BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
rireqlib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"

Data Structures

struct  frstruct

Macros

#define LVO_FileRequester   (-0x54)
#define LVO_PurgeFiles   (-0x72)
#define LVO_ColorRequester   (-0xc0)
#define BUFSIZE   (320 + 320 + 150 + 150)
#define FRQ_SIZEOF   356

Functions

void _requestfile (void)
void _requestfiletitle (void)
void _requestfiletitleflags (void)
void _file (void)
void _reqoutput (void)
void _reqflags (void)
void _colourreq (void)
void rireqlib_libinit (void)
void rireqlib_libfinit (void)
static ULONG libinit_c (ULONG incoming)
 init: open req.library (any version) and allocate the buffers.
static void libfinit_c (void)
 finit: close req.library and free the buffers (if it was open).
static void reqflags_c (ULONG flags)
 ReqFlags flags: the flags of the file requester (FrStruct's flags).
static ULONG file_c (void)
 ReqFileLoc: the address of the path buffer.
static ULONG requestfile_c (void)
 ReqFileRequest: the req.library file requester, the path as the result.
static ULONG requestfiletitle_c (STRPTR title, const ULONG *lens)
 ReqFileRequest(title$): the file requester with a title.
static ULONG requestfiletitleflags_c (STRPTR title, ULONG flags, const ULONG *lens)
 ReqFileRequest(title$,flags): the file requester with a title and flags.
static ULONG colourreq_c (ULONG colour)
 ReqColour(colour): the req.library colour requester on the ReqOutput window.
static void reqoutput_c (APTR *win)
 ReqOutput window#: the window of both requesters.

Variables

static struct frstruct FrStruct
static UBYTE * frq_Title
static UBYTE * frq_Dir
static UBYTE * frq_File
static UBYTE * frq_PathName
static APTR routput
struct { 
   ULONG   defcolour 
   APTR   winptr 
   ULONG   rfu [5] 
} ecr
static struct Library * reqbase
static const char reqname [] = "req.library"

Macro Definition Documentation

◆ BUFSIZE

#define BUFSIZE   (320 + 320 + 150 + 150)

◆ FRQ_SIZEOF

#define FRQ_SIZEOF   356

◆ LVO_ColorRequester

#define LVO_ColorRequester   (-0xc0)

◆ LVO_FileRequester

#define LVO_FileRequester   (-0x54)

◆ LVO_PurgeFiles

#define LVO_PurgeFiles   (-0x72)

Function Documentation

◆ _colourreq()

void _colourreq ( void )

◆ _file()

void _file ( void )

◆ _reqflags()

void _reqflags ( void )

◆ _reqoutput()

void _reqoutput ( void )

◆ _requestfile()

void _requestfile ( void )

◆ _requestfiletitle()

void _requestfiletitle ( void )

◆ _requestfiletitleflags()

void _requestfiletitleflags ( void )

◆ colourreq_c()

ULONG colourreq_c ( ULONG colour)
static

ReqColour(colour): the req.library colour requester on the ReqOutput window.

Fixed (#786): the argument is the default colour (DefColour); the original ignored it. Fixed (#1091): DefColour is a long at 0 and the window at 4, as req.library reads them; the original's word at 0 and window at 2 gave the requester another colour and a mangled window (so #786 alone had no effect with the real library). Fixed (#788): without req.library it returns $FFFF, what ColorRequester returns on cancel; the original called through a6 = 0.

Parameters
colourd0: the colour the requester starts on
Returns
d0: what ColorRequester returns ($FFFF on cancel); without req.library $FFFF

◆ file_c()

ULONG file_c ( void )
static

ReqFileLoc: the address of the path buffer.

The requester writes the chosen path there, which ReqFileRequest returns; a program may write a default path there before the call. 0 without the buffers (#788).

Returns
d0 (and a0, the thunk): the path buffer

◆ libfinit_c()

void libfinit_c ( void )
static

finit: close req.library and free the buffers (if it was open).

PurgeFiles(FrStruct) first frees what req.library keeps in the structure from one FileRequester call to the next (the cached directory, its buffers); fixed (#1092): the original only closed the library, so that memory stayed allocated. FrStruct's buffer fields are cleared again (#785).

◆ libinit_c()

ULONG libinit_c ( ULONG incoming)
static

init: open req.library (any version) and allocate the buffers.

One block of 940 bytes (MEMF_PUBLIC|MEMF_CLEAR): title (320), directory (150), file (150) and path (320); their addresses go to frq_Title ... frq_PathName and into FrStruct's title, directory, file and path fields (fixed, #785: the original never set the fields; its first version, ReqLib.bb, had them). No output window: FrStruct's window and the colour requester's are cleared (fixed, #1090: the original cleared only the colour requester's, so a second run from the editor gave the file requester the first run's closed window until its own ReqOutput). If the AllocMem fails, the library is closed again (_oops2).

Parameters
incomingd0: returned unchanged if the library is already open
Returns
d0: the path buffer; 0 if the library or the memory is missing

◆ reqflags_c()

void reqflags_c ( ULONG flags)
static

ReqFlags flags: the flags of the file requester (FrStruct's flags).

The default is $94: caching, info gadget and cache purge (fixed, #787).

Parameters
flagsd0: the req.library file requester flags

◆ reqoutput_c()

void reqoutput_c ( APTR * win)
static

ReqOutput window#: the window of both requesters.

Parameters
wina0: the window object (windowslib, ia0|pd0), its first long the Window

◆ requestfile_c()

ULONG requestfile_c ( void )
static

ReqFileRequest: the req.library file requester, the path as the result.

FileRequester(FrStruct); the path buffer is copied to a3, a3 ends on the terminating 0 (fixed, #784: the original left it behind the 0). FrStruct holds the buffers (fixed, #785: the original's had none, so the path was what the program wrote with ReqFileLoc, not the requester's). Fixed (#788): without req.library it returns "" as on cancel; the original called through a6 = 0.

Returns
d0: the length of the path; 0 on cancel (a3 unchanged)

◆ requestfiletitle_c()

ULONG requestfiletitle_c ( STRPTR title,
const ULONG * lens )
static

ReqFileRequest(title$): the file requester with a title.

The title string is given up (a3 back by its length + 1), then as requestfile_c. The title is for this call only: afterwards the title field points to the library's (empty) title buffer again (fixed, #789: the original kept the pointer to the given-up string for later calls without a title). On cancel a3 stays at the start of the title string.

Parameters
titled0: the title
lensa2: the argument stack, -4(a2) the length of title$
Returns
d0: the length of the path; 0 on cancel

◆ requestfiletitleflags_c()

ULONG requestfiletitleflags_c ( STRPTR title,
ULONG flags,
const ULONG * lens )
static

ReqFileRequest(title$,flags): the file requester with a title and flags.

The flags are set for later calls too, like ReqFlags, as RIReqLib.guide documents it ("If this is omitted then the last flag setting is used"; not a defect, #789).

Parameters
titled0: the title
flagsd1: the requester flags
lensa2: the argument stack, -4(a2) the length of title$
Returns
d0: the length of the path; 0 on cancel

◆ rireqlib_libfinit()

void rireqlib_libfinit ( void )

◆ rireqlib_libinit()

void rireqlib_libinit ( void )

Variable Documentation

◆ defcolour

ULONG defcolour

◆ [struct]

struct { ... } ecr

◆ frq_Dir

UBYTE * frq_Dir
static

◆ frq_File

UBYTE * frq_File
static

◆ frq_PathName

UBYTE * frq_PathName
static

◆ frq_Title

UBYTE* frq_Title
static

◆ FrStruct

struct frstruct FrStruct
static
Initial value:
= {
2, 0, 0, 0, 0, 0, 0, 20, 28, 12, (1 << 2) | (1 << 4) | (1 << 7), { 0 }
}

◆ reqbase

struct Library* reqbase
static

◆ reqname

const char reqname[] = "req.library"
static

◆ rfu

ULONG rfu[5]

◆ routput

APTR routput
static

◆ winptr

APTR winptr