Annotation of 43BSDReno/contrib/isode-beta/others/quipu/uips/xd/conf_read.y, revision 1.1

1.1     ! root        1: %{
        !             2: #ifndef lint
        !             3: static char *rcsid = "$Header: /f/osi/others/quipu/uips/xd/RCS/conf_read.y,v 7.0 90/06/12 13:12:18 mrose Exp $";
        !             4: #endif
        !             5: 
        !             6: /*
        !             7:  * $Header: /f/osi/others/quipu/uips/xd/RCS/conf_read.y,v 7.0 90/06/12 13:12:18 mrose Exp $
        !             8:  */
        !             9: 
        !            10: /*
        !            11:  * $Log:       conf_read.y,v $
        !            12:  * Revision 7.0  90/06/12  13:12:18  mrose
        !            13:  * *** empty log message ***
        !            14:  * 
        !            15:  * Revision 1.5  90/04/26  10:22:36  emsrssn
        !            16:  * Installation fixed
        !            17:  * 
        !            18:  * 
        !            19:  * Revision 1.4  90/04/25  17:28:06  emsrssn
        !            20:  * Lint tidy up
        !            21:  * 
        !            22:  * 
        !            23:  * Revision 1.3  90/04/19  13:54:07  emsrssn
        !            24:  * keyboard accelerator now activates button highlight.
        !            25:  * 
        !            26:  * search types available is dependent on current position
        !            27:  * to prevent unreasonable searches.
        !            28:  * 
        !            29:  * the help popup changes automatically depending on the 
        !            30:  * position of the cursor
        !            31:  * 
        !            32:  * buttons remain a fixed size when the application is
        !            33:  * resized
        !            34:  * 
        !            35:  * command line options are now handled properly
        !            36:  * 
        !            37:  * logging added
        !            38:  * 
        !            39:  * "reads" are now sorted to show mail address at top etc.
        !            40:  * 
        !            41:  * 
        !            42:  * Revision 1.2  90/03/16  11:32:01  emsrdsm
        !            43:  * *** empty log message ***
        !            44:  * 
        !            45:  * Revision 1.1  90/03/09  16:49:53  emsrdsm
        !            46:  * Initial revision
        !            47:  * 
        !            48:  * Revision 1.1  90/03/09  12:14:12  emsrdsm
        !            49:  * Initial revision
        !            50:  * 
        !            51:  * Revision 1.1  90/03/09  11:43:15  emsrdsm
        !            52:  * Initial revision
        !            53:  * 
        !            54:  */
        !            55: 
        !            56: #include <stdio.h>
        !            57: #include <ctype.h>
        !            58: #include "filt.h"
        !            59: #include "symtab.h"
        !            60: 
        !            61: extern make_type();
        !            62: extern filt_struct *make_item_filter();
        !            63: extern filt_struct *link_filters();
        !            64: extern filt_struct *make_parent_filter();
        !            65: extern put_symbol_value();
        !            66: 
        !            67: extern FILE *file;
        !            68: extern int curr_filt;
        !            69: extern char **file_names;
        !            70: extern table_entry symtab;
        !            71: %}
        !            72: %start type_spec
        !            73: 
        !            74: %union {
        !            75:        filt_struct *filt;
        !            76:        char strval[255];
        !            77:        int symbol;
        !            78: }
        !            79: 
        !            80: %token NUMBER NAME DEFAULT STRING OID AND OR NOT APPROX EQUAL ITEM
        !            81: 
        !            82: %type <filt> filter filter_list assertion filter_item
        !            83: %type <symbol> filt_type match
        !            84: %token <symbol> NOT AND OR APPROX EQUAL SUBSTRING
        !            85: %token <symbol> '"' ':' '(' ')'
        !            86: %token <strval> STRING OID
        !            87: %type  <strval> name default
        !            88: 
        !            89: %%
        !            90:  type_spec    :        name filter             {make_type($1, $2);}
        !            91:              ; 
        !            92: 
        !            93:  name         :        NAME ':' STRING                 {(void) strcpy($$, $3);}
        !            94:              ;
        !            95: 
        !            96:  default      :        DEFAULT ':' STRING              {(void) strcpy($$, $3);}
        !            97:               |                                        {(void) strcpy($$, "\0");}
        !            98:              ;
        !            99: 
        !           100:  assertion    : '(' filt_type filter filter filter_list ')'    {$$ = make_parent_filter($2, $3, $4, $5);}
        !           101:              | '(' NOT filter ')'                              {$$ = make_parent_filter($2, $3, (filt_struct *) 0,(filt_struct *) 0);}
        !           102:              | filter_item                                     {$$ = $1;}
        !           103:              ;
        !           104: 
        !           105:  filter_list  : filter filter_list                     {$$ = link_filters($1, $2);}
        !           106:              | filter                                  {$$ = $1;}
        !           107:              |                                         {$$ = (filt_struct *) 0;}
        !           108:              ;
        !           109: 
        !           110:  filter       : filter_item                    {$$ = $1;}
        !           111:              | assertion                       {$$ = $1;}
        !           112:              ;
        !           113: 
        !           114:  filter_item  : '(' OID match STRING ')'       {$$ = make_item_filter($2, $3, $4);}
        !           115:              ;
        !           116: 
        !           117:  match        : APPROX                         {$$ = $1;}
        !           118:              | EQUAL                           {$$ = $1;}
        !           119:              | SUBSTRING                       {$$ = $1;}
        !           120:              ;
        !           121: 
        !           122:  filt_type    : AND                            {$$ = $1;}
        !           123:              | OR                              {$$ = $1;}
        !           124:              ;
        !           125: %%
        !           126: 
        !           127: yylex()
        !           128: {
        !           129:        int c, count = 0;
        !           130:        char lexeme[255];
        !           131: 
        !           132:        while(iswspace(c = getc(file)))
        !           133:                if (c == EOF) return(0);
        !           134: 
        !           135:         lexeme[count++] = c;
        !           136:        
        !           137:        switch(c) {
        !           138:              case '#':
        !           139:                while (getc(file) != '\n');
        !           140:                return(yylex());
        !           141: 
        !           142:               case '"':
        !           143:                count = 0;
        !           144:                while ((c = getc(file)) != '"')
        !           145:                        lexeme[count++] = c;
        !           146:                lexeme[count] = '\0';
        !           147:                (void) strcpy(yylval.strval, lexeme);
        !           148:                return STRING;
        !           149: 
        !           150:              case '$':
        !           151:                while (!iswspace((c = getc(file))) && !issymbol(c))
        !           152:                        lexeme[count++] = c;
        !           153:                lexeme[count] = '\0';
        !           154:                put_symbol_value(symtab, lexeme+1, (char *) 0);
        !           155:                (void) strcpy(yylval.strval, lexeme);
        !           156:                 return STRING;
        !           157: 
        !           158:              case '(':
        !           159:                return (int) c;
        !           160:              case ')':
        !           161:                return (int) c;
        !           162:              case ':':
        !           163:                return (int) c;
        !           164:              case '&':
        !           165:                yylval.symbol = AND;
        !           166:                return AND;
        !           167:              case '|':
        !           168:                yylval.symbol = OR;
        !           169:                return OR;
        !           170:              case '!':
        !           171:                yylval.symbol = NOT;
        !           172:                return NOT;
        !           173:              case '*':
        !           174:                lexeme[count] = '\0';
        !           175:                (void) strcpy(yylval.strval, lexeme);
        !           176:                return STRING;
        !           177:              case '~':
        !           178:                if((lexeme[count] = getc(file)) == '=') {
        !           179:                        yylval.symbol = APPROX;
        !           180:                        return APPROX;
        !           181:                      }                 
        !           182:                break;
        !           183:              case '%':
        !           184:                if((lexeme[count] = getc(file)) == '=') {
        !           185:                         yylval.symbol = SUBSTRING;
        !           186:                        return SUBSTRING;
        !           187:                      }
        !           188:                
        !           189:              case '=':
        !           190:                yylval.symbol = EQUAL;
        !           191:                return EQUAL;
        !           192:              }
        !           193: 
        !           194:        while(!iswspace(c = getc(file)) && c != '\0' && !issymbol(c))
        !           195:                if (c != EOF)
        !           196:                        lexeme[count++] = c;
        !           197:                else
        !           198:                        return(0);
        !           199: 
        !           200:        (void) fseek(file,(long) -1, 1);
        !           201: 
        !           202:        lexeme[count] = '\0';
        !           203:        switch(*lexeme) {
        !           204:              case 'd':
        !           205:              case 'D':
        !           206:                if(!strcmp(lexeme, "default") || !strcmp(lexeme, "DEFAULT"))
        !           207:                        return DEFAULT;
        !           208:                else {
        !           209:                        (void) strcpy(yylval.strval, lexeme);
        !           210:                        return STRING;
        !           211:                }
        !           212: 
        !           213:              case 'n':
        !           214:              case 'N':
        !           215:                if(!strcmp(lexeme, "name") || !strcmp(lexeme, "NAME"))
        !           216:                        return NAME;
        !           217:                else {
        !           218:                         (void) strcpy(yylval.strval, lexeme);
        !           219:                        return STRING;
        !           220:                }
        !           221: 
        !           222:              case '0':
        !           223:              case '1':
        !           224:              case '2':
        !           225:              case '3':
        !           226:              case '4':
        !           227:              case '5':
        !           228:              case '6':
        !           229:              case '7':
        !           230:              case '8':
        !           231:              case '9':
        !           232:                count = 0;
        !           233:                while (isdigit(lexeme[count]) || lexeme[count] == '.') count++;
        !           234:                if (lexeme[count] == '\0') {
        !           235:                        (void) strcpy(yylval.strval, lexeme);
        !           236:                        return OID;
        !           237:                } else {
        !           238:                        (void) strcpy(yylval.strval, lexeme);
        !           239:                        return STRING;
        !           240:                }
        !           241: 
        !           242:              default:
        !           243:                (void) strcpy(yylval.strval, lexeme);
        !           244:                return STRING;
        !           245:        }
        !           246: }
        !           247: 
        !           248: yyerror(str)
        !           249: char *str;
        !           250: {
        !           251:         (void) fprintf(stderr, "%s: ", str);
        !           252:        (void) fprintf(stderr, "Parse error in -\n");
        !           253: }
        !           254: 
        !           255: int
        !           256: issymbol(c)
        !           257: char c;
        !           258: {
        !           259:        switch(c) {
        !           260:              case '#':
        !           261:                 return 1;
        !           262:               case '"':
        !           263:                 return 1;
        !           264:              case '(':
        !           265:                return 1;
        !           266:              case ')':
        !           267:                return 1;
        !           268:              case ':':
        !           269:                return 1;
        !           270:              case '&':
        !           271:                return 1;
        !           272:              case '|':
        !           273:                return 1;
        !           274:              case '!':
        !           275:                return 1;
        !           276:              case '*':
        !           277:                return 1;
        !           278:              case '~':
        !           279:                return 1;
        !           280:              case '=':
        !           281:                return 1;
        !           282:              case '$':
        !           283:                return 1;
        !           284:              case '%':
        !           285:                return 1;
        !           286:        }
        !           287:        return 0;
        !           288: }
        !           289: 
        !           290: int
        !           291: iswspace(c)
        !           292: char c;
        !           293: {
        !           294:        switch(c) {
        !           295:              case ' ':
        !           296:                return 1;
        !           297:              case '\n':
        !           298:                return 1;
        !           299:              case '\t':
        !           300:                return 1;
        !           301:        }
        !           302:        return 0;
        !           303: }
        !           304: 
        !           305: 
        !           306: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.