00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #define _SYMBLCMP_SOURCE_
00030
00031 #include "setup.h"
00032
00033 #if CONSTRUCT_COMPILER && (! RUN_TIME)
00034
00035 #include <stdio.h>
00036 #define _STDIO_INCLUDED_
00037 #include <string.h>
00038
00039 #include "envrnmnt.h"
00040 #include "symbol.h"
00041 #include "memalloc.h"
00042 #include "constant.h"
00043 #include "exprnpsr.h"
00044 #include "cstrccom.h"
00045 #include "constrct.h"
00046 #include "argacces.h"
00047 #include "cstrncmp.h"
00048 #include "router.h"
00049 #include "conscomp.h"
00050 #include "sysdep.h"
00051 #include "utility.h"
00052
00053 #include "symblcmp.h"
00054
00055
00056
00057
00058
00059 static int SymbolHashNodesToCode(void *,char *,char *,char *,int);
00060 static int BitMapHashNodesToCode(void *,char *,char *,char *,int);
00061 static int BitMapValuesToCode(void *,char *,char *, char *,int);
00062 static int FloatHashNodesToCode(void *,char *,char *,char *,int);
00063 static int IntegerHashNodesToCode(void *,char *,char *,char *,int);
00064 static int HashTablesToCode(void *,char *,char *,char *);
00065 static void PrintCString(FILE *,char *);
00066
00067
00068
00069
00070
00071 globle void AtomicValuesToCode(
00072 void *theEnv,
00073 char *fileName,
00074 char *pathName,
00075 char *fileNameBuffer)
00076 {
00077 int version;
00078
00079 SetAtomicValueIndices(theEnv,TRUE);
00080
00081 HashTablesToCode(theEnv,fileName,pathName,fileNameBuffer);
00082
00083 version = SymbolHashNodesToCode(theEnv,fileName,pathName,fileNameBuffer,5);
00084 version = FloatHashNodesToCode(theEnv,fileName,pathName,fileNameBuffer,version);
00085 version = IntegerHashNodesToCode(theEnv,fileName,pathName,fileNameBuffer,version);
00086 version = BitMapHashNodesToCode(theEnv,fileName,pathName,fileNameBuffer,version);
00087 BitMapValuesToCode(theEnv,fileName,pathName,fileNameBuffer,version);
00088 }
00089
00090
00091
00092
00093
00094
00095 static int SymbolHashNodesToCode(
00096 void *theEnv,
00097 char *fileName,
00098 char *pathName,
00099 char *fileNameBuffer,
00100 int version)
00101 {
00102 unsigned long i, j;
00103 struct symbolHashNode *hashPtr;
00104 int count;
00105 int numberOfEntries;
00106 struct symbolHashNode **symbolTable;
00107 int newHeader = TRUE;
00108 int arrayVersion = 1;
00109 FILE *fp;
00110
00111
00112
00113
00114
00115 symbolTable = GetSymbolTable(theEnv);
00116 count = numberOfEntries = 0;
00117
00118 for (i = 0; i < SYMBOL_HASH_SIZE; i++)
00119 {
00120 for (hashPtr = symbolTable[i];
00121 hashPtr != NULL;
00122 hashPtr = hashPtr->next)
00123 { numberOfEntries++; }
00124 }
00125
00126 if (numberOfEntries == 0) return(version);
00127
00128 for (i = 1; i <= (unsigned long) (numberOfEntries / ConstructCompilerData(theEnv)->MaxIndices) + 1 ; i++)
00129 { fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct symbolHashNode S%d_%ld[];\n",ConstructCompilerData(theEnv)->ImageID,i); }
00130
00131
00132
00133
00134
00135 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(-1);
00136
00137
00138
00139
00140
00141 j = 0;
00142
00143 for (i = 0; i < SYMBOL_HASH_SIZE; i++)
00144 {
00145 for (hashPtr = symbolTable[i];
00146 hashPtr != NULL;
00147 hashPtr = hashPtr->next)
00148 {
00149 if (newHeader)
00150 {
00151 fprintf(fp,"struct symbolHashNode S%d_%d[] = {\n",ConstructCompilerData(theEnv)->ImageID,arrayVersion);
00152 newHeader = FALSE;
00153 }
00154
00155 if (hashPtr->next == NULL)
00156 { fprintf(fp,"{NULL,"); }
00157 else
00158 {
00159 if ((j + 1) >= (unsigned long) ConstructCompilerData(theEnv)->MaxIndices)
00160 { fprintf(fp,"{&S%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion + 1,0); }
00161 else
00162 { fprintf(fp,"{&S%d_%d[%ld],",ConstructCompilerData(theEnv)->ImageID,arrayVersion,j + 1); }
00163 }
00164
00165 fprintf(fp,"%ld,0,1,0,0,%ld,",hashPtr->count + 1,i);
00166 PrintCString(fp,hashPtr->contents);
00167
00168 count++;
00169 j++;
00170
00171 if ((count == numberOfEntries) || (j >= (unsigned) ConstructCompilerData(theEnv)->MaxIndices))
00172 {
00173 fprintf(fp,"}};\n");
00174 GenClose(theEnv,fp);
00175 j = 0;
00176 arrayVersion++;
00177 version++;
00178 if (count < numberOfEntries)
00179 {
00180 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(0);
00181 newHeader = TRUE;
00182 }
00183 }
00184 else
00185 { fprintf(fp,"},\n"); }
00186 }
00187 }
00188
00189 return(version);
00190 }
00191
00192
00193
00194
00195
00196
00197 static int BitMapHashNodesToCode(
00198 void *theEnv,
00199 char *fileName,
00200 char *pathName,
00201 char *fileNameBuffer,
00202 int version)
00203 {
00204 int i, j;
00205 struct bitMapHashNode *hashPtr;
00206 int count;
00207 int numberOfEntries;
00208 struct bitMapHashNode **bitMapTable;
00209 int newHeader = TRUE;
00210 int arrayVersion = 1;
00211 FILE *fp;
00212 int longsReqdPartition = 1,longsReqdPartitionCount = 0;
00213
00214
00215
00216
00217
00218 bitMapTable = GetBitMapTable(theEnv);
00219 count = numberOfEntries = 0;
00220
00221 for (i = 0; i < BITMAP_HASH_SIZE; i++)
00222 {
00223 for (hashPtr = bitMapTable[i];
00224 hashPtr != NULL;
00225 hashPtr = hashPtr->next)
00226 { numberOfEntries++; }
00227 }
00228
00229 if (numberOfEntries == 0) return(version);
00230
00231 for (i = 1; i <= (numberOfEntries / ConstructCompilerData(theEnv)->MaxIndices) + 1 ; i++)
00232 { fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct bitMapHashNode B%d_%d[];\n",ConstructCompilerData(theEnv)->ImageID,i); }
00233
00234
00235
00236
00237
00238 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(-1);
00239
00240
00241
00242
00243
00244 j = 0;
00245
00246 for (i = 0; i < BITMAP_HASH_SIZE; i++)
00247 {
00248 for (hashPtr = bitMapTable[i];
00249 hashPtr != NULL;
00250 hashPtr = hashPtr->next)
00251 {
00252 if (newHeader)
00253 {
00254 fprintf(fp,"struct bitMapHashNode B%d_%d[] = {\n",ConstructCompilerData(theEnv)->ImageID,arrayVersion);
00255 newHeader = FALSE;
00256 }
00257
00258 if (hashPtr->next == NULL)
00259 { fprintf(fp,"{NULL,"); }
00260 else
00261 {
00262 if ((j + 1) >= ConstructCompilerData(theEnv)->MaxIndices)
00263 { fprintf(fp,"{&B%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion + 1,0); }
00264 else
00265 { fprintf(fp,"{&B%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion,j + 1); }
00266 }
00267
00268 fprintf(fp,"%ld,0,1,0,0,%d,(char *) &L%d_%d[%d],%d",
00269 hashPtr->count + 1,i,
00270 ConstructCompilerData(theEnv)->ImageID,longsReqdPartition,longsReqdPartitionCount,
00271 hashPtr->size);
00272
00273 longsReqdPartitionCount += (int) (hashPtr->size / sizeof(unsigned long));
00274 if ((hashPtr->size % sizeof(unsigned long)) != 0)
00275 longsReqdPartitionCount++;
00276 if (longsReqdPartitionCount >= ConstructCompilerData(theEnv)->MaxIndices)
00277 {
00278 longsReqdPartitionCount = 0;
00279 longsReqdPartition++;
00280 }
00281
00282 count++;
00283 j++;
00284
00285 if ((count == numberOfEntries) || (j >= ConstructCompilerData(theEnv)->MaxIndices))
00286 {
00287 fprintf(fp,"}};\n");
00288 GenClose(theEnv,fp);
00289 j = 0;
00290 arrayVersion++;
00291 version++;
00292 if (count < numberOfEntries)
00293 {
00294 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(0);
00295 newHeader = TRUE;
00296 }
00297 }
00298 else
00299 { fprintf(fp,"},\n"); }
00300 }
00301 }
00302
00303 return(version);
00304 }
00305
00306
00307
00308
00309
00310
00311 static int BitMapValuesToCode(
00312 void *theEnv,
00313 char *fileName,
00314 char *pathName,
00315 char *fileNameBuffer,
00316 int version)
00317 {
00318 int i, j, k;
00319 unsigned l;
00320 struct bitMapHashNode *hashPtr;
00321 int count;
00322 int numberOfEntries;
00323 struct bitMapHashNode **bitMapTable;
00324 int newHeader = TRUE;
00325 int arrayVersion = 1;
00326 FILE *fp;
00327 unsigned long tmpLong;
00328 int longsReqd;
00329
00330
00331
00332
00333
00334 bitMapTable = GetBitMapTable(theEnv);
00335 count = numberOfEntries = 0;
00336
00337 for (i = 0; i < BITMAP_HASH_SIZE; i++)
00338 {
00339 for (hashPtr = bitMapTable[i];
00340 hashPtr != NULL;
00341 hashPtr = hashPtr->next)
00342 {
00343 numberOfEntries += (int) (hashPtr->size / sizeof(unsigned long));
00344 if ((hashPtr->size % sizeof(unsigned long)) != 0)
00345 { numberOfEntries++; }
00346 }
00347 }
00348
00349 if (numberOfEntries == 0) return(version);
00350
00351 for (i = 1; i <= (numberOfEntries / ConstructCompilerData(theEnv)->MaxIndices) + 1 ; i++)
00352 { fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern unsigned long L%d_%d[];\n",ConstructCompilerData(theEnv)->ImageID,i); }
00353
00354
00355
00356
00357
00358 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(-1);
00359
00360
00361
00362
00363
00364 j = 0;
00365
00366 for (i = 0; i < BITMAP_HASH_SIZE; i++)
00367 {
00368 for (hashPtr = bitMapTable[i];
00369 hashPtr != NULL;
00370 hashPtr = hashPtr->next)
00371 {
00372 if (newHeader)
00373 {
00374 fprintf(fp,"unsigned long L%d_%d[] = {\n",ConstructCompilerData(theEnv)->ImageID,arrayVersion);
00375 newHeader = FALSE;
00376 }
00377
00378 longsReqd = (int) (hashPtr->size / sizeof(unsigned long));
00379 if ((hashPtr->size % sizeof(unsigned long)) != 0)
00380 longsReqd++;
00381
00382 for (k = 0 ; k < longsReqd ; k++)
00383 {
00384 if (k > 0)
00385 fprintf(fp,",");
00386 tmpLong = 0L;
00387 for (l = 0 ;
00388 ((l < sizeof(unsigned long)) &&
00389 (((k * sizeof(unsigned long)) + l) < (size_t) hashPtr->size)) ;
00390 l++)
00391 ((char *) &tmpLong)[l] = hashPtr->contents[(k * sizeof(unsigned long)) + l];
00392 fprintf(fp,"0x%lxL",tmpLong);
00393 }
00394
00395 count += longsReqd;
00396 j += longsReqd;
00397
00398 if ((count == numberOfEntries) || (j >= ConstructCompilerData(theEnv)->MaxIndices))
00399 {
00400 fprintf(fp,"};\n");
00401 GenClose(theEnv,fp);
00402 j = 0;
00403 arrayVersion++;
00404 version++;
00405 if (count < numberOfEntries)
00406 {
00407 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(0);
00408 newHeader = TRUE;
00409 }
00410 }
00411 else
00412 { fprintf(fp,",\n"); }
00413 }
00414 }
00415
00416 return(version);
00417 }
00418
00419
00420
00421
00422
00423
00424 static int FloatHashNodesToCode(
00425 void *theEnv,
00426 char *fileName,
00427 char *pathName,
00428 char *fileNameBuffer,
00429 int version)
00430 {
00431 int i, j;
00432 struct floatHashNode *hashPtr;
00433 int count;
00434 int numberOfEntries;
00435 struct floatHashNode **floatTable;
00436 int newHeader = TRUE;
00437 FILE *fp;
00438 int arrayVersion = 1;
00439
00440
00441
00442
00443
00444 floatTable = GetFloatTable(theEnv);
00445 count = numberOfEntries = 0;
00446
00447 for (i = 0; i < FLOAT_HASH_SIZE; i++)
00448 {
00449 for (hashPtr = floatTable[i];
00450 hashPtr != NULL;
00451 hashPtr = hashPtr->next)
00452 { numberOfEntries++; }
00453 }
00454
00455 if (numberOfEntries == 0) return(version);
00456
00457 for (i = 1; i <= (numberOfEntries / ConstructCompilerData(theEnv)->MaxIndices) + 1 ; i++)
00458 { fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct floatHashNode F%d_%d[];\n",ConstructCompilerData(theEnv)->ImageID,i); }
00459
00460
00461
00462
00463
00464 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(-1);
00465
00466
00467
00468
00469
00470 j = 0;
00471
00472 for (i = 0; i < FLOAT_HASH_SIZE; i++)
00473 {
00474 for (hashPtr = floatTable[i];
00475 hashPtr != NULL;
00476 hashPtr = hashPtr->next)
00477 {
00478 if (newHeader)
00479 {
00480 fprintf(fp,"struct floatHashNode F%d_%d[] = {\n",ConstructCompilerData(theEnv)->ImageID,arrayVersion);
00481 newHeader = FALSE;
00482 }
00483
00484 if (hashPtr->next == NULL)
00485 { fprintf(fp,"{NULL,"); }
00486 else
00487 {
00488 if ((j + 1) >= ConstructCompilerData(theEnv)->MaxIndices)
00489 { fprintf(fp,"{&F%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion + 1,0); }
00490 else
00491 { fprintf(fp,"{&F%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion,j + 1); }
00492 }
00493
00494 fprintf(fp,"%ld,0,1,0,0,%d,",hashPtr->count + 1,i);
00495 fprintf(fp,"%s",FloatToString(theEnv,hashPtr->contents));
00496
00497 count++;
00498 j++;
00499
00500 if ((count == numberOfEntries) || (j >= ConstructCompilerData(theEnv)->MaxIndices))
00501 {
00502 fprintf(fp,"}};\n");
00503 GenClose(theEnv,fp);
00504 j = 0;
00505 version++;
00506 arrayVersion++;
00507 if (count < numberOfEntries)
00508 {
00509 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(0);
00510 newHeader = TRUE;
00511 }
00512 }
00513 else
00514 { fprintf(fp,"},\n"); }
00515 }
00516 }
00517
00518 return(version);
00519 }
00520
00521
00522
00523
00524
00525
00526 static int IntegerHashNodesToCode(
00527 void *theEnv,
00528 char *fileName,
00529 char *pathName,
00530 char *fileNameBuffer,
00531 int version)
00532 {
00533 int i, j;
00534 struct integerHashNode *hashPtr;
00535 int count;
00536 int numberOfEntries;
00537 struct integerHashNode **integerTable;
00538 int newHeader = TRUE;
00539 FILE *fp;
00540 int arrayVersion = 1;
00541
00542
00543
00544
00545
00546 integerTable = GetIntegerTable(theEnv);
00547 count = numberOfEntries = 0;
00548
00549 for (i = 0; i < INTEGER_HASH_SIZE; i++)
00550 {
00551 for (hashPtr = integerTable[i];
00552 hashPtr != NULL;
00553 hashPtr = hashPtr->next)
00554 { numberOfEntries++; }
00555 }
00556
00557 if (numberOfEntries == 0) return(version);
00558
00559 for (i = 1; i <= (numberOfEntries / ConstructCompilerData(theEnv)->MaxIndices) + 1 ; i++)
00560 { fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct integerHashNode I%d_%d[];\n",ConstructCompilerData(theEnv)->ImageID,i); }
00561
00562
00563
00564
00565
00566 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(-1);
00567
00568
00569
00570
00571
00572 j = 0;
00573
00574 for (i = 0; i < INTEGER_HASH_SIZE; i++)
00575 {
00576 for (hashPtr = integerTable[i];
00577 hashPtr != NULL;
00578 hashPtr = hashPtr->next)
00579 {
00580 if (newHeader)
00581 {
00582 fprintf(fp,"struct integerHashNode I%d_%d[] = {\n",ConstructCompilerData(theEnv)->ImageID,arrayVersion);
00583 newHeader = FALSE;
00584 }
00585
00586 if (hashPtr->next == NULL)
00587 { fprintf(fp,"{NULL,"); }
00588 else
00589 {
00590 if ((j + 1) >= ConstructCompilerData(theEnv)->MaxIndices)
00591 { fprintf(fp,"{&I%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion + 1,0); }
00592 else
00593 { fprintf(fp,"{&I%d_%d[%d],",ConstructCompilerData(theEnv)->ImageID,arrayVersion,j + 1); }
00594 }
00595
00596 fprintf(fp,"%ld,0,1,0,0,%d,",hashPtr->count + 1,i);
00597 fprintf(fp,"%lldLL",hashPtr->contents);
00598
00599 count++;
00600 j++;
00601
00602 if ((count == numberOfEntries) || (j >= ConstructCompilerData(theEnv)->MaxIndices))
00603 {
00604 fprintf(fp,"}};\n");
00605 GenClose(theEnv,fp);
00606 j = 0;
00607 version++;
00608 arrayVersion++;
00609 if (count < numberOfEntries)
00610 {
00611 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,version,FALSE)) == NULL) return(0);
00612 newHeader = TRUE;
00613 }
00614 }
00615 else
00616 { fprintf(fp,"},\n"); }
00617 }
00618 }
00619
00620 return(version);
00621 }
00622
00623
00624
00625
00626
00627
00628 static int HashTablesToCode(
00629 void *theEnv,
00630 char *fileName,
00631 char *pathName,
00632 char *fileNameBuffer)
00633 {
00634 unsigned long i;
00635 FILE *fp;
00636 struct symbolHashNode **symbolTable;
00637 struct floatHashNode **floatTable;
00638 struct integerHashNode **integerTable;
00639 struct bitMapHashNode **bitMapTable;
00640
00641
00642
00643
00644
00645 symbolTable = GetSymbolTable(theEnv);
00646
00647 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,1,FALSE)) == NULL) return(0);
00648
00649 fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct symbolHashNode *sht%d[];\n",ConstructCompilerData(theEnv)->ImageID);
00650 fprintf(fp,"struct symbolHashNode *sht%d[%ld] = {\n",ConstructCompilerData(theEnv)->ImageID,SYMBOL_HASH_SIZE);
00651
00652 for (i = 0; i < SYMBOL_HASH_SIZE; i++)
00653 {
00654 PrintSymbolReference(theEnv,fp,symbolTable[i]);
00655
00656 if (i + 1 != SYMBOL_HASH_SIZE) fprintf(fp,",\n");
00657 }
00658
00659 fprintf(fp,"};\n");
00660
00661 GenClose(theEnv,fp);
00662
00663
00664
00665
00666
00667 floatTable = GetFloatTable(theEnv);
00668
00669 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,2,FALSE)) == NULL) return(0);
00670
00671 fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct floatHashNode *fht%d[];\n",ConstructCompilerData(theEnv)->ImageID);
00672 fprintf(fp,"struct floatHashNode *fht%d[%d] = {\n",ConstructCompilerData(theEnv)->ImageID,FLOAT_HASH_SIZE);
00673
00674 for (i = 0; i < FLOAT_HASH_SIZE; i++)
00675 {
00676 if (floatTable[i] == NULL) { fprintf(fp,"NULL"); }
00677 else PrintFloatReference(theEnv,fp,floatTable[i]);
00678
00679 if (i + 1 != FLOAT_HASH_SIZE) fprintf(fp,",\n");
00680 }
00681
00682 fprintf(fp,"};\n");
00683
00684 GenClose(theEnv,fp);
00685
00686
00687
00688
00689
00690 integerTable = GetIntegerTable(theEnv);
00691
00692 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,3,FALSE)) == NULL) return(0);
00693
00694 fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct integerHashNode *iht%d[];\n",ConstructCompilerData(theEnv)->ImageID);
00695 fprintf(fp,"struct integerHashNode *iht%d[%d] = {\n",ConstructCompilerData(theEnv)->ImageID,INTEGER_HASH_SIZE);
00696
00697 for (i = 0; i < INTEGER_HASH_SIZE; i++)
00698 {
00699 if (integerTable[i] == NULL) { fprintf(fp,"NULL"); }
00700 else PrintIntegerReference(theEnv,fp,integerTable[i]);
00701
00702 if (i + 1 != INTEGER_HASH_SIZE) fprintf(fp,",\n");
00703 }
00704
00705 fprintf(fp,"};\n");
00706
00707 GenClose(theEnv,fp);
00708
00709
00710
00711
00712
00713 bitMapTable = GetBitMapTable(theEnv);
00714
00715 if ((fp = NewCFile(theEnv,fileName,pathName,fileNameBuffer,1,4,FALSE)) == NULL) return(0);
00716
00717 fprintf(ConstructCompilerData(theEnv)->HeaderFP,"extern struct bitMapHashNode *bmht%d[];\n",ConstructCompilerData(theEnv)->ImageID);
00718 fprintf(fp,"struct bitMapHashNode *bmht%d[%d] = {\n",ConstructCompilerData(theEnv)->ImageID,BITMAP_HASH_SIZE);
00719
00720 for (i = 0; i < BITMAP_HASH_SIZE; i++)
00721 {
00722 PrintBitMapReference(theEnv,fp,bitMapTable[i]);
00723
00724 if (i + 1 != BITMAP_HASH_SIZE) fprintf(fp,",\n");
00725 }
00726
00727 fprintf(fp,"};\n");
00728
00729 GenClose(theEnv,fp);
00730
00731 return(1);
00732 }
00733
00734
00735
00736
00737
00738
00739 globle void PrintSymbolReference(
00740 void *theEnv,
00741 FILE *theFile,
00742 struct symbolHashNode *theSymbol)
00743 {
00744 if (theSymbol == NULL) fprintf(theFile,"NULL");
00745 else fprintf(theFile,"&S%d_%d[%d]",
00746 ConstructCompilerData(theEnv)->ImageID,
00747 (int) (theSymbol->bucket / ConstructCompilerData(theEnv)->MaxIndices) + 1,
00748 (int) theSymbol->bucket % ConstructCompilerData(theEnv)->MaxIndices);
00749 }
00750
00751
00752
00753
00754
00755 globle void PrintFloatReference(
00756 void *theEnv,
00757 FILE *theFile,
00758 struct floatHashNode *theFloat)
00759 {
00760 fprintf(theFile,"&F%d_%d[%d]",
00761 ConstructCompilerData(theEnv)->ImageID,
00762 (int) (theFloat->bucket / ConstructCompilerData(theEnv)->MaxIndices) + 1,
00763 (int) theFloat->bucket % ConstructCompilerData(theEnv)->MaxIndices);
00764 }
00765
00766
00767
00768
00769
00770 globle void PrintIntegerReference(
00771 void *theEnv,
00772 FILE *theFile,
00773 struct integerHashNode *theInteger)
00774 {
00775 fprintf(theFile,"&I%d_%d[%d]",
00776 ConstructCompilerData(theEnv)->ImageID,
00777 (int) (theInteger->bucket / ConstructCompilerData(theEnv)->MaxIndices) + 1,
00778 (int) theInteger->bucket % ConstructCompilerData(theEnv)->MaxIndices);
00779 }
00780
00781
00782
00783
00784
00785 globle void PrintBitMapReference(
00786 void *theEnv,
00787 FILE *theFile,
00788 struct bitMapHashNode *theBitMap)
00789 {
00790 if (theBitMap == NULL) fprintf(theFile,"NULL");
00791 else fprintf(theFile,"&B%d_%d[%d]",
00792 ConstructCompilerData(theEnv)->ImageID,
00793 (int) (theBitMap->bucket / ConstructCompilerData(theEnv)->MaxIndices) + 1,
00794 (int) theBitMap->bucket % ConstructCompilerData(theEnv)->MaxIndices);
00795 }
00796
00797
00798
00799
00800
00801
00802 static void PrintCString(
00803 FILE *theFile,
00804 char *str)
00805 {
00806 unsigned i;
00807 size_t slen;
00808
00809
00810
00811
00812
00813 fprintf(theFile,"\"");
00814
00815
00816
00817
00818
00819 slen = strlen(str);
00820 for (i = 0 ; i < slen ; i++)
00821 {
00822
00823
00824
00825
00826 if ((str[i] == '"') || (str[i] == '\\'))
00827 {
00828 fputc('\\',theFile);
00829 fputc(str[i],theFile);
00830 }
00831
00832
00833
00834
00835
00836 else if (str[i] == '\n')
00837 {
00838 fputc('\\',theFile);
00839 fputc('n',theFile);
00840 }
00841
00842
00843
00844
00845
00846
00847 else
00848 { fputc(str[i],theFile); }
00849 }
00850
00851
00852
00853
00854
00855 fprintf(theFile,"\"");
00856 }
00857
00858 #endif