96#include <config_auto.h>
100#include "allheaders.h"
102#define OUTROOT "fhmtgen"
103#define TEMPLATE1 "hmttemplate1.txt"
104#define TEMPLATE2 "hmttemplate2.txt"
106#define PROTOARGS "(l_uint32 *, l_int32, l_int32, l_int32, l_uint32 *, l_int32);"
108#define L_BUF_SIZE 512
114static char wpldecls[][60] = {
116 "l_int32 wpls2, wpls3;",
117 "l_int32 wpls2, wpls3, wpls4;",
119 "l_int32 wpls5, wpls6;",
120 "l_int32 wpls5, wpls6, wpls7;",
121 "l_int32 wpls5, wpls6, wpls7, wpls8;",
123 "l_int32 wpls9, wpls10;",
124 "l_int32 wpls9, wpls10, wpls11;",
125 "l_int32 wpls9, wpls10, wpls11, wpls12;",
127 "l_int32 wpls13, wpls14;",
128 "l_int32 wpls13, wpls14, wpls15;",
129 "l_int32 wpls13, wpls14, wpls15, wpls16;",
131 "l_int32 wpls17, wpls18;",
132 "l_int32 wpls17, wpls18, wpls19;",
133 "l_int32 wpls17, wpls18, wpls19, wpls20;",
135 "l_int32 wpls21, wpls22;",
136 "l_int32 wpls21, wpls22, wpls23;",
137 "l_int32 wpls21, wpls22, wpls23, wpls24;",
139 "l_int32 wpls25, wpls26;",
140 "l_int32 wpls25, wpls26, wpls27;",
141 "l_int32 wpls25, wpls26, wpls27, wpls28;",
143 "l_int32 wpls29, wpls30;",
144 "l_int32 wpls29, wpls30, wpls31;"};
146static char wpldefs[][24] = {
147 " wpls2 = 2 * wpls;",
148 " wpls3 = 3 * wpls;",
149 " wpls4 = 4 * wpls;",
150 " wpls5 = 5 * wpls;",
151 " wpls6 = 6 * wpls;",
152 " wpls7 = 7 * wpls;",
153 " wpls8 = 8 * wpls;",
154 " wpls9 = 9 * wpls;",
155 " wpls10 = 10 * wpls;",
156 " wpls11 = 11 * wpls;",
157 " wpls12 = 12 * wpls;",
158 " wpls13 = 13 * wpls;",
159 " wpls14 = 14 * wpls;",
160 " wpls15 = 15 * wpls;",
161 " wpls16 = 16 * wpls;",
162 " wpls17 = 17 * wpls;",
163 " wpls18 = 18 * wpls;",
164 " wpls19 = 19 * wpls;",
165 " wpls20 = 20 * wpls;",
166 " wpls21 = 21 * wpls;",
167 " wpls22 = 22 * wpls;",
168 " wpls23 = 23 * wpls;",
169 " wpls24 = 24 * wpls;",
170 " wpls25 = 25 * wpls;",
171 " wpls26 = 26 * wpls;",
172 " wpls27 = 27 * wpls;",
173 " wpls28 = 28 * wpls;",
174 " wpls29 = 29 * wpls;",
175 " wpls30 = 30 * wpls;",
176 " wpls31 = 31 * wpls;"};
178static char wplstrp[][10] = {
"+ wpls",
"+ wpls2",
"+ wpls3",
"+ wpls4",
179 "+ wpls5",
"+ wpls6",
"+ wpls7",
"+ wpls8",
180 "+ wpls9",
"+ wpls10",
"+ wpls11",
"+ wpls12",
181 "+ wpls13",
"+ wpls14",
"+ wpls15",
"+ wpls16",
182 "+ wpls17",
"+ wpls18",
"+ wpls19",
"+ wpls20",
183 "+ wpls21",
"+ wpls22",
"+ wpls23",
"+ wpls24",
184 "+ wpls25",
"+ wpls26",
"+ wpls27",
"+ wpls28",
185 "+ wpls29",
"+ wpls30",
"+ wpls31"};
187static char wplstrm[][10] = {
"- wpls",
"- wpls2",
"- wpls3",
"- wpls4",
188 "- wpls5",
"- wpls6",
"- wpls7",
"- wpls8",
189 "- wpls9",
"- wpls10",
"- wpls11",
"- wpls12",
190 "- wpls13",
"- wpls14",
"- wpls15",
"- wpls16",
191 "- wpls17",
"- wpls18",
"- wpls19",
"- wpls20",
192 "- wpls21",
"- wpls22",
"- wpls23",
"- wpls24",
193 "- wpls25",
"- wpls26",
"- wpls27",
"- wpls28",
194 "- wpls29",
"- wpls30",
"- wpls31"};
215 const char *filename)
220 return ERROR_INT(
"sela not defined", __func__, 1);
224 return ERROR_INT(
"code generation problem", __func__, 1);
255 const char *filename)
258char *str_proto1, *str_proto2, *str_proto3;
259char *str_doc1, *str_doc2, *str_doc3, *str_doc4;
260char *str_def1, *str_def2, *str_proc1, *str_proc2;
261char *str_dwa1, *str_low_dt, *str_low_ds;
263l_int32 i, nsels, nbytes, actstart, end, newstart;
268 return ERROR_INT(
"sela not defined", __func__, 1);
271 if ((nsels = selaGetCount(sela)) == 0)
272 return ERROR_INT(
"no sels in sela", __func__, 1);
275 if ((filestr = (
char *)l_binaryRead(TEMPLATE1, &size)) == NULL)
276 return ERROR_INT(
"filestr not made", __func__, 1);
277 sa2 = sarrayCreateLinesFromString(filestr, 1);
280 return ERROR_INT(
"sa2 not made", __func__, 1);
283 sa1 = selaGetSelnames(sela);
286 sprintf(bigbuf,
"PIX *pixHMTDwa_%d(PIX *pixd, PIX *pixs, "
287 "const char *selname);", fileindex);
288 str_proto1 = stringNew(bigbuf);
289 sprintf(bigbuf,
"PIX *pixFHMTGen_%d(PIX *pixd, PIX *pixs, "
290 "const char *selname);", fileindex);
291 str_proto2 = stringNew(bigbuf);
292 sprintf(bigbuf,
"l_int32 fhmtgen_low_%d(l_uint32 *datad, l_int32 w,\n"
293 " l_int32 h, l_int32 wpld,\n"
294 " l_uint32 *datas, l_int32 wpls,\n"
295 " l_int32 index);", fileindex);
296 str_proto3 = stringNew(bigbuf);
297 sprintf(bigbuf,
" * PIX *pixHMTDwa_%d()", fileindex);
298 str_doc1 = stringNew(bigbuf);
299 sprintf(bigbuf,
" * PIX *pixFHMTGen_%d()", fileindex);
300 str_doc2 = stringNew(bigbuf);
301 sprintf(bigbuf,
" * \\brief pixHMTDwa_%d()", fileindex);
302 str_doc3 = stringNew(bigbuf);
303 sprintf(bigbuf,
" * \\brief pixFHMTGen_%d()", fileindex);
304 str_doc4 = stringNew(bigbuf);
305 sprintf(bigbuf,
"pixHMTDwa_%d(PIX *pixd,", fileindex);
306 str_def1 = stringNew(bigbuf);
307 sprintf(bigbuf,
"pixFHMTGen_%d(PIX *pixd,", fileindex);
308 str_def2 = stringNew(bigbuf);
309 sprintf(bigbuf,
" PROCNAME(\"pixHMTDwa_%d\");", fileindex);
310 str_proc1 = stringNew(bigbuf);
311 sprintf(bigbuf,
" PROCNAME(\"pixFHMTGen_%d\");", fileindex);
312 str_proc2 = stringNew(bigbuf);
313 sprintf(bigbuf,
" pixt2 = pixFHMTGen_%d(NULL, pixt1, selname);",
315 str_dwa1 = stringNew(bigbuf);
317 " fhmtgen_low_%d(datad, w, h, wpld, datat, wpls, index);",
319 str_low_dt = stringNew(bigbuf);
321 " fhmtgen_low_%d(datad, w, h, wpld, datas, wpls, index);",
323 str_low_ds = stringNew(bigbuf);
326 sa3 = sarrayCreate(0);
329 sarrayParseRange(sa2, 0, &actstart, &end, &newstart,
"--", 0);
330 sarrayAppendRange(sa3, sa2, actstart, end);
333 sarrayAddString(sa3, str_doc1,
L_INSERT);
334 sarrayAddString(sa3, str_doc2,
L_INSERT);
337 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
338 sarrayAppendRange(sa3, sa2, actstart, end);
341 sarrayAddString(sa3, str_proto1,
L_INSERT);
342 sarrayAddString(sa3, str_proto2,
L_INSERT);
343 sarrayAddString(sa3, str_proto3,
L_INSERT);
346 sprintf(bigbuf,
"\nstatic l_int32 NUM_SELS_GENERATED = %d;", nsels);
347 sarrayAddString(sa3, bigbuf,
L_COPY);
348 sprintf(bigbuf,
"static char SEL_NAMES[][80] = {");
349 sarrayAddString(sa3, bigbuf,
L_COPY);
350 for (i = 0; i < nsels - 1; i++) {
351 sprintf(bigbuf,
" \"%s\",",
353 sarrayAddString(sa3, bigbuf,
L_COPY);
355 sprintf(bigbuf,
" \"%s\"};",
357 sarrayAddString(sa3, bigbuf,
L_COPY);
360 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
361 sarrayAppendRange(sa3, sa2, actstart, end);
362 sarrayAddString(sa3, str_doc3,
L_INSERT);
363 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
364 sarrayAppendRange(sa3, sa2, actstart, end);
367 sarrayAddString(sa3, str_def1,
L_INSERT);
368 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
369 sarrayAppendRange(sa3, sa2, actstart, end);
370 sarrayAddString(sa3, str_proc1,
L_INSERT);
371 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
372 sarrayAppendRange(sa3, sa2, actstart, end);
373 sarrayAddString(sa3, str_dwa1,
L_INSERT);
374 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
375 sarrayAppendRange(sa3, sa2, actstart, end);
378 sarrayAddString(sa3, str_doc4,
L_INSERT);
379 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
380 sarrayAppendRange(sa3, sa2, actstart, end);
383 sarrayAddString(sa3, str_def2,
L_INSERT);
384 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
385 sarrayAppendRange(sa3, sa2, actstart, end);
386 sarrayAddString(sa3, str_proc2,
L_INSERT);
387 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
388 sarrayAppendRange(sa3, sa2, actstart, end);
389 sarrayAddString(sa3, str_low_dt,
L_INSERT);
390 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
391 sarrayAppendRange(sa3, sa2, actstart, end);
392 sarrayAddString(sa3, str_low_ds,
L_INSERT);
393 sarrayParseRange(sa2, newstart, &actstart, &end, &newstart,
"--", 0);
394 sarrayAppendRange(sa3, sa2, actstart, end);
396 filestr = sarrayToString(sa3, 1);
397 nbytes = strlen(filestr);
399 snprintf(bigbuf,
L_BUF_SIZE,
"%s.%d.c", filename, fileindex);
401 sprintf(bigbuf,
"%s.%d.c", OUTROOT, fileindex);
402 l_binaryWrite(bigbuf,
"w", filestr, nbytes);
435 const char *filename)
437char *filestr, *fname, *linestr;
438char *str_doc1, *str_doc2, *str_doc3, *str_def1;
440char breakstring[] =
" break;";
441char staticstring[] =
"static void";
442l_int32 i, k, l, nsels, nbytes, nhits, nmisses;
443l_int32 actstart, end, newstart;
444l_int32 argstart, argend, loopstart, loopend, finalstart, finalend;
446SARRAY *sa1, *sa2, *sa3, *sa4, *sa5, *sa6;
450 return ERROR_INT(
"sela not defined", __func__, 1);
453 if ((nsels = selaGetCount(sela)) == 0)
454 return ERROR_INT(
"no sels in sela", __func__, 1);
457 if ((filestr = (
char *)l_binaryRead(TEMPLATE2, &size)) == NULL)
458 return ERROR_INT(
"filestr not made", __func__, 1);
459 sa1 = sarrayCreateLinesFromString(filestr, 1);
462 return ERROR_INT(
"sa1 not made", __func__, 1);
465 if ((sa2 = sarrayCreate(nsels)) == NULL) {
467 return ERROR_INT(
"sa2 not made", __func__, 1);
469 for (i = 0; i < nsels; i++) {
470 sprintf(bigbuf,
"fhmt_%d_%d", fileindex, i);
471 sarrayAddString(sa2, bigbuf,
L_COPY);
475 sa3 = sarrayCreate(2 * nsels);
476 for (i = 0; i < nsels; i++) {
477 fname = sarrayGetString(sa2, i,
L_NOCOPY);
478 sprintf(bigbuf,
"static void %s%s", fname, PROTOARGS);
479 sarrayAddString(sa3, bigbuf,
L_COPY);
483 sprintf(bigbuf,
" * l_int32 fhmtgen_low_%d()",
485 str_doc1 = stringNew(bigbuf);
486 sprintf(bigbuf,
" * void fhmt_%d_*()", fileindex);
487 str_doc2 = stringNew(bigbuf);
490 sa4 = sarrayCreate(0);
493 sarrayParseRange(sa1, 0, &actstart, &end, &newstart,
"--", 0);
494 sarrayAppendRange(sa4, sa1, actstart, end);
497 sarrayAddString(sa4, str_doc1,
L_INSERT);
498 sarrayParseRange(sa1, newstart, &actstart, &end, &newstart,
"--", 0);
499 sarrayAppendRange(sa4, sa1, actstart, end);
500 sarrayAddString(sa4, str_doc2,
L_INSERT);
501 sarrayParseRange(sa1, newstart, &actstart, &end, &newstart,
"--", 0);
502 sarrayAppendRange(sa4, sa1, actstart, end);
505 for (i = 0; i < nsels; i++) {
506 if ((linestr = sarrayGetString(sa3, i,
L_COPY)) == NULL) {
511 return ERROR_INT(
"linestr not retrieved", __func__, 1);
513 sarrayAddString(sa4, linestr,
L_INSERT);
517 sprintf(bigbuf,
" * fhmtgen_low_%d()", fileindex);
518 str_doc3 = stringNew(bigbuf);
519 sprintf(bigbuf,
"fhmtgen_low_%d(l_uint32 *datad,", fileindex);
520 str_def1 = stringNew(bigbuf);
523 sarrayParseRange(sa1, newstart, &actstart, &end, &newstart,
"--", 0);
524 sarrayAppendRange(sa4, sa1, actstart, end);
525 sarrayAddString(sa4, str_doc3,
L_INSERT);
526 sarrayParseRange(sa1, newstart, &actstart, &end, &newstart,
"--", 0);
527 sarrayAppendRange(sa4, sa1, actstart, end);
528 sarrayAddString(sa4, str_def1,
L_INSERT);
529 sarrayParseRange(sa1, newstart, &actstart, &end, &newstart,
"--", 0);
530 sarrayAppendRange(sa4, sa1, actstart, end);
533 for (i = 0; i < nsels; i++) {
534 sprintf(bigbuf,
" case %d:", i);
535 sarrayAddString(sa4, bigbuf,
L_COPY);
536 sprintf(bigbuf,
" %s(datad, w, h, wpld, datas, wpls);",
538 sarrayAddString(sa4, bigbuf,
L_COPY);
539 sarrayAddString(sa4, breakstring,
L_COPY);
543 sarrayParseRange(sa1, newstart, &actstart, &end, &newstart,
"--", 0);
544 sarrayAppendRange(sa4, sa1, actstart, end);
547 sarrayParseRange(sa1, newstart, &argstart, &argend, &newstart,
"--", 0);
550 sarrayParseRange(sa1, newstart, &loopstart, &loopend, &newstart,
"--", 0);
553 sarrayParseRange(sa1, newstart, &finalstart, &finalend, &newstart,
"--", 0);
556 for (i = 0; i < nsels; i++) {
558 sarrayAddString(sa4, staticstring,
L_COPY);
559 fname = sarrayGetString(sa2, i,
L_NOCOPY);
560 sprintf(bigbuf,
"%s(l_uint32 *datad,", fname);
561 sarrayAddString(sa4, bigbuf,
L_COPY);
562 sarrayAppendRange(sa4, sa1, argstart, argend);
565 if ((sel = selaGetSel(sela, i)) == NULL) {
570 return ERROR_INT(
"sel not returned", __func__, 1);
573 sarrayJoin(sa4, sa5);
579 for (k = 0; k < sel->
sy; k++) {
580 for (l = 0; l < sel->
sx; l++) {
581 if (sel->
data[k][l] == 1)
583 else if (sel->
data[k][l] == 2)
588 linestr = stringNew(
" "
589 "lept_stderr(\"Error in HMT: no hits in sel!\\n\");\n}\n\n");
590 sarrayAddString(sa4, linestr,
L_INSERT);
595 sarrayAppendRange(sa4, sa1, loopstart, loopend);
603 return ERROR_INT(
"sa6 not made", __func__, 1);
605 sarrayJoin(sa4, sa6);
609 sarrayAppendRange(sa4, sa1, finalstart, finalend);
613 filestr = sarrayToString(sa4, 1);
614 nbytes = strlen(filestr);
616 snprintf(bigbuf,
L_BUF_SIZE,
"%slow.%d.c", filename, fileindex);
618 sprintf(bigbuf,
"%slow.%d.c", OUTROOT, fileindex);
619 l_binaryWrite(bigbuf,
"w", filestr, nbytes);
639char emptystring[] =
"";
640l_int32 i, j, ymax, dely;
644 return (
SARRAY *)ERROR_PTR(
"sel not defined", __func__, NULL);
647 for (i = 0; i < sel->
sy; i++) {
648 for (j = 0; j < sel->
sx; j++) {
649 if (sel->
data[i][j] == 1 || sel->
data[i][j] == 2) {
650 dely = L_ABS(i - sel->
cy);
651 ymax = L_MAX(ymax, dely);
656 L_WARNING(
"ymax > 31; truncating to 31\n", __func__);
660 sa = sarrayCreate(0);
664 sarrayAddString(sa, wpldecls[2],
L_COPY);
666 sarrayAddString(sa, wpldecls[6],
L_COPY);
668 sarrayAddString(sa, wpldecls[10],
L_COPY);
670 sarrayAddString(sa, wpldecls[14],
L_COPY);
672 sarrayAddString(sa, wpldecls[18],
L_COPY);
674 sarrayAddString(sa, wpldecls[22],
L_COPY);
676 sarrayAddString(sa, wpldecls[26],
L_COPY);
678 sarrayAddString(sa, wpldecls[ymax - 2],
L_COPY);
680 sarrayAddString(sa, emptystring,
L_COPY);
683 for (i = 2; i <= ymax; i++)
684 sarrayAddString(sa, wpldefs[i - 2],
L_COPY);
701l_int32 i, j, ntot, nfound, type, delx, dely;
705 return (
SARRAY *)ERROR_PTR(
"sel not defined", __func__, NULL);
707 sa = sarrayCreate(0);
708 ntot = nhits + nmisses;
710 for (i = 0; i < sel->
sy; i++) {
711 for (j = 0; j < sel->
sx; j++) {
712 type = sel->
data[i][j];
713 if (type == SEL_HIT || type == SEL_MISS) {
719 L_WARNING(
"barrel shift string not made\n", __func__);
723 sprintf(bigbuf,
" *dptr = %s;",
string);
724 else if (nfound == 1)
725 sprintf(bigbuf,
" *dptr = %s %s",
string, land);
726 else if (nfound < ntot)
727 sprintf(bigbuf,
" %s %s",
string, land);
729 sprintf(bigbuf,
" %s;",
string);
730 sarrayAddString(sa, bigbuf,
L_COPY);
751 if (delx < -31 || delx > 31)
752 return (
char *)ERROR_PTR(
"delx out of bounds", __func__, NULL);
753 if (dely < -31 || dely > 31)
754 return (
char *)ERROR_PTR(
"dely out of bounds", __func__, NULL);
758 if (type == SEL_HIT) {
759 if ((delx == 0) && (dely == 0))
760 sprintf(bigbuf,
"(*sptr)");
761 else if ((delx == 0) && (dely < 0))
762 sprintf(bigbuf,
"(*(sptr %s))", wplstrm[absy - 1]);
763 else if ((delx == 0) && (dely > 0))
764 sprintf(bigbuf,
"(*(sptr %s))", wplstrp[absy - 1]);
765 else if ((delx < 0) && (dely == 0))
766 sprintf(bigbuf,
"((*(sptr) >> %d) | (*(sptr - 1) << %d))",
768 else if ((delx > 0) && (dely == 0))
769 sprintf(bigbuf,
"((*(sptr) << %d) | (*(sptr + 1) >> %d))",
771 else if ((delx < 0) && (dely < 0))
772 sprintf(bigbuf,
"((*(sptr %s) >> %d) | (*(sptr %s - 1) << %d))",
773 wplstrm[absy - 1], absx, wplstrm[absy - 1], 32 - absx);
774 else if ((delx > 0) && (dely < 0))
775 sprintf(bigbuf,
"((*(sptr %s) << %d) | (*(sptr %s + 1) >> %d))",
776 wplstrm[absy - 1], absx, wplstrm[absy - 1], 32 - absx);
777 else if ((delx < 0) && (dely > 0))
778 sprintf(bigbuf,
"((*(sptr %s) >> %d) | (*(sptr %s - 1) << %d))",
779 wplstrp[absy - 1], absx, wplstrp[absy - 1], 32 - absx);
781 sprintf(bigbuf,
"((*(sptr %s) << %d) | (*(sptr %s + 1) >> %d))",
782 wplstrp[absy - 1], absx, wplstrp[absy - 1], 32 - absx);
784 if ((delx == 0) && (dely == 0))
785 sprintf(bigbuf,
"(~*sptr)");
786 else if ((delx == 0) && (dely < 0))
787 sprintf(bigbuf,
"(~*(sptr %s))", wplstrm[absy - 1]);
788 else if ((delx == 0) && (dely > 0))
789 sprintf(bigbuf,
"(~*(sptr %s))", wplstrp[absy - 1]);
790 else if ((delx < 0) && (dely == 0))
791 sprintf(bigbuf,
"((~*(sptr) >> %d) | (~*(sptr - 1) << %d))",
793 else if ((delx > 0) && (dely == 0))
794 sprintf(bigbuf,
"((~*(sptr) << %d) | (~*(sptr + 1) >> %d))",
796 else if ((delx < 0) && (dely < 0))
797 sprintf(bigbuf,
"((~*(sptr %s) >> %d) | (~*(sptr %s - 1) << %d))",
798 wplstrm[absy - 1], absx, wplstrm[absy - 1], 32 - absx);
799 else if ((delx > 0) && (dely < 0))
800 sprintf(bigbuf,
"((~*(sptr %s) << %d) | (~*(sptr %s + 1) >> %d))",
801 wplstrm[absy - 1], absx, wplstrm[absy - 1], 32 - absx);
802 else if ((delx < 0) && (dely > 0))
803 sprintf(bigbuf,
"((~*(sptr %s) >> %d) | (~*(sptr %s - 1) << %d))",
804 wplstrp[absy - 1], absx, wplstrp[absy - 1], 32 - absx);
806 sprintf(bigbuf,
"((~*(sptr %s) << %d) | (~*(sptr %s + 1) >> %d))",
807 wplstrp[absy - 1], absx, wplstrp[absy - 1], 32 - absx);
810 return stringNew(bigbuf);
static SARRAY * sarrayMakeWplsCode(SEL *sel)
sarrayMakeWplsCode()
l_ok fhmtautogen1(SELA *sela, l_int32 fileindex, const char *filename)
fhmtautogen1()
static SARRAY * sarrayMakeInnerLoopDWACode(SEL *sel, l_int32 nhits, l_int32 nmisses)
sarrayMakeInnerLoopDWACode()
static char * makeBarrelshiftString(l_int32 delx, l_int32 dely, l_int32 type)
makeBarrelshiftString()
l_ok fhmtautogen2(SELA *sela, l_int32 fileindex, const char *filename)
fhmtautogen2()