Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news.rediris.es!kanaga.switch.ch!switch.ch!newsfeed2.ip.tiscali.net!tiscali!newsfeed1.ip.tiscali.net!news.tele.dk!news.tele.dk!small.news.tele.dk!skynet.be!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!medusa.aether.demon.co.uk%faq
From: [email protected] (Matthew Hambley)
Newsgroups: comp.sys.acorn.programmer,comp.sys.acorn.announce,comp.answers,news.answers
Subject: The comp.sys.acorn.programmer FAQ
Followup-To: comp.sys.acorn.programmer
Date: Tue, 03 Oct 2006 08:37:58 +0100
Lines: 556
Approved: [email protected]
Message-ID: <[email protected]>
NNTP-Posting-Host: aether.demon.co.uk
X-Trace: news.demon.co.uk 1159934405 21821 83.104.139.183 (4 Oct 2006 04:00:05 GMT)
X-Complaints-To: [email protected]
NNTP-Posting-Date: Wed, 4 Oct 2006 04:00:05 +0000 (UTC)
Summary: This is the FAQ for the comp.sys.acorn.programmer news group.  It gives answers to many often asked questions and some not so often asked questions.  It should be read by anyone considering posting to this group before they do so.
X-Editor: Zap 1.45 (06 Nov 2002), ZapEmail 0.26 (03 Nov 2002)
Xref: senator-bedfellow.mit.edu comp.sys.acorn.programmer:79555 comp.sys.acorn.announce:9907 comp.answers:64212 news.answers:310953

Archive-name: acorn/programmer
Posting-Frequency: monthly (approximately)
Last-modified: 3rd August 2006
Version: 1.46
Maintainer: Matthew Hambley ([email protected])
Disclaimer: Approval for *.answers is based on form, not content.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

                    The comp.sys.acorn.programmer FAQ

                         1.46 - 3rd August 2006

There are a number of questions which crop up time and again in the
comp.sys.acorn.programmer newsgroup. This FAQ hopes to answer these in an
attempt to keep the signal to noise ratio on the group high. It also covers
a number of points concerning the nature of the news group itself.

Please be aware that this FAQ does not hope to be a comprehensive resource
for programmers. Rather it is intended to be what it claims to be, an
answer to some frequently asked questions. If you don't like this, please
feel free to write and maintain your own.

Furthermore note that due to the depressingly large amounts of spam which
afflict my FAQ e-mail address I automatically delete all mail which does
not have the word "FAQ" in the subject line. Simply replying to this post
is OK otherwise make sure you include "FAQ" somewhere in the subject.

Current maintainer: Matthew Hambley <[email protected]>
Web version: <http://www.aether.demon.co.uk/faqs/programmer.html>

Revision History
================

Only the 3 most recent releases are given here. Should you wish to view the
complete history, visit:
<http://www.aether.demon.co.uk/faqs/programmer-history.html>

   v1.46 (2nd August 2006)
       * Added "Sourcery" to the tools section
       * Altered links into riscos.info to reflect its new wikines

   v1.45 (2nd April 2006)
       * New version of GCC

   v1.44 (2nd February 2006)
       * New version of RTK
       * New version of XhoX11
       * Example mirror for JFShared
       * New URL for "Routines"
       * New URL for SharedBLibM
       * New home for Smalltalk
       * New home for new version of Dr Wimp
       * New home and maintainer for RiscXLib
       * Noted lack of home for Desk
       * Removed Mesa as the author appears to have disowned it
       * Typo and spelling fixes

Questions and Answers
=====================

1. Concerning the news group itself

   1.1. What is comp.sys.acorn.programmer?

       Comp.sys.acorn.programmer is a newsgroup for discussion regarding
       programming RISC OS computer systems. Its remit is wide covering
       everything from novice programmers to assembly hackers.

       You are encouraged to ask any programming questions but be aware
       that you may find people more knowledgeable in a specific area of
       programming (e.g. 3D graphics) on a group dedicated to that
       subject.

   1.2. Are there any matters of netiquette of which I should be aware?

       First, a reminder of basic netiquette. Before posting a question
       check that it is not in this FAQ. Then check that it has not been
       discussed before. Google[1] may be used for this last task.

       You may also find an answer to your question in either a RISC OS
       specific web site (try Acorn Search[2]) or a generic programming
       resource such as Wotsit[3].

       Finally consider whether your question is appropriate to
       comp.sys.acorn.programmer. In particular bear in mind that although
       you are writing your program on a RISC OS machine your question may
       not be RISC OS specific. In these cases there may be a more
       appropriate group available.

       Having said all that don't be put off posting. As long as the
       denizens of the group think you have employed due diligence in
       searching for an answer they will be happy to try and help.

       One last thought. Do not end your message with "Please reply by
       private e-mail as I do not read this group." This is considered
       exceptionaly rude and exploitative. If you can not be bothered to
       participate in the group, even for the life span of your query,
       then the regulars can not be bothered to help you.

       [1] http://groups.google.com/
       [2] http://www.drobe.co.uk/search?launched=yes&type=pages&term=
       [3] http://www.wotsit.org

   1.3. What are the rules regarding code fragments?

       It is often a good idea to include a code fragment when asking a
       question as it is often much easier to sort out the problem from
       the code than from a hand-wavey discription. The golden rule is
       "Keep it short and relevant".

       Another trick to make potential helpers' lives easier and increase
       the likelyhood of you getting a useful reply is to include as much
       error information as you can. Also outline your debugging effort to
       date: What you have tried and what did and didn't work.

       Code fragments should be included in-line rather than being
       attached with uucode or MIME. It is also not acceptable to attach
       binary files to your posts. If you feel that a binary will make
       matters clearer then upload it to a web site and provide a link to
       it.

2. On the matter of languages and libraries

   2.1. Which programming languages are available?

       The most obvious languages are BASIC with its built in assembler as
       these are provided "for free" with the operating system. There are
       a number of C/C++ products as outlined in a following question. The
       Acorn C/C++ package also comes with the ObjAsm assembly language
       development application. Other languages which have received ports
       over the years include:

       Ada

       AWK <http://awk.riscos.org.uk/>

       Bob last known version 4
       <http://www.wra1th.plus.com/bob/index.html>

           This language is derived from Bob 1.5, an experimental
           object-oriented language with a C-like syntax by David Betz and
           the subject of an article in Dr Dobbs Journal in September
           1991. Betz is the author of XLisp and later became programming
           language consultant for Apple; NewtonScript has strong
           resemblances to Bob.

           ArmBob is a Risc OS extension of Bob. You can write wimp
           programs with it.

       Forth <ftp://ftp.taygeta.com/pub/Forth/Reviewed/forthmacs.arc>

       Fortran (ukp124 + VAT)
       <http://www.intint.demon.co.uk/riscos/sw/ii68.html>

           II68 Desktop Fortran 77: Commercial product from Inteligent
           Interfaces.

       Foger

       Haskell

       Icon

       Java

       Lisp <http://www.users.dircon.co.uk/~arcangel/files/>

       Lua <http://lua.riscos.org.uk/>

       Pascal

       Perl

       PHP <http://www.php.alexwaugh.com/>

       Python <http://www.schwertberger.de/>

       Sather

       Smalltalk <http://www.rowledge.org/tim/squeak/RISCOSSqueak.html>

       Weave <http://weave.riscos.org.uk/>

           This is a programming language specialised for constructing web
           sites. It is a full programming language with variables,
           functions etc, in which the names of HTML tags become strings,
           functions or functionals.

   2.2. Are there any libraries or similar to ease BASIC programming?

       There certainly are:

       AppBasic last known version 2.02 beta
       <http://www.jettons.co.uk/riscos/toolbox/>

           The aim of this package is to offer a Visual BASIC style
           environment whereby WIMP applications may be developed quickly.
           It utilises the Toolbox modules and replaces EasyB by the same
           author.

       DrWimp (freeware) last known version 4.40
       <http://www.rayfavre.me.uk/drwimp.html>

           A highly regarded set of resources including not only a library
           but also a skeleton application to ease matters further.

       JFShared last known version 2.54

           A collection of BASIC libraries which come with a few templates
           to get you started. This library was written by Justin Fletcher
           for his own use so your mileage may vary.

           Currently dropped off the net but is still available from
           various mirror sites. For instance Drobe[4].

       Routines (Freeware) last known version 1.18
       <http://www.7thsoftware.com/software.htm>

           A collectino of useful functions and procedures which can by
           dynamically included in your applications.

       SharedBLib (LGPL) last known version 1.00
       <http://rrt.sc3d.org/Software/RISC%20OS/SharedBLib/>

           In the vein of SharedCLib a set of BASIC libraries which exist
           only once in memory. Supports both CLI and WIMP interfaces and
           networking.

           The download page is a little confusing so don't be surprised
           if it takes a while to work out how to download it.

       WimpBASIC 2 (ukp39) <http://www.apdl.co.uk/progs/wbasic.htm>

           A commercial development environment from APDL.

       WimpWorks (ukp39.99)
       <http://www.jaffasoft.co.uk/product/wimpworks.html>

           A commercial development environment from Jaffa Software.

[4] http://www.drobe.co.uk/archives/index.php?directory=/freenet.barnet.ac.uk/Acorn/freenet/j.fletcher/jfshared/

   2.3. I want to work in C/C++, what is available?

       Acorn C/C++ (ukp199)

           Includes the toolbox bits and a pile of other utilities.

           The C compiler (often refered to as Norcroft) is very capable
           however the C++ compiler is based on CFront and as such is
           showing its age.

           Now developed and available from Castle Technology

       Easy C/C++ (ukp19) <http://www.apdl.co.uk/prog.htm>

           Originally produced by Beebug, now sold by ProAction/APDL. It
           aims to be a good basic C and C++ compiler. It is a little
           dated now and some doubt has been cast as to its reliability on
           newer machines. However it is cheap and therefore ideal for
           people who are just learning or who are dabbling and don't want
           to muck about with command lines as in GCC.

       GCC (free) last known version 3.4.5
       <http://www.riscos.info/index.php/GCCSDK>

           The latest version of the GNU Compiler Collection ported to
           RISC OS.

       LCC (free) last known version 4.20
       <http://www.riscos.info/index.php/LCC>

           This C compiler is designed to be light-weight. As such it does
           not support the various extensions which GCC has added. Nor
           does it include a C++ compiler.

       There was also a C interpreter, is that still available? I think it
       was written by Hugo Fiennes and came on a magazine cover disc. We
       have a vote for Acorn User, February 1994.

       CMunge
       <http://support.riscos.com/Support/Resources/Libraries/StubsG/>

           Generates a code skeleton to allow the programming of
           relocatable modules in C. Similar to CMHG which comes with the
           Acorn C/C++ environment but, according to advocates, better.
           May be found in the stubsg collection.

       Sourcery (PD) last known version 0.99
<http://www.reallysmall.co.uk/Pages/normal/software/development/sourcery/sourcery.html>

           A graphical replacement for "make". This tool manages all the
           various components of your application including not just
           source but also sprite files, templates, etc.

       conio.h

           Port of "the most abhorrent M$ lib/header file".

       ChoX11 last known version 0.30
       <http://www.riscos.info/index.php/ChoX11>

           An X client library produced as part of the authors Unix
           Porting Project.

       Curses

           Port of the Unix command line cursor control system.

       DeskLib <http://www.riscos.info/index.php/DeskLib>

           The library from which Desk is a fork.

       Desk last known version 3.24

           A fork of DeskLib. It seems to have fallen of the web for the
           time being.

       Dreamscape

           This C++ class library was last updated in June 1998 and an
           archive of it could not be found at the time of writing. It
           wraps up the various toolbox modules in an object oriented
           fashion.

       FlexLib

           Memory manager

       JSLib

           Mozilla JavaScript library. Allows applications to support JS
           scripting.

       OSLib (GPL) last known version 6.80
       <http://ro-oslib.sourceforge.net/>

           Well thought of and nigh on comprehensive set of libraries. A
           recent revision introduced 26/32-bit agnostic code and support
           for RISC OS 5 and Select API's.

       RISC OS Toolkit last known version 0.7.1
       <http://rtk.riscos.org.uk/>

           A class library to aid application development. Of particular
           note is its dynamic window construction in the style of Java
           layout managers.

       RiscXLib last known version 0.03
       <http://www.riscos.info/index.php/ChoX11>

           A set of X client libraries. Part of the Unix Porting Project.

       StubsG last known version 0.04
       <http://support.riscos.com/Support/Resources/Libraries/StubsG/>

           The full gammet of libraries supplied by RISC OS Ltd. Not only
           does this include the stubs library for use with the shared C
           library but also libraries for the toolbox modules, tcp/ip and
           memory allocation.

       UnixLib <http://www.riscos.info/index.php/GCCSDK>

           Provides all the functions required for GCC but can also be
           used with Acorn C. Very useful for porting Unix applications.

       ylib

           For machines with floating point hardware. Provides faster
           versions of the maths functions.

   2.4. Where can I get an update to the Java virtual machine?

       If you have version 0.76 then you can't, that's the most recent
       there is.

   2.5. What is available in the way of Java tools?

       There is a web site at which further information[5] may be found.

         Virtual Machines
       The original Java Virtual Machine (JVM) for RISC OS machines is
       called RiscCafe and was written by Acorn, therefore it is not
       currently supported. It supports applets written to the 1.0.2
       standard. If you want a copy keep your eyes on the charity stalls
       at shows or the small ads in magazines.

       A newer JVM and support libraries called Kaffe[6] has been made
       available by the Unix Porting Project.

       A coding group called eQ R&D gas recently released an alpha test
       version of their JVM, Zhaba[7]

       A third JVM, called Chockcino, is currently under development. As
       yet no release date is known.

         Compilers
       Two Java compilers exist for RISC OS. The first, guavac, compiles
       to the 1.1 version of the Java run-time environment. It can be used
       in conjuction with the libraries supplied with RiscCafe or version
       1.1 libraries are available for it. Guavac support has been dropped
       in favour of Jikes.

       The second compiler is a port of Jikes from IBM. It's newer,
       faster, leaner and smells of peppermint.

       [5] http://www.chocky.org/java/
       [6] http://www.chocky.org/unix/downloads.html#kaffe-cvs
       [7] http://www.eqrd.net/english/riscos/index.html

3. Programming RISC OS

   3.1. How do I get started?

       In my experience the best way to learn programming is to do it
       however some tutorials and reference material can be invaliable.

       The various Acorn/RISC OS magazines have covered this topic
       (generally some time ago so you will have to seek out back issues)
       and I can particularly recomend some of the series run in <<Risc
       User>>. The book <<Wimp Programming for All>> is based on these
       articles and is available on the "RISC User in a Nutshell" CD-ROM.

       You may also be interested in Paul Vigays "RISC OS Academy"
       initiative. This is an on-line correspondence course which is to
       cover BASIC programming as well as a number of other topics
       including HTML coding. Details[8] of the syllabus and subscription
       rates are available.

       [8] http://www.vigay.com/academy/

   3.2. I need manuals and other technical information. Where can I get
        it?

       As part of their Select scheme RISC OS Ltd are building up a
       comprehensively revised and updated set of PRMs. This is available
       in electronic form from the Select members private site. This is
       going to be a definitive reference for many things and is another
       good reason for joining the Select scheme. (I also give excelent
       false witness, price list is available on request)

       There is also a wealth of information for C programmers at
       riscos.info[9].

       Adam Richardson has collected together a page of useful little odds
       and ends[10]. It is a short distilate of the PRMs and Style Guide
       along with some common sense suggestions on good practice.

       [9] http://www.riscos.info
       [10] http://www.snowstone.org.uk/riscos/documents/programmertips.html

   3.3. What general programming utilities are available

       Much software has been written to ease the process of writing
       software. Below are listed some of the non language-specific pieces
       which may prove useful.

       RISC OS Packaging Project <http://www.riscpkg.org/>

           This project aims to provide a dependency tracking package
           manager in the style of Debian's APT. It is still at an early
           stage of development but you may wish to consider it as a means
           to distribute your software.

4. Technical issues of import

   4.1. What's all this about '32-bit' code?

       It relates to the underlying ARM hardware; the simplest explanation
       is that the earliest ARM CPUs used a combined program
       counter/processor status register. This limited the effective
       address range to 64MB ("26-bit" code). Later ARM CPUs provide
       26-bit compatibility along with extra modes that have separate
       program counter and status registers ("32-bit" code).

       Some ARM CPUs - such as the one used in the Castle Iyonix - lack
       the 26-bit compatibility modes. For one thing 26-bit mode is
       incompatible with the "Thumb" instruction set provided by some ARM
       processors.

       There is a longer disertation[11] on this topic should you wish
       some further reading.

       [11] http://www.riscos.info/index.php/32bit

   4.2. Fine, but what C/C++ stuff is 32-bit compatible?

       Castle sell an improved version of the Norcroft compiler, tools and
       libraries which includes an addressing scheme agnostic (i.e. it
       works for both 26 and 32 bit addressing modes) version of the
       shared C library.

       GCC also offers 32-bit addressing mode support as does LCC.

       As far as libraries are concerned most have now been updated but
       check with the original distribution site before assuming that the
       one you use has.

5. Gotchas of which to be aware

   5.1. My BASIC IF...ENDIF block doesn't appear to be working properly

       Chances are you have a space after the THEN. In these cases BASIC
       will assume that it is dealing with a single line IF. Thus it will
       execute the rest of the block regardless of the state of the
       condition.

       There are a number of ways of avoiding this problem in the future.
       Both Zap and StrongEd provide a means whereby trailing spaces may
       be automatically stripped on file save. Alternatively you can use
       the BASIC command CRUNCH to perform a number of size reducing
       operations including the removal of trailing spaces.

   5.2. When I try to run another program from within my BASIC application
        something weird happens.

       Performing this task is a little trickier than you might at first
       think. It is not simply a matter of *RUNing the new program as
       doing this will replace the currently executing code with the new
       stuff. Hence when the new program finishes executing it will exit
       but the original program is no longer in existence to return to.

       There are a number of ways to achieve the desired goal. The
       hardest, most prone to errors and least recommended method is to
       fiddle around, a lot, to set up a new environment in which the new
       program may run.

       If you are looking for an easier and less nasty way there are
       several. There is *WimpTask which will work inside and outside the
       WIMP. Be warned though that you have to be careful keeping track of
       which task is swapped in at any given time. If you try to include
       arguments to the new program by placing them in memory which is
       then swapped out you can suffer crashes.

       There is also the BASICShell module which is part of the SharedBLib
       library. This module may have trouble if another has claimed
       certain vectors.

       Finally you can try hacking the code which provides this function
       out of the SlideShow application.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1-sb1 (RISC OS)

iD8DBQFE0OiBMrwdKMmRE3sRAqTuAJwNk2vg3OE5TLlnSMFwd7QunII4SwCfXjK3
ySv9paW2SUl1XYl/Pqq4LuQ=
=nQ0O
-----END PGP SIGNATURE-----

--
                         (\/)atthew )-(ambley
    Maintainer of the comp.sys.acorn.games and programmer FAQ lists
E-mail : [email protected]                    Public key ID : C991137B
                  http://www.aether.demon.co.uk/faqs/