forked from github/server
removing some naming conflicts that hapen when trying to re-enable amalgamation builds.
This commit is contained in:
parent
e99b69d76e
commit
7358c48580
42 changed files with 154 additions and 164 deletions
|
@ -132,14 +132,14 @@ static int tolua_selected_regions(lua_State * L)
|
||||||
|
|
||||||
static int tolua_state_open(lua_State * L)
|
static int tolua_state_open(lua_State * L)
|
||||||
{
|
{
|
||||||
unused(L);
|
unused_arg(L);
|
||||||
state_open();
|
state_open();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tolua_state_close(lua_State * L)
|
static int tolua_state_close(lua_State * L)
|
||||||
{
|
{
|
||||||
unused(L);
|
unused_arg(L);
|
||||||
state_close(current_state);
|
state_close(current_state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ static int cr_alliance(variant var, char *buffer, const void *userdata)
|
||||||
if (al != NULL) {
|
if (al != NULL) {
|
||||||
sprintf(buffer, "%d", al->id);
|
sprintf(buffer, "%d", al->id);
|
||||||
}
|
}
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ static void paint_info_region(window * wnd, const state * st)
|
||||||
int line = 0, maxline = getmaxy(win) - 2;
|
int line = 0, maxline = getmaxy(win) - 2;
|
||||||
map_region *mr = cursor_region(&st->display, &st->cursor);
|
map_region *mr = cursor_region(&st->display, &st->cursor);
|
||||||
|
|
||||||
unused(st);
|
unused_arg(st);
|
||||||
werase(win);
|
werase(win);
|
||||||
wxborder(win);
|
wxborder(win);
|
||||||
if (mr && mr->r) {
|
if (mr && mr->r) {
|
||||||
|
@ -1276,7 +1276,7 @@ int
|
||||||
curses_readline(struct lua_State *L, char *buffer, size_t size,
|
curses_readline(struct lua_State *L, char *buffer, size_t size,
|
||||||
const char *prompt)
|
const char *prompt)
|
||||||
{
|
{
|
||||||
unused(L);
|
unused_arg(L);
|
||||||
askstring(hstatus, prompt, buffer, size);
|
askstring(hstatus, prompt, buffer, size);
|
||||||
return buffer[0] != 0;
|
return buffer[0] != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ use_antimagiccrystal(unit * u, const struct item_type *itype, int amount,
|
||||||
float force;
|
float force;
|
||||||
spell *sp = find_spell("antimagiczone");
|
spell *sp = find_spell("antimagiczone");
|
||||||
attrib **ap = &r->attribs;
|
attrib **ap = &r->attribs;
|
||||||
unused(ord);
|
unused_arg(ord);
|
||||||
assert(sp);
|
assert(sp);
|
||||||
|
|
||||||
/* Reduziert die Stärke jedes Spruchs um effect */
|
/* Reduziert die Stärke jedes Spruchs um effect */
|
||||||
|
|
|
@ -39,8 +39,8 @@ summon_igjarjuk(struct unit *u, const struct item_type *itype, int amount,
|
||||||
struct order *ord)
|
struct order *ord)
|
||||||
{
|
{
|
||||||
struct plane *p = rplane(u->region);
|
struct plane *p = rplane(u->region);
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
unused(itype);
|
unused_arg(itype);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
|
||||||
return EUNUSABLE;
|
return EUNUSABLE;
|
||||||
|
|
|
@ -42,8 +42,8 @@ use_speedsail(struct unit *u, const struct item_type *itype, int amount,
|
||||||
struct order *ord)
|
struct order *ord)
|
||||||
{
|
{
|
||||||
struct plane *p = rplane(u->region);
|
struct plane *p = rplane(u->region);
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
unused(itype);
|
unused_arg(itype);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -267,7 +267,7 @@ extern "C" {
|
||||||
int ispresent(const struct faction *f, const struct region *r);
|
int ispresent(const struct faction *f, const struct region *r);
|
||||||
|
|
||||||
int check_option(struct faction *f, int option);
|
int check_option(struct faction *f, int option);
|
||||||
extern void parse(keyword_t kword, int (*dofun) (struct unit *,
|
extern void parse_kwd(keyword_t kword, int (*dofun) (struct unit *,
|
||||||
struct order *), bool thisorder);
|
struct order *), bool thisorder);
|
||||||
|
|
||||||
/* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine,
|
/* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine,
|
||||||
|
|
|
@ -230,31 +230,29 @@ void b_write(const connection * b, storage * store)
|
||||||
|
|
||||||
bool b_transparent(const connection * b, const struct faction *f)
|
bool b_transparent(const connection * b, const struct faction *f)
|
||||||
{
|
{
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_opaque(const connection * b, const struct faction * f)
|
bool b_opaque(const connection * b, const struct faction * f)
|
||||||
{
|
{
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_blockall(const connection * b, const unit * u, const region * r)
|
bool b_blockall(const connection * b, const unit * u, const region * r)
|
||||||
{
|
{
|
||||||
unused(u);
|
unused_arg(u);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_blocknone(const connection * b, const unit * u, const region * r)
|
bool b_blocknone(const connection * b, const unit * u, const region * r)
|
||||||
{
|
{
|
||||||
unused(u);
|
unused_arg((u, r, b));
|
||||||
unused(r);
|
|
||||||
unused(b);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,39 +264,36 @@ bool b_rvisible(const connection * b, const region * r)
|
||||||
bool b_fvisible(const connection * b, const struct faction * f,
|
bool b_fvisible(const connection * b, const struct faction * f,
|
||||||
const region * r)
|
const region * r)
|
||||||
{
|
{
|
||||||
unused(r);
|
unused_arg(r, f, b);
|
||||||
unused(f);
|
|
||||||
unused(b);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_uvisible(const connection * b, const unit * u)
|
bool b_uvisible(const connection * b, const unit * u)
|
||||||
{
|
{
|
||||||
unused(u);
|
unused_arg(u, b);
|
||||||
unused(b);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_rinvisible(const connection * b, const region * r)
|
bool b_rinvisible(const connection * b, const region * r)
|
||||||
{
|
{
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_finvisible(const connection * b, const struct faction * f,
|
bool b_finvisible(const connection * b, const struct faction * f,
|
||||||
const region * r)
|
const region * r)
|
||||||
{
|
{
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool b_uinvisible(const connection * b, const unit * u)
|
bool b_uinvisible(const connection * b, const unit * u)
|
||||||
{
|
{
|
||||||
unused(u);
|
unused_arg(u);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,9 +347,9 @@ static const char *b_namewall(const connection * b, const region * r,
|
||||||
{
|
{
|
||||||
const char *bname = "wall";
|
const char *bname = "wall";
|
||||||
|
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
if (gflags & GF_ARTICLE)
|
if (gflags & GF_ARTICLE)
|
||||||
bname = "a_wall";
|
bname = "a_wall";
|
||||||
if (gflags & GF_PURE)
|
if (gflags & GF_PURE)
|
||||||
|
@ -393,9 +388,9 @@ border_type bt_noway = {
|
||||||
static const char *b_namefogwall(const connection * b, const region * r,
|
static const char *b_namefogwall(const connection * b, const region * r,
|
||||||
const struct faction *f, int gflags)
|
const struct faction *f, int gflags)
|
||||||
{
|
{
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
if (gflags & GF_PURE)
|
if (gflags & GF_PURE)
|
||||||
return "fogwall";
|
return "fogwall";
|
||||||
if (gflags & GF_ARTICLE)
|
if (gflags & GF_ARTICLE)
|
||||||
|
@ -406,8 +401,8 @@ static const char *b_namefogwall(const connection * b, const region * r,
|
||||||
static bool
|
static bool
|
||||||
b_blockfogwall(const connection * b, const unit * u, const region * r)
|
b_blockfogwall(const connection * b, const unit * u, const region * r)
|
||||||
{
|
{
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
if (!u)
|
if (!u)
|
||||||
return true;
|
return true;
|
||||||
return (bool) (effskill(u, SK_PERCEPTION) > 4); /* Das ist die alte Nebelwand */
|
return (bool) (effskill(u, SK_PERCEPTION) > 4); /* Das ist die alte Nebelwand */
|
||||||
|
@ -432,8 +427,8 @@ static const char *b_nameillusionwall(const connection * b, const region * r,
|
||||||
const struct faction *f, int gflags)
|
const struct faction *f, int gflags)
|
||||||
{
|
{
|
||||||
int fno = b->data.i;
|
int fno = b->data.i;
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
if (gflags & GF_PURE)
|
if (gflags & GF_PURE)
|
||||||
return (f && fno == f->no) ? "illusionwall" : "wall";
|
return (f && fno == f->no) ? "illusionwall" : "wall";
|
||||||
if (gflags & GF_ARTICLE) {
|
if (gflags & GF_ARTICLE) {
|
||||||
|
@ -475,8 +470,8 @@ static const char *b_namequestportal(const connection * b, const region * r,
|
||||||
{
|
{
|
||||||
const char *bname;
|
const char *bname;
|
||||||
int lock = b->data.i;
|
int lock = b->data.i;
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
|
|
||||||
if (gflags & GF_ARTICLE) {
|
if (gflags & GF_ARTICLE) {
|
||||||
if (lock > 0) {
|
if (lock > 0) {
|
||||||
|
@ -521,7 +516,7 @@ static const char *b_nameroad(const connection * b, const region * r,
|
||||||
int local = (r == b->from) ? b->data.sa[0] : b->data.sa[1];
|
int local = (r == b->from) ? b->data.sa[0] : b->data.sa[1];
|
||||||
static char buffer[64];
|
static char buffer[64];
|
||||||
|
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
if (gflags & GF_PURE)
|
if (gflags & GF_PURE)
|
||||||
return "road";
|
return "road";
|
||||||
if (gflags & GF_ARTICLE) {
|
if (gflags & GF_ARTICLE) {
|
||||||
|
|
|
@ -56,8 +56,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <tests.h>
|
|
||||||
|
|
||||||
#define MAXENTITYHASH 7919
|
#define MAXENTITYHASH 7919
|
||||||
curse *cursehash[MAXENTITYHASH];
|
curse *cursehash[MAXENTITYHASH];
|
||||||
|
|
||||||
|
@ -769,9 +767,9 @@ message *cinfo_simple(const void *obj, objtype_t typ, const struct curse * c,
|
||||||
{
|
{
|
||||||
struct message *msg;
|
struct message *msg;
|
||||||
|
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(self);
|
unused_arg(self);
|
||||||
unused(obj);
|
unused_arg(obj);
|
||||||
|
|
||||||
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
|
|
|
@ -635,9 +635,9 @@ use_birthdayamulet(unit * u, const struct item_type *itype, int amount,
|
||||||
direction_t d;
|
direction_t d;
|
||||||
message *msg = msg_message("meow", "");
|
message *msg = msg_message("meow", "");
|
||||||
|
|
||||||
unused(ord);
|
unused_arg(ord);
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
unused(itype);
|
unused_arg(itype);
|
||||||
|
|
||||||
add_message(&u->region->msgs, msg);
|
add_message(&u->region->msgs, msg);
|
||||||
for (d = 0; d < MAXDIRECTIONS; d++) {
|
for (d = 0; d < MAXDIRECTIONS; d++) {
|
||||||
|
@ -676,7 +676,7 @@ use_tacticcrystal(unit * u, const struct item_type *itype, int amount,
|
||||||
c = create_curse(u, &u->attribs, ct_find("skillmod"), power,
|
c = create_curse(u, &u->attribs, ct_find("skillmod"), power,
|
||||||
duration, effect, u->number);
|
duration, effect, u->number);
|
||||||
c->data.i = SK_TACTICS;
|
c->data.i = SK_TACTICS;
|
||||||
unused(ord);
|
unused_arg(ord);
|
||||||
}
|
}
|
||||||
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
|
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
|
||||||
ADDMSG(&u->faction->msgs, msg_message("use_tacticcrystal",
|
ADDMSG(&u->faction->msgs, msg_message("use_tacticcrystal",
|
||||||
|
@ -714,7 +714,7 @@ mod_elves_only(const unit * u, const region * r, skill_t sk, int value)
|
||||||
{
|
{
|
||||||
if (u_race(u) == new_race[RC_ELF])
|
if (u_race(u) == new_race[RC_ELF])
|
||||||
return value;
|
return value;
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
return -118;
|
return -118;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value)
|
||||||
{
|
{
|
||||||
if (u_race(u) == new_race[RC_DWARF])
|
if (u_race(u) == new_race[RC_DWARF])
|
||||||
return value;
|
return value;
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
return -118;
|
return -118;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ caddmessage(region * r, faction * f, const char *s, msg_t mtype, int level)
|
||||||
log_warning("message for locale \"%s\": %s\n", locale_name(f->locale), s);
|
log_warning("message for locale \"%s\": %s\n", locale_name(f->locale), s);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
unused(level);
|
unused_arg(level);
|
||||||
switch (mtype) {
|
switch (mtype) {
|
||||||
case MSG_INCOME:
|
case MSG_INCOME:
|
||||||
assert(f);
|
assert(f);
|
||||||
|
@ -255,7 +255,7 @@ message * cmistake(const unit * u, struct order *ord, int mno, int mtype)
|
||||||
{
|
{
|
||||||
message * result;
|
message * result;
|
||||||
static char msgname[20];
|
static char msgname[20];
|
||||||
unused(mtype);
|
unused_arg(mtype);
|
||||||
|
|
||||||
if (is_monsters(u->faction))
|
if (is_monsters(u->faction))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2127,7 +2127,7 @@ static void eval_order(struct opstack **stack, const void *userdata)
|
||||||
size_t len;
|
size_t len;
|
||||||
variant var;
|
variant var;
|
||||||
|
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
write_order(ord, buf, sizeof(buf));
|
write_order(ord, buf, sizeof(buf));
|
||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
var.v = strcpy(balloc(len + 1), buf);
|
var.v = strcpy(balloc(len + 1), buf);
|
||||||
|
@ -2282,7 +2282,7 @@ static void eval_int36(struct opstack **stack, const void *userdata)
|
||||||
|
|
||||||
var.v = strcpy(balloc(len + 1), c);
|
var.v = strcpy(balloc(len + 1), c);
|
||||||
opush(stack, var);
|
opush(stack, var);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** END MESSAGE RENDERING ***/
|
/*** END MESSAGE RENDERING ***/
|
||||||
|
|
|
@ -119,7 +119,7 @@ static void terraform_default(struct rawmaterial *res, const region * r)
|
||||||
res->amount = (int)(res->amount * modifier); /* random adjustment, +/- 91% */
|
res->amount = (int)(res->amount * modifier); /* random adjustment, +/- 91% */
|
||||||
if (res->amount < 1)
|
if (res->amount < 1)
|
||||||
res->amount = 1;
|
res->amount = 1;
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RANDOM_CHANGE
|
#ifdef RANDOM_CHANGE
|
||||||
|
|
|
@ -102,13 +102,13 @@ void st_register(const ship_type * type)
|
||||||
ql_push(&shiptypes, (void *)type);
|
ql_push(&shiptypes, (void *)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SMAXHASH 7919
|
#define MAXSHIPHASH 7919
|
||||||
ship *shiphash[SMAXHASH];
|
ship *shiphash[MAXSHIPHASH];
|
||||||
void shash(ship * s)
|
void shash(ship * s)
|
||||||
{
|
{
|
||||||
ship *old = shiphash[s->no % SMAXHASH];
|
ship *old = shiphash[s->no % MAXSHIPHASH];
|
||||||
|
|
||||||
shiphash[s->no % SMAXHASH] = s;
|
shiphash[s->no % MAXSHIPHASH] = s;
|
||||||
s->nexthash = old;
|
s->nexthash = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ void sunhash(ship * s)
|
||||||
{
|
{
|
||||||
ship **show;
|
ship **show;
|
||||||
|
|
||||||
for (show = &shiphash[s->no % SMAXHASH]; *show; show = &(*show)->nexthash) {
|
for (show = &shiphash[s->no % MAXSHIPHASH]; *show; show = &(*show)->nexthash) {
|
||||||
if ((*show)->no == s->no)
|
if ((*show)->no == s->no)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ static ship *sfindhash(int i)
|
||||||
{
|
{
|
||||||
ship *old;
|
ship *old;
|
||||||
|
|
||||||
for (old = shiphash[i % SMAXHASH]; old; old = old->nexthash)
|
for (old = shiphash[i % MAXSHIPHASH]; old; old = old->nexthash)
|
||||||
if (old->no == i)
|
if (old->no == i)
|
||||||
return old;
|
return old;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -749,7 +749,7 @@ void set_level(unit * u, skill_t sk, int value)
|
||||||
static int leftship_age(struct attrib *a)
|
static int leftship_age(struct attrib *a)
|
||||||
{
|
{
|
||||||
/* must be aged, so it doesn't affect report generation (cansee) */
|
/* must be aged, so it doesn't affect report generation (cansee) */
|
||||||
unused(a);
|
unused_arg(a);
|
||||||
return AT_AGE_REMOVE; /* remove me */
|
return AT_AGE_REMOVE; /* remove me */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
#include <tests.h>
|
|
||||||
|
|
||||||
static unsigned int get_markets(region * r, unit ** results, size_t size)
|
static unsigned int get_markets(region * r, unit ** results, size_t size)
|
||||||
{
|
{
|
||||||
unsigned int n = 0;
|
unsigned int n = 0;
|
||||||
|
|
|
@ -107,9 +107,9 @@ leave_arena(struct unit *u, const struct item_type *itype, int amount,
|
||||||
if (u->building != arena_tower(u->faction->magiegebiet) && leave_fail(u)) {
|
if (u->building != arena_tower(u->faction->magiegebiet) && leave_fail(u)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
unused(ord);
|
unused_arg(ord);
|
||||||
unused(itype);
|
unused_arg(itype);
|
||||||
assert(!"not implemented");
|
assert(!"not implemented");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,9 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
unit *u2;
|
unit *u2;
|
||||||
int fee = u->faction->score / 5;
|
int fee = u->faction->score / 5;
|
||||||
unused(ord);
|
unused_arg(ord);
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
unused(itype);
|
unused_arg(itype);
|
||||||
if (fee > 2000)
|
if (fee > 2000)
|
||||||
fee = 2000;
|
fee = 2000;
|
||||||
if (getplane(r) == arena)
|
if (getplane(r) == arena)
|
||||||
|
@ -186,7 +186,7 @@ use_wand_of_tears(unit * user, const struct item_type *itype, int amount,
|
||||||
order * ord)
|
order * ord)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
unused(ord);
|
unused_arg(ord);
|
||||||
for (n = 0; n != amount; ++n) {
|
for (n = 0; n != amount; ++n) {
|
||||||
unit *u;
|
unit *u;
|
||||||
for (u = user->region->units; u; u = u->next) {
|
for (u = user->region->units; u; u = u->next) {
|
||||||
|
@ -432,7 +432,7 @@ static int caldera_handle(trigger * t, void *data)
|
||||||
} else {
|
} else {
|
||||||
log_error("could not perform caldera::handle()\n");
|
log_error("could not perform caldera::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ use_museumexitticket(unit * u, const struct item_type *itype, int amount,
|
||||||
unit *warden = findunit(atoi36("mwar"));
|
unit *warden = findunit(atoi36("mwar"));
|
||||||
int unit_cookie;
|
int unit_cookie;
|
||||||
|
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
|
|
||||||
/* Prüfen ob in Eingangshalle */
|
/* Prüfen ob in Eingangshalle */
|
||||||
if (u->region->x != 9525 || u->region->y != 9525) {
|
if (u->region->x != 9525 || u->region->y != 9525) {
|
||||||
|
@ -362,9 +362,9 @@ use_museumticket(unit * u, const struct item_type *itype, int amount,
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
plane *pl = rplane(r);
|
plane *pl = rplane(r);
|
||||||
|
|
||||||
unused(amount);
|
unused_arg(amount);
|
||||||
|
|
||||||
/* Prüfen ob in normaler Plane und nur eine Person */
|
/* Prüfen ob in normaler Plane und nur eine Person */
|
||||||
if (pl != get_homeplane()) {
|
if (pl != get_homeplane()) {
|
||||||
cmistake(u, ord, 265, MSG_MAGIC);
|
cmistake(u, ord, 265, MSG_MAGIC);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -78,7 +78,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
# define _XOPEN_SOURCE
|
# define _XOPEN_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define unused (void)
|
#define unused_arg (void)
|
||||||
|
|
||||||
#ifndef INLINE_FUNCTION
|
#ifndef INLINE_FUNCTION
|
||||||
# define INLINE_FUNCTION
|
# define INLINE_FUNCTION
|
||||||
|
|
|
@ -234,9 +234,9 @@ static const char *b_namefirewall(const connection * b, const region * r,
|
||||||
const faction * f, int gflags)
|
const faction * f, int gflags)
|
||||||
{
|
{
|
||||||
const char *bname;
|
const char *bname;
|
||||||
unused(f);
|
unused_arg(f);
|
||||||
unused(r);
|
unused_arg(r);
|
||||||
unused(b);
|
unused_arg(b);
|
||||||
if (gflags & GF_ARTICLE)
|
if (gflags & GF_ARTICLE)
|
||||||
bname = "a_firewall";
|
bname = "a_firewall";
|
||||||
else
|
else
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
static message *cinfo_building(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_building(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_BUILDING);
|
assert(typ == TYP_BUILDING);
|
||||||
|
|
||||||
if (self != 0) { /* owner or inside */
|
if (self != 0) { /* owner or inside */
|
||||||
|
|
|
@ -46,8 +46,8 @@ static message *cinfo_cursed_by_the_gods(const void *obj, objtype_t typ,
|
||||||
{
|
{
|
||||||
region *r = (region *) obj;
|
region *r = (region *) obj;
|
||||||
|
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(self);
|
unused_arg(self);
|
||||||
assert(typ == TYP_REGION);
|
assert(typ == TYP_REGION);
|
||||||
|
|
||||||
if (fval(r->terrain, SEA_REGION)) {
|
if (fval(r->terrain, SEA_REGION)) {
|
||||||
|
@ -69,9 +69,9 @@ static struct curse_type ct_godcursezone = {
|
||||||
static message *cinfo_dreamcurse(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_dreamcurse(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(self);
|
unused_arg(self);
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(obj);
|
unused_arg(obj);
|
||||||
assert(typ == TYP_REGION);
|
assert(typ == TYP_REGION);
|
||||||
|
|
||||||
if (curse_geteffect(c) > 0) {
|
if (curse_geteffect(c) > 0) {
|
||||||
|
@ -93,9 +93,9 @@ static struct curse_type ct_gbdream = {
|
||||||
static message *cinfo_magicstreet(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_magicstreet(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(self);
|
unused_arg(self);
|
||||||
unused(obj);
|
unused_arg(obj);
|
||||||
assert(typ == TYP_REGION);
|
assert(typ == TYP_REGION);
|
||||||
|
|
||||||
/* Warnung vor Auflösung */
|
/* Warnung vor Auflösung */
|
||||||
|
@ -116,9 +116,9 @@ static struct curse_type ct_magicstreet = {
|
||||||
static message *cinfo_antimagiczone(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_antimagiczone(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(self);
|
unused_arg(self);
|
||||||
unused(obj);
|
unused_arg(obj);
|
||||||
assert(typ == TYP_REGION);
|
assert(typ == TYP_REGION);
|
||||||
|
|
||||||
/* Magier spüren eine Antimagiezone */
|
/* Magier spüren eine Antimagiezone */
|
||||||
|
@ -138,7 +138,7 @@ cansee_antimagiczone(const struct faction *viewer, const void *obj, objtype_t ty
|
||||||
unit *u = NULL;
|
unit *u = NULL;
|
||||||
unit *mage = c->magician;
|
unit *mage = c->magician;
|
||||||
|
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
assert(typ == TYP_REGION);
|
assert(typ == TYP_REGION);
|
||||||
r = (region *) obj;
|
r = (region *) obj;
|
||||||
|
@ -166,8 +166,8 @@ static struct curse_type ct_antimagiczone = {
|
||||||
static message *cinfo_farvision(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_farvision(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(obj);
|
unused_arg(obj);
|
||||||
|
|
||||||
assert(typ == TYP_REGION);
|
assert(typ == TYP_REGION);
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ message *cinfo_ship(const void *obj, objtype_t typ, const curse * c, int self)
|
||||||
{
|
{
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
unused(obj);
|
unused_arg(obj);
|
||||||
assert(typ == TYP_SHIP);
|
assert(typ == TYP_SHIP);
|
||||||
|
|
||||||
if (self != 0) { /* owner or inside */
|
if (self != 0) { /* owner or inside */
|
||||||
|
@ -63,7 +63,7 @@ static message *cinfo_shipnodrift(const void *obj, objtype_t typ, const curse *
|
||||||
{
|
{
|
||||||
ship *sh = (ship *) obj;
|
ship *sh = (ship *) obj;
|
||||||
|
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_SHIP);
|
assert(typ == TYP_SHIP);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
|
|
|
@ -5569,7 +5569,7 @@ int sp_showastral(castorder * co)
|
||||||
|
|
||||||
free_regionlist(rl);
|
free_regionlist(rl);
|
||||||
return cast_level;
|
return cast_level;
|
||||||
unused(co);
|
unused_arg(co);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -48,7 +48,7 @@ static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
struct unit *u = (struct unit *)obj;
|
struct unit *u = (struct unit *)obj;
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
|
@ -81,7 +81,7 @@ static message *cinfo_slave(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
u = (unit *) obj;
|
u = (unit *) obj;
|
||||||
|
@ -105,7 +105,7 @@ static struct curse_type ct_slavery = { "slavery",
|
||||||
static message *cinfo_calm(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_calm(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (c->magician && c->magician->faction) {
|
if (c->magician && c->magician->faction) {
|
||||||
|
@ -134,7 +134,7 @@ static struct curse_type ct_calmmonster = {
|
||||||
static message *cinfo_speed(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_speed(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
|
@ -157,7 +157,7 @@ static struct curse_type ct_speed = {
|
||||||
*/
|
*/
|
||||||
message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self)
|
message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
|
@ -181,7 +181,7 @@ static struct curse_type ct_orcish = {
|
||||||
static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
|
@ -233,7 +233,7 @@ static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c,
|
||||||
};
|
};
|
||||||
int m, begin = 0, end = 0;
|
int m, begin = 0, end = 0;
|
||||||
unit *u;
|
unit *u;
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
u = (unit *) obj;
|
u = (unit *) obj;
|
||||||
|
@ -333,7 +333,7 @@ write_skill(struct storage *store, const curse * c, const void *target)
|
||||||
static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c,
|
static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused_arg(typ);
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *) obj;
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include <CuTest.h>
|
|
||||||
|
|
||||||
void test_cleanup(void);
|
void test_cleanup(void);
|
||||||
|
|
||||||
struct terrain_type * test_create_terrain(const char * name, unsigned int flags);
|
struct terrain_type * test_create_terrain(const char * name, unsigned int flags);
|
||||||
|
|
|
@ -70,7 +70,7 @@ static int changefaction_handle(trigger * t, void *data)
|
||||||
} else {
|
} else {
|
||||||
log_error("could not perform changefaction::handle()\n");
|
log_error("could not perform changefaction::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ static int changerace_handle(trigger * t, void *data)
|
||||||
} else {
|
} else {
|
||||||
log_error("could not perform changerace::handle()\n");
|
log_error("could not perform changerace::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ static int clonedied_handle(trigger * t, void *data)
|
||||||
a_remove(&u->attribs, a);
|
a_remove(&u->attribs, a);
|
||||||
} else
|
} else
|
||||||
log_error("could not perform clonedied::handle()\n");
|
log_error("could not perform clonedied::handle()\n");
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static int createcurse_handle(trigger * t, void *data)
|
||||||
} else {
|
} else {
|
||||||
log_error("could not perform createcurse::handle()\n");
|
log_error("could not perform createcurse::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int createunit_handle(trigger * t, void *data)
|
||||||
} else {
|
} else {
|
||||||
log_error("could not perform createunit::handle()\n");
|
log_error("could not perform createunit::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ static int gate_handle(trigger * t, void *data)
|
||||||
log_error("could not perform gate::handle()\n");
|
log_error("could not perform gate::handle()\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ static int giveitem_handle(trigger * t, void *data)
|
||||||
} else {
|
} else {
|
||||||
log_error("could not perform giveitem::handle()\n");
|
log_error("could not perform giveitem::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ static int killunit_handle(trigger * t, void *data)
|
||||||
/* we can't remove_unit() here, because that's what's calling us. */
|
/* we can't remove_unit() here, because that's what's calling us. */
|
||||||
set_number(u, 0);
|
set_number(u, 0);
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static int removecurse_handle(trigger * t, void *data)
|
||||||
} else
|
} else
|
||||||
log_error("could not perform removecurse::handle()\n");
|
log_error("could not perform removecurse::handle()\n");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ static int shock_handle(trigger * t, void *data)
|
||||||
if (u && u->number) {
|
if (u && u->number) {
|
||||||
do_shock(u, "trigger");
|
do_shock(u, "trigger");
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int timeout_handle(trigger * t, void *data)
|
||||||
handle_triggers(&td->triggers, NULL);
|
handle_triggers(&td->triggers, NULL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ static int unguard_handle(trigger * t, void *data)
|
||||||
log_error("could not perform unguard::handle()\n");
|
log_error("could not perform unguard::handle()\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ static int unitmessage_handle(trigger * t, void *data)
|
||||||
td->level);
|
td->level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unused(data);
|
unused_arg(data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,21 +135,21 @@ int cr_render(const message * msg, char *buffer, const void *userdata)
|
||||||
int cr_string(variant var, char *buffer, const void *userdata)
|
int cr_string(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "\"%s\"", (const char *)var.v);
|
sprintf(buffer, "\"%s\"", (const char *)var.v);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cr_int(variant var, char *buffer, const void *userdata)
|
int cr_int(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "%d", var.i);
|
sprintf(buffer, "%d", var.i);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cr_ignore(variant var, char *buffer, const void *userdata)
|
int cr_ignore(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
unused(var);
|
unused_arg(var);
|
||||||
unused(buffer);
|
unused_arg(buffer);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ typedef struct parser_state {
|
||||||
struct parser_state *next;
|
struct parser_state *next;
|
||||||
} parser_state;
|
} parser_state;
|
||||||
|
|
||||||
static parser_state *state;
|
static parser_state *states;
|
||||||
|
|
||||||
static int eatwhitespace_c(const char **str_p)
|
static int eatwhitespace_c(const char **str_p)
|
||||||
{
|
{
|
||||||
|
@ -51,12 +51,12 @@ static int eatwhitespace_c(const char **str_p)
|
||||||
|
|
||||||
void init_tokens_str(const char *initstr, char *cmd)
|
void init_tokens_str(const char *initstr, char *cmd)
|
||||||
{
|
{
|
||||||
if (state == NULL) {
|
if (states == NULL) {
|
||||||
state = malloc(sizeof(parser_state));
|
states = malloc(sizeof(parser_state));
|
||||||
} else if (state->current_cmd)
|
} else if (states->current_cmd)
|
||||||
free(state->current_cmd);
|
free(states->current_cmd);
|
||||||
state->current_cmd = cmd;
|
states->current_cmd = cmd;
|
||||||
state->current_token = initstr;
|
states->current_token = initstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser_pushstate(void)
|
void parser_pushstate(void)
|
||||||
|
@ -64,44 +64,44 @@ void parser_pushstate(void)
|
||||||
parser_state *new_state = malloc(sizeof(parser_state));
|
parser_state *new_state = malloc(sizeof(parser_state));
|
||||||
new_state->current_cmd = NULL;
|
new_state->current_cmd = NULL;
|
||||||
new_state->current_token = NULL;
|
new_state->current_token = NULL;
|
||||||
new_state->next = state;
|
new_state->next = states;
|
||||||
state = new_state;
|
states = new_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser_popstate(void)
|
void parser_popstate(void)
|
||||||
{
|
{
|
||||||
parser_state *new_state = state->next;
|
parser_state *new_state = states->next;
|
||||||
if (state->current_cmd != NULL)
|
if (states->current_cmd != NULL)
|
||||||
free(state->current_cmd);
|
free(states->current_cmd);
|
||||||
free(state);
|
free(states);
|
||||||
state = new_state;
|
states = new_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parser_end(void)
|
bool parser_end(void)
|
||||||
{
|
{
|
||||||
eatwhitespace_c(&state->current_token);
|
eatwhitespace_c(&states->current_token);
|
||||||
return *state->current_token == 0;
|
return *states->current_token == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void skip_token(void)
|
void skip_token(void)
|
||||||
{
|
{
|
||||||
char quotechar = 0;
|
char quotechar = 0;
|
||||||
eatwhitespace_c(&state->current_token);
|
eatwhitespace_c(&states->current_token);
|
||||||
|
|
||||||
while (*state->current_token) {
|
while (*states->current_token) {
|
||||||
ucs4_t ucs;
|
ucs4_t ucs;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
unsigned char utf8_character = (unsigned char)state->current_token[0];
|
unsigned char utf8_character = (unsigned char)states->current_token[0];
|
||||||
if (~utf8_character & 0x80) {
|
if (~utf8_character & 0x80) {
|
||||||
ucs = utf8_character;
|
ucs = utf8_character;
|
||||||
++state->current_token;
|
++states->current_token;
|
||||||
} else {
|
} else {
|
||||||
int ret = unicode_utf8_to_ucs4(&ucs, state->current_token, &len);
|
int ret = unicode_utf8_to_ucs4(&ucs, states->current_token, &len);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
state->current_token += len;
|
states->current_token += len;
|
||||||
} else {
|
} else {
|
||||||
log_warning("illegal character sequence in UTF8 string: %s\n", state->current_token);
|
log_warning("illegal character sequence in UTF8 string: %s\n", states->current_token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (iswxspace((wint_t) ucs) && quotechar == 0) {
|
if (iswxspace((wint_t) ucs) && quotechar == 0) {
|
||||||
|
@ -115,7 +115,7 @@ void skip_token(void)
|
||||||
quotechar = utf8_character;
|
quotechar = utf8_character;
|
||||||
break;
|
break;
|
||||||
case ESCAPE_CHAR:
|
case ESCAPE_CHAR:
|
||||||
++state->current_token;
|
++states->current_token;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,5 +189,5 @@ const char *parse_token(const char **str)
|
||||||
|
|
||||||
const char *getstrtoken(void)
|
const char *getstrtoken(void)
|
||||||
{
|
{
|
||||||
return parse_token((const char **)&state->current_token);
|
return parse_token((const char **)&states->current_token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,7 +405,7 @@ static void eval_lt(opstack ** stack, const void *userdata)
|
||||||
int b = opop_i(stack);
|
int b = opop_i(stack);
|
||||||
int rval = (b < a) ? 1 : 0;
|
int rval = (b < a) ? 1 : 0;
|
||||||
opush_i(stack, rval);
|
opush_i(stack, rval);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eval_eq(opstack ** stack, const void *userdata)
|
static void eval_eq(opstack ** stack, const void *userdata)
|
||||||
|
@ -414,7 +414,7 @@ static void eval_eq(opstack ** stack, const void *userdata)
|
||||||
int b = opop_i(stack);
|
int b = opop_i(stack);
|
||||||
int rval = (a == b) ? 1 : 0;
|
int rval = (a == b) ? 1 : 0;
|
||||||
opush_i(stack, rval);
|
opush_i(stack, rval);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eval_add(opstack ** stack, const void *userdata)
|
static void eval_add(opstack ** stack, const void *userdata)
|
||||||
|
@ -422,14 +422,14 @@ static void eval_add(opstack ** stack, const void *userdata)
|
||||||
int a = opop_i(stack);
|
int a = opop_i(stack);
|
||||||
int b = opop_i(stack);
|
int b = opop_i(stack);
|
||||||
opush_i(stack, a + b);
|
opush_i(stack, a + b);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eval_isnull(opstack ** stack, const void *userdata)
|
static void eval_isnull(opstack ** stack, const void *userdata)
|
||||||
{ /* (int, int) -> int */
|
{ /* (int, int) -> int */
|
||||||
void *a = opop_v(stack);
|
void *a = opop_v(stack);
|
||||||
opush_i(stack, (a == NULL) ? 1 : 0);
|
opush_i(stack, (a == NULL) ? 1 : 0);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eval_if(opstack ** stack, const void *userdata)
|
static void eval_if(opstack ** stack, const void *userdata)
|
||||||
|
@ -438,14 +438,14 @@ static void eval_if(opstack ** stack, const void *userdata)
|
||||||
void *b = opop_v(stack);
|
void *b = opop_v(stack);
|
||||||
int cond = opop_i(stack);
|
int cond = opop_i(stack);
|
||||||
opush_v(stack, cond ? b : a);
|
opush_v(stack, cond ? b : a);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void eval_strlen(opstack ** stack, const void *userdata)
|
static void eval_strlen(opstack ** stack, const void *userdata)
|
||||||
{ /* string -> int */
|
{ /* string -> int */
|
||||||
const char *c = (const char *)opop_v(stack);
|
const char *c = (const char *)opop_v(stack);
|
||||||
opush_i(stack, c ? (int)strlen(c) : 0);
|
opush_i(stack, c ? (int)strlen(c) : 0);
|
||||||
unused(userdata);
|
unused_arg(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "base36.h"
|
#include "base36.h"
|
||||||
|
|
Loading…
Reference in a new issue