view tests/agcl/oldagsrc/good/scr4d.h @ 15:f5acaf0c8a29

Don't cast through "volatile int". Causes a gcc warning nowadays. XXX: should put something else back here to frighten the optimizer
author David A. Holland
date Tue, 31 May 2022 01:00:55 -0400
parents 13d2b8934445
children
line wrap: on
line source

#ifndef SCR4D_H
#define SCR4D_H

typedef union {
  long alignment;
  char ag_vt_2[sizeof(int)];
  char ag_vt_4[sizeof(dc *)];
} scr_vs_type;

typedef enum {
  scr_edit_session_token = 1, scr_any_window_token, scr_quit_token,
  scr_change_directory_token, scr_any_edit_string_token, scr_exit_token,
  scr_session_complete_token, scr_any_search_key_token,
  scr_line_number_token, scr_begin_token, scr_req_c_menu_token,
  scr_search_key_token, scr_adjust_search_key_token, scr_edit_string_token,
  scr_adjust_edit_string_token, scr_window_token, scr_req_w_menu_token,
  scr_escape_token = 19, scr_adjust_window_token, scr_return_token,
  scr_specify_line_number_token, scr_specify_lines_back_token,
  scr_specify_lines_forward_token = 25, scr_enter_line_number_token = 27,
  scr_digit_token, scr_backspace_token, scr_delete_token, scr_help_token,
  scr_req_help_index_token, scr_req_key_assign_token,
  scr_req_cursor_assign_token, scr_print_table_token, scr_control_key_token,
  scr_previous_window_token, scr_bottom_window_token, scr_bury_window_token,
  scr_non_cursor_key_token, scr_search_forward_token,
  scr_search_reverse_token, scr_edit_search_key_token = 44,
  scr_clone_window_token, scr_cycle_clone_token, scr_req_aux_win_menu_token,
  scr_req_aux_cmnd_menu_token, scr_req_plane_menu_token, scr_previous_token,
  scr_bottom_token, scr_bury_token, scr_search_next_token,
  scr_down_token = 55, scr_search_previous_token, scr_up_token,
  scr_create_key_token, scr_left_token, scr_right_token,
  scr_text_char_token, scr_home_token, scr_end_token,
  scr_control_left_token, scr_control_right_token, scr_new_directory_token,
  scr_init_string_edit_token, scr_reduce_edit_string_token,
  scr_move_edit_string_token, scr_reduce_search_key_token = 71,
  scr_move_search_key_token, scr_resize_window_token = 74,
  scr_move_window_token, scr_move_token = 77, scr_cursor_control_token,
  scr_reduce_token, scr_page_up_token, scr_page_down_token,
  scr_control_home_token, scr_control_end_token, scr_control_page_up_token,
  scr_control_page_down_token, scr_control_w_token, scr_control_z_token
} scr_token_type;

typedef struct scr_pcb_struct{
  scr_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];
  scr_vs_type vs[128];
  int ag_ap;
  const char *error_message;
  char read_flag;
  char exit_flag;
  int bts[128], btsx;
  const  int *ag_dtl;
  int ag_dsn;
} scr_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
void init_scr(void);
void scr(void);
#endif