Mercurial > ~dholland > hg > ag > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 #ifndef DSL_H | |
2 #define DSL_H | |
3 | |
4 typedef union { | |
5 long alignment; | |
6 char ag_vt_2[sizeof(int)]; | |
7 char ag_vt_3[sizeof(long)]; | |
8 char ag_vt_4[sizeof(char *)]; | |
9 char ag_vt_5[sizeof(unsigned)]; | |
10 char ag_vt_6[sizeof(screen_descriptor *)]; | |
11 char ag_vt_7[sizeof(query_item *)]; | |
12 } dsl_vs_type; | |
13 | |
14 typedef enum { | |
15 dsl_ws_token = 1, dsl_white_token = 10, dsl_comment_token, | |
16 dsl_comment_head_token, dsl_not_eol_token = 18, | |
17 dsl_script_file_token = 21, dsl_execution_block_token, | |
18 dsl_declaration_token, dsl_eof_token = 27, dsl_word_token, | |
19 dsl_integer_variable_token, dsl_string_variable_token, | |
20 dsl_undeclared_variable_token, dsl_parameter_string_token = 34, | |
21 dsl_string_token = 36, dsl_param_word_token = 38, dsl_text_char_token, | |
22 dsl_action_text_token, dsl_action_text_head_token, | |
23 dsl_action_word_token = 44, dsl_action_parameter_string_token = 46, | |
24 dsl_action_param_word_token, dsl_paren_string_chars_token, | |
25 dsl_paren_string_char_token = 51, dsl_not_paren_token, | |
26 dsl_string_chars_token = 54, dsl_string_char_token = 56, | |
27 dsl_not_double_quote_token, dsl_escape_sequence_token, | |
28 dsl_octal_escape_token = 70, dsl_hex_escape_token, dsl_one_octal_token, | |
29 dsl_two_octal_token, dsl_three_octal_token, dsl_hex_number_token = 78, | |
30 dsl_hex_digit_token, dsl_command_token, dsl_identifier_token, | |
31 dsl_parameters_token, dsl_piped_command_token = 85, | |
32 dsl_command_sequence_token = 91, dsl_if_sequence_token, | |
33 dsl_statement_token = 94, dsl_if_statement_token = 96, | |
34 dsl_if_condition_token, dsl_conditional_exp_token = 99, | |
35 dsl_assignment_token, dsl_for_statement_token, | |
36 dsl_screen_description_token, dsl_while_statement_token, | |
37 dsl_string_exp_token = 108, dsl_primary_exp_token = 110, | |
38 dsl_letter_token = 120, dsl_digit_token, dsl_logical_or_exp_token, | |
39 dsl_logical_and_exp_token = 125, dsl_inclusive_or_exp_token = 127, | |
40 dsl_exclusive_or_exp_token = 129, dsl_and_exp_token, | |
41 dsl_equality_exp_token = 132, dsl_relational_exp_token = 134, | |
42 dsl_shift_exp_token = 137, dsl_additive_exp_token = 140, | |
43 dsl_multiplicative_exp_token = 142, dsl_unary_exp_token = 145, | |
44 dsl_nonzero_token = 148, dsl_string_term_token = 152, | |
45 dsl_string_element_token, dsl_numeric_name_token, dsl_built_in_name_token, | |
46 dsl_built_in_argument_token, dsl_string_name_token, | |
47 dsl_undefined_name_token, dsl_hex_constant_token = 161, | |
48 dsl_octal_constant_token, dsl_decimal_constant_token, | |
49 dsl_char_constant_element_token = 172, dsl_not_single_quote_token, | |
50 dsl_screen_items_token, dsl_formula_token = 177, dsl_color_spec_token, | |
51 dsl_query_line_token = 184, dsl_button_line_token, | |
52 dsl_formula_element_token = 193, dsl_eol_token = 200, | |
53 dsl_paren_string_token, dsl_string_literal_token, dsl_literal_token = 208, | |
54 dsl_name_token = 223, dsl_literals_token = 225, | |
55 dsl_integer_constant_token = 247, dsl_character_constant_token, | |
56 dsl__last_token = 263 | |
57 } dsl_token_type; | |
58 | |
59 typedef struct dsl_pcb_struct{ | |
60 dsl_token_type token_number, reduction_token, error_frame_token; | |
61 int input_code; | |
62 int input_value; | |
63 int line, column; | |
64 int ssx, sn, error_frame_ssx; | |
65 int drt, dssx, dsn; | |
66 int ss[128]; | |
67 dsl_vs_type vs[128]; | |
68 int ag_ap; | |
69 const char *error_message; | |
70 char read_flag; | |
71 char exit_flag; | |
72 action_pointer input_context; | |
73 action_pointer cs[128]; | |
74 int bts[128], btsx; | |
75 unsigned char * pointer; | |
76 unsigned char * la_ptr; | |
77 const unsigned char *key_sp; | |
78 int save_index, key_state; | |
79 char ag_msg[82]; | |
80 const int *ag_dtl; | |
81 int ag_dsn; | |
82 } dsl_pcb_type; | |
83 | |
84 #ifndef PRULE_CONTEXT | |
85 #define PRULE_CONTEXT(pcb) (&((pcb).cs[(pcb).ssx])) | |
86 #define PERROR_CONTEXT(pcb) ((pcb).cs[(pcb).error_frame_ssx]) | |
87 #define PCONTEXT(pcb) ((pcb).cs[(pcb).ssx]) | |
88 #endif | |
89 | |
90 #ifndef AG_RUNNING_CODE | |
91 /* PCB.exit_flag values */ | |
92 #define AG_RUNNING_CODE 0 | |
93 #define AG_SUCCESS_CODE 1 | |
94 #define AG_SYNTAX_ERROR_CODE 2 | |
95 #define AG_REDUCTION_ERROR_CODE 3 | |
96 #define AG_STACK_ERROR_CODE 4 | |
97 #define AG_SEMANTIC_ERROR_CODE 5 | |
98 #endif | |
99 | |
100 extern dsl_pcb_type dsl_pcb; | |
101 void init_dsl(void); | |
102 void dsl(void); | |
103 #endif | |
104 |