static int write_dhmm(float32 **tmat, float32 ***mixw, FILE *fp) { int32 n_arc; uint32 i, j, k; int32 tmp; fwrite_long (fp, COUNT_F); /* what type of file it is (trans only) */ /* might also be BIG_HMM */ fwrite_long (fp, S2_N_CODEWORD); /* number of codewords??? */ fwrite_long (fp, S2_N_STATE-1); /* n_omatrix */ /* * Output pdfs */ for (j = 0; j < 4; j++) { for (i = 0; i < S2_N_STATE-1; i++) { for (k = 0; k < S2_N_CODEWORD; k++) { tmp = LOG(mixw[i][j][k]); fwrite_long(fp, tmp); } } } fwrite_long (fp, S2_N_STATE); /* n_states */ fwrite_long (fp, 1); /* n_initial (states) */ fwrite_long (fp, 0); /* list of initial states {0} */ fwrite_long (fp, 1); /* n_final */ fwrite_long (fp, (S2_N_STATE-1)); /* list of final states {S2_N_STATE-1} */ n_arc = 14; fwrite_long (fp, n_arc); /* number of arcs */ /* * Dump these in the same order as s2 did. */ write_transition (0, 0, LOG(tmat[0][0]), 0, fp); write_transition (0, 1, LOG(tmat[0][1]), 0, fp); write_transition (1, 1, LOG(tmat[1][1]), 1, fp); write_transition (1, 2, LOG(tmat[1][2]), 1, fp); write_transition (2, 2, LOG(tmat[2][2]), 2, fp); write_transition (2, 3, LOG(tmat[2][3]), 2, fp); write_transition (3, 3, LOG(tmat[3][3]), 3, fp); write_transition (3, 4, LOG(tmat[3][4]), 3, fp); write_transition (4, 4, LOG(tmat[4][4]), 4, fp); write_transition (4, 5, LOG(tmat[4][5]), 4, fp); /* skip arcs */ write_transition (0, 2, LOG(tmat[0][2]), 0, fp); write_transition (1, 3, LOG(tmat[1][3]), 1, fp); write_transition (2, 4, LOG(tmat[2][4]), 2, fp); write_transition (3, 5, LOG(tmat[3][5]), 3, fp); return S3_SUCCESS; }
static int write_sdm(float32 **tmat, FILE *fp) { int32 n_arc; fwrite_long (fp, TIED_DIST); /* what type of file it is (trans only) */ /* might also be BIG_HMM */ fwrite_long (fp, S2_N_CODEWORD); /* number of codewords??? */ fwrite_long (fp, S2_N_STATE-1); /* n_omatrix */ /* * Output pdfs would go here, but instead go in *.{ccode,xcode,...} */ fwrite_long (fp, S2_N_STATE); /* n_states */ fwrite_long (fp, 1); /* n_initial (states) */ fwrite_long (fp, 0); /* list of initial states {0} */ fwrite_long (fp, 1); /* n_final */ fwrite_long (fp, (S2_N_STATE-1)); /* list of final states {S2_N_STATE-1} */ n_arc = 14; fwrite_long (fp, n_arc); /* number of arcs */ /* * Dump these in the same order as s2 did. */ write_transition (0, 0, LOG(tmat[0][0]), 0, fp); write_transition (0, 1, LOG(tmat[0][1]), 0, fp); write_transition (1, 1, LOG(tmat[1][1]), 1, fp); write_transition (1, 2, LOG(tmat[1][2]), 1, fp); write_transition (2, 2, LOG(tmat[2][2]), 2, fp); write_transition (2, 3, LOG(tmat[2][3]), 2, fp); write_transition (3, 3, LOG(tmat[3][3]), 3, fp); write_transition (3, 4, LOG(tmat[3][4]), 3, fp); write_transition (4, 4, LOG(tmat[4][4]), 4, fp); write_transition (4, 5, LOG(tmat[4][5]), 4, fp); write_transition (0, 2, LOG(tmat[0][2]), 0, fp); write_transition (1, 3, LOG(tmat[1][3]), 1, fp); write_transition (2, 4, LOG(tmat[2][4]), 2, fp); write_transition (3, 5, LOG(tmat[3][5]), 3, fp); return S3_SUCCESS; }
void write_rules () { struct source_group_node *s; char *filter = ccfilter ? " $(CCFILTER)" : ""; /* * Write dependencies with actions for all source groups. * These are used instead of the transition rules when the * source file and object file are in different directories. * A separate dependency action is generated for each source group * to prevent a "too many lefts" error from make(1). */ if ( src_flags.c ) { s = srcfiles; while (s) { if( s->c_list ) { fprintf(outfp, "$(c_%s):\n", s->sgrp_name); write_why("$(@)"); write_transition(cNameFromObjName, "$(@)"); write_change_dir(); write_dependency_action(cToObjActionFormat, ccdef, filter); } s = s->next; } } if ( src_flags.assm ) { s = srcfiles; while (s) { if( s->assm_list ) { fprintf(outfp, "$(assm_%s):\n", s->sgrp_name); write_why("$(@)"); write_transition(asmNameFromObjName, "$(@)"); write_change_dir(); write_dependency_action(asmToObjActionFormat, 0, 0); } s = s->next; } } if ( src_flags.spec ) { s = srcfiles; while (s) { if( s->spec_list ) { fprintf(outfp, "$(spec_%s):\n", s->sgrp_name); write_why("$(@)"); write_change_dir(); write_opp_dependency_action(SNameFromObjName, filter); } s = s->next; } } if ( src_flags.imp ) { s = srcfiles; while (s) { if( s->imp_list ) { fprintf(outfp, "$(imp_%s):\n", s->sgrp_name); write_why("$(@)"); write_change_dir(); write_opp_dependency_action(INameFromObjName, filter); } s = s->next; } } if ( src_flags.C ) { s = srcfiles; while (s) { if( s->C_list ) { fprintf(outfp, "$(C_%s):\n", s->sgrp_name); write_why("$(@)"); write_transition(CNameFromObjName, OmcppOutFileName); write_change_dir(); #if defined(CLIX) || defined(SUNOS) || defined(IRIX) fprintf(outfp, "\t if [ -n \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t%s $(SRC)/$(@:.o=.C) $(@F:.o=.c)\"; \\\n", omcppdef); fprintf(outfp, "\t fi; \\\n"); fprintf(outfp, "\t %s \\\n\t\t$(SRC)/$(@:.o=.C) $(@F:.o=.c); \\\n", omcppdef); fprintf(outfp, "\t if [ \"$(FAST)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t if [ -f $(@) ]; then rm $(@); fi; \\\n"); fprintf(outfp, "\t if [ -z \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t$(@:.o=.c) -> cc.list\\c\"; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t echo \"\\techo \\\"$(@:.o=.c)\\\" >>cc.list\"; \\\n"); fprintf(outfp, "\t fi; \\\n"); fprintf(outfp, "\t echo \"$(@:.o=.c)\" >>cc.list; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t if [ -z \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t$(@:.o=.c) -> $(@)\"; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t echo \"\\t%s -c $(@F:.o=.c)%s\"; \\\n", ccdef, filter); fprintf(outfp, "\t fi; \\\n"); fprintf(outfp, "\t %s -c $(@F:.o=.c)%s; \\\n", ccdef, filter); write_dependency_file_cleanup(OmcppOutExtension); fprintf(outfp, "\t fi\n"); fprintf(outfp, "\t@echo \n\n"); #elif defined(NT) fprintf(outfp, "\t@if not \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t%s $(SRC)\\$(@:.obj=.C) $(@F:.obj=.i)\"\n", omcppdef); fprintf(outfp, "\t@%s \\\n\t\t$(SRC)\\$(@:.obj=.C) $(@F:.obj=.i)\n", omcppdef); fprintf(outfp, "\t@if \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t$(@:.obj=.i) -> $(@)\"\n"); fprintf(outfp, "\t@if not \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t%s -c -Tc $(@F:.obj=.i)%s\"\n", ccdef, filter); fprintf(outfp, "\t@%s -c -Tc $(@F:.obj=.i)%s\n", ccdef, filter); write_dependency_file_cleanup(OmcppOutExtension); fprintf(outfp, "\t@$(ECHO) \n\n"); #else #error Unknown OS #endif } s = s->next; } } /* * These are the inference rules. They are used when source * and object file are in the same directory. */ if ( src_flags.imp ) write_opp_inference_rule(IToObjTransition, filter); if ( src_flags.C ) { #if defined(CLIX) || defined(SUNOS) || defined(IRIX) fprintf(outfp, ".C.o:\n"); write_why("$<"); fprintf(outfp, "\t@if [ -z \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t$< -> $*.c\"; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t echo \"\\t%s $< $*.c\"; \\\n", omcppdef); fprintf(outfp, "\t fi\n"); fprintf(outfp, "\t@%s $< $*.c\n", omcppdef); fprintf(outfp, "\t@if [ \"$(FAST)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t if [ -f $(@) ]; then rm $(@); fi; \\\n"); fprintf(outfp, "\t if [ -z \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t$*.c -> cc.list\\c\"; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t echo \"\\techo \\\"$*.c\\\" >>cc.list\"; \\\n"); fprintf(outfp, "\t fi; \\\n"); fprintf(outfp, "\t echo \"$*.c\" >>cc.list; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t if [ -z \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t$*.c -> $*.o\"; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t echo \"\\t%s -c $*.c%s\"; \\\n", ccdef, filter); fprintf(outfp, "\t fi; \\\n"); fprintf(outfp, "\t %s -c $*.c%s; \\\n", ccdef, filter); write_inference_rule_file_cleanup(OmcppOutExtension); fprintf(outfp, "\t fi\n"); fprintf(outfp, "\t@echo \n\n"); #elif defined(NT) fprintf(outfp, ".C.obj:\n"); write_why("$<"); fprintf(outfp, "\t@if \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t$< -> $*.c\"\n"); fprintf(outfp, "\t@if not \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t%s $< $*.c\"\n", omcppdef); fprintf(outfp, "\t@%s $< $*.c\n", omcppdef); fprintf(outfp, "\t@if \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t$*.c -> $*.o\"\n"); fprintf(outfp, "\t@if not \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t%s -c $*.c%s\"\n", ccdef, filter); fprintf(outfp, "\t@%s -c $*.c%s\n", ccdef, filter); write_inference_rule_file_cleanup(OmcppOutExtension); fprintf(outfp, "\t@$(ECHO) \n\n"); #else #error Unknown OS #endif } if ( src_flags.spec ) write_opp_inference_rule(SToObjTransition, filter); #if defined(CLIX) || defined(SUNOS) || defined(IRIX) fprintf(outfp, ".c.o:\n"); write_why("$<"); fprintf(outfp, "\t@if [ -z \"$(VERBOSE_RULES)\" ]; \\\n"); fprintf(outfp, "\t then \\\n"); fprintf(outfp, "\t echo \"\\t$< -> $*.o\"; \\\n"); fprintf(outfp, "\t else \\\n"); fprintf(outfp, "\t echo \"\\t%s -c $*.c%s\"; \\\n", ccdef, filter); fprintf(outfp, "\t fi\n"); fprintf(outfp, "\t@%s -c $*.c%s\n", ccdef, filter); fprintf(outfp, "\t@echo \n\n"); #elif defined(NT) fprintf(outfp, ".c.obj:\n"); write_why("$<"); fprintf(outfp, "\t@if \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t$< -> $*.obj\"\n"); fprintf(outfp, "\t@if not \"$(VERBOSE_RULES)\" == \"\" $(ECHO) \"\\\\t%s -c $*.c%s\"\n", ccdef, filter); fprintf(outfp, "\t@%s -c $*.c%s\n", ccdef, filter); fprintf(outfp, "\t@$(ECHO) \n\n"); #else #error Unknown OS #endif }