source: trunk/include/odincrt.h@ 488

Last change on this file since 488 was 484, checked in by phaller, 26 years ago

Fix: update

File size: 3.4 KB
Line 
1/* $Id: odincrt.h,v 1.3 1999-08-11 22:25:50 phaller Exp $ */
2
3/*
4 * Project Odin Software License can be found in LICENSE.TXT
5 *
6 * 1998/08/09
7 *
8 * Copyright 1998 Patrick Haller
9 */
10
11
12/*****************************************************************************
13 * Name : ORINCRT.H
14 * Purpose : This module maps all VAC++ runtime functions to thread-safe,
15 * Win32-TEB-safe functions.
16 *****************************************************************************/
17
18
19#ifndef __ODIN_H__
20#define __ODIN_H__
21
22
23#ifdef __cplusplus
24 extern "C" {
25#endif
26
27
28/****************************************************************************
29 * Macros *
30 ****************************************************************************/
31
32#define ODINAPI _Export _Optlink
33typedef unsigned short USHORT;
34
35
36#define ODIN_new( V,T)\
37{ \
38 USHORT sel = RestoreOS2FS(); \
39 V = new T; \
40 SetFS(sel);\
41}
42
43#define ODIN_delete( V)\
44{ \
45 USHORT sel = RestoreOS2FS(); \
46 delete V; \
47 SetFS(sel);\
48}
49
50#define ODIN_FS_BEGIN { USHORT sel = RestoreOS2FS();
51#define ODIN_FS_END SetFS(sel); }
52
53
54/****************************************************************************
55 * Internal Prototypes *
56 ****************************************************************************/
57
58void * _debug_calloc ( size_t, size_t, const char *, size_t );
59void _debug_free ( void *, const char *, size_t );
60void * _debug_malloc ( size_t, const char *, size_t );
61void * _debug_realloc( void *, size_t, const char *, size_t );
62
63
64/****************************************************************************
65 * External Prototypes *
66 ****************************************************************************/
67
68USHORT _System GetFS();
69USHORT _System RestoreOS2FS();
70void _System SetFS(USHORT selector);
71USHORT _System SetReturnFS(USHORT selector);
72
73
74/****************************************************************************
75 * Heap Management *
76 ****************************************************************************/
77
78void * ODINAPI ODIN_calloc ( size_t, size_t );
79void ODINAPI ODIN_free ( void * );
80void * ODINAPI ODIN_malloc ( size_t );
81void * ODINAPI ODIN_realloc ( void *, size_t );
82void * ODINAPI ODIN_debug_calloc ( size_t, size_t, const char *, size_t );
83void ODINAPI ODIN_debug_free ( void *, const char *, size_t );
84void * ODINAPI ODIN_debug_malloc ( size_t, const char *, size_t );
85void * ODINAPI ODIN_debug_realloc( void *, size_t, const char *, size_t );
86
87
88/****************************************************************************
89 * String Management *
90 ****************************************************************************/
91
92char* ODINAPI ODIN_strdup ( const char * );
93
94
95/****************************************************************************
96 * C++ wrappers (experimental) *
97 ****************************************************************************/
98
99void* ODINAPI __nw__FUi ( unsigned int i ); // operator new()
100
101//@@@PH ODIN_new(myClass, ##myParams) new ....
102//@@@PH ODIN_delete(myObject) ... delete myObject ...
103
104#ifdef __cplusplus
105 }
106#endif
107
108#endif /* __ODIN_H_ */
109
Note: See TracBrowser for help on using the repository browser.