#include <varargs.h>#include <stdio.h>#include "../../gui/src/c/xsci/x_charproc.h"#include "machine.h"#include "stack-c.h"#include "sciprint.h"#include "MALLOC.h"Include dependency graph for sciprint.c:

Go to the source code of this file.
Defines | |
| #define | MAXPRINTF 512 |
| #define | MAXCHARSSCIPRINT_FULL 5000 |
Functions | |
| int getdiary | __PARAMS (()) |
| int C2F() | xscion () |
| void diary_nnl | __PARAMS ((char *str, int *n)) |
| void | sciprint (va_alist) |
| int | sciprint2 (va_alist) |
| void | sciprint_full (va_alist) |
| void | sciprint_l (va_alist) |
| #define MAXCHARSSCIPRINT_FULL 5000 |
| #define MAXPRINTF 512 |
Definition at line 42 of file sciprint.c.
Referenced by DebugGW(), DebugGW1(), sciprint(), sciprint2(), sciprint_l(), sciprint_nd(), and wininfo().
| int getdiary __PARAMS | ( | () | ) |
| void sciprint | ( | va_alist | ) |
Definition at line 49 of file sciprint.c.
References C2F, count, diary_nnl(), FREE, getdiary(), i, L, lstr, MAXPRINTF, NULL, PutString(), QueryStringError(), TextPutS(), textwin, void(), vsnprintf(), xscion(), and xscisrn().
00051 { 00052 int i; 00053 integer lstr; 00054 va_list ap; 00055 char s_buf[MAXPRINTF]; 00056 int count=0; 00057 #if defined(__STDC__) || defined(_MSC_VER) 00058 va_start(ap,fmt); 00059 #else 00060 char *fmt; 00061 va_start(ap); 00062 fmt = va_arg(ap, char *); 00063 #endif 00064 00065 #if defined(linux) || defined(_MSC_VER) 00066 // count = vsnprintf (s_buf,MAXPRINTF-1, fmt, ap ); 00067 { 00068 #ifdef _MSC_VER 00069 char *LocalizedString=QueryStringError(fmt); 00070 if (LocalizedString) 00071 { 00072 count= vsnprintf(s_buf,MAXPRINTF-1, LocalizedString, ap ); 00073 if (LocalizedString) {FREE(LocalizedString);LocalizedString=NULL;} 00074 } 00075 else 00076 { 00077 count= vsnprintf(s_buf,MAXPRINTF-1, fmt, ap ); 00078 } 00079 #else 00080 count= vsnprintf(s_buf,MAXPRINTF-1, fmt, ap ); 00081 #endif 00082 if (count == -1) 00083 { 00084 s_buf[MAXPRINTF-1]='\0'; 00085 } 00086 } 00087 #else 00088 (void )vsprintf(s_buf, fmt, ap ); 00089 #endif 00090 lstr=strlen(s_buf); 00091 00092 C2F(xscion)(&i); 00093 if (i == 0) 00094 { 00095 printf("%s",s_buf); 00096 } 00097 else 00098 { 00099 #ifdef _MSC_VER 00100 TextPutS (&textwin,s_buf); 00101 PutString(s_buf); 00102 #else 00103 C2F(xscisrn)(s_buf,&lstr,0L); 00104 #endif 00105 00106 } 00107 if (getdiary()) diary_nnl(s_buf,&lstr); 00108 va_end(ap); 00109 }
Here is the call graph for this function:

| int sciprint2 | ( | va_alist | ) |
Definition at line 147 of file sciprint.c.
References C2F, diary_nnl(), getdiary(), L, MAXPRINTF, retval(), vsnprintf(), xscion(), and xscisncr().
00149 { 00150 int i,retval; 00151 integer lstr; 00152 va_list ap; 00153 char s_buf[MAXPRINTF]; 00154 #if defined(__STDC__) 00155 va_start(ap,fmt); 00156 #else 00157 int iv; 00158 char *fmt; 00159 va_start(ap); 00160 iv = va_arg(ap,int); 00161 fmt = va_arg(ap, char *); 00162 #endif 00163 00164 C2F(xscion)(&i); 00165 if (i == 0) 00166 { 00167 retval= vfprintf(stdout, fmt, ap ); 00168 } 00169 else 00170 { 00171 #ifdef LINUX 00172 retval= vsnprintf (s_buf,MAXPRINTF-1, fmt, ap); 00173 if (retval == -1) 00174 { 00175 s_buf[MAXPRINTF-1]='\0'; 00176 } 00177 #else 00178 retval= vsprintf(s_buf, fmt, ap ); 00179 #endif 00180 00181 lstr=strlen(s_buf); 00182 C2F(xscisncr)(s_buf,&lstr,0L); 00183 } 00184 00185 if (getdiary()) 00186 { 00187 #ifdef LINUX 00188 retval= vsnprintf (s_buf,MAXPRINTF-1, fmt, ap); 00189 if (retval == -1) 00190 { 00191 s_buf[MAXPRINTF-1]='\0'; 00192 } 00193 #else 00194 retval= vsprintf(s_buf, fmt, ap ); 00195 #endif 00196 lstr=strlen(s_buf); 00197 diary_nnl(s_buf,&lstr); 00198 } 00199 00200 va_end(ap); 00201 return retval; 00202 00203 }
Here is the call graph for this function:

| void sciprint_full | ( | va_alist | ) |
Definition at line 212 of file sciprint.c.
References C2F, FREE, MALLOC, MAXCHARSSCIPRINT_FULL, NULL, sciprint(), void(), and vsnprintf().
00214 { 00215 integer lstr; 00216 va_list ap; 00217 char *s_buf=NULL; 00218 char *split_s_buf=NULL; 00219 int count=0; 00220 int p_s=0; 00221 static integer colwidth; 00222 00223 s_buf=MALLOC(sizeof(char)*(MAXCHARSSCIPRINT_FULL+1)); 00224 if (s_buf == (char *) 0) 00225 { 00226 sciprint("sciprint_full: No more memory\r\n"); 00227 return; 00228 } 00229 00230 /* number of columns as set by command lines() */ 00231 colwidth = C2F(iop).lct[4]; /* lct[4] in C is lct(5) from fortran */ 00232 /* clamp to a minimum: value is arbitrary */ 00233 if (colwidth < 20) {colwidth=20;} 00234 /* clamp to a maximum: value is selected so that each line fits in a single console line */ 00235 /* this is needed because computation of the lines() value in ON_WND_TEXT_WM_SIZE is not */ 00236 /* consistent with the limit before a carriage return occurs in TextPutStr - this latter */ 00237 /* limit uses lptw->ScreenSize, which is set to x=120,y=80 at init and apparently never */ 00238 /* changed on window resizing */ 00239 if (colwidth > 109) {colwidth=109;} 00240 00241 split_s_buf=MALLOC(sizeof(char)*(colwidth+1)); 00242 if (split_s_buf == (char *) 0) 00243 { 00244 sciprint("sciprint_full: No more memory\r\n"); 00245 return; 00246 } 00247 00248 #if defined(__STDC__) || defined(_MSC_VER) 00249 va_start(ap,fmt); 00250 #else 00251 char *fmt; 00252 va_start(ap); 00253 fmt = va_arg(ap, char *); 00254 #endif 00255 00256 #if defined(linux) || defined(_MSC_VER) 00257 count = vsnprintf (s_buf,MAXCHARSSCIPRINT_FULL-1, fmt, ap ); 00258 if (count == -1) 00259 { 00260 s_buf[MAXCHARSSCIPRINT_FULL-1]='\0'; 00261 } 00262 #else 00263 (void )vsprintf(s_buf, fmt, ap ); 00264 #endif 00265 00266 va_end(ap); 00267 00268 lstr=strlen(s_buf); 00269 00270 if (lstr<colwidth) 00271 { 00272 sciprint(s_buf); 00273 } 00274 else 00275 { 00276 strncpy(split_s_buf,s_buf+p_s,colwidth-1); 00277 split_s_buf[colwidth]='\0'; 00278 p_s=p_s+colwidth-1; 00279 sciprint(split_s_buf); 00280 sciprint("\n"); 00281 while (p_s+colwidth-1<(int)lstr) 00282 { 00283 strncpy(split_s_buf,s_buf+p_s,colwidth-1); 00284 split_s_buf[colwidth]='\0'; 00285 p_s=p_s+colwidth-1; 00286 sciprint(" (cont'd) %s",split_s_buf); 00287 sciprint("\n"); 00288 } 00289 strncpy(split_s_buf,s_buf+p_s,lstr-p_s); 00290 split_s_buf[lstr-p_s]='\0'; 00291 sciprint(" (end) %s",split_s_buf); 00292 } 00293 00294 if (s_buf){FREE(s_buf);s_buf=NULL;} 00295 if (split_s_buf){FREE(split_s_buf);split_s_buf=NULL;} 00296 00297 }
Here is the call graph for this function:

| void sciprint_l | ( | va_alist | ) |
Definition at line 305 of file sciprint.c.
References C2F, diary_nnl(), getdiary(), L, MAXPRINTF, PutString(), TextPutS(), textwin, void(), vsnprintf(), xscion(), and xscisrn().
00307 { 00308 int i; 00309 integer lstr; 00310 va_list ap; 00311 char s_buf[MAXPRINTF]; 00312 int count=0; 00313 #if defined(__STDC__) || defined(_MSC_VER) 00314 va_start(ap,fmt); 00315 #else 00316 char *fmt; 00317 va_start(ap); 00318 fmt = va_arg(ap, char *); 00319 #endif 00320 00321 #if defined(linux) || defined(_MSC_VER) 00322 count = vsnprintf (s_buf,MAXPRINTF-1, fmt, ap ); 00323 if (count == -1) 00324 { 00325 s_buf[MAXPRINTF-1]='\0'; 00326 } 00327 #else 00328 (void )vsprintf(s_buf, fmt, ap ); 00329 #endif 00330 lstr=strlen(s_buf); 00331 00332 C2F(xscion)(&i); 00333 if (i == 0) 00334 { 00335 printf("%s",s_buf); 00336 } 00337 else 00338 { 00339 #ifdef _MSC_VER 00340 TextPutS (&textwin,s_buf); 00341 PutString(s_buf); 00342 #else 00343 C2F(xscisrn)(s_buf,&lstr,0L); 00344 #endif 00345 00346 } 00347 if (getdiary()) diary_nnl(s_buf,&lstr); 00348 va_end(ap); 00349 }
Here is the call graph for this function:

| int C2F() xscion | ( | ) |
1.5.1