Skip to content

Commit 412f7ad

Browse files
julius: only show window when -visualize is passed
Instead of always showing the GUI when compiling with visualization support, add a new flag '-visualize' so we can still run Julius like before (without an actual user interface).
1 parent 6e56a2d commit 412f7ad

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

julius/main.c

+24-3
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,33 @@ static boolean nolog = FALSE;
4141
*
4242
*/
4343

44+
static boolean show_gui = FALSE;
45+
4446
static void
4547
show_visual(Recog *recog, void *dummy)
4648
{
4749
RecogProcess *process = recog->process_list;
48-
visual_show(process->backtrellis);
50+
51+
if (show_gui)
52+
visual_show(process->backtrellis);
4953
}
5054

5155
static void
5256
init_visual2(Recog *recog, void *dummy)
5357
{
5458
JCONF_SEARCH *conf = recog->process_list->config;
55-
visual2_init(conf->pass2.hypo_overflow);
59+
60+
if (show_gui)
61+
visual2_init(conf->pass2.hypo_overflow);
5662
}
5763

5864
static void
5965
pop_visual2(Recog *recog, void *dummy)
6066
{
6167
StackDecode *pass2 = &(recog->process_list->pass2);
62-
visual2_popped(pass2->current, pass2->popctr);
68+
69+
if (show_gui)
70+
visual2_popped(pass2->current, pass2->popctr);
6371
}
6472

6573
static void
@@ -70,6 +78,9 @@ next_word_visual2(Recog *recog, void *dummy)
7078
NODE *prev, *next;
7179
int popctr;
7280

81+
if (!show_gui)
82+
return;
83+
7384
process = recog->process_list;
7485
pass2 = &(process->pass2);
7586
prev = pass2->current;
@@ -82,6 +93,13 @@ next_word_visual2(Recog *recog, void *dummy)
8293
visual2_next_word(prev, next, popctr);
8394
}
8495

96+
static boolean
97+
opt_visualize(Jconf *jconf, char *arg[], int argnum)
98+
{
99+
show_gui = TRUE;
100+
return TRUE;
101+
}
102+
85103
#endif
86104

87105
/**
@@ -154,6 +172,9 @@ main(int argc, char *argv[])
154172
j_add_option("-outfile", 0, 0, "save result in separate .out file", opt_outfile);
155173
j_add_option("-help", 0, 0, "display this help", opt_help);
156174
j_add_option("--help", 0, 0, "display this help", opt_help);
175+
#ifdef VISUALIZE
176+
j_add_option("-visualize", 0, 0, "show a visual interface for the parsed input", opt_visualize);
177+
#endif /*VISUALIZE*/
157178

158179
/* create a configuration variables container */
159180
jconf = j_jconf_new();

0 commit comments

Comments
 (0)