1 /*
2   This file is Copyright © 1994-1995 Olivier Montanuy,
3                Copyright © 1999-2005 André Majorel,
4                Copyright © 2006-2019 contributors to the DeuTex project.
5 
6   DeuTex incorporates code derived from DEU 5.21 that was put in the
7   public domain in 1994 by Raphaël Quinet and Brendon Wyber.
8 
9   SPDX-License-Identifier: GPL-2.0-or-later
10 */
11 #ifndef TOOLS_H
12 #define TOOLS_H
13 
14 #define MSGCLASS_INFO 'i'
15 #define MSGCLASS_WARN 'w'
16 #define MSGCLASS_ERR  'E'
17 #define MSGCLASS_BUG  'B'
18 
19 void PrintCopyright(void);
20 void print_version(void);
21 void NoCommandGiven(void);
22 
23 char *fnameofs(const char *name, long ofs);
24 char *fname(const char *name);
25 char *lump_name(const char *name);
26 char *short_dump(const char *data, size_t size);
27 const char *quotechar(char c);
28 
29 void PrintVerbosity(int16_t level);
30 void PrintExit(void);
31 
32 void ProgErrorCancel(void);
33 void ProgErrorAction(void (*action) (void));
34 void ProgError(const char *code, const char *fmt, ...); /*fatal error. halt. */
35 void nf_err(const char *code, const char *fmt, ...);    /* Non-fatal error */
36 void Bug(const char *code, const char *fmt, ...);       /*fatal bug. halt */
37 void Warning(const char *code, const char *str, ...);   /*I'm not happy */
38 void LimitedWarn(int *left, const char *code, const char *fmt, ...);
39 void LimitedEpilog(int *left, const char *code, const char *fmt, ...);
40 void Output(const char *fmt, ...);      /*command text output */
41 void Info(const char *code, const char *fmt, ...);      /*useful indications */
42 void Phase(const char *code, const char *fmt, ...);     /*phase of executions */
43 void Detail(const char *code, const char *fmt, ...);    /*technical details */
44 
45 void ToLowerCase(char *file);
46 void MakeDir(char file[128], const char *path, const char *dir, const char
47              *sdir);
48 bool MakeFileName(char file[128], const char *path, const char *dir, const
49                   char *sdir, const char *name, const char *extens);
50 void GetNameOfWAD(char name[8], const char *path);
51 int32_t Get_File_Time(const char *path);
52 void Set_File_Time(const char *path, int32_t time);
53 void Memcpy(void *dest, const void *src, long n);
54 void Memset(void *dest, char car, long n);
55 void *Malloc(long size);
56 void *Realloc(void *old, long size);
57 
58 void Normalise(char dest[8], const char *src);
59 
60 void Progress(void);
61 void ProgressEnds(void);
62 
63 #endif //TOOLS_H
64