Rev 7673 | Rev 8185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7673 | Rev 8155 | ||
---|---|---|---|
Line 91... | Line 91... | ||
91 | // default in itex2MML was 110% : but we thought it was too small... ? |
91 | // default in itex2MML was 110% : but we thought it was too small... ? |
92 | } |
92 | } |
93 | char zoom[2]; |
93 | char zoom[2]; |
94 | snprintf(zoom, 2 ,"%d",use_js_zoom);// int --> char : "0" or "1" |
94 | snprintf(zoom, 2 ,"%d",use_js_zoom);// int --> char : "0" or "1" |
95 | char *argv[]={"wims_mathml","--use-zoom",zoom,"--tex-size",mathml_tex_size,"--max-mml-size",mml_buffer,"--tex-string",p,NULL}; |
95 | char *argv[]={"wims_mathml","--use-zoom",zoom,"--tex-size",mathml_tex_size,"--max-mml-size",mml_buffer,"--tex-string",p,NULL}; |
96 |
|
96 | /* This is the child process. Close other end first. */ |
97 | close(my_pipe[0]); |
97 | close(my_pipe[0]); |
98 | dup2(my_pipe[1], 1); // send stdout to the pipe |
98 | dup2(my_pipe[1], 1); // send stdout to the pipe |
99 | dup2(my_pipe[1], 2); // send stderr to the pipe |
99 | dup2(my_pipe[1], 2); // send stderr to the pipe |
100 | close(my_pipe[1]); |
100 | close(my_pipe[1]); |
101 | execv("../bin/wims_mathml",argv); |
101 | execv("../bin/wims_mathml",argv); |
Line 119... | Line 119... | ||
119 | close(my_pipe[1]); // close the write end of the pipe in the parent |
119 | close(my_pipe[1]); // close the write end of the pipe in the parent |
120 | stream = fdopen (my_pipe[0], "r"); |
120 | stream = fdopen (my_pipe[0], "r"); |
121 | char buffer[MAX_LINELEN+1]; |
121 | char buffer[MAX_LINELEN+1]; |
122 | // make buffer filled with 'zero/null' |
122 | // make buffer filled with 'zero/null' |
123 | memset(buffer,'\0',MAX_LINELEN);//bzero(buffer,maxsize); |
123 | memset(buffer,'\0',MAX_LINELEN);//bzero(buffer,maxsize); |
124 |
|
124 | /* read output from program line by line */ |
125 | if (option == 1) { |
125 | if (option == 1) { |
126 | *p=0; |
126 | *p=0; |
127 | while ( fgets(buffer, MAX_LINELEN, stream) != NULL ){ |
127 | while ( fgets(buffer, MAX_LINELEN, stream) != NULL ){ |
128 | if(strcmp(buffer,"ERROR") != 0){ |
128 | if(strcmp(buffer,"ERROR") != 0){ |
129 | mystrncpy(p, buffer, MAX_LINELEN-1); |
129 | mystrncpy(p, buffer, MAX_LINELEN-1); |
130 | } |
130 | } |
131 | else |
131 | else /* ERROR close stream; close pipe; wait for clean exit */ |
132 | { |
132 | { |
133 | fclose (stream); |
133 | fclose (stream); /* do not know if this is really needed... but it won't hurt ? */ |
134 | close(my_pipe[0]); |
134 | close(my_pipe[0]); |
135 | waitpid(pid, &status, 0); |
135 | waitpid(pid, &status, 0); |
136 | mathalign_base=1; |
136 | mathalign_base=1; /* go to insmath with gifs */ |
137 | return 0; |
137 | return 0; |
138 | } |
138 | } |
139 | } |
139 | } |
140 | } |
140 | } |
141 | else |
141 | else /* this will probably not used ? remove it ? */ |
142 | { |
142 | { |
143 | while ( fgets(buffer, MAX_LINELEN, stream) != NULL ){ |
143 | while ( fgets(buffer, MAX_LINELEN, stream) != NULL ){ |
144 | if(strcmp(buffer,"ERROR") != 0){ |
144 | if(strcmp(buffer,"ERROR") != 0){ |
145 | output("%s", buffer); |
145 | output("%s", buffer); |
146 | } |
146 | } |