summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/devel.but
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/devel.but')
-rw-r--r--apps/plugins/puzzles/src/devel.but126
1 files changed, 76 insertions, 50 deletions
diff --git a/apps/plugins/puzzles/src/devel.but b/apps/plugins/puzzles/src/devel.but
index 25a6c62dfa..131678c17b 100644
--- a/apps/plugins/puzzles/src/devel.but
+++ b/apps/plugins/puzzles/src/devel.but
@@ -555,16 +555,15 @@ The \cw{config_item} structure contains the following elements:
555 555
556\c char *name; 556\c char *name;
557\c int type; 557\c int type;
558\c char *sval; 558\c union { /* type-specific fields */ } u;
559\c int ival; 559\e iiiiiiiiiiiiiiiiiiiiiiiiii
560 560
561\c{name} is an ASCII string giving the textual label for a GUI 561\c{name} is an ASCII string giving the textual label for a GUI
562control. It is \e{not} expected to be dynamically allocated. 562control. It is \e{not} expected to be dynamically allocated.
563 563
564\c{type} contains one of a small number of \c{enum} values defining 564\c{type} contains one of a small number of \c{enum} values defining
565what type of control is being described. The meaning of the \c{sval} 565what type of control is being described. The usable member of the
566and \c{ival} fields depends on the value in \c{type}. The valid 566union field \c{u} depends on \c{type}. The valid type values are:
567values are:
568 567
569\dt \c{C_STRING} 568\dt \c{C_STRING}
570 569
@@ -572,38 +571,64 @@ values are:
572input. The back end does not bother informing the front end that the 571input. The back end does not bother informing the front end that the
573box is numeric rather than textual; some front ends do have the 572box is numeric rather than textual; some front ends do have the
574capacity to take this into account, but I decided it wasn't worth 573capacity to take this into account, but I decided it wasn't worth
575the extra complexity in the interface.) For this type, \c{ival} is 574the extra complexity in the interface.)
576unused, and \c{sval} contains a dynamically allocated string 575
577representing the contents of the input box. 576\lcont{
577
578For controls of this type, \c{u.string} contains a single field
579
580\c char *sval;
581
582which stores a dynamically allocated string representing the contents
583of the input box.
584
585}
578 586
579\dt \c{C_BOOLEAN} 587\dt \c{C_BOOLEAN}
580 588
581\dd Describes a simple checkbox. For this type, \c{sval} is unused, 589\dd Describes a simple checkbox.
582and \c{ival} is \cw{TRUE} or \cw{FALSE}. 590
591\lcont{
592
593For controls of this type, \c{u.boolean} contains a single field
594
595\c int bval;
596
597which is either \cw{TRUE} or \cw{FALSE}.
598
599}
583 600
584\dt \c{C_CHOICES} 601\dt \c{C_CHOICES}
585 602
586\dd Describes a drop-down list presenting one of a small number of 603\dd Describes a drop-down list presenting one of a small number of
587fixed choices. For this type, \c{sval} contains a list of strings 604fixed choices.
588describing the choices; the very first character of \c{sval} is used
589as a delimiter when processing the rest (so that the strings
590\cq{:zero:one:two}, \cq{!zero!one!two} and \cq{xzeroxonextwo} all
591define a three-element list containing \cq{zero}, \cq{one} and
592\cq{two}). \c{ival} contains the index of the currently selected
593element, numbering from zero (so that in the above example, 0 would
594mean \cq{zero} and 2 would mean \cq{two}).
595 605
596\lcont{ 606\lcont{
597 607
598Note that for this control type, \c{sval} is \e{not} dynamically 608For controls of this type, \c{u.choices} contains two fields:
599allocated, whereas it was for \c{C_STRING}. 609
610\c const char *choicenames;
611\c int selected;
612
613\c{choicenames} contains a list of strings describing the choices. The
614very first character of \c{sval} is used as a delimiter when
615processing the rest (so that the strings \cq{:zero:one:two},
616\cq{!zero!one!two} and \cq{xzeroxonextwo} all define a three-element
617list containing \cq{zero}, \cq{one} and \cq{two}).
618
619\c{selected} contains the index of the currently selected element,
620numbering from zero (so that in the above example, 0 would mean
621\cq{zero} and 2 would mean \cq{two}).
622
623Note that \c{u.choices.choicenames} is \e{not} dynamically allocated,
624unlike \c{u.string.sval}.
600 625
601} 626}
602 627
603\dt \c{C_END} 628\dt \c{C_END}
604 629
605\dd Marks the end of the array of \c{config_item}s. All other fields 630\dd Marks the end of the array of \c{config_item}s. There is no
606are unused. 631associated member of the union field \c{u} for this type.
607 632
608The array returned from this function is expected to have filled in 633The array returned from this function is expected to have filled in
609the initial values of all the controls according to the input 634the initial values of all the controls according to the input
@@ -639,7 +664,8 @@ function is never called and need not do anything at all.
639 664
640\S{backend-validate-params} \cw{validate_params()} 665\S{backend-validate-params} \cw{validate_params()}
641 666
642\c char *(*validate_params)(const game_params *params, int full); 667\c const char *(*validate_params)(const game_params *params,
668\c int full);
643 669
644This function takes a \c{game_params} structure as input, and checks 670This function takes a \c{game_params} structure as input, and checks
645that the parameters described in it fall within sensible limits. (At 671that the parameters described in it fall within sensible limits. (At
@@ -724,7 +750,8 @@ again in the game description.
724 750
725\S{backend-validate-desc} \cw{validate_desc()} 751\S{backend-validate-desc} \cw{validate_desc()}
726 752
727\c char *(*validate_desc)(const game_params *params, const char *desc); 753\c const char *(*validate_desc)(const game_params *params,
754\c const char *desc);
728 755
729This function is given a game description, and its job is to 756This function is given a game description, and its job is to
730validate that it describes a puzzle which makes sense. 757validate that it describes a puzzle which makes sense.
@@ -907,10 +934,10 @@ divide mouse coordinates by it.)
907in response to the input event; the puzzle was not interested in it 934in response to the input event; the puzzle was not interested in it
908at all. 935at all.
909 936
910\b Returning the empty string (\cw{""}) indicates that the input 937\b Returning the special value \cw{UI_UPDATE} indicates that the input
911event has resulted in a change being made to the \c{game_ui} which 938event has resulted in a change being made to the \c{game_ui} which
912will require a redraw of the game window, but that no actual 939will require a redraw of the game window, but that no actual \e{move}
913\e{move} was made (i.e. no new \c{game_state} needs to be created). 940was made (i.e. no new \c{game_state} needs to be created).
914 941
915\b Returning anything else indicates that a move was made and that a 942\b Returning anything else indicates that a move was made and that a
916new \c{game_state} must be created. However, instead of actually 943new \c{game_state} must be created. However, instead of actually
@@ -925,7 +952,7 @@ strings can be written to disk when saving the game and fed to
925 952
926The return value from \cw{interpret_move()} is expected to be 953The return value from \cw{interpret_move()} is expected to be
927dynamically allocated if and only if it is not either \cw{NULL} 954dynamically allocated if and only if it is not either \cw{NULL}
928\e{or} the empty string. 955\e{or} the special string constant \c{UI_UPDATE}.
929 956
930After this function is called, the back end is permitted to rely on 957After this function is called, the back end is permitted to rely on
931some subsequent operations happening in sequence: 958some subsequent operations happening in sequence:
@@ -1028,7 +1055,7 @@ not even offer the \q{Solve} menu option.
1028\S{backend-solve} \cw{solve()} 1055\S{backend-solve} \cw{solve()}
1029 1056
1030\c char *(*solve)(const game_state *orig, const game_state *curr, 1057\c char *(*solve)(const game_state *orig, const game_state *curr,
1031\c const char *aux, char **error); 1058\c const char *aux, const char **error);
1032 1059
1033This function is called when the user selects the \q{Solve} option 1060This function is called when the user selects the \q{Solve} option
1034from the menu. 1061from the menu.
@@ -1934,7 +1961,8 @@ This ensures that thin lines are visible even at small scales.
1934\S{drawing-draw-text} \cw{draw_text()} 1961\S{drawing-draw-text} \cw{draw_text()}
1935 1962
1936\c void draw_text(drawing *dr, int x, int y, int fonttype, 1963\c void draw_text(drawing *dr, int x, int y, int fonttype,
1937\c int fontsize, int align, int colour, char *text); 1964\c int fontsize, int align, int colour,
1965\c const char *text);
1938 1966
1939Draws text in the puzzle window. 1967Draws text in the puzzle window.
1940 1968
@@ -2095,7 +2123,7 @@ printing routines, that code may safely call \cw{draw_update()}.)
2095 2123
2096\S{drawing-status-bar} \cw{status_bar()} 2124\S{drawing-status-bar} \cw{status_bar()}
2097 2125
2098\c void status_bar(drawing *dr, char *text); 2126\c void status_bar(drawing *dr, const char *text);
2099 2127
2100Sets the text in the game's status bar to \c{text}. The text is copied 2128Sets the text in the game's status bar to \c{text}. The text is copied
2101from the supplied buffer, so the caller is free to deallocate or 2129from the supplied buffer, so the caller is free to deallocate or
@@ -2366,7 +2394,8 @@ function \cw{drawing_new()} (see \k{drawing-new}).
2366\S{drawingapi-draw-text} \cw{draw_text()} 2394\S{drawingapi-draw-text} \cw{draw_text()}
2367 2395
2368\c void (*draw_text)(void *handle, int x, int y, int fonttype, 2396\c void (*draw_text)(void *handle, int x, int y, int fonttype,
2369\c int fontsize, int align, int colour, char *text); 2397\c int fontsize, int align, int colour,
2398\c const char *text);
2370 2399
2371This function behaves exactly like the back end \cw{draw_text()} 2400This function behaves exactly like the back end \cw{draw_text()}
2372function; see \k{drawing-draw-text}. 2401function; see \k{drawing-draw-text}.
@@ -2469,7 +2498,7 @@ called unless drawing is attempted.
2469 2498
2470\S{drawingapi-status-bar} \cw{status_bar()} 2499\S{drawingapi-status-bar} \cw{status_bar()}
2471 2500
2472\c void (*status_bar)(void *handle, char *text); 2501\c void (*status_bar)(void *handle, const char *text);
2473 2502
2474This function behaves exactly like the back end \cw{status_bar()} 2503This function behaves exactly like the back end \cw{status_bar()}
2475function; see \k{drawing-status-bar}. 2504function; see \k{drawing-status-bar}.
@@ -3129,8 +3158,8 @@ will probably need to pass it to \cw{midend_set_config}.)
3129 3158
3130\H{midend-set-config} \cw{midend_set_config()} 3159\H{midend-set-config} \cw{midend_set_config()}
3131 3160
3132\c char *midend_set_config(midend *me, int which, 3161\c const char *midend_set_config(midend *me, int which,
3133\c config_item *cfg); 3162\c config_item *cfg);
3134 3163
3135Passes the mid-end the results of a configuration dialog box. 3164Passes the mid-end the results of a configuration dialog box.
3136\c{which} should have the same value which it had when 3165\c{which} should have the same value which it had when
@@ -3151,7 +3180,7 @@ using \cw{midend_size()} and eventually perform a refresh using
3151 3180
3152\H{midend-game-id} \cw{midend_game_id()} 3181\H{midend-game-id} \cw{midend_game_id()}
3153 3182
3154\c char *midend_game_id(midend *me, char *id); 3183\c const char *midend_game_id(midend *me, const char *id);
3155 3184
3156Passes the mid-end a string game ID (of any of the valid forms 3185Passes the mid-end a string game ID (of any of the valid forms
3157\cq{params}, \cq{params:description} or \cq{params#seed}) which the 3186\cq{params}, \cq{params:description} or \cq{params#seed}) which the
@@ -3219,7 +3248,7 @@ conversion.
3219 3248
3220\H{midend-solve} \cw{midend_solve()} 3249\H{midend-solve} \cw{midend_solve()}
3221 3250
3222\c char *midend_solve(midend *me); 3251\c const char *midend_solve(midend *me);
3223 3252
3224Requests the mid-end to perform a Solve operation. 3253Requests the mid-end to perform a Solve operation.
3225 3254
@@ -3267,8 +3296,7 @@ visually activate and deactivate a redo button.
3267\H{midend-serialise} \cw{midend_serialise()} 3296\H{midend-serialise} \cw{midend_serialise()}
3268 3297
3269\c void midend_serialise(midend *me, 3298\c void midend_serialise(midend *me,
3270\c void (*write)(void *ctx, void *buf, int len), 3299\c void (*write)(void *ctx, const void *buf, int len), void *wctx);
3271\c void *wctx);
3272 3300
3273Calling this function causes the mid-end to convert its entire 3301Calling this function causes the mid-end to convert its entire
3274internal state into a long ASCII text string, and to pass that 3302internal state into a long ASCII text string, and to pass that
@@ -3291,9 +3319,8 @@ output string.
3291 3319
3292\H{midend-deserialise} \cw{midend_deserialise()} 3320\H{midend-deserialise} \cw{midend_deserialise()}
3293 3321
3294\c char *midend_deserialise(midend *me, 3322\c const char *midend_deserialise(midend *me,
3295\c int (*read)(void *ctx, void *buf, int len), 3323\c int (*read)(void *ctx, void *buf, int len), void *rctx);
3296\c void *rctx);
3297 3324
3298This function is the counterpart to \cw{midend_serialise()}. It 3325This function is the counterpart to \cw{midend_serialise()}. It
3299calls the supplied \cw{read} function repeatedly to read a quantity 3326calls the supplied \cw{read} function repeatedly to read a quantity
@@ -3330,9 +3357,8 @@ place.
3330 3357
3331\H{identify-game} \cw{identify_game()} 3358\H{identify-game} \cw{identify_game()}
3332 3359
3333\c char *identify_game(char **name, 3360\c const char *identify_game(char **name,
3334\c int (*read)(void *ctx, void *buf, int len), 3361\c int (*read)(void *ctx, void *buf, int len), void *rctx);
3335\c void *rctx);
3336 3362
3337This function examines a serialised midend stream, of the same kind 3363This function examines a serialised midend stream, of the same kind
3338used by \cw{midend_serialise()} and \cw{midend_deserialise()}, and 3364used by \cw{midend_serialise()} and \cw{midend_deserialise()}, and
@@ -3482,7 +3508,7 @@ calling \cw{midend_timer()}.
3482 3508
3483\H{frontend-fatal} \cw{fatal()} 3509\H{frontend-fatal} \cw{fatal()}
3484 3510
3485\c void fatal(char *fmt, ...); 3511\c void fatal(const char *fmt, ...);
3486 3512
3487This is called by some utility functions if they encounter a 3513This is called by some utility functions if they encounter a
3488genuinely fatal error such as running out of memory. It is a 3514genuinely fatal error such as running out of memory. It is a
@@ -3737,10 +3763,10 @@ quite everywhere.)
3737 3763
3738\c void free_cfg(config_item *cfg); 3764\c void free_cfg(config_item *cfg);
3739 3765
3740This function correctly frees an array of \c{config_item}s, 3766This function correctly frees an array of \c{config_item}s, including
3741including walking the array until it gets to the end and freeing 3767walking the array until it gets to the end and freeing any subsidiary
3742precisely those \c{sval} fields which are expected to be dynamically 3768data items in each \c{u} sub-union which are expected to be
3743allocated. 3769dynamically allocated.
3744 3770
3745(See \k{backend-configure} for details of the \c{config_item} 3771(See \k{backend-configure} for details of the \c{config_item}
3746structure.) 3772structure.)