#include "rcs_defs.hh"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include "rcs_prnt.hh"
#include "linklist.hh"
Include dependency graph for rcs_prnt.cc:
Go to the source code of this file.
Defines | |
#define | DEBUG_MALLOC(x) malloc(x) |
#define | DEBUG_FREE(x) free(x) |
Functions | |
double RCS_EXPORT | etime (void) |
void (RCS_PASCAL RCS_FAR *rcs_print_notify)()=NULL | |
void RCS_EXPORT | set_rcs_print_destination (RCS_PRINT_DESTINATION_TYPE _dest) |
RCS_PRINT_DESTINATION_TYPE RCS_EXPORT | get_rcs_print_destination () |
char RCS_FAR **RCS_EXPORT | get_rcs_lines_table () |
RCS_LINKED_LIST RCS_FAR *RCS_EXPORT | get_rcs_print_list () |
int RCS_EXPORT | get_rcs_print_list_size () |
void RCS_EXPORT | set_rcs_print_list_sizing (int _new_max_size, LIST_SIZING_MODE _new_sizing_mode) |
void RCS_EXPORT | set_rcs_print_notify (RCS_PRINT_NOTIFY_FUNC_PTR _rcs_print_notify) |
void RCS_EXPORT | clean_print_list () |
void RCS_EXPORT | output_print_list (int output_func(char RCS_FAR *)) |
int RCS_EXPORT | count_characters_in_print_list () |
int RCS_EXPORT | count_lines_in_print_list () |
void RCS_EXPORT | convert_print_list_to_lines () |
void RCS_EXPORT | update_lines_table () |
char RCS_FAR *RCS_EXPORT | strip_control_characters (char RCS_FAR *_dest, char RCS_FAR *_src) |
int RCS_EXPORT | separate_words (char RCS_FAR **_dest, int _max, char RCS_FAR *_src) |
int RCS_EXPORT | rcs_vprint (char RCS_FAR *_fmt, va_list _args, int save_string) |
int RCS_EXPORT | rcs_puts (char RCS_FAR *_str) |
int RCS_EXPORT | rcs_fputs (char RCS_FAR *_str) |
void RCS_EXPORT | close_rcs_printing () |
int RCS_EXPORT | set_rcs_print_file (char RCS_FAR *_file_name) |
int RCS_EXPORT | rcs_print (char RCS_FAR *_fmt,...) |
int RCS_EXPORT | set_print_rcs_error_info (const char *file, int line) |
int RCS_EXPORT | print_rcs_error_new (char RCS_FAR *_fmt,...) |
int RCS_EXPORT | rcs_print_debug (long flag_to_check, char RCS_FAR *_fmt,...) |
void RCS_EXPORT | set_rcs_print_flag (long flag_to_set) |
void RCS_EXPORT | clear_rcs_print_flag (long flag_to_clear) |
int RCS_EXPORT | rcs_print_sys_error (int error_source, char RCS_FAR *_fmt,...) |
int RCS_EXPORT | rcs_print_error (char RCS_FAR *_fmt,...) |
Variables | |
RCS_LINKED_LIST RCS_FAR * | rcs_print_list = NULL |
char RCS_FAR ** | rcs_lines_table = NULL |
RCS_PRINT_DESTINATION_TYPE | rcs_print_destination = RCS_PRINT_TO_STDOUT |
int | max_rcs_errors_to_print = 30 |
int | rcs_errors_printed = 0 |
long | rcs_print_mode_flags = PRINT_RCS_ERRORS |
FILE * | rcs_print_file_stream = NULL |
char | rcs_print_file_name [80] = "rcs_out.txt" |
char | last_error_bufs [4][100] |
int | error_bufs_initialized = 0 |
int | last_error_buf_filled = 0 |
const char * | rcs_error_filename = NULL |
int | rcs_error_linenum = -1 |
|
Definition at line 6 of file rcs_prnt.cc. |
|
Definition at line 7 of file rcs_prnt.cc. |
|
Definition at line 164 of file _timer.c. 00165 { 00166 #ifdef VXWORKS 00167 #ifdef USE_CLOCK_GETTIME 00168 double retval; 00169 struct timespec ts; 00170 #endif 00171 #ifndef POWERPC 00172 if (etime_disabled) 00173 { 00174 return (etime_disable_time); 00175 } 00176 if (global_timer_available) 00177 { 00178 return (((double) get_Global_time ()) * (1E-6)); 00179 } 00180 #endif 00181 00182 #ifdef USE_CLOCK_GETTIME 00183 if (etime_disabled) 00184 { 00185 return (etime_disable_time); 00186 } 00187 if (clock_gettime (CLOCK_REALTIME, &ts)) 00188 { 00189 /* rcs_print_error("clock_gettime: errno = %d %s\n", errno, strerror(errno)); */ 00190 } 00191 retval = ((double) ts.tv_sec) + ((double) ts.tv_nsec) * 1e-9; 00192 return retval; 00193 #else 00194 if (etime_disabled) 00195 { 00196 return (etime_disable_time); 00197 } 00198 return ((double) tickGet ()) / ((double) sysClkRateGet ()); 00199 #endif 00200 #define ETIME_RETURNED 00201 #endif 00202 00203 #if defined (sunos4) || defined (LYNX) || defined(irix5) || defined(sparcworks_sun4) 00204 double retval = 0.0; 00205 static double last_retval = 0.0; 00206 static struct timeval last_tp; 00207 00208 struct timeval tp; 00209 if (etime_disabled) 00210 { 00211 return (etime_disable_time); 00212 } 00213 if (gettimeofday (&tp, NULL) == -1) 00214 { 00215 rcs_print_error ("gettimeofday failed: (errno = %d) %s\n", errno, 00216 strerror (errno)); 00217 return 0.0; 00218 } 00219 retval = ((double) tp.tv_sec) + (((double) tp.tv_usec) / 1000000.0); 00220 return (retval); 00221 #define ETIME_RETURNED 00222 #endif 00223 00224 #if defined(sunos5) || (defined(os5) && defined(sparc)) || defined(irix6) || defined(irix64) 00225 double retval; 00226 struct timespec ts; 00227 00228 if (etime_disabled) 00229 { 00230 return (etime_disable_time); 00231 } 00232 if (clock_gettime (CLOCK_REALTIME, &ts)) 00233 { 00234 rcs_print_error ("clock_gettime: errno = %d %s\n", errno, 00235 strerror (errno)); 00236 } 00237 retval = ((double) ts.tv_sec) + ((double) ts.tv_nsec) * 1e-9; 00238 return retval; 00239 #define ETIME_RETURNED 00240 #endif 00241 00242 #if defined(LINUX) || defined(darwin) || defined(qnx) 00243 00244 struct timeval tp; 00245 double retval; 00246 #if 0 00247 static double last_retval = 0.0; 00248 #endif 00249 00250 if (0 != gettimeofday (&tp, NULL)) 00251 { 00252 rcs_print_error ("etime: can't get time\n"); 00253 return 0.0; 00254 } 00255 00256 retval = ((double) tp.tv_sec) + ((double) tp.tv_usec) / 1000000.0; 00257 #if 0 00258 if (retval < last_retval) 00259 { 00260 rcs_print_error ("etime: negative time interval\n"); 00261 return 0.0; 00262 } 00263 last_retval = retval; 00264 #endif 00265 return retval; 00266 00267 #define ETIME_RETURNED 00268 #endif /* LINUX */ 00269 00270 #ifdef _Windows 00271 #ifdef USE_TOOL_HELP 00272 /* The TimerCount function is more accurate than the GetTickCount() function 00273 but you need toolhelp.dll which comes with Windows 3.1 but not Windows 3.0 or 00274 Windows NT */ 00275 TIMERINFO timer_info; 00276 if (etime_disabled) 00277 { 00278 return (etime_disable_time); 00279 } 00280 if (TimerCount (&timer_info)) 00281 { 00282 return ((double) timer_info.dwmsSinceStart / 1000.0); 00283 } 00284 else 00285 { 00286 rcs_print_error ("etime: TimerCount returned false.\n"); 00287 return (0); 00288 } 00289 #define ETIME_RETURNED 00290 #else /* defined(_Windows) && defined(USE_TOOL_HELP) */ 00291 #if defined(WIN32) && !defined(UNDER_CE) 00292 BOOL frequency_ok = 0; 00293 BOOL counter_ok = 0; 00294 LARGE_INTEGER frequency; 00295 LARGE_INTEGER counter; 00296 double dfreq; 00297 double dcount; 00298 #define TWO_TO_THIRTYTWO (4294967296.00) 00299 #endif 00300 00301 if (etime_disabled) 00302 { 00303 return (etime_disable_time); 00304 } 00305 #if defined(WIN32) && !defined(UNDER_CE) 00306 frequency_ok = QueryPerformanceFrequency (&frequency); 00307 counter_ok = QueryPerformanceCounter (&counter); 00308 if (frequency_ok && counter_ok) 00309 { 00310 dfreq = frequency.HighPart * TWO_TO_THIRTYTWO + frequency.LowPart; 00311 dcount = counter.HighPart * TWO_TO_THIRTYTWO + counter.LowPart; 00312 if (dfreq > 0.0 && dcount > 0.0) 00313 { 00314 return (dcount / dfreq); 00315 } 00316 } 00317 #endif 00318 return ((double) GetTickCount () / 1000.0); 00319 #define ETIME_RETURNED 00320 #endif /* defined(_Windows) && defined(USE_TOOL_HELP) */ 00321 #endif 00322 00323 #if defined(__MSDOS__) && !defined(_Windows) 00324 #ifndef CLOCKS_PER_SECOND 00325 #define CLOCKS_PER_SECOND CLK_TCK 00326 #endif 00327 if (etime_disabled) 00328 { 00329 return (etime_disable_time); 00330 } 00331 return clock () / CLOCKS_PER_SECOND; 00332 #define ETIME_RETURNED 00333 00334 #endif /* __MSDOS__ */ 00335 00336 #ifndef ETIME_RETURNED 00337 #error NO definition for etime for this platform 00338 #endif 00339 } |
|
|
|
Definition at line 109 of file rcs_prnt.cc. 00110 { 00111 if (rcs_print_destination == RCS_PRINT_TO_NULL) 00112 { 00113 rcs_errors_printed = 0; 00114 } 00115 rcs_print_destination = _dest; 00116 } |
|
Definition at line 119 of file rcs_prnt.cc. Referenced by nmlWaitOpen().
00120 { 00121 return (rcs_print_destination); 00122 } |
|
Definition at line 129 of file rcs_prnt.cc. Referenced by main().
00131 { 00132 return (rcs_lines_table); 00133 } |
|
Definition at line 140 of file rcs_prnt.cc. Referenced by main().
00142 { 00143 return (rcs_print_list); 00144 } |
|
Definition at line 147 of file rcs_prnt.cc. 00148 { 00149 if (NULL != rcs_print_list) 00150 { 00151 return (rcs_print_list->list_size); 00152 } 00153 else 00154 { 00155 return (-1); 00156 } 00157 } |
|
Definition at line 159 of file rcs_prnt.cc. 00161 { 00162 if (NULL == rcs_print_list) 00163 { 00164 rcs_print_list = new RCS_LINKED_LIST; 00165 } 00166 if (NULL != rcs_print_list) 00167 { 00168 rcs_print_list->set_list_sizing_mode (_new_max_size, _new_sizing_mode); 00169 } 00170 } |
|
Definition at line 172 of file rcs_prnt.cc. 00173 { 00174 rcs_print_notify = _rcs_print_notify; 00175 } |
|
Definition at line 178 of file rcs_prnt.cc. Referenced by close_rcs_printing().
00179 { 00180 if (NULL != rcs_print_list) 00181 { 00182 delete rcs_print_list; 00183 rcs_print_list = NULL; 00184 } 00185 } |
|
Definition at line 188 of file rcs_prnt.cc. 00189 { 00190 if (NULL != rcs_print_list) 00191 { 00192 char *string_from_list; 00193 string_from_list = (char *) rcs_print_list->get_head (); 00194 while (NULL != string_from_list) 00195 { 00196 if (output_func (string_from_list) != EOF) 00197 { 00198 break; 00199 } 00200 string_from_list = (char *) rcs_print_list->get_next (); 00201 } 00202 } 00203 } |
|
Definition at line 206 of file rcs_prnt.cc. 00207 { 00208 int count = 0; 00209 if (NULL != rcs_print_list) 00210 { 00211 char *string_from_list; 00212 string_from_list = (char *) rcs_print_list->get_head (); 00213 while (NULL != string_from_list) 00214 { 00215 count += strlen (string_from_list); 00216 string_from_list = (char *) rcs_print_list->get_next (); 00217 } 00218 } 00219 return (count); 00220 } |
|
Definition at line 223 of file rcs_prnt.cc. 00224 { 00225 int count = 1; 00226 if (NULL != rcs_print_list) 00227 { 00228 char *string_from_list; 00229 string_from_list = (char *) rcs_print_list->get_head (); 00230 while (NULL != string_from_list) 00231 { 00232 char *line; 00233 line = strchr (string_from_list, '\n'); 00234 while (NULL != line) 00235 { 00236 count++; 00237 line = strchr (line + 1, '\n'); 00238 } 00239 string_from_list = (char *) rcs_print_list->get_next (); 00240 } 00241 } 00242 return (count); 00243 } |
|
Definition at line 246 of file rcs_prnt.cc. Referenced by update_lines_table().
00247 { 00248 char *temp_buf = NULL; 00249 static int last_id_converted = -1; 00250 if (NULL != rcs_print_list) 00251 { 00252 char *string_from_list; 00253 if (-1 == last_id_converted) 00254 { 00255 string_from_list = (char *) rcs_print_list->get_head (); 00256 } 00257 else 00258 { 00259 string_from_list = 00260 (char *) rcs_print_list->get_first_newer (last_id_converted); 00261 } 00262 while (NULL != string_from_list) 00263 { 00264 char *next_line; 00265 next_line = strchr (string_from_list, '\n'); 00266 if (NULL == next_line) 00267 { 00268 if (NULL == temp_buf) 00269 { 00270 temp_buf = (char *) malloc (strlen (string_from_list) + 1); 00271 strcpy (temp_buf, string_from_list); 00272 } 00273 else 00274 { 00275 temp_buf = (char *) realloc (temp_buf, 00276 strlen (temp_buf) 00277 + strlen (string_from_list) + 00278 1); 00279 strcat (temp_buf, string_from_list); 00280 } 00281 rcs_print_list->delete_current_node (); 00282 } 00283 else 00284 { 00285 if (temp_buf != NULL) 00286 { 00287 temp_buf = (char *) realloc (temp_buf, 00288 strlen (temp_buf) 00289 + strlen (string_from_list) + 00290 1); 00291 strcat (temp_buf, string_from_list); 00292 rcs_print_list->delete_current_node (); 00293 rcs_print_list->store_after_current_node (temp_buf, 00294 strlen (temp_buf) 00295 + 1, 1); 00296 DEBUG_FREE (temp_buf); 00297 temp_buf = NULL; 00298 } 00299 else if (next_line[1] != 0) 00300 { 00301 rcs_print_list->store_after_current_node (next_line + 1, 00302 strlen (next_line 00303 + 1) + 1, 00304 1); 00305 next_line[1] = 0; 00306 } 00307 } 00308 string_from_list = (char *) rcs_print_list->get_next (); 00309 } 00310 } 00311 last_id_converted = rcs_print_list->get_newest_id (); 00312 if (temp_buf != NULL) 00313 { 00314 rcs_print_list->store_at_tail (temp_buf, strlen (temp_buf) + 1, 1); 00315 DEBUG_FREE (temp_buf); 00316 temp_buf = NULL; 00317 } 00318 } |
|
Definition at line 321 of file rcs_prnt.cc. Referenced by main().
00322 { 00323 if (NULL != rcs_lines_table) 00324 { 00325 DEBUG_FREE (rcs_lines_table); 00326 rcs_lines_table = NULL; 00327 } 00328 if (NULL != rcs_print_list) 00329 { 00330 convert_print_list_to_lines (); 00331 rcs_lines_table = (char RCS_FAR **) malloc (sizeof (char *) 00332 * 00333 rcs_print_list->list_size); 00334 if (NULL != rcs_print_list) 00335 { 00336 char *string_from_list; 00337 string_from_list = (char *) rcs_print_list->get_head (); 00338 int i = 0; 00339 while (NULL != string_from_list) 00340 { 00341 rcs_lines_table[i] = string_from_list; 00342 i++; 00343 string_from_list = (char *) rcs_print_list->get_next (); 00344 } 00345 } 00346 } 00347 } |
|
Definition at line 354 of file rcs_prnt.cc. 00356 { 00357 static char line_buffer[255]; 00358 char *destination; 00359 #ifndef UNDER_CE 00360 char *control_char_loc; 00361 if (NULL == _dest) 00362 { 00363 destination = line_buffer; 00364 if (strlen (_src) < 255) 00365 { 00366 strcpy (line_buffer, _src); 00367 } 00368 else 00369 { 00370 if (NULL == strpbrk (_src, "\n\r\t\b")) 00371 { 00372 return (_src); 00373 } 00374 else 00375 { 00376 return (NULL); 00377 } 00378 } 00379 } 00380 else 00381 { 00382 destination = _dest; 00383 if (_dest != _src) 00384 { 00385 #ifndef __CENTERLINE__ /* CenterLine messed up string.h for C++ so that memmove will be undefined. */ 00386 memmove (_dest, _src, strlen (_src)); 00387 #else 00388 strcpy (line_buffer, _src); 00389 strcpy (_dest, line_buffer); 00390 #endif 00391 } 00392 } 00393 control_char_loc = strpbrk (destination, "\n\r\t\b"); 00394 while (NULL != control_char_loc) 00395 { 00396 *control_char_loc = ' '; /* Replace control character with SPACE */ 00397 control_char_loc = strpbrk (control_char_loc, "\n\r\t\b"); 00398 } 00399 #else 00400 if (NULL == _dest) 00401 { 00402 destination = line_buffer; 00403 } 00404 else 00405 { 00406 destination = _dest; 00407 } 00408 strcpy (destination, _src); 00409 #endif 00410 return (destination); 00411 00412 } |
|
Definition at line 420 of file rcs_prnt.cc. 00421 { 00422 static char word_buffer[256]; 00423 int i; 00424 if (NULL == _dest || NULL == _src) 00425 { 00426 return -1; 00427 } 00428 if (strlen (_src) > 255) 00429 { 00430 return -1; 00431 } 00432 strcpy (word_buffer, _src); 00433 _dest[0] = strtok (word_buffer, " \n\r\t"); 00434 for (i = 0; NULL != _dest[i] && i < _max - 1; i++) 00435 { 00436 _dest[i + 1] = strtok (NULL, " \n\r\t"); 00437 } 00438 if (_dest[_max - 1] == NULL && i == _max - 1) 00439 { 00440 i--; 00441 } 00442 return (i + 1); 00443 } |
|
Definition at line 446 of file rcs_prnt.cc. 00447 { 00448 static char temp_string[256]; 00449 00450 if (NULL == _fmt) 00451 { 00452 return (EOF); 00453 } 00454 if (strlen (_fmt) > 200) /* Might overflow temp_string. */ 00455 { 00456 return (EOF); 00457 } 00458 #ifndef UNDER_CE 00459 if (EOF == (int) vsprintf (temp_string, _fmt, _args)) 00460 { 00461 return (EOF); 00462 } 00463 #else 00464 if (EOF == (int) RCS_CE_VSPRINTF (temp_string, _fmt, _args)) 00465 { 00466 return (EOF); 00467 } 00468 #endif 00469 if (save_string) 00470 { 00471 if (!error_bufs_initialized) 00472 { 00473 memset (last_error_bufs[0], 0, 100); 00474 memset (last_error_bufs[1], 0, 100); 00475 memset (last_error_bufs[2], 0, 100); 00476 memset (last_error_bufs[3], 0, 100); 00477 error_bufs_initialized = 1; 00478 } 00479 last_error_buf_filled++; 00480 last_error_buf_filled %= 4; 00481 strncpy (last_error_bufs[last_error_buf_filled], temp_string, 99); 00482 } 00483 return (rcs_fputs (temp_string)); 00484 } |
|
Definition at line 487 of file rcs_prnt.cc. |
|
Definition at line 507 of file rcs_prnt.cc. 00508 { 00509 int retval = EOF; 00510 if (NULL != _str) 00511 { 00512 if (0 == _str[0]) 00513 { 00514 return (0); 00515 } 00516 switch (rcs_print_destination) 00517 { 00518 #ifdef VXWORKS 00519 case RCS_PRINT_TO_LOGGER: 00520 retval = logMsg (_str, 0, 0, 0, 0, 0, 0); 00521 break; 00522 #else 00523 case RCS_PRINT_TO_LOGGER: 00524 #endif 00525 00526 case RCS_PRINT_TO_STDOUT: 00527 #ifndef _WINDLL 00528 #ifdef UNDER_CE 00529 #ifdef UNICODE 00530 wchar_t wstr[256]; 00531 RCS_CE_ASCII_TO_UNICODE (wstr, _str, 256); 00532 OutputDebugString (wstr); 00533 #else 00534 OutputDebugString (_str); 00535 #endif 00536 #else 00537 #ifdef WIN32 00538 if (!AllocConsoleCalled) 00539 { 00540 AllocConsoleRetVal = AllocConsole (); 00541 AllocConsoleCalled = TRUE; 00542 } 00543 OutputHandle = GetStdHandle (STD_OUTPUT_HANDLE); 00544 if (NULL == OutputHandle) 00545 { 00546 retval = fputs (_str, stdout); 00547 fflush (stdout); 00548 } 00549 else 00550 { 00551 DWORD bytes_written; 00552 WriteConsole (OutputHandle, _str, strlen (_str), 00553 (LPDWORD) & bytes_written, NULL); 00554 retval = (int) bytes_written; 00555 } 00556 #else 00557 retval = fputs (_str, stdout); 00558 fflush (stdout); 00559 #endif 00560 #endif 00561 #endif 00562 break; 00563 00564 case RCS_PRINT_TO_STDERR: 00565 #ifndef UNDER_CE 00566 retval = fputs (_str, stderr); 00567 fflush (stderr); 00568 #endif 00569 break; 00570 00571 case RCS_PRINT_TO_LIST: 00572 if (NULL == rcs_print_list) 00573 { 00574 rcs_print_list = new RCS_LINKED_LIST; 00575 if (NULL != rcs_print_list) 00576 { 00577 rcs_print_list->set_list_sizing_mode (256, 00578 DELETE_FROM_HEAD); 00579 } 00580 } 00581 if (NULL != rcs_print_list) 00582 { 00583 if (-1 == 00584 rcs_print_list->store_at_tail (_str, 00585 (retval = 00586 strlen (_str)) + 1, 1)) 00587 { 00588 retval = EOF; 00589 } 00590 } 00591 break; 00592 case RCS_PRINT_TO_NULL: 00593 retval = strlen (_str); 00594 break; 00595 case RCS_PRINT_TO_FILE: 00596 #ifndef UNDER_CE 00597 if (NULL == rcs_print_file_stream) 00598 { 00599 if (NULL == rcs_print_file_name) 00600 { 00601 return EOF; 00602 } 00603 rcs_print_file_stream = fopen (rcs_print_file_name, "a+"); 00604 } 00605 if (NULL == rcs_print_file_stream) 00606 { 00607 return EOF; 00608 } 00609 retval = fputs (_str, rcs_print_file_stream); 00610 fflush (rcs_print_file_stream); 00611 #endif 00612 break; 00613 00614 #if defined(_Windows) && !defined(gnuwin32) 00615 case RCS_PRINT_TO_MESSAGE_BOX: 00616 #ifdef UNICODE 00617 wchar_t wstr2[256]; 00618 RCS_CE_ASCII_TO_UNICODE (wstr2, _str, 256); 00619 retval = strlen (_str); 00620 if (IDOK != MessageBox (NULL, wstr2, TEXT ("RCS Message"), MB_OK)) 00621 { 00622 retval = EOF; 00623 } 00624 #else 00625 retval = strlen (_str); 00626 if (IDOK != MessageBox (NULL, _str, "RCS Message", MB_OK)) 00627 { 00628 retval = EOF; 00629 } 00630 #endif 00631 break; 00632 #endif 00633 00634 default: 00635 break; 00636 } 00637 if (NULL != rcs_print_notify) 00638 { 00639 (*rcs_print_notify) (); 00640 } 00641 } 00642 return (retval); 00643 } |
|
Definition at line 646 of file rcs_prnt.cc. 00647 { 00648 #ifndef UNDER_CE 00649 switch (rcs_print_destination) 00650 { 00651 case RCS_PRINT_TO_LIST: 00652 clean_print_list (); 00653 break; 00654 00655 case RCS_PRINT_TO_FILE: 00656 if (NULL != rcs_print_file_stream) 00657 { 00658 fclose (rcs_print_file_stream); 00659 rcs_print_file_stream = NULL; 00660 } 00661 break; 00662 default: 00663 break; 00664 } 00665 #endif 00666 return; 00667 } |
|
Definition at line 670 of file rcs_prnt.cc. 00671 { 00672 #ifndef UNDER_CE 00673 if (_file_name == NULL) 00674 { 00675 return -1; 00676 } 00677 if (strlen (_file_name) > 80) 00678 { 00679 return -1; 00680 } 00681 strcpy (rcs_print_file_name, _file_name); 00682 if (NULL != rcs_print_file_stream) 00683 { 00684 fclose (rcs_print_file_stream); 00685 } 00686 rcs_print_file_stream = fopen (rcs_print_file_name, "a+"); 00687 if (NULL == rcs_print_file_stream) 00688 { 00689 return -1; 00690 } 00691 #endif 00692 return 0; 00693 } |
|
Definition at line 696 of file rcs_prnt.cc. 00697 { 00698 static char temp_buffer[256]; 00699 int retval; 00700 va_list args; 00701 if (strlen (_fmt) > 250) 00702 { 00703 return EOF; 00704 } 00705 va_start (args, _fmt); 00706 #ifdef sparcworks_sun4 // this platform has vsprintf defined as 00707 // char *vsprintf(char *, const char *, va_list); 00708 // it should be 00709 // int vsprintf(char *, const char *, va_list); 00710 vsprintf (temp_buffer, _fmt, args); 00711 va_end (args); 00712 #else 00713 #ifndef UNDER_CE 00714 retval = vsprintf (temp_buffer, _fmt, args); 00715 #else 00716 retval = RCS_CE_VSPRINTF (temp_buffer, _fmt, args); 00717 #endif 00718 va_end (args); 00719 if (retval == (EOF)) 00720 { 00721 return EOF; 00722 } 00723 #endif 00724 retval = rcs_fputs (temp_buffer); 00725 return (retval); 00726 } |
|
Definition at line 733 of file rcs_prnt.cc. 00734 { 00735 rcs_error_filename = file; 00736 rcs_error_linenum = line; 00737 return (0); 00738 } |
|
Definition at line 742 of file rcs_prnt.cc. 00743 { 00744 int retval = 0; 00745 va_list args; 00746 va_start (args, _fmt); 00747 if ((rcs_print_mode_flags & PRINT_RCS_ERRORS) 00748 && ((max_rcs_errors_to_print >= rcs_errors_printed) 00749 || max_rcs_errors_to_print < 0)) 00750 { 00751 if (NULL != rcs_error_filename && rcs_error_linenum > 0) 00752 { 00753 rcs_print ("%s %d: ", rcs_error_filename, rcs_error_linenum); 00754 rcs_error_filename = NULL; 00755 rcs_error_linenum = -1; 00756 } 00757 retval = rcs_vprint (_fmt, args, 1); 00758 if (max_rcs_errors_to_print == rcs_errors_printed && 00759 max_rcs_errors_to_print >= 0) 00760 { 00761 rcs_print ("\nMaximum number of errors to print exceeded!\n"); 00762 } 00763 } 00764 if (rcs_print_destination != RCS_PRINT_TO_NULL) 00765 { 00766 rcs_errors_printed++; 00767 } 00768 va_end (args); 00769 return (retval); 00770 } |
|
Definition at line 776 of file rcs_prnt.cc. 00777 { 00778 int retval = 0; 00779 int pid = 0; 00780 va_list args; 00781 va_start (args, _fmt); 00782 00783 if (flag_to_check & rcs_print_mode_flags) 00784 { 00785 #ifdef WIN32 00786 pid = GetCurrentProcessId (); 00787 #else 00788 #ifndef VXWORKS 00789 pid = getpid (); 00790 #else 00791 pid = taskIdSelf (); 00792 #endif 00793 #endif 00794 rcs_print ("(time=%f,pid=%d): ", etime (), pid); 00795 retval = rcs_vprint (_fmt, args, 0); 00796 } 00797 va_end (args); 00798 return (retval); 00799 } |
|
Definition at line 802 of file rcs_prnt.cc. 00803 { 00804 rcs_print_mode_flags |= flag_to_set; 00805 } |
|
Definition at line 808 of file rcs_prnt.cc. 00809 { 00810 rcs_print_mode_flags &= ~(flag_to_clear); 00811 } |
|
Definition at line 816 of file rcs_prnt.cc. 00817 { 00818 static char temp_string[256]; 00819 static char message_string[512]; 00820 va_list args; 00821 va_start (args, _fmt); 00822 00823 00824 if (NULL == _fmt) 00825 { 00826 return (EOF); 00827 } 00828 if (strlen (_fmt) > 200) /* Might overflow temp_string. */ 00829 { 00830 return (EOF); 00831 } 00832 #ifndef UNDER_CE 00833 if (EOF == (int) vsprintf (temp_string, _fmt, args)) 00834 { 00835 return (EOF); 00836 } 00837 #else 00838 if (EOF == (int) RCS_CE_VSPRINTF (temp_string, _fmt, args)) 00839 { 00840 return (EOF); 00841 } 00842 #endif 00843 va_end (args); 00844 if (max_rcs_errors_to_print == rcs_errors_printed && 00845 max_rcs_errors_to_print >= 0) 00846 { 00847 rcs_print ("\nMaximum number of errors to print exceeded!\n"); 00848 } 00849 rcs_errors_printed++; 00850 if (max_rcs_errors_to_print <= rcs_errors_printed && 00851 max_rcs_errors_to_print >= 0) 00852 { 00853 return (EOF); 00854 } 00855 00856 switch (error_source) 00857 { 00858 case ERRNO_ERROR_SOURCE: 00859 #ifndef UNDER_CE 00860 sprintf (message_string, "%s %d %s\n", temp_string, errno, 00861 strerror (errno)); 00862 #endif 00863 rcs_puts (message_string); 00864 break; 00865 00866 #ifndef UNDER_CE 00867 #ifdef WIN32 00868 case GETLASTERROR_ERROR_SOURCE: 00869 { 00870 char *msgBuf = NULL; 00871 DWORD errCode = GetLastError (); 00872 FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | 00873 FORMAT_MESSAGE_FROM_SYSTEM, NULL, errCode, 00874 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), 00875 (LPTSTR) & msgBuf, 0, NULL); 00876 if (NULL != msgBuf) 00877 { 00878 sprintf (message_string, "%s %d %s\n", temp_string, errCode, 00879 msgBuf); 00880 } 00881 else 00882 { 00883 sprintf (message_string, "%s %d\n", temp_string, errCode); 00884 } 00885 } 00886 rcs_puts (message_string); 00887 break; 00888 00889 case WSAGETLASTERROR_ERROR_SOURCE: 00890 { 00891 char *msgBuf = NULL; 00892 DWORD errCode = WSAGetLastError (); 00893 FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | 00894 FORMAT_MESSAGE_FROM_SYSTEM, NULL, errCode, 00895 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), 00896 (LPTSTR) & msgBuf, 0, NULL); 00897 if (NULL != msgBuf) 00898 { 00899 sprintf (message_string, "%s %d %s\n", temp_string, errCode, 00900 msgBuf); 00901 } 00902 else 00903 { 00904 sprintf (message_string, "%s %d\n", temp_string, errCode); 00905 } 00906 } 00907 rcs_puts (message_string); 00908 break; 00909 00910 #endif 00911 #endif 00912 00913 default: 00914 rcs_puts (temp_string); 00915 break; 00916 } 00917 return (strlen (temp_string)); 00918 } |
|
Definition at line 930 of file rcs_prnt.cc. 00931 { 00932 int retval = 0; 00933 va_list args; 00934 00935 va_start (args, _fmt); 00936 if ((rcs_print_mode_flags & PRINT_RCS_ERRORS) 00937 && ((max_rcs_errors_to_print >= rcs_errors_printed) 00938 || max_rcs_errors_to_print < 0)) 00939 { 00940 retval = rcs_vprint (_fmt, args, 1); 00941 if (max_rcs_errors_to_print == rcs_errors_printed && 00942 max_rcs_errors_to_print >= 0) 00943 { 00944 rcs_print ("\nMaximum number of errors to print exceeded!\n"); 00945 } 00946 } 00947 if (rcs_print_destination != RCS_PRINT_TO_NULL) 00948 { 00949 rcs_errors_printed++; 00950 } 00951 va_end (args); 00952 return (retval); 00953 } |
|
Definition at line 75 of file rcs_prnt.cc. |
|
Definition at line 76 of file rcs_prnt.cc. |
|
Definition at line 80 of file rcs_prnt.cc. |
|
Definition at line 94 of file rcs_prnt.cc. |
|
Definition at line 95 of file rcs_prnt.cc. |
|
Definition at line 97 of file rcs_prnt.cc. |
|
Definition at line 99 of file rcs_prnt.cc. |
|
Definition at line 100 of file rcs_prnt.cc. |
|
Definition at line 103 of file rcs_prnt.cc. |
|
Definition at line 104 of file rcs_prnt.cc. |
|
Definition at line 105 of file rcs_prnt.cc. |
|
Definition at line 730 of file rcs_prnt.cc. |
|
Definition at line 731 of file rcs_prnt.cc. |