Back to index

tetex-bin  3.0
Defines | Functions | Variables
main.c File Reference
#include "web2c.h"
#include "y_tab.h"

Go to the source code of this file.

Defines

#define max_line_length   78
#define max_strings   20000
#define hash_prime   101
#define sym_table_size   3000
#define unused   271828

Functions

void find_next_temp P1H (void)
void my_output P1C (string, s)
int hash P1C (const_string, id)
int add_to_table P1C (string, id)
int main P2C (int, argc, string *, argv)

Variables

boolean debug = false
int indent = 0
int line_pos = 0
int last_brace = 0
int block_level = 0
int last_tok
int tex = 0
int strict_for = 0
int mf = 0
char safe_string [80]
char var_list [200]
char field_list [200]
char last_id [80]
char z_id [80]
char next_temp [] = "zzzaa"
char coerce_name [100] = "coerce.h"
string program_name
long last_i_num
int ii
int l_s
long lower_bound
long upper_bound
FILEout
FILEcoerce
int pf_count = 1
char * std_header = "null.h"
char strings [max_strings]
int hash_list [hash_prime]
short global = 1
int next_sym_free = -1
int next_string_free = 0
int mark_sym_free
int mark_string_free
int argc
char ** gargv
int yyleng

Define Documentation

#define hash_prime   101

Definition at line 27 of file main.c.

#define max_line_length   78

Definition at line 24 of file main.c.

#define max_strings   20000

Definition at line 26 of file main.c.

#define sym_table_size   3000

Definition at line 28 of file main.c.

#define unused   271828

Definition at line 29 of file main.c.


Function Documentation

void my_output P1C ( string  ,
s   
)

Definition at line 103 of file main.c.

{
  int len = strlen (s);
  int less_indent = 0;

  if (!out)
    return;

  if (line_pos + len > max_line_length)
    new_line ();

  if (indent > 1 && (strcmp (s, "case") == 0 || strcmp (s, "default") == 0))
    less_indent = 2;

  while (line_pos < indent * 2 - less_indent) {
    fputs ("  ", out);
    line_pos += 2;
  }

  /* Output the token.  */
  fputs (s, out);

  /* Omitting the space for parentheses makes fixwrites lose.  Sigh.
     What a kludge.  */
  if (!(len == 1 && (*s == ';' || *s == '[' || *s == ']')))
    putc (' ', out);
  line_pos += len + 1;

  last_brace = (s[0] == '}');
}

Here is the call graph for this function:

int search_table P1C ( const_string  ,
id   
)

Definition at line 145 of file main.c.

{
  register int i = 0, j;
  for (j = 0; id[j] != 0; j++)
    i = (i + i + id[j]) % hash_prime;
  return i;
}
int add_to_table P1C ( string  ,
id   
)

Definition at line 172 of file main.c.

{
  int h, ptr;
  h = hash (id);
  ptr = hash_list[h];
  hash_list[h] = ++next_sym_free;
  sym_table[next_sym_free].next = ptr;
  sym_table[next_sym_free].val = unused;
  sym_table[next_sym_free].id = strings + next_string_free;
  sym_table[next_sym_free].var_formal = false;
  sym_table[next_sym_free].var_not_needed = false;
  strcpy (strings + next_string_free, id);
  next_string_free += strlen (id) + 1;
  return next_sym_free;
}

Here is the call graph for this function:

void find_next_temp P1H ( void  ) [read]

Definition at line 71 of file main.c.

{
  next_temp[4]++;
  if (next_temp[4] > 'z')
    {
      next_temp[4] = 'a';
      next_temp[3]++;
    }
}
int main P2C ( int  ,
argc  ,
string ,
argv   
)

Definition at line 227 of file main.c.

{
  int error, i;

  for (i = 1; i < argc; i++)
    if (argv[i][0] == '-')
      switch (argv[i][1])
       {
       case 't':
         tex = true;
         break;
       case 'm':
         mf = true;
         break;
       case 'f':
         strict_for = true;
         break;
       case 'h':
         std_header = &argv[i][2];
         break;
       case 'd':
         debug = true;
         break;
       case 'c':
          program_name = &argv[i][2];
         sprintf (coerce_name, "%s.h", program_name);
         break;
       default:
         fprintf (stderr, "web2c: Unknown option %s, ignored\n", argv[i]);
         break;
       }
    else
      {
       fprintf (stderr, "web2c: Unknown argument %s, ignored\n", argv[i]);
      }

  initialize ();
  error = yyparse ();
  new_line ();

  xfclose (coerce, coerce_name);

  if (debug)
    fprintf (stderr, "%d symbols.\n", next_sym_free);

  return EXIT_SUCCESS;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 65 of file main.c.

Definition at line 36 of file main.c.

Definition at line 53 of file main.c.

char coerce_name[100] = "coerce.h"

Definition at line 46 of file main.c.

Definition at line 32 of file main.c.

char field_list[200]

Definition at line 42 of file main.c.

char** gargv

Definition at line 66 of file main.c.

Definition at line 60 of file main.c.

Definition at line 59 of file main.c.

Definition at line 50 of file main.c.

int indent = 0

Definition at line 33 of file main.c.

Definition at line 50 of file main.c.

Definition at line 35 of file main.c.

long last_i_num

Definition at line 49 of file main.c.

char last_id[80]

Definition at line 43 of file main.c.

Definition at line 37 of file main.c.

Definition at line 34 of file main.c.

Definition at line 51 of file main.c.

Definition at line 63 of file main.c.

Definition at line 63 of file main.c.

int mf = 0

Definition at line 38 of file main.c.

Definition at line 62 of file main.c.

Definition at line 62 of file main.c.

char next_temp[] = "zzzaa"

Definition at line 45 of file main.c.

Definition at line 52 of file main.c.

Definition at line 54 of file main.c.

Definition at line 47 of file main.c.

char safe_string[80]

Definition at line 40 of file main.c.

char* std_header = "null.h"

Definition at line 56 of file main.c.

Definition at line 38 of file main.c.

Definition at line 58 of file main.c.

int tex = 0

Definition at line 38 of file main.c.

Definition at line 51 of file main.c.

char var_list[200]

Definition at line 41 of file main.c.

char z_id[80]

Definition at line 44 of file main.c.