Skip to content

Commit

Permalink
[3/3] Module rework fixup.
Browse files Browse the repository at this point in the history
  • Loading branch information
vifino committed Jul 10, 2018
1 parent 808b884 commit 6d3136b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/modules/bgm_fish.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static char * fish_word(int * hitnl) {
// transfers 'ownership' of args to this.
static void fish_execute(char * module, int argc, char ** argv) {
int i;
int mcount = modules_count();
int mcount = mod_count();
int routing_rov = 0;
if (!strcmp(module, "/then")) {
// Oh, this'll be *hilarious...*
Expand Down Expand Up @@ -174,7 +174,7 @@ static void fish_execute(char * module, int argc, char ** argv) {
//printf("\n");

for (i = 0; i < mcount; i++) {
if (!strcmp(module, modules_get(i)->name)) {
if (!strcmp(module, mod_get(i)->name)) {
if (routing_rov) {
main_force_random(i, argc, argv);
} else {
Expand Down
8 changes: 5 additions & 3 deletions src/modules/flt_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
#include <assert.h>
#include <stdlib.h>

static module* next;
static module* nextm;
static mod_flt* next;

int init(int nextno, char* argstr) {
printf("flt_dummy loading. next mod is %i\n", nextno);
fflush(stdin);
// get next ptr.
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm->mod;
printf("next is %p", next);

if (argstr) {
Expand Down Expand Up @@ -82,5 +84,5 @@ int deinit(void) {
printf("deinit\n");
fflush(stdin);
assert(next != NULL);
return next->deinit();
return nextm->deinit();
}
8 changes: 5 additions & 3 deletions src/modules/flt_flip_x.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
#include <timers.h>
#include <mod.h>

static module* next;
static module* nextm;
static mod_flt* next;

int init(int nextno, char* argstr) {
// get next ptr.
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm->mod;
return 0;
}

Expand Down Expand Up @@ -47,5 +49,5 @@ void wait_until_break(void) {
}

int deinit(void) {
return next->deinit();
return nextm->deinit();
}
8 changes: 5 additions & 3 deletions src/modules/flt_flip_y.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
#include <timers.h>
#include <mod.h>

static module* next;
static module* nextm;
static mod_flt* next;

int init(int nextno, char* argstr) {
// get next ptr.
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm;
return 0;
}

Expand Down Expand Up @@ -47,5 +49,5 @@ void wait_until_break(void) {
}

int deinit(void) {
return next->deinit();
return nextm->deinit();
}
8 changes: 5 additions & 3 deletions src/modules/flt_gamma_correct.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <mod.h>
#include <math.h>

static module* next;
static module* nextm;
static mod_flt* next;

#define GAMMA 2.8f
#define WHITEPOINT {0.98f, 1.0f, 1.0f} // R, G, B, respectively.
Expand All @@ -20,7 +21,8 @@ static byte LUT_B[MAX_VAL + 1];

int init(int nextno, char* argstr) {
// get next ptr.
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm->mod;
float whitepoint[3] = WHITEPOINT;

int i;
Expand Down Expand Up @@ -71,5 +73,5 @@ void wait_until_break(void) {
}

int deinit(void) {
return next->deinit();
return nextm->deinit();
}
8 changes: 5 additions & 3 deletions src/modules/flt_rot_90.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#include <mod.h>
#include <stdlib.h>

static module* next;
static module* nextm;
static mod_flt* next;
static int rot;

int init(int nextno, char* argstr) {
// get next ptr.
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm->mod;
rot = 1;
if (argstr)
rot = atoi(argstr) & 0x03;
Expand Down Expand Up @@ -60,5 +62,5 @@ void wait_until_break(void) {
}

int deinit(void) {
return next->deinit();
return nextm->deinit();
}
8 changes: 5 additions & 3 deletions src/modules/flt_scale.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
#include <assert.h>

static int scale = 0;
static module* next;
static module* nextm;
static mod_flt* next;

int init(int nextno, char* argstr) {
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm->mod;

if (!argstr) {
eprintf("flt_scale: No scaling factor given.\n");
Expand Down Expand Up @@ -79,5 +81,5 @@ void wait_until_break(void) {
}

int deinit(void) {
return next->deinit();
return nextm->deinit();
}
8 changes: 5 additions & 3 deletions src/modules/flt_smapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
#include <stdlib.h>
#include <stdio.h>

static module* next;
static module* nextm;
static mod_flt* next;
static int mx, my;
static int folds, pane_x;

int init(int nextno, char* argstr) {
// get next ptr.
next = modules_get(nextno);
nextm = mod_get(nextno);
next = nextm->mod;
mx = next->getx();
my = next->gety();

Expand Down Expand Up @@ -75,5 +77,5 @@ void wait_until_break(void) {
}

int deinit(void) {
return next->deinit();
return nextm->deinit();
}

0 comments on commit 6d3136b

Please sign in to comment.