ScriptBasic:UsersGuide
From ScriptBasic
ScriptBasic Users Guide
by Peter Verhas
Table of Contents
- 1. Introduction
- 2. Using ScriptBasic
- 3. Installation Instructions
- 4. Code caching
- 5. Compiling BASIC programs
- 6. Compiling BASIC program to EXE
- 7. Compiling BASIC programs to C
- 8. Compiling ScriptBasic with modules
- 9. General Language Format
- 9.1. Hello World
- 9.2. Strings
- 9.3. Numbers
- 9.4. Variables
- 9.5. Constants
- 9.6. Forcing Variable Declaration
- 9.7. Arrays
- 9.8. Associative Arrays
- 9.9. Using Array Mixed Mode
- 9.10. Expressions
- 9.10.1. Operators
- 9.10.1.1. Power operator (^)
- 9.10.1.2. Multiplication operator (*)
- 9.10.1.3. Division operator (/)
- 9.10.1.4. Integer division operator (\)
- 9.10.1.5. Modulus operator (%)
- 9.10.1.6. Addition and subtraction operators (+, -)
- 9.10.1.7. Bit-wise and logical NOT (NOT)
- 9.10.1.8. Equality operator (=)
- 9.10.1.9. Not equal operator (<>)
- 9.10.1.10. Compare operators (<, <=, >, >=)
- 9.10.1.11. Logical operators (and, or, xor)
- 9.10.1.12. Concatenation operator (&)
- 9.10.1.13. ByVal operator
- 9.10.1.14. LIKE operator
- 9.10.1.15. Extension operators
- 9.10.1.16. Planned, Future Operators
- 9.10.1.1. Power operator (^)
- 9.10.1. Operators
- 9.11. Assignments (LET)
- 9.12. Operator Assignments
- 9.13. Comments
- 9.14. Including Files
- 9.15. Internal preprocessors
- 9.16. Using external preprocessor
- 9.17. #! /usr/bin/scriba
- 9.18. @goto start
- 9.19. #!/@goto
- 9.1. Hello World
- 10. Interacting with the user
- 11. Name spaces
- 12. File Handling
- 12.1. Opening and creating files
- 12.2. Text and binary files
- 12.3. Switching between binary and text mode
- 12.4. Getting a free file number
- 12.5. Positioning in a file
- 12.6. Reading and writing files
- 12.7. Getting and setting the current working directory
- 12.8. Locking a file
- 12.9. Locking file range
- 12.10. Truncating a file
- 12.11. Deleting a file or directory
- 12.12. Creating a directory
- 12.13. Setting file parameters
- 12.14. Listing files
- 12.1. Opening and creating files
- 13. Networking
- 14. String handling commands
- 15. Conditional Execution
- 16. The statement GOTO
- 17. Loop constructs
- 18. Functions and Subroutines
- 18.1. Declaration of subroutines and function
- 18.2. Calling functions and subroutines
- 18.3. Returning a value
- 18.4. Local and global variables
- 18.5. More on local and global variables
- 18.6. Parameters passed by value and by reference
- 18.7. ByVal command
- 18.8. Calling functions indirectly
- 18.9. GOSUB and RETURN
- 18.1. Declaration of subroutines and function
- 19. Reference Variables
- 20. Pattern matching
- 21. Handling run-time errors
- 22. Setting options
- 23. Other miscellaneous commands
- 24. Using External modules
- 25. Command reference
- 25.1. ABS
- 25.2. ACOS
- 25.3. ACOSECANT
- 25.4. ACTAN
- 25.5. ADDDAY
- 25.6. ADDHOUR
- 25.7. ADDMINUTE
- 25.8. ADDMONTH
- 25.9. ADDRESS( myFunc() )
- 25.10. ADDSECOND
- 25.11. ADDWEEK
- 25.12. ADDYEAR
- 25.13. ASC(string)
- 25.14. ASECANT
- 25.15. ASIN
- 25.16. ATAN
- 25.17. ATN
- 25.18. BINMODE [ # fn ] | input | output
- 25.19. CALL subroutine
- 25.20. CHDIR directory
- 25.21. CHOMP()
- 25.22. CHR(code)
- 25.23. CLOSE [ # ] fn
- 25.24. CLOSE DIRECTORY [#] dn
- 25.25. COMMAND()
- 25.26. Concatenate operator &
- 25.27. CONF("conf.key")
- 25.28. COS
- 25.29. COSECANT
- 25.30. COTAN
- 25.31. COTAN2
- 25.32. CRYPT(string,salt)
- 25.33. CURDIR()
- 25.34. DAY
- 25.35. DECLARE COMMAND function ALIAS cfun LIB library
- 25.36. DECLARE SUB function ALIAS cfun LIB library
- 25.37. DELETE file/directory_name
- 25.38. DELTREE file/directory_name
- 25.39. DO
- 25.40. DO UNTIL condition
- 25.41. DO WHILE condition
- 25.42. END
- 25.43. ENVIRON("envsymbol") or ENVIRON(n)
- 25.44. EOD(dn)
- 25.45. EOF(n)
- 25.46. ERROR() or ERROR n
- 25.47. ERROR$() or ERROR$(n)
- 25.48. EVEN
- 25.49. EXECUTE("executable_program", time_out,pid_v)
- 25.50. EXIT FUNCTION
- 25.51. EXIT SUB
- 25.52. EXP
- 25.53. FALSE
- 25.54. FILEACCESSTIME(file_name)
- 25.55. FILECOPY filename,filename
- 25.56. FILECREATETIME(file_name)
- 25.57. FILEEXISTS(file_name)
- 25.58. FILELEN(file_name)
- 25.59. FILEMODIFYTIME(file_name)
- 25.60. FIX
- 25.61. LOCK # fn, mode
- 25.62. FOR var=exp_start TO exp_stop [ STEP exp_step ]
- 25.63. FORK()
- 25.64. FORMAT()
- 25.65. FORMATDATE
- 25.66. FILEOWNER(FileName)
- 25.67. FRAC
- 25.68. FREEFILE()
- 25.69. FUNCTION fun()
- 25.70. GMTIME
- 25.71. GMTOLOCALTIME
- 25.72. GOSUB label
- 25.73. GOTO label
- 25.74. HCOS
- 25.75. HCOSECANT
- 25.76. HCTAN
- 25.77. HEX(n)
- 25.78. HOSTNAME()
- 25.79. HOUR
- 25.80. HSECANT
- 25.81. HSIN
- 25.82. HTAN
- 25.83. ICALL n,v1,v2, ... ,vn
- 25.84. IF condition THEN
- 25.85. INPUT(n,fn)
- 25.86. INSTR(base_string,search_string [ ,position ] )
- 25.87. INSTRREV(base_string,search_string [ ,position ] )
- 25.88. INT
- 25.89. ISARRAY
- 25.90. ISDEF
- 25.91. ISDIRECTORY(file_name)
- 25.92. ISEMPTY
- 25.93. ISINTEGER
- 25.94. ISNUMERIC
- 25.95. ISREAL
- 25.96. ISFILE(file_name)
- 25.97. ISSTRING
- 25.98. ISUNDEF
- 25.99. JOIN(joiner,str1,str2,...)
- 25.100. JOKER(n)
- 25.101. KILL(pid)
- 25.102. LBOUND
- 25.103. LCASE()
- 25.104. LEFT(string,len)
- 25.105. LEN()
- 25.106. v = expression
- 25.107. v &= expression
- 25.108. v /= expression
- 25.109. v \= expression
- 25.110. v -= expression
- 25.111. v += expression
- 25.112. v *= expression
- 25.113. string LIKE pattern
- 25.114. LINE INPUT
- 25.115. LOC()
- 25.116. LOCATLTOGMTIME
- 25.117. LOCK REGION # fn FROM start TO end FOR mode
- 25.118. LOF()
- 25.119. LOG
- 25.120. LOG10
- 25.121. LTRIM()
- 25.122. MID(string,start [ ,len ])]
- 25.123. MINUTE
- 25.124. MKDIR directory_name
- 25.125. MONTH
- 25.126. NAME filename,filename
- 25.127. NEXTFILE(dn)
- 25.128. NOW
- 25.129. OCT(n)
- 25.130. ODD
- 25.131. ON ERROR GOTO [ label | NULL ]
- 25.132. ON ERROR RESUME [ label | next ]
- 25.133. OPEN file_name FOR mode AS [ # ] i [ LEN=record_length ]
- 25.134. OPEN DIRECTORY dir_name PATTERN pattern OPTION option AS dn
- 25.135. OPTION symbol value
- 25.136. OPTION("symbol")
- 25.137. pack("format",v1,v2,...,vn)
- 25.138. PI
- 25.139. POW
- 25.140. PRINT [ # fn , ] print_list
- 25.141. RANDOMIZE
- 25.142. ref v1 = v2
- 25.143. REPEAT
- 25.144. REPLACE(base_string,search_string,replace_string [,number_of_replaces] [,position])
- 25.145. RESET
- 25.146. RESET DIRECTORY [#] dn
- 25.147. RESUME [ label | next ]
- 25.148. RETURN
- 25.149. REWIND [ # ]fn
- 25.150. RIGHT(string,len)
- 25.151. RND
- 25.152. ROUND
- 25.153. RTRIM()
- 25.154. SEC
- 25.155. SECANT
- 25.156. SEEK fn,position
- 25.157. SET FILE filename parameter=value
- 25.158. SET JOKER "c" TO "abcdefgh..."
- 25.159. SET WILD "c" TO "abcdefgh..."
- 25.160. SIN
- 25.161. SLEEP(n)
- 25.162. SPACE(n)
- 25.163. SPLIT string BY string TO var_1,var_2,var_3,...,var_n
- 25.164. SPLITA string BY string TO array
- 25.165. SQR
- 25.166. STOP
- 25.167. STR(n)
- 25.168. STRING(n,code)
- 25.169. STRREVERSE(string)
- 25.170. SUB fun()
- 25.171. SYSTEM(executable_program)
- 25.172. TAN
- 25.173. TAN2
- 25.174. TEXTMODE [ # fn] | input | output
- 25.175. TIMEVALUE
- 25.176. TRIM()
- 25.177. TRUE
- 25.178. TRUNCATE fn,new_length
- 25.179. TYPE
- 25.180. UBOUND
- 25.181. UCASE()
- 25.182. UNDEF variable
- 25.183. UNPACK string BY format TO v1,v2,...,vn
- 25.184. VAL
- 25.185. WEEKDAY
- 25.186. WHILE condition
- 25.187. YEAR
- 25.188. YEARDAY
- 25.1. ABS