mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Assorted char * -> const char * API changes.
I went through all the char * parameters and return values I could see in puzzles.h by eye and spotted ones that surely ought to have been const all along.
This commit is contained in:
2
combi.c
2
combi.c
@ -79,7 +79,7 @@ void free_combi(combi_ctx *combi)
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
14
devel.but
14
devel.but
@ -1961,7 +1961,8 @@ This ensures that thin lines are visible even at small scales.
|
|||||||
\S{drawing-draw-text} \cw{draw_text()}
|
\S{drawing-draw-text} \cw{draw_text()}
|
||||||
|
|
||||||
\c void draw_text(drawing *dr, int x, int y, int fonttype,
|
\c void draw_text(drawing *dr, int x, int y, int fonttype,
|
||||||
\c int fontsize, int align, int colour, char *text);
|
\c int fontsize, int align, int colour,
|
||||||
|
\c const char *text);
|
||||||
|
|
||||||
Draws text in the puzzle window.
|
Draws text in the puzzle window.
|
||||||
|
|
||||||
@ -2122,7 +2123,7 @@ printing routines, that code may safely call \cw{draw_update()}.)
|
|||||||
|
|
||||||
\S{drawing-status-bar} \cw{status_bar()}
|
\S{drawing-status-bar} \cw{status_bar()}
|
||||||
|
|
||||||
\c void status_bar(drawing *dr, char *text);
|
\c void status_bar(drawing *dr, const char *text);
|
||||||
|
|
||||||
Sets the text in the game's status bar to \c{text}. The text is copied
|
Sets the text in the game's status bar to \c{text}. The text is copied
|
||||||
from the supplied buffer, so the caller is free to deallocate or
|
from the supplied buffer, so the caller is free to deallocate or
|
||||||
@ -2393,7 +2394,8 @@ function \cw{drawing_new()} (see \k{drawing-new}).
|
|||||||
\S{drawingapi-draw-text} \cw{draw_text()}
|
\S{drawingapi-draw-text} \cw{draw_text()}
|
||||||
|
|
||||||
\c void (*draw_text)(void *handle, int x, int y, int fonttype,
|
\c void (*draw_text)(void *handle, int x, int y, int fonttype,
|
||||||
\c int fontsize, int align, int colour, char *text);
|
\c int fontsize, int align, int colour,
|
||||||
|
\c const char *text);
|
||||||
|
|
||||||
This function behaves exactly like the back end \cw{draw_text()}
|
This function behaves exactly like the back end \cw{draw_text()}
|
||||||
function; see \k{drawing-draw-text}.
|
function; see \k{drawing-draw-text}.
|
||||||
@ -2496,7 +2498,7 @@ called unless drawing is attempted.
|
|||||||
|
|
||||||
\S{drawingapi-status-bar} \cw{status_bar()}
|
\S{drawingapi-status-bar} \cw{status_bar()}
|
||||||
|
|
||||||
\c void (*status_bar)(void *handle, char *text);
|
\c void (*status_bar)(void *handle, const char *text);
|
||||||
|
|
||||||
This function behaves exactly like the back end \cw{status_bar()}
|
This function behaves exactly like the back end \cw{status_bar()}
|
||||||
function; see \k{drawing-status-bar}.
|
function; see \k{drawing-status-bar}.
|
||||||
@ -3178,7 +3180,7 @@ using \cw{midend_size()} and eventually perform a refresh using
|
|||||||
|
|
||||||
\H{midend-game-id} \cw{midend_game_id()}
|
\H{midend-game-id} \cw{midend_game_id()}
|
||||||
|
|
||||||
\c const char *midend_game_id(midend *me, char *id);
|
\c const char *midend_game_id(midend *me, const char *id);
|
||||||
|
|
||||||
Passes the mid-end a string game ID (of any of the valid forms
|
Passes the mid-end a string game ID (of any of the valid forms
|
||||||
\cq{params}, \cq{params:description} or \cq{params#seed}) which the
|
\cq{params}, \cq{params:description} or \cq{params#seed}) which the
|
||||||
@ -3507,7 +3509,7 @@ calling \cw{midend_timer()}.
|
|||||||
|
|
||||||
\H{frontend-fatal} \cw{fatal()}
|
\H{frontend-fatal} \cw{fatal()}
|
||||||
|
|
||||||
\c void fatal(char *fmt, ...);
|
\c void fatal(const char *fmt, ...);
|
||||||
|
|
||||||
This is called by some utility functions if they encounter a
|
This is called by some utility functions if they encounter a
|
||||||
genuinely fatal error such as running out of memory. It is a
|
genuinely fatal error such as running out of memory. It is a
|
||||||
|
@ -71,7 +71,7 @@ void drawing_free(drawing *dr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
|
void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
|
||||||
int align, int colour, char *text)
|
int align, int colour, const char *text)
|
||||||
{
|
{
|
||||||
dr->api->draw_text(dr->handle, x, y, fonttype, fontsize, align,
|
dr->api->draw_text(dr->handle, x, y, fonttype, fontsize, align,
|
||||||
colour, text);
|
colour, text);
|
||||||
@ -190,7 +190,7 @@ char *text_fallback(drawing *dr, const char *const *strings, int nstrings)
|
|||||||
return NULL; /* placate optimiser */
|
return NULL; /* placate optimiser */
|
||||||
}
|
}
|
||||||
|
|
||||||
void status_bar(drawing *dr, char *text)
|
void status_bar(drawing *dr, const char *text)
|
||||||
{
|
{
|
||||||
char *rewritten;
|
char *rewritten;
|
||||||
|
|
||||||
|
9
emcc.c
9
emcc.c
@ -122,7 +122,7 @@ void get_random_seed(void **randseed, int *randseedsize)
|
|||||||
* Fatal error, called in cases of complete despair such as when
|
* Fatal error, called in cases of complete despair such as when
|
||||||
* malloc() has returned NULL.
|
* malloc() has returned NULL.
|
||||||
*/
|
*/
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -136,7 +136,7 @@ void fatal(char *fmt, ...)
|
|||||||
js_error_box(buf);
|
js_error_box(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_printf(char *fmt, ...)
|
void debug_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -384,7 +384,8 @@ static void js_unclip(void *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void js_draw_text(void *handle, int x, int y, int fonttype,
|
static void js_draw_text(void *handle, int x, int y, int fonttype,
|
||||||
int fontsize, int align, int colour, char *text)
|
int fontsize, int align, int colour,
|
||||||
|
const char *text)
|
||||||
{
|
{
|
||||||
char fontstyle[80];
|
char fontstyle[80];
|
||||||
int halign;
|
int halign;
|
||||||
@ -515,7 +516,7 @@ static void js_end_draw(void *handle)
|
|||||||
js_canvas_end_draw();
|
js_canvas_end_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void js_status_bar(void *handle, char *text)
|
static void js_status_bar(void *handle, const char *text)
|
||||||
{
|
{
|
||||||
js_canvas_set_statusbar(text);
|
js_canvas_set_statusbar(text);
|
||||||
}
|
}
|
||||||
|
10
gtk.c
10
gtk.c
@ -71,7 +71,7 @@
|
|||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
static FILE *debug_fp = NULL;
|
static FILE *debug_fp = NULL;
|
||||||
|
|
||||||
void dputs(char *buf)
|
void dputs(const char *buf)
|
||||||
{
|
{
|
||||||
if (!debug_fp) {
|
if (!debug_fp) {
|
||||||
debug_fp = fopen("debug.log", "w");
|
debug_fp = fopen("debug.log", "w");
|
||||||
@ -85,7 +85,7 @@ void dputs(char *buf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_printf(char *fmt, ...)
|
void debug_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -101,7 +101,7 @@ void debug_printf(char *fmt, ...)
|
|||||||
* Error reporting functions used elsewhere.
|
* Error reporting functions used elsewhere.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ void frontend_default_colour(frontend *fe, float *output)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void gtk_status_bar(void *handle, char *text)
|
void gtk_status_bar(void *handle, const char *text)
|
||||||
{
|
{
|
||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
|
|
||||||
@ -1000,7 +1000,7 @@ void gtk_unclip(void *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gtk_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
|
void gtk_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
|
||||||
int align, int colour, char *text)
|
int align, int colour, const char *text)
|
||||||
{
|
{
|
||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
int i;
|
int i;
|
||||||
|
34
midend.c
34
midend.c
@ -1320,7 +1320,8 @@ void midend_request_id_changes(midend *me, void (*notify)(void *), void *ctx)
|
|||||||
me->game_id_change_notify_ctx = ctx;
|
me->game_id_change_notify_ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc)
|
void midend_supersede_game_desc(midend *me, const char *desc,
|
||||||
|
const char *privdesc)
|
||||||
{
|
{
|
||||||
sfree(me->desc);
|
sfree(me->desc);
|
||||||
sfree(me->privdesc);
|
sfree(me->privdesc);
|
||||||
@ -1393,10 +1394,11 @@ config_item *midend_get_config(midend *me, int which, char **wintitle)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *midend_game_id_int(midend *me, char *id, int defmode)
|
static const char *midend_game_id_int(midend *me, const char *id, int defmode)
|
||||||
{
|
{
|
||||||
const char *error;
|
const char *error;
|
||||||
char *par, *desc, *seed;
|
char *par = NULL;
|
||||||
|
const char *desc, *seed;
|
||||||
game_params *newcurparams, *newparams, *oldparams1, *oldparams2;
|
game_params *newcurparams, *newparams, *oldparams1, *oldparams2;
|
||||||
int free_params;
|
int free_params;
|
||||||
|
|
||||||
@ -1409,8 +1411,10 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
|
|||||||
* description. So `par' now points to the parameters
|
* description. So `par' now points to the parameters
|
||||||
* string, and `desc' to the description string.
|
* string, and `desc' to the description string.
|
||||||
*/
|
*/
|
||||||
*desc++ = '\0';
|
par = snewn(desc-id + 1, char);
|
||||||
par = id;
|
strncpy(par, id, desc-id);
|
||||||
|
par[desc-id] = '\0';
|
||||||
|
desc++;
|
||||||
seed = NULL;
|
seed = NULL;
|
||||||
} else if (seed && (!desc || seed < desc)) {
|
} else if (seed && (!desc || seed < desc)) {
|
||||||
/*
|
/*
|
||||||
@ -1418,8 +1422,10 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
|
|||||||
* So `par' now points to the parameters string, and `seed'
|
* So `par' now points to the parameters string, and `seed'
|
||||||
* to the seed string.
|
* to the seed string.
|
||||||
*/
|
*/
|
||||||
*seed++ = '\0';
|
par = snewn(seed-id + 1, char);
|
||||||
par = id;
|
strncpy(par, id, seed-id);
|
||||||
|
par[seed-id] = '\0';
|
||||||
|
seed++;
|
||||||
desc = NULL;
|
desc = NULL;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -1428,12 +1434,14 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
|
|||||||
*/
|
*/
|
||||||
if (defmode == DEF_SEED) {
|
if (defmode == DEF_SEED) {
|
||||||
seed = id;
|
seed = id;
|
||||||
par = desc = NULL;
|
par = NULL;
|
||||||
|
desc = NULL;
|
||||||
} else if (defmode == DEF_DESC) {
|
} else if (defmode == DEF_DESC) {
|
||||||
desc = id;
|
desc = id;
|
||||||
par = seed = NULL;
|
par = NULL;
|
||||||
|
seed = NULL;
|
||||||
} else {
|
} else {
|
||||||
par = id;
|
par = dupstr(id);
|
||||||
seed = desc = NULL;
|
seed = desc = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1563,10 +1571,12 @@ static const char *midend_game_id_int(midend *me, char *id, int defmode)
|
|||||||
me->genmode = GOT_SEED;
|
me->genmode = GOT_SEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sfree(par);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *midend_game_id(midend *me, char *id)
|
const char *midend_game_id(midend *me, const char *id)
|
||||||
{
|
{
|
||||||
return midend_game_id_int(me, id, DEF_PARAMS);
|
return midend_game_id_int(me, id, DEF_PARAMS);
|
||||||
}
|
}
|
||||||
@ -1721,7 +1731,7 @@ int midend_status(midend *me)
|
|||||||
return me->ourgame->status(me->states[me->statepos-1].state);
|
return me->ourgame->status(me->states[me->statepos-1].state);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *midend_rewrite_statusbar(midend *me, char *text)
|
char *midend_rewrite_statusbar(midend *me, const char *text)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* An important special case is that we are occasionally called
|
* An important special case is that we are occasionally called
|
||||||
|
2
misc.c
2
misc.c
@ -351,7 +351,7 @@ void pos2c(int w, int h, int pos, int *cx, int *cy)
|
|||||||
|
|
||||||
void draw_text_outline(drawing *dr, int x, int y, int fonttype,
|
void draw_text_outline(drawing *dr, int x, int y, int fonttype,
|
||||||
int fontsize, int align,
|
int fontsize, int align,
|
||||||
int text_colour, int outline_colour, char *text)
|
int text_colour, int outline_colour, const char *text)
|
||||||
{
|
{
|
||||||
if (outline_colour > -1) {
|
if (outline_colour > -1) {
|
||||||
draw_text(dr, x-1, y, fonttype, fontsize, align, outline_colour, text);
|
draw_text(dr, x-1, y, fonttype, fontsize, align, outline_colour, text);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
extern void _pause();
|
extern void _pause();
|
||||||
extern int _call_java(int cmd, int arg1, int arg2, int arg3);
|
extern int _call_java(int cmd, int arg1, int arg2, int arg3);
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
fprintf(stderr, "fatal error: ");
|
fprintf(stderr, "fatal error: ");
|
||||||
@ -53,7 +53,7 @@ void frontend_default_colour(frontend *fe, float *output)
|
|||||||
output[0] = output[1]= output[2] = 0.8f;
|
output[0] = output[1]= output[2] = 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nestedvm_status_bar(void *handle, char *text)
|
void nestedvm_status_bar(void *handle, const char *text)
|
||||||
{
|
{
|
||||||
_call_java(4,0,(int)text,0);
|
_call_java(4,0,(int)text,0);
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ void nestedvm_unclip(void *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nestedvm_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
|
void nestedvm_draw_text(void *handle, int x, int y, int fonttype, int fontsize,
|
||||||
int align, int colour, char *text)
|
int align, int colour, const char *text)
|
||||||
{
|
{
|
||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
_call_java(5, x + fe->ox, y + fe->oy,
|
_call_java(5, x + fe->ox, y + fe->oy,
|
||||||
|
11
nullfe.c
11
nullfe.c
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
void frontend_default_colour(frontend *fe, float *output) {}
|
void frontend_default_colour(frontend *fe, float *output) {}
|
||||||
void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
|
void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
|
||||||
int align, int colour, char *text) {}
|
int align, int colour, const char *text) {}
|
||||||
void draw_rect(drawing *dr, int x, int y, int w, int h, int colour) {}
|
void draw_rect(drawing *dr, int x, int y, int w, int h, int colour) {}
|
||||||
void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {}
|
void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {}
|
||||||
void draw_thick_line(drawing *dr, float thickness,
|
void draw_thick_line(drawing *dr, float thickness,
|
||||||
@ -41,15 +41,16 @@ int print_rgb_hatched_colour(drawing *dr, float r, float g, float b, int hatch)
|
|||||||
{ return 0; }
|
{ return 0; }
|
||||||
void print_line_width(drawing *dr, int width) {}
|
void print_line_width(drawing *dr, int width) {}
|
||||||
void print_line_dotted(drawing *dr, int dotted) {}
|
void print_line_dotted(drawing *dr, int dotted) {}
|
||||||
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc) {}
|
void midend_supersede_game_desc(midend *me, const char *desc,
|
||||||
void status_bar(drawing *dr, char *text) {}
|
const char *privdesc) {}
|
||||||
|
void status_bar(drawing *dr, const char *text) {}
|
||||||
struct preset_menu *preset_menu_new(void) {return NULL;}
|
struct preset_menu *preset_menu_new(void) {return NULL;}
|
||||||
struct preset_menu *preset_menu_add_submenu(struct preset_menu *parent,
|
struct preset_menu *preset_menu_add_submenu(struct preset_menu *parent,
|
||||||
char *title) {return NULL;}
|
char *title) {return NULL;}
|
||||||
void preset_menu_add_preset(struct preset_menu *parent,
|
void preset_menu_add_preset(struct preset_menu *parent,
|
||||||
char *title, game_params *params) {}
|
char *title, game_params *params) {}
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ void fatal(char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
void debug_printf(char *fmt, ...)
|
void debug_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
17
osx.m
17
osx.m
@ -111,7 +111,7 @@ NSApplication *app;
|
|||||||
* clearly defined subsystem.
|
* clearly defined subsystem.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char errorbuf[2048];
|
char errorbuf[2048];
|
||||||
@ -275,7 +275,7 @@ id initnewitem(NSMenuItem *item, NSMenu *parent, const char *title,
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMenuItem *newitem(NSMenu *parent, char *title, char *key,
|
NSMenuItem *newitem(NSMenu *parent, const char *title, const char *key,
|
||||||
id target, SEL action)
|
id target, SEL action)
|
||||||
{
|
{
|
||||||
return initnewitem([NSMenuItem allocWithZone:[NSMenu menuZone]],
|
return initnewitem([NSMenuItem allocWithZone:[NSMenu menuZone]],
|
||||||
@ -437,7 +437,7 @@ struct frontend {
|
|||||||
- (void)keyDown:(NSEvent *)ev;
|
- (void)keyDown:(NSEvent *)ev;
|
||||||
- (void)activateTimer;
|
- (void)activateTimer;
|
||||||
- (void)deactivateTimer;
|
- (void)deactivateTimer;
|
||||||
- (void)setStatusLine:(char *)text;
|
- (void)setStatusLine:(const char *)text;
|
||||||
- (void)resizeForNewGameParams;
|
- (void)resizeForNewGameParams;
|
||||||
- (void)updateTypeMenuTick;
|
- (void)updateTypeMenuTick;
|
||||||
@end
|
@end
|
||||||
@ -726,7 +726,7 @@ struct frontend {
|
|||||||
last_time = now;
|
last_time = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showError:(char *)message
|
- (void)showError:(const char *)message
|
||||||
{
|
{
|
||||||
NSAlert *alert;
|
NSAlert *alert;
|
||||||
|
|
||||||
@ -1300,7 +1300,7 @@ struct frontend {
|
|||||||
if (update) {
|
if (update) {
|
||||||
int k;
|
int k;
|
||||||
config_item *i;
|
config_item *i;
|
||||||
char *error;
|
const char *error;
|
||||||
|
|
||||||
k = 0;
|
k = 0;
|
||||||
for (i = cfg; i->type != C_END; i++) {
|
for (i = cfg; i->type != C_END; i++) {
|
||||||
@ -1348,7 +1348,7 @@ struct frontend {
|
|||||||
[self sheetEndWithStatus:NO];
|
[self sheetEndWithStatus:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setStatusLine:(char *)text
|
- (void)setStatusLine:(const char *)text
|
||||||
{
|
{
|
||||||
[[status cell] setTitle:[NSString stringWithUTF8String:text]];
|
[[status cell] setTitle:[NSString stringWithUTF8String:text]];
|
||||||
}
|
}
|
||||||
@ -1461,7 +1461,8 @@ static void osx_draw_rect(void *handle, int x, int y, int w, int h, int colour)
|
|||||||
NSRectFill(r);
|
NSRectFill(r);
|
||||||
}
|
}
|
||||||
static void osx_draw_text(void *handle, int x, int y, int fonttype,
|
static void osx_draw_text(void *handle, int x, int y, int fonttype,
|
||||||
int fontsize, int align, int colour, char *text)
|
int fontsize, int align, int colour,
|
||||||
|
const char *text)
|
||||||
{
|
{
|
||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
NSString *string = [NSString stringWithUTF8String:text];
|
NSString *string = [NSString stringWithUTF8String:text];
|
||||||
@ -1612,7 +1613,7 @@ static void osx_end_draw(void *handle)
|
|||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
[fe->image unlockFocus];
|
[fe->image unlockFocus];
|
||||||
}
|
}
|
||||||
static void osx_status_bar(void *handle, char *text)
|
static void osx_status_bar(void *handle, const char *text)
|
||||||
{
|
{
|
||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
[fe->window setStatusLine:text];
|
[fe->window setStatusLine:text];
|
||||||
|
3
ps.c
3
ps.c
@ -102,7 +102,8 @@ static void ps_stroke(psdata *ps, int colour)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ps_draw_text(void *handle, int x, int y, int fonttype,
|
static void ps_draw_text(void *handle, int x, int y, int fonttype,
|
||||||
int fontsize, int align, int colour, char *text)
|
int fontsize, int align, int colour,
|
||||||
|
const char *text)
|
||||||
{
|
{
|
||||||
psdata *ps = (psdata *)handle;
|
psdata *ps = (psdata *)handle;
|
||||||
|
|
||||||
|
21
puzzles.h
21
puzzles.h
@ -224,12 +224,12 @@ game_params *preset_menu_lookup_by_id(struct preset_menu *menu, int id);
|
|||||||
/* We can't use #ifdef DEBUG, because Cygwin defines it by default. */
|
/* We can't use #ifdef DEBUG, because Cygwin defines it by default. */
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
#define debug(x) (debug_printf x)
|
#define debug(x) (debug_printf x)
|
||||||
void debug_printf(char *fmt, ...);
|
void debug_printf(const char *fmt, ...);
|
||||||
#else
|
#else
|
||||||
#define debug(x)
|
#define debug(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void fatal(char *fmt, ...);
|
void fatal(const char *fmt, ...);
|
||||||
void frontend_default_colour(frontend *fe, float *output);
|
void frontend_default_colour(frontend *fe, float *output);
|
||||||
void deactivate_timer(frontend *fe);
|
void deactivate_timer(frontend *fe);
|
||||||
void activate_timer(frontend *fe);
|
void activate_timer(frontend *fe);
|
||||||
@ -241,7 +241,7 @@ void get_random_seed(void **randseed, int *randseedsize);
|
|||||||
drawing *drawing_new(const drawing_api *api, midend *me, void *handle);
|
drawing *drawing_new(const drawing_api *api, midend *me, void *handle);
|
||||||
void drawing_free(drawing *dr);
|
void drawing_free(drawing *dr);
|
||||||
void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
|
void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize,
|
||||||
int align, int colour, char *text);
|
int align, int colour, const char *text);
|
||||||
void draw_rect(drawing *dr, int x, int y, int w, int h, int colour);
|
void draw_rect(drawing *dr, int x, int y, int w, int h, int colour);
|
||||||
void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour);
|
void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour);
|
||||||
void draw_polygon(drawing *dr, int *coords, int npoints,
|
void draw_polygon(drawing *dr, int *coords, int npoints,
|
||||||
@ -256,7 +256,7 @@ void start_draw(drawing *dr);
|
|||||||
void draw_update(drawing *dr, int x, int y, int w, int h);
|
void draw_update(drawing *dr, int x, int y, int w, int h);
|
||||||
void end_draw(drawing *dr);
|
void end_draw(drawing *dr);
|
||||||
char *text_fallback(drawing *dr, const char *const *strings, int nstrings);
|
char *text_fallback(drawing *dr, const char *const *strings, int nstrings);
|
||||||
void status_bar(drawing *dr, char *text);
|
void status_bar(drawing *dr, const char *text);
|
||||||
blitter *blitter_new(drawing *dr, int w, int h);
|
blitter *blitter_new(drawing *dr, int w, int h);
|
||||||
void blitter_free(drawing *dr, blitter *bl);
|
void blitter_free(drawing *dr, blitter *bl);
|
||||||
/* save puts the portion of the current display with top-left corner
|
/* save puts the portion of the current display with top-left corner
|
||||||
@ -312,7 +312,7 @@ int midend_wants_statusbar(midend *me);
|
|||||||
enum { CFG_SETTINGS, CFG_SEED, CFG_DESC, CFG_FRONTEND_SPECIFIC };
|
enum { CFG_SETTINGS, CFG_SEED, CFG_DESC, CFG_FRONTEND_SPECIFIC };
|
||||||
config_item *midend_get_config(midend *me, int which, char **wintitle);
|
config_item *midend_get_config(midend *me, int which, char **wintitle);
|
||||||
const char *midend_set_config(midend *me, int which, config_item *cfg);
|
const char *midend_set_config(midend *me, int which, config_item *cfg);
|
||||||
const char *midend_game_id(midend *me, char *id);
|
const char *midend_game_id(midend *me, const char *id);
|
||||||
char *midend_get_game_id(midend *me);
|
char *midend_get_game_id(midend *me);
|
||||||
char *midend_get_random_seed(midend *me);
|
char *midend_get_random_seed(midend *me);
|
||||||
int midend_can_format_as_text_now(midend *me);
|
int midend_can_format_as_text_now(midend *me);
|
||||||
@ -321,8 +321,9 @@ const char *midend_solve(midend *me);
|
|||||||
int midend_status(midend *me);
|
int midend_status(midend *me);
|
||||||
int midend_can_undo(midend *me);
|
int midend_can_undo(midend *me);
|
||||||
int midend_can_redo(midend *me);
|
int midend_can_redo(midend *me);
|
||||||
void midend_supersede_game_desc(midend *me, char *desc, char *privdesc);
|
void midend_supersede_game_desc(midend *me, const char *desc,
|
||||||
char *midend_rewrite_statusbar(midend *me, char *text);
|
const char *privdesc);
|
||||||
|
char *midend_rewrite_statusbar(midend *me, const char *text);
|
||||||
void midend_serialise(midend *me,
|
void midend_serialise(midend *me,
|
||||||
void (*write)(void *ctx, void *buf, int len),
|
void (*write)(void *ctx, void *buf, int len),
|
||||||
void *wctx);
|
void *wctx);
|
||||||
@ -392,7 +393,7 @@ void pos2c(int w, int h, int pos, int *cx, int *cy);
|
|||||||
* by one pixel; useful for highlighting. Outline is omitted if -1. */
|
* by one pixel; useful for highlighting. Outline is omitted if -1. */
|
||||||
void draw_text_outline(drawing *dr, int x, int y, int fonttype,
|
void draw_text_outline(drawing *dr, int x, int y, int fonttype,
|
||||||
int fontsize, int align,
|
int fontsize, int align,
|
||||||
int text_colour, int outline_colour, char *text);
|
int text_colour, int outline_colour, const char *text);
|
||||||
|
|
||||||
/* Copies text left-justified with spaces. Length of string must be
|
/* Copies text left-justified with spaces. Length of string must be
|
||||||
* less than buffer size. */
|
* less than buffer size. */
|
||||||
@ -645,7 +646,7 @@ struct game {
|
|||||||
*/
|
*/
|
||||||
struct drawing_api {
|
struct drawing_api {
|
||||||
void (*draw_text)(void *handle, int x, int y, int fonttype, int fontsize,
|
void (*draw_text)(void *handle, int x, int y, int fonttype, int fontsize,
|
||||||
int align, int colour, char *text);
|
int align, int colour, const char *text);
|
||||||
void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour);
|
void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour);
|
||||||
void (*draw_line)(void *handle, int x1, int y1, int x2, int y2,
|
void (*draw_line)(void *handle, int x1, int y1, int x2, int y2,
|
||||||
int colour);
|
int colour);
|
||||||
@ -658,7 +659,7 @@ struct drawing_api {
|
|||||||
void (*unclip)(void *handle);
|
void (*unclip)(void *handle);
|
||||||
void (*start_draw)(void *handle);
|
void (*start_draw)(void *handle);
|
||||||
void (*end_draw)(void *handle);
|
void (*end_draw)(void *handle);
|
||||||
void (*status_bar)(void *handle, char *text);
|
void (*status_bar)(void *handle, const char *text);
|
||||||
blitter *(*blitter_new)(void *handle, int w, int h);
|
blitter *(*blitter_new)(void *handle, int w, int h);
|
||||||
void (*blitter_free)(void *handle, blitter *bl);
|
void (*blitter_free)(void *handle, blitter *bl);
|
||||||
void (*blitter_save)(void *handle, blitter *bl, int x, int y);
|
void (*blitter_save)(void *handle, blitter *bl, int x, int y);
|
||||||
|
@ -2039,7 +2039,7 @@ const char *quis = NULL;
|
|||||||
|
|
||||||
#if 0 /* currently unused */
|
#if 0 /* currently unused */
|
||||||
|
|
||||||
static void debug_printf(char *fmt, ...)
|
static void debug_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -770,7 +770,7 @@ int main(void)
|
|||||||
#ifdef TEST_GENERAL
|
#ifdef TEST_GENERAL
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
|
|||||||
*/
|
*/
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
{
|
{
|
||||||
char *sep;
|
const char *sep;
|
||||||
char buf[80];
|
char buf[80];
|
||||||
int retlen;
|
int retlen;
|
||||||
edge *ea;
|
edge *ea;
|
||||||
|
@ -150,7 +150,7 @@ void dputs(char *buf)
|
|||||||
OutputDebugString(buf);
|
OutputDebugString(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_printf(char *fmt, ...)
|
void debug_printf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -258,7 +258,7 @@ void frontend_free(frontend *fe)
|
|||||||
static void update_type_menu_tick(frontend *fe);
|
static void update_type_menu_tick(frontend *fe);
|
||||||
static void update_copy_menu_greying(frontend *fe);
|
static void update_copy_menu_greying(frontend *fe);
|
||||||
|
|
||||||
void fatal(char *fmt, ...)
|
void fatal(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -304,7 +304,7 @@ void get_random_seed(void **randseed, int *randseedsize)
|
|||||||
*randseedsize = sizeof(SYSTEMTIME);
|
*randseedsize = sizeof(SYSTEMTIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void win_status_bar(void *handle, char *text)
|
static void win_status_bar(void *handle, const char *text)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
TCHAR wText[255];
|
TCHAR wText[255];
|
||||||
@ -556,7 +556,8 @@ static void win_unclip(void *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void win_draw_text(void *handle, int x, int y, int fonttype,
|
static void win_draw_text(void *handle, int x, int y, int fonttype,
|
||||||
int fontsize, int align, int colour, char *text)
|
int fontsize, int align, int colour,
|
||||||
|
const char *text)
|
||||||
{
|
{
|
||||||
frontend *fe = (frontend *)handle;
|
frontend *fe = (frontend *)handle;
|
||||||
POINT xy;
|
POINT xy;
|
||||||
|
Reference in New Issue
Block a user