/* ===================================================================== Source: input.rule ===================================================================== */ end_input : { $$=0;} | events_input END_INPUT { $$= $1;} | END_INPUT { $$=0;} ; end_input_array : { $$=0;} | events_iarray END_INPUT { $$= $1;} | END_INPUT { $$=0;} ; opt_defs : { $$=EB_FALSE; } | WITHOUT_DEFAULTS { $$=EB_TRUE; } ; bef_field_list_as_struct : field_name_as_struct { $$=new_field_list(); $$=append_field_to_list($$,$1); } | bef_field_list_as_struct KW_COMMA field_name_as_struct { $$=append_field_to_list($1,$3); } ; aft_field_list_as_struct : field_name_as_struct { $$=new_field_list(); $$=append_field_to_list($$,$1); } |aft_field_list_as_struct KW_COMMA field_name_as_struct { $$=append_field_to_list($1,$3); } ; next_field_cmd : NEXTFIELD atline KW_NEXT { set_cmdlineno($2); $$=new_next_field_cmd(1, NULL); map_ui("NEXTFIELD"); } | NEXTFIELD atline KW_PREVIOUS { set_cmdlineno($2); $$=new_next_field_cmd(-1, NULL); map_ui("NEXTFIELD"); } | NEXTFIELD atline field_name_as_struct {set_cmdlineno($2); $$=new_next_field_cmd(0, $3); map_ui("NEXTFIELD"); } ; input_cmd : KW_INPUT atline { set_cmdlineno($2); } inp_rest { A4GL_new_events(); push_blockcommand ("INPUT"); } end_input { int sio; int blk; blk=get_sio_ids("INPUT"); $$=$4; sio=get_sio_id("INPUT"); $$->cmd_data.command_data_u.input_cmd.sio=sio; $$->cmd_data.command_data_u.input_cmd.blockid=blk; pop_blockcommand ("INPUT"); map_ui_endblock("INPUT"); A4GL_drop_events(); $$->cmd_data.command_data_u.input_cmd.events=$6; } ; input_array_cmd : KW_INPUT_ARRAY variable_usage_expression opt_slice opt_defs FROM idm_input_array atline { if (!check_input_or_display_array_variable($2)) { a4gl_yyerror("Variable cannot be used for an INPUT ARRAY"); } push_blockcommand ("INPUT"); add_feature("UI_INPUT_ARRAY"); map_ui_block("INPUT_ARRAY"); inp_flags=0; A4GL_new_events(); } input_attributes opt_help_no_i end_input_array { int blk; int sio; blk=get_sio_ids("INPUT"); sio=get_sio_id("INPUT"); pop_blockcommand ("INPUT"); set_cmdlineno($7); $$=new_input_array_cmd($6, $2, $9,$11, $4, $10,sio,blk,$3); map_ui_endblock("INPUT"); A4GL_drop_events(); } ; input_attributes: opt_attributes {$$=$1;} ; inp_rest: BY_NAME expanded_ibind_var_list opt_defs input_attributes opt_help_no_i { //struct fh_field_list *f; //char tabname[40]; //int a; //char colname[40]; map_ui_block("INPUT"); add_feature("UI_INPUT_BY_NAME"); $$=new_input_cmd(expand_variables_in_expr_str_list($2,1,1), NULL,NULL, $4,$3, $5,0); } | expanded_ibind_var_list opt_defs FROM field_name_list_as_struct input_attributes opt_help_no_i { map_ui_block("INPUT"); add_feature("UI_INPUT"); $$=new_input_cmd(expand_variables_in_expr_str_list($1,1,1), $4,NULL, $5,$2, $6, 0); } ; idm_input_array :identifier KW_DOT KW_MULTIPLY { $$=A4GL_new_expr_simple_string($1,ET_EXPR_IDENTIFIER); } | VARIABLE OPEN_BRACKET char_or_var_vl CLOSE_BRACKET { $$=A4GL_new_expr_simple_expr($3, ET_EXPR_VARIABLE_IDENTIFIER); } ; scroll_cmd : SCROLL field_name_list_as_struct up_or_down { map_ui("SCROLL"); add_feature("UI_SCROLL"); $$=new_scroll_cmd($2,chk_expr($3)); } ; up_or_down : KWUP_BY INT_VALUE { SPRINTF1($$,"%s",$2); $$=A4GL_new_literal_long_str($$); } | KWDOWN_BY INT_VALUE { SPRINTF1($$,"-%s",$2); $$=A4GL_new_literal_long_str($$); } | KWUP { strcpy($$,"1"); $$=A4GL_new_literal_long_str($$); } | KWDOWN { strcpy($$,"-1"); $$=A4GL_new_literal_long_str($$); } | KWUP_BY variable_usage_expression { int a; char errbuff[256]; a=get_variable_dtype_from_variable_usage_expression(errbuff,$2); if (a==-1) { a4gl_yyerror(errbuff); YYERROR; } else { a=a&DTYPE_MASK; if (a!=DTYPE_INT&&a!=DTYPE_SMINT && a!=DTYPE_SERIAL) { a4gl_yyerror("Only INTEGER/SMALLINT variables may be here"); YYERROR; /* error processing */; } } $$=$2; } | KWDOWN_BY variable_usage_expression { int a; char errbuff[256]; a=get_variable_dtype_from_variable_usage_expression(errbuff, $2); if (a==-1) { a4gl_yyerror(errbuff); YYERROR; } else { a=a&DTYPE_MASK; if (a!=DTYPE_INT&&a!=DTYPE_SMINT && a!=DTYPE_SERIAL) { a4gl_yyerror("Only INTEGER/SMALLINT variables may be here"); YYERROR; /* error processing */; } } $$=A4GL_new_op_expr(A4GL_new_literal_long_str("0"),$2,ET_EXPR_OP_SUB,0); } ; input_array_attributes: input_array_attributes_int ; input_array_attributes_int : CURRENT_ROW_DISPLAY_EQUAL fgl_expr_c { curr_attrib.currentrowdisplayexpr=$2; } | COUNT EQUAL INT_VALUE { curr_attrib.count=new_variable_or_literal( ET_E_V_OR_LIT_INT, $3); } | COUNT EQUAL ensured_variable_usage_expression { curr_attrib.count=$3; } | MAXCOUNT EQUAL INT_VALUE { curr_attrib.maxcount=new_variable_or_literal( ET_E_V_OR_LIT_INT, $3); } | MAXCOUNT EQUAL ensured_variable_usage_expression { curr_attrib.maxcount=$3; } | INSERT_ROW_EQUAL_TRUE { curr_attrib.allow_insert=EB_TRUE; } | INSERT_ROW_EQUAL_FALSE { curr_attrib.allow_insert=EB_FALSE; } | DELETE_ROW_EQUAL_TRUE { curr_attrib.allow_delete=EB_TRUE; } | DELETE_ROW_EQUAL_FALSE { curr_attrib.allow_delete=EB_FALSE; } ; opt_slice : {strcpy($$,"");} | SLICE OPEN_BRACKET identifier THRU identifier CLOSE_BRACKET { SPRINTF2($$,"%s:%s",$3,$5); } ; /* ========================= input.rule ============================= */