Changeset 66 in libcf
- Timestamp:
- 04/11/13 13:02:05 (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf_debug.h
r64 r66 2 2 * @file cf_debug.h 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 * 6 5 * @remark … … 8 7 * Preprocessor에 _DEBUG가 정의되어 있는 경우에 만 9 8 * 디버그 코드가 동작하도록 할 수 있음 <br /> 10 * 디버그 메시지는 stdout 및 stderr를 이용한 파일 포인터 출력을 지원하고, 11 * 환경에 적합하도록 사용자가 구성한 컨텍스트를 이용하여 사용할 수도 있음 <br /> 12 * (단, 콜스택의 푸시/팝은 컨텍스트를 이용해야만 사용 가능) 9 * 디버그 메시지는 stdout 및 stderr 등의 파일 포인터 출력을 지원함 13 10 * 14 11 * @example debug.c … … 20 17 21 18 #include <stdio.h> 19 #include <stddef.h> 22 20 23 21 /** Windows 함수 이름 매크로 재정의 */ … … 121 119 const int line, 122 120 const unsigned char * bin, 123 const intlen,121 const size_t len, 124 122 const char * fmt, ...); 125 123 -
trunk/include/cf_error.h
r51 r66 1 /** 2 * @file cf_error.h 3 * @author myusgun <myusgun@gmail.com> 4 */ 1 5 #ifndef __CF_ERROR_H__ 2 6 #define __CF_ERROR_H__ … … 88 92 /* }}} log */ 89 93 94 /* codec {{{ */ 95 #define CF_ERROR_CODEC CF_ERROR_BASE * 8 96 /*------------------------------------------------------------*/ 97 #define CF_ERROR_CODEC_INVALID_ARGS CF_ERROR_CODEC - 1 98 #define CF_ERROR_CODEC_NOT_HEXSTRING CF_ERROR_CODEC - 2 99 /* }}} codec */ 100 90 101 91 102 #endif // #ifndef __CF_ERROR_H__ -
trunk/include/cf_file.h
r41 r66 2 2 * @file cf_file.h 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 * 6 5 * @example file.c -
trunk/include/cf_log.h
r40 r66 2 2 * @file cf_log.h 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.1 4 * 5 * @remark 6 * 매핑 ID 값을 이용하여 해당 로그에 기록 <br /> 7 * 로그 레벨을 적용할 때도 용이하며 define 이나 enumeration 등을 활용하면 좋음 5 8 * 6 9 * @example log.c -
trunk/include/cf_socket.h
r53 r66 2 2 * @file cf_socket.h 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 * 6 5 * @remark TCP 소켓만 지원됨 -
trunk/include/cf_thread.h
r59 r66 2 2 * @file cf_thread.h 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 * 6 5 * @remark 멀티스레드 및 뮤텍스 지원 -
trunk/src/cf_debug.c
r63 r66 2 2 * @file cf_debug.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_debug.h" … … 105 104 const int line, 106 105 const unsigned char * bin, 107 const intlen)106 const size_t len) 108 107 { 109 108 int i, j; … … 186 185 const int line, 187 186 const unsigned char * bin, 188 const int len,187 const size_t len, 189 188 const char * fmt, ...) 190 189 { -
trunk/src/cf_file.c
r58 r66 2 2 * @file cf_file.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_file.h" 6 #include "cf_local.h" 7 7 #include "cf_error.h" 8 8 … … 18 18 # define mkdir(a,b) _mkdir (a) 19 19 # define access(a,b) _access (a,b) 20 # define snprintf _snprintf21 20 22 21 # define F_OK 0 -
trunk/src/cf_local.h
r23 r66 1 1 /** 2 * cf_local.h 2 * @file cf_local.h 3 * @author myusgun <myusgun@gmail.com> 3 4 */ 4 5 #ifndef __CF_LOCAL_H__ … … 12 13 #define CATCH_ELSE else 13 14 15 #if defined(_WIN32) || defined(_WIN64) 16 # define snprintf _snprintf 17 #else 18 #endif 19 14 20 #endif // #ifndef __CF_LOCAL_H__ -
trunk/src/cf_log.c
r64 r66 2 2 * @file cf_log.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #if defined(_WIN32) || defined(_WIN64) … … 21 20 22 21 #if defined(_WIN32) || defined(_WIN64) 23 # define snprintf _snprintf24 22 # include <Windows.h> 25 23 #else … … 76 74 77 75 #if defined(_WIN32) || defined(_WIN64) 78 /* #if defined(_WIN32) || defined(_WIN64){{{ */76 /* {{{ */ 79 77 struct timezone 80 78 { 81 int tz_minuteswest; 82 int tz_dsttime; 79 int tz_minuteswest; /* minutes W of Greenwich */ 80 int tz_dsttime; /* type of dst correction */ 83 81 }; 84 82 85 // Definition of a gettimeofday function 86 int gettimeofday(struct timeval *tv, struct timezone *tz) 87 { 88 // Define a structure to receive the current Windows filetime 89 FILETIME ft; 90 91 // Initialize the present time to 0 and the timezone to UTC 92 unsigned __int64 ui64 =0; 83 int gettimeofday (struct timeval *tv, struct timezone *tz) 84 { 85 FILETIME ft; 86 unsigned __int64 buf =0; 93 87 //static int tzflag = 0; 94 88 95 89 if (NULL != tv) 96 90 { 97 GetSystemTimeAsFileTime(&ft); 98 99 ui64 = (((unsigned __int64) ft.dwHighDateTime << 32) 100 + (unsigned __int64) ft.dwLowDateTime); 101 102 if (ui64) 103 { 104 ui64 /= 10; 105 ui64 -= ((369 * 365 + 89) * (unsigned __int64) 86400) * 1000000; 106 } 107 108 // Finally change microseconds to seconds and place in the seconds value. 109 // The modulus picks up the microseconds. 110 tv->tv_sec = (long)(ui64 / 1000000UL); 111 tv->tv_usec = (long)(ui64 % 1000000UL); 91 GetSystemTimeAsFileTime (&ft); 92 93 buf |= ft.dwHighDateTime; 94 buf <<= 32 95 buf |= ft.dwLowDateTime; 96 97 if (buf) 98 { 99 buf /= 10; 100 buf -= ((369 * 365 + 89) * (unsigned __int64) 86400) * 1000000; 101 } 102 103 tv->tv_sec = (long)(buf / 1000000UL); 104 tv->tv_usec = (long)(buf % 1000000UL); 112 105 } 113 106 … … 129 122 return 0; 130 123 } 131 /* }}} #if defined(_WIN32) || defined(_WIN64)*/124 /* }}} */ 132 125 #endif 133 126 -
trunk/src/cf_socket.c
r55 r66 2 2 * @file cf_socket.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_socket.h" -
trunk/src/cf_thread.c
r65 r66 2 2 * @file cf_thread.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_thread.h" -
trunk/src/makefile
r14 r66 42 42 cf_debug \ 43 43 cf_log \ 44 cf_codec \ 44 45 45 46 TARGET_NAME = cf -
trunk/test/debug.c
r64 r66 2 2 * @file debug.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_file.h" -
trunk/test/file.c
r41 r66 2 2 * @file file.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_file.h" -
trunk/test/log.c
r40 r66 2 2 * @file log.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_log.h" -
trunk/test/socket_client.c
r48 r66 2 2 * @file socket_client.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_socket.h" -
trunk/test/socket_server.c
r53 r66 2 2 * @file socket_server.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_socket.h" -
trunk/test/test.c
r64 r66 2 2 * @file test.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_file.h" -
trunk/test/thread.c
r57 r66 2 2 * @file thread.c 3 3 * @author myusgun <myusgun@gmail.com> 4 * @version 0.15 4 */ 6 5 #include "cf_thread.h"
Note:
See TracChangeset
for help on using the changeset viewer.