mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 05:27:35 +02:00
conditionally toggling isalpha/isxdigit between function or macro depending on platform
needed for plan9 where the function definitions are not provided
This commit is contained in:
parent
280ea1cddb
commit
78f0e9bd22
3 changed files with 10 additions and 5 deletions
|
@ -16,6 +16,8 @@ extern "C" {
|
|||
|
||||
#if defined(_WIN32) || defined(__MINGW32__)
|
||||
#include <windows.h>
|
||||
#define sexp_isalpha(x) ((isalpha)(x))
|
||||
#define sexp_isxdigit(x) ((isxdigit)(x))
|
||||
#else
|
||||
#if SEXP_USE_DL
|
||||
#include <dlfcn.h>
|
||||
|
@ -25,6 +27,8 @@ extern "C" {
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#define sexp_isalpha(x) (isalpha(x))
|
||||
#define sexp_isxdigit(x) (isxdigit(x))
|
||||
#endif
|
||||
|
||||
#ifdef PLAN9
|
||||
|
|
4
main.c
4
main.c
|
@ -201,10 +201,10 @@ void run_main (int argc, char **argv) {
|
|||
arg = ((argv[i][2] == '\0') ? argv[++i] : argv[i]+2);
|
||||
check_nonull_arg('h', arg);
|
||||
heap_size = strtoul(arg, &arg, 0);
|
||||
if ((isalpha)(*arg)) heap_size *= multiplier(*arg++);
|
||||
if (sexp_isalpha(*arg)) heap_size *= multiplier(*arg++);
|
||||
if (*arg == '/') {
|
||||
heap_max_size = strtoul(arg+1, &arg, 0);
|
||||
if ((isalpha)(*arg)) heap_max_size *= multiplier(*arg++);
|
||||
if (sexp_isalpha(*arg)) heap_max_size *= multiplier(*arg++);
|
||||
}
|
||||
break;
|
||||
case 'V':
|
||||
|
|
7
sexp.c
7
sexp.c
|
@ -1539,7 +1539,7 @@ sexp sexp_read_string (sexp ctx, sexp in) {
|
|||
case 't': c = '\t'; break;
|
||||
case 'x':
|
||||
c = sexp_read_char(ctx, in);
|
||||
if (isxdigit(c)) {
|
||||
if (sexp_isxdigit(c)) {
|
||||
c = digit_value(c)*16 + digit_value(sexp_read_char(ctx, in));
|
||||
} else {
|
||||
sexp_push_char(ctx, c, in); c = 'x';
|
||||
|
@ -1651,7 +1651,7 @@ sexp sexp_read_number (sexp ctx, sexp in, int base) {
|
|||
c = sexp_read_char(ctx, in);
|
||||
}
|
||||
|
||||
for ( ; isxdigit(c); c=sexp_read_char(ctx, in)) {
|
||||
for ( ; sexp_isxdigit(c); c=sexp_read_char(ctx, in)) {
|
||||
digit = digit_value(c);
|
||||
if ((digit < 0) || (digit >= base))
|
||||
break;
|
||||
|
@ -1919,7 +1919,8 @@ sexp sexp_read_raw (sexp ctx, sexp in) {
|
|||
if (sexp_string_length(res) == 1) {
|
||||
res = sexp_make_character(c1);
|
||||
} else if ((c1 == 'x' || c1 == 'X') &&
|
||||
(isxdigit)(str[1]) && (isxdigit)(str[2]) && str[3] == '\0') {
|
||||
sexp_isxdigit(str[1])
|
||||
&& sexp_isxdigit(str[2]) && str[3] == '\0') {
|
||||
res = sexp_make_character(16 * digit_value(str[1])
|
||||
+ digit_value(str[2]));
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue