Superbase NG Programmer's Guide Getting to Grips with the SIMPOL Language
Total Page:16
File Type:pdf, Size:1020Kb
Superbase NG Programmer's Guide Getting to Grips with the SIMPOL Language Neil Robinson Superbase NG Programmer's Guide: Getting to Grips with the SIM- POL Language by Neil Robinson Copyright © 2001-2017 Superbase Software Limited All rights reserved. The programs and documentation in this book are not guaranteed to be without defect, nor are they declared to be fit for any specific purpose other than instruction in the use of the programming language SIMPOL. It is entirely possible (though not probable) that use of any sample program code in this book could reformat your hard disk, disable your computer forever, fry your dog in a microwave oven, and even cause a computer virus to infect you by touching the keyboard, though none of these things is terribly likely (after all, almost anything is possible). It is just that most things are extremely improbable. Table of Contents 1. Introduction .............................................................................................................. 1 Copyright Information ............................................................................................ 1 Disclaimer ............................................................................................................ 1 New Versions of this Document ............................................................................... 1 Software Used ....................................................................................................... 1 I. Quick Start With SIMPOL ........................................................................................... 3 2. Introduction ...................................................................................................... 7 Local Variables, Objects, and Values ................................................................ 7 Constants ..................................................................................................... 7 Function Parameters ....................................................................................... 8 Statements .................................................................................................... 8 Intrinsic Functions ......................................................................................... 9 Operators ..................................................................................................... 9 Complex Object Types ................................................................................... 9 Flow Control ............................................................................................... 10 File Types .................................................................................................. 11 Source Files ........................................................................................ 11 Compiled Files .................................................................................... 11 Debug Information ............................................................................... 12 II. SIMPOL Language Basics ........................................................................................ 13 3. Basic SIMPOL Grammatical Stucture .................................................................. 17 End of Statement Characters .......................................................................... 17 Line Continuation Character .......................................................................... 17 Line Breaks and White Space ........................................................................ 17 Comments .................................................................................................. 17 Literals ....................................................................................................... 18 Case-sensitivity ............................................................................................ 19 Identifiers ................................................................................................... 19 Reserved Words .......................................................................................... 19 4. Data Types, Values, and Ranges ......................................................................... 21 Blobs ......................................................................................................... 21 Booleans ..................................................................................................... 21 Integers ...................................................................................................... 21 Numbers ..................................................................................................... 21 Strings ....................................................................................................... 22 Pre-Defined Values ...................................................................................... 22 Functions .................................................................................................... 22 Supplied Types ............................................................................................ 23 A Word About Arrays .................................................................................. 25 User-Defined Types ..................................................................................... 26 5. Operators and Expressions ................................................................................. 31 Operator Overview ....................................................................................... 31 Assignment Operators ................................................................................... 31 Arithmetic Operators .................................................................................... 32 Comparison Operators .................................................................................. 32 Logical Operators ........................................................................................ 33 Bitwise Operators ........................................................................................ 33 Object Operators .......................................................................................... 34 Expressions and Statements ........................................................................... 35 6. Statements and Flow Control .............................................................................. 37 function ................................................................................................. 37 if ............................................................................................................. 37 while ....................................................................................................... 37 7. Variables ........................................................................................................ 39 Variable Typing ........................................................................................... 39 iii Superbase NG Programmer's Guide Declaring Variables ...................................................................................... 39 Variable and Type Scope and Visibility ........................................................... 40 Value Types, Reference Types, and Type Tags ................................................. 41 Variable and Object Persistence ..................................................................... 42 8. Intrinsic Functions ............................................................................................ 45 The Nature of Intrinsic Functions ................................................................... 45 Compression Functions ................................................................................. 45 Conversion Functions ................................................................................... 45 Numeric Functions ....................................................................................... 46 Selection Functions ...................................................................................... 46 Blob Functions ............................................................................................ 46 String Functions .......................................................................................... 47 9. System Functions ............................................................................................. 49 The Nature of System Functions ..................................................................... 49 The !beginthread() Function .................................................................. 49 The !loadmodule() Function .................................................................... 49 The !wait() Function ................................................................................ 50 10. User-Defined Functions ................................................................................... 51 Defining and Calling Functions ...................................................................... 51 Function Scope ............................................................................................ 51 Function References (Pointers) ....................................................................... 51 III. Web Server Applications — CGI, ISAPI, and FastCGI for Dynamic Web Content .............. 53 11. SIMPOL Web Server Applications .................................................................... 57 Introduction ...............................................................................................