BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
asllib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"
#include <intuition/screens.h>
#include <libraries/asl.h>
#include <proto/asl.h>

Macros

#define __NOLIBBASE__
#define ASL_BASE_NAME   aslbase
#define FRF_DRAWERSONLY_   1
#define ASLTAG   0x80080000UL
#define SVAR   (BL_VARPTR | BL_STRING)
#define FREEREQ(r)
#define FREQ_ARGS

Functions

void doaslfreqa (void)
void doaslfreqb (void)
void doaslfreqc (void)
void doaslfreqd (void)
void doaslfreqe (void)
void doaslfreqf (void)
ULONG doaslfont (ULONG flags, struct Screen **scr)
 ASLFontRequest(flags): an ASL font requester on the used screen.
ULONG doaslscreen (ULONG flags, struct Screen **scr)
 ASLScreenRequest(flags): an ASL screen mode requester on the used screen.
static void codeinit (void)
 init: OpenLibrary("asl.library",0) -> aslbase (0 if not there).
static void codefinit (void)
 finit: CloseLibrary(aslbase) if it was opened.
void asllib_freqchk (void)
void freqchk2 (void)
static ULONG allocst (ULONG s, ULONG len)
static void freecopies (void)
static UWORD copyout (const UBYTE *s, UBYTE *var)
static UWORD copyresult (const UBYTE *s)
static ULONG aslreq (ULONG title, ULONG path, ULONG file, struct Screen **scr, const ULONG *lens)
static void dims (ULONG x, ULONG y, ULONG w, ULONG h)
static ULONG freqa_c (ULONG arg0, ULONG arg1, ULONG arg2, ULONG arg3, ULONG arg4, ULONG arg5, struct Screen **scr, const ULONG *lens)
 ASLFileRequest$(Title$,Pathname$,Filename$): an ASL file requester at 20,20 280x160 (doaslfreqa).
static ULONG freqb_c (ULONG arg0, ULONG arg1, ULONG arg2, ULONG arg3, ULONG arg4, ULONG arg5, struct Screen **scr, const ULONG *lens)
 ASLFileRequest$(Title$,Pathname$,Filename$,Pattern$): with a pattern (FRF_DOPATTERNS), at 20,20 280x160 (doaslfreqb).
static ULONG freqc_c (ULONG arg0, ULONG arg1, ULONG arg2, ULONG arg3, ULONG arg4, ULONG arg5, struct Screen **scr, const ULONG *lens)
 ASLFileRequest$(Title$,Pathname$,Filename$,x,y,w,h): at the given position and size (doaslfreqc).
static ULONG freqd_c (ULONG arg0, ULONG arg1, ULONG arg2, ULONG arg3, ULONG arg4, ULONG arg5, struct Screen **scr, const ULONG *lens)
 ASLFileRequest$(Title$,Pathname$,Filename$,Pattern$,x,y,w,h): with a pattern, at the given position and size (doaslfreqd).
static ULONG freqe_c (ULONG arg0, ULONG arg1, ULONG arg2, ULONG arg3, ULONG arg4, ULONG arg5, struct Screen **scr, const ULONG *lens)
 ASLPathRequest$(Title$,Pathname$): an ASL drawer requester (FRF_DRAWERSONLY) at 20,20 280x160 (doaslfreqe).
static ULONG freqf_c (ULONG arg0, ULONG arg1, ULONG arg2, ULONG arg3, ULONG arg4, ULONG arg5, struct Screen **scr, const ULONG *lens)
 ASLPathRequest$(Title$,Pathname$,x,y,w,h): an ASL drawer requester at the given position and size (doaslfreqf).
static void freqchk_c (ULONG path, ULONG file)
static void freqchk2_c (ULONG path)

Variables

static struct Library * aslbase
static APTR aslstruct
struct { 
   struct TagItem   screen 
   struct TagItem   flags 
   struct TagItem   maxheight 
   struct TagItem   end 
} ftags
struct { 
   char *   name 
   UWORD   size 
   UBYTE   style 
   UBYTE   flags 
   UBYTE   pen1 
   UBYTE   pen2 
   UBYTE   drawmode 
   UBYTE   pad 
   ULONG   len 
   char   str [96] 
} fstruct = { fstruct.str }
static struct ScreenModeRequester smresult
struct { 
   struct TagItem   screen 
   struct TagItem   dotags [5] 
   struct TagItem   end 
} stags
static const UWORD nullstr [1] = { 0 }
struct { 
   struct TagItem   screen 
   struct TagItem   name 
   struct TagItem   path 
   struct TagItem   file 
   struct TagItem   x 
   struct TagItem   y 
   struct TagItem   w 
   struct TagItem   h 
   struct TagItem   flags 
   struct TagItem   pattern 
   struct TagItem   noinfo 
   struct TagItem   flags2 
   struct TagItem   end 
} Tags

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ ASL_BASE_NAME

#define ASL_BASE_NAME   aslbase

◆ ASLTAG

#define ASLTAG   0x80080000UL

◆ FREEREQ

#define FREEREQ ( r)
Value:
FreeFileRequest((struct FileRequester *)(r))

◆ FREQ_ARGS

#define FREQ_ARGS
Value:
ULONG arg0 BL_REG(d0), ULONG arg1 BL_REG(d1), ULONG arg2 BL_REG(d2), \
ULONG arg3 BL_REG(d3), ULONG arg4 BL_REG(d4), ULONG arg5 BL_REG(d5), \
struct Screen **scr BL_REG(a1), const ULONG *lens BL_REG(a2)
#define BL_REG(r)
Definition blitzlib.h:280

◆ FRF_DRAWERSONLY_

#define FRF_DRAWERSONLY_   1

◆ SVAR

#define SVAR   (BL_VARPTR | BL_STRING)

Function Documentation

◆ allocst()

ULONG allocst ( ULONG s,
ULONG len )
static

◆ asllib_freqchk()

void asllib_freqchk ( void )

◆ aslreq()

ULONG aslreq ( ULONG title,
ULONG path,
ULONG file,
struct Screen ** scr,
const ULONG * lens )
static

◆ codefinit()

void codefinit ( void )
static

finit: CloseLibrary(aslbase) if it was opened.

◆ codeinit()

void codeinit ( void )
static

init: OpenLibrary("asl.library",0) -> aslbase (0 if not there).

◆ copyout()

UWORD copyout ( const UBYTE * s,
UBYTE * var )
static

◆ copyresult()

UWORD copyresult ( const UBYTE * s)
static

◆ dims()

void dims ( ULONG x,
ULONG y,
ULONG w,
ULONG h )
static

◆ doaslfont()

ULONG doaslfont ( ULONG flags,
struct Screen ** scr )

ASLFontRequest(flags): an ASL font requester on the used screen.

Amiga mode only. flags enable the gadgets (1 = pen, 2 = background, 4 = style, 8 = drawmode, 16 = fixed size; ASLFO_Flags). On OK the font is copied into the static .fontinfo {name$ (pointer to a BB2 string: length.l in front), ysize.w, style.b, flags.b, pen1.b, pen2.b, drawmode.b, pad.b}. The test is on d7, the name length after a request: an empty font name returns 0 as well (not a bug: an empty name is no font OpenDiskFont could open). BUG(orig) (#65): a name of more than 95 characters overruns the static buffer. The CD binary has an extra tag ASL_TB+17 = 256 (ASLFO_MaxHeight).

Parameters
flagsd0: the enable flags
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
Returns
d0: the address of .fontinfo, 0 on cancel (or without asl.library, or if no requester could be allocated)

◆ doaslfreqa()

void doaslfreqa ( void )

◆ doaslfreqb()

void doaslfreqb ( void )

◆ doaslfreqc()

void doaslfreqc ( void )

◆ doaslfreqd()

void doaslfreqd ( void )

◆ doaslfreqe()

void doaslfreqe ( void )

◆ doaslfreqf()

void doaslfreqf ( void )

◆ doaslscreen()

ULONG doaslscreen ( ULONG flags,
struct Screen ** scr )

ASLScreenRequest(flags): an ASL screen mode requester on the used screen.

Amiga mode only. flags enable the gadgets (1 = width, 2 = height, 4 = depth, 8 = overscan, 16 = autoscroll; ASLSM_Do*: -1/0). Fixed (#60): returns a copy of the requester's fields (static, struct ScreenModeRequester: sm_DisplayID ... sm_UserData), made before the requester is freed; the original returned the freed requester.

Parameters
flagsd0: the enable flags
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
Returns
d0: the copy of the ScreenModeRequester's fields (valid until the next call), 0 on cancel (or without asl.library, or if no requester could be allocated)

◆ freecopies()

void freecopies ( void )
static

◆ freqa_c()

ULONG freqa_c ( ULONG arg0,
ULONG arg1,
ULONG arg2,
ULONG arg3,
ULONG arg4,
ULONG arg5,
struct Screen ** scr,
const ULONG * lens )
static

ASLFileRequest$(Title$,Pathname$,Filename$): an ASL file requester at 20,20 280x160 (doaslfreqa).

The common part (aslreq): on OK the drawer and the file name are copied into the path$/file$ variables (their length longs at -4 updated); the result is drawer + "/" (unless empty or ending in ":") + file, written at a3 = the title argument's place in the string work area; Cancel: "" (0 at a3), also without asl.library (fixed #62). Fixed (#63): the title (and pattern) copies of maxslib allocst are freed after the request. Fixed (#403): FreeFileRequest only for an allocated requester. Errors (debugger, freqchk): path$ and file$ must be variables with room for 160/64 characters.

Parameters
arg0d0: the title
arg1d1: the path$ variable
arg2d2: the file$ variable
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
lensa2: the compiler's string stack, -4(a2) = the title's length
Returns
d0: the length of the result string at a3, 0 on cancel

◆ freqb_c()

ULONG freqb_c ( ULONG arg0,
ULONG arg1,
ULONG arg2,
ULONG arg3,
ULONG arg4,
ULONG arg5,
struct Screen ** scr,
const ULONG * lens )
static

ASLFileRequest$(Title$,Pathname$,Filename$,Pattern$): with a pattern (FRF_DOPATTERNS), at 20,20 280x160 (doaslfreqb).

The common part (aslreq): on OK the drawer and the file name are copied into the path$/file$ variables (their length longs at -4 updated); the result is drawer + "/" (unless empty or ending in ":") + file, written at a3 = the title argument's place in the string work area; Cancel: "" (0 at a3), also without asl.library (fixed #62). Fixed (#63): the title (and pattern) copies of maxslib allocst are freed after the request. Fixed (#403): FreeFileRequest only for an allocated requester. Errors (debugger, freqchk): path$ and file$ must be variables with room for 160/64 characters.

Parameters
arg0d0: the title
arg1d1: the path$ variable
arg2d2: the file$ variable
arg3d3: the pattern
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
lensa2: the compiler's string stack, -4(a2) = the title's length, -8(a2) = the pattern's
Returns
d0: the length of the result string at a3, 0 on cancel

◆ freqc_c()

ULONG freqc_c ( ULONG arg0,
ULONG arg1,
ULONG arg2,
ULONG arg3,
ULONG arg4,
ULONG arg5,
struct Screen ** scr,
const ULONG * lens )
static

ASLFileRequest$(Title$,Pathname$,Filename$,x,y,w,h): at the given position and size (doaslfreqc).

The common part (aslreq): on OK the drawer and the file name are copied into the path$/file$ variables (their length longs at -4 updated); the result is drawer + "/" (unless empty or ending in ":") + file, written at a3 = the title argument's place in the string work area; Cancel: "" (0 at a3), also without asl.library (fixed #62). Fixed (#63): the title (and pattern) copies of maxslib allocst are freed after the request. Fixed (#403): FreeFileRequest only for an allocated requester. Errors (debugger, freqchk): path$ and file$ must be variables with room for 160/64 characters.

Parameters
arg0d0: the title
arg1d1: the path$ variable
arg2d2: the file$ variable
arg3d3: x
arg4d4: y
arg5d5: w
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
lensa2: the compiler's string stack, -4(a2) = the title's length, -8(a2) = h
Returns
d0: the length of the result string at a3, 0 on cancel

◆ freqchk2()

void freqchk2 ( void )

◆ freqchk2_c()

void freqchk2_c ( ULONG path)
static

◆ freqchk_c()

void freqchk_c ( ULONG path,
ULONG file )
static

◆ freqd_c()

ULONG freqd_c ( ULONG arg0,
ULONG arg1,
ULONG arg2,
ULONG arg3,
ULONG arg4,
ULONG arg5,
struct Screen ** scr,
const ULONG * lens )
static

ASLFileRequest$(Title$,Pathname$,Filename$,Pattern$,x,y,w,h): with a pattern, at the given position and size (doaslfreqd).

The common part (aslreq): on OK the drawer and the file name are copied into the path$/file$ variables (their length longs at -4 updated); the result is drawer + "/" (unless empty or ending in ":") + file, written at a3 = the title argument's place in the string work area; Cancel: "" (0 at a3), also without asl.library (fixed #62). Fixed (#63): the title (and pattern) copies of maxslib allocst are freed after the request. Fixed (#403): FreeFileRequest only for an allocated requester. Errors (debugger, freqchk): path$ and file$ must be variables with room for 160/64 characters.

Parameters
arg0d0: the title
arg1d1: the path$ variable
arg2d2: the file$ variable
arg3d3: the pattern
arg4d4: x
arg5d5: y
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
lensa2: the compiler's string stack, -4(a2) = the title's length, -8(a2) = the pattern's, -12(a2) = w, -16(a2) = h
Returns
d0: the length of the result string at a3, 0 on cancel

◆ freqe_c()

ULONG freqe_c ( ULONG arg0,
ULONG arg1,
ULONG arg2,
ULONG arg3,
ULONG arg4,
ULONG arg5,
struct Screen ** scr,
const ULONG * lens )
static

ASLPathRequest$(Title$,Pathname$): an ASL drawer requester (FRF_DRAWERSONLY) at 20,20 280x160 (doaslfreqe).

As ASLFileRequest$ (aslreq), without a file name variable. Fixed (#61): no initial file, fr_File goes into the result only (the original copied it to the address in d2, which is no argument here, and wrote its length to d2-4). Fixed (#64): no pattern gadget (the original kept the pattern flag of the previous ASLFileRequest$). Errors (debugger, freqchk2): path$ must be a variable with room for 160 characters.

Parameters
arg0d0: the title
arg1d1: the path$ variable
arg2d2: no argument (not used, fixed #61)
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
lensa2: the compiler's string stack, -4(a2) = the title's length
Returns
d0: the length of the result string at a3, 0 on cancel

◆ freqf_c()

ULONG freqf_c ( ULONG arg0,
ULONG arg1,
ULONG arg2,
ULONG arg3,
ULONG arg4,
ULONG arg5,
struct Screen ** scr,
const ULONG * lens )
static

ASLPathRequest$(Title$,Pathname$,x,y,w,h): an ASL drawer requester at the given position and size (doaslfreqf).

As ASLPathRequest$. Fixed (#61): fr_File goes into the result only (the original copied it to the address in d2 = x and its length to x-4). Errors (debugger, freqchk2): path$ must be a variable with room for 160 characters.

Parameters
arg0d0: the title
arg1d1: the path$ variable
arg2d2: x
arg3d3: y
arg4d4: w
arg5d5: h
scra1: the used screen object (!libs {screenslib,$1102}): its Screen, 0 = the default public screen
lensa2: the compiler's string stack, -4(a2) = the title's length
Returns
d0: the length of the result string at a3, 0 on cancel

Variable Documentation

◆ aslbase

struct Library* aslbase
static

◆ aslstruct

APTR aslstruct
static

◆ dotags

struct TagItem dotags[5]

◆ drawmode

UBYTE drawmode

◆ end

struct TagItem end

◆ file

struct TagItem file

◆ flags

struct TagItem flags

◆ flags2

struct TagItem flags2

◆ [struct]

struct { ... } fstruct

◆ [struct]

struct { ... } ftags
Initial value:
= {
{ ASLTAG + 40, 0 }, { ASLTAG + 20, 15 }, { ASLTAG + 17, 256 }, { 0, 0 }
}
#define ASLTAG
Definition asllib.c:73

◆ h

struct TagItem h

◆ len

ULONG len

◆ maxheight

struct TagItem maxheight

◆ name

struct TagItem name

◆ noinfo

struct TagItem noinfo

◆ nullstr

const UWORD nullstr[1] = { 0 }
static

◆ pad

UBYTE pad

◆ path

struct TagItem path

◆ pattern

struct TagItem pattern

◆ pen1

UBYTE pen1

◆ pen2

UBYTE pen2

◆ screen

struct TagItem screen

◆ size

UWORD size

◆ smresult

struct ScreenModeRequester smresult
static

◆ [struct]

struct { ... } stags
Initial value:
= {
{ ASLTAG + 40, 0 },
{ { ASLTAG + 109, 0 }, { ASLTAG + 110, 0 }, { ASLTAG + 111, 0 },
{ ASLTAG + 112, 0 }, { ASLTAG + 113, 0 } },
{ 0, 0 }
}

◆ str

char str[96]

◆ style

UBYTE style

◆ [struct]

struct { ... } Tags
Initial value:
= {
{ ASLTAG + 40, 0 }, { ASLTAG + 1, 0 }, { ASLTAG + 9, 0 }, { ASLTAG + 8, 0 },
{ ASLTAG + 3, 0 }, { ASLTAG + 4, 0 }, { ASLTAG + 5, 0 }, { ASLTAG + 6, 0 },
{ ASLTAG + 20, 0 }, { ASLTAG + 10, (ULONG)nullstr }, { ASLTAG + 60, (ULONG)-1 },
{ ASLTAG + 22, 0 }, { 0, 0 }
}
static const UWORD nullstr[1]
Definition asllib.c:182

◆ w

struct TagItem w

◆ x

struct TagItem x

◆ y

struct TagItem y