Back to index

wims  3.65+svn20090927
Classes | Defines | Typedefs | Functions | Variables
libwims.h File Reference
#include "../config.h"
#include "../includes.h"
#include "../wimsdef.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ev_variable
struct  leveldata

Defines

#define RAND_MAX   2147483647
#define random   genrand_int31
#define srandom   init_genrand
#define EV_S   "EVLS"
#define EV_T   "EVLT"
#define EV_X   "EVLX"
#define EV_Y   "EVLY"
#define LEVEL_LIM   256
#define LEVELPOINT_LIM   16384
#define LEVELSIZE_LIM   2048
#define LEVELGRAIN_LIM   16
#define myisdigit(x)   (x>='0' && x<='9')
#define myisalpha(x)   ((x&~32)>='A' && (x&~32)<='Z')
#define myisalnum(x)   (myisalpha(x) || myisdigit(x))
#define myisupper(x)   (x>='A' && x<='Z')
#define myislower(x)   (x>='a' && x<='z')
#define myislspace(x)   (x==' ' || x=='\t')
#define myisspace(x)   (x==' ' || x=='\t' || x=='\n' || x=='\r')

Typedefs

typedef struct ev_variable ev_variable

Functions

long int genrand_int31 (void)
char * int2str (int i)
void * xmalloc (size_t n)
int msleep (int ms)
void _tolinux (char *p)
void mystrncpy (char *dest, char *src, int lim)
char * find_matching (char *p, char c)
char * find_word_start (char *p)
char * find_word_end (char *p)
char * strparchr (char *p, char c)
char * strparstr (char *p, char *fnd)
char * find_item_end (char *p)
char * find_line_end (char *p)
char * charchr (char *p, char *w)
char * wordchr (char *p, char *w)
char * itemchr (char *p, char *w)
char * linechr (char *p, char *w)
char * varchr (char *p, char *v)
int cutitems (char *p, char *list[], int max)
int cutwords (char *p, char *list[], int max)
int cutlines (char *p, char *list[], int max)
int cutchars (char *p, char *list[], int max)
char * strip_trailing_spaces (char *p)
int verify_order (void *list, int items, size_t item_size)
int search_list (void *list, int items, size_t item_size, const char *str)
unsigned int linenum (char *p)
unsigned int itemnum (char *p)
unsigned int wordnum (char *p)
unsigned int charnum (char *p)
char * fnd_line (char *p, int n, char bf[])
char * fnd_item (char *p, int n, char bf[])
char * fnd_word (char *p, int n, char bf[])
char * fnd_char (char *p, int n, char bf[])
char * fnd_row (char *p, int n, char bf[])
int separate_item (char *p, char *parm[], int max)
int separate_line (char *p, char *parm[], int max)
int separate_word (char *p, char *parm[], int max)
int _separator (char *p, char *parm[], int max, char fs)
int rows2lines (char *p)
void lines2rows (char *p)
unsigned int rownum (char *p)
void words2items (char *p)
void words2lines (char *p)
void lines2items (char *p)
void lines2words (char *p)
void items2words (char *p)
void items2lines (char *p)
void strip_enclosing_par (char *p)
char * memstr (char *s1, char *s2, int len)
int check_parentheses (char *p, int style)
void nospace (char *p)
void singlespace (char *p)
void deaccent (char *p)
void reaccent (char *p)
void string_modify (char *start, char *bad_beg, char *bad_end, char *good,...)
long int filelength (char *fn,...)
int catfile (FILE *outf, char *fn,...)
char * moneyprint (char *p, double s)
double factorial (double d)
void init_random (void)
double drand (double m)
double irand (double n)
double sign (double d)
double binomial (double d1, double d2)
double max (double d1, double d2)
double min (double d1, double d2)
double gcd (double n1, double n2)
double lcm (double n1, double n2)
int eval_getpos (char *name)
void eval_setval (int pos, double v)
void set_evalue_pointer (char *p)
char * get_evalue_pointer (void)
double _evalue (int ord)
double strevalue (char *p)
int get_evalue_error (void)
void set_evalue_error (int e)
int get_evalcnt (void)
char * get_evalname (int i)
int get_evaltype (int i)
int evaltab_verify (void)
int search_evaltab (char *p)
int evalue_compile (char *p)
char * find_mathvar_start (char *p)
char * find_mathvar_end (char *p)
void mathvarlist (char *p)
int remove_tree (char *dirname)
void mkdirs (char *s)
void text (char *p)
int textab_verify (void)
int levelcurve (leveldata *ld)

Variables

void(* error1 )(char *msg)
void(* error2 )(char *msg)
void(* error3 )(char *msg)
char * fnd_position
char * fnd_nextpos
int * ev_varcnt
ev_variableev_var
char *(* substitute )(char *p)

Class Documentation

struct ev_variable

Definition at line 125 of file libwims.h.

Class Members
char * name
double value
struct leveldata

Definition at line 184 of file libwims.h.

Class Members
int datacnt
char * fn
int grain
int levelcnt
double levels
short unsigned int xdata
int xevpos
char * xname
double xrange
int xsize
double xspan
short unsigned int ydata
int yevpos
char * yname
double yrange
int ysize
double yspan

Define Documentation

#define EV_S   "EVLS"

Definition at line 121 of file libwims.h.

#define EV_T   "EVLT"

Definition at line 122 of file libwims.h.

#define EV_X   "EVLX"

Definition at line 123 of file libwims.h.

#define EV_Y   "EVLY"

Definition at line 124 of file libwims.h.

#define LEVEL_LIM   256

Definition at line 180 of file libwims.h.

Definition at line 183 of file libwims.h.

#define LEVELPOINT_LIM   16384

Definition at line 181 of file libwims.h.

#define LEVELSIZE_LIM   2048

Definition at line 182 of file libwims.h.

#define myisalnum (   x)    (myisalpha(x) || myisdigit(x))

Definition at line 196 of file libwims.h.

#define myisalpha (   x)    ((x&~32)>='A' && (x&~32)<='Z')

Definition at line 195 of file libwims.h.

#define myisdigit (   x)    (x>='0' && x<='9')

Definition at line 194 of file libwims.h.

#define myislower (   x)    (x>='a' && x<='z')

Definition at line 198 of file libwims.h.

#define myislspace (   x)    (x==' ' || x=='\t')

Definition at line 199 of file libwims.h.

#define myisspace (   x)    (x==' ' || x=='\t' || x=='\n' || x=='\r')

Definition at line 200 of file libwims.h.

#define myisupper (   x)    (x>='A' && x<='Z')

Definition at line 197 of file libwims.h.

#define RAND_MAX   2147483647

Definition at line 28 of file libwims.h.

Definition at line 29 of file libwims.h.

Definition at line 30 of file libwims.h.


Typedef Documentation

typedef struct ev_variable ev_variable

Function Documentation

double _evalue ( int  ord)

Definition at line 308 of file evalue.c.

{
    double d,dd;
    int i,k;
    char buf[32];

    
    if(evalue_error) return NAN;
    d=0;
    while(*evalue_pt=='+') evalue_pt++;
    if(*evalue_pt==0) return 0; /* empty string */
    switch(*evalue_pt) {
       case '(':
       evalue_pt++; d=_evalue(')');goto vld;
       case '|':
       if(ord=='|') {
           evalue_pt++; return 0;
       }
       evalue_pt++; d=fabs(_evalue('|'));goto vld;
       case '-':
       evalue_pt++; d=-_evalue(6);goto vld;
    }
    if((128&*evalue_pt)!=0) {
       k=(*evalue_pt)&255; evalue_pt++;
       if(k>=130 && k<140) {
           i=(k-130)*200; k=(*evalue_pt)&255; evalue_pt++;
           if(k<33 || k>=233) goto badeval;
           i+=k-33; if(i<0 || i>=evalname_no) goto badeval;
           goto ename;
       }
       if(k>=140 && k<150) {
           i=(k-140)*200; k=(*evalue_pt)&255; evalue_pt++;
           if(k<33 || k>=233) goto badeval;
           if(ev_var==NULL || ev_varcnt==NULL) goto badeval;
           i+=k-33; if(i<0 || i>=*ev_varcnt) goto badeval;
           goto vname;
       }
       evalue_pt++; goto badeval;
    }
    if(*evalue_pt=='.' || myisdigit(*evalue_pt))
       {d=strtod(evalue_pt,&evalue_pt);goto binary;}
    for(i=0;myisalnum(*(evalue_pt+i)) && i<16; i++)
      buf[i]=*(evalue_pt+i);
    buf[i]=0; evalue_pt+=i;
    if(i==0) goto badeval;
    if(ev_varcnt!=NULL && ev_var!=NULL && *ev_varcnt>0)
      for(i=0;i<*ev_varcnt;i++) {
         if(strcmp(buf,ev_var[i].name)==0) {
             vname: d=ev_var[i].value; goto vld;
         }
      }
    i=search_list(evalname,evalname_no,sizeof(evalname[0]),buf);
    ename: if(i>=0) switch(evalname[i].type) {
       case 0: {
           d=evalname[i].val;
           if(evalname[i].f1!=NULL) {
              if(d==0) d=NAN; if(d==1) d=HUGE_VAL;
           }
           break;
       }
       case 1: {
           if(*evalue_pt!='(') return NAN;
           evalue_pt++;
           d=evalname[i].f1(_evalue(')')); break;
       }
       case 2: {
           double parm1,parm2;
           if(*evalue_pt!='(') return NAN;
           evalue_pt++;
           parm1=_evalue(',');parm2=_evalue(')');
           d=evalname[i].f2(parm1,parm2); break;
       }
       default: {    /* This is impossible. */
           return NAN;
       }
    }
    else {
       badeval: evalue_error=-1; return NAN;
    }
  vld:
    if(evalue_error) return NAN;
  binary:
    if(*evalue_pt=='!') {
       evalue_pt++; d=factorial(d);
    }
    if(*evalue_pt==ord) {evalue_pt++;goto ok;}
    if(*evalue_pt==0 || 
       (ord<10 && (*evalue_pt==',' || *evalue_pt==';' || *evalue_pt==')'
                 || *evalue_pt=='|')))
       goto ok;
    switch(*evalue_pt) {
              case '+':
                     if(ord<=8) break;
                     evalue_pt++; d+=_evalue(8);goto vld;
              case '-':
                     if(ord<=8) break;
                     evalue_pt++; d-=_evalue(8);goto vld;
              case '*':
                     if(ord<=6) break;
                     evalue_pt++; d*=_evalue(6);goto vld;
              case '/':
                     if(ord<=6) break;
                     evalue_pt++; dd=_evalue(6);
                     if(dd==0) {evalue_error=10;return NAN;}
                     d/=dd;goto vld;
       case '%': {
           int di, ddi;
           if(ord<=6) break;
           evalue_pt++; dd=_evalue(6);
           if(dd==0) {evalue_error=10;return NAN;}
           di=d; ddi=dd; d=di%ddi;goto vld;
       }
       case '^': {
           if(ord<5) break;
           evalue_pt++; d=pow(d,_evalue(5));goto vld;
       }
       default : {
           /*if(ord<=6) break;
           d*=_evalue(6);goto vld;*/
           return NAN;
       }
    }
    ok: return d;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _separator ( char *  p,
char *  parm[],
int  max,
char  fs 
)
void _tolinux ( char *  p)

Definition at line 57 of file lines.c.

{
    char *pp,*p1;
    pp=strchr(p,13); if(pp==NULL) return;
    for(p1=pp; *pp; pp++) {
       if(*pp==13) {
           if(*(pp+1)=='\n' || (pp>p && *(pp-1)=='\n') ||
              (*(pp+1)=='\\' && *(pp+2)=='\n')) continue;
           else *pp='\n';
       }
       *p1++=*pp;
    }
    *p1=0;
}

Here is the caller graph for this function:

double binomial ( double  d1,
double  d2 
)

Definition at line 136 of file evalue.c.

{
    return factorial(d1)/(factorial(d2)*factorial(d1-d2));
}

Here is the call graph for this function:

int catfile ( FILE *  outf,
char *  fn,
  ... 
)

Definition at line 711 of file lines.c.

{
    char buf[4096];
    va_list vp;
    int l,tot,fd;
    
    tot=0;
    va_start(vp,fn);
    vsnprintf(buf,sizeof(buf),fn,vp); va_end(vp);
    fd=open(buf,O_RDONLY); if(fd==-1) return 0;
    for(l=read(fd,buf,4096);l>0 && l<=4096; l=read(fd,buf,4096)) {
       fwrite(buf,1,l,outf); tot+=l;
    }
    close(fd);
    return tot;
}

Here is the caller graph for this function:

char* charchr ( char *  p,
char *  w 
)

Definition at line 203 of file lines.c.

{
    return strchr(p,w[0]);
}

Here is the caller graph for this function:

unsigned int charnum ( char *  p)

Definition at line 396 of file lines.c.

{
    return strlen(p);
}

Here is the caller graph for this function:

int check_parentheses ( char *  p,
int  style 
)

Definition at line 528 of file lines.c.

{
    int i,j,k;
    j=strlen(p);
    if(j>=MAX_LINELEN) return 65535;
    if(style!=0) {
       char buf[MAX_LINELEN+1];
       char *pp, *pe, c;
       for(pp=p;pp<p+j;pp++) {
           switch (*pp) {
              case ')':
              case ']':
              case '}': return -1;
              case '(': c=')'; goto find;
              case '[': c=']'; goto find;
              case '{': c='}';
              find: {
                  pe=find_matching(pp+1,c);
                  if(pe==NULL) return 1;
                  memcpy(buf,pp+1,pe-pp-1);
                  buf[pe-pp-1]=0;
                  if((k=check_parentheses(buf,1))!=0) return k;
                  else pp=pe;
              }
              default: break;
           }
       }
       return 0;
    }
    for(i=k=0;i<j && k>=0;i++) {
       if(*(p+i)=='(') k++;
       if(*(p+i)==')') k--;
    }
    return k;
}

Here is the caller graph for this function:

int cutchars ( char *  p,
char *  list[],
int  max 
)

Definition at line 299 of file lines.c.

{
    int i; char *pp;
    for(i=0,pp=p;*pp && i<max;list[i++]=pp++);
    return i;
}
int cutitems ( char *  p,
char *  list[],
int  max 
)

Definition at line 284 of file lines.c.

{
    return _cutit_(p,list,max,find_item_end,3);
}

Here is the caller graph for this function:

int cutlines ( char *  p,
char *  list[],
int  max 
)

Definition at line 294 of file lines.c.

{
    return _cutit_(p,list,max,find_line_end,0);
}

Here is the caller graph for this function:

int cutwords ( char *  p,
char *  list[],
int  max 
)

Definition at line 289 of file lines.c.

{
    return _cutit_(find_word_start(p),list,max,find_word_end,1);
}

Here is the caller graph for this function:

void deaccent ( char *  p)

Definition at line 660 of file lines.c.

{
    signed char *sp;
    char *v;
    for(sp=p;*sp;sp++) {
       if(*sp<0 && (v=strchr(acctab,*sp))!=NULL)
         *sp=*(deatab+(v-acctab));
    }
}

Here is the caller graph for this function:

double drand ( double  m)

Definition at line 63 of file evalue.c.

{
    double r;
    r=((double) random()+(double) random()/(double) RAND_MAX);
    return (r/(double) RAND_MAX)*m;
}

Here is the caller graph for this function:

int eval_getpos ( char *  name)

Definition at line 291 of file evalue.c.

{
    return search_list(evalname,evalname_no,sizeof(evalname[0]),name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void eval_setval ( int  pos,
double  v 
)

Definition at line 297 of file evalue.c.

{
    if(pos>=0 && pos<evalname_no) evalname[pos].val=v;
}

Here is the caller graph for this function:

int evaltab_verify ( void  )

Definition at line 273 of file evalue.c.

{return verify_order(evalname,evalname_no,sizeof(evalname[0]));}

Here is the call graph for this function:

Here is the caller graph for this function:

int evalue_compile ( char *  p)

Definition at line 460 of file evalue.c.

{
    char *p1, *p2, *pe, name[256], buf[8];
    int i,k;
    
    k=0;
    for(p1=p; *p1; p1++) if((128&*p1)!=0) return -1;
    nospace(p);
    for(p1=find_mathvar_start(p); *p1; p1=find_mathvar_start(pe)) {
       pe=find_mathvar_end(p1);
       if(!myisalpha(*p1)) continue;
       p2=pe; if(p2-p1>16) continue;
       memmove(name,p1,p2-p1); name[p2-p1]=0;
       if(ev_varcnt!=NULL && ev_var!=NULL && *ev_varcnt>0) {
           for(i=0;i<*ev_varcnt && strcmp(name,ev_var[i].name)!=0;i++);
           if(i<*ev_varcnt && i<2000) {
              buf[0]=i/200+140; buf[1]=i%200+33; buf[2]=0;
              string_modify(p,p1,p2,"%s",buf);
              pe=p1+2; k++; continue;
           }
       }
       i=search_list(evalname,evalname_no,sizeof(evalname[0]),name);
       if(i>=0 && i<2000) {
           buf[0]=i/200+130; buf[1]=i%200+33; buf[2]=0;
           string_modify(p,p1,p2,"%s",buf);
           pe=p1+2; k++; continue;
       }
    }
    return k;
}

Here is the call graph for this function:

Here is the caller graph for this function:

double factorial ( double  d)

Definition at line 125 of file evalue.c.

{
    int i,n; double t;
    n=d;
    if(n<0 || n!=d) return NAN;
    if(n>1000) return HUGE_VAL;
    t=1; for(i=1;i<=n;i++) t=t*i;
    return t;
}

Here is the caller graph for this function:

long int filelength ( char *  fn,
  ... 
)

Definition at line 729 of file lines.c.

{
    char buf[MAX_FNAME+1];
    va_list vp;
    struct stat st;
    int l;
    
    va_start(vp,fn);
    vsnprintf(buf,sizeof(buf),fn,vp); va_end(vp);
    l=stat(buf,&st); if(l) return -1;
    return st.st_size;
}

Here is the caller graph for this function:

char* find_item_end ( char *  p)

Definition at line 190 of file lines.c.

{
    return strparstr(p,",");
}

Here is the caller graph for this function:

char* find_line_end ( char *  p)

Definition at line 196 of file lines.c.

{
    char *pp=strstr(p,"\n");
    if(pp==NULL) pp=p+strlen(p);
    return pp;
}

Here is the caller graph for this function:

char* find_matching ( char *  p,
char  c 
)

Definition at line 113 of file common.c.

{
    char *pp;
    int parenth, brak, brace;
    parenth=brak=brace=0;
    for(pp=p; *pp!=0; pp++) {
       switch(*pp) {
           case '[': brak++; break;
           case ']': brak--; break;
           case '(': parenth++; break;
           case ')': parenth--; break;
           case '{': brace++; break;
           case '}': brace--; break;
           default: continue;
       }
       if(parenth<0 || brak<0 || brace<0) {
           if(*pp!=c || parenth>0 || brak>0 || brace>0) return NULL;
           else break;
       }
    }
    if(*pp!=c) return NULL;
    return pp;
}
char* find_mathvar_end ( char *  p)

Definition at line 30 of file math.c.

{
    int i; char *pp;
    if(!isalnum(*p) && *p!='.') return p;
    if(isalpha(*p)) {
       for(i=0; *p!=0 && (isalnum(*p) || *p=='.' || *p=='\'')
           && i<MAX_LINELEN;p++,i++);
       return p;
    }
    else {
       int t=0;
       expon:
       for(i=0; (isdigit(*p) || *p=='.') && i<MAX_LINELEN;p++,i++);
       pp=p; if(t) return pp;
       while(isspace(*p)) p++;
       if(*p=='e' || *p=='E'){
           t=1; p++; while(isspace(*p)) p++;
           if(isdigit(*p)) goto expon;
           if((*p=='-' || *p=='+') && isdigit(*(p+1))) {
              p++; goto expon;
           }
       }
       return pp;
    }
}

Here is the caller graph for this function:

char* find_mathvar_start ( char *  p)

Definition at line 22 of file math.c.

{
    int i;
    for(i=0;!isalnum(*p) && *p!='.' && *p!=0 && i<MAX_LINELEN; p++,i++);
    return p;
}

Here is the caller graph for this function:

char* find_word_end ( char *  p)

Definition at line 74 of file common.c.

{
    int i;
    for(i=0;!isspace(*p) && *p!=0 && i<MAX_LINELEN; p++,i++);
    return p;
}
char* find_word_start ( char *  p)

Definition at line 82 of file common.c.

{
    int i;
    for(i=0; isspace(*p) && i<MAX_LINELEN; p++,i++);
    return p;
}
char* fnd_char ( char *  p,
int  n,
char  bf[] 
)

Definition at line 452 of file lines.c.

{
    int t;
    
    t=strlen(p);
    if(n>t || n<1) {*bf=0;fnd_position=NULL; fnd_nextpos="";}
    else {
       *bf=*(p+n-1); *(bf+1)=0;
       fnd_position=p+n-1;fnd_nextpos=p+n;
    }
    return bf;
}

Here is the caller graph for this function:

char* fnd_item ( char *  p,
int  n,
char  bf[] 
)

Definition at line 418 of file lines.c.

{
    char *pp, *pe;
    int i;

    for(i=1,pp=p; i<n && (pp==p || *(pp-1)!=0); pp=find_item_end(pp)+1, i++);
    fnd_position=pp; if(pp>p && *(pp-1)==0) {
       fnd_position=NULL; *bf=0; return bf;
    }
    pp=find_word_start(pp); pe=find_item_end(pp);
    if(*pe) fnd_nextpos=pe+1; else fnd_nextpos=pe;
    while(pe>pp && myisspace(*(pe-1))) pe--;
    memmove(bf,pp,pe-pp); bf[pe-pp]=0;
    return bf;
}

Here is the caller graph for this function:

char* fnd_line ( char *  p,
int  n,
char  bf[] 
)

Definition at line 402 of file lines.c.

{
    char *pp;
    int i;
    
    for(i=1,pp=p; pp-1!=NULL && *pp!=0 && i<n; pp=strchr(pp,'\n')+1, i++);
    fnd_position=pp; if(pp-1==NULL) {
       fnd_position=NULL; fnd_nextpos=""; *bf=0; return bf;
    }
    for(i=0; *(pp+i)!=0 && *(pp+i)!='\n'; i++) *(bf+i)=*(pp+i);
    *(bf+i)=0;
    if(pp[i]=='\n') i++; fnd_nextpos=pp+i;
    return bf;
}

Here is the caller graph for this function:

char* fnd_row ( char *  p,
int  n,
char  bf[] 
)

Definition at line 505 of file lines.c.

{
    rows2lines(p); return fnd_line(p,n,bf);
}

Here is the caller graph for this function:

char* fnd_word ( char *  p,
int  n,
char  bf[] 
)

Definition at line 435 of file lines.c.

{
    char *pp;
    int i;
    
    for(i=1, pp=find_word_start(p); *pp!=0 && i<n ; i++) {
       while(!myisspace(*pp) && *pp!=0) pp++;
       pp=find_word_start(pp);
    }
    if(*pp) fnd_position=pp; else fnd_position=NULL;
    for(i=0; *(pp+i)!=0 && !myisspace(*(pp+i)); i++) *(bf+i)=*(pp+i);
    fnd_nextpos=find_word_start(pp+i);
    *(bf+i)=0; 
    return bf;
}

Here is the caller graph for this function:

double gcd ( double  n1,
double  n2 
)

Definition at line 154 of file evalue.c.

{
    unsigned long long int l1, l2, ll;
    n1=abs(n1); n2=abs(n2);
    if(!finite(n1) || !finite(n2) || n1<0 || n2<0 ||
       n1>1E18 || n2>1E18) return NAN;
    l1=n1; l2=n2;
    if(l1<l2) {
       ll=l1;l1=l2;l2=ll;
    }
    if(l1==0) return NAN;
    while(l2>0) {
       ll=l2;l2=l1%l2;l1=ll;
    }
    return l1;
}

Here is the caller graph for this function:

long int genrand_int31 ( void  )

Definition at line 138 of file mt19937ar.c.

{
    return (long)(genrand_int32()>>1);
}

Here is the call graph for this function:

int get_evalcnt ( void  )

Definition at line 270 of file evalue.c.

{return evalname_no;}

Here is the caller graph for this function:

char* get_evalname ( int  i)

Definition at line 271 of file evalue.c.

{return evalname[i].name;}

Here is the caller graph for this function:

int get_evaltype ( int  i)

Definition at line 272 of file evalue.c.

{return evalname[i].type;}

Here is the caller graph for this function:

int get_evalue_error ( void  )

Definition at line 281 of file evalue.c.

{ return evalue_error; }
char* get_evalue_pointer ( void  )

Definition at line 303 of file evalue.c.

{
    return evalue_pt;
}
void init_random ( void  )

Definition at line 51 of file evalue.c.

{
    int r;
    struct timeval t;
/*    initstate(1,rand_buf,RAND_BUF_SIZE); */
    gettimeofday(&t,NULL);
    r=t.tv_usec+t.tv_sec*1000;
    if(r<0) r=-r; if(r==0) r=1;
    srandom(r);
}

Here is the caller graph for this function:

char* int2str ( int  i)

Definition at line 23 of file lines.c.

{
    int neg,t;
    static char int_buf[int_buf_size];
    int_buf[int_buf_size-1]=0;
    neg=0; if(i<0) {neg=1;i=-i;}
    for(t=int_buf_size-2;t>=0;) {
       int_buf[t--]=i%10+'0'; i/=10;
       if(i==0) break;
    }
    if(t<=0) {int_buf[0]=0; return int_buf;} /* should never occur. */
    if(neg) int_buf[t--]='-';
    t++; return int_buf+t;
}

Here is the caller graph for this function:

double irand ( double  n)

Definition at line 72 of file evalue.c.

{
    int  end,r;
    if(n==0) return 0;
    if(n>0) end=n; else end=-n;
    r=(double) random()*end/RAND_MAX;
    if(r==n) r--;
    if(n>0) return r; else return -r;    
}

Here is the caller graph for this function:

char* itemchr ( char *  p,
char *  w 
)

Definition at line 222 of file lines.c.

{
    char *r, *r1, *r2; int n;

    if(*w==0) return NULL;
    n=strlen(w);
    for(r=strstr(p,w);r!=NULL; r=strstr(r+1,w)) {
       r1=r-1;while(r1>=p && myisspace(*r1)) r1--;
       r2=find_word_start(r+n);
       if((r1<p || *r1==',') && (*r2==0 || *r2==',')) return r;
    }
    return r;
}

Here is the caller graph for this function:

unsigned int itemnum ( char *  p)

Definition at line 374 of file lines.c.

{
    int i; char *pp;

    if(*p==0) return 0;
    for(i=0,pp=p; pp==p || *(pp-1)!=0; pp=find_item_end(pp)+1, i++);
    return i;
}

Here is the caller graph for this function:

void items2lines ( char *  p)

Definition at line 650 of file lines.c.

{
    char *pp;
    for(pp=strparstr(p,",");*pp;pp=strparstr(pp+1,",")) *pp='\n';
}
void items2words ( char *  p)

Definition at line 643 of file lines.c.

{
    char *pp;
    for(pp=strparstr(p,",");*pp;pp=strparstr(pp+1,",")) *pp=' ';
}

Here is the caller graph for this function:

double lcm ( double  n1,
double  n2 
)

Definition at line 171 of file evalue.c.

{
    return n1*n2/gcd(n1,n2);
}

Here is the call graph for this function:

int levelcurve ( leveldata ld)

Definition at line 66 of file levelcurve.c.

{
    int xx,yy,xi,yi,xsteps,ysteps;
    int i,x,y,xt,yt;
    short int l1[LEVELSIZE_LIM+16], l2[LEVELSIZE_LIM+16];
    short int l3[LEVELGRAIN_LIM+2][LEVELGRAIN_LIM+2];
    char f[MAX_LINELEN+1];
    
    ld->datacnt=0;
    if(ld->fn==NULL || *(ld->fn)==0 || ld->levelcnt<1) return 1;
    if(ld->grain<1) ld->grain=4;
    if(ld->grain>LEVELGRAIN_LIM) ld->grain=LEVELGRAIN_LIM;
    if(ld->levelcnt>LEVEL_LIM) ld->levelcnt=LEVEL_LIM;
    if(ld->xsize<10 || ld->xsize>LEVELSIZE_LIM) return 2;
    if(ld->ysize<10 || ld->ysize>LEVELSIZE_LIM) return 2;
    if(check_parentheses(ld->fn,0)) return 3;
    ld->xspan=ld->xrange[1]-ld->xrange[0];
    ld->yspan=ld->yrange[1]-ld->yrange[0];
    if(ld->levelcnt>1) qsort(ld->levels,ld->levelcnt,sizeof(double),_lcomp);
    if(ld->xname==NULL || *(ld->xname)==0) ld->xname="x";
    if(ld->yname==NULL || *(ld->yname)==0) ld->yname="y";
    snprintf(f,sizeof(f),"%s",ld->fn); substitute(f); ld->fn=f;
    ld->xevpos=eval_getpos(EV_X); ld->yevpos=eval_getpos(EV_Y);
    if(ld->xevpos<0 || ld->yevpos<0) return 4;
    lc_replacexy(ld); evalue_compile(f);
    xsteps=(ld->xsize+ld->grain-1)/ld->grain+1;
    ysteps=(ld->ysize+ld->grain-1)/ld->grain+1;
    for(yy=yi=0;yi<ysteps;yy+=ld->grain,yi++) l2[yi]=_getlevel(ld,0,yy);
    l2[ysteps]=l2[ysteps-1];
    for(xi=1,xx=ld->grain;xi<xsteps && ld->datacnt<LEVELPOINT_LIM;xx+=ld->grain,xi++) {
       memmove(l1,l2,(ysteps+1)*sizeof(short int));
       for(yi=yy=0;yi<ysteps;yy+=ld->grain,yi++) l2[yi]=_getlevel(ld,xx,yy);
       l2[ysteps]=l2[ysteps-1];
       for(yi=0;yi<ysteps && ld->datacnt<LEVELPOINT_LIM;yi++)
         if(l1[yi]!=l1[yi+1] || l1[yi]!=l2[yi] || l1[yi]!=l2[yi+1]) {
             for(x=0,xt=(xi-1)*ld->grain;x<=ld->grain;x++,xt++)
              for(y=0,yt=yi*ld->grain;y<=ld->grain;y++,yt++) {
                  if(x==0 && y==0) {l3[x][y]=l1[yi]; continue;}
                  if(x==0 && y==ld->grain) {l3[x][y]=l1[yi+1]; continue;}
                  if(x==ld->grain && y==0) {l3[x][y]=l2[yi]; continue;}
                  if(x==ld->grain && y==ld->grain) {l3[x][y]=l2[yi+1]; continue;}
                  l3[x][y]=_getlevel(ld,xt,yt);
              }
             for(x=0,xt=(xi-1)*ld->grain;x<ld->grain;x++,xt++)
              for(y=0,yt=yi*ld->grain;y<ld->grain;y++,yt++) {
                  i=l3[x][y];
                  if((i!=l3[x][y+1] || i!=l3[x+1][y]) && 
                     ld->datacnt<LEVELPOINT_LIM && 
                     (i!=l3[x][y+1] || ld->datacnt==0 ||
                     l3[x+1][y+1]==l3[x+1][y] ||
                     ld->xdata[ld->datacnt-1]!=xt ||
                     ld->ydata[ld->datacnt-1]!=yt-1)) {
                     ld->xdata[ld->datacnt]=xt;
                     ld->ydata[ld->datacnt++]=yt;
                  }
              }
         }
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* linechr ( char *  p,
char *  w 
)

Definition at line 237 of file lines.c.

{
    char *r;
    int n;

    if(*w==0) return NULL;
    n=strlen(w);
    for(r=strstr(p,w);r!=NULL; r=strstr(r+1,w)) {
       if((r<=p || *(r-1)=='\n') && (*(r+n)==0 || *(r+n)=='\n'))
         break;
    }
    return r;
}

Here is the caller graph for this function:

unsigned int linenum ( char *  p)

Definition at line 362 of file lines.c.

{
    int i; char *pp;

    /* Ending blank line will be thus removed. */
    i=strlen(p); if(i>1 && *(p+i-1)=='\n') *(p+i-1)=0;
    if(*p=='\n') i=1; else i=0;
    for(pp=p; pp!=NULL && *pp!=0; pp=strchr(pp+1,'\n'), i++);
    return i;
}

Here is the caller graph for this function:

void lines2items ( char *  p)

Definition at line 629 of file lines.c.

{
    char *pp;
    for(pp=strchr(p,'\n'); pp; pp=strchr(pp,'\n')) *pp++=',';
}
void lines2rows ( char *  p)

Definition at line 488 of file lines.c.

{
    char *pp;
    strip_trailing_spaces(p);
    for(pp=strchr(find_word_start(p),'\n'); pp!=NULL; pp=strchr(pp+1,'\n'))
      *pp=';';
}

Here is the caller graph for this function:

void lines2words ( char *  p)

Definition at line 636 of file lines.c.

{
    char *pp;
    for(pp=strchr(p,'\n'); pp; pp=strchr(pp,'\n')) *pp++=' ';
}
void mathvarlist ( char *  p)

Definition at line 58 of file math.c.

{
    char buf[MAX_LINELEN+1], *pb, *pe, *pp;
    char *l[10240];
    int i,j,len, nofn=0;

    pb=find_word_start(p);pe=find_word_end(pb);
    if(pe-pb==strlen("nofn") && memcmp(pb,"nofn",strlen("nofn"))==0) {
       nofn=1; pb=find_word_start(pe);
    }
    snprintf(buf,sizeof(buf),"%s",pb);
    len=strlen(buf);
    for(i=0,pb=buf;pb<buf+len;pb++) {
       if(!isalpha(*pb)) continue;
       if(pb>buf && isalnum(*(pb-1))) {
           pb=find_mathvar_end(pb); continue;
       }
       pe=find_mathvar_end(pb); pp=find_word_start(pe);
       if(nofn && *pp=='(') {
           pb=pe; continue;
       }
       *pe=0;
       if(i<10240) {
           for(j=0;j<i;j++) if(strcmp(pb,l[j])==0) goto nextp;
           l[i++]=pb;
       }
       nextp:
       pb=pe;
    }
    for(*p=0,j=0;j<i;j++) {
       strcat(p,l[j]);
       if(j<i-1) strcat(p,",");
    }
}

Here is the call graph for this function:

double max ( double  d1,
double  d2 
)

Definition at line 142 of file evalue.c.

{
    if(!finite(d1) || !finite(d2)) return NAN;
    if(d1<d2) return d2; else return d1;
}

Here is the caller graph for this function:

char* memstr ( char *  s1,
char *  s2,
int  len 
)

Definition at line 513 of file lines.c.

{
    char *p, *pp;
    pp=s1;
    for(p=s1; p<s1+len; p=pp) {
       pp=strstr(p,s2); if(pp!=NULL) break;
       pp=p+strlen(p);
       while(pp<s1+len && *pp==0) pp++;
    }
    return pp;
}

Here is the caller graph for this function:

double min ( double  d1,
double  d2 
)

Definition at line 147 of file evalue.c.

{
    if(!finite(d1) || !finite(d2)) return NAN;
    if(d1<d2) return d1; else return d2;
}

Here is the caller graph for this function:

void mkdirs ( char *  s)

Definition at line 47 of file dir.c.

{
    struct stat st;
    if(stat(s,&st)==-1) {
       if(strrchr(s,'/')!=NULL) {
           char buf[MAX_FNAME+1];
           mystrncpy(buf,s,sizeof(buf));
           *strrchr(buf,'/')=0; mkdirs(buf);
       }
       mkdir(s,S_IRWXU|S_IRWXG|S_IRWXO);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* moneyprint ( char *  p,
double  s 
)

Definition at line 26 of file evalue.c.

{
    char *p1, *p2, buf[16];
    int t, t1, t2;
    if(s<0) {*p++='-'; s=-s;}
    if(s>999999) s=999999;
    t=floor(s*100+0.5); if(t>99999999) t=99999999; if(t<0) t=0;
    if(t==0) {*p++='0'; *p=0; return p;}
    t1=t/100; t2=t%100; p1=buf+10;
    for(*p1--=t1%10+'0',t1/=10;t1>0;*p1--=t1%10+'0',t1/=10);
    p2=buf+11;
    if(t2) {
       *p2++='.';
       *p2++=t2/10+'0'; t2%=10;
       if(t2) *p2++=t2+'0';
    }
    p1++; *p2=0; memmove(p,p1,p2-p1+1); p+=p2-p1;
    return p;
}

Here is the caller graph for this function:

int msleep ( int  ms)

Definition at line 48 of file lines.c.

{
    struct timespec req, rem;
    if(ms<=0) return 0;
    req.tv_sec=ms/1000; req.tv_nsec=(ms%1000)*1000*1000;
    return nanosleep(&req,&rem);
}

Here is the caller graph for this function:

void mystrncpy ( char *  dest,
char *  src,
int  lim 
)

Definition at line 73 of file lines.c.

{
    int i;
    i=strlen(src);
    if(i<0 || (i>=lim && i>=MAX_LINELEN)) error1("cmd_output_too_long");
    if(i>=lim) i=lim-1;
    memmove(dest,src,i); dest[i]=0;
}
void nospace ( char *  p)

Definition at line 605 of file lines.c.

{
    char *pp, *pt;
    for(pp=pt=p;*pp;pp++) if(!myisspace(*pp)) *pt++=*pp;
    *pt=0;
}

Here is the caller graph for this function:

void reaccent ( char *  p)

Definition at line 677 of file lines.c.

{
    char *sp, *ap, c;
    int i, k;
    if(*p==0) return;
    for(sp=p+1; *sp; sp++) {
       ap=strchr(reaccents,*sp); if(ap==NULL) continue;
       i=ap-reaccents;
       sp--; ap=strchr(reaccentl,*sp); if(ap==NULL) {sp++; continue;}
       k=ap-reaccentl;
       c=reaccentab[k*strlen(reaccents)+i];
       if(c!=*sp) {*sp=c; strcpy(sp+1,sp+2);}
       else sp++;
    }
}

Here is the caller graph for this function:

int remove_tree ( char *  dirname)

Definition at line 21 of file dir.c.

{
    DIR *sdir;
    struct dirent *f;
    struct stat dst;

    sdir=opendir(dirname);
    if(sdir==NULL) {   /* Cannot open session directory. */
       return -1;
    }
    while((f=readdir(sdir))!=NULL) {
       char fname[MAX_LINELEN+1];
       if(strcmp(".",f->d_name)==0 || strcmp("..",f->d_name)==0) continue;
       snprintf(fname,sizeof(fname),"%s/%s",dirname,f->d_name);
       if(lstat(fname,&dst)) continue;
       if(S_ISDIR(dst.st_mode)) remove_tree(fname);
       else remove(fname);
    }
    closedir(sdir);
    if(rmdir(dirname)<0) {  /* Cannot remove directory. */
       return -1;
    }
    return 0;
}
unsigned int rownum ( char *  p)

Definition at line 496 of file lines.c.

{
    char buf[MAX_LINELEN+1];
    snprintf(buf,sizeof(buf),"%s",p);
    rows2lines(buf);
    return linenum(buf);
}

Here is the caller graph for this function:

int rows2lines ( char *  p)

Definition at line 466 of file lines.c.

{
    char *pp, *p2;
    int t;
    if(strchr(p,'\n')!=NULL) return 0;
    for(t=0, pp=p; *pp; pp++) {
       if(*pp=='(') {p2=find_matching(pp+1,')'); if(p2!=NULL) pp=p2; continue;}
       if(*pp=='[') {p2=find_matching(pp+1,']'); if(p2!=NULL) pp=p2; continue;}
       if(*pp=='{') {p2=find_matching(pp+1,'}'); if(p2!=NULL) pp=p2; continue;}
       if(*pp==';') {*pp='\n'; t++; continue;}
       if(*pp=='&' && myisalpha(*(pp+1))) {
           for(p2=pp+1; myisalpha(*p2) && p2-pp<14; p2++);
           pp=p2; continue;
       }
       if(*pp=='&' && *(pp+1)=='#') {
           for(p2=pp+2; myisdigit(*p2) && p2-pp<6; p2++);
           pp=p2; continue;
       }
    }
    return t;
}

Here is the caller graph for this function:

int search_evaltab ( char *  p)

Definition at line 274 of file evalue.c.

                            {
    return search_list(evalname,evalname_no,sizeof(evalname[0]),p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int search_list ( void *  list,
int  items,
size_t  item_size,
const char *  str 
)

Definition at line 139 of file common.c.

{
    int i1,i2,j,k;
    char **p;
    char c;
    
    if(items<=0) return -1;
    j=0; c=*str;
    p=list;
    k=**p-c; if(k==0) k=strcmp(*p,str);
    if(k==0) return k; if(k>0) return -1;
    p=list+(items-1)*item_size; 
    k=**p-c; if(k==0) k=strcmp(*p,str);
    if(k==0) return items-1; if(k<0) return -1;
    for(i1=0,i2=items-1;i2>i1+1;) {
       j=i1+(i2-i1)/2;
       p=list+(j*item_size);
       k=**p-c; if(k==0) k=strcmp(*p,str);
       if(k==0) return j;
       if(k>0) {i2=j; continue;}
       if(k<0) {i1=j; continue;}   
    }
    return -1;
}
int separate_item ( char *  p,
char *  parm[],
int  max 
)
int separate_line ( char *  p,
char *  parm[],
int  max 
)
int separate_word ( char *  p,
char *  parm[],
int  max 
)
void set_evalue_error ( int  e)

Definition at line 282 of file evalue.c.

{evalue_error=e; return;}

Here is the caller graph for this function:

void set_evalue_pointer ( char *  p)

Definition at line 285 of file evalue.c.

{
    evalue_pt=p;
}

Here is the caller graph for this function:

double sign ( double  d)

Definition at line 83 of file evalue.c.

{
    if(d==0) return 0;
    if(d<0) return -1;
    else return 1;
}

Here is the caller graph for this function:

void singlespace ( char *  p)

Definition at line 593 of file lines.c.

{
    char *pp, *pt, *p2;
    for(pp=pt=p;*pp;pp++) {
       if(!myisspace(*pp)) {*pt++=*pp; continue; }
       *pt++=' ';
       for(p2=pp+1;myisspace(*p2);p2++); pp=--p2;
    }
    *pt=0;
}

Here is the caller graph for this function:

double strevalue ( char *  p)

Definition at line 444 of file evalue.c.

{
    char buf[MAX_LINELEN+1];
    
    if(p==NULL) return 0;
    mystrncpy(buf,p,sizeof(buf));
    substitute(buf); nospace(buf);
    if(check_parentheses(buf,0)) return NAN;
    set_evalue_error(0);
    set_evalue_pointer(buf);
    return _evalue(10);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void string_modify ( char *  start,
char *  bad_beg,
char *  bad_end,
char *  good,
  ... 
)

Definition at line 694 of file lines.c.

{
    char buf[MAX_LINELEN+1];
    int ln, le;
    va_list vp;
    
    va_start(vp,good);
    vsnprintf(buf,sizeof(buf),good,vp); va_end(vp);
    ln=strlen(buf); le=strlen(bad_end);
    if(ln+le+(bad_beg-start)>=MAX_LINELEN) {
       error1("string_too_long"); return;
    }
    if(ln!=bad_end-bad_beg) memmove(bad_beg+ln,bad_end,le+1);
    memmove(bad_beg,buf,ln);
}
void strip_enclosing_par ( char *  p)

Definition at line 565 of file lines.c.

{
    char *p1;
    partest: strip_trailing_spaces(p);
    if(*p=='(') {
       p1=find_matching(p+1,')');
       if(p1 && *(p1+1)==0) {
           *p1=0; strcpy(p,find_word_start(p+1));
           goto partest;
       }
    }
    if(*p=='[') {
       p1=find_matching(p+1,']');
       if(p1 && *(p1+1)==0) {
           *p1=0; strcpy(p,find_word_start(p+1));
           goto partest;
       }
    }
    if(*p=='{') {
       p1=find_matching(p+1,'}');
       if(p1 && *(p1+1)==0) {
           *p1=0; strcpy(p,find_word_start(p+1));
           goto partest;
       }
    }
}

Here is the caller graph for this function:

char* strip_trailing_spaces ( char *  p)

Definition at line 65 of file common.c.

{
    char *pp;
    if(*p==0) return p;
    for(pp=p+strlen(p)-1; pp>=p && isspace(*pp); *(pp--)=0);
    return pp;
}
char* strparchr ( char *  p,
char  c 
)

Definition at line 153 of file lines.c.

{
    char *pp;
    
    for(pp=p;*pp && *pp!=c && pp-p<MAX_LINELEN; pp++) {
       switch(*pp) {
           case '(': pp=find_matching(pp+1,')'); break;
           case '[': pp=find_matching(pp+1,']'); break;
           case '{': pp=find_matching(pp+1,'}'); break;
       }
       if(pp==NULL) return NULL;
    }
    if(*pp==c) return pp; else return NULL;
}

Here is the caller graph for this function:

char* strparstr ( char *  p,
char *  fnd 
)

Definition at line 169 of file lines.c.

{
    char *pp, c;
    int n;
    
    if(*fnd==0) return p+strlen(p);
    c=*fnd; n=strlen(fnd);
    for(pp=p;pp-1!=NULL && *pp!=0; pp++) {
       if(*pp==c && (n==1 || strncmp(pp,fnd,n)==0)) return pp;
       switch(*pp) {
           case '(': pp=find_matching(pp+1,')'); break;
           case '[': pp=find_matching(pp+1,']'); break;
           case '{': pp=find_matching(pp+1,'}'); break;
       }
    }
    if(pp-1==NULL) pp=strstr(p,fnd);
    if(pp!=NULL) return pp; 
    else return p+strlen(p);
}

Here is the caller graph for this function:

void text ( char *  p)

Definition at line 371 of file text.c.

{
    int i,j,n;
    char *p1, *p2;
    char c,cc;
    char buf[MAX_LINELEN+1];
    p1=find_word_start(p); p2=find_word_end(p1);
    if(p2<=p1 || *p2==0) error2("syntax_error");
    *p2=0;
    i=search_list(text_proc,TEXT_PROC_NO,sizeof(text_proc[0]),p1);
    if(i<0) error2("syntax_error");
    snprintf(buf,sizeof(buf),"%s",find_word_start(p2+1));
    if((text_proc[i].tag&1)!=0 && (p1=wordchr(buf,"mask"))!=NULL) {
       *p1=0; strip_trailing_spaces(buf);
       p2=find_word_start(p1+strlen("mask"));
       strip_trailing_spaces(p2);
       snprintf(maskbuf,sizeof(maskbuf),"%s",p2);
       substitute(maskbuf);
       n=strlen(maskbuf); if(n==0) goto zeromask;
       c=maskbuf[n-1]; cc=0;
       if(c=='+') cc='1'; if(c=='-') cc='0';
       if(cc!=0) memset(maskbuf+n-1,cc,sizeof(maskbuf)-n);
       else for(j=n;j<MAX_LINELEN;j++) maskbuf[j]=maskbuf[j%n];
       maskbuf[sizeof(maskbuf)-1]=0;
    }
    else zeromask: memset(maskbuf,0,sizeof(maskbuf));
    text_proc[i].routine(buf);
    buf[MAX_LINELEN]=0;strcpy(p,buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int textab_verify ( void  )

Definition at line 366 of file text.c.

                        {
    return verify_order(text_proc,TEXT_PROC_NO,sizeof(text_proc[0]));
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* varchr ( char *  p,
char *  v 
)

Definition at line 102 of file common.c.

{
        char *pp; int n=strlen(v);
        for(pp=strstr(p,v); pp!=NULL; pp=strstr(pp+1,v)) {
           if((pp==p || (!isalnum(*(pp-1)) && *(pp-1)!='_')) &&
              ((!isalnum(*(pp+n)) && *(pp+n)!='_') || *(pp+n)==0)) break;
       }
        return pp;
}
int verify_order ( void *  list,
int  items,
size_t  item_size 
)

Definition at line 319 of file lines.c.

{
    int i; char *old, **p;
    p=list; old=*p;
    for(i=item_size;i<items*item_size;i+=item_size) {
       p=list+i;
       if(strcmp(*p,old)<0) {
           fprintf(stderr,"Table disorder: %s > %s",old,*p);
           exit(1);
       }
       old=*p;
    }
    return 0;
}

Here is the caller graph for this function:

char* wordchr ( char *  p,
char *  w 
)

Definition at line 90 of file common.c.

{
    char *r;

    if(*w==0) return NULL;
    for(r=strstr(p,w);r!=NULL && 
       ( (r>p && !isspace(*(r-1))) || (!isspace(*(r+strlen(w))) && *(r+strlen(w))!=0) );
       r=strstr(r+1,w));
    return r;
}
unsigned int wordnum ( char *  p)

Definition at line 384 of file lines.c.

{
    int i; char *pp;
    
    for(i=0, pp=find_word_start(p); *pp!=0; i++) {
       while(!myisspace(*pp) && *pp!=0) pp++;
       while(myisspace(*pp)) pp++;
    }
    return i;
}

Here is the caller graph for this function:

void words2items ( char *  p)

Definition at line 621 of file lines.c.

{   _spaces2_(p,',');       }

Here is the caller graph for this function:

void words2lines ( char *  p)

Definition at line 625 of file lines.c.

{   _spaces2_(p,'\n');      }
void* xmalloc ( size_t  n)

Definition at line 3 of file xmalloc.c.

{
    void *p = malloc(n);
    if(p==NULL) {
        fprintf(stderr,"Malloc failure."); exit(1);
    }
    return p;
}

Variable Documentation

void(* error1)(char *msg)

Definition at line 34 of file libwims.h.

void(* error2)(char *msg)

Definition at line 35 of file libwims.h.

void(* error3)(char *msg)

Definition at line 36 of file libwims.h.

int* ev_varcnt
char* fnd_nextpos

Definition at line 30 of file mathexp.c.

char* fnd_position

Definition at line 29 of file mathexp.c.

char*(* substitute)(char *p)

Definition at line 153 of file libwims.h.