aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-09-02 15:49:50 +0100
committerRichard Brooksby2012-09-02 15:49:50 +0100
commit74c3b4b877ed085092f7dfc25067b397b60c2143 (patch)
tree728e8449f3add7ff956f4049f9bae077fc0b9034 /mps/code
parent894ce316996bce7d9abc29efb28890aa116d8909 (diff)
downloademacs-74c3b4b877ed085092f7dfc25067b397b60c2143.tar.gz
emacs-74c3b4b877ed085092f7dfc25067b397b60c2143.zip
Deleting unused callback mechanism for installing plinth routines with windows' broken dynamic linker.
Copied from Perforce Change: 179174 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/mpslibcb.c343
-rw-r--r--mps/code/mpslibcb.def10
-rw-r--r--mps/code/mpslibcb.h58
3 files changed, 0 insertions, 411 deletions
diff --git a/mps/code/mpslibcb.c b/mps/code/mpslibcb.c
deleted file mode 100644
index 41bf5bcb6c7..00000000000
--- a/mps/code/mpslibcb.c
+++ /dev/null
@@ -1,343 +0,0 @@
1/* mpslibcb.c: RAVENBROOK MEMORY POOL SYSTEM LIBRARY INTERFACE (CALLBACK)
2 *
3 * $Header$
4 * Copyright (c) 2005 Ravenbrook Limited. See end of file for license.
5 *
6 * .purpose: The purpose of this code is
7 * 1. permit the MPS Library Interface to be used conveniently when
8 * the MPS is packaged as a dynamic library (and in particular a
9 * Windows DLL).
10 *
11 * .readership: For MPS client application developers and MPS developers.
12 * .sources: <design/lib/>
13 *
14 * .freestanding: This is designed to be deployed in a freestanding
15 * environment, so we can't use strcmp from <string.h>, so we have to
16 * roll our own (in fact we only ever need equality so we define a
17 * simpler interface).
18 *
19 * .mpm.not: This module occupies a halfway house between the MPM and
20 * the client. Let's make it clearer: this module should not use any
21 * services of the MPM. That is, it should be written as if the client
22 * could have, in principle, written it. .mpm.not.why: Perhaps the most
23 * compelling reason is that if config.h is included (via mpm.h) then
24 * the compile breaks on platform.w3i3mv because of "#define
25 * mps_lib_memset memset" in config.h.
26 */
27
28#include "mpslibcb.h"
29#include "mpslib.h"
30#include "mps.h"
31
32/* Forward declarations. */
33
34int mps_lib_callback_default_get_EOF(void);
35mps_lib_FILE *mps_lib_callback_default_get_stderr(void);
36mps_lib_FILE *mps_lib_callback_default_get_stdout(void);
37int mps_lib_callback_default_fputc(int c_, mps_lib_FILE *f_);
38int mps_lib_callback_default_fputs(const char *s_, mps_lib_FILE *f_);
39void *mps_lib_callback_default_memset(void *p_, int c_, size_t n_);
40void *mps_lib_callback_default_memcpy(void *p_, const void *q_, size_t n_);
41int mps_lib_callback_default_memcmp(const void *p_, const void *q_, size_t n_);
42mps_clock_t mps_lib_callback_default_clock(void);
43mps_clock_t mps_lib_callback_default_clocks_per_sec(void);
44unsigned long mps_lib_callback_default_telemetry_control(void);
45int mps_lib_callback_streq(const char *, const char *);
46
47/* Macros */
48
49/* See .freestanding */
50#define EQ(p, q) (mps_lib_callback_streq((p), (q)))
51/* We use this to call mps_lib_asssert_fail (which we only ever do
52 * unconditionally). See .mpm.not on why we cannot use ASSERT from
53 * mpm.h */
54#define AFAIL mps_lib_assert_fail
55/* Replaced UNUSED from mpm.h, see .mpm.not */
56#define UNUSED(x) ((void)(x))
57
58/* Structures and Types */
59
60struct mps_lib_callback_s
61{
62 int (*lib_get_EOF)(void);
63 mps_lib_FILE * (*lib_get_stderr)(void);
64 mps_lib_FILE * (*lib_get_stdout)(void);
65 int (*lib_fputc)(int, mps_lib_FILE *);
66 int (*lib_fputs)(const char *, mps_lib_FILE *);
67 void (*lib_assert_fail)(const char *);
68 void * (*lib_memset)(void *, int, size_t);
69 void * (*lib_memcpy)(void *, const void *, size_t);
70 int (*lib_memcmp)(const void *, const void *, size_t);
71 mps_clock_t (*clock)(void);
72 mps_clock_t (*clocks_per_sec)(void);
73 unsigned long (*lib_telemetry_control)(void);
74};
75
76/* Globals */
77
78/* .global.why: A global is necessary so that we can store the function
79 * pointers that the client gives us. The functions in the mpslib.h
80 * interface _are_ global. There is no scope for having one memset
81 * function for one Arena and a different memset function for another.
82 * */
83
84/* The default functions are stubs that assert. Except for the
85 * assert_fail function (which is called when assertions fail) which
86 * will be NULL. This means: if you provide assert_fail and forget
87 * something else, you'll know about it. If you do not provide
88 * assert_fail then it will probably stop anyway.
89 *
90 * These functions really do need to fail, so they subvert the checking
91 * mechanism (which is in mpm.h and not available to us, see .mpm.not)
92 */
93
94struct mps_lib_callback_s mps_lib_callback_global = {
95 mps_lib_callback_default_get_EOF,
96 mps_lib_callback_default_get_stderr,
97 mps_lib_callback_default_get_stdout,
98 mps_lib_callback_default_fputc,
99 mps_lib_callback_default_fputs,
100 NULL, /* assert_fail */
101 mps_lib_callback_default_memset,
102 mps_lib_callback_default_memcpy,
103 mps_lib_callback_default_memcmp,
104 mps_lib_callback_default_clock,
105 mps_lib_callback_default_clocks_per_sec,
106 mps_lib_callback_default_telemetry_control
107};
108
109/* Functions */
110
111int mps_lib_callback_register(const char *name, mps_lib_function_t f)
112{
113 if(NULL == name) {
114 return MPS_RES_FAIL;
115 }
116 if(EQ(name, "mps_lib_get_EOF")) {
117 mps_lib_callback_global.lib_get_EOF = (int(*)(void))f;
118 } else if(EQ(name, "mps_lib_get_stderr")) {
119 mps_lib_callback_global.lib_get_stderr = (mps_lib_FILE *(*)(void))f;
120 } else if(EQ(name, "mps_lib_get_stdout")) {
121 mps_lib_callback_global.lib_get_stdout = (mps_lib_FILE *(*)(void))f;
122 } else if(EQ(name, "mps_lib_fputc")) {
123 mps_lib_callback_global.lib_fputc = (int(*)(int, mps_lib_FILE *))f;
124 } else if(EQ(name, "mps_lib_fputs")) {
125 mps_lib_callback_global.lib_fputs =
126 (int(*)(const char *, mps_lib_FILE *))f;
127 } else if(EQ(name, "mps_lib_assert_fail")) {
128 mps_lib_callback_global.lib_assert_fail = (void(*)(const char *))f;
129 } else if(EQ(name, "mps_lib_memset")) {
130 mps_lib_callback_global.lib_memset = (void *(*)(void *, int, size_t))f;
131 } else if(EQ(name, "mps_lib_memcpy")) {
132 mps_lib_callback_global.lib_memcpy =
133 (void *(*)(void *, const void *, size_t))f;
134 } else if(EQ(name, "mps_lib_memcmp")) {
135 mps_lib_callback_global.lib_memcmp =
136 (int(*)(const void *, const void *, size_t))f;
137 } else if(EQ(name, "mps_clock")) {
138 mps_lib_callback_global.clock = (mps_clock_t(*)(void))f;
139 } else if(EQ(name, "mps_clocks_per_sec")) {
140 mps_lib_callback_global.clocks_per_sec = (mps_clock_t(*)(void))f;
141 } else if(EQ(name, "mps_lib_telemetry_control")) {
142 mps_lib_callback_global.lib_telemetry_control =
143 (unsigned long(*)(void))f;
144 } else {
145 return MPS_RES_UNIMPL;
146 }
147 return MPS_RES_OK;
148}
149
150/* Return non-zero if and only if string p equals string q. */
151int mps_lib_callback_streq(const char *p, const char *q)
152{
153 do {
154 if(*p == '\0' && *q == '\0') {
155 return 1;
156 }
157 } while(*p++ == *q++);
158 return 0;
159}
160
161int mps_lib_callback_default_get_EOF(void)
162{
163 AFAIL("mps_lib_get_EOF needs to be provided");
164 return 0;
165}
166
167mps_lib_FILE *mps_lib_callback_default_get_stderr(void)
168{
169 AFAIL("mps_lib_get_stderr needs to be provided");
170 return NULL;
171}
172
173mps_lib_FILE *mps_lib_callback_default_get_stdout(void)
174{
175 AFAIL("mps_lib_get_stdout needs to be provided");
176 return NULL;
177}
178
179int mps_lib_callback_default_fputc(int c_, mps_lib_FILE *f_)
180{
181 UNUSED(c_);
182 UNUSED(f_);
183 AFAIL("mps_lib_fputc needs to be provided");
184 return 0;
185}
186
187int mps_lib_callback_default_fputs(const char *s_, mps_lib_FILE *f_)
188{
189 UNUSED(s_);
190 UNUSED(f_);
191 AFAIL("mps_lib_fputs needs to be provided");
192 return 0;
193}
194
195/* No default implementation for mps_lib_assert_fail */
196
197void *mps_lib_callback_default_memset(void *p_, int c_, size_t n_)
198{
199 UNUSED(p_);
200 UNUSED(c_);
201 UNUSED(n_);
202 AFAIL("mps_lib_memset needs to be provided");
203 return NULL;
204}
205
206void *mps_lib_callback_default_memcpy(void *p_, const void *q_, size_t n_)
207{
208 UNUSED(p_);
209 UNUSED(q_);
210 UNUSED(n_);
211 AFAIL("mps_lib_memcpy needs to be provided");
212 return NULL;
213}
214
215int mps_lib_callback_default_memcmp(const void *p_, const void *q_, size_t n_)
216{
217 UNUSED(p_);
218 UNUSED(q_);
219 UNUSED(n_);
220 AFAIL("mps_lib_memcmp needs to be provided");
221 return 0;
222}
223
224mps_clock_t mps_lib_callback_default_clock(void)
225{
226 AFAIL("mps_clock needs to be provided");
227 return 0;
228}
229
230mps_clock_t mps_lib_callback_default_clocks_per_sec(void)
231{
232 AFAIL("mps_clocks_per_sec needs to be provided");
233 return 0;
234}
235
236unsigned long mps_lib_callback_default_telemetry_control(void)
237{
238 AFAIL("mps_lib_telemetry_control needs to be provided");
239 return 0;
240}
241
242int mps_lib_get_EOF(void)
243{
244 return mps_lib_callback_global.lib_get_EOF();
245}
246
247mps_lib_FILE *mps_lib_get_stderr(void)
248{
249 return mps_lib_callback_global.lib_get_stderr();
250}
251
252mps_lib_FILE *mps_lib_get_stdout(void)
253{
254 return mps_lib_callback_global.lib_get_stdout();
255}
256
257int mps_lib_fputc(int c, mps_lib_FILE *f)
258{
259 return mps_lib_callback_global.lib_fputc(c, f);
260}
261
262int mps_lib_fputs(const char *s, mps_lib_FILE *f)
263{
264 return mps_lib_callback_global.lib_fputs(s, f);
265}
266
267void mps_lib_assert_fail(const char *m)
268{
269 mps_lib_callback_global.lib_assert_fail(m);
270}
271
272void *(mps_lib_memset)(void *p, int c, size_t n)
273{
274 return mps_lib_callback_global.lib_memset(p, c, n);
275}
276
277void *(mps_lib_memcpy)(void *p, const void *q, size_t n)
278{
279 return mps_lib_callback_global.lib_memcpy(p, q, n);
280}
281
282int (mps_lib_memcmp)(const void *p, const void *q, size_t n)
283{
284 return mps_lib_callback_global.lib_memcmp(p, q, n);
285}
286
287mps_clock_t mps_clock(void)
288{
289 return mps_lib_callback_global.clock();
290}
291
292mps_clock_t mps_clocks_per_sec(void)
293{
294 return mps_lib_callback_global.clocks_per_sec();
295}
296
297unsigned long mps_lib_telemetry_control(void)
298{
299 return mps_lib_callback_global.lib_telemetry_control();
300}
301
302
303
304/* C. COPYRIGHT AND LICENSE
305 *
306 * Copyright (C) 2005 Ravenbrook Limited <http://www.ravenbrook.com/>.
307 * All rights reserved. This is an open source license. Contact
308 * Ravenbrook for commercial licensing options.
309 *
310 * Redistribution and use in source and binary forms, with or without
311 * modification, are permitted provided that the following conditions are
312 * met:
313 *
314 * 1. Redistributions of source code must retain the above copyright
315 * notice, this list of conditions and the following disclaimer.
316 *
317 * 2. Redistributions in binary form must reproduce the above copyright
318 * notice, this list of conditions and the following disclaimer in the
319 * documentation and/or other materials provided with the distribution.
320 *
321 * 3. Redistributions in any form must be accompanied by information on how
322 * to obtain complete source code for this software and any accompanying
323 * software that uses this software. The source code must either be
324 * included in the distribution or be available for no more than the cost
325 * of distribution plus a nominal fee, and must be freely redistributable
326 * under reasonable conditions. For an executable file, complete source
327 * code means the source code for all modules it contains. It does not
328 * include source code for modules or files that typically accompany the
329 * major components of the operating system on which the executable file
330 * runs.
331 *
332 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
333 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
334 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
335 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
336 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
337 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
338 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
339 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
340 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
341 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
342 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
343 */
diff --git a/mps/code/mpslibcb.def b/mps/code/mpslibcb.def
deleted file mode 100644
index 9b2f4e3b285..00000000000
--- a/mps/code/mpslibcb.def
+++ /dev/null
@@ -1,10 +0,0 @@
1; $Header$
2; --- EXTERNAL MPS FUNCTIONS ---
3; This file tells the linker to export the mpslibcb functions from
4; the MPS DLL.
5; This list is for the w3i3mv platform.
6;
7; This file was extracted by hand from expgen.sh; see MPS job002148.
8EXPORTS
9; mpslibcb.h
10mps_lib_callback_register
diff --git a/mps/code/mpslibcb.h b/mps/code/mpslibcb.h
deleted file mode 100644
index 140448e2482..00000000000
--- a/mps/code/mpslibcb.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/* mpslibcb.h: RAVENBROOK MEMORY POOL SYSTEM LIBRARY CALLBACK INTERFACE
2 *
3 * $Header$
4 * Copyright (c) 2005 Ravenbrook Limited. See end of file for license.
5 *
6 * .readership: MPS client application developers, MPS developers.
7 *
8 */
9
10#ifndef mpslibcb_h
11#define mpslibcb_h
12
13typedef void (*mps_lib_function_t)(void);
14int mps_lib_callback_register(const char *, mps_lib_function_t);
15
16#endif /* mpslibcb_h */
17
18
19/* C. COPYRIGHT AND LICENSE
20 *
21 * Copyright (C) 2005 Ravenbrook Limited <http://www.ravenbrook.com/>.
22 * All rights reserved. This is an open source license. Contact
23 * Ravenbrook for commercial licensing options.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions are
27 * met:
28 *
29 * 1. Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 *
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 *
36 * 3. Redistributions in any form must be accompanied by information on how
37 * to obtain complete source code for this software and any accompanying
38 * software that uses this software. The source code must either be
39 * included in the distribution or be available for no more than the cost
40 * of distribution plus a nominal fee, and must be freely redistributable
41 * under reasonable conditions. For an executable file, complete source
42 * code means the source code for all modules it contains. It does not
43 * include source code for modules or files that typically accompany the
44 * major components of the operating system on which the executable file
45 * runs.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
48 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
49 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
50 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
51 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
52 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
55 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 */