Ticket #36397: patch-token.c.diff

File patch-token.c.diff, 3.4 KB (added by stevecheckoway (Stephen Checkoway), 12 years ago)
  • token.c

    old new  
    77
    88#include <math.h>
    99#include <stdio.h>
     10#include <string.h>
    1011
    1112#ifdef LCC
    1213#include <stdlib.h>
    typedef struct iostack { 
    3536static char INPUT[1000];
    3637static int getnew = 1;
    3738static char oldchar = '\0';
    38 static oldcharvalid = 0;
     39static int oldcharvalid = 0;
    3940static char pipe = 0;
    4041static int eof = 0;
    4142static int init = 0;
    static FILE *IOSTREAM; 
    4647static char FILENAME[300];
    4748static int line = 1;
    4849
     50static int getsystemstring(void);
     51
    4952#ifdef VMS
    5053/* On VMS, there are no popen() and pclose(), so we provide dummies here. */
    51 FILE *popen(command, type)
    52 char *command, *type;
     54FILE *popen(const char *command, const char *type)
    5355{
    5456    return(NULL);
    5557}
    56 int pclose(stream)
    57 FILE *stream;
     58int pclose(FILE *stream)
    5859{
    5960    return(-1);
    6061}
    6162#endif /*VMS*/
    6263
    63 set_input_file(s)
    64 char *s;
     64void set_input_file(const char *s)
    6565{
    66   FILE *f;
    6766  Iostack n;
    6867
    6968  if (init == 0) {
    char *s; 
    9392  }
    9493}
    9594
    96 error_header()
     95void error_header()
    9796{
    9897  fprintf(stderr, "%s,%d: ", FILENAME, line);
    9998}
    10099 
    101 int gettokenchar()
     100static int gettokenchar()
    102101{
    103102  if (oldcharvalid == 0) oldchar = getc(IOSTREAM);
    104103  oldcharvalid = 0;
    int gettokenchar() 
    106105  return oldchar;
    107106}
    108107
    109 ungettokenchar()
     108static void ungettokenchar()
    110109{
    111110  oldcharvalid = 1;
    112111  if (oldchar == '\n') line--;
    113112}
    114113
    115 int gettoken(s)
    116 char *s;
     114static int gettoken(char *s)
    117115{
    118116  int i;
    119117  char c;
    char *s; 
    131129  return i;
    132130}
    133131
    134 get_comment()
     132static void get_comment()
    135133{
    136134  if (eof) return;
    137135  while (1) {
    static int iostackempty() 
    148146  return (first(stack) == nil(stack));
    149147}
    150148
    151 static push_iostack(p)
    152 int p;
     149static void push_iostack(int p)
    153150{
    154151  Iostack n;
    155152
    int p; 
    177174  strcpy(FILENAME, INPUT);
    178175}
    179176
    180 static pop_iostack()
     177static void pop_iostack()
    181178{
    182179  Iostack n;
    183180
    static pop_iostack() 
    195192  if (n->stream == NULL) {
    196193    n->stream = fopen(n->filename, "r");
    197194    if (n->stream == NULL) {
    198       fprintf(stderr, "Error: cannot open file \"%s\"\n", n->stream);
     195      fprintf(stderr, "Error: cannot open file \"%s\"\n", n->filename);
    199196      exit(1);
    200197    }
    201198  }
    static pop_iostack() 
    210207  free_node(n, stack);
    211208}
    212209
    213 static nexttoken()
     210static void nexttoken()
    214211{
    215212  if (eof) return;
    216213  if (getnew) {
    static nexttoken() 
    258255  return;
    259256}
    260257
    261 int getstring(s)
    262 char *s;
     258int getstring(char *s)
    263259{
    264260  nexttoken();
    265261  if (eof) return 0;
    char *s; 
    267263  return 1;
    268264}
    269265
    270 int getint(i)
    271 int *i;
     266int getint(int *i)
    272267{
    273268  int j;
    274269
    int *i; 
    282277  return 1;
    283278}
    284279
    285 int getfloat(f)
    286 float *f;
     280int getfloat(float *f)
    287281{
    288282  int j;
    289283
    float *f; 
    304298  } else return 1;
    305299}
    306300
    307 static char *new_printable_text(s)
    308 char *s;
     301static char *new_printable_text(const char *s)
    309302{
    310303  char *new_s;
    311304  int to_pad, i, j;
    char *s; 
    334327char *getmultiline()
    335328{
    336329  char c;
    337   int i, j, done, len, started;
     330  int i, done, len, started;
    338331  char *out_str;
    339332
    340333  if (getnew == 0) return CNULL;
    char *getmultiline() 
    374367
    375368char *getlabel()
    376369{
    377   char c;
    378370  char *txt, *new;
    379   int i;
    380371
    381372  txt = getmultiline();
    382373  if (txt == CNULL) return CNULL;
    int getsystemstring() 
    415406  return 1;
    416407}
    417408
    418 rejecttoken()
     409void rejecttoken()
    419410{
    420411  getnew = 0;
    421412}