Changeset 6 in libcf


Ignore:
Timestamp:
01/30/13 17:17:16 (11 years ago)
Author:
cheese
Message:

#1 add debug util and arrange some code

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/cf_base.h

    r4 r6  
    88    CF_TRUE = 0,
    99    CF_FALSE = 1
    10 } E_CF_BOOL;
     10} E_CF_BOOL, CF_BOOL;
    1111
    1212#define CF_OK                           0
    1313#define CF_ERROR                        -1
     14
    1415#define CF_ERROR_BASE                   CF_ERROR * 1000
     16
     17#define CF_ERROR_FILE                   CF_ERROR_BASE * 2
     18#define CF_ERROR_SOCKET                 CF_ERROR_BASE * 3
     19#define CF_ERROR_THREAD                 CF_ERROR_BASE * 4
     20#define CF_ERROR_MUTEX                  CF_ERROR_BASE * 5
     21#define CF_ERROR_DEBUG                  CF_ERROR_BASE * 6
    1522
    1623#ifdef _WIN32
  • trunk/include/cf_file.h

    r5 r6  
    77#include "cf_base.h"
    88#include <fcntl.h>
    9 
    10 #define CF_ERROR_FILE                   CF_ERROR_BASE * 2
    119
    1210#define CF_ERROR_FILE_OPEN              CF_ERROR_FILE - 1
  • trunk/include/cf_socket.h

    r4 r6  
    77#include "cf_base.h"
    88#include <stddef.h>
    9 
    10 #ifdef _WIN32
    11 typedef int socklen_t;
    12 #endif // #ifdef _WIN32
    13 
    14 #define CF_ERROR_SOCKET                 CF_ERROR_BASE * 3
    159
    1610#define CF_ERROR_SOCKET_INITIALIZE      CF_ERROR_SOCKET - 1
     
    3226#define CF_ERROR_SOCKET_RECV            CF_ERROR_SOCKET - 17
    3327
     28#ifdef _WIN32
     29typedef int socklen_t;
     30#endif // #ifdef _WIN32
     31
    3432#ifdef __cplusplus
    3533extern "C" {
    3634#endif
    3735
    38 CF_EXPORT E_CF_BOOL
     36CF_EXPORT CF_BOOL
    3937CF_Socket_IsInitialized (void);
    4038
  • trunk/include/cf_thread.h

    r5 r6  
    66
    77#include "cf_base.h"
     8
     9#define CF_ERROR_THREAD_CREATE          CF_ERROR_THREAD - 1
     10#define CF_ERROR_THREAD_INVALID_ARGS    CF_ERROR_THREAD - 2
     11
     12#define CF_ERROR_MUTEX_CREATE           CF_ERROR_MUTEX - 1
     13#define CF_ERROR_MUTEX_INVALID_ARGS     CF_ERROR_MUTEX - 2
    814
    915#ifdef _WIN32
     
    1723
    1824typedef CF_THREAD_RETURN  (CF_THREAD_CALL * CF_Thread_Function) (void *);
    19 
    20 #define CF_ERROR_THREAD                 CF_ERROR_BASE * 4
    21 #define CF_ERROR_THREAD_CREATE          CF_ERROR_THREAD - 1
    22 #define CF_ERROR_THREAD_INVALID_ARGS    CF_ERROR_THREAD - 2
    23 
    24 #define CF_ERROR_MUTEX                  CF_ERROR_BASE * 5
    25 #define CF_ERROR_MUTEX_CREATE           CF_ERROR_MUTEX - 1
    26 #define CF_ERROR_MUTEX_INVALID_ARGS     CF_ERROR_MUTEX - 2
    2725
    2826typedef void *  CF_Thread;
  • trunk/src/cf_socket.c

    r5 r6  
    2828        return CF_ERROR_SOCKET_INVALID_SOCKET
    2929
    30 E_CF_BOOL gInitialized = CF_FALSE;
    31 
    32 E_CF_BOOL
     30CF_BOOL gInitialized = CF_FALSE;
     31
     32CF_BOOL
    3333CF_Socket_IsInitialized (void)
    3434{
  • trunk/src/makefile

    r4 r6  
    4040                    cf_socket       \
    4141                    cf_thread       \
     42                    cf_debug        \
    4243
    4344LIB_NAME        = CF
Note: See TracChangeset for help on using the changeset viewer.