[CM] S7 integrated in TIC-80, and bug reports

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Fri Feb 3 06:40:51 PST 2023


Here's a first stab at it -- put this code at line 1430 or thereabouts
in s7.c (after the error_nr forward declaration), then build s7 with
-DDISABLE_FILE_OUTPUT=1:

#ifndef DISABLE_FILE_OUTPUT
   #define DISABLE_FILE_OUTPUT 0
#endif

#if DISABLE_FILE_OUTPUT
static FILE *old_fopen(const char *pathname, const char *mode) 
{return(fopen(pathname, mode));}

#define fwrite local_fwrite
#define fopen local_fopen
/* 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, cur_sc->nil);
}

static FILE *local_fopen(const char *pathname, const char *mode)
{
   if ((mode[0] == 'w') || (mode[0] == 'a'))
     error_nr(cur_sc, cur_sc->io_error_symbol, cur_sc->nil);
   return(old_fopen(pathname, mode));
}
#endif



More information about the Cmdist mailing list