|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
#include "blitzlib.h"Macros | |
| #define | FFP_CC_(cc, pivot, elem, ffp) |
| #define | GT_I(p, v, f) |
| #define | LT_I(p, v, f) |
| #define | GT_F(p, v, f) |
| #define | LT_F(p, v, f) |
| #define | GT_S(p, v, f) |
| #define | LT_S(p, v, f) |
| #define | SCAN_UP(T, COND, R, p) |
| #define | SCAN_DOWN(T, COND, R, p) |
| #define | SORT_FN(name, T, GT, LT, R) |
Functions | |
| void | dosort (ULONG base, const UBYTE *args, const void *ffp) |
| Sort Arrayname() - sort the whole array in place. | |
| void | dosortup (void) |
| SortUp - the following Sort commands sort ascending. | |
| void | dosortdown (void) |
| SortDown - the following Sort commands sort descending. | |
| static LONG | strcmpptr (ULONG pivot, ULONG elem) |
Variables | |
| static UWORD | sdir |
| #define FFP_CC_ | ( | cc, | |
| pivot, | |||
| elem, | |||
| ffp ) |
| #define GT_F | ( | p, | |
| v, | |||
| f ) |
| #define GT_S | ( | p, | |
| v, | |||
| f ) |
| #define SCAN_DOWN | ( | T, | |
| COND, | |||
| R, | |||
| p ) |
| #define SCAN_UP | ( | T, | |
| COND, | |||
| R, | |||
| p ) |
| void dosort | ( | ULONG | base, |
| const UBYTE * | args, | ||
| const void * | ffp ) |
Sort Arrayname() - sort the whole array in place.
"The Blitz 1 Sort algorithm": a recursive Hoare quicksort, ascending or descending as set by SortUp/SortDown. !args{$38} (array|arrayend| unknown): the compiler passes the base of the array data in d0 and pushes the end address (long) and the element type (word); the routine reads them with MOVE.l -(a2),a1 / MOVE -(a2),d1. Types: 1 byte, 2 word, 5 float (mathffp SPCmp), 7 string (strcomplib $CE02 on the string pointers), everything else (3 long, 4 quick) as signed longs. The original leaves a2 decremented by 6; the compiler does not use a2 afterwards.
Fixed (#275): for word arrays the pivot is read as a word, the middle element (the original read it with MOVE.l and compared with CMP.w: the element after the middle one, for a one element array the word behind the array; reads only, the result was right).
Fixed (#276): string elements that were never assigned (pointer 0) are the empty string (the original read their length from -4(0)).
| base | d0: the base (lowest element) of the array data |
| args | a2: the stack pointer before the pushes: -4 = the end address (long), -6 = the element type (word) |
| ffp | a6: the mathffp base (ffplib), for float arrays |
| void dosortdown | ( | void | ) |
SortDown - the following Sort commands sort descending.
MOVE #-1,sdir.
| void dosortup | ( | void | ) |
SortUp - the following Sort commands sort ascending.
CLR sdir. Also the library's init (BLITZ_NULLSUB_AT): ascending is the default.
|
static |
|
static |