]> icculus.org git repositories - taylor/freespace2.git/blob - include/pstypes.h
Initial revision
[taylor/freespace2.git] / include / pstypes.h
1 /*
2  * $Logfile: /Freespace2/code/GlobalIncs/PsTypes.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file containg global typedefs, constants and macros
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 34    6/16/00 3:16p Jefff
15  * sim of the year dvd version changes, a few german soty localization
16  * fixes
17  * 
18  * 33    10/05/99 2:29p Danw
19  * 
20  * 32    10/01/99 9:10a Daveb
21  * V 1.1 PATCH
22  * 
23  * 31    9/13/99 12:22a Dave
24  * Minor build update.
25  * 
26  * 30    8/28/99 4:54p Dave
27  * Fixed directives display for multiplayer clients for wings with
28  * multiple waves. Fixed hud threat indicator rendering color.
29  * 
30  * 29    8/09/99 4:18p Andsager
31  * Make french and german defines, needed specifically to enable language
32  * under launcher misc. tab
33  * 
34  * 28    7/20/99 1:49p Dave
35  * Peter Drake build. Fixed some release build warnings.
36  * 
37  * 27    7/18/99 5:19p Dave
38  * Jump node icon. Fixed debris fogging. Framerate warning stuff.
39  * 
40  * 26    7/15/99 9:21a Andsager
41  * FS2_DEMO check in
42  * 
43  * 25    7/09/99 9:51a Dave
44  * Added thick polyline code.
45  * 
46  * 24    6/29/99 10:35a Dave
47  * Interface polygon bitmaps! Whee!
48  * 
49  * 23    6/14/99 10:45a Dave
50  * Made beam weapons specify accuracy by skill level in the weapons.tbl
51  * 
52  * 22    6/03/99 10:15p Dave
53  * Put in temporary main hall screen.
54  * 
55  * 21    5/09/99 8:57p Dave
56  * Final E3 build preparations.
57  * 
58  * 20    4/25/99 7:43p Dave
59  * Misc small bug fixes. Made sun draw properly.
60  * 
61  * 19    4/25/99 3:03p Dave
62  * Removed E3_BUILD from pstypes
63  * 
64  * 18    4/25/99 3:02p Dave
65  * Build defines for the E3 build.
66  * 
67  * 17    4/15/99 1:29p Dave
68  * Remove multiplayer beta build define.
69  * 
70  * 16    4/15/99 1:24p Dave
71  * Final Beta 1 checkin.
72  * 
73  * 15    4/14/99 5:28p Dave
74  * Minor bug fixes.
75  * 
76  * 14    4/12/99 2:22p Dave
77  * More checks for dogfight stats.
78  * 
79  * 13    4/09/99 2:21p Dave
80  * Multiplayer beta stuff. CD checking.
81  * 
82  * 12    2/25/99 4:19p Dave
83  * Added multiplayer_beta defines. Added cd_check define. Fixed a few
84  * release build warnings. Added more data to the squad war request and
85  * response packets.
86  * 
87  * 11    2/23/99 2:29p Dave
88  * First run of oldschool dogfight mode. 
89  * 
90  * 10    2/07/99 8:51p Andsager
91  * Add inner bound to asteroid field.  Inner bound tries to stay astroid
92  * free.  Wrap when within and don't throw at ships inside.
93  * 
94  * 9     1/15/99 11:29a Neilk
95  * Fixed D3D screen/texture pixel formatting problem. 
96  * 
97  * 8     1/08/99 2:08p Dave
98  * Fixed software rendering for pofview. Super early support for AWACS and
99  * beam weapons.
100  * 
101  * 7     1/06/99 2:24p Dave
102  * Stubs and release build fixes.
103  * 
104  * 6     11/30/98 1:07p Dave
105  * 16 bit conversion, first run.
106  * 
107  * 5     11/05/98 4:18p Dave
108  * First run nebula support. Beefed up localization a bit. Removed all
109  * conditional compiles for foreign versions. Modified mission file
110  * format.
111  * 
112  * 4     10/13/98 9:28a Dave
113  * Started neatening up freespace.h. Many variables renamed and
114  * reorganized. Added AlphaColors.[h,cpp]
115  * 
116  * 3     10/07/98 11:28a Dave
117  * 
118  * 2     10/07/98 10:52a Dave
119  * Initial checkin.
120  * 
121  * 1     10/07/98 10:48a Dave
122  * 
123  * 75    8/20/98 5:30p Dave
124  * Put in handy multiplayer logfile system. Now need to put in useful
125  * applications of it all over the code.
126  * 
127  * 74    6/17/98 11:01a Lawrance
128  * set correct offset for English special font chars
129  * 
130  * 73    6/12/98 4:52p Hoffoss
131  * Added support for special characters in in forgeign languages.
132  * 
133  * 72    6/09/98 6:49p Lawrance
134  * Comment out UK_BUILD
135  * 
136  * 71    6/09/98 5:15p Lawrance
137  * French/German localization
138  * 
139  * 70    6/09/98 12:12p Hoffoss
140  * Added XSTR localization code.
141  * 
142  * 69    6/05/98 9:49a Lawrance
143  * OEM changes
144  * 
145  * 68    5/22/98 3:13p Allender
146  * no Int3()'s and Asserts
147  * 
148  * 67    5/20/98 12:59p John
149  * Turned optimizations on for debug builds.   Also turning on automatic
150  * function inlining.  Turned off the unreachable code warning.
151  * 
152  * 66    5/04/98 1:49p Allender
153  * make Int3's do nothing when InterplayQA is defined
154  * 
155  * 65    4/25/98 11:55p Lawrance
156  * compile out Int3() and Assert() for release demo build
157  * 
158  *
159  * $NoKeywords: $
160  *
161  */
162
163 #ifndef _PSTYPES_H
164 #define _PSTYPES_H
165
166
167 // Build defines.  Comment in/out for whatever build is necessary:
168 // #define OEM_BUILD                                            // enable for OEM builds
169 // #define MULTIPLAYER_BETA_BUILD                               // enable for multiplayer beta build
170 // #define E3_BUILD                                                     // enable for 3dfx E3 build                                             
171 // #define PRESS_TOUR_BUILD                     // enable for press tour build
172 // #define FS2_DEMO                                     // enable demo build for FS2
173 // #define PD_BUILD                                             // fred documentation/evaluation build
174 //      #define FRENCH_BUILD                            // build for French (obsolete)
175 // #define GERMAN_BUILD                         // build for German (this is now used)
176 #define RELEASE_REAL                                    // this means that it is an actual release candidate, not just an optimized/release build
177
178 // uncomment this #define for DVD version (makes popups say DVD instead of CD 2 or whatever): JCF 5/10/2000
179 // #define DVD_MESSAGE_HACK
180
181
182 #if defined(MULTIPLAYER_BETA_BUILD) || defined(E3_BUILD) || defined(RELEASE_REAL)
183         #define GAME_CD_CHECK
184 #endif
185
186 // 4127 is constant conditional (assert)
187 // 4100 is unreferenced formal parameters,
188 // 4514 is unreferenced inline function removed, 
189 // 4201 is nameless struct extension used. (used by windows header files)
190 // 4410 illegal size for operand... ie...       fxch st(1)
191 // 4611 is _setjmp warning.  Since we use setjmp alot, and we don't really use constructors or destructors, this warning doesn't really apply to us.
192 // 4725 is the pentium division bug warning, and I can't seem to get rid of it, even with this pragma.
193 //      JS: I figured out the disabling 4725 works, but not on the first function in the module.
194 //      So to disable this, I add in a stub function at the top of each module that does nothing.
195 // 4710 is inline function not expanded (who cares?)
196 // 4711 tells us an inline function was expanded (who cares?)
197 // 4702 unreachable code.  I care, but too many to deal with
198 // 4201 nonstandard extension used : nameless struct/union (happens a lot in Windows include headers)
199 // 4390 emptry control statement (triggered by nprintf and mprintf's inside of one-line if's, etc)
200 #ifndef PLAT_UNIX
201 #pragma warning(disable: 4127 4100 4514 4201 4410 4611 4725 4710 4711 4702 4201 4390)
202 #endif
203
204 #include <stdio.h>      // For NULL, etc
205 #include <stdlib.h>
206 #include <memory.h>
207 #include <malloc.h>
208 #include <string.h>
209
210 #ifdef PLAT_UNIX
211 #include "unix.h"
212 #endif
213 // value to represent an uninitialized state in any int or uint
214 #define UNINITIALIZED 0x7f8e6d9c
215
216 #if defined(DEMO) || defined(OEM_BUILD) // no change for FS2_DEMO
217         #define MAX_PLAYERS     1
218 #else
219         #define MAX_PLAYERS     12
220 #endif
221
222 #define MAX_TEAMS               3
223
224 #define USE_INLINE_ASM 1                // Define this to use inline assembly
225 #define STRUCT_CMP(a, b) memcmp((void *) &a, (void *) &b, sizeof(a))
226
227 #define LOCAL static                    // make module local varilable static.
228
229 typedef __int64 longlong;
230 typedef long fix;
231 typedef unsigned char ubyte;
232 typedef unsigned short ushort;
233 typedef unsigned int uint;
234
235 #define HARDWARE_ONLY
236
237 //Stucture to store clipping codes in a word
238 typedef struct ccodes {
239         ubyte vor,vand; //or is low byte, and is high byte
240 } ccodes;
241
242 typedef struct vector {
243         union {
244                 struct {
245                         float x,y,z;
246                 };
247                 float a1d[3];
248         };
249 } vector;
250
251 // A vector referenced as an array
252 typedef struct vectora {
253         float   xyz[3];
254 } vectora;
255
256 typedef struct vec2d {
257         float i,j;
258 } vec2d;
259
260 // Used for some 2d primitives, like gr_poly
261 typedef struct vert2df {
262         float x, y;
263 } vert2df;
264
265 typedef struct angles {
266         float   p, b, h;
267 } angles_t;
268
269 typedef struct matrix {
270         union {
271                 struct {
272                         vector  rvec, uvec, fvec;
273                 };
274                 float a2d[3][3];
275                 float a1d[9];
276         };
277 } matrix;
278
279 typedef struct uv_pair {
280         float u,v;
281 } uv_pair;
282
283 // Used to store rotated points for mines.
284 // Has flag to indicate if projected.
285 typedef struct vertex {
286         float           x, y, z;                                // world space position
287         float           sx, sy, sw;                     // screen space position (sw == 1/z)
288         float           u, v;                                   // texture position
289         ubyte           r, g, b, a;                     // color.  Use b for darkening;
290         ubyte           codes;                          // what sides of view pyramid this point is on/off.  0 = Inside view pyramid.
291         ubyte           flags;                          // Projection flags.  Indicates whether it is projected or not or if projection overflowed.
292         ubyte           pad[2];                         // pad structure to be 4 byte aligned.
293 } vertex;
294
295 #define BMP_AABITMAP                    (1<<0)                          // antialiased bitmap
296 #define BMP_TEX_XPARENT         (1<<1)                          // transparent texture
297 #define BMP_TEX_NONDARK         (1<<2)                          // nondarkening texture
298 #define BMP_TEX_OTHER                   (1<<3)                          // so we can identify all "normal" textures
299
300 // any texture type
301 #define BMP_TEX_ANY                             ( BMP_TEX_XPARENT | BMP_TEX_NONDARK | BMP_TEX_OTHER )
302
303 // max res == 1024x768. max texture size == 256
304 #define MAX_BMAP_SECTIONS_X                             4
305 #define MAX_BMAP_SECTIONS_Y                             3
306 #define MAX_BMAP_SECTION_SIZE                           256
307 typedef struct bitmap_section_info {
308         ushort sx[MAX_BMAP_SECTIONS_X];         // x offset of each section
309         ushort sy[MAX_BMAP_SECTIONS_Y];         // y offset of each section
310
311         ubyte num_x, num_y;                                             // number of x and y sections
312 } bitmap_section_info;
313
314 typedef struct bitmap {
315         short   w, h;           // Width and height
316         short   rowsize;        // What you need to add to go to next row
317         ubyte   bpp;            // How many bits per pixel it is. (7,8,15,16,24,32)
318         ubyte   flags;  // See the BMP_???? defines for values
319         uint    data;           // Pointer to data, or maybe offset into VRAM.
320         ubyte *palette; // If bpp==8, this is pointer to palette.   If the BMP_NO_PALETTE_MAP flag
321                                                         // is not set, this palette just points to the screen palette. (gr_palette)
322
323         bitmap_section_info sections;
324 } bitmap;
325
326 //This are defined in MainWin.c
327 extern void _cdecl WinAssert(char * text,char *filename, int line);
328 extern void _cdecl Error( char * filename, int line, char * format, ... );
329 extern void _cdecl Warning( char * filename, int line, char * format, ... );
330
331 #include "outwnd.h"
332
333 // To debug printf do this:
334 // mprintf(( "Error opening %s\n", filename ));
335 #ifndef NDEBUG
336 #define mprintf(args) outwnd_printf2 args
337 #define nprintf(args) outwnd_printf args
338 #else
339 #define mprintf(args) 
340 #define nprintf(args) 
341 #endif
342
343 #define LOCATION __FILE__,__LINE__
344
345 // To flag an error, you can do this:
346 // Error( __FILE__, __LINE__, "Error opening %s", filename );
347 // or, 
348 // Error( LOCATION, "Error opening %s", filename );
349
350 #if defined(NDEBUG)
351 #define Assert(x) do {} while (0)
352 #else
353 void gr_activate(int);
354 #define Assert(x) do { if (!(x)){ gr_activate(0); WinAssert(#x,__FILE__,__LINE__); gr_activate(1); } } while (0)
355 #endif
356
357 //#define Int3() _asm { int 3 }
358
359 #ifdef INTERPLAYQA
360         // Interplay QA version of Int3
361         #define Int3() do { } while (0) 
362
363         // define to call from Warning function above since it calls Int3, so without this, we
364         // get put into infinite dialog boxes
365         #define AsmInt3() _asm { int 3 }
366
367 #else
368         #if defined(NDEBUG)
369                 // No debug version of Int3
370                 #define Int3() do { } while (0) 
371         #else
372                 void debug_int3();
373
374                 // Debug version of Int3
375                 #define Int3() debug_int3()
376         #endif  // NDEBUG && DEMO
377 #endif  // INTERPLAYQA
378
379 #define min(a,b) (((a) < (b)) ? (a) : (b))
380 #define max(a,b) (((a) > (b)) ? (a) : (b))
381
382 #define PI                                      3.141592654f
383 #define PI2                                     (3.141592654f*2.0f)     // PI*2
384 #define ANG_TO_RAD(x)   ((x)*PI/180)
385
386
387 extern int      Fred_running;  // Is Fred running, or FreeSpace?
388 extern int Pofview_running;
389 extern int Nebedit_running;
390
391
392 //======================================================================================
393 //======          D E B U G    C O N S O L E   S T U F F        ========================
394 //======================================================================================
395
396 // Here is a a sample command to toggle something that would
397 // be called by doing "toggle it" from the debug console command window/
398
399 /*
400 DCF(toggle_it,"description")
401 {
402         if (Dc_command) {
403                 This_var = !This_var;
404         }
405
406         if (Dc_help)    {
407                 dc_printf( "Usage: sample\nToggles This_var on/off.\n" );
408         }
409
410         if (Dc_status)  {
411                 dc_printf( "The status is %d.\n", This_var );
412         }
413 */
414
415 class debug_command {
416         public:
417         char *name;
418         char *help;
419         void (*func)();
420         debug_command(char *name,char *help,void (*func)());    // constructor
421 };
422
423 #define DCF(function_name,help_text)                    \
424                 void dcf_##function_name();     \
425                 debug_command dc_##function_name(#function_name,help_text,dcf_##function_name); \
426                 void dcf_##function_name()              
427
428 // Starts the debug console
429 extern void debug_console( void (*func)() = NULL );
430
431 // The next three variables tell your function what to do.  It should
432 // only change something if the dc_command is set.   A minimal function
433 // needs to process the dc_command.   Usually, these will be called in
434 // these combinations:
435 // dc_command=true, dc_status=true  means process it and show status
436 // dc_help=true means show help only
437 // dc_status=true means show status only
438 // I would recommend doing this in each function:
439 // if (dc_command) { process command }
440 // if (dc_help) { print out help }
441 // if (dc_status) { print out status }
442 // with the last two being optional
443
444 extern int Dc_command;  // If this is set, then process the command
445 extern int Dc_help;             // If this is set, then print out the help text in the form, "usage: ... \nLong description\n" );
446 extern int Dc_status;           // If this is set, then print out the current status of the command.
447
448 void dc_get_arg(uint flags);            // Gets the next argument.   If it doesn't match the flags, this function will print an error and not return.
449 extern char *Dc_arg;            // The (lowercased) string value of the argument retrieved from dc_arg
450 extern char *Dc_arg_org;        // Dc_arg before it got converted to lowercase
451 extern uint Dc_arg_type;        // The type of dc_arg.
452 extern char *Dc_command_line;           // The rest of the command line, from the end of the last processed arg on.
453 extern int Dc_arg_int;          // If Dc_arg_type & ARG_INT or ARG_HEX is set, then this is the value
454 extern float Dc_arg_float;      // If Dc_arg_type & ARG_FLOAT is set, then this is the value
455
456 // Outputs text to the console
457 void dc_printf( char *format, ... );
458
459 // Each dc_arg_type can have one or more of these flags set.
460 // This is because some things can fit into two catagories.
461 // Like 1 can be an integer, a float, a string, or a true boolean
462 // value.
463 #define ARG_NONE                (1<<0)  // no argument
464 #define ARG_ANY         0xFFFFFFFF      // Anything.
465 #define ARG_STRING      (1<<1)  // any valid string
466 #define ARG_QUOTE               (1<<2)  // a quoted string
467 #define ARG_INT         (1<<3)  // a valid integer
468 #define ARG_FLOAT               (1<<4)  // a valid floating point number
469
470 // some specific commonly used predefined types. Can add up to (1<<31)
471 #define ARG_HEX         (1<<5)  // a valid hexadecimal integer. Note that ARG_INT will always be set also in this case.
472 #define ARG_TRUE                (1<<6)  // on, true, non-zero number
473 #define ARG_FALSE               (1<<7)  // off, false, zero
474 #define ARG_PLUS                (1<<8)  // Plus sign
475 #define ARG_MINUS               (1<<9)  // Minus sign
476 #define ARG_COMMA               (1<<10) // a comma
477
478 // A shortcut for boolean only variables.
479 // Example:  
480 // DCF_BOOL( lighting, Show_lighting )
481 //
482 #define DCF_BOOL( function_name, bool_variable )        \
483         void dcf_##function_name();     \
484         debug_command dc_##function_name(#function_name,"Toggles "#bool_variable,dcf_##function_name ); \
485         void dcf_##function_name()      {       \
486         if ( Dc_command )       {       \
487                 dc_get_arg(ARG_TRUE|ARG_FALSE|ARG_NONE);                \
488                 if ( Dc_arg_type & ARG_TRUE )   bool_variable = 1;      \
489                 else if ( Dc_arg_type & ARG_FALSE ) bool_variable = 0;  \
490                 else if ( Dc_arg_type & ARG_NONE ) bool_variable ^= 1;  \
491         }       \
492         if ( Dc_help )  dc_printf( "Usage: %s [bool]\nSets %s to true or false.  If nothing passed, then toggles it.\n", #function_name, #bool_variable );      \
493         if ( Dc_status )        dc_printf( "%s is %s\n", #function_name, (bool_variable?"TRUE":"FALSE") );      \
494 }
495
496
497 //======================================================================================
498 //======================================================================================
499 //======================================================================================
500
501
502
503 #include "fix.h"
504 #include "floating.h"
505
506 // Some constants for stuff
507 #define MAX_FILENAME_LEN        32                      // Length for filenames, ie "title.pcx"
508 #define MAX_PATH_LEN                    128             // Length for pathnames, ie "c:\bitmaps\title.pcx"
509
510 // contants and defined for byteswapping routines (useful for mac)
511
512 #define SWAPSHORT(x)    (                                                       \
513                                                 ((ubyte)x << 8) |                                       \
514                                                 (((ushort)x) >> 8)                      \
515                                                 )
516                                                 
517 #define SWAPINT(x)              (                                                       \
518                                                 (x << 24) |                                     \
519                                                 (((ulong)x) >> 24) |            \
520                                                 ((x & 0x0000ff00) << 8) |       \
521                                                 ((x & 0x00ff0000) >> 8)         \
522                                                 )
523
524 #ifndef MACINTOSH
525 #define INTEL_INT(x)    x
526 #define INTEL_SHORT(x)  x
527 #else
528 #define INTEL_INT(x)    SWAPINT(x)
529 #define INTEL_SHORT(x)  SWAPSHORT(x)
530 #endif
531
532 #define TRUE    1
533 #define FALSE   0
534
535 int myrand();
536
537
538
539 // Callback Loading function. 
540 // If you pass a function to this, that function will get called
541 // around 10x per second, so you can update the screen.
542 // Pass NULL to turn it off.
543 // Call this with the name of a function.  That function will
544 // then get called around 10x per second.  The callback function
545 // gets passed a 'count' which is how many times game_busy has
546 // been called since the callback was set.   It gets called
547 // one last time with count=-1 when you turn off the callback
548 // by calling game_busy_callback(NULL).   Game_busy_callback
549 // returns the current count, so you can tell how many times
550 // game_busy got called.
551 // If delta_step is above 0, then it will also make sure it 
552 // calls the callback each time count steps 'delta_step' even
553 // if 1/10th of a second hasn't elapsed.
554 extern int game_busy_callback( void (*callback)(int count), int delta_step = -1 );
555
556 // Call whenever loading to display cursor
557 extern void game_busy();
558
559
560 //=========================================================
561 // Functions to monitor performance
562 #ifndef NDEBUG
563
564 class monitor {
565         public:
566         char    *name;                  
567         int     value;                  // Value that gets cleared to 0 each frame.
568         int     min, max, sum, cnt;             // Min & Max of value.  Sum is used to calculate average 
569         monitor(char *name);    // constructor
570 };
571
572 // Creates a monitor variable
573 #define MONITOR(function_name)                          monitor mon_##function_name(#function_name)
574
575 // Increments a monitor variable
576 #define MONITOR_INC(function_name,inc)          do { mon_##function_name.value+=(inc); } while(0)
577
578 // Call this once per frame to update monitor file
579 void monitor_update();
580
581 #else
582
583 #define MONITOR(function_name)
584
585 #define MONITOR_INC(function_name,inc)          do { } while(0)
586
587 // Call this once per frame to update monitor file
588 #define monitor_update() do { } while(0)
589
590 #endif
591
592 #define NOX(s) s
593
594 char *XSTR(char *str, int index);
595
596 // Caps V between MN and MX.
597 template <class T> void CAP( T& v, T mn, T mx )
598 {
599         if ( v < mn )   {
600                 v = mn;
601         } else if ( v > mx )    {
602                 v = mx;
603         }
604 }
605
606 // ========================================================
607 // stamp checksum stuff
608 // ========================================================
609
610 // here is the define for the stamp for this set of code
611 #define STAMP_STRING "\001\001\001\001\002\002\002\002Read the Foundation Novels from Asimov.  I liked them." 
612 #define STAMP_STRING_LENGTH     80
613 #define DEFAULT_CHECKSUM_STRING         "\001\001\001\001"
614 #define DEFAULT_TIME_STRING                     "\002\002\002\002"
615
616 // macro to calculate the checksum for the stamp.  Put here so that we can use different methods
617 // for different applications.  Requires the local variable 'checksum' to be defined!!!
618 #define CALCULATE_STAMP_CHECKSUM() do { \
619                 int i, found;   \
620                                                         \
621                 checksum = 0;   \
622                 for ( i = 0; i < (int)strlen(ptr); i++ ) {      \
623                         found = 0;      \
624                         checksum += ptr[i];     \
625                         if ( checksum & 0x01 )  \
626                                 found = 1;      \
627                         checksum = checksum >> 1;       \
628                         if (found)      \
629                                 checksum |= 0x80000000; \
630                 }       \
631                 checksum |= 0x80000000; \
632         } while (0) ;
633
634 //=========================================================
635 // Memory management functions
636 //=========================================================
637
638 #ifndef NDEBUG
639         // Debug versions
640
641         // Returns 0 if not enough RAM.
642         int vm_init(int min_heap_size);
643
644         // Allocates some RAM.
645         void *vm_malloc( int size, char *filename=NULL, int line=-1 );
646
647         // 
648         char *vm_strdup( const char *ptr, char *filename, int line );
649
650         // Frees some RAM. 
651         void vm_free( void *ptr, char *filename=NULL, int line=-1 );
652
653         // Frees all RAM.
654         void vm_free_all();
655
656         // Easy to use macros
657         #define VM_MALLOC(size) vm_malloc((size),__FILE__,__LINE__)
658         #define VM_FREE(ptr) vm_free((ptr),__FILE__,__LINE__)
659
660         #define malloc(size) vm_malloc((size),__FILE__,__LINE__)
661         #define free(ptr) vm_free((ptr),__FILE__,__LINE__)
662         #define strdup(ptr) vm_strdup((ptr),__FILE__,__LINE__)
663         
664 #else
665         // Release versions
666
667         // Returns 0 if not enough RAM.
668         int vm_init(int min_heap_size);
669
670         // Allocates some RAM.
671         void *vm_malloc( int size );
672
673         // 
674         char *vm_strdup( const char *ptr );
675
676         // Frees some RAM. 
677         void vm_free( void *ptr );
678
679         // Frees all RAM.
680         void vm_free_all();
681
682         // Easy to use macros
683         #define VM_MALLOC(size) vm_malloc(size)
684         #define VM_FREE(ptr) vm_free(ptr)
685
686         #define malloc(size) vm_malloc(size)
687         #define free(ptr) vm_free(ptr)
688         #define strdup(ptr) vm_strdup(ptr)
689 #endif
690
691
692 #endif          // PS_TYPES_H
693