Mercurial > ~dholland > hg > ag > index.cgi
diff tests/agcl/examples/good/dsl.h @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/agcl/examples/good/dsl.h Sat Dec 22 17:52:45 2007 -0500 @@ -0,0 +1,104 @@ +#ifndef DSL_H +#define DSL_H + +typedef union { + long alignment; + char ag_vt_2[sizeof(int)]; + char ag_vt_3[sizeof(long)]; + char ag_vt_4[sizeof(char *)]; + char ag_vt_5[sizeof(unsigned)]; + char ag_vt_6[sizeof(screen_descriptor *)]; + char ag_vt_7[sizeof(query_item *)]; +} dsl_vs_type; + +typedef enum { + dsl_ws_token = 1, dsl_white_token = 10, dsl_comment_token, + dsl_comment_head_token, dsl_not_eol_token = 18, + dsl_script_file_token = 21, dsl_execution_block_token, + dsl_declaration_token, dsl_eof_token = 27, dsl_word_token, + dsl_integer_variable_token, dsl_string_variable_token, + dsl_undeclared_variable_token, dsl_parameter_string_token = 34, + dsl_string_token = 36, dsl_param_word_token = 38, dsl_text_char_token, + dsl_action_text_token, dsl_action_text_head_token, + dsl_action_word_token = 44, dsl_action_parameter_string_token = 46, + dsl_action_param_word_token, dsl_paren_string_chars_token, + dsl_paren_string_char_token = 51, dsl_not_paren_token, + dsl_string_chars_token = 54, dsl_string_char_token = 56, + dsl_not_double_quote_token, dsl_escape_sequence_token, + dsl_octal_escape_token = 70, dsl_hex_escape_token, dsl_one_octal_token, + dsl_two_octal_token, dsl_three_octal_token, dsl_hex_number_token = 78, + dsl_hex_digit_token, dsl_command_token, dsl_identifier_token, + dsl_parameters_token, dsl_piped_command_token = 85, + dsl_command_sequence_token = 91, dsl_if_sequence_token, + dsl_statement_token = 94, dsl_if_statement_token = 96, + dsl_if_condition_token, dsl_conditional_exp_token = 99, + dsl_assignment_token, dsl_for_statement_token, + dsl_screen_description_token, dsl_while_statement_token, + dsl_string_exp_token = 108, dsl_primary_exp_token = 110, + dsl_letter_token = 120, dsl_digit_token, dsl_logical_or_exp_token, + dsl_logical_and_exp_token = 125, dsl_inclusive_or_exp_token = 127, + dsl_exclusive_or_exp_token = 129, dsl_and_exp_token, + dsl_equality_exp_token = 132, dsl_relational_exp_token = 134, + dsl_shift_exp_token = 137, dsl_additive_exp_token = 140, + dsl_multiplicative_exp_token = 142, dsl_unary_exp_token = 145, + dsl_nonzero_token = 148, dsl_string_term_token = 152, + dsl_string_element_token, dsl_numeric_name_token, dsl_built_in_name_token, + dsl_built_in_argument_token, dsl_string_name_token, + dsl_undefined_name_token, dsl_hex_constant_token = 161, + dsl_octal_constant_token, dsl_decimal_constant_token, + dsl_char_constant_element_token = 172, dsl_not_single_quote_token, + dsl_screen_items_token, dsl_formula_token = 177, dsl_color_spec_token, + dsl_query_line_token = 184, dsl_button_line_token, + dsl_formula_element_token = 193, dsl_eol_token = 200, + dsl_paren_string_token, dsl_string_literal_token, dsl_literal_token = 208, + dsl_name_token = 223, dsl_literals_token = 225, + dsl_integer_constant_token = 247, dsl_character_constant_token, + dsl__last_token = 263 +} dsl_token_type; + +typedef struct dsl_pcb_struct{ + dsl_token_type token_number, reduction_token, error_frame_token; + int input_code; + int input_value; + int line, column; + int ssx, sn, error_frame_ssx; + int drt, dssx, dsn; + int ss[128]; + dsl_vs_type vs[128]; + int ag_ap; + const char *error_message; + char read_flag; + char exit_flag; + action_pointer input_context; + action_pointer cs[128]; + int bts[128], btsx; + unsigned char * pointer; + unsigned char * la_ptr; + const unsigned char *key_sp; + int save_index, key_state; + char ag_msg[82]; + const int *ag_dtl; + int ag_dsn; +} dsl_pcb_type; + +#ifndef PRULE_CONTEXT +#define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) +#define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) +#define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) +#endif + +#ifndef AG_RUNNING_CODE +/* PCB.exit_flag values */ +#define AG_RUNNING_CODE 0 +#define AG_SUCCESS_CODE 1 +#define AG_SYNTAX_ERROR_CODE 2 +#define AG_REDUCTION_ERROR_CODE 3 +#define AG_STACK_ERROR_CODE 4 +#define AG_SEMANTIC_ERROR_CODE 5 +#endif + +extern dsl_pcb_type dsl_pcb; +void init_dsl(void); +void dsl(void); +#endif +