|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include "blitzlib.h"#include "blitzobj.h"#include <stddef.h>#include <intuition/intuition.h>#include <proto/intuition.h>Data Structures | |
| struct | item |
| struct | textsize |
Macros | |
| #define | __NOLIBBASE__ |
| #define | INTUITION_BASE_NAME intbase |
| #define | MENUSIZE sizeof(struct Menu) |
| #define | ITEMSIZE sizeof(struct item) |
| #define | M_LEFT offsetof(struct Menu, LeftEdge) |
| #define | M_WIDTH offsetof(struct Menu, Width) /* also MenuItem */ |
| #define | M_FLAGS offsetof(struct Menu, Flags) /* also MenuItem */ |
| #define | M_FIRST offsetof(struct Menu, FirstItem) |
| #define | I_TOP offsetof(struct MenuItem, TopEdge) |
| #define | I_SUB offsetof(struct MenuItem, SubItem) |
| #define | FLAGS_HI M_FLAGS /* the bytes of Flags: CHECKED */ |
| #define | FLAGS_LO (M_FLAGS + 1) /* ITEMTEXT, ITEMENABLED, MENUENABLED */ |
| #define | W(p, o) |
| #define | UW(p, o) |
| #define | L(p, o) |
| #define | B(p, o) |
| #define | P(p, o) |
| #define | fontattr dumintuitext.ITextFont |
Functions | |
| void | doshapeitem (void) |
| void | doshapesub (void) |
| void | domenugap (void) |
| void | dosubitemoff (void) |
| void | menuslib_domenustate (void) |
| void | menuslib_domenustate2 (void) |
| void | menuslib_domenustate3 (void) |
| void | menuslib_domenustate4 (void) |
| void | domenupens (void) |
| void | menuslib_domenuchecked (void) |
| void | menuslib_domenuchecked2 (void) |
| void | menutitlechk (void) |
| void | setmenuchk (void) |
| void | itemchk2 (void) |
| void | subchk2 (void) |
| void | shapeitemchk (void) |
| void | shapesubchk (void) |
| void | menuslib_statechk2 (void) |
| void | menuslib_statechk3 (void) |
| void | menuslib_statechk4 (void) |
| void | menuslib_chkchk3 (void) |
| void | menuslib_chkchk4 (void) |
| void | dosetmenu (struct Window **win, struct Library *intbase) |
| SetMenu Menulist# - attach the menu list to the used window (Amiga mode only). | |
| void | domenutitle (WORD m, const UBYTE *text, const ULONG *lens) |
| MenuTitle MenuList#,Menu,Title$ - create or replace a menu. | |
| void | domenuitem (WORD m, WORD i, const UBYTE *text, struct TextAttr **font, const ULONG *lens, struct Library *intbase) |
| MenuItem MenuList#,Flags,Menu,Item,Itemtext$ - create or replace a text item. | |
| void | domenuitem2 (WORD m, WORD i, const UBYTE *text, const UBYTE *key, struct TextAttr **font, const ULONG *lens, struct Library *intbase) |
| MenuItem MenuList#,Flags,Menu,Item,Itemtext$,Shortcut$ - a text item with a keyboard shortcut. | |
| void | dosubitem (WORD m, WORD i, WORD s, const UBYTE *text, struct TextAttr **font, const ULONG *lens, struct Library *intbase) |
| SubItem MenuList#,Flags,Menu,Item,Subitem,Subitemtext$ - create or replace a text subitem. | |
| void | dosubitem2 (WORD m, WORD i, WORD s, const UBYTE *text, const UBYTE *key, struct TextAttr **font, const ULONG *lens, struct Library *intbase) |
| SubItem MenuList#,Flags,Menu,Item,Subitem,Subitemtext$,Shortcut$ - a text subitem with a keyboard shortcut. | |
| static void | freemenu (void) |
| _free of the MenuList object (Free MenuList, program end) - free every menu, item and subitem with their texts. | |
| static UBYTE * | allocst (const UBYTE *s, ULONG len) |
| static void | freest (ULONG s) |
| static UBYTE * | globalloc (ULONG size) |
| static void | globfree (void *mem, ULONG size) |
| static void | domenupens_c (UBYTE c) |
| MenuColour Colour - the front pen of the texts of items and subitems created from now on. | |
| BLITZ_ALIAS (domenupens, domenupens_c) | |
| static void | changestate (UBYTE *p, UWORD on, int bit) |
| static UBYTE * | walk (UBYTE *p, UWORD n) |
| static void | domenustate_c (UWORD on) |
| MenuState MenuList#,On|Off - enable or disable every menu of the list. | |
| static void | domenustate2_c (UWORD m, UWORD on) |
| MenuState MenuList#,Menu,On|Off - enable or disable a menu. | |
| static void | domenustate3_c (UWORD m, UWORD i, UWORD on) |
| MenuState MenuList#,Menu,Item,On|Off - enable or disable an item. | |
| static void | domenustate4_c (UWORD m, UWORD i, UWORD s, UWORD on) |
| MenuState MenuList#,Menu,Item,Subitem,On|Off - enable or disable a subitem. | |
| BLITZ_ALIAS (menuslib_domenustate, domenustate_c) | |
| BLITZ_ALIAS (menuslib_domenustate2, domenustate2_c) | |
| BLITZ_ALIAS (menuslib_domenustate3, domenustate3_c) | |
| BLITZ_ALIAS (menuslib_domenustate4, domenustate4_c) | |
| static ULONG | checked (ULONG hiword, const UBYTE *p) |
| static ULONG | domenuchecked_c (ULONG hiword, UBYTE *p, UWORD m, UWORD i) |
| MenuChecked(MenuList#,Menu,Item) - whether a toggle item is checked. | |
| BLITZ_ALIAS (menuslib_domenuchecked, domenuchecked_c) | |
| static ULONG | domenuchecked2_c (ULONG hiword, UBYTE *p, UWORD m, UWORD i, UWORD s) |
| MenuChecked(MenuList#,Menu,Item,Subitem) - whether a toggle subitem is checked. | |
| BLITZ_ALIAS (menuslib_domenuchecked2, domenuchecked2_c) | |
| static void | sussflags (ULONG flags, UWORD item) |
| static void | domenugap_c (WORD x, WORD y) |
| MenuGap X Gap,Y Gap - the space around the text or shape of items and subitems created from now on. | |
| BLITZ_ALIAS (domenugap, domenugap_c) | |
| static void | dosubitemoff_c (WORD x, WORD y) |
| SubItemOff X Offset,Y Offset - the offset of subitems created from now on, added to their position. | |
| BLITZ_ALIAS (dosubitemoff, dosubitemoff_c) | |
| static void | setmax (UBYTE *head) |
| static UBYTE * | getthing (UBYTE *p, WORD n) |
| static UBYTE * | findthing (UBYTE *link, WORD n, ULONG memlen, int pos, WORD size, int sub) |
| static struct item * | finditem (UBYTE *head, WORD n, WORD width, WORD height, WORD size) |
| static void | fontcalc (struct TextAttr **font) |
| static struct textsize | textcalc (const ULONG **sp, const UBYTE *s, UWORD item, struct Library *intbase) |
| static struct item * | menucont (UBYTE *head, WORD n, struct textsize extent, WORD size) |
| static void | menuitem (WORD m, WORD i, const UBYTE *text, struct TextAttr **font, const ULONG *lens, struct Library *intbase) |
| static void | subcont (struct item *e) |
| static void | subitem (WORD m, WORD i, WORD s, const UBYTE *text, struct TextAttr **font, const ULONG *lens, struct Library *intbase) |
| static struct textsize | shapecalc (ULONG flags, UWORD item, const struct bb_shape *shape) |
| static struct item * | shapecont (UBYTE *head, WORD n, struct textsize extent, const struct bb_shape *shape) |
| static void | doshapeitem_c (WORD m, WORD i, const struct bb_shape *shape, ULONG flags) |
| ShapeItem MenuList#,Flags,Menu,Item,Shape# - create or replace an item showing a shape. | |
| static void | doshapesub_c (WORD m, WORD i, WORD s, const struct bb_shape *shape, ULONG flags) |
| ShapeSub MenuList#,Flags,Menu,Item,Subitem,Shape# - create or replace a subitem showing a shape. | |
| static void | freeitem (struct MenuItem *e) |
| static int | existschk (UBYTE **entry, UWORD n) |
| static int | nextchk (UBYTE **entry, UWORD n) |
| static void | setmenuchk_c (const ULONG *win) |
| static void | menutitlechk_c (UWORD m) |
| static void | itemchk (UBYTE *list, UWORD m, UWORD i) |
| static void | subchk (UBYTE *list, UWORD m, UWORD i, UWORD s) |
| static void | itemchk2_c (UWORD m, UWORD i, const struct bb_intuifont *font) |
| static void | shapeitemchk_c (UWORD m, UWORD i, const struct bb_shape *shape) |
| static void | subchk2_c (UWORD m, UWORD i, UWORD s, const struct bb_intuifont *font) |
| static void | shapesubchk_c (UWORD m, UWORD i, UWORD s, const struct bb_shape *shape) |
| static int | statechk (UBYTE *list, int depth, UWORD m, UWORD i, UWORD s) |
| static void | statechk2_c (UWORD m) |
| static void | statechk3_c (UWORD m, UWORD i) |
| static void | statechk4_c (UWORD m, UWORD i, UWORD s) |
| static void | chkchk3_c (UBYTE *list, UWORD m, UWORD i) |
| static void | chkchk4_c (UBYTE *list, UWORD m, UWORD i, UWORD s) |
Variables | |
| static UBYTE | menupens [2] = { 1, 2 } |
| static UBYTE | menumode |
| static UWORD | dmenflags = 0x10 + 2 + 0x40 |
| static UWORD | menflags |
| static WORD | subxoff = 48 |
| static WORD | subyoff = 4 |
| static WORD | menuxxs = 4 |
| static WORD | menuyxs = 2 |
| static WORD | fonthite = 8 |
| static UBYTE | shortcut |
| static ULONG | mexclude |
| static struct IntuiText | dumintuitext |
| #define __NOLIBBASE__ |
| #define B | ( | p, | |
| o ) |
| #define FLAGS_LO (M_FLAGS + 1) /* ITEMTEXT, ITEMENABLED, MENUENABLED */ |
| #define fontattr dumintuitext.ITextFont |
| #define I_SUB offsetof(struct MenuItem, SubItem) |
| #define I_TOP offsetof(struct MenuItem, TopEdge) |
| #define INTUITION_BASE_NAME intbase |
| #define ITEMSIZE sizeof(struct item) |
| #define L | ( | p, | |
| o ) |
| #define M_FIRST offsetof(struct Menu, FirstItem) |
| #define M_FLAGS offsetof(struct Menu, Flags) /* also MenuItem */ |
| #define M_LEFT offsetof(struct Menu, LeftEdge) |
| #define M_WIDTH offsetof(struct Menu, Width) /* also MenuItem */ |
| #define MENUSIZE sizeof(struct Menu) |
| #define P | ( | p, | |
| o ) |
| #define UW | ( | p, | |
| o ) |
| #define W | ( | p, | |
| o ) |
|
static |
| BLITZ_ALIAS | ( | domenugap | , |
| domenugap_c | ) |
| BLITZ_ALIAS | ( | domenupens | , |
| domenupens_c | ) |
| BLITZ_ALIAS | ( | dosubitemoff | , |
| dosubitemoff_c | ) |
| BLITZ_ALIAS | ( | menuslib_domenuchecked | , |
| domenuchecked_c | ) |
| BLITZ_ALIAS | ( | menuslib_domenuchecked2 | , |
| domenuchecked2_c | ) |
| BLITZ_ALIAS | ( | menuslib_domenustate | , |
| domenustate_c | ) |
| BLITZ_ALIAS | ( | menuslib_domenustate2 | , |
| domenustate2_c | ) |
| BLITZ_ALIAS | ( | menuslib_domenustate3 | , |
| domenustate3_c | ) |
| BLITZ_ALIAS | ( | menuslib_domenustate4 | , |
| domenustate4_c | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
MenuChecked(MenuList#,Menu,Item,Subitem) - whether a toggle subitem is checked.
Walks to the subitem as domenustate4 does. Fixed (#217): in the original both inner DBF jumped to the menu loop: only (menu,item,sub) = (m,0,0) ended where it should, other values walked the lists again with a counter of -1 (65536 steps).
Errors (debugger only, chkchk4): "Illegal Menu number", "Illegal Menu Item number", "Illegal Menu Sub Item number".
| hiword | d0: the caller's d0 (its upper word stays). |
| p | a2: the list. |
| m | d1: the menu number. |
| i | d2: the item number. |
| s | d3: the subitem number. |
|
static |
MenuChecked(MenuList#,Menu,Item) - whether a toggle item is checked.
checked: BTST #0,12(a2):SNE d0:EXT d0 (CHECKED). Not a bug (word result, the compiler uses only d0.w): the upper word of d0 stays.
Errors (debugger only, chkchk3): "Illegal Menu number", "Illegal Menu Item number".
| hiword | d0: the caller's d0 (its upper word stays). |
| p | a2: the list. |
| m | d1: the menu number. |
| i | d2: the item number. |
| void domenugap | ( | void | ) |
|
static |
| void domenuitem | ( | WORD | m, |
| WORD | i, | ||
| const UBYTE * | text, | ||
| struct TextAttr ** | font, | ||
| const ULONG * | lens, | ||
| struct Library * | intbase ) |
MenuItem MenuList#,Flags,Menu,Item,Itemtext$ - create or replace a text item.
The text is copied (allocst); the item gets the size of the text in the current IntuiFont (IntuiTextLength) + 2 * MenuGap, the pens of MenuColour, and is placed below the items before it; a replaced item moves the following ones by the height difference. Flags: 0 = default ($52), 1 = toggle ($5B), 2 = toggle + exclude the others, 3 = checked toggle ($15B), 4 = 3 + exclude, >= 5 = the flags themselves. The list is in a3.
Fixed (#219): the original's flag test was a word compare after a long test: $10000 gave word 0 < 5 and ended in the "4" branch.
Errors (debugger only, itemchk2): "Uninitialized IntuiFont", "Illegal Menu number", "Illegal Menu Item number" (the item may be one behind the last). Without the debugger wrong numbers walk over the end of the lists (#416).
| m | d1: the menu number. |
| i | d2: the item number. |
| text | d3: the text's characters. |
| font | a1: intuifontlib's value, the used IntuiFont (*a1 = the TextAttr). |
| lens | a2: the stack pointer of the arguments: the pushed Flags long and the text length are read with -(a2). |
| intbase | a6: intuition.library. |
| void domenuitem2 | ( | WORD | m, |
| WORD | i, | ||
| const UBYTE * | text, | ||
| const UBYTE * | key, | ||
| struct TextAttr ** | font, | ||
| const ULONG * | lens, | ||
| struct Library * | intbase ) |
MenuItem MenuList#,Flags,Menu,Item,Itemtext$,Shortcut$ - a text item with a keyboard shortcut.
As MenuItem without a shortcut; the first character of Shortcut$ becomes the Command key. Not a bug (the intended result for a new entry): the shortcut sets the item's Flags to COMMSEQ in findthing, the item flags are ORed in afterwards.
| void domenupens | ( | void | ) |
|
static |
MenuColour Colour - the front pen of the texts of items and subitems created from now on.
MOVE.b d0,menufpen.
| c | d0: the pen. |
|
static |
MenuState MenuList#,Menu,On|Off - enable or disable a menu.
Sets or clears MENUENABLED. Fixed (#216): the original changed bit 4 of the Menu flags (changestate2, as for items): no effect.
Errors (debugger only, statechk2): "Illegal Menu number".
| m | d1: the menu number. |
| on | d2: On (<> 0) or Off (0). |
|
static |
MenuState MenuList#,Menu,Item,On|Off - enable or disable an item.
Sets or clears ITEMENABLED.
Errors (debugger only, statechk3): "Illegal Menu number", "Illegal Menu Item number". Without the debugger wrong numbers walk over the end of the lists (#416).
| m | d1: the menu number. |
| i | d2: the item number. |
| on | d3: On (<> 0) or Off (0). |
|
static |
MenuState MenuList#,Menu,Item,Subitem,On|Off - enable or disable a subitem.
Sets or clears ITEMENABLED.
Errors (debugger only, statechk4): "Illegal Menu number", "Illegal Menu Item number", "Illegal Menu Sub Item number".
| m | d1: the menu number. |
| i | d2: the item number. |
| s | d3: the subitem number. |
| on | d4: On (<> 0) or Off (0). |
|
static |
MenuState MenuList#,On|Off - enable or disable every menu of the list.
Sets or clears MENUENABLED of each menu; the list is in a3. The original changes d7, a3 and keeps d0-d1/a0-a1.
| on | d1: On (<> 0) or Off (0). |
| void domenutitle | ( | WORD | m, |
| const UBYTE * | text, | ||
| const ULONG * | lens ) |
MenuTitle MenuList#,Menu,Title$ - create or replace a menu.
The title is copied (maxslib allocst; fixed (#981): an empty title with length 1, the empty string, where the original stored MenuName 0 and Intuition read the title at address 0). Not a bug (a limitation acknowledged in the original source): width = 8 * length + 8 ("8 wide font, for now"); the menu is placed behind the ones before it (+2), a replaced menu moves the following ones by the width difference. The list is in a3.
Errors (debugger only, menutitlechk): "Illegal Menu number" (the menu may be one behind the last).
| m | d1: the menu number. |
| text | d2: the title's characters. |
| lens | a2: the stack pointer of the arguments; the title's length is the long at -4(a2) (MOVE.l -(a2),d1). |
| void dosetmenu | ( | struct Window ** | win, |
| struct Library * | intbase ) |
SetMenu Menulist# - attach the menu list to the used window (Amiga mode only).
All items of a list (and of every sublist) first get the width of the widest one; an old menu strip of the window is cleared. The list is in a3.
Errors (debugger only, setmenuchk): "Uninitialized Window", "Uninitialized Menu List".
| win | a2: the used window (object; !libs windowslib,$1202). |
| intbase | a6: intuition.library. |
| void doshapeitem | ( | void | ) |
|
static |
ShapeItem MenuList#,Flags,Menu,Item,Shape# - create or replace an item showing a shape.
The item is an Image of the shape (its planes, PlanePick/PlaneOnOff -1), size = shape size + 2 * MenuGap.
Flags as MenuItem (the item gets them without ITEMTEXT). Fixed (#218): the original took the high word of the pushed long (MOVE 4(a7),d7, read as a long behind the cleared low word of mexclude): small flag values gave the default flags. It also set the item Flags (MOVE) where menucont ORs them; the same for the new entry, ORed here as well.
Errors (debugger only, shapeitemchk): "Uninitialized Shape", "Illegal Menu number", "Illegal Menu Item number".
| m | d1: the menu number. |
| i | d2: the item number. |
| shape | a2: the shape (!libs shapeslib,$1283). |
| flags | d7: the Flags long (loaded by the thunk from 8(sp)). |
| void doshapesub | ( | void | ) |
|
static |
ShapeSub MenuList#,Flags,Menu,Item,Subitem,Shape# - create or replace a subitem showing a shape.
As ShapeItem, in the item's sublist, and moved by SubItemOff. Fixed (#218) as ShapeItem.
Errors (debugger only, shapesubchk): "Uninitialized Shape", "Illegal Menu number", "Illegal Menu Item number", "Illegal Menu Sub Item number".
| m | d1: the menu number. |
| i | d2: the item number. |
| s | d3: the subitem number. |
| shape | a2: the shape (!libs shapeslib,$1284). |
| flags | d7: the Flags long. |
| void dosubitem | ( | WORD | m, |
| WORD | i, | ||
| WORD | s, | ||
| const UBYTE * | text, | ||
| struct TextAttr ** | font, | ||
| const ULONG * | lens, | ||
| struct Library * | intbase ) |
SubItem MenuList#,Flags,Menu,Item,Subitem,Subitemtext$ - create or replace a text subitem.
As MenuItem, in the item's sublist, and moved by SubItemOff.
A replaced subitem moves the following ones by the height difference. Fixed (#220): the original moved them by (subitem number - old height) (d3 was the number again after textcalc). Fixed (#219) as MenuItem.
Errors (debugger only, subchk2): "Uninitialized IntuiFont", "Illegal Menu number", "Illegal Menu Item number", "Illegal Menu Sub Item number" (the subitem may be one behind the last).
| m | d1: the menu number. |
| i | d2: the item number. |
| s | d3: the subitem number. |
| text | d4: the text's characters. |
| font | a1: intuifontlib's value, the used IntuiFont. |
| lens | a2: the stack pointer of the arguments (Flags, text length). |
| intbase | a6: intuition.library. |
| void dosubitem2 | ( | WORD | m, |
| WORD | i, | ||
| WORD | s, | ||
| const UBYTE * | text, | ||
| const UBYTE * | key, | ||
| struct TextAttr ** | font, | ||
| const ULONG * | lens, | ||
| struct Library * | intbase ) |
SubItem MenuList#,Flags,Menu,Item,Subitem,Subitemtext$,Shortcut$ - a text subitem with a keyboard shortcut.
As SubItem without a shortcut, the shortcut as for MenuItem.
| void dosubitemoff | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
_free of the MenuList object (Free MenuList, program end) - free every menu, item and subitem with their texts.
The list is in a3; it is cleared first.
|
static |
|
static |
|
static |
|
static |
|
static |
| void itemchk2 | ( | void | ) |
|
static |
|
static |
| void menuslib_chkchk3 | ( | void | ) |
| void menuslib_chkchk4 | ( | void | ) |
| void menuslib_domenuchecked | ( | void | ) |
| void menuslib_domenuchecked2 | ( | void | ) |
| void menuslib_domenustate | ( | void | ) |
| void menuslib_domenustate2 | ( | void | ) |
| void menuslib_domenustate3 | ( | void | ) |
| void menuslib_domenustate4 | ( | void | ) |
| void menuslib_statechk2 | ( | void | ) |
| void menuslib_statechk3 | ( | void | ) |
| void menuslib_statechk4 | ( | void | ) |
| void menutitlechk | ( | void | ) |
|
static |
|
static |
|
static |
| void setmenuchk | ( | void | ) |
|
static |
|
static |
| void shapeitemchk | ( | void | ) |
|
static |
| void shapesubchk | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| void subchk2 | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |