annotate src/tests.c @ 617:af57a77cbc92

[xemacs-hg @ 2001-06-18 07:09:50 by ben] --------------------------------------------------------------- DOCUMENTATION FIXES: --------------------------------------------------------------- eval.c: Correct documentation. elhash.c: Doc correction. --------------------------------------------------------------- LISP OBJECT CLEANUP: --------------------------------------------------------------- bytecode.h, buffer.h, casetab.h, chartab.h, console-msw.h, console.h, database.c, device.h, eldap.h, elhash.h, events.h, extents.h, faces.h, file-coding.h, frame.h, glyphs.h, gui-x.h, gui.h, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lrecord.h, lstream.h, mule-charset.h, objects.h, opaque.h, postgresql.h, process.h, rangetab.h, specifier.h, toolbar.h, tooltalk.h, ui-gtk.h: Add wrap_* to all objects (it was already there for a few of them) -- an expression to encapsulate a pointer into a Lisp object, rather than the inconvenient XSET*. "wrap" was chosen because "make" as in make_int(), make_char() is not appropriate. (It implies allocation. The issue does not exist for ints and chars because they are not allocated.) Full error checking has been added to these expressions. When used without error checking, non-union build, use of these expressions will incur no loss of efficiency. (In fact, XSET* is now defined in terms of wrap_* in a non-union build.) In a union build, you will also get no loss of efficiency provided that you have a decent optimizing compiler, and a compiler that either understands inlines or automatically inlines those particular functions. (And since people don't normally do their production builds on union, it doesn't matter.) Update the sample Lisp object definition in lrecord.h accordingly. dumper.c: Fix places in dumper that referenced wrap_object to reference its new name, wrap_pointer_1. buffer.c, bufslots.h, conslots.h, console.c, console.h, devslots.h, device.c, device.h, frame.c, frame.h, frameslots.h, window.c, window.h, winslots.h: -- Extract out the Lisp objects of `struct device' into devslots.h, just like for the other structures. -- Extract out the remaining (not copied into the window config) Lisp objects in `struct window' into winslots.h; use different macros (WINDOW_SLOT vs. WINDOW_SAVED_SLOT) to differentiate them. -- Eliminate the `dead' flag of `struct frame', since it duplicates information already available in `framemeths', and fix FRAME_LIVE_P accordingly. (Devices and consoles already work this way.) -- In *slots.h, switch to system where MARKED_SLOT is automatically undef'd at the end of the file. (Follows what winslots.h already does.) -- Update the comments at the beginning of *slots.h to be accurate. -- When making any of the above objects dead, zero it out entirely and reset all Lisp object slots to Qnil. (We were already doing this somewhat, but not consistently.) This (1) Eliminates the possibility of extra objects hanging around that ought to be GC'd, (2) Causes an immediate crash if anyone tries to access a structure in one of these objects, (3) Ensures consistent behavior wrt dead objects. dialog-msw.c: Use internal_object_printer, since this object should not escape. --------------------------------------------------------------- FIXING A CRASH THAT I HIT ONCE (AND A RELATED BAD BEHAVIOR): --------------------------------------------------------------- eval.c: Fix up some comments about the FSF implementation. Fix two nasty bugs: (1) condition_case_unwind frees the conses sitting in the catch->tag slot too quickly, resulting in a crash that I hit. (2) catches need to be unwound one at a time when calling unwind-protect code, rather than all at once at the end; otherwise, incorrect behavior can result. (A comment shows exactly how.) backtrace.h: Improve comment about FSF differences in the handler stack. --------------------------------------------------------------- FIXING A CRASH THAT I REPEATEDLY HIT WHEN USING THE MOUSE WHEEL UNDER MSWINDOWS: --------------------------------------------------------------- Basic idea: My crash is due either to a dead, non-marked, GC-collected frame inside of a window mirror, or a prematurely freed window mirror. We need to mark the Lisp objects inside of window mirrors. Tracking the lifespan of window mirrors and scrollbar instances is extremely hard, and there may well be lurking bugs where such objects are freed too soon. The only safe way to fix these problems (and it fixes both problems at once) is to make both of these structures Lisp objects. lrecord.h, emacs.c, inline.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, symsinit.h: Make scrollbar instances actual Lisp objects. Mark the window mirrors in them. inline.c needs to know about scrollbar.h now. Record the new type in lrecord.h. Fix up scrollbar-*.c appropriately. Create a hash table in scrollbar-msw.c so that the scrollbar instances stored in scrollbar HWND's are properly GC-protected. Create complex_vars_of_scrollbar_mswindows() to create the hash table at startup, and call it from emacs.c. Don't store the scrollbar instance as a property of the GTK scrollbar, as it's not used and if we did this, we'd have to separately GC-protect it in a hash table, like in MS Windows. lrecord.h, frame.h, frame.c, frameslots.h, redisplay.c, window.c, window.h: Move mark_window_mirror from redisplay.c to window.c. Make window mirrors actual Lisp objects. Tell lrecord.h about them. Change the window mirror member of struct frame from a pointer to a Lisp object, and add XWINDOW_MIRROR in appropriate places. Mark the scrollbar instances in the window mirror. redisplay.c, redisplay.h, alloc.c: Delete mark_redisplay. Don't call mark_redisplay. We now mark frame-specific structures in mark_frame. NOTE: I also deleted an extremely questionable call to update_frame_window_mirrors(). It was extremely questionable before, and now totally impossible, since it will create Lisp objects during redisplay. frame.c: Mark the scrollbar instances, which are now Lisp objects. Call mark_gutter() here, not in mark_redisplay(). gutter.c: Update comments about correct marking. --------------------------------------------------------------- ISSUES BROUGHT UP BY MARTIN: --------------------------------------------------------------- buffer.h: Put back these macros the way Steve T and I think they ought to be. I already explained in a previous changelog entry why I think these macros should be the way I'd defined them. Once again: We fix these macros so they don't care about the type of their lvalues. The non-C-string equivalents of these already function in the same way, and it's correct because it should be OK to pass in a CBufbyte *, a BufByte *, a Char_Binary *, an UChar_Binary *, etc. The whole reason for these different types is to work around errors caused by signed-vs-unsigned non-matching types. Any possible error that might be caught in a DFC macro would also be caught wherever the argument is used elsewhere. So creating multiple macro versions would add no useful error-checking and just further complicate an already complicated area. As for Martin's "ANSI aliasing" bug, XEmacs is not ANSI-aliasing clean and probably never will be. Unless the board agrees to change XEmacs in this way (and we really don't want to go down that road), this is not a bug. sound.h: Undo Martin's type change. signal.c: Fix problem identified by Martin with Linux and g++ due to non-standard declaration of setitimer(). systime.h: Update the docs for "qxe_" to point out why making the encapsulation explicit is always the right way to go. (setitimer() itself serves as an example.) For 21.4: update-elc-2.el: Correct misplaced parentheses, making lisp/mule not get recompiled.
author ben
date Mon, 18 Jun 2001 07:10:32 +0000
parents 4a8bb4aa9740
children b39c14581166
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
1 /* C support for testing XEmacs - see tests/automated/c-tests.el
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
2 Copyright (C) 2000 Martin Buchholz
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
3
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
4 This file is part of XEmacs.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
5
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
9 later version.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
10
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
14 for more details.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
15
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
20
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
21 /* Author: Martin Buchholz
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
22
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
23 This file provides support for running tests for XEmacs that cannot
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
24 be written entirely in Lisp. These tests are run automatically via
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
25 tests/automated/c-tests.el, or can be run by hand using M-x */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
26
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
27
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
28 #include <config.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
29 #include "lisp.h"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
30 #include "buffer.h"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
31 #include "lstream.h"
489
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
32 #include "elhash.h"
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
33 #include "opaque.h"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
34
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
35 static Lisp_Object Vtest_function_list;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
36
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
37
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
38 DEFUN ("test-data-format-conversion", Ftest_data_format_conversion, 0, 0, "", /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
39 Test TO_EXTERNAL_FORMAT() and TO_INTERNAL_FORMAT()
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
40 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
41 ())
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
42 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
43 void *ptr; size_t len;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
44 Lisp_Object string, opaque;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
45
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
46 Bufbyte int_foo[] = "\n\nfoo\nbar";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
47 Extbyte ext_unix[]= "\n\nfoo\nbar";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
48
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
49 Extbyte ext_dos[] = "\r\n\r\nfoo\r\nbar";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
50 Extbyte ext_mac[] = "\r\rfoo\rbar";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
51 Lisp_Object opaque_dos = make_opaque (ext_dos, sizeof (ext_dos) - 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
52 Lisp_Object string_foo = make_string (int_foo, sizeof (int_foo) - 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
53
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
54 Extbyte ext_latin[] = "f\372b\343\340";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
55 Bufbyte int_latin1[] = "f\201\372b\201\343\201\340";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
56 Bufbyte int_latin2[] = "f\202\372b\202\343\202\340";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
57 #ifdef MULE
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
58 Extbyte ext_latin12[]= "f\033-A\372b\343\340\033-B";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
59 Extbyte ext_tilde[] = "f~b~~";
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
60 Lisp_Object string_latin2 = make_string (int_latin2, sizeof (int_latin2) - 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
61 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
62 Lisp_Object opaque_latin = make_opaque (ext_latin, sizeof (ext_latin) - 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
63 Lisp_Object opaque0_latin = make_opaque (ext_latin, sizeof (ext_latin));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
64 Lisp_Object string_latin1 = make_string (int_latin1, sizeof (int_latin1) - 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
65
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
66 /* Check for expected strings before and after conversion.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
67 Conversions depend on whether MULE is defined,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
68 and on whether FILE_CODING is defined. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
69 #ifdef MULE
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
70 #define DFC_CHECK_DATA_COND_MULE(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
71 constant_string_mule, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
72 constant_string_non_mule) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
73 DFC_CHECK_DATA (ptr, len, constant_string_mule)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
74 #define DFC_CHECK_DATA_COND_MULE_NUL(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
75 constant_string_mule, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
76 constant_string_non_mule) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
77 DFC_CHECK_DATA_NUL (ptr, len, constant_string_mule)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
78 #else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
79 #define DFC_CHECK_DATA_COND_MULE(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
80 constant_string_mule, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
81 constant_string_non_mule) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
82 DFC_CHECK_DATA (ptr, len, constant_string_non_mule)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
83 #define DFC_CHECK_DATA_COND_MULE_NUL(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
84 constant_string_mule, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
85 constant_string_non_mule) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
86 DFC_CHECK_DATA_NUL (ptr, len, constant_string_non_mule)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
87 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
88
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
89 #ifdef FILE_CODING
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
90 #define DFC_CHECK_DATA_COND_EOL(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
91 constant_string_eol, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
92 constant_string_non_eol) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
93 DFC_CHECK_DATA (ptr, len, constant_string_eol)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
94 #define DFC_CHECK_DATA_COND_EOL_NUL(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
95 constant_string_eol, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
96 constant_string_non_eol) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
97 DFC_CHECK_DATA_NUL (ptr, len, constant_string_eol)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
98 #else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
99 #define DFC_CHECK_DATA_COND_EOL(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
100 constant_string_eol, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
101 constant_string_non_eol) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
102 DFC_CHECK_DATA (ptr, len, constant_string_non_eol)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
103 #define DFC_CHECK_DATA_COND_EOL_NUL(ptr,len, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
104 constant_string_eol, \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
105 constant_string_non_eol) \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
106 DFC_CHECK_DATA_NUL (ptr, len, constant_string_non_eol)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
107 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
108
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
109 /* Check for expected strings before and after conversion. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
110 #define DFC_CHECK_DATA(ptr,len, constant_string) do { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
111 assert ((len) == sizeof (constant_string) - 1); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
112 assert (!memcmp (ptr, constant_string, len)); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
113 } while (0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
114
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
115 /* Macro version that includes the trailing NULL byte. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
116 #define DFC_CHECK_DATA_NUL(ptr,len,constant_string) do {\
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
117 assert ((len) == sizeof (constant_string)); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
118 assert (!memcmp (ptr, constant_string, len)); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
119 } while (0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
120
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
121 #ifdef MULE
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
122 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
123 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
124 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
125 Fget_coding_system (intern ("iso-8859-2")));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
126 DFC_CHECK_DATA_NUL (ptr, len, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
127
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
128 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
129 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin2,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
130 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
131 Fget_coding_system (intern ("iso-8859-2")));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
132 DFC_CHECK_DATA (ptr, len, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
133
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
134 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
135 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
136 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
137 Fget_coding_system (intern ("iso-8859-2")));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
138 DFC_CHECK_DATA (ptr, len, ext_latin12);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
139
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
140 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
141 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
142 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
143 Fget_coding_system (intern ("iso-8859-2")));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
144 DFC_CHECK_DATA (ptr, len, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
145 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
146
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
147 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
148 LISP_OPAQUE, opaque,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
149 Fget_coding_system (intern ("iso-8859-2")));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
150 DFC_CHECK_DATA (XOPAQUE_DATA (opaque), XOPAQUE_SIZE (opaque), ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
151
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
152 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
153 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
154 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
155 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
156 DFC_CHECK_DATA (ptr, len, int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
157
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
158 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
159 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
160 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
161 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
162 DFC_CHECK_DATA (ptr, len, int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
163 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
164
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
165 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
166 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
167 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
168 DFC_CHECK_DATA (XSTRING_DATA (string), XSTRING_LENGTH (string), int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
169
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
170 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_latin,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
171 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
172 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
173 DFC_CHECK_DATA (XSTRING_DATA (string), XSTRING_LENGTH (string), int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
174
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
175 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque0_latin,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
176 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
177 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
178 DFC_CHECK_DATA_NUL (XSTRING_DATA (string), XSTRING_LENGTH (string), int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
179
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
180 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque0_latin,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
181 LISP_BUFFER, Fcurrent_buffer(),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
182 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
183 DFC_CHECK_DATA_NUL (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
184 sizeof (int_latin2), int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
185
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
186 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_latin,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
187 LISP_BUFFER, Fcurrent_buffer(),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
188 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
189 DFC_CHECK_DATA (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
190 sizeof (int_latin1) - 1, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
191
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
192 TO_INTERNAL_FORMAT (DATA, (ext_latin12, sizeof (ext_latin12) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
193 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
194 intern ("iso-8859-2"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
195 DFC_CHECK_DATA (ptr, len, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
196
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
197 #endif /* MULE */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
198
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
199 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
200 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
201 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
202 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
203 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
204
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
205 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
206 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
207 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
208 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
209 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
210
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
211 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
212 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
213 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
214 Fget_coding_system (Qbinary));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
215 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_tilde, int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
216
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
217 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
218 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
219 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
220 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
221 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
222
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
223
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
224 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
225 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
226 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
227 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
228 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
229
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
230 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
231 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
232 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
233 Fget_coding_system (Qbinary));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
234 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
235
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
236 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
237 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
238 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
239 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
240 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
241
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
242 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
243 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
244 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
245 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
246 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
247 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
248
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
249 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
250 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
251 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
252 Fget_coding_system (Qbinary));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
253 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_tilde, int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
254 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
255
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
256 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
257 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
258 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
259 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
260 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
261 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
262
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
263 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
264 LISP_OPAQUE, opaque,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
265 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
266 DFC_CHECK_DATA_COND_MULE (XOPAQUE_DATA (opaque),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
267 XOPAQUE_SIZE (opaque), ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
268
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
269 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
270 LISP_OPAQUE, opaque,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
271 Fget_coding_system (Qbinary));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
272 DFC_CHECK_DATA_COND_MULE_NUL (XOPAQUE_DATA (opaque),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
273 XOPAQUE_SIZE (opaque), ext_tilde, int_latin2);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
274
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
275 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
276 LISP_OPAQUE, opaque,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
277 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
278 DFC_CHECK_DATA_COND_MULE (XOPAQUE_DATA (opaque),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
279 XOPAQUE_SIZE (opaque), ext_latin, int_latin1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
280
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
281 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
282 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
283 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
284 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
285 DFC_CHECK_DATA_COND_MULE (ptr, len, int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
286
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
287 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
288 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
289 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
290 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
291 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
292
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
293 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
294 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
295 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
296 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
297 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
298 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
299
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
300 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
301 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
302 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
303 Qnil);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
304 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
305 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
306
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
307 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
308 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
309 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
310 DFC_CHECK_DATA_COND_MULE (XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
311 XSTRING_LENGTH (string), int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
312
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
313 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_latin,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
314 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
315 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
316 DFC_CHECK_DATA_COND_MULE (XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
317 XSTRING_LENGTH (string), int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
318
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
319 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque0_latin,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
320 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
321 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
322 DFC_CHECK_DATA_COND_MULE_NUL (XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
323 XSTRING_LENGTH (string), int_latin1, ext_latin);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
324
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
325
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
326 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
327 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
328 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
329 Fget_coding_system (Qbinary));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
330 DFC_CHECK_DATA_COND_EOL_NUL (ptr, len, ext_unix, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
331 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
332
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
333 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
334 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
335 LISP_OPAQUE, opaque,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
336 intern ("raw-text-mac"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
337 DFC_CHECK_DATA_COND_EOL (XOPAQUE_DATA (opaque),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
338 XOPAQUE_SIZE (opaque), ext_mac, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
339
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
340 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
341 TO_EXTERNAL_FORMAT (LISP_STRING, string_foo,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
342 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
343 intern ("raw-text-dos"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
344 DFC_CHECK_DATA_COND_EOL (ptr, len, ext_dos, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
345
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
346 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
347 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
348 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
349 intern ("raw-text-unix"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
350 DFC_CHECK_DATA_COND_EOL (ptr, len, ext_unix, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
351
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
352 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
353 TO_EXTERNAL_FORMAT (LISP_STRING, string_foo,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
354 MALLOC, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
355 intern ("no-conversion-mac"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
356 DFC_CHECK_DATA_COND_EOL (ptr, len, ext_mac, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
357 xfree (ptr);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
358
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
359 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
360 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
361 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
362 Fget_coding_system (intern ("no-conversion-dos")));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
363 DFC_CHECK_DATA_COND_EOL (ptr, len, ext_dos, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
364
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
365 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
366 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
367 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
368 intern ("no-conversion-unix"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
369 DFC_CHECK_DATA_COND_EOL_NUL (ptr, len, ext_unix, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
370
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
371 #ifdef FILE_CODING
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
372 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_dos,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
373 LISP_BUFFER, Fcurrent_buffer(),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
374 intern ("undecided"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
375 DFC_CHECK_DATA (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
376 sizeof (int_foo) - 1, int_foo);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
377
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
378 #endif /* FILE_CODING */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
379
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
380 TO_INTERNAL_FORMAT (DATA, (ext_mac, sizeof (ext_mac) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
381 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
382 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
383 DFC_CHECK_DATA_COND_EOL (XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
384 XSTRING_LENGTH (string), int_foo, ext_mac);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
385
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
386 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
387 Lisp_Object stream =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
388 make_fixed_buffer_input_stream (ext_dos, sizeof (ext_dos) - 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
389 TO_INTERNAL_FORMAT (LISP_LSTREAM, stream,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
390 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
391 intern ("iso-8859-1"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
392 DFC_CHECK_DATA_COND_EOL (XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
393 XSTRING_LENGTH (string), int_foo, ext_dos);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
394 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
395
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
396 TO_INTERNAL_FORMAT (DATA, (ext_unix, sizeof (ext_unix) - 1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
397 LISP_STRING, string,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
398 intern ("no-conversion"));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
399 DFC_CHECK_DATA_COND_EOL (XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
400 XSTRING_LENGTH (string), int_foo, ext_unix);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
401
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
402
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
403 ptr = NULL, len = rand();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
404 TO_EXTERNAL_FORMAT (LISP_OPAQUE, opaque_dos,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
405 ALLOCA, (ptr, len),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
406 Qbinary);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
407 DFC_CHECK_DATA (ptr, len, ext_dos);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
408
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
409 return intern ("PASS");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
410 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
411
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
412
489
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
413 /* Hash Table testing */
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
414
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
415 typedef struct
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
416 {
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
417 Lisp_Object hash_table;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
418 EMACS_INT sum;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
419 } test_hash_tables_data;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
420
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
421
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
422 static int
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
423 test_hash_tables_mapper (Lisp_Object key, Lisp_Object value,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
424 void *extra_arg)
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
425 {
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
426 test_hash_tables_data *p = (test_hash_tables_data *) extra_arg;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
427 p->sum += XINT (value);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
428 return 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
429 }
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
430
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
431 static int
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
432 test_hash_tables_modifying_mapper (Lisp_Object key, Lisp_Object value,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
433 void *extra_arg)
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
434 {
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
435 test_hash_tables_data *p = (test_hash_tables_data *) extra_arg;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
436 Fputhash (make_int (- XINT (key)),
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
437 make_int (2 * XINT (value)),
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
438 p->hash_table);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
439 p->sum += XINT (value);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
440 return 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
441 }
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
442
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
443 static int
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
444 test_hash_tables_predicate (Lisp_Object key, Lisp_Object value,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
445 void *extra_arg)
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
446 {
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
447 return XINT (key) < 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
448 }
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
449
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
450
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
451 DEFUN ("test-hash-tables", Ftest_hash_tables, 0, 0, "", /*
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
452 Test C interface to hash tables.
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
453 */
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
454 ())
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
455 {
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
456 test_hash_tables_data data;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
457 data.hash_table = make_lisp_hash_table (50, HASH_TABLE_NON_WEAK,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
458 HASH_TABLE_EQUAL);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
459
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
460 Fputhash (make_int (1), make_int (2), data.hash_table);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
461 Fputhash (make_int (3), make_int (4), data.hash_table);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
462
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
463 data.sum = 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
464 elisp_maphash_unsafe (test_hash_tables_mapper,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
465 data.hash_table, (void *) &data);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
466 assert (data.sum == 2 + 4);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
467
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
468 data.sum = 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
469 elisp_maphash (test_hash_tables_modifying_mapper,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
470 data.hash_table, (void *) &data);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
471 assert (data.sum == 2 + 4);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
472
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
473 /* hash table now contains: (1, 2) (3, 4) (-1, 2*2) (-3, 2*4) */
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
474
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
475 data.sum = 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
476 elisp_maphash_unsafe (test_hash_tables_mapper,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
477 data.hash_table, (void *) &data);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
478 assert (data.sum == 3 * (2 + 4));
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
479
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
480 /* Remove entries with negative keys, added by modifying mapper */
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
481 elisp_map_remhash (test_hash_tables_predicate,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
482 data.hash_table, 0);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
483
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
484 data.sum = 0;
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
485 elisp_maphash_unsafe (test_hash_tables_mapper,
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
486 data.hash_table, (void *) &data);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
487 assert (data.sum == 2 + 4);
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
488
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
489 return intern ("PASS");
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
490 }
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
491
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
492
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
493
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
494 #define TESTS_DEFSUBR(Fname) do { \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
495 DEFSUBR (Fname); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
496 Vtest_function_list = \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
497 Fcons (intern (subr_name (&S##Fname)), \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
498 Vtest_function_list); \
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
499 } while (0)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
500
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
501 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
502 syms_of_tests (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
503 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
504 Vtest_function_list = Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
505
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
506 TESTS_DEFSUBR (Ftest_data_format_conversion);
489
4a8bb4aa9740 [xemacs-hg @ 2001-04-30 08:49:24 by martinb]
martinb
parents: 398
diff changeset
507 TESTS_DEFSUBR (Ftest_hash_tables);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
508 /* Add other test functions here with TESTS_DEFSUBR */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
509 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
510
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
511 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
512 vars_of_tests (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
513 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
514 DEFVAR_LISP ("test-function-list", &Vtest_function_list /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
515 List of all test functions defined in tests.c.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
516 For use by the automated test suite. See tests/automated/c-tests.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
517 */ );
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
518 }