mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-25 05:51:55 -08:00
Moved macros from eval.h to cons.h
This commit is contained in:
parent
bb0ca9163f
commit
de3349b677
6 changed files with 109 additions and 45 deletions
35
src/h/cons.h
35
src/h/cons.h
|
|
@ -22,6 +22,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define Null(x) ((x)==Cnil)
|
||||
#define CONS(a,d) ecl_cons((a),(d))
|
||||
#define ACONS(a,b,c) ecl_cons(ecl_cons((a),(b)),(c))
|
||||
|
||||
/* BEGIN-GENERATED (gen-cons-h) */
|
||||
|
||||
#if ECL_CAN_INLINE
|
||||
|
|
@ -435,6 +439,37 @@ extern ECL_API cl_object ecl_cdaddr(cl_object);
|
|||
extern ECL_API cl_object ecl_cadddr(cl_object);
|
||||
extern ECL_API cl_object ecl_cddddr(cl_object);
|
||||
|
||||
#define CAR(x) _ecl_car(x)
|
||||
#define CDR(x) _ecl_cdr(x)
|
||||
#define CAAR(x) _ecl_caar(x)
|
||||
#define CDAR(x) _ecl_cdar(x)
|
||||
#define CADR(x) _ecl_cadr(x)
|
||||
#define CDDR(x) _ecl_cddr(x)
|
||||
#define CAAAR(x) _ecl_caaar(x)
|
||||
#define CDAAR(x) _ecl_cdaar(x)
|
||||
#define CADAR(x) _ecl_cadar(x)
|
||||
#define CDDAR(x) _ecl_cddar(x)
|
||||
#define CAADR(x) _ecl_caadr(x)
|
||||
#define CDADR(x) _ecl_cdadr(x)
|
||||
#define CADDR(x) _ecl_caddr(x)
|
||||
#define CDDDR(x) _ecl_cdddr(x)
|
||||
#define CAAAAR(x) _ecl_caaaar(x)
|
||||
#define CDAAAR(x) _ecl_cdaaar(x)
|
||||
#define CADAAR(x) _ecl_cadaar(x)
|
||||
#define CDDAAR(x) _ecl_cddaar(x)
|
||||
#define CAADAR(x) _ecl_caadar(x)
|
||||
#define CDADAR(x) _ecl_cdadar(x)
|
||||
#define CADDAR(x) _ecl_caddar(x)
|
||||
#define CDDDAR(x) _ecl_cdddar(x)
|
||||
#define CAAADR(x) _ecl_caaadr(x)
|
||||
#define CDAADR(x) _ecl_cdaadr(x)
|
||||
#define CADADR(x) _ecl_cadadr(x)
|
||||
#define CDDADR(x) _ecl_cddadr(x)
|
||||
#define CAADDR(x) _ecl_caaddr(x)
|
||||
#define CDADDR(x) _ecl_cdaddr(x)
|
||||
#define CADDDR(x) _ecl_cadddr(x)
|
||||
#define CDDDDR(x) _ecl_cddddr(x)
|
||||
|
||||
extern ECL_API cl_object cl_car(cl_object);
|
||||
extern ECL_API cl_object cl_cdr(cl_object);
|
||||
extern ECL_API cl_object cl_caar(cl_object);
|
||||
|
|
|
|||
|
|
@ -79,13 +79,13 @@
|
|||
|
||||
#include <ecl/object.h>
|
||||
#include <ecl/external.h>
|
||||
#include <ecl/eval.h>
|
||||
#include <ecl/cons.h>
|
||||
#include <ecl/stacks.h>
|
||||
#include <ecl/number.h>
|
||||
#ifdef LOCATIVE
|
||||
#include <ecl/unify.h>
|
||||
#endif
|
||||
#include <ecl/legacy.h>
|
||||
|
||||
typedef void (*ecl_init_function_t)(cl_object block);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#define CONS(a,d) ecl_cons((a),(d))
|
||||
#define ACONS(a,b,c) ecl_cons(ecl_cons((a),(b)),(c))
|
||||
|
||||
/*
|
||||
#define CAR(x) (Null(x)? (x) : ECL_CONS_CAR(x))
|
||||
#define CDR(x) (Null(x)? (x) : ECL_CONS_CDR(x))
|
||||
|
||||
|
|
@ -48,5 +50,6 @@
|
|||
#define CDDADR(x) CDR(CDADR(x))
|
||||
#define CDDDAR(x) CDR(CDDAR(x))
|
||||
#define CDDDDR(x) CDR(CDDDR(x))
|
||||
*/
|
||||
|
||||
#define Null(x) ((x)==Cnil)
|
||||
|
|
|
|||
|
|
@ -2153,50 +2153,6 @@ extern ECL_API cl_object si_non_negative_long_float_p(cl_object);
|
|||
extern ECL_API cl_object si_non_positive_long_float_p(cl_object);
|
||||
extern ECL_API cl_object si_positive_long_float_p(cl_object);
|
||||
|
||||
/*
|
||||
* LEGACY
|
||||
*/
|
||||
#ifndef ECL_NO_LEGACY
|
||||
|
||||
#define make_shortfloat(x) ecl_make_shortfloat(x);
|
||||
#define cl_def_c_function_va(sym,function) ecl_def_c_function_va(sym,function)
|
||||
#define cl_def_c_function(sym,function,narg) ecl_def_c_function(sym,function,narg)
|
||||
#define cl_def_c_macro(sym,function,narg) { \
|
||||
int n = (narg); \
|
||||
if (n < 0) \
|
||||
ecl_def_c_macro_va((sym),(function)); \
|
||||
else \
|
||||
ecl_def_c_macro((sym),(function),n); }
|
||||
#define cl_make_cfun(fun,name,block,narg) ecl_make_cfun(fun,name,block,narg)
|
||||
#define cl_make_cfun_va(fun,name,block) ecl_make_cfun_va(fun,name,block)
|
||||
#define cl_make_cclosure_va(fun,name,block) ecl_make_cclosure_va(fun,name,block)
|
||||
#define si_bc_file(o) si_compiled_function_file(o)
|
||||
#define ARRAYP ECL_ARRAYP
|
||||
#define VECTORP ECL_VECTORP
|
||||
#define c_string_to_object ecl_read_from_cstring
|
||||
|
||||
#define big_register0_get _ecl_big_register0
|
||||
#define big_register1_get _ecl_big_register1
|
||||
#define big_register2_get _ecl_big_register2
|
||||
#define big_register_free _ecl_big_register_free
|
||||
#define big_register_copy _ecl_big_register_copy
|
||||
#define big_register_normalize _ecl_big_register_normalize
|
||||
/* #define big_copy _ecl_big_copy Has disappeared */
|
||||
/* #define big_to_double Has disappeared */
|
||||
|
||||
#define cl_alloc_simple_base_string ecl_alloc_simple_base_string
|
||||
#define cl_alloc_adjustable_base_string ecl_alloc_adjustable_base_string
|
||||
#define cl_alloc_simple_extended_string ecl_alloc_simple_extended_string
|
||||
|
||||
#define ecl_search_hash _ecl_gethash
|
||||
|
||||
#define read_VV ecl_init_module
|
||||
|
||||
#endif
|
||||
|
||||
#define make_simple_base_string(s) ecl_make_simple_base_string((s),-1)
|
||||
#define make_constant_base_string(s) ecl_make_simple_base_string((char *)(s),-1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
61
src/h/legacy.h
Normal file
61
src/h/legacy.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- mode: c; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
legacy.h -- Legacy macros, functions and names.
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2011, Juan Jose Garcia-Ripoll
|
||||
|
||||
ECL is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
See file '../Copyright' for full details.
|
||||
*/
|
||||
|
||||
#if !defined(ECL_LEGACY_H) && !defined(ECL_NO_LEGACY)
|
||||
#define ECL_LEGACY_H
|
||||
|
||||
/*
|
||||
* LEGACY
|
||||
*/
|
||||
|
||||
#define make_shortfloat(x) ecl_make_shortfloat(x);
|
||||
#define cl_def_c_function_va(sym,function) ecl_def_c_function_va(sym,function)
|
||||
#define cl_def_c_function(sym,function,narg) ecl_def_c_function(sym,function,narg)
|
||||
#define cl_def_c_macro(sym,function,narg) { \
|
||||
int n = (narg); \
|
||||
if (n < 0) \
|
||||
ecl_def_c_macro_va((sym),(function)); \
|
||||
else \
|
||||
ecl_def_c_macro((sym),(function),n); }
|
||||
#define cl_make_cfun(fun,name,block,narg) ecl_make_cfun(fun,name,block,narg)
|
||||
#define cl_make_cfun_va(fun,name,block) ecl_make_cfun_va(fun,name,block)
|
||||
#define cl_make_cclosure_va(fun,name,block) ecl_make_cclosure_va(fun,name,block)
|
||||
#define si_bc_file(o) si_compiled_function_file(o)
|
||||
#define ARRAYP ECL_ARRAYP
|
||||
#define VECTORP ECL_VECTORP
|
||||
#define c_string_to_object ecl_read_from_cstring
|
||||
|
||||
#define big_register0_get _ecl_big_register0
|
||||
#define big_register1_get _ecl_big_register1
|
||||
#define big_register2_get _ecl_big_register2
|
||||
#define big_register_free _ecl_big_register_free
|
||||
#define big_register_copy _ecl_big_register_copy
|
||||
#define big_register_normalize _ecl_big_register_normalize
|
||||
/* #define big_copy _ecl_big_copy Has disappeared */
|
||||
/* #define big_to_double Has disappeared */
|
||||
|
||||
#define cl_alloc_simple_base_string ecl_alloc_simple_base_string
|
||||
#define cl_alloc_adjustable_base_string ecl_alloc_adjustable_base_string
|
||||
#define cl_alloc_simple_extended_string ecl_alloc_simple_extended_string
|
||||
|
||||
#define ecl_search_hash _ecl_gethash
|
||||
|
||||
#define read_VV ecl_init_module
|
||||
|
||||
#endif /* !ECL_LEGACY_H && !ECL_NO_LEGACY */
|
||||
|
||||
#define make_simple_base_string(s) ecl_make_simple_base_string((s),-1)
|
||||
#define make_constant_base_string(s) ecl_make_simple_base_string((char *)(s),-1)
|
||||
|
||||
|
|
@ -47,6 +47,8 @@
|
|||
(case flag
|
||||
(:inline
|
||||
(write-rec depth list :unsafe "static ECL_INLINE "))
|
||||
(:unsafe-macro
|
||||
(format t "~%#define C~AR(x) _ecl_c~ar(x)" (string-upcase string) string))
|
||||
(:unsafe
|
||||
(format t "~%~acl_object _ecl_c~ar(cl_object x)~%{" prefix string)
|
||||
(loop for what in (reverse list)
|
||||
|
|
@ -86,6 +88,7 @@
|
|||
(loop for depth from 1 below 5
|
||||
do (write-rec depth nil :declare-safe))
|
||||
(terpri)
|
||||
(gen-cons-legacy-h)
|
||||
(loop for depth from 1 below 5
|
||||
do (write-rec depth nil :declare-common-lisp))
|
||||
(terpri))
|
||||
|
|
@ -102,6 +105,11 @@
|
|||
do (write-rec depth nil :common-lisp))
|
||||
(terpri))
|
||||
|
||||
(defun gen-cons-legacy-h ()
|
||||
(loop for depth from 1 below 5
|
||||
do (write-rec depth nil :unsafe-macro))
|
||||
(terpri))
|
||||
|
||||
(defun gen-cons-sysfun ()
|
||||
(loop for depth from 1 below 5
|
||||
do (write-rec depth nil :common-lisp-inline))
|
||||
|
|
@ -109,6 +117,7 @@
|
|||
|
||||
(process-file "src/c/cons.d")
|
||||
(process-file "src/h/cons.h")
|
||||
;(process-file "src/h/legacy.h")
|
||||
(process-file "src/cmp/sysfun.lsp")
|
||||
(terpri)
|
||||
#+ecl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue