|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include <exec/memory.h>#include <exec/ports.h>#include <exec/tasks.h>#include <exec/io.h>#include <dos/dos.h>#include <dos/dosextens.h>#include <intuition/intuition.h>#include <proto/exec.h>#include <proto/dos.h>#include "edstub.h"Data Structures | |
| struct | comdata_s |
Macros | |
| #define | STUB(n) |
| #define | PROGMARK 0x54454470UL /* 'TEDp' */ |
| #define | CDOFF(m) |
| #define | WIN_WIDTH 640 |
| #define | BMAPMUL 80 /* bytes per row of a 640 pixel plane */ |
| #define | BITMAP_ROWS 16 /* stripe uses rows 0..9 */ |
| #define | LOG_BEGIN struct sb L = { lbuf, 0, sizeof lbuf }; lbuf[0] = 0 |
| #define | LOG_END edstub_log(lbuf) |
| #define | MAXREQ 8 |
| #define | GUARD_BYTE 0xA5 |
| #define | PROGCOLS 256 /* columns counted and pictured */ |
Functions | |
| void | edstub_tomain (void) |
| STUB (screenclose) | |
| STUB (screenopen2) | |
| STUB (openreq) | |
| STUB (closereq) | |
| STUB (getinput) | |
| STUB (error) | |
| STUB (detokallz) | |
| STUB (tokall) | |
| STUB (ezfreq) | |
| STUB (refgads) | |
| STUB (getinput2) | |
| STUB (tokone) | |
| STUB (openio) | |
| STUB (closeio) | |
| STUB (actgad) | |
| STUB (pointeron) | |
| STUB (sleepon) | |
| STUB (extalloc) | |
| STUB (progress) | |
| static void | stripe_check (void) |
| void * | memset (void *d, int c, size_t n) |
| void * | memcpy (void *d, const void *s, size_t n) |
| ULONG | edstub_strlen (const char *s) |
| The length of the string s. | |
| int | edstub_prefix (const char *s, const char *pre) |
| 1 if s starts with pre, else 0. | |
| int | edstub_streq (const char *a, const char *b) |
| 1 if the strings are equal, else 0. | |
| void | edstub_strcpy (char *d, const char *s, ULONG max) |
| Copy s to d, at most max - 1 characters and the 0 (nothing if max is 0). | |
| void | edstub_strcat (char *d, const char *s, ULONG max) |
| Append s to d; max is the size of all of d (as edstub_strcpy). | |
| ULONG | edstub_udiv10 (ULONG u, ULONG *rem) |
| u / 10 without libgcc (no __udivsi3 in a -nostdlib build); the remainder to *rem. | |
| void | sbc (struct sb *b, char c) |
| Append the character c. | |
| void | sbs (struct sb *b, const char *s) |
| Append the string s ("(null)" for NULL). | |
| void | sbn (struct sb *b, LONG v) |
| Append v in decimal. | |
| void | sbx (struct sb *b, ULONG v, int digits) |
| Append the low digits hex digits of v, upper case. | |
| void | sbq (struct sb *b, const char *s) |
| Append s quoted, controls (< 32 and 127) as \xNN. | |
| void | edstub_log (const char *s) |
| Log a line: to Output() and appended to the log file. | |
| int | edstub_set_log (const char *path) |
| Set the log file: create it (a new file) and write the lines kept so far. | |
| static void | closeall (void) |
| static void | abort_job (const char *why) |
| void | edstub_reset_requests (void) |
| A new job: the counters of the requester answers start again. | |
| static const char * | reqtext (struct Requester *r) |
| static const char * | gadtext (struct Gadget *g) |
| static void | popreq (void) |
| void | screenclose_c (struct regs *r) |
| void | screenopen2_c (struct regs *r) |
| void | detokallz_c (struct regs *r) |
| void | tokall_c (struct regs *r) |
| void | refgads_c (struct regs *r) |
| void | openio_c (struct regs *r) |
| void | closeio_c (struct regs *r) |
| void | pointeron_c (struct regs *r) |
| void | sleepon_c (struct regs *r) |
| void | actgad_c (struct regs *r) |
| void | tokone_c (struct regs *r) |
| void | openreq_c (struct regs *r) |
| void | closereq_c (struct regs *r) |
| void | getinput2_c (struct regs *r) |
| int | edstub_open_requests (void) |
| The number of requesters open now (openreq not yet closed). | |
| struct MsgPort * | edstub_req_port (void) |
| The UserPort of the requester window. | |
| void | getinput_c (struct regs *r) |
| void | ezfreq_c (struct regs *r) |
| void | extalloc_c (struct regs *r) |
| void | error_c (struct regs *r) |
| static ULONG | rowoff (UWORD row) |
| static void | stripe_reset (void) |
| int | edstub_set_bitmap (UWORD bmapmul, ULONG guard) |
| Give the compiler a bitmap of bmapmul bytes per row (comdata+92) with guard bytes before and after it, and record the stripe from now on (edstub_stripe_log). | |
| void | edstub_set_progress (int on) |
| Announce the progress call (comdata+98 = 'TEDp') or not (0). | |
| void | progress_c (struct regs *r) |
| void | edstub_stripe_log (const char *id) |
| After a compile: log the stripe, then clear the bitmap, refill the guards and the counters. | |
| struct MsgPort * | edstub_create_port (void) |
| A message port with a signal of its own, with Kickstart 1.x calls (CreateMsgPort of V36). | |
| void | edstub_delete_port (struct MsgPort *port) |
| Free a port of edstub_create_port() and its signal. | |
| struct IORequest * | edstub_create_ioreq (struct MsgPort *port, ULONG size) |
| An IO request for a port, with Kickstart 1.x calls (CreateIORequest of V36). | |
| void | edstub_delete_ioreq (struct IORequest *io) |
| Free a request of edstub_create_ioreq() (as DeleteIORequest: the node's successor and io_Device set to -1 first). | |
| void | edstub_init_c (struct regs *r) |
| void | edstub_main_c (struct regs *r) |
Variables | |
| struct ExecBase * | SysBase |
| struct DosLibrary * | DOSBase |
| struct IntuitionBase * | IntuitionBase |
| struct edstruct * | edstub_ed |
| The edstruct blitz2 passed to outside (a1). | |
| const char *(* | edstub_ezfreq_hook )(const char *title) |
| ezfreq: the file name for the requester with this title, or NULL (default: cancelled). | |
| void(* | edstub_error_hook )(const char *msg) |
| The compiler's error message (default: logged). | |
| void(* | edstub_tokone_hook )(UBYTE *line) |
| tokone: tokenise the line (default: logged, line left as is). | |
| void(* | edstub_abort_hook )(const char *why) |
| Before the frame aborts inside main (compiler waits for input forever, extalloc of the original compiler failed): the program can log its result and free its data. | |
| void(* | edstub_openio_hook )(void) |
| openio/closeio (ted.s: the console window of a program run from the editor): called in the program's process, runtheprog, before and after the program. | |
| void(* | edstub_closeio_hook )(void) |
| openio/closeio (ted.s: the console window of a program run from the editor): called in the program's process, runtheprog, before and after the program. | |
| UWORD(* | edstub_getinput2_hook )(void) |
| getinput2 (the compiler polls the stop requester, chkrealstop): the id of the gadget hit, 0 = nothing (default: nothing). | |
| char | edstub_logname [EDSTUB_PATHLEN] |
| The log file's name; empty while there is none. | |
| int | edstub_quiet |
| Non-zero: edstub_log does not write to Output() (a program with a console output of its own; the log file still gets the lines). | |
| ULONG | edstub_abort_sp |
| static struct comdata_s | cd |
| static UWORD | colors [32] |
| static UWORD | halfcolors [32] |
| static UBYTE | flag84 |
| static struct Window | fakewin |
| static struct MsgPort * | winport |
| static UBYTE * | bitmap |
| static UBYTE * | bitmap_mem |
| static ULONG | bitmap_size |
| static ULONG | guard_size |
| static APTR | old_winptr |
| static int | in_main |
| static char | early [2048] |
| static struct sb | earlyb = { early, 0, sizeof early } |
| static char | lbuf [600] |
| static int | reqdepth |
| static struct Requester * | reqstack [MAXREQ] |
| static int | nomem_answers |
| static int | unexpected |
| int | edstub_busy |
| The busy pointer: sleepon sets it (1), pointeron clears it (ted.s: the window pointer); the frame shows nothing, it only keeps the state. | |
| static int | stripe_on |
| static UBYTE | progcount [4][PROGCOLS] |
| static ULONG | progcalls |
| static ULONG | progbad |
| static UBYTE | snap [BITMAP_ROWS][PROGCOLS] |
| static ULONG | snap_set |
| static ULONG | guard_before |
| static ULONG | guard_after |
| #define BITMAP_ROWS 16 /* stripe uses rows 0..9 */ |
| #define BMAPMUL 80 /* bytes per row of a 640 pixel plane */ |
| #define GUARD_BYTE 0xA5 |
| #define LOG_END edstub_log(lbuf) |
| #define MAXREQ 8 |
| #define PROGCOLS 256 /* columns counted and pictured */ |
| #define PROGMARK 0x54454470UL /* 'TEDp' */ |
| #define STUB | ( | n | ) |
| #define WIN_WIDTH 640 |
|
static |
| void actgad_c | ( | struct regs * | r | ) |
|
static |
| void closeio_c | ( | struct regs * | r | ) |
| void closereq_c | ( | struct regs * | r | ) |
| void detokallz_c | ( | struct regs * | r | ) |
| struct IORequest * edstub_create_ioreq | ( | struct MsgPort * | port, |
| ULONG | size ) |
| struct MsgPort * edstub_create_port | ( | void | ) |
A message port with a signal of its own, with Kickstart 1.x calls (CreateMsgPort of V36).
| void edstub_delete_ioreq | ( | struct IORequest * | io | ) |
Free a request of edstub_create_ioreq() (as DeleteIORequest: the node's successor and io_Device set to -1 first).
| io | the request (NULL: nothing) |
| void edstub_delete_port | ( | struct MsgPort * | port | ) |
Free a port of edstub_create_port() and its signal.
| port | the port (NULL: nothing) |
| void edstub_init_c | ( | struct regs * | r | ) |
| void edstub_log | ( | const char * | s | ) |
Log a line: to Output() and appended to the log file.
Before there is a log file, the lines are kept and edstub_set_log() writes them first. The file is opened and closed for every line, so the log survives a crash of the compiler.
| s | the line, without its line feed |
| void edstub_main_c | ( | struct regs * | r | ) |
| int edstub_open_requests | ( | void | ) |
The number of requesters open now (openreq not yet closed).
| int edstub_prefix | ( | const char * | s, |
| const char * | pre ) |
1 if s starts with pre, else 0.
| struct MsgPort * edstub_req_port | ( | void | ) |
The UserPort of the requester window.
Its signal is the stop requester's exception (blitz2 openstopreq), a message there is "a gadget was hit".
| void edstub_reset_requests | ( | void | ) |
A new job: the counters of the requester answers start again.
| int edstub_set_bitmap | ( | UWORD | bmapmul, |
| ULONG | guard ) |
Give the compiler a bitmap of bmapmul bytes per row (comdata+92) with guard bytes before and after it, and record the stripe from now on (edstub_stripe_log).
| bmapmul | bytes per row (at least 80) |
| guard | guard bytes before and after the bitmap |
| int edstub_set_log | ( | const char * | path | ) |
Set the log file: create it (a new file) and write the lines kept so far.
| path | the file name (cut to EDSTUB_PATHLEN - 1 characters) |
| void edstub_set_progress | ( | int | on | ) |
Announce the progress call (comdata+98 = 'TEDp') or not (0).
A call toggles the cell as the original compiler XORs it (the byte column of rows bar and 9 - bar of the bitmap) and is counted.
| void edstub_strcat | ( | char * | d, |
| const char * | s, | ||
| ULONG | max ) |
Append s to d; max is the size of all of d (as edstub_strcpy).
| void edstub_strcpy | ( | char * | d, |
| const char * | s, | ||
| ULONG | max ) |
Copy s to d, at most max - 1 characters and the 0 (nothing if max is 0).
| int edstub_streq | ( | const char * | a, |
| const char * | b ) |
1 if the strings are equal, else 0.
| void edstub_stripe_log | ( | const char * | id | ) |
After a compile: log the stripe, then clear the bitmap, refill the guards and the counters.
Lines (tab separated, with the job's id): PROGRESS ID none (no call) or per bar with calls PROGRESS ID bar N COUNTS (the calls per column from column 0, a digit each, '+' above 9, up to the last column called), plus PROGRESS ID bad N for calls with a bar above 3 or a column outside the row; STRIPE ID none (bitmap empty) or per row with set bytes STRIPE ID row R PICTURE ('#' $FF, '.' 0, 'x' else, up to the last byte not 0, columns 0 to 255); GUARD ID ok or GUARD ID before N after M (bytes of the guards changed). The picture and the guards are those of the checkpoints openreq, closereq and the end of the job: the fullest picture, the most changed guard bytes (with two passes the XORs of the second undo those of the first; the requester of the second pass opens between them). Nothing without edstub_set_bitmap.
| id | the job's id |
| ULONG edstub_strlen | ( | const char * | s | ) |
The length of the string s.
| void edstub_tomain | ( | void | ) |
| ULONG edstub_udiv10 | ( | ULONG | u, |
| ULONG * | rem ) |
u / 10 without libgcc (no __udivsi3 in a -nostdlib build); the remainder to *rem.
| void error_c | ( | struct regs * | r | ) |
| void extalloc_c | ( | struct regs * | r | ) |
| void ezfreq_c | ( | struct regs * | r | ) |
|
static |
| void getinput2_c | ( | struct regs * | r | ) |
| void getinput_c | ( | struct regs * | r | ) |
| void * memcpy | ( | void * | d, |
| const void * | s, | ||
| size_t | n ) |
| void * memset | ( | void * | d, |
| int | c, | ||
| size_t | n ) |
| void openio_c | ( | struct regs * | r | ) |
| void openreq_c | ( | struct regs * | r | ) |
| void pointeron_c | ( | struct regs * | r | ) |
|
static |
| void progress_c | ( | struct regs * | r | ) |
| void refgads_c | ( | struct regs * | r | ) |
|
static |
|
static |
| void sbc | ( | struct sb * | b, |
| char | c ) |
Append the character c.
| void sbn | ( | struct sb * | b, |
| LONG | v ) |
Append v in decimal.
| void sbq | ( | struct sb * | b, |
| const char * | s ) |
Append s quoted, controls (< 32 and 127) as \xNN.
| void sbs | ( | struct sb * | b, |
| const char * | s ) |
Append the string s ("(null)" for NULL).
| void sbx | ( | struct sb * | b, |
| ULONG | v, | ||
| int | digits ) |
Append the low digits hex digits of v, upper case.
| void screenclose_c | ( | struct regs * | r | ) |
| void screenopen2_c | ( | struct regs * | r | ) |
| void sleepon_c | ( | struct regs * | r | ) |
|
static |
|
static |
| STUB | ( | actgad | ) |
| STUB | ( | closeio | ) |
| STUB | ( | closereq | ) |
| STUB | ( | detokallz | ) |
| STUB | ( | error | ) |
| STUB | ( | extalloc | ) |
| STUB | ( | ezfreq | ) |
| STUB | ( | getinput | ) |
| STUB | ( | getinput2 | ) |
| STUB | ( | openio | ) |
| STUB | ( | openreq | ) |
| STUB | ( | pointeron | ) |
| STUB | ( | progress | ) |
| STUB | ( | refgads | ) |
| STUB | ( | screenclose | ) |
| STUB | ( | screenopen2 | ) |
| STUB | ( | sleepon | ) |
| STUB | ( | tokall | ) |
| STUB | ( | tokone | ) |
| void tokall_c | ( | struct regs * | r | ) |
| void tokone_c | ( | struct regs * | r | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
| struct DosLibrary* DOSBase |
|
static |
| void(* edstub_abort_hook) (const char *why) | ( | const char * | why | ) |
Before the frame aborts inside main (compiler waits for input forever, extalloc of the original compiler failed): the program can log its result and free its data.
| ULONG edstub_abort_sp |
| int edstub_busy |
The busy pointer: sleepon sets it (1), pointeron clears it (ted.s: the window pointer); the frame shows nothing, it only keeps the state.
| void(* edstub_closeio_hook) (void) | ( | void | ) |
openio/closeio (ted.s: the console window of a program run from the editor): called in the program's process, runtheprog, before and after the program.
| struct edstruct* edstub_ed |
The edstruct blitz2 passed to outside (a1).
| void(* edstub_error_hook) (const char *msg) | ( | const char * | msg | ) |
The compiler's error message (default: logged).
| const char *(* edstub_ezfreq_hook) (const char *title) | ( | const char * | title | ) |
ezfreq: the file name for the requester with this title, or NULL (default: cancelled).
| UWORD(* edstub_getinput2_hook) (void) | ( | void | ) |
getinput2 (the compiler polls the stop requester, chkrealstop): the id of the gadget hit, 0 = nothing (default: nothing).
| char edstub_logname[EDSTUB_PATHLEN] |
The log file's name; empty while there is none.
| void(* edstub_openio_hook) (void) | ( | void | ) |
openio/closeio (ted.s: the console window of a program run from the editor): called in the program's process, runtheprog, before and after the program.
| int edstub_quiet |
Non-zero: edstub_log does not write to Output() (a program with a console output of its own; the log file still gets the lines).
| void(* edstub_tokone_hook) (UBYTE *line) | ( | UBYTE * | line | ) |
tokone: tokenise the line (default: logged, line left as is).
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| struct IntuitionBase* IntuitionBase |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| struct ExecBase* SysBase |
|
static |
|
static |