#pragma once #include "extval.h" /* This routine is common to both the Mac and IBM versions, along with parse.c pback.c and putil.c RAM Nov 91: Test change to eliminate LEPO & compound error. RAM Jul 90: Made changes for new Pause control. RAM Mar 90: Made changes for soi, sue, hoi, hue. RAM Mar 90: Allowed for separation of ICA from I again. RAM Mar 89: Restored ICA to I and changed Pause() considerably. Renamed numbered lexemes. RAM Feb 89: Allowed for separation of ICA from I and RANITAI compounds RAM Feb 89: Inserted InsZe2() to avoid a required comma in text; RAM Nov 88: History removed to separate file to which these items will be periodically added. Allowed for dacine and cousins, as well as nifi and cousins. Also will have to do something about pause. RAM Jul 87. Boolean was changed from character to integer to avoid problems with signed characters? As a result the call to setmem below had to be changed to clear twice as many bytes */ short freefix(short start,short tlex) /*This routine separates out freemods for separate parsing by altering the lexemes by multiplication by a multiple of 1000. On entry start is the word number being examined, and tlex a lexeme that must be paired with a second lexeme*/ { short i,base,nlex,val,j,k; val = 0; base = addend; /*Addend is global, so is initially 0 */ for (i = start; i= 4) /* mark pairs from right */ while ((ichar -= 2) > first) brkmap[ichar] = TRUE; else if (last - first == 3) { if (first == 0) brkmap[1] = TRUE; else if (MatchList (&wd[first], "ai:", "ei:", NULL)) brkmap [first + 2] = TRUE; /* consonant name */ else brkmap [first + 1] = TRUE; } else if ((last - first == 1) && !(first &&IsCons(wd[first-1]))) { if (MatchList (&wd[last], "zi:", "fi:", NULL)){ brkmap [last] = FALSE; brkmap [last + 2] = TRUE; /* vowel name */ } } ichar = last; /* pick up at next C */ } for (ichar = 0; ichar < tlen; ++ichar) if (brkmap[ichar] && !brkmap [ichar + 2] && ((MatchList (&wd[ichar], "noV:", NULL) && wd [ichar + 2] != 'i') || MatchList (&wd[ichar], "nuu:", NULL))) brkmap [ichar + 2] = TRUE; } void LexOfCPD (char *parts[],short lexeme[],short length) /*Given a bounded string of 2 or more lexemes representing the partition of a current CPD into its constituent LW-lexemes, this function examines lexemes from the beginning. If several are to be considered as one, it recompounds them before adding. It then recursively continues the examination from the last lexeme added.*/ { short i,j,tlex,state; state = 1; /* Initial condition */ /* Certain lexemes [lao, liu + sue] require gobbling of subsequent lexemes. If these occur in the string, discard subsequent*/ for (i=0; i 0) PPJoinNext ("Quote"); } void JoinSOI(void) /* Join SOI with following word as above */ { PPStart(); while (PPFindList (SOI, 0) > 0) PPJoinNext ("free"); } void Pause(void) /* A recent change puts pause removal outside of Parse. If a parse fails because of an unexpected comma, that comma is removed from the lexeme string, and the sentence is reparsed as long as commas cause parse failures. However, inserted right hand ends must be deleted after a failure before looking for commas, and commas before A must be removed to avoid misparses.*/ { short next, flag; PPStart(); while ((flag = PPFindList (PAUSE, 0)) > 0) { next = PPLexeme (1); if (next==A4) PPDelete(); else PPNext(); } } void InsM7(void) /* RAM Jan 88. This now replaces PA2 with PA1 when followed by a pred-sign */ { short curlex, place1,tcont; PPStart(); while ((curlex = PPFindList (PA2, GA2, 0)) > 0) { tcont = curlex/1000; place1 = PPWhere(); PPNext(); if (PredSign()) { lexemes[ppmark[place1]] = PA1+tcont*1000; leaves[ppmark[place1]]->lexeme = PA1; } } } void InsM3M2(void) /* RAM Jan 88. This routine now replaces KA3 with KA2 or KA1 when followed by a pred-sign or linkargs-sign respectively */ { short curlex, place1,tcont; Boolean m5,m4; PPStart(); while ((curlex = PPFindList (NO4, KA3, 0)) > 0) { tcont = curlex/1000; place1 = PPWhere(); PPSkipList (NO4, KA3, 0); m4 = (PPLexeme(0)%1000 != PA1); if ((m5 = PredSign()) || PPLexeme (0) == JE || PPLexeme (0) == JUE) { PPGoto (place1); repeat { curlex = PPLexeme (0)%1000; if (curlex == KA3 && m4) { lexemes[ppiword] = (m5 ? KA2+tcont*1000: KA1+tcont*1000); leaves[ppiword]->lexeme = (m5 ? KA2 : KA1); } else if (curlex != NO4 && curlex != KA3) break; PPNext(); } } } } void InsZe2(void) /* This routine replaces ZE1 with ZE2 before argsign */ // Jul95 Replace ZE1 with A2 and A3 before argmods and linkargs. { short place1,tcont,curlex; PPStart(); while ((curlex=PPFindList (ZE2, 0)) > 0) { tcont = curlex/1000; place1 = PPWhere(); PPNext(); if (PredSign()) { lexemes[ppmark[place1]] = CA+tcont*1000; //Jun 97 leaves[ppmark[place1]]->lexeme = CA; //Jun 97 } else switch (PPLexeme (0)) { case JE: /* linkargs-signs and mod-signs */ case JUE: case PA2: case NO1: lexemes[ppmark[place1]] = A2+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = A2; break; case JI: /* argmod-signs */ case JIO: lexemes[ppmark[place1]] = A3+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = A3; break; default: lexemes[ppmark[place1]] = A4+tcont*1000; //Sept 97 replace ZE2 with A4. leaves[ppmark[place1]]->lexeme = A4; break; } } } void InsGuu2(void) /* This routine replaces GUU1 with GUU2 before ji/jio */ { short place1,tcont,curlex; PPStart(); while ((curlex=PPFindList (GUU1, 0)) > 0) { tcont = curlex/1000; place1 = PPWhere(); PPNext(); switch (PPLexeme (0)) { case JI: case JIO: lexemes[ppmark[place1]] = GUU2+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = GUU2; break; default: break; } } } void InsM8M4(void) /* Replace NO4 with NO3|NO2|NO1 before argsign|markpred|PA */ { short place1,tcont,curlex; PPStart(); while ((curlex=PPFindList (NO4, 0)) > 0) { tcont = curlex/1000; place1 = PPWhere(); PPNext(); if (ArgSign()) { lexemes[ppmark[place1]] = NO3+tcont*1000; //Nov 96? /*Aug88 for test*/ leaves[ppmark[place1]]->lexeme = NO3; } else switch (PPLexeme (0)) { case PO: /* markpred-signs */ case ZO: case PA1: /* RAM Jan 88 This was originally M7 PA, but is now PA1. The preceding NO is changed to NO2 instead of inserting M8 */ lexemes[ppmark[place1]] = NO2+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = NO2; break; /* case KA3: KA followed by unmarked PA is a mod-sign if (PPLexeme (1) != PA2) break; anything else terminates (Deleted) */ case PA2: /*PA not before pred = mod-sign RAM Jan 88, change preceding NO to NO1 instead of inserting M4 */ lexemes[ppmark[place1]] = NO1+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = NO1; break; } } } void InsM10M1M6M5M9M11(void) /* Replace A4 with A1|A2|A3 before pred|linkargs|argmod respectively. Other insertions formerly in this routine were found unnecessary and deleted. */ { short found, place1,tcont,curlex; PPStart(); while ((curlex=PPFindList (A4, ACI, AGE, 0)) > 0) { tcont = curlex/1000; found = PPLexeme (0); place1 = PPWhere(); PPNext(); if (PredSign()) /*RAM Jan88 Instead of inserting M10,M11, and M9, replace A, AGE, and ACI with A1,AGE1,and ACI1. AGE and ACI were reduced to a single lexeme when this change was found unnecessary.*/ { if (found == A4) { lexemes[ppmark[place1]] = A1+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = A1; } /* else if (found == AGE)lexemes[ppmark[place1]] = AGE; else lexemes[ppmark[place1]] = ACI+tcont*1000; //Nov 96?*/ } else switch (PPLexeme (0)) { case JE: /* linkargs-signs and mod-signs */ case JUE: case PA2: //Sep 95 case NO1: //Sep 95 /* RAM Jan 88. Instead of inserting M1, replace A by A2 */ lexemes[ppmark[place1]] = A2+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = A2; break; case JI: /* argmod-signs */ case JIO: /* RAM Jan 88 Instead of inserting M6, replace A by A3 */ lexemes[ppmark[place1]] = A3+tcont*1000; //Nov 96? leaves[ppmark[place1]]->lexeme = A3; break; } } } Boolean ArgSign(void) { switch (PPLexeme (0)%1000) { case DA: case HU: case IE: case KA3: case LE: case LEPO: case LI: case LIE: case LIO: case LIU: case NI: case DIO: case RA: case TAI: case DJAN: return (TRUE); } return (FALSE); } Boolean PredSign(void) /* Determines if at the beginning of an predicate */ { short curplace; Boolean psfound; switch (PPLexeme(0)%1000) { /* RAM Jan 88 In this table, replace the former M7,M3,and M8 by PA,KA2,and NO2 */ case CA: case CUI: case SUE: case GE: case PA1: case KA2: case NO2: case ME: case NU: case PO: case ZO: case PREDA: return (TRUE); case NO4: curplace = PPWhere(); while (PPNext() == NO4) {}; psfound = PredSign(); PPGoto (curplace); return (psfound); default: return (FALSE); } } /* End of PREPARSE.C */