PIPS
dotting.c
Go to the documentation of this file.
1 /*
2 
3  $Id: dotting.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27  /* Sorry to keep you waiting...
28  *
29  * Emit a message and then a waiting character every second till it is
30  * notified to shut up.
31  *
32  * Francois Irigoin, 18 April 1990
33  *
34  * Modification:
35  * - installed in Lib/misc/dotting.c, 21 April 1990
36  * - no more dotting: in wpips, the window io associated to each
37  * dotting requires a malloc(); as it may occur at any time, malloc()
38  * (or free()) may be already active and wpips core dumps;
39  * (Francois Irigoin, Bruno Baron, ?? ???? 1990)
40  */
41 
42 #include <stdlib.h>
43 #include <stdio.h>
44 #include <stdarg.h>
45 #include <signal.h>
46 
47 #include "genC.h"
48 
49 #include "misc.h"
50 
51 /*
52 static FILE * dotting_file;
53 static char dotting_character;
54 */
55 
56 /*
57 static void print_dot()
58 {
59  if (dotting_file == stdout)
60  user_log("%c", dotting_character);
61  else {
62  (void) putc(dotting_character, dotting_file);
63  if(dotting_file!=stderr) fflush(dotting_file);
64  }
65  alarm(1);
66 }
67 */
68 
69 /* start_dotting: the profile should be changed and varargs used so as
70  * to let user emit the initial message as with a fprintf
71  * the dotting character could be a constant (e.g. '.') or be passed
72  * as first argument
73  * start_dotting(dotting_file, dotting_character, format, args)
74  */
75 
76 /*VARARGS3*/
77 void
78 start_dotting(FILE * dotting_file,
79  const char dotting_character,
80  const char * fmt,
81  ...)
82 {
83  pips_debug(9, "dotting with '%c'", dotting_character);
84 
85  va_list args;
86 
87  va_start(args, fmt);
88 
89  if (dotting_file == stdout)
90  (* pips_log_handler)(fmt, &args);
91  else {
92  vfprintf(dotting_file, fmt, args);
93  if(dotting_file!=stderr) fflush(dotting_file);
94  }
95  va_end(args);
96 /*
97  if((int) signal(SIGALRM, print_dot)==-1) {
98  pips_internal_error("signal error");
99  exit(1);
100  }
101  alarm(1);
102  */
103 }
104 
106 {
107 /* alarm(0);
108  (void) signal(SIGALRM, SIG_DFL);
109 
110  Vire le "\n" qui interfère... RK.
111  if (dotting_file == stdout)
112  user_log("\n");
113  else {
114  (void) putc('\n', dotting_file);
115  if(dotting_file!=stderr) fflush(dotting_file);
116  }
117 */
118 }
void stop_dotting()
Definition: dotting.c:105
void start_dotting(FILE *dotting_file, const char dotting_character, const char *fmt,...)
Sorry to keep you waiting...
Definition: dotting.c:78
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145