|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include "blitzlib.h"#include "blitzobj.h"#include "blitzexec.h"#include <proto/datatypes.h>#include <proto/dos.h>#include <proto/intuition.h>#include <proto/graphics.h>#include <datatypes/datatypes.h>#include <datatypes/datatypesclass.h>#include <datatypes/pictureclass.h>#include <intuition/classes.h>#include <intuition/gadgetclass.h>#include <intuition/icclass.h>#include <graphics/displayinfo.h>Data Structures | |
| struct | pcolour |
| struct | pdata |
Macros | |
| #define | __NOLIBBASE__ |
| #define | DATATYPES_BASE_NAME database |
| #define | DOS_BASE_NAME dosbase |
| #define | INTUITION_BASE_NAME intuibase |
| #define | GRAPHICS_BASE_NAME gfxbase |
| #define | database libbases[0] |
| #define | dosbase libbases[1] |
| #define | intuibase libbases[2] |
| #define | gfxbase libbases[3] |
| #define | TAG(t, tag, data) |
| #define | PALDATA(o) |
Functions | |
| void | _datatypeopen (void) |
| void | _datatypeclose (void) |
| void | _datatypename (void) |
| void | _datatypebasename (void) |
| void | _datatypeid (void) |
| void | _datatypecreate2 (void) |
| void | _datatypecreate (void) |
| void | _attachdatatype (void) |
| void | _attachdatatype2 (void) |
| void | _attachdatatype3 (void) |
| void | _detachdatatype (void) |
| void | _datatypesuper (void) |
| void | _datatypebitmap (void) |
| void | _datatypespalette (void) |
| void | _datatypewidth (void) |
| void | _datatypeheight (void) |
| void | _datatypedepth (void) |
| void | _datatypeready (void) |
| void | _setdatatypeattr (void) |
| void | _setdatatypeattr2 (void) |
| void | _getdatatypeattr (void) |
| void | _getmodeid (void) |
| void | _getmodeid2 (void) |
| void | _datatypegroup (void) |
| void | ridatatypeslib_libinit (void) |
| void | ridatatypeslib_libfinit (void) |
| static void | c_libinit (void) |
| init: opens datatypes, dos, intuition and graphics.library (V37) and allocates the 1024 byte buffer (memlib globalloc, MEMF_CLEAR). | |
| void | c_detachdatatype (void) |
| DetachDataType: removes the object from the window it is attached to. | |
| static void | freename (void) |
| void | c_datatypeclose (void) |
| DataTypeClose: detaches the object, disposes of it, releases the DataType and unlocks the file. | |
| static void | c_libfinit (void) |
| finit: DetachDataType, DataTypeClose, closes the libraries and frees the buffer. | |
| static ULONG | putstring (const UBYTE *s) |
| static ULONG | putid (const UBYTE *s) |
| ULONG | c_datatypeopen (CONST_STRPTR name) |
| DataTypeOpen filename$: locks a file and obtains its DataType. | |
| ULONG | c_datatypename (void) |
| DataTypeName: the name of the file's DataType (dth_Name). | |
| ULONG | c_datatypebasename (void) |
| DataTypeBaseName: the base name of the file's DataType (dth_BaseName), written at a3 like DataTypeName. | |
| ULONG | c_datatypeid (void) |
| DataTypeID: the ID of the file's DataType (dth_ID), up to four characters (up to a 0) at a3. | |
| ULONG | c_datatypegroup (void) |
| DataTypeGroup: the group ID of the file's DataType (dth_GroupID), up to four characters at a3. | |
| static ULONG | create (struct TagItem *tags) |
| ULONG | c_datatypecreate2 (void) |
| DataTypeCreate: NewDTObject of the file's name without tags. | |
| ULONG | c_datatypecreate (struct TagItem *tags) |
| DataTypeCreate &taglist: NewDTObject of the file's name with a tag list. | |
| ULONG | c_datatypebitmap (void) |
| DataTypeBitmap: gets the object's BitMapHeader (PDTA_BitMapHeader) for DataTypeWidth/Height/Depth/ModeID and AttachDataType. | |
| static BB_BOOL | doattach (const ULONG *winobj) |
| static struct TagItem * | tailtags (struct TagItem *t) |
| BB_BOOL | c_attachdatatype (ULONG id, ULONG *winobj) |
| AttachDataType window,id: attaches the object to a window at 0,0 with the size of the BitMapHeader. | |
| BB_BOOL | c_attachdatatype2 (ULONG id, WORD x, WORD y, WORD w, WORD h, ULONG *winobj) |
| AttachDataType window,id,x,y,width,height: attaches the object to a window at a position and size. | |
| BB_BOOL | c_attachdatatype3 (ULONG id, struct TagItem *tags, ULONG *winobj) |
| AttachDataType window,id,&taglist: attaches the object to a window with a tag list of the program's. | |
| BB_BOOL | c_datatypeready (void) |
| DataTypeReady: whether the attached object's layout is done (DTA_LayoutProc 0). | |
| ULONG | c_datatypesuper (void) |
| DataTypeSuper: the ID of the object's class (cl_ID), written at a3 like DataTypeName. | |
| ULONG | c_datatypespalette (struct bb_palette *palobj) |
| DataTypesPalette palette#: the object's colours (PDTA_ColorRegisters) into a palette object. | |
| UWORD | c_datatypewidth (void) |
| DataTypeWidth: the picture's width (bmh_Width). | |
| UWORD | c_datatypeheight (void) |
| DataTypeHeight: the picture's height (bmh_Height). | |
| UWORD | c_datatypedepth (void) |
| DataTypeDepth: the picture's depth (bmh_Depth, sign-extended). | |
| void | c_setdatatypeattr (struct TagItem *tags) |
| SetDataTypeAttr &taglist: SetAttrs on the object. | |
| void | c_setdatatypeattr2 (UWORD n, const ULONG *sp) |
| SetDataTypeAttr attr,data[,attr,data..]: SetAttrs with the pairs as a tag list in the buffer. | |
| ULONG | c_getdatatypeattr (ULONG attr) |
| GetDataTypeAttr(attribute): GetAttr of one attribute into the buffer. | |
| static ULONG | domodeid (struct TagItem *more) |
| ULONG | c_getmodeid (void) |
| DataTypeModeID: BestModeID for the picture's size and depth (the tags in the buffer). | |
| ULONG | c_getmodeid2 (struct TagItem *tags) |
| DataTypeModeID taglist: as DataTypeModeID, with the program's tag list behind the library's tags (TAG_MORE; the library's come first). Fixed (#603): the original wrote its tags over the list. | |
Variables | |
| static struct Library * | libbases [5] |
| static const char *const | libnames [] |
| union { | |
| ULONG value | |
| struct TagItem tags [128] | |
| } * | storage |
| static BPTR | lock |
| static struct DataType * | dtype |
| static struct DataTypeHeader * | dtypehead |
| static Object * | object |
| static UBYTE * | fname |
| static struct BitMapHeader * | bitmapheader |
| static ULONG | attached |
| static UWORD | attachtobitmap |
| #define __NOLIBBASE__ |
| #define database libbases[0] |
| #define DATATYPES_BASE_NAME database |
| #define DOS_BASE_NAME dosbase |
| #define dosbase libbases[1] |
| #define gfxbase libbases[3] |
| #define GRAPHICS_BASE_NAME gfxbase |
| #define intuibase libbases[2] |
| #define INTUITION_BASE_NAME intuibase |
| void _attachdatatype | ( | void | ) |
| void _attachdatatype2 | ( | void | ) |
| void _attachdatatype3 | ( | void | ) |
| void _datatypebasename | ( | void | ) |
| void _datatypebitmap | ( | void | ) |
| void _datatypeclose | ( | void | ) |
| void _datatypecreate | ( | void | ) |
| void _datatypecreate2 | ( | void | ) |
| void _datatypedepth | ( | void | ) |
| void _datatypegroup | ( | void | ) |
| void _datatypeheight | ( | void | ) |
| void _datatypeid | ( | void | ) |
| void _datatypename | ( | void | ) |
| void _datatypeopen | ( | void | ) |
| void _datatypeready | ( | void | ) |
| void _datatypespalette | ( | void | ) |
| void _datatypesuper | ( | void | ) |
| void _datatypewidth | ( | void | ) |
| void _detachdatatype | ( | void | ) |
| void _getdatatypeattr | ( | void | ) |
| void _getmodeid | ( | void | ) |
| void _getmodeid2 | ( | void | ) |
| void _setdatatypeattr | ( | void | ) |
| void _setdatatypeattr2 | ( | void | ) |
| BB_BOOL c_attachdatatype | ( | ULONG | id, |
| ULONG * | winobj ) |
AttachDataType window,id: attaches the object to a window at 0,0 with the size of the BitMapHeader.
SetAttrs (GA_Left/Top/Width/Height/ID, ICA_TARGET ICTARGET_IDCMP, PDTA_Remap 0), then AddDTObject. Without a BitMapHeader it is got first, as DataTypeBitmap does (fixed, #595: the original read the size through the unchecked pointer, without DataTypeBitmap at address 0). Does not test datatypes.library (an open file needs it).
| id | d1: the gadget id |
| winobj | a0: the window object (windowslib, parameter 0) |
| BB_BOOL c_attachdatatype2 | ( | ULONG | id, |
| WORD | x, | ||
| WORD | y, | ||
| WORD | w, | ||
| WORD | h, | ||
| ULONG * | winobj ) |
AttachDataType window,id,x,y,width,height: attaches the object to a window at a position and size.
The word arguments go into the tag list sign-extended (fixed, #597: the original wrote the registers, with the upper words they had). Needs an object (fixed, #1098: the original checked only the file and passed the object 0 to SetAttrsA and AddDTObject).
| id | d1: the gadget id |
| x | d2: left (word) |
| y | d3: top (word) |
| w | d4: width (word) |
| h | d5: height (word) |
| winobj | a0: the window object |
| BB_BOOL c_attachdatatype3 | ( | ULONG | id, |
| struct TagItem * | tags, | ||
| ULONG * | winobj ) |
AttachDataType window,id,&taglist: attaches the object to a window with a tag list of the program's.
SetAttrs (GA_ID, ICA_TARGET ICTARGET_IDCMP, PDTA_Remap 0), SetAttrs with the program's tag list (fixed, #596: the original passed the id as the tag list and ignored the program's), then AddDTObject. Needs an object (fixed, #1098, as the form with coordinates).
| id | d1: the gadget id |
| tags | d2: the program's tag list |
| winobj | a0: the window object |
| ULONG c_datatypebasename | ( | void | ) |
DataTypeBaseName: the base name of the file's DataType (dth_BaseName), written at a3 like DataTypeName.
| ULONG c_datatypebitmap | ( | void | ) |
DataTypeBitmap: gets the object's BitMapHeader (PDTA_BitMapHeader) for DataTypeWidth/Height/Depth/ModeID and AttachDataType.
The buffer is cleared first (fixed, #598: the original took whatever the command before had left in it when GetAttr failed).
| void c_datatypeclose | ( | void | ) |
DataTypeClose: detaches the object, disposes of it, releases the DataType and unlocks the file.
Detached first (fixed, #599: the original disposed of an attached object, the window kept the freed gadget). The file is unlocked whenever it is locked (fixed, #605: the original unlocked it, and cleared the BitMapHeader, only if there was a DataType). Nothing without datatypes.library.
| ULONG c_datatypecreate | ( | struct TagItem * | tags | ) |
DataTypeCreate &taglist: NewDTObject of the file's name with a tag list.
While an object exists: 0, the object stays (fixed, #600: the original lost it).
| tags | d0: the tag list |
| ULONG c_datatypecreate2 | ( | void | ) |
DataTypeCreate: NewDTObject of the file's name without tags.
Needs an open file, as the form with a tag list (fixed, #601: the original made an object of the name the last DataTypeOpen had copied, at first ""). While an object exists: 0, the object stays (fixed, #600: the original lost it).
| UWORD c_datatypedepth | ( | void | ) |
DataTypeDepth: the picture's depth (bmh_Depth, sign-extended).
| ULONG c_datatypegroup | ( | void | ) |
DataTypeGroup: the group ID of the file's DataType (dth_GroupID), up to four characters at a3.
| UWORD c_datatypeheight | ( | void | ) |
DataTypeHeight: the picture's height (bmh_Height).
| ULONG c_datatypeid | ( | void | ) |
DataTypeID: the ID of the file's DataType (dth_ID), up to four characters (up to a 0) at a3.
| ULONG c_datatypename | ( | void | ) |
DataTypeName: the name of the file's DataType (dth_Name).
The string is written at a3 (a3 behind its 0).
| ULONG c_datatypeopen | ( | CONST_STRPTR | name | ) |
DataTypeOpen filename$: locks a file and obtains its DataType.
The name is copied for DataTypeCreate into a block of its own length (fixed, #604: the original copied it into a 384 byte buffer without a limit); out of memory: 0. Without a DataType the file is unlocked again (fixed, #605: the original read the DataTypeHeader through address 28 and kept the lock).
| name | d0: the file name |
| BB_BOOL c_datatypeready | ( | void | ) |
DataTypeReady: whether the attached object's layout is done (DTA_LayoutProc 0).
| ULONG c_datatypespalette | ( | struct bb_palette * | palobj | ) |
DataTypesPalette palette#: the object's colours (PDTA_ColorRegisters) into a palette object.
Into the palette's colour block (count.w, first.w, then a long per component; the top bytes set). The smaller of the picture's (PDTA_NumColors) and the palette's number of colours (fixed, #606: the original copied the palette's number, behind the picture's table for a larger palette, 65536 for 0). Does not test datatypes.library.
| palobj | a0: the palette object (palettelib, parameter 0) The buffer is cleared before GetAttr (fixed, #607: the original took what the command before had left in it for an object that does not know the attribute). |
| ULONG c_datatypesuper | ( | void | ) |
DataTypeSuper: the ID of the object's class (cl_ID), written at a3 like DataTypeName.
| UWORD c_datatypewidth | ( | void | ) |
DataTypeWidth: the picture's width (bmh_Width).
| void c_detachdatatype | ( | void | ) |
DetachDataType: removes the object from the window it is attached to.
Nothing if it is not attached, or attached to a bitmap.
| ULONG c_getdatatypeattr | ( | ULONG | attr | ) |
GetDataTypeAttr(attribute): GetAttr of one attribute into the buffer.
| attr | d0: the attribute |
| ULONG c_getmodeid | ( | void | ) |
DataTypeModeID: BestModeID for the picture's size and depth (the tags in the buffer).
| ULONG c_getmodeid2 | ( | struct TagItem * | tags | ) |
DataTypeModeID taglist: as DataTypeModeID, with the program's tag list behind the library's tags (TAG_MORE; the library's come first). Fixed (#603): the original wrote its tags over the list.
| tags | d0: the tag list (0: none) |
|
static |
finit: DetachDataType, DataTypeClose, closes the libraries and frees the buffer.
Each of the four that opened is closed (fixed, #602: the original stopped at the first one that had not opened).
|
static |
init: opens datatypes, dos, intuition and graphics.library (V37) and allocates the 1024 byte buffer (memlib globalloc, MEMF_CLEAR).
A library that does not open leaves its base 0; the commands that test the base then do nothing.
| void c_setdatatypeattr | ( | struct TagItem * | tags | ) |
SetDataTypeAttr &taglist: SetAttrs on the object.
| tags | d0: the tag list |
| void c_setdatatypeattr2 | ( | UWORD | n, |
| const ULONG * | sp ) |
SetDataTypeAttr attr,data[,attr,data..]: SetAttrs with the pairs as a tag list in the buffer.
BUG(orig) (#608): 0 pairs are 65536 (DBRA), more than 127 overflow the 1024 byte buffer. DIFF: a2 stays unchanged.
| n | d7: the number of pairs |
| sp | a2: the argument stack (the pairs below it) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| void ridatatypeslib_libfinit | ( | void | ) |
| void ridatatypeslib_libinit | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| union { ... } * storage |
| struct TagItem tags[128] |
| ULONG value |