C:/Users/Dennis/src/lang/Life_start/Life/life-1.02/source/token.c File Reference

#include <pwd.h>
#include "extern.h"
#include "trees.h"
#include "types.h"
#include "token.h"
#include "memory.h"
#include "error.h"
#include "parser.h"
#include "modules.h"

Go to the source code of this file.

Defines

#define isoctal(c)   (c=='0'||c=='1'||c=='2'||c=='3'||c=='4'||c=='5'||c=='6'||c=='7')

Functions

void TOKEN_ERROR (ptr_psi_term p)
void stdin_cleareof ()
void heap_add_int_attr (ptr_psi_term t, char *attrname, long value)
void stack_add_int_attr (ptr_psi_term t, char *attrname, long value)
void heap_mod_int_attr (ptr_psi_term t, char *attrname, long value)
void heap_add_str_attr (ptr_psi_term t, char *attrname, char *str)
void stack_add_str_attr (ptr_psi_term t, char *attrname, char *str)
void heap_mod_str_attr (ptr_psi_term t, char *attrname, char *str)
void heap_add_psi_attr (ptr_psi_term t, char *attrname, ptr_psi_term g)
void stack_add_psi_attr (ptr_psi_term t, char *attrname, ptr_psi_term g)
void bk_stack_add_psi_attr (ptr_psi_term t, char *attrname, ptr_psi_term g)
GENERIC get_attr (ptr_psi_term t, char *attrname)
FILE * get_stream (ptr_psi_term t)
void save_state (ptr_psi_term t)
void restore_state (ptr_psi_term t)
void new_state (ptr_psi_term *t)
void save_parse_state (ptr_parse_block pb)
void restore_parse_state (ptr_parse_block pb)
void init_parse_state ()
void begin_terminal_io ()
void end_terminal_io ()
char * expand_file_name (char *s)
long open_input_file (char *file)
long open_output_file (string file)
long read_char ()
void put_back_char (long c)
void put_back_token (psi_term t)
void psi_term_error ()
void read_comment (ptr_psi_term tok)
void read_string_error (int n)
int base2int (int n)
void read_string (ptr_psi_term tok, long e)
long symbolic (long c)
long legal_in_name (long c)
void read_name (ptr_psi_term tok, long ch, long(*f)(), ptr_definition typ)
void read_number (ptr_psi_term tok, long c)
void read_token_main ()
void read_token (ptr_psi_term tok)
void read_token_b (ptr_psi_term tok)
void read_token_main (ptr_psi_term tok, long for_parser)

Variables

static char vcid [] = "$Id: token.c,v 1.4 1995/07/27 19:22:17 duchier Exp $"
long var_occurred
ptr_node symbol_table
ptr_psi_term error_psi_term
long psi_term_line_number
long trace_input = FALSE
FILE * output_stream
char * prompt
long stdin_terminal
long stringparse
char * stringinput
FILE * input_stream
string input_file_name
long line_count
long start_of_line
long saved_char
long old_saved_char
ptr_psi_term saved_psi_term
ptr_psi_term old_saved_psi_term
long eof_flag
ptr_psi_term input_state
ptr_psi_term stdin_state
static long inchange
static long outchange
static FILE * out
ptr_psi_term old_state = NULL


Define Documentation

#define isoctal (  )     (c=='0'||c=='1'||c=='2'||c=='3'||c=='4'||c=='5'||c=='6'||c=='7')

Definition at line 898 of file token.c.

Referenced by read_string().


Function Documentation

int base2int ( int  n  ) 

Definition at line 866 of file token.c.

Referenced by read_string().

void begin_terminal_io (  ) 

Definition at line 454 of file token.c.

References inchange, input_stream, open_input_file(), out, outchange, and output_stream.

Referenced by main(), WFInit(), and what_next_aim().

void bk_stack_add_psi_attr ( ptr_psi_term  t,
char *  attrname,
ptr_psi_term  g 
)

Definition at line 244 of file token.c.

References bk_stack_insert(), featcmp(), and heap_copy_string().

void end_terminal_io (  ) 

Definition at line 475 of file token.c.

References inchange, NULL, out, outchange, output_stream, and restore_state().

Referenced by main(), and what_next_aim().

char* expand_file_name ( char *  s  ) 

Definition at line 494 of file token.c.

References STRLEN.

Referenced by c_chdir(), file_exists(), open_input_file(), and open_output_file().

GENERIC get_attr ( ptr_psi_term  t,
char *  attrname 
)

Definition at line 254 of file token.c.

References wl_node::data, featcmp(), and find().

Referenced by get_stream(), load_aim(), and restore_state().

FILE* get_stream ( ptr_psi_term  t  ) 

Definition at line 263 of file token.c.

References get_attr(), and STREAM.

Referenced by c_set_input().

void heap_add_int_attr ( ptr_psi_term  t,
char *  attrname,
long  value 
)

Definition at line 102 of file token.c.

References featcmp(), heap_alloc(), heap_copy_string(), heap_insert(), heap_psi_term(), integer, REAL, wl_psi_term::type, and wl_psi_term::value.

Referenced by new_state().

void heap_add_psi_attr ( ptr_psi_term  t,
char *  attrname,
ptr_psi_term  g 
)

Definition at line 228 of file token.c.

References featcmp(), heap_copy_string(), and heap_insert().

Referenced by new_state(), and save_state().

void heap_add_str_attr ( ptr_psi_term  t,
char *  attrname,
char *  str 
)

Definition at line 166 of file token.c.

References featcmp(), heap_copy_string(), heap_insert(), heap_psi_term(), quoted_string, wl_psi_term::type, and wl_psi_term::value.

Referenced by new_state().

void heap_mod_int_attr ( ptr_psi_term  t,
char *  attrname,
long  value 
)

Definition at line 135 of file token.c.

References wl_node::data, featcmp(), find(), REAL, and wl_psi_term::value.

Referenced by save_state().

void heap_mod_str_attr ( ptr_psi_term  t,
char *  attrname,
char *  str 
)

Definition at line 197 of file token.c.

References wl_node::data, featcmp(), find(), heap_copy_string(), and wl_psi_term::value.

Referenced by save_state().

void init_parse_state (  ) 

Definition at line 425 of file token.c.

References eof_flag, FALSE, line_count, NULL, old_saved_char, saved_char, start_of_line, stringparse, and TRUE.

Referenced by c_parse(), open_input_file(), and WFInput().

long legal_in_name ( long  c  ) 

Definition at line 1022 of file token.c.

References DIGIT, LOWER, and UPPER.

Referenced by extract_module_from_name(), read_name(), and strip_module_name().

void new_state ( ptr_psi_term t  ) 

Definition at line 345 of file token.c.

References current_module, CURRENT_MODULE, EOF_FLAG, eof_flag, heap_add_int_attr(), heap_add_psi_attr(), heap_add_str_attr(), heap_psi_term(), input_file_name, INPUT_FILE_NAME, input_stream, inputfilesym, line_count, LINE_COUNT, wl_module::module_name, null_psi_term, old_saved_char, OLD_SAVED_CHAR, OLD_SAVED_PSI_TERM, saved_char, SAVED_CHAR, SAVED_PSI_TERM, START_OF_LINE, start_of_line, STREAM, stream, wl_psi_term::type, and wl_psi_term::value.

Referenced by open_input_file().

long open_input_file ( char *  file  ) 

Definition at line 620 of file token.c.

References Errorline(), expand_file_name(), FALSE, init_parse_state(), input_file_name, input_stream, new_state(), noisy, NULL, restore_state(), save_state(), and TRUE.

Referenced by begin_terminal_io(), c_close(), c_load(), c_open_in(), exit_life(), fail_all(), handle_interrupt(), load_aim(), main(), WFInit(), and yes_or_no().

long open_output_file ( string  file  ) 

Definition at line 713 of file token.c.

References Errorline(), expand_file_name(), FALSE, NULL, output_stream, and TRUE.

Referenced by c_close(), and c_open_out().

void psi_term_error (  ) 

Definition at line 822 of file token.c.

References FALSE, input_file_name, parse_ok, perr_i(), perr_s(), and psi_term_line_number.

Referenced by parse_list(), and push().

void put_back_char ( long  c  ) 

Definition at line 794 of file token.c.

References Errorline(), old_saved_char, and saved_char.

Referenced by main(), parse(), read_name(), read_number(), read_string(), and what_next_aim().

void put_back_token ( psi_term  t  ) 

Definition at line 808 of file token.c.

References Errorline(), NULL, and stack_copy_psi_term().

Referenced by parse_list(), read_life_form(), and read_psi_term().

long read_char (  ) 

Definition at line 746 of file token.c.

References EOLN, FALSE, Infoline, input_stream, line_count, old_saved_char, prompt, saved_char, start_of_line, stringinput, stringparse, trace_input, and TRUE.

Referenced by c_get(), handle_interrupt(), main(), parse(), read_comment(), read_name(), read_number(), read_string(), what_next_aim(), and yes_or_no().

void read_comment ( ptr_psi_term  tok  ) 

Definition at line 837 of file token.c.

References comment, EOLN, and read_char().

void read_name ( ptr_psi_term  tok,
long  ch,
long (*)()  f,
ptr_definition  typ 
)

Definition at line 1039 of file token.c.

References bk2_stack_insert(), constant, create_module(), FALSE, find(), global, heap_copy_string(), legal_in_name(), wl_module::module_name, NULL, put_back_char(), read_char(), STRLEN, SYMBOL, symbolic(), TOKEN_ERROR(), TRUE, wl_definition::type, update_symbol(), var_occurred, var_tree, and Warningline.

void read_number ( ptr_psi_term  tok,
long  c 
)

Definition at line 1147 of file token.c.

References DIGIT, heap_alloc(), integer, put_back_char(), read_char(), real, REAL, and wl_definition::type.

void read_string ( ptr_psi_term  tok,
long  e 
)

Definition at line 904 of file token.c.

References base2int(), FALSE, heap_copy_string(), isoctal, NULL, put_back_char(), read_char(), read_string_error(), STRLEN, TOKEN_ERROR(), TRUE, update_symbol(), and Warningline.

void read_string_error ( int  n  ) 

Definition at line 850 of file token.c.

References FALSE, parse_ok, stringparse, and Syntaxerrorline().

Referenced by read_string().

void read_token ( ptr_psi_term  tok  ) 

Definition at line 1224 of file token.c.

References read_token_main(), and TRUE.

Referenced by parse(), parse_list(), read_life_form(), and read_psi_term().

void read_token_b ( ptr_psi_term  tok  ) 

Definition at line 1230 of file token.c.

Referenced by c_read().

void read_token_main ( ptr_psi_term  tok,
long  for_parser 
)

Definition at line 1234 of file token.c.

References FALSE, and read_token_main().

void read_token_main (  ) 

Referenced by read_token(), and read_token_main().

void restore_parse_state ( ptr_parse_block  pb  ) 

Definition at line 409 of file token.c.

References eof_flag, line_count, old_saved_char, saved_char, and start_of_line.

Referenced by c_parse().

void restore_state ( ptr_psi_term  t  ) 

Definition at line 311 of file token.c.

References EOF_FLAG, eof_flag, get_attr(), input_file_name, INPUT_FILE_NAME, input_stream, LINE_COUNT, line_count, NULL, null_psi_term, OLD_SAVED_CHAR, old_saved_char, OLD_SAVED_PSI_TERM, REAL, SAVED_CHAR, saved_char, SAVED_PSI_TERM, START_OF_LINE, start_of_line, STREAM, and type.

Referenced by c_set_input(), end_terminal_io(), handle_interrupt(), load_aim(), open_input_file(), and yes_or_no().

void save_parse_state ( ptr_parse_block  pb  ) 

Definition at line 394 of file token.c.

References eof_flag, line_count, old_saved_char, saved_char, and start_of_line.

Referenced by c_parse(), and WFInput().

void save_state ( ptr_psi_term  t  ) 

Definition at line 274 of file token.c.

References wl_node::data, EOF_FLAG, eof_flag, featcmp(), find(), heap_add_psi_attr(), heap_mod_int_attr(), heap_mod_str_attr(), heap_psi_term(), input_file_name, INPUT_FILE_NAME, input_stream, line_count, LINE_COUNT, null_psi_term, old_saved_char, OLD_SAVED_CHAR, OLD_SAVED_PSI_TERM, saved_char, SAVED_CHAR, SAVED_PSI_TERM, START_OF_LINE, start_of_line, STREAM, wl_psi_term::type, and wl_psi_term::value.

Referenced by c_set_input(), load_aim(), and open_input_file().

void stack_add_int_attr ( ptr_psi_term  t,
char *  attrname,
long  value 
)

Definition at line 117 of file token.c.

References featcmp(), heap_alloc(), heap_copy_string(), integer, REAL, stack_insert(), stack_psi_term(), wl_psi_term::type, and wl_psi_term::value.

Referenced by c_localtime(), and collect_symbols().

void stack_add_psi_attr ( ptr_psi_term  t,
char *  attrname,
ptr_psi_term  g 
)

Definition at line 236 of file token.c.

References featcmp(), heap_copy_string(), and stack_insert().

Referenced by collect_symbols(), and prove_aim().

void stack_add_str_attr ( ptr_psi_term  t,
char *  attrname,
char *  str 
)

Definition at line 180 of file token.c.

References featcmp(), heap_copy_string(), quoted_string, stack_copy_string(), stack_insert(), stack_psi_term(), wl_psi_term::type, and wl_psi_term::value.

void stdin_cleareof (  ) 

Definition at line 86 of file token.c.

References eof_flag, FALSE, NULL, old_saved_char, saved_char, start_of_line, stdin_terminal, and TRUE.

Referenced by abort_life(), fail_all(), handle_interrupt(), main(), WFInit(), and what_next_aim().

long symbolic ( long  c  ) 

Definition at line 1011 of file token.c.

References SYMBOL.

Referenced by read_name().

void TOKEN_ERROR ( ptr_psi_term  p  ) 

Definition at line 74 of file token.c.

References Syntaxerrorline(), and wl_psi_term::type.

Referenced by read_name(), and read_string().


Variable Documentation

long eof_flag

Definition at line 57 of file token.c.

Referenced by c_get(), c_read(), init_parse_state(), new_state(), restore_parse_state(), restore_state(), save_parse_state(), save_state(), and stdin_cleareof().

ptr_psi_term error_psi_term

Definition at line 27 of file token.c.

Referenced by c_string2psi(), check(), crunch(), global_error_check(), init_built_in_types(), make_life_form(), persistent_error_check(), pop(), read_life_form(), read_psi_term(), and update_symbol().

long inchange [static]

Definition at line 441 of file token.c.

Referenced by begin_terminal_io(), and end_terminal_io().

string input_file_name

Definition at line 50 of file token.c.

Referenced by create_module(), new_state(), open_input_file(), psi_term_error(), restore_state(), and save_state().

ptr_psi_term input_state

Definition at line 60 of file token.c.

Referenced by c_load(), c_open_in(), c_set_input(), check(), handle_interrupt(), init_io(), load_aim(), main(), WFInit(), and yes_or_no().

FILE* input_stream

Definition at line 49 of file token.c.

Referenced by begin_terminal_io(), c_close(), load_aim(), new_state(), open_input_file(), read_char(), restore_state(), and save_state().

long line_count

Definition at line 51 of file token.c.

Referenced by c_read(), init_parse_state(), new_state(), read_char(), read_life_form(), restore_parse_state(), restore_state(), save_parse_state(), and save_state().

long old_saved_char

Definition at line 54 of file token.c.

Referenced by init_parse_state(), new_state(), put_back_char(), read_char(), restore_parse_state(), restore_state(), save_parse_state(), save_state(), and stdin_cleareof().

ptr_psi_term old_saved_psi_term

Definition at line 56 of file token.c.

Referenced by check().

ptr_psi_term old_state = NULL

Definition at line 443 of file token.c.

Referenced by check(), handle_interrupt(), and yes_or_no().

FILE* out [static]

Definition at line 442 of file token.c.

Referenced by begin_terminal_io(), and end_terminal_io().

long outchange [static]

Definition at line 441 of file token.c.

Referenced by begin_terminal_io(), and end_terminal_io().

FILE* output_stream

Definition at line 31 of file token.c.

Referenced by begin_terminal_io(), c_close(), c_listing(), c_open_out(), c_put_main(), c_set_output(), display_couple(), display_psi_stream(), end_terminal_io(), fail_all(), init_io(), list_special(), listing_pred_write(), open_output_file(), outputline(), pred_write(), and print_variables().

char* prompt

Definition at line 32 of file token.c.

Referenced by c_get(), c_read(), handle_interrupt(), init_system(), parse(), read_char(), what_next_aim(), and yes_or_no().

long psi_term_line_number

Definition at line 28 of file token.c.

Referenced by psi_term_error().

long saved_char

Definition at line 53 of file token.c.

Referenced by init_parse_state(), new_state(), parse(), put_back_char(), read_char(), restore_parse_state(), restore_state(), save_parse_state(), save_state(), and stdin_cleareof().

ptr_psi_term saved_psi_term

Definition at line 55 of file token.c.

Referenced by check(), and parse().

long start_of_line

Definition at line 52 of file token.c.

Referenced by init_parse_state(), new_state(), read_char(), restore_parse_state(), restore_state(), save_parse_state(), save_state(), and stdin_cleareof().

ptr_psi_term stdin_state

Definition at line 63 of file token.c.

Referenced by check(), and init_io().

long stdin_terminal

Definition at line 34 of file token.c.

Referenced by init_io(), and stdin_cleareof().

char* stringinput

Definition at line 38 of file token.c.

Referenced by c_parse(), read_char(), and WFInput().

long stringparse

Definition at line 37 of file token.c.

Referenced by c_parse(), init_parse_state(), parse(), parse_list(), read_char(), read_life_form(), read_psi_term(), read_string_error(), and WFInput().

ptr_node symbol_table

Definition at line 26 of file token.c.

long trace_input = FALSE

Definition at line 29 of file token.c.

Referenced by c_trace_input(), and read_char().

long var_occurred

Definition at line 25 of file token.c.

Referenced by abort_life(), c_parse(), load_aim(), main(), read_name(), WFInit(), WFInput(), and what_next_aim().

char vcid[] = "$Id: token.c,v 1.4 1995/07/27 19:22:17 duchier Exp $" [static]

Definition at line 7 of file token.c.


Generated on Sat Jan 26 08:48:09 2008 for WildLife by  doxygen 1.5.4