m_misc.h
 1  //
 2  // Copyright(C) 1993-1996 Id Software, Inc.
 3  // Copyright(C) 2005-2014 Simon Howard
 4  //
 5  // This program is free software; you can redistribute it and/or
 6  // modify it under the terms of the GNU General Public License
 7  // as published by the Free Software Foundation; either version 2
 8  // of the License, or (at your option) any later version.
 9  //
10  // This program is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  // GNU General Public License for more details.
14  //
15  // DESCRIPTION:
16  //      Miscellaneous.
17  //    
18  
19  
20  #ifndef __M_MISC__
21  #define __M_MISC__
22  
23  #include <stdio.h>
24  #include <stdarg.h>
25  
26  #include "doomtype.h"
27  #include "ff.h"
28  
29  boolean M_WriteFile(char *name, void *source, int length);
30  int M_ReadFile(char *name, byte **buffer);
31  void M_MakeDirectory(char *dir);
32  char *M_TempFile(char *s);
33  boolean M_FileExists(char *file);
34  #if ORIGCODE
35  long M_FileLength(FILE *handle);
36  #else
37  long M_FileLength(FIL *handle);
38  #endif
39  boolean M_StrToInt(const char *str, int *result);
40  void M_ExtractFileBase(char *path, char *dest);
41  void M_ForceUppercase(char *text);
42  char *M_StrCaseStr(char *haystack, char *needle);
43  boolean M_StringCopy(char *dest, const char *src, size_t dest_size);
44  boolean M_StringConcat(char *dest, const char *src, size_t dest_size);
45  char *M_StringReplace(const char *haystack, const char *needle,
46                        const char *replacement);
47  char *M_StringJoin(const char *s, ...);
48  boolean M_StringStartsWith(const char *s, const char *prefix);
49  boolean M_StringEndsWith(const char *s, const char *suffix);
50  int M_vsnprintf(char *buf, size_t buf_len, const char *s, va_list args);
51  int M_snprintf(char *buf, size_t buf_len, const char *s, ...);
52  char *M_OEMToUTF8(const char *ansi);
53  
54  #endif
55