Scripting

From RISC OS

(Difference between revisions)
Jump to: navigation, search
(Formati)
(Removing Ruby, Tcl and Bash as no longer maintained and the latter does not work for most commands)
 
(7 intermediate revisions not shown)
Line 1: Line 1:
-
''Scripting could be described as programming for the lazy. Scripting languages are designed to get a lot of useful work done with a small amount of code. This article is a collaborative effort to describe what scripting languages are available for RISC OS, and how they can be used.''
+
Scripting in short, is a high level sequence of commands, usually without the strong typing of compiled languages. This is an overview of scripting languages available for RISC OS.
 +
 
 +
==Languages==
*[http://lua.riscos.org.uk/ Lua]
*[http://lua.riscos.org.uk/ Lua]
*[http://www.alexwaugh.com/perl/ Perl]
*[http://www.alexwaugh.com/perl/ Perl]
-
*[http://www.cp15.org/php/ PHP]
+
*[[PHP]]
-
*[http://python.acorn.de/ Python]
+
*[http://www.schwertberger.de/python.html Python] (see also [http://www.riscosports.co.uk/python27.zip Python 2.7.2] for modern systems)
-
 
+
-
No longer supported?
+
-
 
+
-
*[[Ruby]] Ported by Reuben Thomas.  
+
-
*[[Tcl]] Ported by C.T.Stretch.
+
==What is a scripting language?==
==What is a scripting language?==
RISC OS is controlled by Obey files. These contain scripts for a command language. It is rather a limited language; its
RISC OS is controlled by Obey files. These contain scripts for a command language. It is rather a limited language; its
-
variables we call ''system variables'', and its facilities for conditional or looping structures are rudimentary. For this reason, '''Basic ''' is often used in situations where Obey files are insufficiently expressive. The OSCLI command allows one to build up Obey commands using Basic variables. In other words, Basic has a useful role to play as a scripting language. However, Basic lacks certain facilities that are often needed for scripting, namely:
+
variables we call ''system variables'', and its facilities for conditional or looping structures are rudimentary. For this reason, '''Basic ''' is often used in situations where Obey files are insufficiently expressive. The OSCLI command allows one to build up Obey commands using Basic variables. In other words, Basic has a useful role to play as a scripting language. However, BASIC lacks certain facilities that are often needed for scripting, namely:
-
* Passing parameters into a Basic program via the command line is not straightforward.
+
* Passing parameters into a BASIC program via the command line is not straightforward.
* Basic has no mechanism for iterating over objects in a directory, without recourse to SWIs.
* Basic has no mechanism for iterating over objects in a directory, without recourse to SWIs.
* Basic has only rudimentary facilities for pattern matching.
* Basic has only rudimentary facilities for pattern matching.
* Basic strings are limited in size - you cannot load a whole file in as a single string.
* Basic strings are limited in size - you cannot load a whole file in as a single string.
-
* Memory management is not automatic in Basic, so maximum sizes have to be guessed for DIM statements.
+
* Memory management is not automatic in BASIC, so maximum sizes have to be guessed for DIM statements.
The term ''scripting language'' is vague, but the languages described by it tend to have the following features:
The term ''scripting language'' is vague, but the languages described by it tend to have the following features:
Line 27: Line 24:
* They have powerful string-processing and pattern-matching facilities.
* They have powerful string-processing and pattern-matching facilities.
* They can read system variables and execute commands.
* They can read system variables and execute commands.
-
* The words on the commandline are available as an array of strings.
+
* The words on the command line are available as an array of strings.
* They support arrays or lists in various forms without the need for specifying a maximum number of components.
* They support arrays or lists in various forms without the need for specifying a maximum number of components.
As scripting languages evolved, these features were found to be useful for expressing command scripts concisely. Of course, many of these languages have also acquired other features, some of them appropriate for writing applications more ambitious than quick and dirty scripts. Almost all of them are interpreted. The interpreters are usually divided into two parts - a compiler that converts the source scripts into bytecodes for a virtual machine, and an emulator and runtime system for the virtual machine.
As scripting languages evolved, these features were found to be useful for expressing command scripts concisely. Of course, many of these languages have also acquired other features, some of them appropriate for writing applications more ambitious than quick and dirty scripts. Almost all of them are interpreted. The interpreters are usually divided into two parts - a compiler that converts the source scripts into bytecodes for a virtual machine, and an emulator and runtime system for the virtual machine.
 +
 +
== See Also ==
 +
 +
* [http://en.wikipedia.org/wiki/Scripting Wikipedia's Definition]
 +
* [[StrongED:Applying_scripts]] How to use scripts on the contents of StrongED windows.
 +
* [[Stick]] How to make wimp applications without writing wimp programs.

Latest revision as of 09:25, 21 November 2018

Scripting in short, is a high level sequence of commands, usually without the strong typing of compiled languages. This is an overview of scripting languages available for RISC OS.

Languages

What is a scripting language?

RISC OS is controlled by Obey files. These contain scripts for a command language. It is rather a limited language; its variables we call system variables, and its facilities for conditional or looping structures are rudimentary. For this reason, Basic is often used in situations where Obey files are insufficiently expressive. The OSCLI command allows one to build up Obey commands using Basic variables. In other words, Basic has a useful role to play as a scripting language. However, BASIC lacks certain facilities that are often needed for scripting, namely:

  • Passing parameters into a BASIC program via the command line is not straightforward.
  • Basic has no mechanism for iterating over objects in a directory, without recourse to SWIs.
  • Basic has only rudimentary facilities for pattern matching.
  • Basic strings are limited in size - you cannot load a whole file in as a single string.
  • Memory management is not automatic in BASIC, so maximum sizes have to be guessed for DIM statements.

The term scripting language is vague, but the languages described by it tend to have the following features:

  • Memory management is automatic. The claiming and freeing of memory ceases to be of concern.
  • They have powerful string-processing and pattern-matching facilities.
  • They can read system variables and execute commands.
  • The words on the command line are available as an array of strings.
  • They support arrays or lists in various forms without the need for specifying a maximum number of components.

As scripting languages evolved, these features were found to be useful for expressing command scripts concisely. Of course, many of these languages have also acquired other features, some of them appropriate for writing applications more ambitious than quick and dirty scripts. Almost all of them are interpreted. The interpreters are usually divided into two parts - a compiler that converts the source scripts into bytecodes for a virtual machine, and an emulator and runtime system for the virtual machine.

See Also

Personal tools