home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************\
- ** **
- ** WW WW IIIIIIII NNN NN DDDDDDD BBBBBBB AA SSSSSS EEEEEEEE **
- ** WW W WW II NNNN NN DD DD BB BB AA AA SS EE **
- ** WW W WW II NN NN NN DD DD BBBBBBB AAAAAAAA SSSSSS EEEEEE **
- ** WW W WW II NN NNNN DD DD BB BB AA AA SS EE **
- ** WWWWW IIIIIIII NN NNN DDDDDDD BBBBBBB AA AA SSSSSS EEEEEEEE **
- ** **
- ** SSSSSS OOOOOO FFFFFFFF TTTTTTTT WW WW AA RRRRRRR EEEEEEEE **
- ** SS OO OO FF TT WW W WW AA AA RR RR EE **
- ** SSSSS OO OO FFFFF TT WW W WW AAAAAAAA RRRRRRR EEEEEE **
- ** SS OO OO FF TT WW W WW AA AA RR RR EE **
- ** SSSSSS OOOOOO FF TT WWWWW AA AA RR RR EEEEEEEE **
- ** **
- *********** NOTICE ************************************************************
- ** This file contains valuable trade secrets and proprietary **
- ** assets of Windbase Software Inc. Embodying substantial **
- ** creative efforts and confidential information. Unauthorized **
- ** use, copying, decompiling, translating, disclosure or **
- ** transfer, of any kind, is strictly prohibited. **
- ** **
- ** COPYRIGHT (C) 1992, 1993, 1994. Windbase Software Inc. **
- ** ALL RIGHTS RESERVED. **
- \*****************************************************************************/
-
- #include <stdio.h>
- #include <string.h>
- #include <malloc.h>
-
- #include "../memsl.h"
-
- #ifdef WBSTDC
- int Compare(void *nullitem, char *item1, char *item2)
- #else
- int Compare(nullitem, item1, item2)
- void *nullitem;
- char *item1,
- *item2;
- #endif
- {
- WBTrcEntry(0,"Compare",("%p, %s, %s",nullitem,item1?item1:"NULL",item2?item2:"NULL"));
-
- nullitem = nullitem;
-
- WBTrcReturn(0,strcmp(item1,item2),("%d",strcmp(item1,item2)));
- }
-
- #ifdef WBSTDC
- void Print(void *nullitem, char *item)
- #else
- void Print(nullitem, item)
- void *nullitem;
- char *item;
- #endif
- {
- WBTrcEntry(0,"Print",("%p, %s",nullitem,item?item:"NULL"));
-
- nullitem = nullitem;
-
- printf("%s\n",item);
-
- WBTrcVReturn(0,(""));
- }
-
- #ifdef WBSTDC
- void Delete(void *nullitem, char *item)
- #else
- void Delete(nullitem, item)
- void *nullitem;
- char *item;
- #endif
- {
- WBTrcEntry(0,"Delete",("%p, %s",nullitem,item?item:"NULL"));
-
- nullitem = nullitem;
-
- free(item);
-
- WBTrcVReturn(0,(""));
- }
-
- #if defined(WBTRC_LEVEL1) || defined(WBTRC_LEVEL2)
- #ifdef WBSTDC
- int main(int argc, char **argv)
- #else
- int main(argc, argv)
- int argc;
- char **argv;
- #endif
- #else
- #ifdef WBSTDC
- int main(void)
- #else
- int main()
- #endif
- #endif
- {
- FILE *file;
- WBTABLE *table1, *table2;
- char str[41], *strptr;
-
- WBTrcMainEntry();
-
- if ((table1 = WBTableOpen(NULL)) != NULL)
- if ((table2 = WBTableOpen(NULL)) != NULL)
- {
- #ifdef FUNCTCAST
- WBTableCompareF(table1,NULL,(int (*)(void *, void *, void *))Compare);
- WBTableExecuteF(table1,NULL,(void (*)(void *, void *))Print);
- WBTableDeleteF(table1,NULL,(void (*)(void *, void *))Delete);
- WBTableCompareF(table2,NULL,(int (*)(void *, void *, void *))Compare);
- WBTableExecuteF(table2,NULL,(void (*)(void *, void *))Print);
- WBTableDeleteF(table2,NULL,(void (*)(void *, void *))Delete);
- #else
- WBTableCompareF(table1,NULL,(int (*)())Compare);
- WBTableExecuteF(table1,NULL,(void (*)())Print);
- WBTableDeleteF(table1,NULL,(void (*)())Delete);
- WBTableCompareF(table2,NULL,(int (*)())Compare);
- WBTableExecuteF(table2,NULL,(void (*)())Print);
- WBTableDeleteF(table2,NULL,(void (*)())Delete);
- #endif
-
- if ((file = fopen("data.dat","rt")) != NULL)
- {
- while (fgets(str,40,file))
- {
- if (*str && *(str+strlen(str)-1) == '\n')
- *(str+strlen(str)-1) = '\0';
- if ((strptr = malloc(strlen(str)+1)) != NULL)
- {
- strcpy(strptr,str);
- if (WBTableAdd(table1,strptr) == -1)
- free(strptr);
- }
- }
- fclose(file);
- }
- if ((file = fopen("data2.dat","rt")) != NULL)
- {
- while (fgets(str,40,file))
- {
- if (*str && *(str+strlen(str)-1) == '\n')
- *(str+strlen(str)-1) = '\0';
- if ((strptr = malloc(strlen(str)+1)) != NULL)
- {
- strcpy(strptr,str);
- if (WBTableAdd(table2,strptr) == -1)
- free(strptr);
- }
- }
- fclose(file);
- }
- printf("Executing table1\n");
- WBTableExecute(table1);
- printf("Executing table2\n");
- WBTableExecute(table2);
- WBTableClose(table1);
- WBTableClose(table2);
- }
- WBTrcReturn(0,0,("0"));
- }
-
-
-