-%fingerprint-spec 1.2
+%fingerprint-spec 1.4
%fprint:IFFI
%url:http://example.com
%desc:INTERCAL-like Foreign Function Interface
void ick_iffi_interpreter_one_iteration(void)
{
- fungeCell opcode;
+ funge_cell opcode;
opcode = fungespace_get(&iffiIP->position);
if (setting_trace_level > 8) {
execute_instruction(opcode, iffiIP);
if (iffiIP->needMove)
- ip_forward(iffiIP, 1);
+ ip_forward(iffiIP);
else
iffiIP->needMove = true;
}
static void finger_IFFI_create(instructionPointer * ip)
{
// arguments: line number on TOS, signature as 0gnirts beneath it
- fungeCell l = stack_pop(ip->stack);
- unsigned char * restrict str = stack_pop_string(ip->stack);
+ funge_cell l = stack_pop(ip->stack);
+ unsigned char * restrict str = stack_pop_string(ip->stack, NULL);
ick_create((const char*)str, l);
}
// C - In markmode COME FROM the top of stack
static void finger_IFFI_come_from(instructionPointer * ip)
{
- fungeCell l;
+ funge_cell l;
l = stack_pop(ip->stack);
// 0 if the argument is not a variable, or its number if it is
// The argument's value at the time the CREATED instruction was called
// The argument's value now (same as previous if -a was not used)
- fungeCell i;
+ funge_cell i;
if (firstload) {
ip_reverse(ip);
// F - FORGET NEXT stack entries equal to top of stack
static void finger_IFFI_forget(instructionPointer * ip)
{
- fungeCell f;
+ funge_cell f;
if (firstload) {
ip_reverse(ip);
// var numbers are positive for onespot, negative for twospot
// return: the value of the variable
- fungeCell v;
+ funge_cell v;
if (firstload) {
ip_reverse(ip);
// L - Use top of stack as a line label for this point
static void finger_IFFI_label(instructionPointer * ip)
{
- fungeCell l;
+ funge_cell l;
if (firstload) {
ip_reverse(ip);
// N - Try to NEXT to the line labelled with the top of stack
static void finger_IFFI_next(instructionPointer * ip)
{
- fungeCell l;
+ funge_cell l;
if (firstload) {
ip_reverse(ip);
// R - RESUME to the top-of-stackth NEXT stack entry
static void finger_IFFI_resume(instructionPointer * ip)
{
- fungeCell f;
+ funge_cell f;
if (firstload) {
ip_reverse(ip);
// var numbers are positive for onespot, negative for twospot
// return: the value of the variable
- fungeCell v, d;
+ funge_cell v, d;
if (firstload) {
ip_reverse(ip);
{
// arguments: 0-based argument index on TOS, new value beneath it
// note that this is a NOP unless -a was used when compiling
- fungeCell i, d;
+ funge_cell i, d;
if (firstload) {
ip_reverse(ip);
// X - In markmode NEXT FROM the top of stack
static void finger_IFFI_next_from(instructionPointer * ip)
{
- fungeCell l;
+ funge_cell l;
l = stack_pop(ip->stack);
#include "../../global.h"
#include "../manager.h"
+#if !defined(CFUNGE_API_VERSION) || (CFUNGE_API_VERSION != 1)
+# error "This version of IFFI isn't compatible with this cfunge version."
+#endif
+
#ifdef CONCURRENT_FUNGE
-#error The C-INTERCAL/cfunge external calls interface cannot be used concurrently
+# error "The C-INTERCAL/cfunge external calls interface cannot be used concurrently."
#endif
// We need at least GCC 4.1 for this trick.
cp -r "$ICKSRC_PATH/etc/IFFI" "$ICKSRC_PATH/etc/IFFI.spec" src/fingerprints
echo " " Regenerating fingerprint lists...
-$CFUNGE_PATH/tools/gen_fprint_list.sh > /dev/null || die "Failed to regen list."
+tools/gen_fprint_list.sh > /dev/null || die "Failed to regen list."
# Trust the filenames that are in the cfunge directory tree; if the user's
# trying to trick themselves into running this on something that looks like
while(i--) if(tempcp[i] == '\0') tempcp[i]='\x1a';
if(!ick_cesspoolout) ick_cesspoolout=stdout;
fprintf(ick_cesspoolout,"%s\n",tempcp);
- fflush(ick_cesspoolout);
+ (void) fflush(ick_cesspoolout);
free(tempcp);
free(buf);
}
just with extra arrows in. The annotations here show that nulls are allowed
when called recursively, but not otherwise. */
/*@-incondefs@*/
-/*@null@*/ node *nodecopy(/*@null@*/ node* n)
+/*@null@*/ node *nodecopy(/*@null@*/ const node* n)
/*@=incondefs@*/
{
node* np;
/* This function by AIS. Compares expressions. In C++, I'd call this
node::operator== . */
-ick_bool nodessame(const node* n1, const node* n2)
+ick_bool nodessame(/*@observer@*/ const node* n1, /*@observer@*/ const node* n2)
{
if(!n1) return !n2;
if(!n2) return 0;
extern void optimizef(void); /* AIS */
extern void nodefree(/*@keep@*/ /*@null@*/ node* np); /* AIS */
extern unsigned long varextern(unsigned long intern, int vartype); /* AIS */
-extern node *nodecopy(node*); /* AIS */
-extern ick_bool nodessame(const node*, const node*); /* AIS */
+extern node *nodecopy(const node*); /* AIS */
+extern ick_bool nodessame(/*@observer@*/ const node*, /*@observer@*/ const node*); /* AIS */
extern node *optdebugnode; /* AIS */
extern const char **enablers; /* AIS: so that there can be an element before the
* If the order of statement-token defines in parser.y ever changes,
* this will need to be reordered.
*/
-const char *enablersm1[MAXTYPES+1] =
+/*@observer@*/ const char *enablersm1[MAXTYPES+1] =
{
"UNKNOWN", /* AIS: so comments can be ABSTAINED/REINSTATED */
"GETS",
case BADCHAR:
if (np->constant > 256)
(void) fprintf(fp, "o%xx%x",
- (int)(np->constant / 256),
- (int)(np->constant % 256));
+ (unsigned int)(np->constant / 256),
+ (unsigned int)(np->constant % 256));
else
- (void) fprintf(fp, "u%x", (int)np->constant);
+ (void) fprintf(fp, "u%x", (unsigned int)np->constant);
return 2;
case US_ID: (void) fputc((char)np->constant, fp); return 0;
case US_ELEM: (void) fputc(';', fp); return 1;
/*@dependent@*/ extern tuple *optuple; /* AIS: The tuple currently being optimized */
extern const char **enablers;
-extern const char *enablersm1[MAXTYPES+1];
+/*@observer@*/ extern const char *enablersm1[MAXTYPES+1];
extern const assoc vartypes[];
/* the lexical analyzer keeps copies of the source logical lines */
typedef struct
{
- const char *name;
- int value;
+ /*@observer@*/ const char *name;
+ const int value;
}
numeral;
else if(c=='\n' && jlb) {jlb = 0; continue;}
else if(c=='\n') {x=0; y++; jlb = 0;}
else x++;
- fprintf(of,"\\x%x",c);
+ fprintf(of,"\\x%x",(unsigned int)c);
if(!x) fprintf(of,"\"\n\"");
}
fprintf(of,"\";\n\nint ick_iffi_markercount=%d;\n"
markerposns[markercount][1]);
fprintf(of,"};\n");
- fclose(of);
+ (void) fclose(of);
/* Put the libraries and .cio file in the command line. */
ick_snprintf_or_die(libbuf+strlen(libbuf),libbuf_size - strlen(libbuf),
* @param cooptsh Path to coopt.sh
* @param binaryname The output binary filename.
*/
-static void run_coopt(/*@observer@*/ /*@null@*/ const char* cooptsh,
- /*@observer@*/ const char* binaryname)
+static void run_coopt(/*@observer@*/ /*@null@*/ /*@unused@*/ const char* cooptsh,
+ /*@observer@*/ /*@unused@*/ const char* binaryname)
{
- char commandlinebuf[BUFSIZ];
+ /* Note: Params are marked unused because they may not be used if sh isn't supported. */
#ifdef HAVE_PROG_SH
# ifdef HAVE_SYS_INTERPRETER
if(coopt) /* AIS */
WRITE IN. Double-oh-sevens screw this up, too. */
if(cooptsh)
{
+ char commandlinebuf[BUFSIZ];
(void) ick_snprintf_or_die(commandlinebuf, sizeof commandlinebuf,
"sh %s %s", cooptsh, binaryname);
ICK_SYSTEM(commandlinebuf); /* replaces the output executable if
#endif
oldoptind=optind; /* AIS */
- *libbuf = 0; /* AIS */
+ *libbuf = '\0'; /* AIS */
/* Begin file loop */
for (firstfile = ick_TRUE; optind < argc; optind++, firstfile = ick_FALSE)
{
it instead adds a space and the filename to libbuf. */
handle_archive(libbuf, sizeof libbuf,
argv[optind] /* Archive name without extension. */);
- *argv[optind]=0;
+ *argv[optind]='\0';
continue;
}