Merge pull request #66 from davidgiven/dtrg-warnings

lang/basic/lib: fewer warnings
This commit is contained in:
David Given 2017-11-19 11:39:45 +01:00 committed by GitHub
commit fb90b7b8d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 605 additions and 577 deletions

View file

@ -5,11 +5,11 @@
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
long _abl(i) long i;
long _abl(long i)
{
return (i >= 0 ? i : -i);
}
double _abr(f) double f;
double _abr(double f)
{
return (f >= 0.0 ? f : -f);
}

View file

@ -2,8 +2,7 @@
/* $Id$ */
int _asc(str)
String *str;
int _asc(String* str)
{
if (str == 0 || str->strval == 0)
error(3);

View file

@ -1,8 +1,10 @@
/* $Id$ */
#include <stdio.h>
#include <stdlib.h>
asrt(b)
void asrt(int b)
{
if (!b)
{
if(!b){
printf("ASSERTION ERROR\n");
abort();
}

View file

@ -10,4 +10,3 @@
#include <math.h>
double _atn(double x) { return atan(x); }

View file

@ -2,8 +2,7 @@
/* $Id$ */
String *_chr(i)
int i;
String* _chr(int i)
{
String* s;
char buf[2];

View file

@ -1,17 +1,18 @@
/* $Id$ */
int _cint(f) double f;
int _cint(double f)
{
int r;
if( f<-32768 || f>32767) error(4);
if (f < -32768 || f > 32767)
error(4);
if (f < 0)
r = f - 0.5;
else r= f+0.5;
else
r = f + 0.5;
return (r);
}
double _trunc(f)
double f;
double _trunc(double f)
{
long d;
d = f;
@ -19,22 +20,25 @@ double f;
return (f);
}
double _fcint(f) double f;
double _fcint(double f)
{
long r;
if(f<0){
if (f < 0)
{
r = -f;
r = -r - 1;
}else r= f;
}
else
r = f;
f = r;
return (f);
}
int _fix(f)
double f;
int _fix(double f)
{
int r;
if( f<-32768.0 || f>32767.0) error(4);
if (f < -32768.0 || f > 32767.0)
error(4);
r = _sgn(f) * _fcint((f > 0.0 ? f : -f));
return (r);
}

View file

@ -52,13 +52,13 @@ char *errortable[255]={
0
};
error(index)
int index;
void error(int index)
{
_setline();
if (index < 0 || index > 40)
printf("LINE %d:ERROR %d: Unprintable error\n", _erlsym, index);
else printf("LINE %d:ERROR %d: %s\n",_erlsym,index,errortable[index]);
else
printf("LINE %d:ERROR %d: %s\n", _erlsym, index, errortable[index]);
_errsym = index;
_trap();
}

View file

@ -12,14 +12,11 @@ Filedesc _fdtable[16];
1-15 user files
*/
int _chann = -1;
FILE* _chanrd = stdin;
FILE* _chanwr = stdout;
_setchan(index)
int index;
void _setchan(int index)
{
#ifdef DEBUG
printf("setchannel %d\n", index);
@ -38,12 +35,13 @@ int index;
_chanrd = _chanwr = _fdtable[index].fd;
}
_asschn()
void _asschn(void)
{
#ifdef DEBUG
printf("_asschn %d\n", _chann);
#endif
if( _chann == -1) return;
if (_chann == -1)
return;
#ifdef DEBUG
printf(" file %d\n", _fdtable[_chann].fd);
#endif
@ -55,17 +53,16 @@ _asschn()
error(2);
}
_clochn(nr)
int nr;
void _clochn(int nr)
{
if( nr<1 || nr >15 || _fdtable[nr].fd==0) error(3);
if (nr < 1 || nr > 15 || _fdtable[nr].fd == 0)
error(3);
fclose(_fdtable[nr].fd);
_fdtable[nr].fd=0; _fdtable[nr].fname=0;
_fdtable[nr].fd = 0;
_fdtable[nr].fname = 0;
}
_opnchn(reclen,fname,mode)
String *mode,*fname;
int reclen;
void _opnchn(int reclen, String* fname, String* mode)
{
/* channel has been set */
FILE* f;
@ -110,22 +107,23 @@ int reclen;
#endif
}
_ioeof(channel)
int channel;
int _ioeof(int channel)
{
FILE* fd;
char c;
if( channel<0 || channel >15) error(3);
if (channel < 0 || channel > 15)
error(3);
fd = _fdtable[channel].fd;
if (fd == 0)
error(3);
c = fgetc(fd);
if( feof(_fdtable[channel].fd) ) return(-1);
if (feof(_fdtable[channel].fd))
return (-1);
ungetc(c, fd);
return (0);
}
_close()
void _close(void)
{
/* close all open files */
int i;

View file

@ -1,12 +1,11 @@
#include <stdlib.h>
_hlt(nr)
int nr;
void _hlt(int nr)
{
exit(nr);
}
_goto_err()
void _goto_err(void)
{
error(3);
}

View file

@ -10,24 +10,31 @@
int _width = 75, _pos = 0, _zonewidth = 15;
_out(str)
char *str;
void _out(char* str)
{
int pos;
if( _chann== -1) pos= _pos;
else pos= _fdtable[_chann].pos;
if (_chann == -1)
pos = _pos;
else
pos = _fdtable[_chann].pos;
while (*str)
{
if( pos>= _width){ _outnl(); pos=0;}
if (pos >= _width)
{
_outnl();
pos = 0;
}
fputc(*str++, _chanwr);
pos++;
}
if( _chann== -1) _pos=pos;
else _fdtable[_chann].pos= pos;
if (_chann == -1)
_pos = pos;
else
_fdtable[_chann].pos = pos;
}
_outnl()
void _outnl(void)
{
fputc('\n', _chanwr);
if (_chann == -1)
@ -35,14 +42,16 @@ _outnl()
else
_fdtable[_chann].pos = 0;
}
_zone()
void _zone(void)
{
/* go to next zone */
int pos;
if (_chann == -1)
pos = _pos;
else pos= _fdtable[_chann].pos;
do{
else
pos = _fdtable[_chann].pos;
do
{
fputc(' ', _chanwr);
pos++;
if (pos == _width)
@ -52,11 +61,12 @@ _zone()
break;
}
} while (pos % _zonewidth != 0);
if( _chann== -1) _pos=pos;
else _fdtable[_chann].pos= pos;
if (_chann == -1)
_pos = pos;
else
_fdtable[_chann].pos = pos;
}
_in(buf)
char *buf;
void _in(char* buf)
{
register int holder;
char* c;
@ -64,28 +74,36 @@ char *buf;
if (_chann == -1)
{
pos = _pos;
}else pos= _fdtable[_chann].pos;
}
else
pos = _fdtable[_chann].pos;
c = buf;
while( (holder = fgetc(_chanrd)) != EOF && holder != '\n'){
while ((holder = fgetc(_chanrd)) != EOF && holder != '\n')
{
*c = holder;
if( _chann == -1) putchar(holder);
c++; pos++;
if (_chann == -1)
putchar(holder);
c++;
pos++;
}
*c = 0;
if (_chann == -1)
{
_pos = pos;
} else _fdtable[_chann].pos= pos;
}
_tab(x)
int x;
else
_fdtable[_chann].pos = pos;
}
void _tab(int x)
{
if( x> _width) error(3);
if( x< _pos) _outnl();
if (x > _width)
error(3);
if (x < _pos)
_outnl();
_spc(x - _pos);
}
_spc(x)
int x;
void _spc(int x)
{
while(x-->0) _out(" ");
while (x-- > 0)
_out(" ");
}

View file

@ -2,8 +2,7 @@
/* $Id$ */
String *_mki(i)
long i;
String* _mki(long i)
{
char* buffer = " ";
String* s;
@ -12,8 +11,7 @@ long i;
*((long*)s->strval) = i;
return (s);
}
String *_mkd(d)
double d;
String* _mkd(double d)
{
char* buffer = " ";
String* s;
@ -22,13 +20,11 @@ double d;
*((double*)s->strval) = d;
return (s);
}
long _cvi(s)
String *s;
long _cvi(String* s)
{
return *((long*)s->strval);
}
double _cvd(s)
String *s;
double _cvd(String* s)
{
return *((double*)s->strval);
}

View file

@ -4,16 +4,14 @@
/* $Id$ */
String *_oct(i)
int i;
String* _oct(int i)
{
char buffer[30];
sprintf(buffer, "%o", i);
return ((String*)_newstr(buffer));
}
String *_hex(i)
int i;
String* _hex(int i)
{
char buffer[30];
@ -21,8 +19,7 @@ int i;
return ((String*)_newstr(buffer));
}
String *_nstr(f)
double f;
String* _nstr(double f)
{
char buffer[80];

View file

@ -1,7 +1,6 @@
/* $Id$ */
int peek(addr)
int addr;
int peek(int addr)
{
/* this can not work properly for machines in which the
POINTERSIZE differs from the integer size
@ -17,8 +16,7 @@ int addr;
return (i);
}
_poke(i,j)
int i,j;
void _poke(int i, int j)
{
char* p;
p = (char*)i;

View file

@ -1,4 +1,3 @@
#include <math.h>
double _power(double x, double y) { return pow(x, y); }

View file

@ -7,60 +7,68 @@
/* Here all routine to generate terminal oriented output is located */
_qstmark()
void _qstmark(void)
{
/* prompt for terminal input */
putchar('?');
}
_nl()
void _nl(void)
{
_asschn();
_outnl();
}
_prinum(i)
int i;
void _prinum(int i)
{
char buffer[40];
_asschn();
if (i >= 0)
sprintf(buffer, " %d ", i);
else sprintf(buffer,"-%d ",-i);
else
sprintf(buffer, "-%d ", -i);
_out(buffer);
}
_str(f,buffer)
double f;
char *buffer;
void _str(double f, char* buffer)
{
register char* c = buffer;
int eformat = 0;
if( f>=0){
if( f> 1.0e8) {
if (f >= 0)
{
if (f > 1.0e8)
{
eformat = 1;
sprintf(buffer, " %e", f);
}
else sprintf(buffer," %f",f);
else
sprintf(buffer, " %f", f);
c++;
}else {
if(-f> 1.0e8) {
}
else
{
if (-f > 1.0e8)
{
eformat = 1;
sprintf(buffer, "-%e", -f);
}
else sprintf(buffer,"-%f",-f);
else
sprintf(buffer, "-%f", -f);
}
if (! eformat) {
for( ; *c && *c!= ' ';c++) ;
if (!eformat)
{
for (; *c && *c != ' '; c++)
;
c--;
while (c > buffer && *c == '0')
{
*c= 0;c--;
*c = 0;
c--;
}
if( *c=='.') *c=0;
if (*c == '.')
*c = 0;
}
}
_prfnum(f)
double f;
void _prfnum(double f)
{
/* BASIC strings trailing zeroes */
char buffer[100];
@ -72,10 +80,11 @@ double f;
strcat(buffer, " ");
_out(buffer);
}
_prstr(str)
String *str;
void _prstr(String* str)
{
_asschn();
if( str==0) _out("<null>");
else _out(str->strval);
if (str == 0)
_out("<null>");
else
_out(str->strval);
}

View file

@ -5,7 +5,7 @@
#define EM_WSIZE _EM_WSIZE
#endif
_randomi()
void _randomi(void)
{
int i;
_setchan(-1);
@ -14,14 +14,14 @@ _randomi()
_setrand(i);
}
_setrand(i)
int i;
void _setrand(int i)
{
srand(i);
}
double _rnd(d) double d;
double _rnd(double d)
{
double f; f= (int) rand();
double f;
f = (int)rand();
return (f /
#if EM_WSIZE == 4
2147483647.0

View file

@ -4,14 +4,14 @@
/* $Id$ */
_readln()
void _readln(void)
{
register int c;
while ((c = fgetc(_chanrd)) != EOF && c != '\n')
;
}
readskip()
void readskip(void)
{
register int c;
#ifdef DEBUG
@ -20,8 +20,7 @@ readskip()
while ((c = fgetc(_chanrd)) != EOF && c != ',' && c != '\n')
;
}
_readint(addr)
int *addr;
void _readint(int* addr)
{
int i;
char buf[1024];
@ -32,8 +31,10 @@ int *addr;
_asschn();
if (fscanf(_chanrd, "%d", &i) != 1)
{
if( ferror(_chanrd)) error(29);
if( feof(_chanrd)) error(2);
if (ferror(_chanrd))
error(29);
if (feof(_chanrd))
error(2);
if (_chann == -1)
{
_asschn(); /* may be closed by now */
@ -43,10 +44,14 @@ int *addr;
return;
}
error(40);
}else { readskip(); *addr=i;}
}
_readflt(addr)
double *addr;
else
{
readskip();
*addr = i;
}
}
void _readflt(double* addr)
{
double f;
char buf[1024];
@ -57,8 +62,10 @@ double *addr;
_asschn();
if (fscanf(_chanrd, "%lf", &f) != 1)
{
if( ferror(_chanrd)) error(29);
if( feof(_chanrd)) error(2);
if (ferror(_chanrd))
error(29);
if (feof(_chanrd))
error(2);
if (_chann == -1)
{
fgets(buf, 1024, _chanrd);
@ -67,10 +74,14 @@ double *addr;
return;
}
error(40);
}else { readskip(); *addr=f;}
}
_readstr(s)
String **s;
else
{
readskip();
*addr = f;
}
}
void _readstr(String** s)
{
char buffer[1024];
register int kar;
@ -91,25 +102,29 @@ String **s;
#ifdef DEBUG
printf("qouted string\n");
#endif
while ( (kar= fgetc(_chanrd)) != EOF && kar!='"' ) *c++ = kar ;
while ((kar = fgetc(_chanrd)) != EOF && kar != '"')
*c++ = kar;
ungetc(kar, _chanrd);
*c = 0;
}else
if( isalpha(*c))
}
else if (isalpha(*c))
{
/* read normal string */
c++;
#ifdef DEBUG
printf("non-qouted string\n");
#endif
while( (kar= fgetc(_chanrd)) != ',' && kar!= EOF &&
!isspace(kar) && kar!='\n')
while ((kar = fgetc(_chanrd)) != ',' && kar != EOF && !isspace(kar) && kar != '\n')
*c++ = kar;
ungetc(kar, _chanrd);
*c = 0;
}else{
if( ferror(_chanrd)) error(29);
if( feof(_chanrd)) error(2);
}
else
{
if (ferror(_chanrd))
error(29);
if (feof(_chanrd))
error(2);
if (_chann == -1)
{
fgets(buffer, 1024, _chanrd);
@ -130,8 +145,7 @@ String **s;
extern int _seektab[];
_restore(line)
int line;
void _restore(int line)
{
int nr;
char buffer[1024];
@ -152,11 +166,11 @@ int line;
#ifdef DEBUG
printf(" %d lines to skip\n", nr);
#endif
while(nr-- >0 ) fgets(buffer,1024,_chanrd);
while (nr-- > 0)
fgets(buffer, 1024, _chanrd);
}
}
_rdline(s)
String **s;
void _rdline(String** s)
{
char buffer[1024];
if (fgets(buffer, 1024, _chanrd) == 0)

View file

@ -5,18 +5,18 @@
int _gotable[MAXNESTING];
int topstk = 0;
_gosub(x)
int x;
void _gosub(int x)
{
/* administer gosub */
#ifdef DEBUG
printf("store %d in %d\n", x, topstk);
#endif
if( topstk== MAXNESTING) error(26);
if (topstk == MAXNESTING)
error(26);
_gotable[topstk] = x;
topstk++;
}
_retstmt()
int _retstmt(void)
{
/* make sure that a return label index is on top
of the stack */

View file

@ -1,18 +1,19 @@
#include <stdlib.h>
char * salloc(length)
unsigned length;
char* salloc(unsigned length)
{
char* c, *s;
c = malloc(length);
if( !c ) error(5);
for(s=c;s<c+length;s++) *s = 0;
if (!c)
error(5);
for (s = c; s < c + length; s++)
*s = 0;
return (c);
}
sfree(c)
char *c;
void sfree(char* c)
{
if( !c ) return;
if (!c)
return;
free(c);
}

View file

@ -1,16 +1,17 @@
/* $Id$ */
_sgn(v)
double v;
int _sgn(double v)
{
if( v>0) return(1);
if( v<0) return(-1);
if (v > 0)
return (1);
if (v < 0)
return (-1);
return (0);
}
_forsgn(v)
double v;
int _forsgn(double v)
{
if (v >= 0) return 1;
if (v >= 0)
return 1;
return -1;
}

View file

@ -13,4 +13,3 @@
double _sin(double x) { return sin(x); }
double _cos(double x) { return cos(x); }
double _tan(double x) { return tan(x); }

View file

@ -11,4 +11,3 @@
#include <math.h>
double _sqt(double x) { return sqrt(x); }

View file

@ -4,19 +4,21 @@
/* $Id$ */
#define ok(X) if( X ==0) return;
#define okr(X) if( X ==0) return(0);
#define ok(X) \
if (X == 0) \
return;
#define okr(X) \
if (X == 0) \
return (0);
extern char* salloc();
_length(str)
String *str;
int _length(String* str)
{
okr(str);
return (str->strlength);
}
String *_newstr(str)
char *str;
String* _newstr(char* str)
{
String* s;
okr(str);
@ -27,24 +29,23 @@ char *str;
strcpy(s->strval, str);
return (s);
}
_incstr(src)
String *src;
void _incstr(String* src)
{
/* one more variable uses the string */
ok(src);
src->strcount++;
}
_decstr(str)
String *str;
void _decstr(String* str)
{
ok(str);
/* Strings in ROM are initialized with this count */
if ( str->strcount==9999 ) return ;
if (str->strcount == 9999)
return;
str->strcount--;
if(str->strcount<=0) _delstr(str);
if (str->strcount <= 0)
_delstr(str);
}
_strcpy(dst,src)
String *src,*dst;
void _strcpy(String* dst, String* src)
{
ok(src);
ok(dst);
@ -52,19 +53,18 @@ String *src,*dst;
*dst = *src;
_incstr(src);
}
_delstr(src)
String *src;
void _delstr(String* src)
{
ok(src);
sfree(src->strval);
sfree((char*)src);
}
String *_concat(s1,s2)
String *s1,*s2;
String* _concat(String* s1, String* s2)
{
String* s;
int length;
okr(s1); okr(s2);
okr(s1);
okr(s2);
s = (String*)salloc(sizeof(String));
s->strlength = _length(s1) + _length(s2);
s->strval = salloc(s->strlength + 1);
@ -73,22 +73,21 @@ String *s1,*s2;
strcat(s->strval, s1->strval);
return (s);
}
_strcomp(s1,s2)
String *s1,*s2;
int _strcomp(String* s1, String* s2)
{
okr(s1);okr(s2);
okr(s1);
okr(s2);
return (strcmp(s2->strval, s1->strval));
}
String *_left(size,s)
String *s;
int size;
String* _left(int size, String* s)
{
String* ns;
int i;
okr(s);
if( size <0 || size >s->strlength) error(3);
if (size < 0 || size > s->strlength)
error(3);
ns = (String*)salloc(sizeof(String));
ns->strval = salloc(size + 1);
ns->strcount = 1;
@ -99,8 +98,7 @@ int size;
return (ns);
}
String *_space(d)
int d;
String* _space(int d)
{
String* s;
int i, len;
@ -116,17 +114,18 @@ int d;
return (s);
}
String *_strascii()
String* _strascii(void)
{
}
String *_string(f, d)
double d,f;
String* _string(double f, double d)
{
int i, j;
String* s;
i=d;j=f;
if( i<0 || i>MAXSTRING) error(3);
i = d;
j = f;
if (i < 0 || i > MAXSTRING)
error(3);
s = (String*)salloc(sizeof(String));
s->strlength = i;
s->strcount = 1;
@ -136,49 +135,52 @@ double d,f;
s->strval[i] = j;
return (s);
}
_midstmt(s2,i1,i2,s)
int i1,i2;
String *s, *s2;
void _midstmt(String* s2, int i1, int i2, String* s)
{
int l;
/*printf("mid called %d %d %s %s\n",i1,i2,s->strval, s2->strval);*/
if (i2 < 0 || i1 < -1) error(3);
if( s->strlength<i2 || s2->strlength < i1) error(3); /* source string too short */
if( i1== -1) i1= s2->strlength;
if (i2 < 0 || i1 < -1)
error(3);
if (s->strlength < i2 || s2->strlength < i1)
error(3); /* source string too short */
if (i1 == -1)
i1 = s2->strlength;
l = s->strlength - i2 + 1;
if( i1>l ) i1=l;
if (i1 > l)
i1 = l;
strncpy(s->strval + i2 - 1, s2->strval, i1);
}
String *_mid(i1,i2,s)
int i1,i2;
String *s;
String* _mid(int i1, int i2, String* s)
{
int l;
String* s2;
/* printf("mid fcn called %d %d %s\n",i1,i2,s->strval);*/
if (i2 < 0 || i1 < -1) return(s2); /* or error? */
if( i1 == -1) i1= s->strlength;
if (i2 < 0 || i1 < -1)
return (s2); /* or error? */
if (i1 == -1)
i1 = s->strlength;
s2 = _newstr(s->strval);
s2->strval[0] = 0;
if( s->strlength<i2) return(s2); /* source string too short */
if (s->strlength < i2)
return (s2); /* source string too short */
l = s->strlength - i2 + 1;
if( i1>l ) i1=l;
if (i1 > l)
i1 = l;
strncpy(s2->strval, s->strval + i2 - 1, i1);
s2->strval[i1] = 0;
return (s2);
}
String *_right(length,str)
String *str;
int length;
String* _right(int length, String* str)
{
String* s;
int i;
i = _length(str) - length;
if(i<0) i=0;
if (i < 0)
i = 0;
s = _newstr(str->strval + i);
return (s);
}

View file

@ -2,8 +2,7 @@
/* $Id$ */
_intswap(i1,i2)
int *i1,*i2;
void _intswap(int* i1, int* i2)
{
int i3;
i3 = *i1;
@ -11,8 +10,7 @@ int *i1,*i2;
*i2 = i3;
}
_fltswap(i1,i2)
double *i1,*i2;
void _fltswap(double* i1, double* i2)
{
double i3;
i3 = *i1;
@ -20,8 +18,7 @@ double *i1,*i2;
*i2 = i3;
}
_strswap(s1,s2)
String **s1,**s2;
void _strswap(String** s1, String** s2)
{
String* s;
s = *s1;

View file

@ -1,7 +1,6 @@
/* $Id$ */
_trace(i)
int i;
void _trace(int i)
{
printf("[%d]", i);
}

View file

@ -13,15 +13,12 @@
int _trpline; /* BASIC return label */
jmp_buf trpbuf;
_trpset(nr)
int nr;
void _trpset(int nr)
{
/*debug printf("trap set to %d\n",nr);*/
_trpline = nr;
}
void
_trpfatal(i)
int i;
void _trpfatal(int i)
{
extern int _errsym, _erlsym;
@ -35,7 +32,7 @@ int i;
_trap();
}
_ini_trp()
void _ini_trp(void)
{
/* initialize trap routines */
int i;
@ -44,17 +41,16 @@ _ini_trp()
signal(i, _trpfatal);
}
_settrap(nr)
int nr;
void _settrap(int nr)
{
_trpline = nr;
}
_trap()
void _trap(void)
{
int line;
if( _trpline==0) exit(-1);
if (_trpline == 0)
exit(-1);
line = _trpline;
_trpline = 0; /* should be reset by user */
_ini_trp();

View file

@ -5,31 +5,34 @@
/* assume that the channel has been set */
_wrnl()
void _wrnl(void)
{
if( fputc('\n',_chanwr) == EOF) error(29);
if (fputc('\n', _chanwr) == EOF)
error(29);
}
_wrcomma()
void _wrcomma(void)
{
if( fputc(',',_chanwr) == EOF) error(29);
if (fputc(',', _chanwr) == EOF)
error(29);
}
_wrint(i)
int i;
void _wrint(int i)
{
if (i > 0)
if( fputc(' ',_chanwr)==EOF) error(29);
if (fputc(' ', _chanwr) == EOF)
error(29);
fprintf(_chanwr, "%d", i);
if( ferror(_chanwr) ) error(29);
if (ferror(_chanwr))
error(29);
}
_wrflt(f)
double f;
void _wrflt(double f)
{
fprintf(_chanwr, "%f", f);
if( ferror(_chanwr) ) error(29);
if (ferror(_chanwr))
error(29);
}
_wrstr(s)
String *s;
void _wrstr(String* s)
{
fprintf(_chanwr, "\"%s\"", s->strval);
if( ferror(_chanwr) ) error(29);
if (ferror(_chanwr))
error(29);
}

View file

@ -123,7 +123,7 @@ struct idf* str2idf(char tg[], int cpy)
int size;
IDF_STARTHASH(hash);
while (c = *cp++)
while ((c = *cp++))
{
IDF_ENHASH(hash, c);
}