cint_stubs.h (3180B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: cint_stubs.h 8 * Purpose: stubs for CINT portability interfaces 9 */ 10 11 #ifndef _CINT_STUBS_H_ 12 #define _CINT_STUBS_H_ 13 14 #include <stdio.h> 15 #include <errno.h> 16 #include <stddef.h> 17 #include <stdarg.h> 18 19 extern int cint_stub_printf(const char *format, ...); 20 extern int cint_stub_vprintf(const char *format, va_list ap); 21 extern void *cint_stub_malloc(size_t size); 22 extern void *cint_stub_realloc(void *ptr, size_t size); 23 extern void cint_stub_free(void *ptr); 24 extern char *cint_stub_strrchr(const char *s, int c); 25 extern int cint_stub_strcmp(const char *s1, const char *s2); 26 extern char *cint_stub_strstr(const char *s1, const char *s2); 27 extern void *cint_stub_memcpy(void *dest, const void *src, size_t n); 28 extern void *cint_stub_memset(void *s, int c, size_t n); 29 extern int cint_stub_sprintf(char *str, const char *format, ...); 30 extern int cint_stub_snprintf(char *str, size_t size, const char *format, ...); 31 extern int cint_stub_vsnprintf(char *str, size_t size, const char *format, va_list ap); 32 extern char *cint_stub_strcat(char *dest, const char *src); 33 extern char *cint_stub_strdup(const char *s); 34 extern size_t cint_stub_strlen(const char *s); 35 extern char *cint_stub_strncpy(char *dest, const char *src, size_t n); 36 extern void cint_stub_fatal_error(const char *msg); 37 extern size_t cint_stub_fread(void *ptr, size_t size, size_t nmemb, FILE *stream); 38 extern int cint_stub_ferror(FILE *stream); 39 extern int cint_stub_getc(FILE *stream); 40 extern int cint_stub_ferror(FILE *stream); 41 extern FILE *cint_stub_fopen(const char *path, const char *mode); 42 extern int cint_stub_fclose(FILE *stream); 43 44 45 #define CINT_PRINTF cint_stub_printf 46 #define CINT_VPRINTF cint_stub_vprintf 47 #define CINT_MALLOC(sz) cint_stub_malloc(sz) 48 #define CINT_FREE cint_stub_free 49 #define CINT_STRRCHR cint_stub_strrchr 50 #define CINT_STRCMP cint_stub_strcmp 51 #define CINT_STRSTR cint_stub_strstr 52 #define CINT_MEMCPY cint_stub_memcpy 53 #define CINT_MEMSET cint_stub_memset 54 #define CINT_SPRINTF cint_stub_sprintf 55 #define CINT_SNPRINTF cint_stub_snprintf 56 #define CINT_VSNPRINTF cint_stub_vsnprintf 57 #define CINT_STRCAT cint_stub_strcat 58 #define CINT_STRDUP cint_stub_strdup 59 #define CINT_STRLEN cint_stub_strlen 60 61 #define CINT_STRNCPY cint_stub_strncpy 62 #define CINT_FATAL_ERROR(msg) cint_stub_fatal_error(msg); 63 64 #define CINT_FERROR cint_stub_ferror 65 #define CINT_GETC cint_stub_getc 66 67 /* File IO interfaces */ 68 #if CINT_CONFIG_FILE_IO == 1 69 #define CINT_FREAD cint_stub_fread 70 71 #if CINT_CONFIG_INCLUDE_XINCLUDE == 1 72 #define CINT_FOPEN cint_stub_fopen 73 #define CINT_FCLOSE cint_stub_fclose 74 #endif /* CINT_CONFIG_INCLUDE_XINCLUDE */ 75 76 #endif /* CINT_CONFIG_FILE_IO */ 77 78 #if CINT_CONFIG_INCLUDE_PARSER_READLINE == 1 79 #ifndef CINT_READLINE 80 extern char* readline(const char* p); 81 #define CINT_READLINE readline 82 #endif 83 #endif 84 85 #if CINT_CONFIG_INCLUDE_PARSER_ADD_HISTORY == 1 86 extern void add_history(char* p); 87 #ifndef CINT_ADD_HISTORY 88 #define CINT_ADD_HISTORY add_history 89 #endif 90 #endif 91 92 #endif /* _CINT_STUBS_H_ */