The unified diff between revisions [afdbb938..] and [c2301346..] is displayed below. It can also be downloaded as a raw diff.
# # old_revision [afdbb9388305ae66464ad4acb0437922656e3059] # new_revision [c2301346be8a3f197425575f91b4910582a22a62] # # add_file "src/lsi/abi.h" # content [236608e1022f2e510b6b085db0e732e71c36dc40] # # add_file "src/lsi/abispec" # content [0d73d72014de2fc86dd7b847f527aa3dee5027f7] # # add_file "src/lsi/makeabi" # content [007086efc8065fc0857d86ae0fac503e708cb961] # # patch "src/lsi/Makefile" # from [1345a82aeacb32dcd1c90dd59c46be291477403c] # to [c00858097a6f271fbfea57ba936c38008c8d78dd] # # patch "src/lsi/vm.c" # from [bbb6e957a3bbc5fa4906c581c044dea5085cd39e] # to [2c18e65f543e306db2ca1023e8ef82724829f4a7] # # set "src/lsi/makeabi" # attr "mtn:execute" # value "true" # ============================================================ --- src/lsi/Makefile 1345a82aeacb32dcd1c90dd59c46be291477403c +++ src/lsi/Makefile c00858097a6f271fbfea57ba936c38008c8d78dd @@ -5,6 +5,9 @@ SRCS= main.c vm.c plugins.c dmx.c midi.c OBJS= main.o vm.o plugins.o dmx.o midi.o beatdetect.o fft.o map3d.o mouse.o SRCS= main.c vm.c plugins.c dmx.c midi.c beatdetect.c fft.c map3d.c mouse.c +OBJS+= abi.o +SRCS+= abi.c + COMMONOBJS= mem.o hash.o COMMONDIR= ../common @@ -20,6 +23,12 @@ lsi: ${OBJS} lsi: ${OBJS} ${LINK.c} -o ${.TARGET} ${PROGOBJS} ${LDLIBS} +abi.c: abispec makeabi + ./makeabi abispec + +abi.lh: abispec makeabi + ./makeabi abispec + install: lsi ${INSTALL} -d ${PREFIX}/bin ${INSTALL} -c lsi ${PREFIX}/bin/lsi @@ -28,4 +37,4 @@ clean: mkdep -- ${CFLAGS} ${CPPFLAGS} ${SRCS} clean: - rm -f ${OBJS} lsi + rm -f ${OBJS} lsi abi.c abi.lh ============================================================ --- /dev/null +++ src/lsi/abi.h 236608e1022f2e510b6b085db0e732e71c36dc40 @@ -0,0 +1,40 @@ +/* abi.h */ + +typedef int (*vm_intfn)(void); + +/* + * We must include here all prototypes for functions which can be + * included in the ABI function table + */ + +int vm_intfn_nop(void); +int vm_intfn_global_store(void); +int vm_intfn_global_load(void); +int vm_intfn_global_array_store(void); +int vm_intfn_global_array_load(void); +int vm_intfn_printint(void); +int vm_intfn_printreal(void); +int vm_intfn_printstr(void); +int vm_intfn_dmxsetchannel(void); +int vm_intfn_dmxoutput(void); +int vm_intfn_gettime(void); +int vm_intfn_waittime(void); +int vm_intfn_wait(void); +int vm_intfn_wakeup(void); +int vm_intfn_spawn(void); +int vm_intfn_midi_read(void); +int vm_intfn_beatdetect_read(void); +int vm_intfn_beatdetect_phase(void); +int vm_intfn_beatdetect_confidence(void); +int vm_intfn_realtoint(void); +int vm_intfn_inttoreal(void); +int vm_intfn_map3d_setcal(void); +int vm_intfn_map3d_calibrate(void); +int vm_intfn_map3d_transform(void); +int vm_intfn_map3d_setparams(void); +int vm_intfn_map3d_load(void); +int vm_intfn_map3d_save(void); +int vm_intfn_sin(void); +int vm_intfn_cos(void); +int vm_intfn_random(void); +int vm_intfn_mouse_read(void); ============================================================ --- /dev/null +++ src/lsi/abispec 0d73d72014de2fc86dd7b847f527aa3dee5027f7 @@ -0,0 +1,39 @@ +/* This should be a master file specifying all aspects of ABI */ + +/* Function assignments */ + +function nop +function global_store +function global_load +function global_array_store +function global_array_load +function printint +function printreal +function printstr +function dmxsetchannel +function dmxoutput +function gettime +function waittime +function wait +function wakeup +function spawn +function midi_read +function beatdetect_read +function beatdetect_phase +function beatdetect_confidence +funciton realtoint +function inttoreal +function map3d_setcal +function map3d_calibrate +function map3d_transform +function map3d_setparams +function map3d_load +function map3d_save +function sin +function cos +function random +function mouse_read + +/* + * The ABI should be identified by a SHA1 hash of this file + */ ============================================================ --- /dev/null +++ src/lsi/makeabi 007086efc8065fc0857d86ae0fac503e708cb961 @@ -0,0 +1,50 @@ +#!/bin/sh + +INFILE=$1 + +if [ "X${INFILE}" = "X" ] +then + echo "Usage: $0 abispec" + exit 1 +fi + +ABI=abi.c +HEADER=abi.lh + +FNCOUNT=0 + +do_function() +{ + echo " vm_intfn_${ARG1}," >>${ABI} + echo "fndefint ${ARG1} ${FNCOUNT};" >>${HEADER} + FNCOUNT=$((${FNCOUNT}+1)) +} + +cat <<EOF >${ABI} +/* abi.c */ +/* autogenerated - do not edit */ + +#include "abi.h" + +vm_intfn vm_intfn_table[] = { +EOF + +cat <<EOF >${HEADER} +/* abi.lh */ +/* autogenerated - do not edit */ + +EOF + +while read TYPE ARG1 ARG2 +do + case "$TYPE" in + function) do_function + ;; + esac +done <${INFILE} + +cat <<EOF >>${ABI} +}; + +const int vm_intfn_size = sizeof(vm_intfn_table) / sizeof(vm_intfn); +EOF ============================================================ --- src/lsi/vm.c bbb6e957a3bbc5fa4906c581c044dea5085cd39e +++ src/lsi/vm.c 2c18e65f543e306db2ca1023e8ef82724829f4a7 @@ -67,79 +67,15 @@ struct hashentry *arrayhash[HASHSIZE]; #define GLOB_MAXNAMELEN 1024 -int vm_intfn_nop(void); -int vm_intfn_global_store(void); -int vm_intfn_global_load(void); -int vm_intfn_global_array_store(void); -int vm_intfn_global_array_load(void); -int vm_intfn_printint(void); -int vm_intfn_printreal(void); -int vm_intfn_printstr(void); -int vm_intfn_dmxsetchannel(void); -int vm_intfn_dmxoutput(void); -int vm_intfn_gettime(void); -int vm_intfn_waittime(void); -int vm_intfn_wait(void); -int vm_intfn_wakeup(void); -int vm_intfn_spawn(void); -int vm_intfn_midi_read(void); -int vm_intfn_beatdetect_read(void); -int vm_intfn_beatdetect_phase(void); -int vm_intfn_beatdetect_confidence(void); -int vm_intfn_realtoint(void); -int vm_intfn_inttoreal(void); -int vm_intfn_map3d_setcal(void); -int vm_intfn_map3d_calibrate(void); -int vm_intfn_map3d_transform(void); -int vm_intfn_map3d_setparams(void); -int vm_intfn_map3d_load(void); -int vm_intfn_map3d_save(void); -int vm_intfn_sin(void); -int vm_intfn_cos(void); -int vm_intfn_random(void); -int vm_intfn_mouse_read(void); void vm_destroy(struct vm_thread *); void vm_unqueue(struct vm_thread *); void vm_queue(struct vm_thread *, int); -typedef int (*vm_intfn)(void); +#include "abi.h" -vm_intfn vm_intfn_table[] = { - vm_intfn_nop, - vm_intfn_global_store, - vm_intfn_global_load, - vm_intfn_global_array_store, - vm_intfn_global_array_load, - vm_intfn_printint, - vm_intfn_printreal, - vm_intfn_printstr, - vm_intfn_dmxsetchannel, - vm_intfn_dmxoutput, - vm_intfn_gettime, - vm_intfn_waittime, - vm_intfn_wait, - vm_intfn_wakeup, - vm_intfn_spawn, - vm_intfn_midi_read, - vm_intfn_beatdetect_read, - vm_intfn_beatdetect_phase, - vm_intfn_beatdetect_confidence, - vm_intfn_realtoint, - vm_intfn_inttoreal, - vm_intfn_map3d_setcal, - vm_intfn_map3d_calibrate, - vm_intfn_map3d_transform, - vm_intfn_map3d_setparams, - vm_intfn_map3d_load, - vm_intfn_map3d_save, - vm_intfn_sin, - vm_intfn_cos, - vm_intfn_random, - vm_intfn_mouse_read, -}; +extern vm_intfn vm_intfn_table[]; +extern const int vm_intfn_size; -const int vm_intfn_size = sizeof(vm_intfn_table) / sizeof(vm_intfn); - void stack_push(struct vm_thread *thread, stkentry e); void stack_pop(struct vm_thread *thread, int count); stkentry stack_get(struct vm_thread *thread, int count);