forked from remacs/remacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
executable file
·368 lines (340 loc) · 10.8 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(private_no_mangle_fns)]
#![feature(proc_macro)]
#![cfg_attr(feature = "strict", deny(warnings))]
#![feature(global_allocator)]
// Wilfred/remacs#38 : Need to override the allocator for legacy unexec support on Mac.
#[cfg(all(not(test), target_os = "macos"))]
extern crate alloc_unexecmacosx;
#[macro_use]
extern crate lazy_static;
extern crate remacs_sys;
// Needed for linking.
#[allow(unused_extern_crates)]
extern crate remacs_lib;
extern crate remacs_macros;
extern crate libc;
extern crate md5;
extern crate rand;
extern crate sha1;
extern crate sha2;
extern crate base64 as base64_crate;
#[macro_use]
mod eval;
mod lisp;
mod lists;
mod marker;
mod floatfns;
mod math;
mod numbers;
mod objects;
mod strings;
mod symbols;
#[macro_use]
mod vectors;
mod character;
mod base64;
mod crypto;
mod str2sig;
mod multibyte;
mod buffers;
mod windows;
mod hashtable;
mod interactive;
mod process;
mod fonts;
mod threads;
mod chartable;
mod category;
mod obarray;
mod editfns;
mod util;
mod minibuf;
mod fns;
#[cfg(all(not(test), target_os = "macos"))]
use alloc_unexecmacosx::OsxUnexecAlloc;
#[cfg(all(not(test), target_os = "macos"))]
#[global_allocator]
static ALLOCATOR: OsxUnexecAlloc = OsxUnexecAlloc;
use remacs_sys::Lisp_Subr;
pub use base64::base64_encode_1;
pub use base64::base64_decode_1;
pub use util::clip_to_bounds;
// Used in buffer.c
pub use buffers::Fbuffer_live_p;
pub use buffers::Fbuffer_modified_p;
// Used in window.c
pub use windows::Fwindow_buffer;
// used in process.c
pub use buffers::Fbuffer_name;
pub use buffers::validate_region;
// Used in nsfns.m
pub use buffers::Fbuffer_file_name;
// These need to be exported as bytecode.c depends upon them.
pub use math::Fplus;
pub use math::Fminus;
pub use math::Ftimes;
pub use math::Fmax;
pub use math::Fmin;
pub use math::Fquo;
pub use math::Flss;
pub use math::Fleq;
pub use math::arithcompare;
pub use editfns::Feobp;
pub use editfns::Fbobp;
pub use fns::Felt;
// Widely used in the C codebase.
pub use lists::Fsetcar;
pub use lists::Fsetcdr;
pub use lists::Fcar;
pub use lists::Fcdr;
pub use lists::Fcar_safe;
pub use lists::Fcdr_safe;
pub use lists::Flistp;
pub use lists::Fnthcdr;
pub use lists::Fnth;
pub use lists::Fmemq;
pub use lists::Fmember;
pub use lists::Fassq;
pub use lists::Fassoc;
pub use lists::Frassq;
pub use lists::Frassoc;
pub use lists::Fdelq;
pub use lists::Fplist_get;
pub use lists::Fplist_member;
pub use lists::Fplist_put;
pub use lists::Fget;
pub use lists::Fput;
pub use lists::Flist;
pub use lists::Fmake_list;
pub use floatfns::extract_float;
pub use numbers::Frandom;
pub use objects::Fequal;
pub use objects::Fequal_including_properties;
pub use symbols::Fsymbolp;
pub use symbols::Fsymbol_name;
pub use symbols::Ffboundp;
pub use symbols::Fsymbol_function;
pub use symbols::Fsymbol_plist;
pub use strings::Fstring_equal;
pub use strings::Fstring_as_multibyte;
pub use strings::Fstring_to_multibyte;
pub use strings::Fstring_to_unibyte;
pub use strings::Fmultibyte_string_p;
pub use strings::Fstring_lessp;
pub use vectors::Flength;
pub use vectors::Fsort;
pub use lists::merge;
pub use buffers::Fget_buffer;
pub use buffers::Fcurrent_buffer;
pub use buffers::Fset_buffer;
pub use obarray::intern_1;
pub use obarray::Fintern;
pub use obarray::Fintern_soft;
pub use marker::Fmarker_position;
pub use marker::Fmarker_buffer;
pub use windows::Fwindow_point;
// Used in fileio.c
pub use editfns::Fpoint;
// used in chartab.c
pub use chartable::Fset_char_table_parent;
// used in category.c
pub use category::Fcategory_table_p;
// Used in process.c
pub use str2sig::str2sig;
pub use process::Fget_process;
// Used in character.c
pub use multibyte::char_resolve_modifier_mask;
pub use multibyte::char_string;
pub use multibyte::string_char;
pub use multibyte::count_size_as_multibyte;
pub use multibyte::multibyte_chars_in_text;
pub use multibyte::parse_str_as_multibyte;
pub use multibyte::str_as_multibyte;
pub use multibyte::str_to_multibyte;
pub use multibyte::str_as_unibyte;
pub use multibyte::str_to_unibyte;
// Used in xdisp.c
pub use buffers::Foverlay_start;
pub use buffers::Foverlay_end;
// Used in window.c, macros.c
pub use interactive::Fprefix_numeric_value;
pub use editfns::Fbolp;
pub use editfns::Feolp;
extern "C" {
fn defsubr(sname: *const Lisp_Subr);
}
#[no_mangle]
pub extern "C" fn rust_init_syms() {
unsafe {
defsubr(&*buffers::Soverlayp);
defsubr(&*buffers::Sbuffer_live_p);
defsubr(&*buffers::Sget_buffer);
defsubr(&*buffers::Scurrent_buffer);
defsubr(&*buffers::Sbuffer_file_name);
defsubr(&*buffers::Sbuffer_modified_p);
defsubr(&*buffers::Sbuffer_modified_tick);
defsubr(&*buffers::Sbuffer_chars_modified_tick);
defsubr(&*buffers::Sbuffer_name);
defsubr(&*buffers::Sset_buffer);
defsubr(&*buffers::Soverlay_start);
defsubr(&*buffers::Soverlay_end);
defsubr(&*buffers::Soverlay_buffer);
defsubr(&*windows::Swindowp);
defsubr(&*windows::Swindow_live_p);
defsubr(&*windows::Swindow_point);
defsubr(&*windows::Sselected_window);
defsubr(&*windows::Swindow_buffer);
defsubr(&*windows::Swindow_valid_p);
defsubr(&*process::Sget_process);
defsubr(&*process::Sprocessp);
defsubr(&*lists::Satom);
defsubr(&*lists::Slistp);
defsubr(&*lists::Snlistp);
defsubr(&*math::Smod);
defsubr(&*math::Splus);
defsubr(&*math::Sminus);
defsubr(&*math::Stimes);
defsubr(&*math::Squo);
defsubr(&*math::Slogand);
defsubr(&*math::Slogior);
defsubr(&*math::Slogxor);
defsubr(&*math::Smax);
defsubr(&*math::Smin);
defsubr(&*math::Sabs);
defsubr(&*math::Seqlsign);
defsubr(&*math::Slss);
defsubr(&*math::Sgtr);
defsubr(&*math::Sleq);
defsubr(&*math::Sgeq);
defsubr(&*math::Sneq);
defsubr(&*numbers::Sintegerp);
defsubr(&*numbers::Sinteger_or_marker_p);
defsubr(&*numbers::Sfloatp);
defsubr(&*numbers::Snatnump);
defsubr(&*numbers::Snumber_or_marker_p);
defsubr(&*numbers::Snumberp);
defsubr(&*numbers::Srandom);
defsubr(&*objects::Snull);
defsubr(&*objects::Seq);
defsubr(&*objects::Seql);
defsubr(&*objects::Sequal);
defsubr(&*objects::Sequal_including_properties);
defsubr(&*symbols::Ssymbolp);
defsubr(&*symbols::Ssymbol_name);
defsubr(&*symbols::Sfboundp);
defsubr(&*symbols::Ssymbol_function);
defsubr(&*symbols::Ssymbol_plist);
defsubr(&*lists::Sconsp);
defsubr(&*lists::Ssetcar);
defsubr(&*lists::Ssetcdr);
defsubr(&*lists::Scar);
defsubr(&*lists::Scdr);
defsubr(&*lists::Scar_safe);
defsubr(&*lists::Scdr_safe);
defsubr(&*lists::Snthcdr);
defsubr(&*lists::Snth);
defsubr(&*lists::Smemq);
defsubr(&*lists::Smemql);
defsubr(&*lists::Smember);
defsubr(&*lists::Sassq);
defsubr(&*lists::Sassoc);
defsubr(&*lists::Srassq);
defsubr(&*lists::Srassoc);
defsubr(&*lists::Sdelq);
defsubr(&*lists::Splist_get);
defsubr(&*lists::Slax_plist_get);
defsubr(&*lists::Splist_member);
defsubr(&*lists::Splist_put);
defsubr(&*lists::Slax_plist_put);
defsubr(&*lists::Sget);
defsubr(&*lists::Sput);
defsubr(&*lists::Slist);
defsubr(&*lists::Smake_list);
defsubr(&*lists::Ssafe_length);
defsubr(&*marker::Smarkerp);
defsubr(&*marker::Smarker_position);
defsubr(&*marker::Smarker_buffer);
defsubr(&*strings::Sstringp);
defsubr(&*strings::Smultibyte_string_p);
defsubr(&*base64::Sbase64_encode_string);
defsubr(&*base64::Sbase64_decode_string);
defsubr(&*strings::Sstring_bytes);
defsubr(&*strings::Sstring_equal);
defsubr(&*strings::Sstring_as_multibyte);
defsubr(&*strings::Sstring_to_multibyte);
defsubr(&*strings::Sstring_to_unibyte);
defsubr(&*strings::Sstring_lessp);
defsubr(&*character::Smax_char);
defsubr(&*character::Scharacterp);
defsubr(&*character::Schar_or_string_p);
defsubr(&*character::Sunibyte_char_to_multibyte);
defsubr(&*character::Smultibyte_char_to_unibyte);
defsubr(&*vectors::Sarrayp);
defsubr(&*vectors::Sbool_vector_p);
defsubr(&*vectors::Sbufferp);
defsubr(&*vectors::Sbyte_code_function_p);
defsubr(&*vectors::Schar_table_p);
defsubr(&*vectors::Scondition_variable_p);
defsubr(&*vectors::Smutexp);
defsubr(&*vectors::Ssequencep);
defsubr(&*vectors::Ssort);
defsubr(&*vectors::Ssubrp);
defsubr(&*vectors::Sthreadp);
defsubr(&*vectors::Svector_or_char_table_p);
defsubr(&*vectors::Svectorp);
defsubr(&*vectors::Slength);
defsubr(&*hashtable::Scopy_hash_table);
defsubr(&*fonts::Sfontp);
defsubr(&*crypto::Smd5);
defsubr(&*crypto::Ssecure_hash);
defsubr(&*crypto::Sbuffer_hash);
defsubr(&*interactive::Sprefix_numeric_value);
defsubr(&*chartable::Schar_table_subtype);
defsubr(&*chartable::Schar_table_parent);
defsubr(&*chartable::Sset_char_table_parent);
defsubr(&*category::Scategory_table_p);
defsubr(&*category::Scategory_table);
defsubr(&*obarray::Sintern_soft);
defsubr(&*obarray::Sintern);
defsubr(&*floatfns::Sisnan);
defsubr(&*floatfns::Sacos);
defsubr(&*floatfns::Sasin);
defsubr(&*floatfns::Satan);
defsubr(&*floatfns::Scos);
defsubr(&*floatfns::Ssin);
defsubr(&*floatfns::Stan);
defsubr(&*floatfns::Slog);
defsubr(&*floatfns::Ssqrt);
defsubr(&*floatfns::Sexp);
defsubr(&*floatfns::Sffloor);
defsubr(&*floatfns::Sfceiling);
defsubr(&*floatfns::Sftruncate);
defsubr(&*floatfns::Sfloat);
defsubr(&*floatfns::Scopysign);
defsubr(&*floatfns::Sfrexp);
defsubr(&*floatfns::Sldexp);
defsubr(&*floatfns::Sexpt);
defsubr(&*floatfns::Slogb);
defsubr(&*floatfns::Sfround);
defsubr(&*floatfns::Sceiling);
defsubr(&*floatfns::Sfloor);
defsubr(&*floatfns::Sround);
defsubr(&*floatfns::Struncate);
defsubr(&*editfns::Spoint);
defsubr(&*editfns::Sbuffer_size);
defsubr(&*editfns::Seobp);
defsubr(&*editfns::Sbobp);
defsubr(&*editfns::Sbolp);
defsubr(&*editfns::Seolp);
defsubr(&*editfns::Sregion_beginning);
defsubr(&*editfns::Sregion_end);
defsubr(&*editfns::Smark_marker);
defsubr(&*editfns::Spoint_min);
defsubr(&*editfns::Spoint_max);
defsubr(&*minibuf::Sminibufferp);
defsubr(&*minibuf::Sactive_minibuffer_window);
defsubr(&*fns::Selt);
}
}