The Semware Editor Professional SAL language rules: SAL is a computer languages used by The Semware Editor Professional (=TSE) text editor. The acronym 'SAL' stands for 'SemWare Application Language'. SAL is not the same as Pascal. SAL is not the same as C or C++. In SAL we use 'NOT (x in y)' instead of 'x not in y' In SAL you write: 'NOT ( SubStr(resultS, 2, 1) in "." )' and you do not write 'SubStr(resultS, 2, 1) not in "."' SAL does not use ';' to terminate. SAL does not use begin ... end like in Pascal SAL does not use '{' ... '}' but uses IF ... ENDIF instead SAL does not use '{' ... '}' but uses WHILE ... ENDWHILE instead SAL does not use '{' ... '}' but uses REPEAT ... UNTIL instead SAL does not use '{' ... '}' but uses DO ... TIMES ... ENDDO instead SAL does not know the keyword 'LOOP' A SAL program uses always a 'PROC Main() ... END' as the start of the program In SAL 'PROC Main() ... END' is always the last function in the program SAL uses 'proc' instead of 'procedure' SAL uses 'integer proc' when an integer result of a function is expected SAL uses 'string proc' when a string result of a function is expected In SAL 'mod' is used instead of '%' In SAL is no direct support for arrays except through DLL calls or custom implementations. SAL does not know integer arrays, like 'integer primes[10]' In SAL arrays could be simulated by using the numbered lines in a buffer file instead. SAL does not know '+=' SAL uses '==' when comparing 2 values. In SAL add a capital 'I' at the end of an integer variable name. This is just a convenience for me personally. In SAL add a capital 'S' at the end of an string variable name. This is just a convenience for me personally. Better use 'Warn()' instead of 'Message()' when wanting to show the resulting output. In Warn() using a ',' does not print a space after the value. In Warn() using a ';' prints a space after the value. In SAL one can not use Warn( x; ) it has to be Warn( x ) In SAL 'return' values of a function must be put between '()' parenthesis. E.g. return( I ) In SAL functions must already be known when they are called, by putting those functions first (=on top) in the program. In SAL functions can get the word FORWARD in front to make those functions known to other functions coming after it. In SAL 'FORWARD' declarations have to be put in the beginning of the program and they start with the keyword 'FORWARD' E.g. FORWARD STRING PROC FNEvaluateSimpleExpressionS(STRING exprS, INTEGER decimalI) In SAL the default file extension of SAL program is '.s' In SAL all variable initializations for a string must be placed immediately after the function header or procedure header. In SAL all variable initializations for an integer must be placed immediately after the function header or procedure header. In SAL one can not declare string or integer in the middle of the function, these initializations should be placed immediately after the function definition header. E.g. string variableName[size] = "initialValue" integer variableName = initialValue One can not intermix statements with declarations thus. In SAL 'a != b' is not used. Use instead 'not ( a == b )' In SAL 'SubStr(resultS, 2, 1) != "."' should be written instead as 'NOT( SubStr(resultS, 2, 1) == "." )' SAL does not know the 'Sqrt()' function In SAL when initializing a string one has to indicate the amount of characters in that string. E.g. 'string s[255] = ""' and not 'string s' thus. 'Message' is a reserved keyword in SAL. 'Pos' is a reserved keyword in SAL. SAL uses the Borland C++ command line compiler version 5.5 The Borland C++ compiler automatically adds an underscore '_' prefix to exported function names. SAL example using a DLL: dll "" integer proc MessageBox( integer hwndOwner, //handle of owner window string lpszText : cstrval, //address of text in message box string lpszTitle: cstrval, //address of title of message box integer fuStyle //style of message box ) : "MessageBoxA" end #define NULL 0 // some sample styles #define MB_OK 0x00000000 #define MB_OKCANCEL 0x00000001 #define MB_ABORTRETRYIGNORE 0x00000002 #define MB_YESNOCANCEL 0x00000003 #define MB_YESNO 0x00000004 #define MB_RETRYCANCEL 0x00000005 #define MB_ICONHAND 0x00000010 #define MB_ICONQUESTION 0x00000020 #define MB_ICONEXCLAMATION 0x00000030 #define MB_ICONASTERISK 0x00000040 proc PopMsg(string title, string text) MessageBox(GetWinHandle(), text, title, MB_OK) end PROC Main() PopMsg( "Title goes here", "This is the text" + chr(10) + "of the message" ) END In SAL the keyword 'Query()' is not used when requesting for user input. Instead 'Ask()' is used. The correct syntax for 'Ask()' is that the input result has to be assigned to an already declared string. For example: proc Main() string s1[255]="" if Ask( "Enter your choice = ", s1 ) Warn( s1 ) endif end In SAL if you want to add history to you add ', _EDIT_HISTORY' for example: Ask("Enter first number: ", num1S, _EDIT_HISTORY_ ) In SAL comments start with // for single line or /* */ for multi-line #define is used for constants or macros. SAL uses chr() to get character codes, e.g., chr(10) for newline. In SAL string concatenation is done using 'Format()' or otherwise '+'. In SAL no foreach loop, you would simulate this with a DO ... TIMES ... ENDDO loop. In SAL regarding strings: strings must specify their size, e.g., string myString[255] = "" In SAL regarding integers: no arrays, only scalar integer values. In SAL there is no built-in support for floating-point numbers except through DLL calls or external .exe files calling with Dos() and passing parameters or custom implementations. In SAL the function 'Len()' does not exist, the correct name is 'Length()' In SAL there exists no keyword 'XOR'. In SAL the maximum string length is 255 characters. For example: string s[255] = "" In SAL a 'constant' can only be an integer, a constant can not be a string. SAL does not know 'double' In SAL if the dll_file is enclosed within <>, the editor allows the operating system to search the default DLL search path. Thus, a dll_file of "" would be found in the Windows system directory. In SAL outside of a DLL declaration you can not use cstrval. So this is the correct definition instead: integer proc RegOpenKeyEx(integer hKey, string subKey, integer options, integer access, var integer result ) In SAL 'keyname' is a reserved name. SAL does not know 'void'. In SAL CASE caseS WHEN "a" WHEN "b" WHEN "c" OTHERWISE ENDCASE or CASE I WHEN 1 WHEN 2 WHEN 5 OTHERWISE ENDCASE In SAL one can not reassign a constant string parameter: in SAL string names parameters in the function header are constants and cannot be modified later. In SAL regarding this 'Can not reassign constant string' error, you should rename the variable name in the function name, then declare a new variable after the function definition and assign the renamed variable to it. For example: PROCTest( STRING inS ) STRING s[255] = inS END