|
|
1.1 ! root 1: %{ ! 2: #include "patchl.h" ! 3: struct PatchInfo argInfo; ! 4: static void assign_fn(); ! 5: %} ! 6: %union { ! 7: int num; ! 8: Vname name; ! 9: struct PatchInfo pinfo; ! 10: } ! 11: %token PEEK ASSIGN COLON IN OUT MAKEDEV LPAREN RPAREN COMMA SIZE ! 12: %token <num> NUMBER ! 13: %token <name> VARIABLE ! 14: %type <num> number ! 15: %start arg ! 16: %% ! 17: arg : peek_arg ! 18: | assign_arg ! 19: | con_in_arg ! 20: | con_out_arg ! 21: ; ! 22: ! 23: peek_arg : VARIABLE PEEK { ! 24: argInfo.piType = peek_arg; ! 25: strncpy(argInfo.piData.peekData.vname, $1, ! 26: PATCH_VAR_NAME_LENGTH); ! 27: }; ! 28: ! 29: assign_arg : VARIABLE ASSIGN number { ! 30: assign_fn($1, $3); ! 31: } ! 32: | VARIABLE ASSIGN NUMBER COLON SIZE { ! 33: assign_fn($1, $3); ! 34: }; ! 35: ! 36: con_in_arg : VARIABLE COLON NUMBER COLON IN { ! 37: argInfo.piType = con_in_arg; ! 38: strncpy(argInfo.piData.conData.vname, $1, ! 39: PATCH_VAR_NAME_LENGTH); ! 40: argInfo.piData.conData.maj = $3; ! 41: }; ! 42: ! 43: con_out_arg : VARIABLE COLON NUMBER COLON OUT { ! 44: argInfo.piType = con_out_arg; ! 45: strncpy(argInfo.piData.conData.vname, $1, ! 46: PATCH_VAR_NAME_LENGTH); ! 47: argInfo.piData.conData.maj = $3; ! 48: }; ! 49: ! 50: number : NUMBER { ! 51: $$ = $1; ! 52: } ! 53: | MAKEDEV LPAREN NUMBER COMMA NUMBER RPAREN { ! 54: $$ = ($3 << 8) | $5; ! 55: } ! 56: ; ! 57: ! 58: %% ! 59: static void assign_fn(var, val) ! 60: char * var; ! 61: int val; ! 62: { ! 63: argInfo.piType = assign_arg; ! 64: strncpy(argInfo.piData.assignData.vname, var, ! 65: PATCH_VAR_NAME_LENGTH); ! 66: argInfo.piData.assignData.newValue = val; ! 67: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.