campo-sirio/include/mshell.h

102 lines
2.7 KiB
C
Raw Normal View History

#ifndef __MSHELL_H
#define __MSHELL_H
#ifdef XVT_OS
#ifdef __cplusplus
extern "C" {
#endif
#if XVT_OS == XVT_OS_NOTUSED
#define ALIGNSIZE sizeof(double)
#define CALCSIZE(x) ((((x) + (ALIGNSIZE - 1)) / ALIGNSIZE) * ALIGNSIZE)
#define malloc(a) win_malloc((a))
#define realloc(a,b) win_realloc((a), (b))
#define free(a) win_free((a))
#define calloc(a,b) win_calloc((a), (b))
#define strdup(a) win_strdup((a))
void setmemsize(long);
char* win_malloc(size_t);
char* win_realloc(char*, size_t);
void win_free(char*);
char* win_calloc(size_t, size_t);
char* win_strdup(char*);
#else
/*
#define malloc(a) xvt_fmalloc((a))
#define realloc(a,b) xvt_frealloc((a), (b))
#define free(a) xvt_ffree((a))
#define calloc(a,b) xvt_calloc((a), (b))
#define strdup(a) xvt_strdup((a))
#define setmemsize(a)
char *xvt_calloc(size_t, size_t);
char *xvt_strdup(char*);
*/
#endif
#ifdef __cplusplus
};
#endif
#else
#define size_t unsigned
#define MEMLIST
#define MEMWHERE
/* interface functions */
unsigned long memused(void);
void memdisplay(FILE *);
/* interface macros */
#define ALIGNSIZE sizeof(double)
#define CALCSIZE(x) ((((x) + (ALIGNSIZE - 1)) / ALIGNSIZE) * ALIGNSIZE)
/* interface functions to access only through macros */
#ifdef MEMWHERE
#ifdef __cplusplus
extern "C" {
#endif
char *memalloc(size_t, char *, int);
char *memrealloc(char *, size_t, char *, int);
void memfree(char *, char *, int);
char *memcalloc(size_t, size_t, char *, int);
char *memstrdup(char *, char *, int);
#else
char *memalloc(size_t);
char *memrealloc(char *);
void memfree(char *);
char *memcalloc(size_t, size_t);
char *memstrdup(char *);
#ifdef __cplusplus
};
#endif
#endif
/* Interface macros */
#ifndef __MSHELL__
#ifdef MEMWHERE
#define malloc(a) memalloc((a), __FILE__, __LINE__)
#define realloc(a,b) memrealloc((a), (b), __FILE__, __LINE__)
#define free(a) memfree((a), __FILE__, __LINE__)
#define calloc(a,b) memcalloc((a), (b), __FILE__, __LINE__)
#define strdup(a) memstrdup((a), __FILE__, __LINE__)
#else
#define malloc(a) memalloc((a))
#define realloc(a,b) memrealloc((a), (b))
#define free(a) memfree((a))
#define calloc(a,b) memcalloc((a), (b))
#define strdup(a) memstrdup((a))
#endif
#endif
#endif /* XVT_OS */
#endif /* __MSHELL_H */