mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 13:49:17 +02:00
Mark char* input parameters const where applicable.
This commit is contained in:
parent
d0155f4bf2
commit
c8e1f4c18c
16 changed files with 24 additions and 19 deletions
|
@ -12,7 +12,7 @@
|
||||||
extern sexp sexp_gc (sexp ctx, size_t *sum_freed);
|
extern sexp sexp_gc (sexp ctx, size_t *sum_freed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void sexp_define_type_predicate (sexp ctx, sexp env, char *cname, sexp_uint_t type) {
|
static void sexp_define_type_predicate (sexp ctx, sexp env, const char *cname, sexp_uint_t type) {
|
||||||
sexp_gc_var2(name, op);
|
sexp_gc_var2(name, op);
|
||||||
sexp_gc_preserve2(ctx, name, op);
|
sexp_gc_preserve2(ctx, name, op);
|
||||||
name = sexp_c_string(ctx, cname, -1);
|
name = sexp_c_string(ctx, cname, -1);
|
||||||
|
@ -22,7 +22,8 @@ static void sexp_define_type_predicate (sexp ctx, sexp env, char *cname, sexp_ui
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sexp_define_accessors (sexp ctx, sexp env, sexp_uint_t ctype,
|
static void sexp_define_accessors (sexp ctx, sexp env, sexp_uint_t ctype,
|
||||||
sexp_uint_t cindex, char* get, char *set) {
|
sexp_uint_t cindex,
|
||||||
|
const char* get, const char *set) {
|
||||||
sexp type, index;
|
sexp type, index;
|
||||||
sexp_gc_var2(name, op);
|
sexp_gc_var2(name, op);
|
||||||
sexp_gc_preserve2(ctx, name, op);
|
sexp_gc_preserve2(ctx, name, op);
|
||||||
|
@ -480,7 +481,7 @@ static sexp sexp_unsetenv (sexp ctx, sexp self, sexp_sint_t n, sexp name) {
|
||||||
#define sexp_define_type(ctx, name, tag) \
|
#define sexp_define_type(ctx, name, tag) \
|
||||||
sexp_env_define(ctx, env, sexp_intern(ctx, name, -1), sexp_type_by_index(ctx, tag));
|
sexp_env_define(ctx, env, sexp_intern(ctx, name, -1), sexp_type_by_index(ctx, tag));
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -231,7 +231,7 @@ static sexp sexp_disasm (sexp ctx, sexp self, sexp_sint_t n, sexp bc, sexp out)
|
||||||
return disasm(ctx, self, bc, out, 0);
|
return disasm(ctx, self, bc, out, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -128,7 +128,7 @@ static sexp sexp_heap_dump (sexp ctx, sexp self, sexp_sint_t n, sexp depth) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <chibi/eval.h>
|
#include <chibi/eval.h>
|
||||||
|
|
||||||
|
#if SEXP_USE_SEND_FILE
|
||||||
|
#include <sys/sendfile.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SEXP_LAST_CONTEXT_CHECK_LIMIT 256
|
#define SEXP_LAST_CONTEXT_CHECK_LIMIT 256
|
||||||
|
|
||||||
#define sexp_cookie_ctx(vec) sexp_vector_ref((sexp)vec, SEXP_ZERO)
|
#define sexp_cookie_ctx(vec) sexp_vector_ref((sexp)vec, SEXP_ZERO)
|
||||||
|
@ -144,7 +148,7 @@ static cookie_io_functions_t sexp_cookie_no_seek = {
|
||||||
|
|
||||||
#endif /* !SEXP_BSD */
|
#endif /* !SEXP_BSD */
|
||||||
|
|
||||||
static sexp sexp_make_custom_port (sexp ctx, sexp self, char *mode,
|
static sexp sexp_make_custom_port (sexp ctx, sexp self, const char *mode,
|
||||||
sexp read, sexp write,
|
sexp read, sexp write,
|
||||||
sexp seek, sexp close) {
|
sexp seek, sexp close) {
|
||||||
FILE *in;
|
FILE *in;
|
||||||
|
@ -190,7 +194,7 @@ static sexp sexp_make_custom_port (sexp ctx, sexp self, char *mode,
|
||||||
#else /* ! SEXP_USE_STRING_STREAMS */
|
#else /* ! SEXP_USE_STRING_STREAMS */
|
||||||
|
|
||||||
static sexp sexp_make_custom_port (sexp ctx, sexp self,
|
static sexp sexp_make_custom_port (sexp ctx, sexp self,
|
||||||
char *mode, sexp read, sexp write,
|
const char *mode, sexp read, sexp write,
|
||||||
sexp seek, sexp close) {
|
sexp seek, sexp close) {
|
||||||
sexp vec;
|
sexp vec;
|
||||||
sexp_gc_var2(res, str);
|
sexp_gc_var2(res, str);
|
||||||
|
|
|
@ -10,7 +10,7 @@ static sexp sexp_increment_cdr (sexp ctx, sexp self, sexp_sint_t n, sexp pair) {
|
||||||
return SEXP_VOID;
|
return SEXP_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -19,7 +19,7 @@ static sexp copy_opcode (sexp ctx, struct sexp_opcode_struct *op) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
sexp_gc_var2(name, op);
|
sexp_gc_var2(name, op);
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
|
|
|
@ -59,7 +59,7 @@ sexp sexp_weak_vector_set (sexp ctx, sexp self, sexp_sint_t n, sexp v, sexp k, s
|
||||||
return SEXP_VOID;
|
return SEXP_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
#if 0
|
#if 0
|
||||||
sexp v;
|
sexp v;
|
||||||
int sexp_weak_vector_id;
|
int sexp_weak_vector_id;
|
||||||
|
|
|
@ -93,7 +93,7 @@ static sexp sexp_current_clock_second (sexp ctx, sexp self, sexp_sint_t n) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return sexp_global(ctx, SEXP_G_ABI_ERROR);
|
return sexp_global(ctx, SEXP_G_ABI_ERROR);
|
||||||
|
|
|
@ -629,7 +629,7 @@ sexp sexp_lookup_named_type (sexp ctx, sexp env, const char *name) {
|
||||||
|
|
||||||
#endif /* SEXP_USE_GREEN_THREADS */
|
#endif /* SEXP_USE_GREEN_THREADS */
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
sexp t;
|
sexp t;
|
||||||
sexp_gc_var1(name);
|
sexp_gc_var1(name);
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
|
|
|
@ -169,7 +169,7 @@ static sexp sexp_random_source_pseudo_randomize (sexp ctx, sexp self, sexp_sint_
|
||||||
return SEXP_VOID;
|
return SEXP_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
sexp_gc_var2(name, op);
|
sexp_gc_var2(name, op);
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
|
|
|
@ -311,7 +311,7 @@ static sexp sexp_bit_set_p (sexp ctx, sexp self, sexp_sint_t n, sexp i, sexp x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -26,7 +26,7 @@ static sexp sexp_parameter_converter (sexp ctx, sexp self, sexp_sint_t n, sexp p
|
||||||
return res ? res : SEXP_FALSE;
|
return res ? res : SEXP_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -236,7 +236,7 @@ static sexp sexp_hash_table_delete (sexp ctx, sexp self, sexp_sint_t n, sexp ht,
|
||||||
return SEXP_VOID;
|
return SEXP_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -256,7 +256,7 @@ static sexp sexp_sort_x (sexp ctx, sexp self, sexp_sint_t n, sexp seq,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -44,7 +44,7 @@ sexp sexp_get_environment_variables (sexp ctx, sexp self, sexp_sint_t n) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {
|
sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {
|
||||||
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
if (!(sexp_version_compatible(ctx, version, sexp_version)
|
||||||
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
&& sexp_abi_compatible(ctx, abi, SEXP_ABI_IDENTIFIER)))
|
||||||
return SEXP_ABI_ERROR;
|
return SEXP_ABI_ERROR;
|
||||||
|
|
|
@ -1707,7 +1707,7 @@
|
||||||
(newline)
|
(newline)
|
||||||
(if *c++?*
|
(if *c++?*
|
||||||
(cat "extern \"C\" "))
|
(cat "extern \"C\" "))
|
||||||
(cat "sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, sexp_abi_identifier_t abi) {\n"
|
(cat "sexp sexp_init_library (sexp ctx, sexp self, sexp_sint_t n, sexp env, const char* version, const sexp_abi_identifier_t abi) {\n"
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (t) (cat " sexp " t ";\n"))
|
(lambda (t) (cat " sexp " t ";\n"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue