core: Prepare for M2-Planet: if (foo).

Rewrite C-constructs not supported by M2-Planet

    if (foo)              -> if (foo != 0)

* src/posix.c: Rewrite C-constructs not supported by M2-Planet.
(current_input_port): Likewise.
* src/display.c (display_helper): : Likewise.
* src/eval-apply.c (expand_variable_): : Likewise.
(eval_apply): : Likewise.
* src/mes.c (open_boot): : Likewise.
* src/reader.c (reader_read_identifier_or_number): : Likewise.
* src/symbols.c (init_symbol): : Likewise.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-07-18 08:53:42 +02:00
parent 89c3246dd1
commit d7c4fae997
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
6 changed files with 10 additions and 10 deletions

View File

@ -115,7 +115,7 @@ display_helper (SCM x, int cont, char *sep, int fd, int write_p)
{
if (write_p == 0)
fdputc (VALUE (x), fd);
else if (1)
else
{
fdputs ("#", fd);
fdwrite_char (VALUE (x), fd);

View File

@ -259,7 +259,7 @@ expand_variable_ (SCM x, SCM formals, int top_p) /*:((internal)) */
else if (a == cell_symbol_define || a == cell_symbol_define_macro)
{
SCM f = CADR (x);
if (top_p && TYPE (f) == TPAIR)
if (top_p != 0 && TYPE (f) == TPAIR)
f = CDR (f);
formals = add_formals (formals, f);
x = CDR (x);
@ -270,7 +270,7 @@ expand_variable_ (SCM x, SCM formals, int top_p) /*:((internal)) */
&& a != cell_symbol_boot_module
&& a != cell_symbol_current_module
&& a != cell_symbol_primitive_load
&& formal_p (a, formals))
&& formal_p (CAR (x), formals) == 0)
{
SCM v = module_variable (R0, a);
if (v != cell_f)
@ -671,7 +671,7 @@ eval:
formals = CDADR (R1);
body = CDDR (R1);
if (macro_p || global_p)
if (macro_p != 0 || global_p != 0)
expand_variable (body, formals);
R1 = cons (cell_symbol_lambda, cons (formals, body));
push_cc (R1, R2, p, cell_vm_eval_define);

View File

@ -372,11 +372,11 @@ open_boot ()
char *boot = __open_boot_buf;
char *file_name = __open_boot_file_name;
strcpy (g_datadir, ".");
if (getenv ("MES_BOOT"))
if (getenv ("MES_BOOT") != 0)
strcpy (boot, getenv ("MES_BOOT"));
else
strcpy (boot, "boot-0.scm");
if (getenv ("MES_PREFIX"))
if (getenv ("MES_PREFIX") != 0)
{
strcpy (g_datadir, getenv ("MES_PREFIX"));
strcpy (g_datadir + strlen (g_datadir), "/mes");
@ -395,7 +395,7 @@ open_boot ()
if (__stdin < 0)
{
g_datadir[0] = 0;
if (getenv ("srcdest"))
if (getenv ("srcdest") != 0)
strcpy (g_datadir, getenv ("srcdest"));
strcpy (g_datadir + strlen (g_datadir), "mes");
strcpy (file_name, g_datadir);

View File

@ -197,7 +197,7 @@ current_input_port ()
if (__stdin >= 0)
return make_number (__stdin);
SCM x = g_ports;
while (x)
while (x != 0)
{
SCM a = CAR (x);
if (PORT (a) == __stdin)

View File

@ -91,7 +91,7 @@ reader_read_identifier_or_number (int c)
n = n + c - '0';
c = readchar ();
}
if (reader_end_of_word_p (c))
if (reader_end_of_word_p (c) != 0)
{
unreadchar (c);
if (negative_p != 0)

View File

@ -43,7 +43,7 @@ SCM
init_symbol (SCM x, long type, char const *name)
{
TYPE (x) = type;
if (!g_symbols)
if (g_symbols == 0)
g_free = g_free + M2_CELL_SIZE;
else
{