@@ -101,8 +101,7 @@ tst_output_types tst_output_init(tst_output_stream * output, int rank,
101
101
#endif
102
102
103
103
/* Check if stream type uses a file and get the name of this file */
104
- if (type == TST_OUTPUT_TYPE_LOGFILE || type == TST_OUTPUT_TYPE_HTML ||
105
- type == TST_OUTPUT_TYPE_LATEX ) {
104
+ if (type == TST_OUTPUT_TYPE_LOGFILE ) {
106
105
va_start (arglist , type );
107
106
fname = va_arg (arglist , char * );
108
107
sprintf (output -> filename ,"R%d_" , tst_output_global_rank );
@@ -126,28 +125,6 @@ tst_output_types tst_output_init(tst_output_stream * output, int rank,
126
125
return 0 ;
127
126
}
128
127
break ;
129
- case TST_OUTPUT_TYPE_HTML :
130
- output -> streamptr = fopen (output -> filename , "w+" );
131
- if (output -> streamptr == NULL ) {
132
- fprintf (stderr , "Error opening stream: Could not open output file." );
133
- return 0 ;
134
- }
135
- fprintf (output -> streamptr , "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
136
- "<HTML>\n"
137
- "<TITLE>OpenMPI-Test-Suite - Logfile</TITLE>\n"
138
- "</HEAD>\n"
139
- "<BODY>\n" );
140
- break ;
141
- case TST_OUTPUT_TYPE_LATEX :
142
- output -> streamptr = fopen (output -> filename , "w+" );
143
- if (output -> streamptr == NULL ) {
144
- fprintf (stderr , "Error opening stream: Could not open output file." );
145
- return 0 ;
146
- }
147
- fprintf (output -> streamptr , "\\documentclass{article}\n"
148
- "\\title{OpenMPI-Test-Suite - Logfile}\n"
149
- "\\begin{document}\n" );
150
- break ;
151
128
default :
152
129
fprintf (stderr , "Error opening stream: Unknown stream type (%i)." , type );
153
130
return TST_OUTPUT_TYPE_NONE ;
@@ -179,16 +156,6 @@ int tst_output_close(tst_output_stream * output) {
179
156
strcpy (output -> filename ,"" );
180
157
fclose (output -> streamptr );
181
158
break ;
182
- case TST_OUTPUT_TYPE_HTML :
183
- fprintf (output -> streamptr , "</BODY>\n</HTML>\n" );
184
- strcpy (output -> filename ,"" );
185
- fclose (output -> streamptr );
186
- break ;
187
- case TST_OUTPUT_TYPE_LATEX :
188
- fprintf (output -> streamptr , "\\end{document}\n" );
189
- strcpy (output -> filename ,"" );
190
- fclose (output -> streamptr );
191
- break ;
192
159
default :
193
160
break ;
194
161
}
@@ -221,63 +188,8 @@ int tst_output_printf(tst_output_stream * output,
221
188
222
189
if ((output -> isopen == 1 ) && (output -> rank == tst_output_global_rank ) && (error_level <= output -> level )) {
223
190
va_start (arglist , format );
224
- switch (output -> type ) {
225
- case TST_OUTPUT_TYPE_HTML : {
226
- char * msg ;
227
- char * tmpstrptr ;
228
-
229
- msg = malloc (sizeof (char ) * 2048 );
230
- count = vsnprintf (msg , 2047 , format , arglist );
231
- /* Output was truncated */
232
- if (count >= 2047 ) {
233
- free (msg );
234
- return -1 ;
235
- }
236
- tst_output_str_replace ("rank" , "<B>rank</B>$" , msg , & tmpstrptr );
237
- free (msg );
238
- tst_output_str_replace ("Rank" , "<B>Rank</B>" , tmpstrptr , & msg );
239
- free (tmpstrptr );
240
- tst_output_str_replace ("ERROR" , "<B style=\"color:red;\">ERROR</B>" , msg , & tmpstrptr );
241
- free (msg );
242
- tst_output_str_replace ("Error" , "<B style=\"color:red;\">Error</B>" , tmpstrptr , & msg );
243
- free (tmpstrptr );
244
- count = fprintf (output -> streamptr , "<P>\n%s</P>\n" , msg );
245
- fflush (output -> streamptr );
246
- break ;
247
- }
248
- case TST_OUTPUT_TYPE_LATEX : {
249
- char * msg ;
250
- char * tmpstrptr ;
251
-
252
- msg = malloc (sizeof (char ) * 2048 );
253
- count = vsnprintf (msg , 2047 , format , arglist );
254
- /* Output was truncated */
255
- if (count >= 2047 ) {
256
- free (msg );
257
- return -1 ;
258
- }
259
- tst_output_latex_special_chars (msg , & tmpstrptr );
260
- tst_output_str_replace ("<" , "$<$" , tmpstrptr , & msg );
261
- free (tmpstrptr );
262
- tst_output_str_replace (">" , "$>$" , msg , & tmpstrptr );
263
- free (msg );
264
- tst_output_str_replace ("Rank" , "\\textbf{Rank}" , tmpstrptr , & msg );
265
- free (tmpstrptr );
266
- tst_output_str_replace ("ERROR" , "\\textbf{ERROR}" , msg , & tmpstrptr );
267
- free (msg );
268
- tst_output_str_replace ("Error" , "\\textbf{Error}" , tmpstrptr , & msg );
269
- free (tmpstrptr );
270
-
271
- count = fprintf (output -> streamptr , "%s" , msg );
272
- fprintf (output -> streamptr , "\n\n" );
273
- fflush (output -> streamptr );
274
- break ;
275
- }
276
- default :
277
- count = vfprintf (output -> streamptr , format , arglist );
278
- fflush (output -> streamptr );
279
- break ;
280
- }
191
+ count = vfprintf (output -> streamptr , format , arglist );
192
+ fflush (output -> streamptr );
281
193
va_end (arglist );
282
194
}
283
195
else {
@@ -287,112 +199,3 @@ int tst_output_printf(tst_output_stream * output,
287
199
return count ;
288
200
}
289
201
290
- /****************************************************************************/
291
- /** **/
292
- /** LOCAL FUNCTIONS **/
293
- /** **/
294
- /****************************************************************************/
295
-
296
- int tst_output_latex_special_chars (char * string , char * * result ) {
297
- int count = 0 ;
298
- int newlength = 0 ;
299
- char * strptr = NULL ;
300
- char * resultptr ;
301
-
302
- /* calculate number of special chars */
303
- strptr = string ;
304
- while (* strptr != '\0' ){
305
- switch (* strptr ) {
306
- case '\\' :
307
- case '&' :
308
- case '$' :
309
- case '%' :
310
- case '#' :
311
- case '_' :
312
- case '{' :
313
- case '}' :
314
- count ++ ;
315
- break ;
316
- }
317
- strptr ++ ;
318
- }
319
- /* allocate memory for the result */
320
- newlength = strlen (string ) + count ;
321
- resultptr = malloc (sizeof (char ) * (newlength + 1 ));
322
- memset (resultptr , 0 , newlength + 1 );
323
- * result = resultptr ;
324
- /* do special char masking */
325
- strptr = string ;
326
- while (* strptr != '\0' ){
327
- switch (* strptr ) {
328
- case '\\' :
329
- case '&' :
330
- case '$' :
331
- case '%' :
332
- case '#' :
333
- case '_' :
334
- case '{' :
335
- case '}' :
336
- * resultptr = '\\' ;
337
- resultptr ++ ;
338
- * resultptr = * strptr ;
339
- resultptr ++ ;
340
- break ;
341
- default :
342
- * resultptr = * strptr ;
343
- resultptr ++ ;
344
- break ;
345
- }
346
- strptr ++ ;
347
- }
348
- * resultptr = '\0' ;
349
-
350
- return count ;
351
- }
352
-
353
- int tst_output_str_replace (char * search , char * replace , char * string , char * * result ) {
354
- int count = 0 , replace_count = 0 ;
355
- int oldlength = 0 ;
356
- int newlength = 0 ;
357
- int searchlength = 0 ;
358
- int n ;
359
- char * strptr = NULL ;
360
- char * oldstrptr = NULL ;
361
-
362
- oldlength = strlen (string );
363
- searchlength = strlen (search );
364
-
365
- /* Calculate number of replacements to be preformed */
366
- for (strptr = strstr (string , search ); strptr != NULL ; strptr = strstr (++ strptr , search )) {
367
- count ++ ;
368
- }
369
- /* Calculate length of the resulting string and allocate the necessary memory */
370
- newlength = oldlength + count * (strlen (replace ) - strlen (search ));
371
- * result = (char * ) malloc ( (newlength + 1 ) * sizeof (char ) );
372
- memset (* result , 0 , newlength + 1 );
373
-
374
- /* Perform replacements and store result to new string */
375
- for (strptr = string ; ; ) {
376
- oldstrptr = strptr ;
377
- strptr = strstr (strptr , search );
378
- /* all replacements done? */
379
- if (strptr == NULL ) {
380
- strcat (* result , oldstrptr );
381
- break ;
382
- }
383
- /* Append all up to place of discovery */
384
- n = strptr - oldstrptr ;
385
- strncat (* result , oldstrptr , n );
386
- /* Append replace string and move forward in the string */
387
- strcat (* result , replace );
388
- strptr += searchlength ;
389
- replace_count ++ ;
390
- }
391
-
392
- /* Safety check */
393
- if (count != replace_count ) {
394
- fprintf (stderr , "Error: count (%d) != replace_count (%d)!\n" , count , replace_count );
395
- exit (-1 );
396
- }
397
- return count ;
398
- }
0 commit comments