switch source tree from k&r to c99
This commit is contained in:
+61
-92
@@ -6,33 +6,33 @@
|
||||
#include "sp_lev.h"
|
||||
|
||||
/* lua_CFunction prototypes */
|
||||
static int FDECL(l_selection_new, (lua_State *));
|
||||
static int FDECL(l_selection_clone, (lua_State *));
|
||||
static int FDECL(l_selection_getpoint, (lua_State *));
|
||||
static int FDECL(l_selection_setpoint, (lua_State *));
|
||||
static int FDECL(l_selection_not, (lua_State *));
|
||||
static int FDECL(l_selection_filter_percent, (lua_State *));
|
||||
static int FDECL(l_selection_rndcoord, (lua_State *));
|
||||
static boolean FDECL(params_sel_2coords, (lua_State *, struct selectionvar **,
|
||||
xchar *, xchar *, xchar *, xchar *));
|
||||
static int FDECL(l_selection_line, (lua_State *));
|
||||
static int FDECL(l_selection_randline, (lua_State *));
|
||||
static int FDECL(l_selection_rect, (lua_State *));
|
||||
static int FDECL(l_selection_fillrect, (lua_State *));
|
||||
static int FDECL(l_selection_grow, (lua_State *));
|
||||
static int FDECL(l_selection_filter_mapchar, (lua_State *));
|
||||
static int FDECL(l_selection_match, (lua_State *));
|
||||
static int FDECL(l_selection_flood, (lua_State *));
|
||||
static int FDECL(l_selection_circle, (lua_State *));
|
||||
static int FDECL(l_selection_ellipse, (lua_State *));
|
||||
static int FDECL(l_selection_gradient, (lua_State *));
|
||||
static int FDECL(l_selection_iterate, (lua_State *));
|
||||
static int FDECL(l_selection_gc, (lua_State *));
|
||||
static int FDECL(l_selection_not, (lua_State *));
|
||||
static int FDECL(l_selection_and, (lua_State *));
|
||||
static int FDECL(l_selection_or, (lua_State *));
|
||||
static int FDECL(l_selection_xor, (lua_State *));
|
||||
static int FDECL(l_selection_not, (lua_State *));
|
||||
static int l_selection_new(lua_State *);
|
||||
static int l_selection_clone(lua_State *);
|
||||
static int l_selection_getpoint(lua_State *);
|
||||
static int l_selection_setpoint(lua_State *);
|
||||
static int l_selection_not(lua_State *);
|
||||
static int l_selection_filter_percent(lua_State *);
|
||||
static int l_selection_rndcoord(lua_State *);
|
||||
static boolean params_sel_2coords(lua_State *, struct selectionvar **,
|
||||
xchar *, xchar *, xchar *, xchar *);
|
||||
static int l_selection_line(lua_State *);
|
||||
static int l_selection_randline(lua_State *);
|
||||
static int l_selection_rect(lua_State *);
|
||||
static int l_selection_fillrect(lua_State *);
|
||||
static int l_selection_grow(lua_State *);
|
||||
static int l_selection_filter_mapchar(lua_State *);
|
||||
static int l_selection_match(lua_State *);
|
||||
static int l_selection_flood(lua_State *);
|
||||
static int l_selection_circle(lua_State *);
|
||||
static int l_selection_ellipse(lua_State *);
|
||||
static int l_selection_gradient(lua_State *);
|
||||
static int l_selection_iterate(lua_State *);
|
||||
static int l_selection_gc(lua_State *);
|
||||
static int l_selection_not(lua_State *);
|
||||
static int l_selection_and(lua_State *);
|
||||
static int l_selection_or(lua_State *);
|
||||
static int l_selection_xor(lua_State *);
|
||||
static int l_selection_not(lua_State *);
|
||||
#if 0
|
||||
/* the following do not appear to currently be
|
||||
used and because they are static, the OSX
|
||||
@@ -40,16 +40,14 @@ static int FDECL(l_selection_not, (lua_State *));
|
||||
if ifdef'd out the prototype here and the
|
||||
function body below.
|
||||
*/
|
||||
static int FDECL(l_selection_add, (lua_State *));
|
||||
static int FDECL(l_selection_sub, (lua_State *));
|
||||
static int FDECL(l_selection_ipairs, (lua_State *));
|
||||
static struct selectionvar *FDECL(l_selection_to, (lua_State *, int));
|
||||
static int l_selection_add(lua_State *);
|
||||
static int l_selection_sub(lua_State *);
|
||||
static int l_selection_ipairs(lua_State *);
|
||||
static struct selectionvar *l_selection_to(lua_State *, int);
|
||||
#endif
|
||||
|
||||
struct selectionvar *
|
||||
l_selection_check(L, index)
|
||||
lua_State *L;
|
||||
int index;
|
||||
l_selection_check(lua_State *L, int index)
|
||||
{
|
||||
struct selectionvar *sel;
|
||||
|
||||
@@ -61,8 +59,7 @@ int index;
|
||||
}
|
||||
|
||||
static int
|
||||
l_selection_gc(L)
|
||||
lua_State *L;
|
||||
l_selection_gc(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = l_selection_check(L, 1);
|
||||
|
||||
@@ -73,9 +70,7 @@ lua_State *L;
|
||||
|
||||
#if 0
|
||||
static struct selectionvar *
|
||||
l_selection_to(L, index)
|
||||
lua_State *L;
|
||||
int index;
|
||||
l_selection_to(lua_State *L, int index)
|
||||
{
|
||||
struct selectionvar *sel = (struct selectionvar *)lua_touserdata(L, index);
|
||||
|
||||
@@ -86,8 +81,7 @@ int index;
|
||||
#endif
|
||||
|
||||
static struct selectionvar *
|
||||
l_selection_push(L)
|
||||
lua_State *L;
|
||||
l_selection_push(lua_State *L)
|
||||
{
|
||||
struct selectionvar *tmp = selection_new();
|
||||
struct selectionvar
|
||||
@@ -106,8 +100,7 @@ lua_State *L;
|
||||
|
||||
/* local sel = selection.new(); */
|
||||
static int
|
||||
l_selection_new(L)
|
||||
lua_State *L;
|
||||
l_selection_new(lua_State *L)
|
||||
{
|
||||
(void) l_selection_push(L);
|
||||
return 1;
|
||||
@@ -116,8 +109,7 @@ lua_State *L;
|
||||
/* Replace the topmost selection in the stack with a clone of it. */
|
||||
/* local sel = selection.clone(sel); */
|
||||
static int
|
||||
l_selection_clone(L)
|
||||
lua_State *L;
|
||||
l_selection_clone(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = l_selection_check(L, 1);
|
||||
struct selectionvar *tmp;
|
||||
@@ -139,8 +131,7 @@ lua_State *L;
|
||||
/* local sel = selection.set(sel); */
|
||||
/* TODO: allow setting multiple coordinates at once: set({x,y}, {x,y}, ...); */
|
||||
static int
|
||||
l_selection_setpoint(L)
|
||||
lua_State *L;
|
||||
l_selection_setpoint(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
xchar x = -1, y = -1;
|
||||
@@ -184,8 +175,7 @@ lua_State *L;
|
||||
|
||||
/* local value = selection.get(sel, x, y); */
|
||||
static int
|
||||
l_selection_getpoint(L)
|
||||
lua_State *L;
|
||||
l_selection_getpoint(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = l_selection_check(L, 1);
|
||||
xchar x = (xchar) luaL_checkinteger(L, 2);
|
||||
@@ -209,8 +199,7 @@ lua_State *L;
|
||||
/* local s = selection.negate(); */
|
||||
/* local s = sel:negate(); */
|
||||
static int
|
||||
l_selection_not(L)
|
||||
lua_State *L;
|
||||
l_selection_not(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel, *sel2;
|
||||
@@ -230,8 +219,7 @@ lua_State *L;
|
||||
|
||||
/* local sel = selection.area(4,5, 40,10) & selection.rect(7,8, 60,14); */
|
||||
static int
|
||||
l_selection_and(L)
|
||||
lua_State *L;
|
||||
l_selection_and(lua_State *L)
|
||||
{
|
||||
int x,y;
|
||||
struct selectionvar *sela = l_selection_check(L, 1);
|
||||
@@ -251,8 +239,7 @@ lua_State *L;
|
||||
|
||||
/* local sel = selection.area(4,5, 40,10) | selection.rect(7,8, 60,14); */
|
||||
static int
|
||||
l_selection_or(L)
|
||||
lua_State *L;
|
||||
l_selection_or(lua_State *L)
|
||||
{
|
||||
int x,y;
|
||||
struct selectionvar *sela = l_selection_check(L, 1);
|
||||
@@ -272,8 +259,7 @@ lua_State *L;
|
||||
|
||||
/* local sel = selection.area(4,5, 40,10) ~ selection.rect(7,8, 60,14); */
|
||||
static int
|
||||
l_selection_xor(L)
|
||||
lua_State *L;
|
||||
l_selection_xor(lua_State *L)
|
||||
{
|
||||
int x,y;
|
||||
struct selectionvar *sela = l_selection_check(L, 1);
|
||||
@@ -294,8 +280,7 @@ lua_State *L;
|
||||
|
||||
/* local s = selection.percentage(sel, 50); */
|
||||
static int
|
||||
l_selection_filter_percent(L)
|
||||
lua_State *L;
|
||||
l_selection_filter_percent(lua_State *L)
|
||||
{
|
||||
struct selectionvar *ret;
|
||||
int p;
|
||||
@@ -313,8 +298,7 @@ lua_State *L;
|
||||
/* local x,y = selection.rndcoord(sel); */
|
||||
/* local x,y = selection.rndcoord(sel, 1); */
|
||||
static int
|
||||
l_selection_rndcoord(L)
|
||||
lua_State *L;
|
||||
l_selection_rndcoord(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = l_selection_check(L, 1);
|
||||
int removeit = (int) luaL_optinteger(L, 2, 0);
|
||||
@@ -341,10 +325,8 @@ lua_State *L;
|
||||
/* function(selection, x1,y1, x2,y2) */
|
||||
/* selection:function(x1,y1, x2,y2) */
|
||||
static boolean
|
||||
params_sel_2coords(L, sel, x1,y1, x2,y2)
|
||||
lua_State *L;
|
||||
struct selectionvar **sel;
|
||||
xchar *x1, *y1, *x2, *y2;
|
||||
params_sel_2coords(lua_State *L, struct selectionvar **sel,
|
||||
xchar *x1, xchar *y1, xchar *x2, xchar *y2)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
@@ -376,8 +358,7 @@ xchar *x1, *y1, *x2, *y2;
|
||||
/* local s = selection.line(x1,y1, x2,y2); */
|
||||
/* s:line(x1,y1, x2,y2); */
|
||||
static int
|
||||
l_selection_line(L)
|
||||
lua_State *L;
|
||||
l_selection_line(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = NULL;
|
||||
xchar x1, y1, x2, y2;
|
||||
@@ -397,8 +378,7 @@ lua_State *L;
|
||||
|
||||
/* local s = selection.rect(sel, x1,y1, x2,y2); */
|
||||
static int
|
||||
l_selection_rect(L)
|
||||
lua_State *L;
|
||||
l_selection_rect(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = NULL;
|
||||
xchar x1, y1, x2, y2;
|
||||
@@ -426,8 +406,7 @@ lua_State *L;
|
||||
/* s:fillrect(x1,y1, x2,y2); */
|
||||
/* selection.area(x1,y1, x2,y2); */
|
||||
static int
|
||||
l_selection_fillrect(L)
|
||||
lua_State *L;
|
||||
l_selection_fillrect(lua_State *L)
|
||||
{
|
||||
struct selectionvar *sel = NULL;
|
||||
int y;
|
||||
@@ -459,8 +438,7 @@ lua_State *L;
|
||||
/* TODO: selection.randline(x1,y1, x2,y2, roughness); */
|
||||
/* TODO: selection.randline({x1,y1}, {x2,y2}, roughness); */
|
||||
static int
|
||||
l_selection_randline(L)
|
||||
lua_State *L;
|
||||
l_selection_randline(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -500,8 +478,7 @@ lua_State *L;
|
||||
/* local s = selection.grow(sel); */
|
||||
/* local s = selection.grow(sel, "north"); */
|
||||
static int
|
||||
l_selection_grow(L)
|
||||
lua_State *L;
|
||||
l_selection_grow(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
const char *const growdirs[] = { "all", "random", "north", "west", "east", "south", NULL };
|
||||
@@ -522,8 +499,7 @@ lua_State *L;
|
||||
|
||||
/* local s = selection.filter_mapchar(sel, mapchar, lit); */
|
||||
static int
|
||||
l_selection_filter_mapchar(L)
|
||||
lua_State *L;
|
||||
l_selection_filter_mapchar(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = l_selection_check(L, 1);
|
||||
@@ -556,8 +532,7 @@ lua_State *L;
|
||||
|
||||
/* local s = selection.match([[...]]); */
|
||||
static int
|
||||
l_selection_match(L)
|
||||
lua_State *L;
|
||||
l_selection_match(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -596,8 +571,7 @@ lua_State *L;
|
||||
|
||||
/* local s = selection.floodfill(x,y); */
|
||||
static int
|
||||
l_selection_flood(L)
|
||||
lua_State *L;
|
||||
l_selection_flood(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -630,8 +604,7 @@ lua_State *L;
|
||||
/* local s = selection.circle(sel, x, y, radius); */
|
||||
/* local s = selection.circle(sel, x, y, radius, filled); */
|
||||
static int
|
||||
l_selection_circle(L)
|
||||
lua_State *L;
|
||||
l_selection_circle(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -679,8 +652,7 @@ lua_State *L;
|
||||
/* local s = selection.ellipse(sel, x, y, radius1, radius2); */
|
||||
/* local s = selection.ellipse(sel, x, y, radius1, radius2, filled); */
|
||||
static int
|
||||
l_selection_ellipse(L)
|
||||
lua_State *L;
|
||||
l_selection_ellipse(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -732,8 +704,7 @@ lua_State *L;
|
||||
/* selection.gradient({ type = "radial", x = 3, y = 5, x2 = 10, y2 = 12,
|
||||
* mindist = 4, maxdist = 10, limited = false }); */
|
||||
static int
|
||||
l_selection_gradient(L)
|
||||
lua_State *L;
|
||||
l_selection_gradient(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -747,7 +718,7 @@ lua_State *L;
|
||||
/* if limited is true, no points farther than maxdist will be added; if
|
||||
* false, all points farther than maxdist will be added */
|
||||
boolean limited = FALSE;
|
||||
long type;
|
||||
long type = 0;
|
||||
static const char *const gradtypes[] = {
|
||||
"radial", "square", NULL
|
||||
};
|
||||
@@ -792,8 +763,7 @@ lua_State *L;
|
||||
|
||||
/* sel:iterate(function(x,y) ... end); */
|
||||
static int
|
||||
l_selection_iterate(L)
|
||||
lua_State *L;
|
||||
l_selection_iterate(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
struct selectionvar *sel = (struct selectionvar *) 0;
|
||||
@@ -857,8 +827,7 @@ static const luaL_Reg l_selection_meta[] = {
|
||||
};
|
||||
|
||||
int
|
||||
l_selection_register(L)
|
||||
lua_State *L;
|
||||
l_selection_register(lua_State *L)
|
||||
{
|
||||
int lib_id, meta_id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user