<?xml version="1.0"?>
<!DOCTYPE riscos-prm PUBLIC "-//Gerph//DTD PRM documentation 1.03//EN"
                            "http://gerph.org/dtd/103/prm.dtd">

<riscos-prm>
<chapter title="Twin">
<section title="Introduction and Overview">
<p>
The Twin module provides editing facilities for BBC BASIC, and for text files in general.
Originally the Twin module was supplied with Arthur as a full screen editor. Under
RISC OS Pyromaniac the modules provides access to configurable text editors.
</p>

<p>
    <version-table>
        <version supplier="RISC OS Pyromaniac" riscos-ge="7.03" state="supported"/>
    </version-table>
</p>

</section>


<section title="Technical details">
<p>
The Twin editor is traditionally involved by issuing the <userinput>TWIN</userinput>
command from within BASIC. This command launches the Twin editor with the current BASIC
program. When the Twin editor returns to BASIC, the program will be reloaded.
</p>

<p>
    Under RISC OS Pyromaniac, the Twin module functions by invoking the configured
    Text Editor on the file, before returning to BASIC. By default, the text editor
    is configured to invoke the 'nano' editor, which is available for most POSIX
    based systems. The implementation to use may be set using the
    'texteditor.implementation' configuration.
</p>
<p>
    The text editor may be configured to use alternative implementations
    which have different presentations. One such alternative is the 'wxwidgets'
    implementation, which opens a new window to edit the text file.
</p>
<p>
    In addition, the Twin module also provides the ability to start the editor
    on any file on disc with the command
    <userinput>*Edit <userreplace>file</userreplace></userinput>. This command
    can also take the optional switch '-view', which makes the content read
    only.
</p>

<p>
    The module may be disabled entirely with the 'twin.enable' setting, if its
    use might cause problems for the system.
</p>
</section>


<section title="*Commands">
<command-definition name="Twin"
                    description="Start the Twin editor with current BASIC program">

<syntax>
  <text>@</text>
  <userreplace>start</userreplace>
  <text>,</text>
  <userreplace>end</userreplace>
</syntax>

<parameter name="start">
 Address in memory of the start of the text content to be edited, as a Hexadecimal number.
</parameter>

<parameter name="end">
 Address in memory of the end of the text content to be edited, as a Hexadecimal number.
</parameter>

<use>
<p>This command is used to start the Twin editor on a block of memory. When finished,
the content will be loaded into BASIC using a command like <command>BASIC @8f00,9102</command>.
</p>
</use>

<example>
<command>*Twin @9008,a124</command>
</example>


<related>
<reference type="command" name="Edit" />
</related>

</command-definition>


<command-definition name="Edit"
                    description="Start the Twin editor with a specific file">

<syntax>
    <optional>
        <switch name="view"/>
    </optional>
    <userreplace>filename</userreplace>
</syntax>

<parameter name="filename">
 Name of the RISC OS file which is to be edited in place, or viewed.
</parameter>

<parameter switch="view">
 Only view the text file. Makes the content read only and never
 saves back to the original file.
</parameter>

<use>
<p>This command is used to start the Twin editor on a file. The command options allow the
editor to be launched in read only mode.</p>
</use>

<compatibility>
    <version supplier="RISC OS Pyromaniac" riscos-ge='7.34' state='supported'/>
</compatibility>

<example>
<command>*Edit $.MyApp.VersionNum</command>
</example>


<related>
<reference type="command" name="Twin" />
</related>

</command-definition>


</section>

</chapter>

<!-- MetaData -->
<meta>
 <maintainer>
  <email name="Gerph" address="gerph@gerph.org" />
 </maintainer>
 <disclaimer>
    <p>
        &copy; Gerph, 2022-23.
    </p>
 </disclaimer>

 <history>
  <revision number="1" author="Gerph" date="26 Dec 2022" title="Initial version">
    <change>Created some basic information on how the Twin module works.</change>
  </revision>
  <revision number="2" author="Gerph" date="20 Sep 2023" title="Version information">
    <change>Version information added.</change>
  </revision>
 </history>
</meta>
</riscos-prm>
