BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
ab3job.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  ab3job
 The job of a command line run. More...

Macros

#define AB3JOB_MAGIC   "AB3JOB1"
 The job's first bytes: what ab3cli checks before it trusts a0.
#define AB3JOB_PATHLEN   256
 Bytes of a file name in the job (with its 0).
#define AB3JOB_W_ALL   ((uint32_t)((1UL << AB3JOB_W_COUNT) - 1))
 The set of all warnings.

Enumerations

enum  ab3job_rc { AB3JOB_RC_OK = 0 , AB3JOB_RC_WARN = 5 , AB3JOB_RC_ERROR = 10 , AB3JOB_RC_FAIL = 20 }
 The return codes of a command line run (design D6): those of the NDK's dos/dos.h (ab3cli checks that they agree; the host has no dos/dos.h). More...
enum  ab3job_warning { AB3JOB_W_RESCLASH , AB3JOB_W_COUNT }
 The compiler's warnings (change compiler-warnings, design D1): their numbers, bit n of a warning set. The compiler core has the same numbers in parse.h (W_*); ab3main.c checks that they agree. More...
enum  ab3args_result {
  AB3ARGS_EDITOR , AB3ARGS_COMPILE , AB3ARGS_HELP , AB3ARGS_UNSUPPORTED ,
  AB3ARGS_FAIL
}
 What ab3args_parse found. More...

Functions

static int ab3job_rc (const struct ab3job *job, int setuperrs, int compileerr, int written)
 The return code at the end of a compile (design D6 of the change compiler-warnings), what ab3cli leaves in the job.
int ab3args_parse (int argc, char *const argv[], struct ab3job *job, char *msg, size_t cap)
 Parse the command line of blitz2-ab3.
int ab3args_rc (int result)
 The return code that goes with a result of ab3args_parse.

Variables

const char *const ab3args_warnings []
 The names of the warnings by number (-w, -werr and the console line), AB3JOB_W_COUNT entries and a NULL.
const char ab3args_usage []
 The usage (several lines, each ending in LF).

Macro Definition Documentation

◆ AB3JOB_MAGIC

#define AB3JOB_MAGIC   "AB3JOB1"

The job's first bytes: what ab3cli checks before it trusts a0.

◆ AB3JOB_PATHLEN

#define AB3JOB_PATHLEN   256

Bytes of a file name in the job (with its 0).

◆ AB3JOB_W_ALL

#define AB3JOB_W_ALL   ((uint32_t)((1UL << AB3JOB_W_COUNT) - 1))

The set of all warnings.

Enumeration Type Documentation

◆ ab3args_result

What ab3args_parse found.

Enumerator
AB3ARGS_EDITOR 
AB3ARGS_COMPILE 
AB3ARGS_HELP 
AB3ARGS_UNSUPPORTED 
AB3ARGS_FAIL 

◆ ab3job_rc

enum ab3job_rc

The return codes of a command line run (design D6): those of the NDK's dos/dos.h (ab3cli checks that they agree; the host has no dos/dos.h).

Enumerator
AB3JOB_RC_OK 
AB3JOB_RC_WARN 
AB3JOB_RC_ERROR 
AB3JOB_RC_FAIL 

◆ ab3job_warning

The compiler's warnings (change compiler-warnings, design D1): their numbers, bit n of a warning set. The compiler core has the same numbers in parse.h (W_*); ab3main.c checks that they agree.

Enumerator
AB3JOB_W_RESCLASH 
AB3JOB_W_COUNT 

Function Documentation

◆ ab3args_parse()

int ab3args_parse ( int argc,
char *const argv[],
struct ab3job * job,
char * msg,
size_t cap )

Parse the command line of blitz2-ab3.

argv[1..argc) as libnix (or a shell) splits them. Without an argument that starts with '-' the result is AB3ARGS_EDITOR (blitz2's start with at most a project name). Options, in any case, AmiBlitz3's spelling: -s/-source FILE, -e/-exe FILE, -r/-release, -mode ab3|bb2 and -w/-werr LIST (this repository's), -h/-help. A LIST is comma-separated items all, none, NAME, -NAME (ab3args_warnings), applied left to right; several -w (-werr) are applied in order. The other options of AmiBlitz3's CLI mode (-d/-debug, -run, -dump, -setcom, -setdbg, -strbufsize, -stacksize, -maxerrors, -1/-1pass, -dform, -PED, -save, -v/-verbose) are refused. The first problem decides; -h before it gives AB3ARGS_HELP. Given twice, the last value counts (the lists: both are applied). An unknown warning name or an empty item is AB3ARGS_FAIL.

Parameters
argcthe number of arguments with the program's name
argvthe arguments; argv[0] is the program's name
jobthe job: initialised (magic, defaults) and filled
msgthe message for AB3ARGS_UNSUPPORTED and AB3ARGS_FAIL (one line without LF; "" otherwise)
capthe size of msg in bytes (> 0)
Returns
an enum ab3args_result

◆ ab3args_rc()

int ab3args_rc ( int result)

The return code that goes with a result of ab3args_parse.

Parameters
resultan enum ab3args_result
Returns
AB3JOB_RC_OK for AB3ARGS_HELP, AB3JOB_RC_FAIL for the errors, -1 for AB3ARGS_EDITOR and AB3ARGS_COMPILE (not the end of the run)

◆ ab3job_rc()

int ab3job_rc ( const struct ab3job * job,
int setuperrs,
int compileerr,
int written )
inlinestatic

The return code at the end of a compile (design D6 of the change compiler-warnings), what ab3cli leaves in the job.

A set-up error (outside the compile: loading libraries or residents) gives AB3JOB_RC_FAIL, unless all of them were warnings that are errors (AB3JOB_RC_ERROR); a compile error AB3JOB_RC_ERROR; no executable written AB3JOB_RC_FAIL; otherwise AB3JOB_RC_WARN after a warning, else AB3JOB_RC_OK.

Parameters
jobthe job (warnerrs, warnings)
setuperrsthe set-up errors (0: the compile ran)
compileerrnonzero: the compile ended with an error
writtennonzero: the executable was written
Returns
an enum ab3job_rc

Variable Documentation

◆ ab3args_usage

const char ab3args_usage[]
extern

The usage (several lines, each ending in LF).

◆ ab3args_warnings

const char* const ab3args_warnings[]
extern

The names of the warnings by number (-w, -werr and the console line), AB3JOB_W_COUNT entries and a NULL.