Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

rcs_prnt.hh File Reference

#include "rcs_defs.hh"
#include <stdarg.h>

Include dependency graph for rcs_prnt.hh:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define rcs_print_error   set_print_rcs_error_info( __FILE__, __LINE__); print_rcs_error_new
#define PRINT_RCS_ERRORS   0x00000001
#define PRINT_NODE_CONSTRUCTORS   0x00000002
#define PRINT_NODE_DESTRUCTORS   0x00000004
#define PRINT_CMS_CONSTRUCTORS   0x00000008
#define PRINT_CMS_DESTRUCTORS   0x00000010
#define PRINT_NML_CONSTRUCTORS   0x00000020
#define PRINT_NML_DESTRUCTORS   0x00000040
#define PRINT_COMMANDS_RECIEVED   0x00000100
#define PRINT_COMMANDS_SENT   0x00000200
#define PRINT_STATUS_RECIEVED   0x00000400
#define PRINT_STATUS_SENT   0x00000800
#define PRINT_NODE_CYCLES   0x00001000
#define PRINT_NODE_MISSED_CYCLES   0x00002000
#define PRINT_NODE_CYCLE_TIMES   0x00004000
#define PRINT_NODE_PROCESS_TIMES   0x00008000
#define PRINT_NEW_WM   0x00010000
#define PRINT_NODE_ABORT   0x00020000
#define PRINT_CMS_CONFIG_INFO   0x00040000
#define PRINT_SOCKET_READ_SIZE   0x00080000
#define PRINT_SOCKET_WRITE_SIZE   0x00100000
#define PRINT_INTERFACE_LOADING   0x00200000
#define PRINT_RPC_SERVER_CALL   0x00400000
#define PRINT_SEMAPHORE_ACTIVITY   0x00800000
#define PRINT_SOCKET_CONNECT   0x01000000
#define PRINT_SERVER_THREAD_ACTIVITY   0x02000000
#define PRINT_SERVER_SUBSCRIPTION_ACTIVITY   0x04000000
#define PRINT_SHARED_MEMORY_ACTIVITY   0x08000000
#define PRINT_ALL_SOCKET_REQUESTS   0x10000000
#define PRINT_EVERYTHING   0xFFFFFFFF

Enumerations

enum  RCS_PRINT_DESTINATION_TYPE {
  RCS_PRINT_TO_STDOUT, RCS_PRINT_TO_STDERR, RCS_PRINT_TO_NULL, RCS_PRINT_TO_LIST,
  RCS_PRINT_TO_FILE, RCS_PRINT_TO_MESSAGE_BOX, RCS_PRINT_TO_LOGGER
}
enum  RCS_PRINT_ERROR_SOURCE_TYPE { ERRNO_ERROR_SOURCE = 1, GETLASTERROR_ERROR_SOURCE, WSAGETLASTERROR_ERROR_SOURCE }

Functions

void RCS_EXPORT clean_print_list (void)
void RCS_EXPORT output_print_list (int output_func(char *))
int RCS_EXPORT count_characters_in_print_list (void)
int RCS_EXPORT count_lines_in_print_list (void)
void RCS_EXPORT convert_print_list_to_lines (void)
void RCS_EXPORT update_lines_table (void)
int RCS_EXPORT rcs_vprint (char RCS_FAR *_fmt, va_list va_args, int save_string)
int RCS_EXPORT rcs_print (char RCS_FAR *_fmt,...)
int RCS_EXPORT rcs_print_debug (long, 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,...)
void RCS_EXPORT set_rcs_print_flag (long flags_to_set)
void RCS_EXPORT clear_rcs_print_flag (long flags_to_set)
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_puts (char RCS_FAR *)
int RCS_EXPORT rcs_fputs (char RCS_FAR *)
char RCS_FAR **RCS_EXPORT get_rcs_lines_table (void)
int RCS_EXPORT get_rcs_print_list_size (void)
typedef void (RCS_PASCAL RCS_FAR *RCS_PRINT_NOTIFY_FUNC_PTR)(void)
void RCS_EXPORT set_rcs_print_notify (RCS_PRINT_NOTIFY_FUNC_PTR)
int RCS_EXPORT set_rcs_print_file (char RCS_FAR *_file_name)
void RCS_EXPORT close_rcs_printing (void)
void RCS_EXPORT set_rcs_print_destination (RCS_PRINT_DESTINATION_TYPE)
RCS_PRINT_DESTINATION_TYPE
RCS_EXPORT 
get_rcs_print_destination (void)
int RCS_EXPORT rcs_print_sys_error (int error_source, char RCS_FAR *_fmt,...)

Variables

int max_rcs_errors_to_print
int rcs_errors_printed
char last_error_bufs [4][100]
int last_error_buf_filled


Define Documentation

#define rcs_print_error   set_print_rcs_error_info( __FILE__, __LINE__); print_rcs_error_new
 

Definition at line 58 of file rcs_prnt.hh.

Referenced by CMS::CMS(), CMS_ASCII_UPDATER::CMS_ASCII_UPDATER(), CMS_DISPLAY_ASCII_UPDATER::CMS_DISPLAY_ASCII_UPDATER(), CMS_SERVER_REMOTE_UDP_PORT::CMS_SERVER_REMOTE_UDP_PORT(), CMS_XDR_UPDATER::CMS_XDR_UPDATER(), FILEMEM::FILEMEM(), GLOBMEM::GLOBMEM(), LOCMEM::LOCMEM(), NML::NML(), NMLInit(), NMLRead(), NMLReadExit(), NML_SERVER::NML_SERVER(), NMLmsg::NMLmsg(), NODE::NODE(), NODE_LINK::NODE_LINK(), PHYSMEM_HANDLE::PHYSMEM_HANDLE(), RCS_SHAREDMEM::RCS_SHAREDMEM(), RPC_HOST::RPC_HOST(), RTLMEM::RTLMEM(), SHMEM::SHMEM(), STCPMEM::STCPMEM(), TCPMEM::TCPMEM(), TCPSVR_BLOCKING_READ_REQUEST::TCPSVR_BLOCKING_READ_REQUEST(), UDPMEM::UDPMEM(), CMS_SERVER_REMOTE_TCP_PORT::accept_local_port_cms(), CMS_SERVER_REMOTE_STCP_PORT::accept_local_port_cms(), acquire_access(), CMS_SERVER::add_local_port(), CMS_SERVER_REMOTE_UDP_PORT::add_subscription_client(), NML_SUPER_SERVER::add_to_list(), autokey_getkey(), autokey_releasekey(), UDPMEM::blocking_read(), TTYMEM::blocking_read(), TCPMEM::blocking_read(), NML_SERVER_LOCAL_PORT::blocking_read(), NML::blocking_read(), UDPMEM::cancel_subscription(), check_buffer_info(), UDPMEM::check_if_read(), STCPMEM::check_if_read(), RPCMEM::check_if_read(), CMS::check_if_read_encoded(), CMS::check_if_read_raw(), CMS_XDR_UPDATER::check_pointer(), CMS_ASCII_UPDATER::check_pointer(), CMS::check_pointer(), TCPMEM::clear(), RPCMEM::clear(), NMLmsg::clear(), cms_create(), cms_create_from_lines(), NML_PERFORMANCE_TEST_MSG::compute_array_length(), convert2upper(), CMS_SERVER_REMOTE_RPC_PORT::dispatch(), dl_accept(), dl_bind(), dl_closesocket(), dl_connect(), dl_fd_isset(), dl_gethostbyname(), dl_htonl(), dl_htons(), dl_inet_addr(), dl_inet_ntoa(), dl_ioctlsocket(), dl_listen(), dl_ntohl(), dl_ntohs(), dl_recv(), dl_recvfrom(), dl_select(), dl_send(), dl_sendto(), dl_setsockopt(), dl_socket(), NODE::error_handler(), esleep(), etime(), CMS_DISPLAY_ASCII_UPDATER::find_next_comma(), find_proc_and_buffer_lines(), CMS_SERVER::find_user(), NML::format_input(), NML::format_output(), GLOBMEM::get_access(), get_buffer_line(), NODE::get_command_message(), NODE::get_subordinates_status(), CMS_SERVER::get_user_info(), TCPMEM::handle_old_replies(), handle_pipe_error(), CMS_SERVER_REMOTE_UDP_PORT::handle_request(), CMS_SERVER_REMOTE_TTY_PORT::handle_request(), hostname_matches_bufferline(), NODE::initialize_command_buffer(), NODE::initialize_status_buffer(), NODE::initialize_world_model_buffer(), CMS_SERVER::initialize_write_request_space(), CMS::internal_access(), CMS::internal_clear(), last_pipe_signum(), load_nml_config_file(), load_rpc_interface(), load_socket_interface(), TCPMEM::login(), STCPMEM::login(), RPCMEM::login(), main(), SHMEM::main_access(), GLOBMEM::main_access(), CMS::main_access(), make_tcp_socket_blocking(), make_tcp_socket_nonblocking(), make_udp_socket_blocking(), make_udp_socket_broadcast(), make_udp_socket_nonblocking(), mem_release_access(), nml_watch(), nmlcfg_read_file(), SHMEM::open(), RPCMEM::open(), CMS::open(), open_serial_communications_port(), CMS::operator new(), parse_buffer_info(), parse_process_info(), UDPMEM::peek(), TTYMEM::peek(), TCPMEM::peek(), STCPMEM::peek(), RPCMEM::peek(), NML::peek(), CMS::peek_encoded(), CMS::peek_raw(), perf_types_format(), physmem_read_local_address_is_null_error_print_count(), physmem_write_local_address_is_null_error_print_count(), pmac_init(), pmac_print_error(), pmac_sendstring(), NML::print_queue_info(), CMS_SERVER::process_request(), CMS::queue_check_if_read_encoded(), CMS::queue_check_if_read_raw(), CMS::queue_peek_encoded(), CMS::queue_peek_raw(), CMS::queue_read_encoded(), CMS::queue_read_raw(), CMS::queue_write_encoded(), CMS::queue_write_if_read_encoded(), CMS::queue_write_if_read_raw(), CMS::queue_write_raw(), rcs_exit(), rcs_sem_create(), rcs_sem_destroy(), rcs_sem_flush(), rcs_sem_init(), rcs_sem_open(), rcs_sem_post(), rcs_sem_trywait(), rcs_sem_wait(), rcs_sem_wait_notimeout(), rcs_shm_close(), rcs_shm_delete(), rcs_shm_open(), UDPMEM::read(), TTYMEM::read(), TCPMEM::read(), STCPMEM::read(), RPCMEM::read(), PHYSMEM_HANDLE::read(), NML::read(), FILEMEM::read(), BBDMEM::read(), CMS::read_encoded(), CMS_SERVER::read_passwd_file(), read_pmac_uint16(), read_pmac_uint8(), CMS::read_raw(), NODE::read_world_model_in(), NML_SERVER_LOCAL_PORT::reader(), readn(), TCPMEM::reconnect(), NML::reconstruct(), recvline(), recvmsgt_implementation(), recvn(), CMS_SERVER_REMOTE_UDP_PORT::register_port(), CMS_SERVER_REMOTE_STCP_PORT::register_port(), CMS_SERVER_REMOTE_RPC_PORT::register_port(), CMS_SERVER::register_server(), release_access(), GLOBMEM::release_access(), CMS_SERVER_REMOTE_UDP_PORT::run(), CMS_SERVER_REMOTE_TTY_PORT::run(), NODE::run(), run_perfsvr(), CMS_SERVER::security_check(), NODE::send_subordinates_commands(), sendline(), sendmsgt(), sendn(), NML_MODULE::setCmdChannel(), NML_MODULE::setErrorLogChannel(), NML_MODULE::setStatChannel(), CMS_SERVER_REMOTE_UDP_PORT::set_broadcast_address(), CMS_XDR_UPDATER::set_encoded_data(), CMS_XDR_UPDATER::set_mode(), CMS_UPDATER::set_mode(), CMS_DISPLAY_ASCII_UPDATER::set_mode(), CMS_ASCII_UPDATER::set_mode(), set_serial_port_configuration(), set_stcp_socket_options(), set_tcp_socket_options(), CMS::set_temp_updater(), set_udp_socket_options(), UDPMEM::setup_subscription(), tcp_svr_reverse_double(), NMLmsg::update(), CMS_XDR_UPDATER::update(), CMS_ASCII_UPDATER::update(), CMS_SERVER_REMOTE_UDP_PORT::update_subscriptions(), NML_MODULE::use_realloc(), UDPMEM::verify_bufname(), UDPMEM::write(), TTYMEM::write(), TCPMEM::write(), STCPMEM::write(), RPCMEM::write(), PHYSMEM_HANDLE::write(), NML::write(), FILEMEM::write(), CMS::write_encoded(), UDPMEM::write_if_read(), TTYMEM::write_if_read(), TCPMEM::write_if_read(), STCPMEM::write_if_read(), RPCMEM::write_if_read(), NML::write_if_read(), CMS::write_if_read_encoded(), CMS::write_if_read_raw(), write_pmac_uint16(), write_pmac_uint8(), CMS::write_raw(), NODE::write_world_model_out(), writen(), NML_SERVER_LOCAL_PORT::writer(), NML::~NML(), and RPCMEM::~RPCMEM().

#define PRINT_RCS_ERRORS   0x00000001
 

Definition at line 99 of file rcs_prnt.hh.

#define PRINT_NODE_CONSTRUCTORS   0x00000002
 

Definition at line 100 of file rcs_prnt.hh.

#define PRINT_NODE_DESTRUCTORS   0x00000004
 

Definition at line 101 of file rcs_prnt.hh.

#define PRINT_CMS_CONSTRUCTORS   0x00000008
 

Definition at line 102 of file rcs_prnt.hh.

#define PRINT_CMS_DESTRUCTORS   0x00000010
 

Definition at line 103 of file rcs_prnt.hh.

#define PRINT_NML_CONSTRUCTORS   0x00000020
 

Definition at line 104 of file rcs_prnt.hh.

#define PRINT_NML_DESTRUCTORS   0x00000040
 

Definition at line 105 of file rcs_prnt.hh.

#define PRINT_COMMANDS_RECIEVED   0x00000100
 

Definition at line 107 of file rcs_prnt.hh.

#define PRINT_COMMANDS_SENT   0x00000200
 

Definition at line 108 of file rcs_prnt.hh.

#define PRINT_STATUS_RECIEVED   0x00000400
 

Definition at line 109 of file rcs_prnt.hh.

#define PRINT_STATUS_SENT   0x00000800
 

Definition at line 110 of file rcs_prnt.hh.

#define PRINT_NODE_CYCLES   0x00001000
 

Definition at line 111 of file rcs_prnt.hh.

#define PRINT_NODE_MISSED_CYCLES   0x00002000
 

Definition at line 112 of file rcs_prnt.hh.

#define PRINT_NODE_CYCLE_TIMES   0x00004000
 

Definition at line 113 of file rcs_prnt.hh.

#define PRINT_NODE_PROCESS_TIMES   0x00008000
 

Definition at line 114 of file rcs_prnt.hh.

#define PRINT_NEW_WM   0x00010000
 

Definition at line 115 of file rcs_prnt.hh.

#define PRINT_NODE_ABORT   0x00020000
 

Definition at line 116 of file rcs_prnt.hh.

#define PRINT_CMS_CONFIG_INFO   0x00040000
 

Definition at line 117 of file rcs_prnt.hh.

#define PRINT_SOCKET_READ_SIZE   0x00080000
 

Definition at line 118 of file rcs_prnt.hh.

#define PRINT_SOCKET_WRITE_SIZE   0x00100000
 

Definition at line 119 of file rcs_prnt.hh.

#define PRINT_INTERFACE_LOADING   0x00200000
 

Definition at line 120 of file rcs_prnt.hh.

#define PRINT_RPC_SERVER_CALL   0x00400000
 

Definition at line 121 of file rcs_prnt.hh.

#define PRINT_SEMAPHORE_ACTIVITY   0x00800000
 

Definition at line 122 of file rcs_prnt.hh.

#define PRINT_SOCKET_CONNECT   0x01000000
 

Definition at line 123 of file rcs_prnt.hh.

#define PRINT_SERVER_THREAD_ACTIVITY   0x02000000
 

Definition at line 124 of file rcs_prnt.hh.

#define PRINT_SERVER_SUBSCRIPTION_ACTIVITY   0x04000000
 

Definition at line 125 of file rcs_prnt.hh.

#define PRINT_SHARED_MEMORY_ACTIVITY   0x08000000
 

Definition at line 126 of file rcs_prnt.hh.

#define PRINT_ALL_SOCKET_REQUESTS   0x10000000
 

Definition at line 127 of file rcs_prnt.hh.

#define PRINT_EVERYTHING   0xFFFFFFFF
 

Definition at line 128 of file rcs_prnt.hh.


Enumeration Type Documentation

enum RCS_PRINT_DESTINATION_TYPE
 

Enumeration values:
RCS_PRINT_TO_STDOUT 
RCS_PRINT_TO_STDERR 
RCS_PRINT_TO_NULL 
RCS_PRINT_TO_LIST 
RCS_PRINT_TO_FILE 
RCS_PRINT_TO_MESSAGE_BOX 
RCS_PRINT_TO_LOGGER 

Definition at line 134 of file rcs_prnt.hh.

00135 {
00136 #endif
00137   RCS_PRINT_TO_STDOUT,
00138   RCS_PRINT_TO_STDERR,
00139   RCS_PRINT_TO_NULL,
00140   RCS_PRINT_TO_LIST,
00141   RCS_PRINT_TO_FILE,
00142   RCS_PRINT_TO_MESSAGE_BOX,     /* Only available for Windows */
00143   RCS_PRINT_TO_LOGGER           /* Only available for VXWORKS */
00144 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
00145 };
00146 #else
00147 }

enum RCS_PRINT_ERROR_SOURCE_TYPE
 

Enumeration values:
ERRNO_ERROR_SOURCE 
GETLASTERROR_ERROR_SOURCE 
WSAGETLASTERROR_ERROR_SOURCE 

Definition at line 168 of file rcs_prnt.hh.

00169   {
00170 #endif
00171     ERRNO_ERROR_SOURCE = 1,
00172     GETLASTERROR_ERROR_SOURCE,
00173     WSAGETLASTERROR_ERROR_SOURCE
00174 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
00175   };
00176 #else
00177   }


Function Documentation

void RCS_EXPORT clean_print_list void   
 

Definition at line 178 of file rcs_prnt.cc.

00179 {
00180   if (NULL != rcs_print_list)
00181     {
00182       delete rcs_print_list;
00183       rcs_print_list = NULL;
00184     }
00185 }

void RCS_EXPORT output_print_list int output_func(char *)   
 

int RCS_EXPORT count_characters_in_print_list void   
 

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 }

int RCS_EXPORT count_lines_in_print_list void   
 

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 }

void RCS_EXPORT convert_print_list_to_lines void   
 

Definition at line 246 of file rcs_prnt.cc.

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 }

void RCS_EXPORT update_lines_table void   
 

Definition at line 321 of file rcs_prnt.cc.

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 }

int RCS_EXPORT rcs_vprint char RCS_FAR *    _fmt,
va_list    va_args,
int    save_string
 

Definition at line 446 of file rcs_prnt.cc.

Referenced by print_rcs_error_new(), rcs_print_debug(), and rcs_print_error().

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 }

int RCS_EXPORT rcs_print char RCS_FAR *    _fmt,
...   
 

int RCS_EXPORT rcs_print_debug long    flag_to_check,
char RCS_FAR *    _fmt,
...   
 

Definition at line 776 of file rcs_prnt.cc.

Referenced by CMS::CMS(), NML::NML(), NODE::NODE(), STCPMEM::STCPMEM(), TCPMEM::TCPMEM(), UDPMEM::UDPMEM(), CMS_SERVER_REMOTE_STCP_PORT::accept_local_port_cms(), CMS_SERVER_REMOTE_PORT::add_connected_user(), TCPMEM::blocking_read(), TCPMEM::check_if_read(), NODE::check_timer(), TCPMEM::clear(), cms_config(), cms_create(), NML::delete_channel(), CMS_SERVER_REMOTE_RPC_PORT::dispatch(), find_proc_and_buffer_lines(), NODE::get_command_message(), TCPMEM::get_diagnostics_info(), NODE_LINK::get_status(), TCPMEM::handle_old_replies(), load_rpc_interface(), TCPMEM::login(), nml_cleanup(), CMS::open(), NML::operator delete(), CMS::operator delete(), NML::operator new(), CMS::operator new(), TCPMEM::peek(), rcs_sem_post(), rcs_sem_t(), rcs_sem_wait(), rcs_sem_wait_notimeout(), rcs_shm_close(), rcs_shm_open(), TCPMEM::read(), NODE_LINK::read_wm(), TCPMEM::reconnect(), NML::reconstruct(), recvline(), recvmsgt_implementation(), recvn(), CMS_SERVER_REMOTE_STCP_PORT::register_port(), NODE::run(), sem_force_fifo(), NODE_LINK::send_command(), TCPMEM::send_diag_info(), NODE::send_status_message(), sendline(), sendmsgt(), sendn(), CMS_SERVER_REMOTE_UDP_PORT::set_broadcast_address(), CMS_SERVER_REMOTE_UDP_PORT::update_subscriptions(), TCPMEM::verify_bufname(), NODE::wait_for_timer(), TCPMEM::write(), TCPMEM::write_if_read(), NODE::write_world_model_out(), CMS::~CMS(), and NODE::~NODE().

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 }

int RCS_EXPORT set_print_rcs_error_info const char *    file,
int    line
 

Definition at line 733 of file rcs_prnt.cc.

00734 {
00735   rcs_error_filename = file;
00736   rcs_error_linenum = line;
00737   return (0);
00738 }

int RCS_EXPORT print_rcs_error_new char RCS_FAR *    _fmt,
...   
 

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 }

void RCS_EXPORT set_rcs_print_flag long    flags_to_set
 

Definition at line 802 of file rcs_prnt.cc.

00803 {
00804   rcs_print_mode_flags |= flag_to_set;
00805 }

void RCS_EXPORT clear_rcs_print_flag long    flags_to_set
 

Definition at line 808 of file rcs_prnt.cc.

00809 {
00810   rcs_print_mode_flags &= ~(flag_to_clear);
00811 }

char RCS_FAR* RCS_EXPORT strip_control_characters char RCS_FAR *    _dest,
char RCS_FAR *    _src
 

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 }

int RCS_EXPORT separate_words char RCS_FAR **    _dest,
int    _max,
char RCS_FAR *    _src
 

Definition at line 420 of file rcs_prnt.cc.

Referenced by CMS::CMS(), SHMEM::SHMEM(), cms_create_from_lines(), find_proc_and_buffer_lines(), get_buffer_line(), hostname_matches_bufferline(), parse_buffer_info(), and parse_process_info().

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 }

int RCS_EXPORT rcs_puts char RCS_FAR *    _str
 

Definition at line 487 of file rcs_prnt.cc.

Referenced by RPCMEM::check_if_read(), RPCMEM::clear(), RPCMEM::open(), rcs_print_sys_error(), rcs_sem_flush(), rcs_sem_init(), rcs_sem_open(), rcs_sem_post(), and RPCMEM::read().

00488 {
00489   int retval, retval2;
00490   retval = rcs_fputs (_str);
00491   if (retval != EOF)
00492     {
00493       retval2 = rcs_fputs ("\n");
00494       if (retval2 != EOF)
00495         {
00496           retval += retval;
00497         }
00498       else
00499         {
00500           retval = EOF;
00501         }
00502     }
00503   return (retval);
00504 }

int RCS_EXPORT rcs_fputs char RCS_FAR *    _str
 

Definition at line 507 of file rcs_prnt.cc.

Referenced by rcs_print(), rcs_puts(), and rcs_vprint().

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 }

char RCS_FAR** RCS_EXPORT get_rcs_lines_table void   
 

Definition at line 129 of file rcs_prnt.cc.

00131 {
00132   return (rcs_lines_table);
00133 }

int RCS_EXPORT get_rcs_print_list_size void   
 

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 }

typedef void RCS_PASCAL RCS_FAR *    RCS_PRINT_NOTIFY_FUNC_PTR
 

Referenced by TCPMEM::TCPMEM(), dl_clnt_destroy(), dl_xdr_destroy(), rcs_sem_wait(), and TCPMEM::reenable_sigpipe().

void RCS_EXPORT set_rcs_print_notify RCS_PRINT_NOTIFY_FUNC_PTR    _rcs_print_notify
 

Definition at line 172 of file rcs_prnt.cc.

00173 {
00174   rcs_print_notify = _rcs_print_notify;
00175 }

int RCS_EXPORT set_rcs_print_file char RCS_FAR *    _file_name
 

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 }

void RCS_EXPORT close_rcs_printing void   
 

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 }

void RCS_EXPORT set_rcs_print_destination RCS_PRINT_DESTINATION_TYPE    _dest
 

Definition at line 109 of file rcs_prnt.cc.

Referenced by main(), and nmlWaitOpen().

00110 {
00111   if (rcs_print_destination == RCS_PRINT_TO_NULL)
00112     {
00113       rcs_errors_printed = 0;
00114     }
00115   rcs_print_destination = _dest;
00116 }

RCS_PRINT_DESTINATION_TYPE RCS_EXPORT get_rcs_print_destination void   
 

Definition at line 119 of file rcs_prnt.cc.

00120 {
00121   return (rcs_print_destination);
00122 }

int RCS_EXPORT rcs_print_sys_error int    error_source,
char RCS_FAR *    _fmt,
...   
 

Definition at line 816 of file rcs_prnt.cc.

Referenced by TCPMEM::TCPMEM(), SHMEM::main_access(), SHMEM::open(), open_serial_communications_port(), read_serial_communications_port(), recvn(), set_serial_port_configuration(), CMS_SERVER::spawn(), and write_serial_communications_port().

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 }


Variable Documentation

int max_rcs_errors_to_print
 

Definition at line 186 of file rcs_prnt.hh.

int rcs_errors_printed
 

Definition at line 187 of file rcs_prnt.hh.

char last_error_bufs[4][100]
 

Definition at line 189 of file rcs_prnt.hh.

int last_error_buf_filled
 

Definition at line 190 of file rcs_prnt.hh.


Generated on Sun Dec 2 15:57:49 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001