source: trunk/src/odincrt/odincrt.cpp@ 517

Last change on this file since 517 was 517, checked in by achimha, 26 years ago

CVS ID added

File size: 3.8 KB
Line 
1/* $Id: odincrt.cpp,v 1.6 1999-08-16 20:15:54 achimha Exp $ */
2/************************************************************************/
3/* odincrt.c */
4/************************************************************************/
5/* */
6/* Odin shared C runtime library for IBM VAC++ 3.08 */
7/* */
8/************************************************************************/
9/* Created: 99/08/08 */
10/* Last Edited: 99/00/08 */
11/************************************************************************/
12/* (C)'99 Patrick Haller, Achim Hasenmueller */
13/************************************************************************/
14
15/* we need all prototypes for the C runtime library */
16/****************************************************************************
17 * Includes *
18 ****************************************************************************/
19
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <odincrt.h>
24
25typedef unsigned short USHORT;
26
27
28/****************************************************************************
29 * Macros *
30 ****************************************************************************/
31
32#define ODIN_TEB_OFF { \
33 USHORT sel = RestoreOS2FS();
34
35#define ODIN_TEB_ON1(rc) SetFS(sel);\
36 return(rc);\
37 }
38
39#define ODIN_TEB_ON0() SetFS(sel);\
40 }
41
42
43/****************************************************************************
44 * Memory Management *
45 ****************************************************************************/
46
47void* ODINAPI ODIN_calloc ( size_t s1, size_t s2 )
48 ODIN_TEB_OFF
49 void* rc = calloc(s1,s2);
50 ODIN_TEB_ON1(rc)
51
52void* ODINAPI ODIN_realloc( void * p1, size_t s1 )
53 ODIN_TEB_OFF
54 void* rc = realloc(p1,s1);
55 ODIN_TEB_ON1(rc)
56
57void* ODINAPI ODIN_malloc (size_t size)
58 ODIN_TEB_OFF
59 void *rc = malloc(size);
60 ODIN_TEB_ON1(rc)
61
62void ODINAPI ODIN_free (void *ptr)
63 ODIN_TEB_OFF
64 free(ptr);
65 ODIN_TEB_ON0()
66
67void * ODINAPI ODIN_debug_calloc ( size_t s1, size_t s2, const char *p1, size_t s3)
68 ODIN_TEB_OFF
69 void* rc = _debug_calloc(s1,s2,p1,s3);
70 ODIN_TEB_ON1(rc)
71
72void ODINAPI ODIN_debug_free ( void *p1, const char *p2, size_t s1)
73 ODIN_TEB_OFF
74 _debug_free(p1,p2,s1);
75 ODIN_TEB_ON0()
76
77void * ODINAPI ODIN_debug_malloc ( size_t s1, const char * p1, size_t s2)
78 ODIN_TEB_OFF
79 void *rc = _debug_malloc(s1,p1,s2);
80 ODIN_TEB_ON1(rc)
81
82void * ODINAPI ODIN_debug_realloc( void *p1, size_t s1, const char *p2, size_t s2)
83 ODIN_TEB_OFF
84 void* rc = _debug_realloc(p1,s1,p2,s2);
85 ODIN_TEB_ON1(rc)
86
87
88
89
90/****************************************************************************
91 * String operations *
92 ****************************************************************************/
93
94char* ODINAPI ODIN_strdup( const char *s1)
95 ODIN_TEB_OFF
96 char *rc = strdup(s1);
97 ODIN_TEB_ON1(rc)
98
99
100/****************************************************************************
101 * C++ operator wrappers (experimental) *
102 ****************************************************************************/
103
104// operator new()
105//void* _Optlink ODIN__nw__FUi(unsigned int i)
106// ODIN_TEB_OFF
107// void* rc = __nw__FUi(i);
108// ODIN_TEB_ON1(rc)
109
Note: See TracBrowser for help on using the repository browser.