61e42e8527
* mes.c (scm_t): Change car, string, ref, cdr, macro, vector into g_cell index [WAS]: scm_t pointer. * define.c: Update. * lib.c: Update. * math.c: Update. * posix.c: Update. * quasiquote.c: Update. * string.c: Update. * type.c: Update. * build-aux/mes-snarf.mes Update. * tests/gc-4.test: New test. * tests/gc-5.test: New test. * tests/gc-6.test: New test.
103 lines
1.7 KiB
C
103 lines
1.7 KiB
C
/* -*-comment-start: "//";comment-end:""-*-
|
|
* Mes --- Maxwell Equations of Software
|
|
* Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
|
|
*
|
|
* This file is part of Mes.
|
|
*
|
|
* Mes is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
* your option) any later version.
|
|
*
|
|
* Mes is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#if !TYPE0
|
|
|
|
SCM
|
|
char_p (SCM x)
|
|
{
|
|
return type (x) == CHAR ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
macro_p (SCM x)
|
|
{
|
|
return type (x) == MACRO ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
number_p (SCM x)
|
|
{
|
|
return type (x) == NUMBER ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
pair_p (SCM x)
|
|
{
|
|
return type (x) == PAIR ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
ref_p (SCM x)
|
|
{
|
|
return type (x) == REF ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
string_p (SCM x)
|
|
{
|
|
return type (x) == STRING ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
symbol_p (SCM x)
|
|
{
|
|
return type (x) == SYMBOL ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
vector_p (SCM x)
|
|
{
|
|
return type (x) == VECTOR ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
builtin_p (SCM x)
|
|
{
|
|
return type (x) == FUNCTION ? cell_t : cell_f;
|
|
}
|
|
|
|
// Non-types
|
|
SCM
|
|
null_p (SCM x)
|
|
{
|
|
return x == cell_nil ? cell_t : cell_f;
|
|
}
|
|
|
|
SCM
|
|
atom_p (SCM x)
|
|
{
|
|
return (type (x) == PAIR ? cell_f : cell_t);
|
|
}
|
|
|
|
SCM
|
|
boolean_p (SCM x)
|
|
{
|
|
return (x == cell_t || x == cell_f) ? cell_t : cell_f;
|
|
}
|
|
#endif
|
|
|
|
SCM make_number (int);
|
|
SCM
|
|
mes_type_of (SCM x)
|
|
{
|
|
return make_number (type (x));
|
|
}
|