home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / rvtrn33 / REVTRAN.TXT < prev    next >
Text File  |  1995-02-16  |  21KB  |  469 lines

  1.                                   
  2.                            REVTRAN Manual
  3.                                   
  4.                    Version 3.3/3.3a, February 1995
  5.  
  6.  
  7. Introduction
  8.  
  9.    Revtran is a program for the Psion Series 3 or 3a, which reverse-
  10.    translates translated programs back into moderately intelligible
  11.    OPL source code.  It is written in OPL, and will run on the
  12.    Series 3/3a, or on Psion's Series 3 or 3a emulators (available
  13.    on CIX) which run on a PC.  Revtran processes both Series 3 and
  14.    Series 3a OPL programs.
  15.  
  16.  
  17. Uses
  18.  
  19.    You might use Revtran on your own programs, e.g. if you have
  20.    lost the source code, or you want to regress to an earlier
  21.    version of a program where you have deleted the earlier source
  22.    code.
  23.    
  24.    You might use Revtran on someone else's programs, for a variety
  25.    of reasons, for example:
  26.    
  27.    - to do minor bugfixes, and to make adjustments and improvements
  28.      to a user interface for your own use.
  29.    - to remove features that you don't use, and which are taking up
  30.      space.
  31.    - to understand the data file formats used, so you can read or
  32.      write them from another program.
  33.    - to convert a .OPO to a .OPA or vice versa.
  34.    - to extract, remove, replace or add an icon picture in a .OPA.
  35.    - to convert a Series 3a application to Series 3 (by removing
  36.      Series 3a-specific keywords etc).
  37.    - to learn from others' experience.
  38.    - NOT to hack into authorisation mechanisms etc.!
  39.    
  40.    NOTE: whatever your reason for using Revtran, please DO NOT
  41.    distribute any modified programs without the original author's
  42.    approval.  See the 'Ethics' section below.
  43.  
  44.  
  45. What's new in V3.3
  46.  
  47.    V3.3 is slightly modified from V3.2, to allow "WHILE" 
  48.    statements to be avoided in rare cases where they are 
  49.    inferred mistakenly.
  50.  
  51.    Previous versions fixed problems with IOOPEN, SEND, VECTOR, q-
  52.    code values $7e and $7f, negative single-byte integers, TYPE
  53.    codes, control-structure inference, and 'percentage' operators.
  54.  
  55.  
  56. Installation
  57.  
  58.    You should have unzipped the following files:
  59.    
  60.    REVTRAN.TXT  This file.
  61.    
  62.    RVTRN3.OPA   Series 3 version of the program.
  63.    
  64.    RVTRN3A.OPA  Series 3a version of the program.
  65.    
  66.    REVTRAN.TBL  A look-up table used by Revtran.
  67.    
  68.    Put REVTRAN.TBL in a \APP or \APP\REVTRAN directory on disk A, B
  69.    or M.  Put RVTRN3.OPA or RVTRN3A.OPA in any directory, and
  70.    "Install" it from the Sytem screen.
  71.    
  72.    RVTRN3.OPA will run on a Series 3a in "compatibility mode".
  73.    RVTRN3A.OPA provides identical functionality, but looks slightly
  74.    better.  It is larger mainly because of the larger icon picture.
  75.    Both programs will process Series 3 and 3a .OPO/.OPA files.
  76.    
  77.    You can rename the .OPA file to anything you like, but
  78.    REVTRAN.TBL must have that name.
  79.  
  80.  
  81. Memory/disk space requirements
  82.  
  83.    You will need about 32k bytes to store the two program files.
  84.    
  85.    In addition, at run-time Revtran needs up to roughly 30-35k,
  86.    depending on the most complex source-code line being
  87.    reconstructed.
  88.    
  89.    Also, don't forget you need space for the output file(s).
  90.  
  91.  
  92. Running the program
  93.  
  94.    Start the Revtran application, then choose appropriate items
  95.    from the menus presented, as follows.
  96.    
  97.    (Open File) This opens a .OPO or .OPA file and checks its basic
  98.    details.  The default directory for input files is \APP, but
  99.    normal Psion dialogs are used when selecting input and output
  100.    files, so you can use Tab or Control-Tab to change directory,
  101.    e.g. to \OPO.  It is also possible to open .IMG, .APP, .ALS,
  102.    .GRP and .PIC files; these contain no translated OPL code, but 
  103.    may contain an embedded PIC file (usually an Icon), which
  104.    Revtran can extract.  If you wish to access files in the
  105.    machine's internal ROM, do the following in the "Open input
  106.    file" dialog:
  107.  
  108.    1. With cursor on the top line, press Control-Tab.
  109.    2. Edit the "Full path" line to show "ROM::".
  110.    3. Press Control-Enter, then scroll the Name selector.
  111.    
  112.    (Write Icon) If the input file is an OPA and contains an icon
  113.    picture, you should write the picture out to a bitmap (.PIC)
  114.    file if you wish to reconstruct an identical .OPA later, because
  115.    the reverse-translated OPL source will need to make a reference
  116.    to the bitmap file.  Some other file types also have embedded
  117.    PIC files, possibly with multiple bitmaps, not all of which are 
  118.    icon-related (e.g. in ROM::WORLD.APP).  You can select which
  119.    bitmaps to write out; e.g. a pair of 48x48 bitmaps to describe
  120.    the black and grey planes of a Series 3a icon, or a 24x24
  121.    bitmap for a Series 3 icon.
  122.  
  123.    (Write OPL) When you write out reverse-translated OPL, you're
  124.    given the option of adding or discarding an APP..ENDA section,
  125.    by choosing an OPA or OPO module type.  If you keep or add an
  126.    APP..ENDA section, you'll be prompted for the parameters to
  127.    insert (although as many as possible are copied from the
  128.    original by default).  If you put a blank entry in the dialog
  129.    for PATH, EXT or ICON, then that line will be omitted from the
  130.    APP..ENDA section.
  131.    
  132.    If you choose to alter the 'Text features', you can adjust
  133.    several things.  You can change how new local variable and
  134.    procedure parameter names are invented, but bear in mind that
  135.    you may cause name clashes with global variables.  You can
  136.    choose 'Verbose' comments, so that 'REM' statements will be
  137.    added to the OPL output to record some numerical details which
  138.    may help in debugging a Revtran problem.  You can choose
  139.    Hexadecimal output for all integer literals, although some
  140.    integer literals will be output in hex even if Decimal is
  141.    selected, to ensure that data types are unchanged.  If you find
  142.    that reverse-translated OPL has too many nested levels of
  143.    structure, you can flatten out the
  144.    'ELSE' clauses by choosing 'No ELSE' for the 'ELSE and 
  145.    WHILE' item.  If the OPL appears to have missing 'ENDWH' 
  146.    statements, this may be due to mis-interpretation of 
  147.    poorly-structured code, and you can choose 'No WHILE', 
  148.    which will result in 'IF' and 'GOTO' being used to 
  149.    achieve the correct behaviour.
  150.    
  151.    If there is more than one translated procedure, you can select a
  152.    range of procedures to reverse-translate (from 'First proc' to
  153.    'Last proc').  This range defaults to all the procedures in the
  154.    file.  If you specify a 'First proc' number which is larger than
  155.    'Last proc', then all procedures will be skipped, and you will
  156.    just get a REM statement naming each procedure.
  157.  
  158.  
  159. Input/Output Files
  160.  
  161.    When the program runs, it accesses up to three files which you
  162.    specify:
  163.    
  164.    <your file>.OPO/.OPA (Read, mandatory) The .OPO or .OPA file to
  165.                         reverse-translate, from the M:\APP directory
  166.                         by default.
  167.    
  168.    <revtran output>.OPL (Write, optional) The new OPL source code
  169.                         extracted from the .OPO/.OPA file, to go in
  170.                         the M:\OPL directory by default.
  171.    
  172.    <original icon>.PIC  (Write, optional) The extracted icon
  173.                         picture, if one is present inside a .OPA
  174.                         file, to go in the M:\PIC directory by
  175.                         default (M:\PIC will be created if
  176.                         necessary).
  177.    
  178.    When writing OPL source code for a .OPA, Revtran will also
  179.    prompt you for a filename to go in the ICON command, but Revtran
  180.    will not access that file.
  181.  
  182.  
  183. Capabilities and limitations
  184.  
  185.    Revtran is intended to cope with all the OPL language constructs
  186.    described in the Series 3a Programming Manual (Version 1.0).  It
  187.    will only take as input OPO and OPA files, i.e. those created as
  188.    a result of translating OPL source code.  It cannot process the
  189.    compiled version of 'C' source code etc., e.g. .IMG files.
  190.    
  191.    If you translate something from, say, English to Japanese, then
  192.    reverse-translate back to English, you'll lose something in both
  193.    directions.  Unfortunately, the situation wi