SPL is the Original HP 3000 Systems Language
SPL stands for "Systems Programming Language." It is an
Algol-based language that was introduced with the original
HP 3000. All of the systems code for
MPE was written in SPL, rather than in Assembly language.
HP did not convert SPL to Native mode when they
migrated MPE
to the PA-RISC, but some third-party
programmers did. Their native-mode SPL compiler is called
SPLash!, a compiler that
can even generate code for HP-UX.
Here are some SPL tips from the 1985 SMUG IV book:
Efficiency
- Avoid ASSEMBLE and TOS because they make the programs hard to understand.
- INTEGER is the most efficient data-type.
- Use LOGICAL only for items that are flags or that must be unsigned, such as dates from the CALENDAR intrinsic.
- Don't use BYTE arrays for small integers unless you check for overflow manually -- SPL uses INTEGER arithmetic.
- Use a ripple move to initialize arrays to zero or blank, instead of using a FOR statement or moving a full literal constant.
BUF := ""; MOVE BUF(1) := BUF, (65)
.
- Use word moves instead of byte moves where possible.
- Use SCAN and MOVE-WHILE, but don't warp the problem to fit them. To get the length, use variable := MOVE|SCAN.
- Use local variables and parameters before global variables.
- Data stack size equals global variables plus the deepest nesting of local variables.
- Remember that your stack is expanded dynamically by MPE, but must be contracted manually by calling ZSIZE.
- Use a VALUE parameter instead of a reference when you don't intend to pass back a result; VALUE is more efficient and better. You can pass in an expression, you can use it as a local variable, and you have less chance of disrupting the caller.
- Use =PB constant arrays locally, or literals such as "ABC", before using global arrays.
Recommended Subset of SPL
Statements to use freely:
Assignment, MOVE, Procedure call, Subroutine call, IF, CASE,
WHILE, DO-UNTIL, and BEGIN-END.
Statements requiring caution:
SCAN and MOVE WHILE.
Statements to avoid:
GO TO, RETURN, ASSEMBLE, FOR, PUSH, and SET.
Data structures to use freely:
Constants and EQUATEs, simple variables, arrays (first element = 0),
DEFINEs, and types BYTE, INTEGER, LOGICAL and DOUBLE.
Data structures requiring caution:
REAL and LONG in files (they are
not compatible with COBOL), POINTERs and bit fields.
Data structures to avoid:
TOS except after MOVE/SCAN, =register except =PB, and
bit fields in permanent files (other languages can't handle them).
Suggested SPL Style
Follow the rules of structured programming
and aim for a clear programming style.
Use EQUATEs for integer constants, except 0 and 1. Use
DEFINEs for other numeric constants.
Use equivalenced arrays and length-EQUATEs to construct
records.
Use SUBROUTINEs to decompose PROCEDUREs into modules.
Insert a $PAGE command before each module declaration.
For local SUBROUTINE variables, declare dummy VALUE parameters.
Use $INCLUDE files for any data or code that should
be the same in several programs.