1 /*---------------------------------------------------------------------------*
2   Project:  NitroSDK - tools - makelcf
3   File:     misc.h
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: misc.h,v $
14   Revision 1.5  2006/01/18 02:11:19  kitase_hirotake
15   do-indent
16 
17   Revision 1.4  2005/08/26 11:23:11  yasu
18   Overlay support for ITCM/DTCM
19 
20   Revision 1.3  2005/02/28 05:26:03  yosizaki
21   do-indent.
22 
23   Revision 1.2  2004/06/29 04:08:33  yasu
24   Added VBuffer
25 
26   Revision 1.1  2004/03/26 05:07:33  yasu
27   Support for variables like as -DNAME=VALUE
28 
29   $NoKeywords: $
30  *---------------------------------------------------------------------------*/
31 #ifndef	MISC_H_
32 #define	MISC_H_
33 
34 #ifndef	NITRO_TYPES_H_
35 typedef enum
36 {
37     FALSE = 0,
38     TRUE = 1
39 }
40 BOOL;
41 
42 typedef unsigned char u8;
43 typedef unsigned short int u16;
44 typedef unsigned long int u32;
45 typedef signed char s8;
46 typedef signed short int s16;
47 typedef signed long int s32;
48 #endif
49 
50 #define	error(...)	do { fprintf(stderr, "Error: ");   \
51                              fprintf(stderr, __VA_ARGS__); \
52                              fprintf(stderr, "\n"); } while(0)
53 
54 #define	warning(...)	do { fprintf(stderr, "Warning: "); \
55                              fprintf(stderr, __VA_ARGS__); \
56                              fprintf(stderr, "\n"); } while(0)
57 
58 void   *Alloc(size_t size);
59 void    Free(void *p);
60 
61 typedef struct
62 {
63     char   *buffer;
64     int     size;
65 }
66 VBuffer;
67 
68 #define	VBUFFER_INITIAL_SIZE	1024
69 void    InitVBuffer(VBuffer * vbuf);
70 void    FreeVBuffer(VBuffer * vbuf);
71 void    PutVBuffer(VBuffer * vbuf, char c);
72 char   *GetVBuffer(VBuffer * vbuf);
73 
74 extern BOOL DebugMode;
75 void    debug_printf(const char *str, ...);
76 
77 #endif //MISC_H_
78