version 1.4, 1999/10/18 20:58:33
|
version 1.10, 2000/03/22 21:08:03
|
Line 36
|
Line 36
|
case S_VAR: case S_CONSTANT: \ |
case S_VAR: case S_CONSTANT: \ |
printf("STR(%s)\n",(xx)->s_str); break; \ |
printf("STR(%s)\n",(xx)->s_str); break; \ |
} } |
} } |
#else |
#else /* YACC_DBUG */ |
#define YYDBUG_PR1(xx) { } |
#define YYDBUG_PR1(xx) { } |
#define YYDBUG_PR2(xx,yy) { } |
#define YYDBUG_PR2(xx,yy) { } |
#define YYDBUG_PR3(xx,yy,zz) { } |
#define YYDBUG_PR3(xx,yy,zz) { } |
#define YYDBUG_PR4(xx,yy,zz,aa) { } |
#define YYDBUG_PR4(xx,yy,zz,aa) { } |
#define YYDBUG_SYM(xx) { } |
#define YYDBUG_SYM(xx) { } |
#endif |
#endif /* YACC_DBUG */ |
|
|
int yylex(); |
int yylex(); |
void yyerror(char*); |
void yyerror(char*); |
void free_calc_expr(Symbol*); |
void free_calc_expr(Symbol*); |
|
void assign_pts (Symbol *, Symbol *, Symbol *); |
/******************************************************************************/ |
/******************************************************************************/ |
/* GLOBAL VARIABLES */ |
/* GLOBAL VARIABLES */ |
/******************************************************************************/ |
/******************************************************************************/ |
Line 117 PointsList_t *LastPtsList;
|
Line 118 PointsList_t *LastPtsList;
|
%token ANS_OFF ANS_ON ANS_OR ANS_ORDERED |
%token ANS_OFF ANS_ON ANS_OR ANS_ORDERED |
%token ANS_PATH ANS_PCREDIT ANS_PLUS ANS_RANGE |
%token ANS_PATH ANS_PCREDIT ANS_PLUS ANS_RANGE |
%token ANS_SHOW_BR ANS_SIG ANS_TOLERANCE ANS_TRY ANS_TYPE |
%token ANS_SHOW_BR ANS_SIG ANS_TOLERANCE ANS_TRY ANS_TYPE |
%token ANS_UNFMT ANS_UNIT ANS_WEIGHT |
%token ANS_UNFMT ANS_UNIT ANS_VERBATIM ANS_WEIGHT |
%token VAR_RANGE VERBATIM |
%token VAR_RANGE VERBATIM |
%token SLASH FORMAT |
%token SLASH FORMAT |
%token EQ_op NE_op GT_op GE_op LT_op LE_op AND_op OR_op EoL |
%token EQ_op NE_op GT_op GE_op LT_op LE_op AND_op OR_op EoL |
Line 287 statement : IDENTIFIER '=' calc_expr
|
Line 288 statement : IDENTIFIER '=' calc_expr
|
; |
; |
|
|
rqo_def : rqo_speca { rqo_1spec(); } |
rqo_def : rqo_speca { rqo_1spec(); } |
| rqo_speca "," rqo_def { rqo_2spec(); } |
| rqo_speca ',' rqo_def { rqo_2spec(); } |
; |
; |
|
|
rqo_speca : an_integer {start_rqo_type(SINGLE);append_rqo($1);} |
rqo_speca : an_integer {start_rqo_type(SINGLE);append_rqo($1);} |
| an_integer "!" {start_rqo_type(IMMOBILE);append_rqo($1);} |
| an_integer '!' {start_rqo_type(IMMOBILE);append_rqo($1);} |
| an_integer "-" an_integer {start_rqo_type(RANGE);append_rqo($1); |
| an_integer '-' an_integer {start_rqo_type(RANGE);append_rqo($1); |
append_rqo($3); |
append_rqo($3); |
} |
} |
| an_integer "~" rqo_specb {prefix_rqo($1);} |
| an_integer '~' rqo_specb {prefix_rqo($1);} |
| an_integer "+" rqo_specc {prefix_rqo($1);} |
| an_integer '+' rqo_specc {prefix_rqo($1);} |
; |
; |
|
|
rqo_specb : an_integer {start_rqo_type(ALL_MIX);append_rqo($1);} |
rqo_specb : an_integer {start_rqo_type(ALL_MIX);append_rqo($1);} |
| an_integer "~" rqo_specb {prefix_rqo($1);} |
| an_integer '~' rqo_specb {prefix_rqo($1);} |
| an_integer "+" an_integer {start_rqo_type(LAST_FIXED);append_rqo($1); |
| an_integer '+' an_integer {start_rqo_type(LAST_FIXED);append_rqo($1); |
append_rqo($3);} |
append_rqo($3);} |
; |
; |
|
|
rqo_specc : an_integer {start_rqo_type(ALL_FIXED);append_rqo($1);} |
rqo_specc : an_integer {start_rqo_type(ALL_FIXED);append_rqo($1);} |
| an_integer "+" rqo_specd {prefix_rqo($1);} |
| an_integer '+' rqo_specd {prefix_rqo($1);} |
| an_integer "~" rqo_spece {prefix_rqo($1);} |
| an_integer '~' rqo_spece {prefix_rqo($1);} |
; |
; |
|
|
rqo_specd : an_integer {start_rqo_type(ALL_FIXED);append_rqo($1);} |
rqo_specd : an_integer {start_rqo_type(ALL_FIXED);append_rqo($1);} |
| an_integer "+" rqo_specd {prefix_rqo($1);} |
| an_integer '+' rqo_specd {prefix_rqo($1);} |
; |
; |
|
|
rqo_spece : an_integer {start_rqo_type(FIRST_FIXED);append_rqo($1);} |
rqo_spece : an_integer {start_rqo_type(FIRST_FIXED);append_rqo($1);} |
| an_integer "~" rqo_spece {prefix_rqo($1);} |
| an_integer '~' rqo_spece {prefix_rqo($1);} |
| an_integer "+" an_integer {start_rqo_type(BOTH_FIXED);append_rqo($1); |
| an_integer '+' an_integer {start_rqo_type(BOTH_FIXED);append_rqo($1); |
append_rqo($3);} |
append_rqo($3);} |
; |
; |
|
|
Line 375 if_expr : CAPA_IF '(' calc_expr '
|
Line 376 if_expr : CAPA_IF '(' calc_expr '
|
leng = strlen($3->s_str); |
leng = strlen($3->s_str); |
capa_mfree($3->s_str); |
capa_mfree($3->s_str); |
} |
} |
leng = strlen($3->s_str); |
if(leng == 0) { |
if(leng == 0) { |
|
IFstatus[IFcount] = IF_FALSE; |
IFstatus[IFcount] = IF_FALSE; |
begin_if_skip(); |
begin_if_skip(); |
}else{ |
}else{ |
Line 506 ans_infospec : ANS_TOLERANCE '=' a_numbe
|
Line 506 ans_infospec : ANS_TOLERANCE '=' a_numbe
|
} |
} |
| ANS_SHOW_BR '=' ANS_OFF { LexiProblem_p->show_br = DONOT_SHOW; |
| ANS_SHOW_BR '=' ANS_OFF { LexiProblem_p->show_br = DONOT_SHOW; |
} |
} |
|
| ANS_VERBATIM '=' ANS_ON { LexiProblem_p->verbatim = DO_VERBATIM; |
|
} |
|
| ANS_VERBATIM '=' ANS_OFF { LexiProblem_p->verbatim = DONOT_VERBATIM; |
|
} |
| ANS_BOX_SHOW '=' ANS_ON { LexiProblem_p->show_ans_box = DO_SHOW; |
| ANS_BOX_SHOW '=' ANS_ON { LexiProblem_p->show_ans_box = DO_SHOW; |
} |
} |
| ANS_BOX_SHOW '=' ANS_OFF { LexiProblem_p->show_ans_box = DONOT_SHOW; |
| ANS_BOX_SHOW '=' ANS_OFF { LexiProblem_p->show_ans_box = DONOT_SHOW; |
Line 555 pt_list : pt_list ',' point_coo
|
Line 559 pt_list : pt_list ',' point_coo
|
| pt_range { } |
| pt_range { } |
; |
; |
|
|
pt_range : point_coord ':' point_coord '#' IDENTIFIER { PointsList_t *pt; |
pt_range : point_coord ':' point_coord '#' IDENTIFIER |
|
{ |
if( LastPtsList != NULL ) { |
assign_pts($1,$3,$5); |
LastPtsList->pts_next = gen_ptslist( $1, $3, $5 ); |
/*PointsList_t *pt; |
pt = LastPtsList->pts_next; |
if( LastPtsList != NULL ) { |
while( pt->pts_next != NULL ) { |
LastPtsList->pts_next = gen_ptslist( $1, $3, $5 ); |
pt = pt->pts_next; |
pt = LastPtsList->pts_next; |
} |
while( pt->pts_next != NULL ) { |
LastPtsList = pt; |
pt = pt->pts_next; |
} else { |
} |
CurrPtsList = gen_ptslist( $1, $3, $5 ); |
LastPtsList = pt; |
LastPtsList = CurrPtsList; |
} else { |
} |
CurrPtsList = gen_ptslist( $1, $3, $5 ); |
if( $1->s_type == S_CONSTANT ) { |
LastPtsList = CurrPtsList; |
capa_mfree($1->s_str); capa_mfree((char *)$1); |
} |
} |
if( $1->s_type == S_CONSTANT ) { |
if( $3->s_type == S_CONSTANT ) { |
capa_mfree($1->s_str); capa_mfree((char *)$1); |
capa_mfree($3->s_str); capa_mfree((char *)$3); |
} |
} |
if( $3->s_type == S_CONSTANT ) { |
} |
capa_mfree($3->s_str); capa_mfree((char *)$3); |
| point_coord ':' point_coord '#' a_number { PointsList_t *pt; |
} |
|
*/ |
if( LastPtsList != NULL ) { |
} |
LastPtsList->pts_next = gen_ptslist( $1, $3, $5 ); |
| point_coord ':' point_coord '#' ARRAY_ID '[' calc_expr ']' |
pt = LastPtsList->pts_next; |
{ assign_pts($1,$3,get_array_symbol($5,$7,1)); } |
while( pt->pts_next != NULL ) { |
| point_coord ':' point_coord '#' a_number |
pt = pt->pts_next; |
{ |
} |
assign_pts($1,$3,$5); |
LastPtsList = pt; |
/*PointsList_t *pt; |
} else { |
|
CurrPtsList = gen_ptslist( $1, $3, $5 ); |
if( LastPtsList != NULL ) { |
LastPtsList = CurrPtsList; |
LastPtsList->pts_next = gen_ptslist( $1, $3, $5 ); |
} |
pt = LastPtsList->pts_next; |
if( $1->s_type == S_CONSTANT ) { |
while( pt->pts_next != NULL ) { |
capa_mfree($1->s_str); capa_mfree((char *)$1); |
pt = pt->pts_next; |
} |
} |
if( $3->s_type == S_CONSTANT ) { |
LastPtsList = pt; |
capa_mfree($3->s_str); capa_mfree((char *)$3); |
} else { |
} |
CurrPtsList = gen_ptslist( $1, $3, $5 ); |
if( $5->s_type == I_CONSTANT || $5->s_type == R_CONSTANT) { |
LastPtsList = CurrPtsList; |
capa_mfree((char *)$5); |
} |
} |
if( $1->s_type == S_CONSTANT ) { |
} |
capa_mfree($1->s_str); capa_mfree((char *)$1); |
|
} |
|
if( $3->s_type == S_CONSTANT ) { |
|
capa_mfree($3->s_str); capa_mfree((char *)$3); |
|
} |
|
if( $5->s_type == I_CONSTANT || $5->s_type == R_CONSTANT) { |
|
capa_mfree((char *)$5); |
|
} |
|
*/ |
|
} |
; |
; |
|
|
|
|
point_coord : IDENTIFIER { $$ = $1; } |
point_coord : IDENTIFIER { $$ = $1; } |
| S_CONSTANT { $$ = $1; } |
| ARRAY_ID '[' calc_expr ']' { $$ = get_array_symbol($1,$3,1); } |
|
| S_CONSTANT { $$ = $1; } |
; |
; |
|
|
|
|
Line 835 an_integer : I_CONSTANT
|
Line 849 an_integer : I_CONSTANT
|
a_real : R_CONSTANT { $$ = $1; } |
a_real : R_CONSTANT { $$ = $1; } |
; |
; |
|
|
an_array : ARRAY_ID '[' calc_expr ']' { $$=get_array_symbol($1,$3,1); } |
an_array : ARRAY_ID '[' calc_expr ']' { |
|
YYDBUG_PR1(" an_array <= ARRAY_ID '['calc_expr ']' "); |
|
$$=get_array_symbol($1,$3,1); |
|
} |
; |
; |
|
|
startQ : { /* first matching will occur before first line of input text */ |
startQ : { /* first matching will occur before first line of input text */ |
Line 918 Symbol *name,*index;int free_symbols;
|
Line 935 Symbol *name,*index;int free_symbols;
|
sprintf(key,"%s[%s]",name->s_name,tmp); |
sprintf(key,"%s[%s]",name->s_name,tmp); |
|
|
a_p = find_arrayid(name->s_name); /* use the array name to search array tree */ |
a_p = find_arrayid(name->s_name); /* use the array name to search array tree */ |
/* */ |
/* did not check for error! */ |
s_p = find_array_by_index(a_p,key); /* use the index portion to search along array linked list */ |
s_p = find_array_by_index(a_p,key); /* use the index portion to search along array linked list */ |
capa_mfree((char *)tmp); capa_mfree((char *)key); |
capa_mfree((char *)tmp); capa_mfree((char *)key); |
|
|
Line 1079 append_warn(type,str) int type;char *str
|
Line 1096 append_warn(type,str) int type;char *str
|
/*********** if *b is a constant symbol, destroy (free) b ********************/ |
/*********** if *b is a constant symbol, destroy (free) b ********************/ |
/*********** if *a is a var symbol, create a new symbol **********************/ |
/*********** if *a is a var symbol, create a new symbol **********************/ |
/* do not free(*a) */ |
/* do not free(*a) */ |
/* */ |
/* If either a or b is invalid it propagates the error up the parse tree */ |
Symbol * |
Symbol * |
symbols_op(a, b, op) Symbol *a; Symbol *b; int op; |
symbols_op(a, b, op) Symbol *a; Symbol *b; int op; |
{ |
{ |
Line 1094 if( a->s_type == IDENTIFIER || b->s_type
|
Line 1111 if( a->s_type == IDENTIFIER || b->s_type
|
if(a->s_type == IDENTIFIER) { /* a is IDENTIFIER */ |
if(a->s_type == IDENTIFIER) { /* a is IDENTIFIER */ |
sprintf(warn_msg,"var \"%s\" not defined before use.\n", a->s_name); |
sprintf(warn_msg,"var \"%s\" not defined before use.\n", a->s_name); |
capa_msg(MESSAGE_ERROR,warn_msg); |
capa_msg(MESSAGE_ERROR,warn_msg); |
return (b); |
return (a); |
} else { /* b is IDENTIFIER */ |
} else { /* b is IDENTIFIER */ |
sprintf(warn_msg, |
sprintf(warn_msg,"var \"%s\" not defined before use.\n",b->s_name); |
"var \"%s\" not defined before use.\n",b->s_name); |
|
capa_msg(MESSAGE_ERROR,warn_msg); |
capa_msg(MESSAGE_ERROR,warn_msg); |
return (a); |
return (b); |
} |
} |
} else { /* a and b are neither identifiers */ |
} else { /* a and b are neither identifiers */ |
if( (a->s_type == I_VAR) || |
if( (a->s_type == I_VAR) || |
Line 1790 assign_id_list( s ) Symbol *s;
|
Line 1806 assign_id_list( s ) Symbol *s;
|
} |
} |
} |
} |
|
|
|
/* void assign_pts ( Symbol* coord1, Symbol* coord2, Symbol* num) { */ |
|
void assign_pts (coord1, coord2, num)Symbol *coord1;Symbol *coord2;Symbol *num; |
|
{ |
|
PointsList_t *pt; |
|
if( LastPtsList != NULL ) { |
|
LastPtsList->pts_next = gen_ptslist( coord1, coord2, num ); |
|
pt = LastPtsList->pts_next; |
|
while( pt->pts_next != NULL ) { |
|
pt = pt->pts_next; |
|
} |
|
LastPtsList = pt; |
|
} else { |
|
CurrPtsList = gen_ptslist( coord1, coord2, num ); |
|
LastPtsList = CurrPtsList; |
|
} |
|
if(coord1->s_type == S_CONSTANT) { |
|
capa_mfree(coord1->s_str); capa_mfree((char *)coord1); |
|
} |
|
if(coord2->s_type == S_CONSTANT) { |
|
capa_mfree(coord2->s_str); capa_mfree((char *)coord2); |
|
} |
|
if(num->s_type == I_CONSTANT || num->s_type == R_CONSTANT) { |
|
capa_mfree((char *)num); |
|
} |
|
} |
|
|
/* =========================================================================== */ |
/* =========================================================================== */ |
|
|
|
|