1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 /*  Library porting Tool Kit
24  *
25  * These are generic definitions which should be applicable to any system.
26  */
27 
28 #ifndef GLK_TADS_TADS2_LTK
29 #define GLK_TADS_TADS2_LTK
30 
31 #include "glk/tads/tads2/error_handling.h"
32 
33 namespace Glk {
34 namespace TADS {
35 namespace TADS2 {
36 
37 
38 /*
39  * ltkini - allocate and INItialize ltk context.  'heapsiz' is the
40  * requested size for the local heap. Returns 0 if the request cannot be
41  * satisfied.
42  */
43 extern void ltkini(unsigned short heapsiz);
44 
45 
46 /*
47  * ltkfre - FREe ltk context.
48  */
49 extern void ltkfre();
50 
51 
52 /*
53  * ltk_dlg - DiaLoG.  Present user with informational dialog message.
54  * 'title' specifies the title to use in the dialog box, 'msg' is the
55  * text message, which may contain printf-style formatting.
56  * printf-style arguments must be passed in also, if the message
57  * requires them.
58  */
59 extern void ltk_dlg(const char *title, const char *msg, ...);
60 
61 
62 /*
63  * ltk_errlog - Error logging function for LER routines.
64  */
65 extern void ltk_errlog(void *ctx, const char *fac, int errCode, int agrc, erradef *argv);
66 
67 
68 /*
69  * ltk_alloc - ALLOCate permanent global memory.  Returns 0 if the
70  * request cannot be satisfied.
71  */
72 extern void *ltk_alloc(size_t siz);
73 
74 /* ltk_realloc - reallocate memory; analogous to realloc() */
75 extern void *ltk_realloc(void *ptr, size_t siz);
76 
77 
78 /*
79  * ltk_sigalloc - ALLOCate permanent global memory, signals error on
80  * failure.
81  */
82 extern void *ltk_sigalloc(struct errcxdef *errcx, size_t siz);
83 
84 
85 /*
86  * ltk_free - FREE memory allocated using ltk_alloc.
87  */
88 extern void ltk_free(void *ptr);
89 
90 
91 /*
92  * ltk_suballoc - SUB-ALLOCate memory from user heap.  Returns 0 if the
93  * request cannot be satisfied.
94  */
95 extern void *ltk_suballoc(size_t siz);
96 
97 
98 /*
99  * ltk_sigsuballoc - SUB-ALLOCate memory from user heap, signals error
100  * on failure.
101  */
102 extern void *ltk_sigsuballoc(struct errcxdef *errcx, size_t siz);
103 
104 
105 /*
106  * ltk_subfree - SUBsegment FREE.  Frees memory allocated by
107  * ltk_suballoc.
108  */
109 extern void ltk_subfree(void *ptr);
110 
111 
112 /*
113  * ltk_beep - BEEP the user.
114  */
115 extern void ltk_beep(void);
116 
117 
118 /*
119  * ltk_beg_wait - signal that the user needs to wait.
120  */
121 extern void ltk_beg_wait(void);
122 
123 
124 /*
125  * ltk_end_wait - end the waiting period .
126  */
127 extern void ltk_end_wait(void);
128 
129 } // End of namespace TADS2
130 } // End of namespace TADS
131 } // End of namespace Glk
132 
133 #endif
134