view tests/agcl/parsifal/good/rfc822a.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 source

#ifndef RFC822A_H
#define RFC822A_H

typedef enum {
  rfc822a_message_token = 1, rfc822a_CRLF_token, rfc822a_atom_token,
  rfc822a_word_token, rfc822a_linear_space_token, rfc822a_number_token = 8,
  rfc822a_address_token, rfc822a_mailbox_token, rfc822a_group_token,
  rfc822a_addr_spec_token, rfc822a_local_part_token,
  rfc822a_domain_token = 15, rfc822a_ATOM_CHAR_token,
  rfc822a_authentic_token, rfc822a_SPACE_token = 22,
  rfc822a_multiple_mailboxes_token, rfc822a_comment_token = 26,
  rfc822a_comment_choice_token, rfc822a_ctext_token,
  rfc822a_quoted_pair_token, rfc822a_linear_white_space_token = 32,
  rfc822a_date_token, rfc822a_day_numb_token, rfc822a_month_token,
  rfc822a_year_token, rfc822a_DIGIT_token, rfc822a_dates_token,
  rfc822a_orig_date_token, rfc822a_resent_date_token,
  rfc822a_date_time_token, rfc822a_day_token, rfc822a_time_token = 45,
  rfc822a_delimeters_token = 53, rfc822a_specials_token,
  rfc822a_destination_token, rfc822a_addresses_token = 57,
  rfc822a_multiple_sub_domains_token = 64, rfc822a_sub_domain_token,
  rfc822a_domain_literal_token = 67, rfc822a_literal_fill_token = 69,
  rfc822a_dtext_token = 72, rfc822a_domain_ref_token,
  rfc822a_field_token = 75, rfc822a_field_name_token,
  rfc822a_field_body_token, rfc822a_fields_token = 79,
  rfc822a_fields_makeup_token, rfc822a_source_token,
  rfc822a_optional_field_token, rfc822a_field_body_contents_token,
  rfc822a_LWSP_char_token, rfc822a_CHAR_token = 86, rfc822a_hour_token = 91,
  rfc822a_route_addr_token = 95, rfc822a_text_token,
  rfc822a_msg_id_token = 112, rfc822a_optional_fields_token = 115,
  rfc822a_originator_token = 118, rfc822a_phrase_token = 121,
  rfc822a_qtext_token = 123, rfc822a_quoted_string_token = 126,
  rfc822a_QUOTED_token = 128, rfc822a_received_token = 131,
  rfc822a_received_fields_token = 133, rfc822a_rec_date_time_token = 135,
  rfc822a_from_token, rfc822a_from_domain_token,
  rfc822a_by_domain_token = 139, rfc822a_via_atom_token = 141,
  rfc822a_with_atom_token = 143, rfc822a_rec_msg_id_token = 145,
  rfc822a_for_addr_spec_token = 147, rfc822a_resent_token,
  rfc822a_resent_authentic_token, rfc822a_return_token = 155,
  rfc822a_route_token = 157, rfc822a_route_list_token,
  rfc822a_sub_route_token, rfc822a_trace_token = 161,
  rfc822a_text_char_token = 164, rfc822a_zone_token = 166,
  rfc822a_ALPHA_token = 178
} rfc822a_token_type;

typedef struct rfc822a_pcb_struct{
  rfc822a_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];
  int vs[128];
  int ag_ap;
  const char *error_message;
  char read_flag;
  char exit_flag;
  unsigned char * input_context;
  unsigned char * 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];
} rfc822a_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 rfc822a_pcb_type rfc822a_pcb;
void init_rfc822a(void);
void rfc822a(void);
#endif