Changeset 7508


Ignore:
Timestamp:
06/27/18 22:53:55 (3 weeks ago)
Author:
baker
Message:

use typedef's for thr_ret instead of #define's, remove C++ #undef thr_ret hack caused by erroneous thr_ret function prototypes (fixed in r7507)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/platform.h

    r6858 r7508  
    1  
    2 /* 
    3  *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE 
    4  *   CHECKED IT OUT USING THE COMMAND CHECKOUT. 
    5  * 
    6  *    $Id$ 
    7  * 
    8  *    Revision history: 
    9  *     $Log$ 
    10  *     Revision 1.11  2007/04/13 17:30:47  hal 
    11  *     added typedef for ulong when we're compining under cygwin 
    12  * 
    13  *     Revision 1.10  2007/03/27 22:19:51  paulf 
    14  *     added _MACOSX flags 
    15  * 
    16  *     Revision 1.9  2006/04/05 19:30:12  stefan 
    17  *     logit fix for log file slash 
    18  * 
    19  *     Revision 1.8  2006/04/05 14:32:55  stefan 
    20  *     added platform specific DIR_SLASH string 
    21  * 
    22  *     Revision 1.7  2006/03/10 13:50:56  paulf 
    23  *     minor linux related fixes to removing _SOLARIS from the include line 
    24  * 
    25  *     Revision 1.6  2005/07/27 15:11:34  friberg 
    26  *     added in _LINUX ifdefs 
    27  * 
    28  *     Revision 1.5  2004/10/07 21:30:15  mark 
    29  *     Added thread priority constants 
    30  * 
    31  *     Revision 1.4  2003/12/03 01:16:05  davidk 
    32  *     added NT #def for snprintf() in lieu of _snprintf() 
    33  * 
    34  *     Revision 1.3  2000/06/02 21:37:28  davidk 
    35  *     Added a #define for vsnprintf on NT.  Removed comments from #define 
    36  *     lines.  Comments on #define lines can be potentially diasterous if 
    37  *     you comment out a section of code, and there is an end comment (* /) 
    38  *     in a #define that you can't see, then you will get what seem like 
    39  *     random compile errors. 
    40  * 
    41  *     Revision 1.2  2000/03/05 21:51:06  lombard 
    42  *     Added `ifndef LONG_t' around LONG to prevent redefinition errors. 
    43  * 
    44  *     Revision 1.1  2000/02/14 20:05:54  lucky 
    45  *     Initial revision 
    46  * 
    47  * 
    48  */ 
    49  
    501 
    512              /************************************************* 
     
    589#ifndef PLATFORM_H 
    5910#define PLATFORM_H 
     11 
     12/********************************************************************* _WINNT */ 
    6013 
    6114#ifdef _WINNT 
     
    9245 
    9346/* Thread functions return this */ 
    94 #define thr_ret void 
     47typedef void thr_ret; 
    9548/* Value returned by thread functions; for Windows, nothing */ 
    9649#define THR_NULL_RET 
     
    10962typedef signed __int32 EW_INT32; 
    11063#endif 
    111  
    11264 
    11365/* added so that logit.c can call vsnprintf for all platforms */ 
     
    12678#define DIR_SLASH   '/' 
    12779#endif /* _WINNT */ 
     80 
     81/*********************************************************************** _OS2 */ 
    12882 
    12983#ifdef _OS2 
     
    14296#include <sys\socket.h>            /* Socket stuff */ 
    14397#include <netdb.h>                 /* Socket stuff */ 
    144 typedef void thr_ret;              /* Thread functions return this */ 
     98/* Thread functions return this */ 
     99typedef void thr_ret; 
    145100/* Value returned by thread functions; for OS2, nothing */ 
    146101#define THR_NULL_RET 
     
    153108#endif /* _OS2 */ 
    154109 
     110/********************************************************************* _LINUX */ 
    155111 
    156112#ifdef _LINUX 
     
    178134 
    179135/* Thread functions return this */ 
    180 #define thr_ret void*               
     136typedef void *thr_ret; 
    181137/* Value returned by thread functions; for UNIX, NULL */ 
    182138#define THR_NULL_RET (NULL) 
     
    207163 
    208164#endif /* _LINUX */ 
     165 
     166/******************************************************************** _MACOSX */ 
    209167 
    210168#ifdef _MACOSX 
     
    230188 
    231189/* Thread functions return this */ 
    232 #define thr_ret void*               
     190typedef void *thr_ret; 
    233191/* Value returned by thread functions; for MACOSX, NULL */ 
    234192#define THR_NULL_RET (NULL) 
     
    258216 
    259217#endif /* _MACOSX */ 
     218 
     219/******************************************************************* _SOLARIS */ 
    260220 
    261221#ifdef _SOLARIS 
     
    278238 
    279239/* Thread functions return this */ 
    280 #define thr_ret void*               
     240typedef void *thr_ret; 
    281241/* Value returned by thread functions; for Solaris, NULL */ 
    282242#define THR_NULL_RET (NULL) 
  • trunk/include_cpp/serverbase.h

    r1334 r7508  
    1414 
    1515extern "C" { 
    16 #include <platform.h> 
    17 // C++ compilers don't like the earthworm def for thr_ret 
    18 #undef thr_ret 
    19 #define thr_ret void fun 
    20 #include <socket_ew.h> 
    21 #include <transport.h> 
     16#include "platform.h" 
     17#include "socket_ew.h" 
     18#include "transport.h" 
    2219} 
    2320#define _USING_EW_XPORT 1 // prevent conflict between EW & MW 
    24  
    2521 
    2622// microsoft pragma to avoid 157 messages in some cases 
     
    4036#include <configsource.h> 
    4137 
    42  
    43  
    4438#define SERVE_MAX_THREADS    100 
    4539#define WAIT_FOR_SERVICE_THREAD  3000    // milliseconds to wait for a service thread to come free 
     
    5549// Absolute minumum time to listen for a message if specified 
    5650#define MIN_RECV_TIMEOUT_MS  50 
    57  
    5851 
    5952enum WORM_SERVER_THREAD_STATE  // Server Thread States 
     
    126119                             ); 
    127120 
    128  
    129121   // ======================================================================= 
    130122   //                  from TConfigurable 
     
    142134   */ 
    143135   void CheckConfig(); 
    144  
    145136 
    146137   // ======================================================================= 
     
    164155   int            LoggingLevel; 
    165156 
    166  
    167157   SERVICETHREAD_MAP ThreadsInfo; 
    168158 
     
    217207   WORM_STATUS_CODE SendMessage( const SOCKET p_descriptor, const char * p_msg, int * p_length ); 
    218208 
    219  
    220209   /* Running -- flag indicating if the main loop is running, 
    221210   **            set to false by terminate message, or various 
     
    237226   } 
    238227 
    239  
    240228   /* PrepareToRun() -- actions to take prior to entering main loop 
    241229   ** 
     
    277265   // (WormServerBase) that takes no parameters and returns THREAD_RETURN 
    278266//   THREAD_RETURN (WormServerBase::*MyThreadFunction)(void * p_argument); 
    279  
    280267 
    281268public: 
     
    349336 
    350337#endif // EWserverbaseH 
    351  
    352  
  • trunk/include_cpp/simple_mod_base.h

    r1334 r7508  
    1 /* 
    2  *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE 
    3  *   CHECKED IT OUT USING THE COMMAND CHECKOUT. 
    4  * 
    5  *    $Id$ 
    6  * 
    7  *    Revision history: 
    8  *     $Log$ 
    9  *     Revision 1.2  2004/03/17 17:31:41  dhanych 
    10  *     for RCS 
    11  * 
    12  *     Revision 1.1  2003/09/05 19:11:38  dhanych 
    13  *     Initial revision 
    14  * 
    15  * 
    16  * 
    17  */ 
    18  
    191/* 
    202 * This is a base class which serves as a template providing 
     
    3012 
    3113extern "C" { 
    32 #include <platform.h> 
    33 #include <earthworm_defs.h> 
    34 #include <earthworm_simple_funcs.h> 
    35  
    36 /* C++ compilers don't like the earthworm def for thr_ret */ 
    37 #undef thr_ret 
    38 #define thr_ret void fun 
    39 #include <transport.h>        /* Ring stuff  */ 
    40 #include <mem_circ_queue.h> 
    41  
     14#include "platform.h" 
     15#include "earthworm_defs.h" 
     16#include "earthworm_simple_funcs.h" 
     17#include "transport.h"        /* Ring stuff  */ 
     18#include "mem_circ_queue.h" 
    4219} 
    4320 
     
    5027#include <threadableobject.h> 
    5128 
    52  
    5329//#pragma warning(disable:4786)    // microsoft pragma to avoid messages from cpp stdlib 
    5430//#include <string>                // std::string 
    5531//#include <queue>                 // std::queue 
    56  
    57  
    5832 
    5933enum WORKER_THREAD_STATUS 
     
    7953#define WORK_THREAD_DEAD_SEC  10  /* number of seconds without worker thread pulse before considered dead */ 
    8054 
    81  
    8255// Default Logging Level 
    8356#define DEF_LOGGING_LEVEL  WORM_LOG_DETAILS 
     
    9467// Default millisecond sleep time for Handler thread (if no new message) 
    9568#define DEF_HANDLE_SLEEP_MS  400 
    96  
    9769 
    9870/* 
     
    10173#define SMB_ERR_QUEUE_WRAPPED 1 
    10274#define SMB_ERR_MSG_TOO_LONG  2 
    103  
    104  
    10575 
    10676//--------------------------------------------------------------------------- 
     
    212182   virtual void CheckConfig(); 
    213183 
    214     
    215  
    216    // ======================================================================= 
     184      // ======================================================================= 
    217185   //                   for SimpleModuleBase 
    218186   // ======================================================================= 
     
    276244                 , const char   * p_messagetext /*  = NULL */ 
    277245                 ); 
    278     
    279     
     246 
    280247   // ======================================================================= 
    281248   //  METHODS FOR DERIVATIVE CLASSES TO OVER-RIDE TO EXTEND FUNCTIONALITY 
     
    294261    */ 
    295262   virtual bool PrepareToRun(); 
    296     
    297263 
    298264   /*  
     
    317283   virtual WORM_STATUS_CODE MainThreadActions() { return WORM_STAT_NOMATCH; } 
    318284 
    319  
    320285   /* CheckForFatal -- allows the main loop in the Run() method to query derived 
    321286    *                  classes if a fatal error has been encountered. 
     
    328293    */ 
    329294   virtual bool CheckForFatal(); 
    330  
    331295 
    332296   /* FinishedRunning() -- actions to take after exiting main loop in the 
     
    352316                           ,       char     * p_messagebody 
    353317                           ) { return true; }     
    354     
    355     
     318 
    356319   // ======================================================================= 
    357320   //  MAIN METHOD FOR DERIVATIVE CLASSES TO PROVIDE APPLICATION-SPECIFIC 
     
    373336                              ,       char     * p_messagebody 
    374337                              ) = 0; 
    375                                        
    376     
     338 
    377339public: 
    378  
    379340 
    380341   // ======================================================================= 
     
    408369      } 
    409370   } 
    410     
    411371 
    412372   // ======================================================================= 
Note: See TracChangeset for help on using the changeset viewer.