~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/sys/gen/format.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)Output (Tina's printf)
  2  * @(#)Norm is output to Top tool's text subwindow
  3  * @(#)If 2 (or more) text subwindows, then output to most recently CREATED
  4  * @(#)If no text subwindow, then output to shell
  5 **/
  6 #include <tina/sys.h>
  7 
  8 void    default_print(char *msg)
  9 {
 10     (void) printf("%s", msg);
 11 }
 12 
 13 void    default_print_sw(void* text_subwin, char *msg)
 14 {
 15     (void) printf("%s", msg);
 16 }
 17 
 18 static void (*print) () = default_print;
 19 static void (*print_sw) (void*text_subwin, char *msg) = default_print_sw;
 20 
 21 void    format_set_print(void (*func) ( /* ??? */ ))
 22 {
 23     print = func;
 24 }
 25 
 26 void    (*format_get_print(void)) ( /* ??? */ )
 27 {
 28     return (print);
 29 }
 30 #ifdef _PCC
 31 void    *format_get_print_sw (void (*format_sw)
 32                               (void* text_subwin, char *msg))
 33 {
 34     return (void*)print_sw;
 35 }
 36 #elif _MVP
 37 typedef void *(*Fmtpr)(void);
 38 Fmtpr format_get_print_sw (void (*format_sw)
 39                                       (void* text_subwin, char *msg))
 40 
 41 {
 42     return (Fmtpr)print_sw;
 43 }
 44 #else
 45 void    (*format_get_print_sw(void)) (void (*format_sw)
 46                                       (void* text_subwin, char *msg))
 47 {
 48     return (void *)print_sw;
 49 }
 50 
 51 #endif
 52 void    format_set_print_sw(void (*format_sw_func) (void* text_subwin, char *msg))
 53 {
 54     print_sw = format_sw_func;
 55 }
 56 
 57 static void default_flush(void)
 58 {
 59 }
 60 
 61 static void (*flush) () = default_flush;
 62 
 63 void    format_set_flush(void (*func) ( /* ??? */ ))
 64 {
 65     flush = func;
 66 }
 67 
 68 void    (*format_get_flush(void)) ( /* ??? */ )
 69 {
 70     return (flush);
 71 }
 72 
 73 #ifndef ANSIFYING
 74 #ifdef __STRICT_ANSI__
 75 
 76 
 77 void    format(char *fmt,...)
 78 {
 79     va_list ap;
 80     char    string[1024];
 81 
 82     va_start(ap, fmt);
 83     (void) vsprintf(string, fmt, ap);
 84     print(string);
 85     va_end(ap);
 86 }
 87 
 88 void    format_sw(void* text_subwin, char *fmt,...)
 89 {
 90     va_list ap;
 91     char    string[1024];
 92 
 93     va_start(ap, fmt);
 94     (void) vsprintf(string, fmt, ap);
 95     print_sw(text_subwin, string);
 96     va_end(ap);
 97 }
 98 
 99 /* Print message to tw text window so it appears immediately. */
100 void    format_flush(char *fmt,...)
101 {
102     va_list ap;
103     char    string[1024];
104 
105     va_start(ap, fmt);
106     (void) vsprintf(string, fmt, ap);
107     format(string);
108     flush();
109     va_end(ap);
110 }
111 
112 #else
113 
114 void    format(fmt, va_alist)
115 char   *fmt;
116 
117 va_dcl
118 {
119     va_list ap;
120     char    string[1024];
121 
122     va_start(ap);
123     (void) vsprintf(string, fmt, ap);
124     print(string);
125     va_end(ap);
126 }
127 
128 void    format_flush(fmt, va_alist)
129 char   *fmt;
130 
131 va_dcl
132 {
133     va_list ap;
134     char    string[1024];
135 
136     va_start(ap);
137     (void) vsprintf(string, fmt, ap);
138     format(string);
139     flush();
140     va_end(ap);
141 }
142 
143 #endif                          /* __STRICT_ANSI__ */
144 #endif                          /* ANSIFYING */
145 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.