Subversion Repositories wimsdev

Rev

Rev 7676 | Rev 8100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7676 Rev 8094
Line 21... Line 21...
21
 
21
 
22
/* limit of data buffers */
22
/* limit of data buffers */
23
#define buflim 1024*1024*16
23
#define buflim 1024*1024*16
24
 
24
 
25
/***************** Nothing should need change hereafter *****************/
25
/***************** Nothing should need change hereafter *****************/
26
 
-
 
27
#include "../wims.h"
26
#include "../wims.h"
28
#include "../Lib/basicstr.c"
27
#include "../Lib/libwims.h"
29
#include "../hmname.c"
28
#include "../hmname.c"
30
 
29
 
31
char fn1[1024]="", fn2[1024]="";
30
char fn1[1024]="", fn2[1024]="";
32
char mathbuf[MAX_LINELEN+1];
31
char mathbuf[MAX_LINELEN+1];
33
char *filebuf;
32
char *filebuf;
Line 52... Line 51...
52
    {"\\Longleftarrow\\", " <== "},
51
    {"\\Longleftarrow\\", " <== "},
53
};
52
};
54
 
53
 
55
#define backtransno (sizeof(backtrans)/sizeof(backtrans[0]))
54
#define backtransno (sizeof(backtrans)/sizeof(backtrans[0]))
56
 
55
 
57
void *xmalloc(size_t n)
56
/*void *xmalloc(size_t n)
58
{
57
{
59
    void *p;
58
    void *p;
60
    p=malloc(n);
59
    p=malloc(n);
61
    if(p==NULL) exit(1);
60
    if(p==NULL) exit(1);
62
    return p;
61
    return p;
63
}
62
}
-
 
63
*/
64
 
64
 
65
/* Points to the end of the word */
65
/* Points to the end of the word */
-
 
66
/*
66
char *find_word_end(char *p)
67
char *find_word_end(char *p)
67
{
68
{
68
    int i;
69
    int i;
69
    for(i=0;!isspace(*p) && *p!=0 && i<MAX_LINELEN; p++,i++);
70
    for(i=0;!isspace(*p) && *p!=0 && i<MAX_LINELEN; p++,i++);
70
    return p;
71
    return p;
71
}
72
}
72
 
73
*/
73
/* Strips leading spaces */
74
/* Strips leading spaces */
74
char *find_word_start(char *p)
75
/*char *find_word_start(char *p)
75
{
76
{
76
    int i;
77
    int i;
77
    for(i=0; isspace(*p) && i<MAX_LINELEN; p++,i++);
78
    for(i=0; isspace(*p) && i<MAX_LINELEN; p++,i++);
78
    return p;
79
    return p;
79
}
80
}
80
 
81
*/
81
char *find_tag_end(char *p)
82
char *find_tag_end(char *p)
82
{
83
{
83
    char *pp, *old;
84
    char *pp, *old;
84
    pp=p; if(*pp=='<') pp++;
85
    pp=p; if(*pp=='<') pp++;
85
    for(; *pp && *pp!='>'; pp++) {
86
    for(; *pp && *pp!='>'; pp++) {
Line 107... Line 108...
107
      if(strncasecmp(pp+1,tag,len)==0 && !isalnum(*(pp+1+len))) return pp;
108
      if(strncasecmp(pp+1,tag,len)==0 && !isalnum(*(pp+1+len))) return pp;
108
    }
109
    }
109
    return p+strlen(p);
110
    return p+strlen(p);
110
}
111
}
111
 
112
 
112
/* modify a string. Bufferlen must be ast least MAX_LINELEN */
113
/* modify a string. Bufferlen must be ast least MAX_LINELEN
113
void string_modify(char *start, char *bad_beg, char *bad_end, char *good,...)
114
void string_modify(char *start, char *bad_beg, char *bad_end, char *good,...)
114
{
115
{
115
    char buf[MAX_LINELEN+1];
116
    char buf[MAX_LINELEN+1];
116
    va_list vp;
117
    va_list vp;
117
 
118
 
Line 121... Line 122...
121
      return;
122
      return;
122
    }
123
    }
123
    strcat(buf,bad_end);
124
    strcat(buf,bad_end);
124
    ovlstrcpy(bad_beg,buf);
125
    ovlstrcpy(bad_beg,buf);
125
}
126
}
-
 
127
*/
126
 
128
 
127
void cutamp(char *p)
129
void cutamp(char *p)
128
{
130
{
129
    char *pp;
131
    char *pp;
130
    for(pp=strchr(p,'&'); pp; pp=strchr(pp+1,'&')) {
132
    for(pp=strchr(p,'&'); pp; pp=strchr(pp+1,'&')) {