Main Page | Data Structures | File List | Data Fields | Globals

flowcontrol.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "types.h"
#include "toke.h"
#include "emit.h"
#include "vocabfuncts.h"
#include "scanner.h"
#include "stack.h"
#include "errhandler.h"
#include "flowcontrol.h"
#include "stream.h"

Include dependency graph for flowcontrol.c:

Go to the source code of this file.

Data Structures

struct  cstag_group

Defines

#define BEGIN_CSTAG   0xC57be916
#define IF_CSTAG   0xC57A901f
#define WHILE_CSTAG   0xC573412e
#define DO_CSTAG   0xC57A90d0
#define CASE_CSTAG   0xC57Aca5e
#define OF_CSTAG   0xC57A90f0
#define ENDOF_CSTAG   0xC57e6d0f

Typedefs

typedef cstag_group cstag_group_t

Functions

static void push_cstag (unsigned long cstag, unsigned long datum)
static void pop_cstag (void)
static bool control_stack_size_test (int min_depth)
static void control_structure_mismatch (void)
static void offset_too_large (bool too_large_for_16)
static void emit_fc_offset (int fc_offset)
static bool matchup_control_structure (unsigned long cstag)
static void control_structure_swap (void)
static bool matchup_two_control_structures (unsigned long top_cstag, unsigned long next_cstag)
static void mark_backward_target (unsigned long cstag)
static void mark_forward_branch (unsigned long cstag)
static void resolve_backward (unsigned long cstag)
static void resolve_forward (unsigned long cstag)
void emit_if (void)
void emit_then (void)
void emit_else (void)
void emit_begin (void)
void emit_again (void)
void emit_until (void)
void emit_while (void)
void emit_repeat (void)
void mark_do (void)
void resolve_loop (void)
void emit_case (void)
void emit_of (void)
void emit_endof (void)
void emit_endcase (void)
static void control_struct_incomplete (int severity, char *call_cond, cstag_group_t *c_s_entry)
void announce_control_structs (int severity, char *call_cond, unsigned int abs_token_limit)
void clear_control_structs_to_limit (char *call_cond, unsigned int abs_token_limit)
void clear_control_structs (char *call_cond)

Variables

int control_stack_depth = 0
static cstag_group_tcontrol_stack = NULL
static bool not_cs_underflow
static bool not_consuming_two = TRUE
static bool didnt_print_otl = TRUE


Define Documentation

#define BEGIN_CSTAG   0xC57be916
 

Definition at line 179 of file flowcontrol.c.

Referenced by emit_again(), emit_begin(), emit_repeat(), and emit_until().

#define CASE_CSTAG   0xC57Aca5e
 

Definition at line 183 of file flowcontrol.c.

Referenced by emit_case(), emit_endcase(), emit_of(), and matchup_control_structure().

#define DO_CSTAG   0xC57A90d0
 

Definition at line 182 of file flowcontrol.c.

Referenced by clear_control_structs_to_limit(), mark_do(), and resolve_loop().

#define ENDOF_CSTAG   0xC57e6d0f
 

Definition at line 185 of file flowcontrol.c.

Referenced by emit_endcase(), and emit_endof().

#define IF_CSTAG   0xC57A901f
 

Definition at line 180 of file flowcontrol.c.

Referenced by emit_else(), emit_if(), and emit_then().

#define OF_CSTAG   0xC57A90f0
 

Definition at line 184 of file flowcontrol.c.

Referenced by emit_endof(), and emit_of().

#define WHILE_CSTAG   0xC573412e
 

Definition at line 181 of file flowcontrol.c.

Referenced by emit_repeat(), emit_then(), and emit_while().


Typedef Documentation

typedef struct cstag_group cstag_group_t
 


Function Documentation

void announce_control_structs int  severity,
char *  call_cond,
unsigned int  abs_token_limit
 

Definition at line 1934 of file flowcontrol.c.

References control_struct_incomplete(), cstag_group::cs_abs_token_num, cstag_group::cs_not_dup, and cstag_group::prev.

Referenced by create_word(), dev_vocab_control_struct_check(), and error_check_locals().

Here is the call graph for this function:

void clear_control_structs char *  call_cond  ) 
 

Definition at line 2077 of file flowcontrol.c.

References clear_control_structs_to_limit().

Referenced by fcode_end_err_check().

Here is the call graph for this function:

void clear_control_structs_to_limit char *  call_cond,
unsigned int  abs_token_limit
 

Definition at line 2012 of file flowcontrol.c.

References control_stack_depth, control_struct_incomplete(), cstag_group::cs_abs_token_num, cstag_group::cs_not_dup, cstag_group::cs_tag, DO_CSTAG, do_loop_depth, pop_cstag(), and TKERROR.

Referenced by clear_control_structs(), and handle_internal().

Here is the call graph for this function:

static bool control_stack_size_test int  min_depth  )  [static]
 

Definition at line 473 of file flowcontrol.c.

References control_stack_depth, in_last_colon(), not_cs_underflow, statbuf, TKERROR, and tokenization_error().

Referenced by control_structure_swap(), emit_endof(), and matchup_control_structure().

Here is the call graph for this function:

static void control_struct_incomplete int  severity,
char *  call_cond,
cstag_group_t c_s_entry
[static]
 

Definition at line 1898 of file flowcontrol.c.

References cstag_group::cs_inp_fil, cstag_group::cs_line_num, cstag_group::cs_word, tokenization_error(), and where_started().

Referenced by announce_control_structs(), and clear_control_structs_to_limit().

Here is the call graph for this function:

static void control_structure_mismatch void   )  [static]
 

Definition at line 524 of file flowcontrol.c.

References cstag_group::cs_inp_fil, cstag_group::cs_line_num, cstag_group::cs_not_dup, cstag_group::cs_word, not_consuming_two, statbuf, TKERROR, tokenization_error(), and where_started().

Referenced by matchup_control_structure().

Here is the call graph for this function:

static void control_structure_swap void   )  [static]
 

Definition at line 796 of file flowcontrol.c.

References control_stack_size_test(), and cstag_group::prev.

Referenced by emit_else(), emit_endcase(), emit_endof(), emit_while(), and matchup_two_control_structures().

Here is the call graph for this function:

void emit_again void   ) 
 

Definition at line 1328 of file flowcontrol.c.

References BEGIN_CSTAG, emit_token(), and resolve_backward().

Referenced by emit_repeat(), and handle_internal().

Here is the call graph for this function:

void emit_begin void   ) 
 

Definition at line 1294 of file flowcontrol.c.

References BEGIN_CSTAG, emit_token(), and mark_backward_target().

Referenced by handle_internal().

Here is the call graph for this function:

void emit_case void   ) 
 

Definition at line 1640 of file flowcontrol.c.

References CASE_CSTAG, emit_token(), and push_cstag().

Referenced by handle_internal().

Here is the call graph for this function:

void emit_else void   ) 
 

Definition at line 1258 of file flowcontrol.c.

References control_stack_depth, control_structure_swap(), emit_then(), emit_token(), IF_CSTAG, mark_forward_branch(), and not_cs_underflow.

Referenced by handle_internal().

Here is the call graph for this function:

void emit_endcase void   ) 
 

Definition at line 1845 of file flowcontrol.c.

References CASE_CSTAG, control_structure_swap(), cstag_group::cs_datum, emit_token(), ENDOF_CSTAG, matchup_control_structure(), pop_cstag(), and resolve_forward().

Referenced by handle_internal().

Here is the call graph for this function:

void emit_endof void   ) 
 

Definition at line 1760 of file flowcontrol.c.

References control_stack_size_test(), control_structure_swap(), emit_token(), ENDOF_CSTAG, mark_forward_branch(), OF_CSTAG, and resolve_forward().

Referenced by handle_internal().

Here is the call graph for this function:

static void emit_fc_offset int  fc_offset  )  [static]
 

Definition at line 641 of file flowcontrol.c.

References emit_offset(), noerrors, offs16, offset_too_large(), tokenization_error(), and WARNING.

Referenced by resolve_backward(), and resolve_forward().

Here is the call graph for this function:

void emit_if void   ) 
 

Definition at line 1155 of file flowcontrol.c.

References emit_token(), IF_CSTAG, and mark_forward_branch().

Referenced by abort_quote(), and handle_internal().

Here is the call graph for this function:

void emit_of void   ) 
 

Definition at line 1692 of file flowcontrol.c.

References CASE_CSTAG, cstag_group::cs_datum, emit_token(), mark_forward_branch(), matchup_control_structure(), and OF_CSTAG.

Referenced by handle_internal().

Here is the call graph for this function:

void emit_repeat void   ) 
 

Definition at line 1452 of file flowcontrol.c.

References BEGIN_CSTAG, emit_again(), emit_token(), matchup_two_control_structures(), not_consuming_two, not_cs_underflow, resolve_forward(), and WHILE_CSTAG.

Referenced by handle_internal().

Here is the call graph for this function:

void emit_then void   ) 
 

Definition at line 1196 of file flowcontrol.c.

References cstag_group::cs_tag, emit_token(), IF_CSTAG, resolve_forward(), and WHILE_CSTAG.

Referenced by abort_quote(), emit_else(), and handle_internal().

Here is the call graph for this function:

void emit_until void   ) 
 

Definition at line 1347 of file flowcontrol.c.

References BEGIN_CSTAG, emit_token(), and resolve_backward().

Referenced by handle_internal().

Here is the call graph for this function:

void emit_while void   ) 
 

Definition at line 1402 of file flowcontrol.c.

References control_stack_depth, control_structure_swap(), emit_token(), mark_forward_branch(), and WHILE_CSTAG.

Referenced by handle_internal().

Here is the call graph for this function:

static void mark_backward_target unsigned long  cstag  )  [static]
 

Definition at line 920 of file flowcontrol.c.

References opc, and push_cstag().

Referenced by emit_begin(), mark_do(), and mark_forward_branch().

Here is the call graph for this function:

void mark_do void   ) 
 

Definition at line 1518 of file flowcontrol.c.

References cstag_group::cs_not_dup, DO_CSTAG, do_loop_depth, mark_backward_target(), and mark_forward_branch().

Referenced by handle_internal().

Here is the call graph for this function:

static void mark_forward_branch unsigned long  cstag  )  [static]
 

Definition at line 964 of file flowcontrol.c.

References emit_offset(), and mark_backward_target().

Referenced by emit_else(), emit_endof(), emit_if(), emit_of(), emit_while(), and mark_do().

Here is the call graph for this function:

static bool matchup_control_structure unsigned long  cstag  )  [static]
 

Definition at line 726 of file flowcontrol.c.

References CASE_CSTAG, control_stack_size_test(), control_structure_mismatch(), cstag_group::cs_tag, and noerrors.

Referenced by emit_endcase(), emit_of(), matchup_two_control_structures(), resolve_backward(), and resolve_forward().

Here is the call graph for this function:

static bool matchup_two_control_structures unsigned long  top_cstag,
unsigned long  next_cstag
[static]
 

Definition at line 854 of file flowcontrol.c.

References control_structure_swap(), matchup_control_structure(), noerrors, not_consuming_two, not_cs_underflow, and pop_cstag().

Referenced by emit_repeat(), and resolve_loop().

Here is the call graph for this function:

static void offset_too_large bool  too_large_for_16  )  [static]
 

Definition at line 582 of file flowcontrol.c.

References cstag_group::cs_inp_fil, cstag_group::cs_line_num, cstag_group::cs_not_dup, cstag_group::cs_word, didnt_print_otl, INFO, offs16, statbuf, TKERROR, tokenization_error(), and where_started().

Referenced by emit_fc_offset().

Here is the call graph for this function:

static void pop_cstag void   )  [static]
 

Definition at line 429 of file flowcontrol.c.

References control_stack_depth, cstag_group::cs_inp_fil, cstag_group::cs_word, and cstag_group::prev.

Referenced by clear_control_structs_to_limit(), emit_endcase(), matchup_two_control_structures(), resolve_backward(), and resolve_forward().

static void push_cstag unsigned long  cstag,
unsigned long  datum
[static]
 

Definition at line 379 of file flowcontrol.c.

References abs_token_no, control_stack_depth, cstag_group::cs_abs_token_num, cstag_group::cs_datum, cstag_group::cs_inp_fil, cstag_group::cs_line_num, cstag_group::cs_not_dup, cstag_group::cs_tag, cstag_group::cs_word, iname, lineno, cstag_group::prev, safe_malloc(), and statbuf.

Referenced by emit_case(), and mark_backward_target().

Here is the call graph for this function:

static void resolve_backward unsigned long  cstag  )  [static]
 

Definition at line 1018 of file flowcontrol.c.

References cstag_group::cs_datum, emit_fc_offset(), matchup_control_structure(), opc, and pop_cstag().

Referenced by emit_again(), emit_until(), and resolve_loop().

Here is the call graph for this function:

static void resolve_forward unsigned long  cstag  )  [static]
 

Definition at line 1089 of file flowcontrol.c.

References cstag_group::cs_datum, emit_fc_offset(), matchup_control_structure(), noerrors, opc, and pop_cstag().

Referenced by emit_endcase(), emit_endof(), emit_repeat(), emit_then(), and resolve_loop().

Here is the call graph for this function:

void resolve_loop void   ) 
 

Definition at line 1599 of file flowcontrol.c.

References didnt_print_otl, DO_CSTAG, do_loop_depth, emit_offset(), matchup_two_control_structures(), not_consuming_two, not_cs_underflow, resolve_backward(), and resolve_forward().

Referenced by handle_internal().

Here is the call graph for this function:


Variable Documentation

cstag_group_t* control_stack = NULL [static]
 

Definition at line 308 of file flowcontrol.c.

int control_stack_depth = 0
 

Definition at line 133 of file flowcontrol.c.

Referenced by clear_control_structs_to_limit(), control_stack_size_test(), create_word(), emit_else(), emit_while(), pop_cstag(), and push_cstag().

bool didnt_print_otl = TRUE [static]
 

Definition at line 341 of file flowcontrol.c.

Referenced by offset_too_large(), and resolve_loop().

bool not_consuming_two = TRUE [static]
 

Definition at line 340 of file flowcontrol.c.

Referenced by control_structure_mismatch(), emit_repeat(), matchup_two_control_structures(), and resolve_loop().

bool not_cs_underflow [static]
 

Definition at line 321 of file flowcontrol.c.

Referenced by control_stack_size_test(), emit_else(), emit_repeat(), matchup_two_control_structures(), and resolve_loop().


Generated on Fri Aug 18 14:04:20 2006 for Toke1.0 by  doxygen 1.4.4