C:/Users/Dennis/src/lang/russell.orig/src/pass1/scanner/getchr.c

Go to the documentation of this file.
00001 /* Scanner input routine. Also updates yycolno.  */
00002 # include <stdio.h>
00003 # include "parm.h"
00004 # include "scan.h"
00005 
00006 extern int yycolno;
00007 
00008 char getchr()
00009 {
00010    char c;
00011 
00012    yycolno++;
00013    if ((c = getchar()) < 32) {
00014        return (charfix(c));
00015    } else {
00016        return(c);
00017    }
00018 }
00019 
00020 /* Fix things up for a control character c */
00021 char charfix(c)
00022 char c;
00023 {
00024         switch(c) {
00025                 case '\n':      yycolno = 0;
00026                                 return(c);
00027 
00028                 case '\015': /* carriage return */
00029 
00030                 case '\014': /* form feed */
00031                                 yycolno = 0;
00032                                 return('\n');
00033                                 break;
00034 
00035                 case '\t':      /* tab */
00036                                 yycolno = ((yycolno + TABWIDTH) / TABWIDTH) * TABWIDTH 
00037                                           + 1;
00038                                 return(c);
00039                 default:        return(c);
00040         }
00041 }

Generated on Fri Jan 25 10:39:46 2008 for russell by  doxygen 1.5.4