557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
|
for {set hash 0} {$hash < $config(hashTableSize)} {incr hash} {
if {[info exists indexesAtHash($hash)]} {
set indexes $indexesAtHash($hash)
} else {
set indexes [list]
}
lappend indexes $invalidValue
lappend outputHeader "${config(prefix)}static const long ${outCVarName}_hashTable_${hash}\[\] = \{"
lappend outputHeader "${config(prefix)}\t[join $indexes {, }]"
lappend outputHeader "${config(prefix)}\};"
}
lappend outputHeader "${config(prefix)}static const long * const ${outCVarName}_hashTable\[${config(hashTableSize)}\] = \{"
for {set hash 0} {$hash < $config(hashTableSize)} {incr hash} {
lappend outputHeader "${config(prefix)}\t${outCVarName}_hashTable_${hash},"
}
lappend outputHeader "${config(prefix)}\};"
lappend outputBody "${config(prefix)}${outCVarName}_hash = Tcl_ZlibAdler32(0, (unsigned char *) ${cVarName}, ${cVarLength}) % ${config(hashTableSize)};"
lappend outputBody "${config(prefix)}for (${outCVarName}_idx = 0; ${outCVarName}_idx <= ${maxIndexes}; ${outCVarName}_idx++) \{"
lappend outputBody "${config(prefix)}\t${outCVarName} = ${outCVarName}_hashTable\[${outCVarName}_hash\]\[${outCVarName}_idx\];"
lappend outputBody "${config(prefix)}\tif (${outCVarName} == $invalidValue) \{"
lappend outputBody "${config(prefix)}\t\tbreak;"
lappend outputBody "${config(prefix)}\t\}"
lappend outputBody ""
lappend outputBody "${config(prefix)}\tif (${config(validate)}) \{"
lappend outputBody "${config(prefix)}\t\t${config(onValidated)}"
|
>
|
>
|
|
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
|
for {set hash 0} {$hash < $config(hashTableSize)} {incr hash} {
if {[info exists indexesAtHash($hash)]} {
set indexes $indexesAtHash($hash)
} else {
set indexes [list]
}
if {[llength $indexes] != $maxIndexes} {
lappend indexes $invalidValue
}
lappend outputHeader "${config(prefix)}static const long ${outCVarName}_hashTable_${hash}\[\] = \{"
lappend outputHeader "${config(prefix)}\t[join $indexes {, }]"
lappend outputHeader "${config(prefix)}\};"
}
lappend outputHeader "${config(prefix)}static const long * const ${outCVarName}_hashTable\[${config(hashTableSize)}\] = \{"
for {set hash 0} {$hash < $config(hashTableSize)} {incr hash} {
lappend outputHeader "${config(prefix)}\t${outCVarName}_hashTable_${hash},"
}
lappend outputHeader "${config(prefix)}\};"
lappend outputBody "${config(prefix)}${outCVarName}_hash = Tcl_ZlibAdler32(0, (unsigned char *) ${cVarName}, ${cVarLength}) % ${config(hashTableSize)};"
lappend outputBody "${config(prefix)}for (${outCVarName}_idx = 0; ${outCVarName}_idx < ${maxIndexes}; ${outCVarName}_idx++) \{"
lappend outputBody "${config(prefix)}\t${outCVarName} = ${outCVarName}_hashTable\[${outCVarName}_hash\]\[${outCVarName}_idx\];"
lappend outputBody "${config(prefix)}\tif (${outCVarName} == $invalidValue) \{"
lappend outputBody "${config(prefix)}\t\tbreak;"
lappend outputBody "${config(prefix)}\t\}"
lappend outputBody ""
lappend outputBody "${config(prefix)}\tif (${config(validate)}) \{"
lappend outputBody "${config(prefix)}\t\t${config(onValidated)}"
|