1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - tool - defval
3   File:     misc.h
4 
5   Copyright 2005-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   $Date:: 2008-09-17#$
14   $Rev: 8556 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 #ifndef MISC_H__
18 #define MISC_H__
19 
20 #include <stdio.h>
21 #include <malloc.h>                    // calloc()
22 #include <stdlib.h>                    // free(), exit()
23 #include <string.h>                    // strlen/strdup/strcpy/memcpy
24 #include <stdarg.h>                    // va_start(),va_end()
25 #include <assert.h>                    // assert()
26 
27 typedef enum
28 {
29     TRUE = 1,
30     FALSE = 0
31 }
32 BOOL;
33 
34 #define DEFAULT_LINE_BUFFER_SIZE        1024
35 
36 char   *StrDup(const char *str);
37 char   *StrCatDup(const char *str1, const char *str2);
38 char   *StrNDup(const char *str, int len);
39 void   *Calloc(int size);
40 void   *Realloc(void *buffer, int size);
41 void    Free(void **ptr);
42 FILE   *Fopen(const char *filename, const char *mode);
43 void    Fclose(FILE * fp);
44 char   *Fgets(char **pbuffer, int *pbuffer_size, FILE * fp);
45 void    UnpackFileName(const char *path, char **dir, char **base, char **ext);
46 void    SetDebugMode(BOOL mode);
47 void    DebugPrintf(const char *fmt, ...);
48 
49 #endif //MISC_H__
50