mirror of
https://git.code.sf.net/p/newrpl/sources
synced 2024-11-16 19:51:25 +01:00
d117776c9d
Added SORT command.
67 lines
2.3 KiB
C
67 lines
2.3 KiB
C
/*
|
|
* Copyright (c) 2014, Claudio Lapilli and the newRPL Team
|
|
* All rights reserved.
|
|
* This file is released under the 3-clause BSD license.
|
|
* See the file LICENSE.txt that shipped with this distribution.
|
|
*/
|
|
|
|
#include "newrpl.h"
|
|
|
|
// EXTERNAL RPL MACHINE REGISTERS
|
|
|
|
|
|
// GLOBAL ARRAY OF POINTERS THAT ARE TO BE UPDATED BY THE GC
|
|
WORDPTR GC_PTRUpdate[MAX_GC_PTRUPDATE];
|
|
|
|
// MEMORY REGIONS. EACH MEMORY REGION CAN GROW INDEPENDENTLY
|
|
// GROWTH MAY TRIGGER A GC IF INSUFFICIENT MEMORY.
|
|
|
|
WORDPTR *RStk; // BASE OF RETURN STACK
|
|
WORDPTR *DStk; // BASE OF DATA STACK
|
|
WORDPTR *DStkProtect; // BASE OF THE PROTECTED STACK
|
|
WORDPTR TempOb; // TEMPORARY OBJECT STORAGE
|
|
WORDPTR *TempBlocks; // TEMPOB BLOCK POINTERS STORAGE
|
|
WORDPTR *Directories; // BASE OF DIRECTORY STORAGE
|
|
WORDPTR *LAMs; // BASE OF LOCAL VARIABLES STORAGE
|
|
|
|
// OTHER VARIABLES THAT ARE NOT AFFECTED BY GC
|
|
WORD CurOpcode; // CURRENT OPCODE (WORD)
|
|
WORD Exceptions, TrappedExceptions; // FLAGS FOR CURRENT EXCEPTIONS
|
|
WORDPTR *RSTop; // TOP OF THE RETURN STACK
|
|
WORDPTR *DSTop; // TOP OF THE DATA STACK
|
|
WORDPTR *LAMTop; // TOP OF THE LAM STACK
|
|
WORDPTR *nLAMBase; // START OF THE LAST LAM ENVIRONMENT
|
|
WORDPTR *ValidateTop; // TEMPORARY DATA AFTER THE RETURN STACK USED DURING COMPILATION
|
|
WORDPTR *LAMTopSaved; // SAVED VALUE OF LAMTOP USED DURING COMPILATION
|
|
WORDPTR *ErrornLAMBase; // SAVED BASE OF LAM ENVIRONMENT AT ERROR HANDLER
|
|
WORDPTR *ErrorLAMTop; // SAVED VALUE OF LAMTOP AT ERROR HANDLER
|
|
WORDPTR *ErrorRSTop; // SAVED TOP OF RETURN STACK AT ERROR HANDLER
|
|
WORDPTR *TempBlocksEnd; // END OF THE TEMPOB BLOCKS
|
|
WORDPTR *CurrentDir; // POINTER TO CURRENT DIRECTORY
|
|
WORDPTR *DirsTop; // POINTER TO END OF USED DIRECTORIES
|
|
BINT DStkSize; // TOTAL SIZE OF DATA STACK
|
|
BINT RStkSize; // TOTAL SIZE OF RETURN STACK
|
|
BINT TempBlocksSize;
|
|
BINT LAMSize;
|
|
BINT DirSize;
|
|
|
|
// ARGUMENTS TO PASS TO LIBRARY HANDLERS
|
|
// DURING COMPILATION
|
|
UBINT ArgNum1,ArgNum2,ArgNum3,RetNum;
|
|
|
|
|
|
|
|
LIBHANDLER LowLibRegistry[MAXLOWLIBS];
|
|
LIBHANDLER HiLibRegistry[MAXHILIBS];
|
|
BINT HiLibNumbers[MAXHILIBS];
|
|
BINT NumHiLibs;
|
|
|
|
// MULTIPRECISION LIBRARY CONTEXT
|
|
mpd_context_t Context;
|
|
|
|
// PREALLOCATED STATIC REAL NUMBER REGISTERS FOR TEMPORARY STORAGE
|
|
mpd_t RReg[REAL_REGISTERS];
|
|
// TEMPORARY SCRATCH MEMORY FOR DIGITS
|
|
mpd_uint_t RDigits[REAL_SCRATCHMEM];
|
|
|
|
BINT BINT2RealIdx;
|