I have good news! The S7 integration I've been working on has been accepted
and pulled into the main branch of the TIC-80 and is flagged to be
integrated in the next version release (version 1.1). I have no idea when
this will be actually released but... we made it! Thanks for your support,
it was really appreciated!

I'm attaching the diff from s7.c that I got from your tarball with the one
that got integrated, in case you want some of those changes.

The main maintainer of the tic80 repo was asking me if we could add s7 as a
submodule to the tic80 repo, like most other languages were setup to be. To
achieve this though, we would need a good coordination of my changes into
your s7 repo but also, I think that we don't have the access rights to your
repo. When I try to clone it externally, it doesn't work with this error:

"fatal: unable to access 'https://cm-gitlab.stanford.edu/bil/s7/': SSL
certificate problem: unable to get local issuer certificate"

I noticed that there is a work around but if this is to be a tic-80
submodule, then it would need to work directly I think. Anyways, thanks
again for your great scheme implementation and your support!

--
David

On Fri, Feb 3, 2023 at 1:52 PM <[email protected]> wrote:

> > Would there be a way to give a better error message?
>
> The error message is the third argument to error_nr.
> One simple change might be to forward declare wrap_string
> and set_elist_1,
>
> static s7_pointer set_elist_1(s7_scheme *sc, s7_pointer x1);
> static s7_pointer wrap_string(s7_scheme *sc, const char *str, s7_int
> len);
>
> then
>
> static size_t local_fwrite(const void *ptr, size_t size, size_t nmemb,
> FILE *stream)
> {
>    error_nr(cur_sc, cur_sc->io_error_symbol,
>             set_elist_1(cur_sc, wrap_string(cur_sc, "writing a file is
> not allowed in this version of s7", 51)));
> }
>
> and similarly for local_fopen.  The integer (51 above) is the length of
> the
> error message string.
>
>

-- 
David
73,76d72
< // TIC-80 specific config
< #define WITH_SYSTEM_EXTRAS 0
< #define DISABLE_FILE_IO 1
< 
208,219c204,214
< /* #ifndef WITH_C_LOADER */
< /*   #if WITH_GCC && (!__MINGW32__) && (!__CYGWIN__) */
< /*     #define WITH_C_LOADER 1 */
< /*   /\* (load file.so [e]) looks for (e 'init_func) and if found, calls it as the shared object init function. */
< /*    * If WITH_SYSTEM_EXTRAS is 0, the caller needs to supply system and delete-file so that cload.scm works. */
< /*    *\/ */
< /*   #else */
< /*     #define WITH_C_LOADER 0 */
< /*     /\* I think dlopen et al are available in MS C, but I have no way to test them; see load_shared_object below *\/ */
< /*   #endif */
< /* #endif */
< #define WITH_C_LOADER 0
---
> #ifndef WITH_C_LOADER
>   #if WITH_GCC && (!__MINGW32__) && (!__CYGWIN__)
>     #define WITH_C_LOADER 1
>   /* (load file.so [e]) looks for (e 'init_func) and if found, calls it as the shared object init function.
>    * If WITH_SYSTEM_EXTRAS is 0, the caller needs to supply system and delete-file so that cload.scm works.
>    */
>   #else
>     #define WITH_C_LOADER 0
>     /* I think dlopen et al are available in MS C, but I have no way to test them; see load_shared_object below */
>   #endif
> #endif
250,256d244
< #elif defined(__ANDROID__)
<   #ifndef HAVE_COMPLEX_NUMBERS
<     #define HAVE_COMPLEX_NUMBERS 0
<   #endif
<   #ifndef HAVE_COMPLEX_TRIG
<     #define HAVE_COMPLEX_TRIG 0
<   #endif
348c336
<   #define noreturn 
---
>   #define noreturn _Noreturn /* deprecated in C23 */
378c366
< #if defined(_MSC_VER) || defined(__MINGW32__) || defined(S7_BAREMETALPI) || defined(S7_N3DS)
---
> #if defined(_MSC_VER) || defined(__MINGW32__)
1433,1437d1420
< 
< #ifndef DISABLE_FILE_IO
<    #define DISABLE_FILE_IO 0
< #endif
< 
1439c1422
<    static void gdb_break(void) {};
---
>   static void gdb_break(void) {};
1441,1443c1424,1425
< #if S7_DEBUGGING || POINTER_32 || WITH_WARNINGS || DISABLE_FILE_IO
< static s7_scheme *cur_sc = NULL; /* intended for gdb (see gdbinit), but
< also used if S7_DEBUGGING unfortunately */
---
> #if S7_DEBUGGING || POINTER_32 || WITH_WARNINGS
> static s7_scheme *cur_sc = NULL; /* intended for gdb (see gdbinit), but also used if S7_DEBUGGING unfortunately */
1446,1479c1428
< static noreturn void error_nr(s7_scheme *sc, s7_pointer type, s7_pointer
< info);
< 
< static s7_pointer set_elist_1(s7_scheme *sc, s7_pointer x1);
< static s7_pointer wrap_string(s7_scheme *sc, const char *str, s7_int len);
< 
< #if DISABLE_FILE_IO
< /* static FILE *old_fopen(const char *pathname, const char *mode) */
< /* {return(fopen(pathname, mode));} */
< 
< #define fwrite local_fwrite
< #define fopen local_fopen
< #define fread local_fread
< /* open only used for file_probe (O_RDONLY), creat and write not used */
< 
< static size_t local_fwrite(const void *ptr, size_t size, size_t nmemb,
< FILE *stream)
< {
<     error_nr(cur_sc, cur_sc->io_error_symbol,
<              set_elist_1(cur_sc, wrap_string(cur_sc, "reading or writing a file is not allowed in this version of s7", 62)));
< }
< 
< static size_t fread(void *buffer, size_t size, size_t count, FILE *stream )
< {
<     error_nr(cur_sc, cur_sc->io_error_symbol,
<              set_elist_1(cur_sc, wrap_string(cur_sc, "reading or writing a file is not allowed in this version of s7", 62)));
< }
< 
< static FILE *local_fopen(const char *pathname, const char *mode)
< {
<     error_nr(cur_sc, cur_sc->io_error_symbol,
<              set_elist_1(cur_sc, wrap_string(cur_sc, "reading or writing a file is not allowed in this version of s7", 62)));
< }
< #endif
---
> static noreturn void error_nr(s7_scheme *sc, s7_pointer type, s7_pointer info);
5970a5920,5921
> static s7_pointer wrap_string(s7_scheme *sc, const char *str, s7_int len);
> 
6287c6238
< static inline bool is_constant_symbol(s7_scheme *sc, s7_pointer sym)
---
> static inline bool is_constant_symbol(s7_scheme *sc, s7_pointer sym) /* inline: 7 in cb, 5 in tgen */
26760,26763c26711,26713
<   if ((i1 >= 0) && (i1 < string_length(p1)))
<     return(chars[((uint8_t *)string_value(p1))[i1]]);
<   out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, wrap_integer(sc, i1), (i1 < 0) ? it_is_negative_string : it_is_too_large_string);
<   return(p1);
---
>   if ((i1 < 0) || (i1 >= string_length(p1)))
>     out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, wrap_integer(sc, i1), (i1 < 0) ? it_is_negative_string : it_is_too_large_string);
>   return(chars[((uint8_t *)string_value(p1))[i1]]);
26777,26780c26727,26729
<   if (string_length(p1) > 0)
<     return(chars[((uint8_t *)string_value(p1))[0]]);
<   out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, int_zero, it_is_too_large_string);
<   return(p1);
---
>   if (string_length(p1) <= 0)
>     out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, int_zero, it_is_too_large_string);
>   return(chars[((uint8_t *)string_value(p1))[0]]);
26783c26732
< static s7_pointer string_plast_via_method(s7_scheme *sc, s7_pointer p1)
---
> static s7_pointer string_plast_via_method(s7_scheme *sc, s7_pointer p1) /* tmock */
26793,26796c26742,26744
<   if (string_length(p1) > 0)
<     return(chars[((uint8_t *)string_value(p1))[string_length(p1) - 1]]);
<   out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, wrap_integer(sc, string_length(p1) - 1), it_is_too_large_string);
<   return(p1);
---
>   if (string_length(p1) <= 0)
>     out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, wrap_integer(sc, string_length(p1) - 1), it_is_too_large_string);
>   return(chars[((uint8_t *)string_value(p1))[string_length(p1) - 1]]);
26801,26804c26749,26751
<   if ((i1 >= 0) && (i1 < string_length(p1)))
<     return(chars[((uint8_t *)string_value(p1))[i1]]);
<   out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, wrap_integer(sc, i1), (i1 < 0) ? it_is_negative_string : it_is_too_large_string);
<   return(p1);
---
>   if ((i1 < 0) || (i1 >= string_length(p1)))
>     out_of_range_error_nr(sc, sc->string_ref_symbol, int_two, wrap_integer(sc, i1), (i1 < 0) ? it_is_negative_string : it_is_too_large_string);
>   return(chars[((uint8_t *)string_value(p1))[i1]]);
36585c36532
< #if (!MS_WINDOWS) && !defined(S7_BAREMETALPI) && !defined(S7_N3DS)
---
> #if (!MS_WINDOWS)
39135c39082
< static inline s7_pointer typed_vector_setter(s7_scheme *sc, s7_pointer vec, s7_int loc, s7_pointer val)
---
> static /* inline */ s7_pointer typed_vector_setter(s7_scheme *sc, s7_pointer vec, s7_int loc, s7_pointer val) /* tstr faster without inline! */
41899a41847
>       /* (int-vector-set!  #i() `(x 1) (abs x)) in a do loop in a function... */
68552c68500
<   return(g_values(sc, x));
---
>   return(s7_values(sc, x)); /* g_values == s7_values */
92354d92301
< #if !defined(S7_BAREMETALPI) && !defined(S7_N3DS)
92368d92314
< #endif // !defined(S7_BAREMETALPI) && !defined(S7_N3DS)
93108a93055,93059
> 
>     case SL_MAJOR_VERSION:
>     case SL_MINOR_VERSION:
>       sl_unsettable_error_nr(sc, sym);
> 
95165c95116
< #if (!MS_WINDOWS) && !defined(S7_BAREMETALPI) && !defined(S7_N3DS)
---
> #if (!MS_WINDOWS)
95175c95126
< #if (!MS_WINDOWS) && !defined(S7_BAREMETALPI) && !defined(S7_N3DS)
---
> #if (!MS_WINDOWS)
95201c95152
< #if (!MS_WINDOWS) && !defined(S7_BAREMETALPI) && !defined(S7_N3DS)
---
> #if (!MS_WINDOWS)
95205c95156
< #if S7_DEBUGGING || POINTER_32 || WITH_WARNINGS || DISABLE_FILE_IO
---
> #if S7_DEBUGGING || POINTER_32 || WITH_WARNINGS
96133a96085,96086
>  *
>  * file-exists? with "~" file names?
_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to