📄 sdk_comn.h
字号:
/* Copyright 2000, ESS Technology, Inc. *//* SCCSID @(#)sdk_comn.h 1.1 10/16/01 *//* Based on DVD/SVCD version 1.1 12/01/00 *//* $Id$ *//* * $Log$ *//* * standard library function declaration and re-definement * 1. memory management functions * 2. string manipulation functions * * version history * */#ifdef __cplusplusextern "C" {#endif#if defined(LUX)|| defined(III_MTDOS) || defined(USE_NUCLEUS) || defined(VESTEL) || defined(ESS) || defined(BROADCOM_PSOS) || (defined(WIN32) && defined(NDEBUG)) || defined(LSI) || defined(TRIMEDIA) || (defined(IBM_STB) && !defined(IBM_STB_PC))#undef HAVE_STDC_MALLOC#define HAVE_STDC_STRING#elif defined(__linux__) || defined(__sun__)#define HAVE_STDC_MALLOC 1#define HAVE_STDC_STRING 1#define DEBUG_MALLOC#else#define HAVE_STDC_MALLOC 1#define HAVE_STDC_STRING 1#endif#if defined(WIN32) && defined(_DEBUG) && defined(HAVE_STDC_MALLOC)#define DEBUG_MALLOC#endif/* YOU HAVE TO INCLUDE STANDARD HEADER FILE FIRST */#ifdef HAVE_STDC_MALLOC#include <stdlib.h>#endif#ifdef HAVE_STDC_STRING#include <string.h>#endif/********************** MEMORY *********************/#define global_malloc sdk_malloc#define global_realloc sdk_realloc#define global_free sdk_free#define sdk_trace_malloc_id sdk_malloc_id#define sdk_size_t size_t#if defined(HAVE_STDC_MALLOC) #define sdk_memcpy memcpy #define sdk_memmove memmove #define sdk_memset memset#if !defined(DEBUG_MALLOC) #define sdk_malloc malloc #define sdk_calloc calloc #define sdk_free free #define sdk_realloc realloc #define sdk_malloc_id(nbytes, id, file,line) malloc(nbytes)#else /* DEBUG_MALLOC defined */ #define sdk_malloc(sz) sdk_trace_malloc(sz,__FILE__,__LINE__) #define sdk_calloc(n,sz) sdk_trace_calloc(n,sz,__FILE__,__LINE__) #define sdk_realloc(p,sz) sdk_trace_realloc(p,sz,__FILE__,__LINE__) #define sdk_free(p) sdk_trace_free(p,__FILE__,__LINE__) void *sdk_trace_malloc(unsigned long sz,const char *file, int line); void *sdk_trace_malloc_id(unsigned long sz,unsigned id,const char *file, int line); void *sdk_trace_realloc(void *ptr, unsigned long sz,const char *file, int line); void sdk_trace_free(void *ptr,const char *file, int line); void *sdk_trace_calloc(int nbytes,int size, const char *file, int line);#endif /* DEBUG_MALLOC */#else /* HAVE_STDC_MALLOC not defiend */#ifndef IBM_STB #define malloc sdk_malloc #define realloc sdk_realloc #define free sdk_free#endif#if defined(USE_NUCLEUS) typedef unsigned long size_t;#endif void *sdk_malloc(size_t sz); void sdk_free(void *ptr); void *sdk_realloc(void *ptr, size_t sz); void *sdk_malloc_id(size_t sz, unsigned char id, const char *file, int line);#if defined(HAVE_STDC_STRING) ||(defined(WIN32) && defined(NDEBUG)) #define sdk_memcpy memcpy #define sdk_memmove memmove #define sdk_memset memset#else #define memcpy sdk_memcpy #define memset sdk_memset #define memmove sdk_memmove void *sdk_memset(void *, int, int); void *sdk_memcpy(void *, const void *, size_t); void *sdk_memmove(void *, const void *, size_t);#endif#endif /* HAVE_STDC_MALLOC *//********************** STRING *********************/#ifdef HAVE_STDC_STRING #define sdk_sprintf sprintf #define sdk_strstr strstr #define sdk_strncat strncat #define sdk_strcat strcat #define sdk_strlen strlen #define sdk_strncpy strncpy #define sdk_strcpy strcpy #define sdk_strncmp strncmp #define sdk_strnicmp strnicmp #define sdk_strcmp strcmp #define sdk_strspn strspn #define sdk_strtok strtok #define sdk_abs abs #define sdk_toupper toupper #define sdk_atof atof #define sdk_strtol strtol #define sdk_atoi atoi #define sdk_ltoa ltoa #define sdk_itoa itoa #define sdk_tolower tolower #define sdk_isalpha isalpha #define sdk_isspace isspace #define sdk_isdigit isdigit #define sdk_isgraph isgraph#if defined(DEBUG_MALLOC) char *sdk_trace_strdup( char *_s, const char *file, int line); char *my_strdup(const char *_s); #define sdk_strdup(s) sdk_trace_strdup(s,__FILE__,__LINE__)#elif defined(HAVE_STDC_MALLOC) #define sdk_strdup strdup #else char *sdk_strdup(const char *);#endif#else char *strcpy(char *dest, const char *src); char *strncpy(char *dest, const char *src, size_t n); char *strcat(char *dest, const char *src); char *strncat(char *dest, const char *src, size_t n); char *strdup(const char *src); char *strtok(char *s, const char *delim); char *strstr(const char *haystack, const char *needle); long int strtol(const char *nptr, char **endptr, int base); int toupper (int c); int tolower (int c); int isalnum (int c); int isalpha (int c); int isascii (int c); int isblank (int c); int iscntrl (int c); int isdigit (int c); int isgraph (int c); int islower (int c); int isprint (int c); int ispunct (int c); int isspace (int c); int isupper (int c); int isxdigit (int c);#endif #ifdef __cplusplus}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -