windows/PlatformDefinitions.h
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.oorexx.org/license.html */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 /******************************************************************************/
39 /* REXX WIN32 Support winrexx.h */
40 /* */
41 /* WIN32 master definition file */
42 /* */
43 /******************************************************************************/
44 
45 /******************************************************************************/
46 /* Template for system specific declarations for Object REXX. The following */
47 /* sections are a series of required and optional sections where system */
48 /* specific information is provided to the rest of the interpreter code. */
49 /* Wherever possible, reasonable defaults are provided for these settings. */
50 /******************************************************************************/
51 
52 #ifndef WINREXX_H /* provide a define here to protect */
53 #define WINREXX_H /* against multiple includes */
54 
55 /******************************************************************************/
56 /* REQUIRED: The implemenation must decide on the C_STACK_SIZE defining */
57 /* constants that are compiler/linker dependent. */
58 /******************************************************************************/
59 // we need a little more space on 64-bit platforms, so add some padding based on
60 // the size of a pointer
61 #define MIN_C_STACK 1024*(32 + sizeof(void *))
62 // official settings are not enough to execute RosetaCode ackermann-function-1.rexx
63 // multiply by 2: silently stop before the end when stack overflow
64 // multiply by 4: silently stop before the end when stack overflow
65 // multiply by 8: silently stop before the end when stack overflow
66 // back to the initial setting
67 #define TOTAL_STACK_SIZE 1024*512
68 #define C_STACK_SIZE TOTAL_STACK_SIZE
69 
70 #define SysCall _cdecl
71 
72 /******************************************************************************/
73 /* OPTIONAL: Perform stack bounds checking on new message invocations. If */
74 /* this is a non-stack based calling convention, or it is not possible to */
75 /* determine the bounds of the stack, leave this undefined. */
76 /******************************************************************************/
77 #define STACKCHECK
78 
79 /******************************************************************************/
80 /* OPTIONAL: No time slicing support for REXX activation yields is available.*/
81 /* Code will yield after a given count of instructions. */
82 /******************************************************************************/
83 //
84 // timers in windows only get called back at yield boundaries
85 //
86 //#define NOTIMER // used in activa, activi for
87  // count based yielding
88 
89 /******************************************************************************/
90 /* OPTIONAL: Enable concurrency timeslice dispatching support. Default is */
91 /* only yield at specific event points. */
92 /******************************************************************************/
93 // Make this clearer? Mutually exclusive with NOTIMER?
94 #define TIMESLICE
95 #define FIXEDTIMERS
96 
97 /******************************************************************************/
98 /* OPTIONAL: If the implementation enables external scripting support, then */
99 /* additional hand-shaking with an the exernal environment is enabled for */
100 /* providing default values for uninitialized variables. */
101 /******************************************************************************/
102 #define SCRIPTING
103 
104 /******************************************************************************/
105 /* REQUIRED: Define the string used for the default initial address setting. */
106 /******************************************************************************/
107 
108 #define SYSINITIALADDRESS "CMD"
109 
110 /******************************************************************************/
111 /* REQUIRED: Define the name of the image file that is saved and restored. */
112 /******************************************************************************/
113 
114 #define BASEIMAGE "rexx.img"
115 
116 /******************************************************************************/
117 /* REQUIRED: Define the name of the program called to load create the saved */
118 /* image file. */
119 /******************************************************************************/
120 
121 #define BASEIMAGELOAD "CoreClasses.orx"
122 
123 /******************************************************************************/
124 /* REQUIRED: Name of the file used to store the external message repository */
125 /******************************************************************************/
126 #define REXXMESSAGEFILE "winatab.rc"
127 
128 /******************************************************************************/
129 /* REQUIRED: define the path delimiter and end of line information */
130 /* appropriate for this file system. */
131 /******************************************************************************/
132 
133 #define delimiter '\\'
134 #define line_end "\r\n"
135 #define line_end_size 2
136 
137 /******************************************************************************/
138 /* OPTIONAL: Overrides for any functions defined in sysdef.h. These */
139 /* can map the calls directly to inline code or comment them out all together.*/
140 /******************************************************************************/
141 
142 #define DEFRXSTRING 256 /* Default RXSTRING return size */
143 
144 /******************************************************************************/
145 /* OPTIONAL: Finally, any other global defined constants for system specific */
146 /* code usage. */
147 /******************************************************************************/
148  // Re-directed output...
149  #include <stdio.h> // for following file ref...
150  // another annoying incompatibility in MS compiler.
151  #if _MSC_VER < 1800
152 #define isnan(x) _isnan(x)
153 #endif
154 
155  // Exception handling
156  typedef BOOL __stdcall CONSOLECTRLHANDLER(DWORD);
158 
159  #define WinBeginExceptions SetConsoleCtrlHandler(&WinConsoleCtrlHandler, true);\
160  __try {
161  #define WinEndExceptions } __except ( WinExceptionFilter(GetExceptionCode( ))) { }\
162  SetConsoleCtrlHandler(&WinConsoleCtrlHandler, FALSE);
163 
164  int WinExceptionFilter( int xCode );
165 #endif
166 
CONSOLECTRLHANDLER WinConsoleCtrlHandler
BOOL __stdcall CONSOLECTRLHANDLER(DWORD)
int WinExceptionFilter(int xCode)