w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

cfuncs.c
Go to the documentation of this file.
1 # define CFUNCS_C
2 #include "cfuncs.h"
3 
4 int P_argc;
5 char **P_argv;
7 int _EscIO2 (int errorcode, char* filename)
8 { fprintf(stderr,"Input file %s not found\n",filename);
9  exit(errorcode); return errorcode; }
10 int _EscIO (int errorcode){ return _EscIO2(errorcode,""); }
11 int _Escape (int exitcode)
12 { exit(exitcode); return exitcode; }
13 int _SETIO (int OK, int errorcode){ return P_ioresult = OK ? 0 : errorcode; }
14 int P_eof (FILE * infile)
15 { int x;
16  if (feof(infile)) return 1;
17  x = fgetc(infile);
18  if (x==EOF) return 1;
19  ungetc(x,infile); return 0;
20  }
22 int _OutMem(void) { fprintf(stderr,"Out of memory\n"); exit(-2); return -2; }
23 void PASCAL_MAIN (int npars, char ** pars)
24 { P_argc = npars; P_argv = pars; }
25 
26 void scan1(char *s, short p, short *n)
27 { sscanf(s+p-1,"%hd",n);
28 }
29 
30 short pos1(char c, char *s)
31 { char *t = strchr(s,c);
32  if (t) return (short) (t-s+1); else return 0;
33 }
34 
35 void delete1(char *s, short p)
36 { char *t = (s+=p); s=t-1;
37  while (*s) *s++ = *t++;
38 }
39 
40 void predelete(char *s, short l)
41 { char *t = s+l;
42  while (*t) *s++ = *t++;
43  *s = *t;
44 }
45 
46 void shorten(char *s, short new_length)
47 { s[new_length] = '\0';
48 }
49 
50 short posNot(char c, char *s)
51 { char *t = s;
52  while (*t == c) t++;
53  if (*t) return t-s+1;
54  else return 0;
55 }
56 
57 void getNum(char *line, short *k)
58 { int j=sscanf(line,"%hd",k);
59  if (j<1) *k=0;
60 }
61 
62 
63 void getTwoNums(char *line, short *k1, short *k2)
64 { int param = sscanf(line,"%hd/%hd",k1,k2);
65  if (param<2) *k2 = 0;
66 }
67 
68 void toUpper(char *s)
69 { while (*s) { *s = toupper(*s); s++; }
70 }
71 
72 boolean startsWith(char *s1, char *s2)
73 { while (*s2) { if (*s1++ != *s2++) return false; }
74  return true;
75 }
76 
77 void insertChar(char c, char *s, short p)
78 { char x;
79  s += p-1;
80  do { x=c; c=*s; *s++=x; } while (x);
81 }
82 
83 char *substr_(char *Result, char *s, short start, short count)
84 { char *R = Result;
85  s += start-1;
86  while (count--) *R++ = *s++;
87  *R = '\0';
88  return Result;
89 }
90 
91 short strpos2 (char *s1, char *s2, short p)
92 { char *r = strstr (s1+p, s2);
93  if (r == NULL) return 0;
94  else return r-s1;
95 }
96 
97 short nextWordBound(char *s, char trigger, short p)
98 {
99  do {
100  p++;
101  } while (p <= strlen(s) && s[p-1] != trigger);
102  while (p < strlen(s) && s[p] != ' ')
103  p++;
104  return p;
105 }
106 
107 # undef CFUNCS_C
#define count(a)
Definition: aptex-macros.h:781
#define param(a, b)
int P_ioresult
Definition: cfuncs.c:6
short posNot(char c, char *s)
Definition: cfuncs.c:50
void delete1(char *s, short p)
Definition: cfuncs.c:35
void insertChar(char c, char *s, short p)
Definition: cfuncs.c:77
char * substr_(char *Result, char *s, short start, short count)
Definition: cfuncs.c:83
void * __MallocTemp__
Definition: cfuncs.c:21
short strpos2(char *s1, char *s2, short p)
Definition: cfuncs.c:91
int P_eof(FILE *infile)
Definition: cfuncs.c:14
int _Escape(int exitcode)
Definition: cfuncs.c:11
int _OutMem(void)
Definition: cfuncs.c:22
void predelete(char *s, short l)
Definition: cfuncs.c:40
void getNum(char *line, short *k)
Definition: cfuncs.c:57
boolean startsWith(char *s1, char *s2)
Definition: cfuncs.c:72
void toUpper(char *s)
Definition: cfuncs.c:68
void shorten(char *s, short new_length)
Definition: cfuncs.c:46
void PASCAL_MAIN(int npars, char **pars)
Definition: cfuncs.c:23
short pos1(char c, char *s)
Definition: cfuncs.c:30
char ** P_argv
Definition: cfuncs.c:5
void getTwoNums(char *line, short *k1, short *k2)
Definition: cfuncs.c:63
int P_argc
Definition: cfuncs.c:4
int _EscIO2(int errorcode, char *filename)
Definition: cfuncs.c:7
int _SETIO(int OK, int errorcode)
Definition: cfuncs.c:13
void scan1(char *s, short p, short *n)
Definition: cfuncs.c:26
int _EscIO(int errorcode)
Definition: cfuncs.c:10
short nextWordBound(char *s, char trigger, short p)
Definition: cfuncs.c:97
#define n
Definition: t4ht.c:1290
#define fgetc
Definition: xxstdio.h:26
int sscanf()
int exitcode
#define s
Definition: afcover.h:80
#define t
Definition: afcover.h:96
#define c(n)
Definition: gpos-common.c:150
#define strchr
Definition: gsftopk.c:59
static FILE * infile
Definition: rdjpgcom.c:61
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
void exit()
#define EOF
Definition: afmparse.c:59
char * strstr()
#define fprintf
Definition: mendex.h:64
float x
Definition: cordic.py:15
int k
Definition: otp-parser.c:70
char * filename[256]
Definition: pbmtopk.c:46
#define k1
int r
Definition: ppmqvga.c:68
type_C toupper(type_C)
Definition: bdf.c:133
Definition: dvips.h:235
#define FILE
Definition: t1stdio.h:34
#define ungetc(c, f)
Definition: t1stdio.h:106
#define feof(f)
Definition: t1stdio.h:109
int j
Definition: t4ht.c:1589
s1
Definition: t4ht.c:1059
char * s2
Definition: t4ht.c:1062
*job_name strlen((char *) job_name) - 4)
@ R
Definition: ubidiimp.h:46
@ start
Definition: preamble.c:52
#define OK
Definition: vlna.c:3