From: Peter.Leyssens@eonic.com (Peter Leyssens)
Subject: Re: Workabout programming problems
Date: Fri, 21 Feb 1997 09:16:44 GMT

On 20 Feb 1997 17:04:42 GMT, "Kris Gheselle" <kris.gheselle@ping.be>
wrote:

>Could someone confirm that it's true that you can use a two or three
>dimensional array in ODE, OPL?
>
>In pascal and c you can use the keyword Record in your program so you can
>also define
>arrays with record elements, CAN you do that in ODE,opl??
>
>Tnx
>kris
>

You can use 2D or 3D arrays by programming it yourself.  This is not
OPL syntax, but General PseudoCode (TM) :

	i=SIZEX;
	j=SIZEY;

	DIM arrayname[i*j];

Then, to use arrayname[i][j], you can do it like this :

	tmp=arrayname[i*SIZEY+j];

or :

	tmp=arrayname[i+j*SIZEX];

depending on circumstances.  More exactly : if you want to access all
the elements one after another and you do this by first accessing the
first row (j=1, i going from 1 to SIZEX), then you'd better take the
second access method.  If you want to access the columns first, take
the first access method.

3D arrays are similar.

I don't really know whether an array of records is available in OPL.


From: ple@cix.compulink.co.uk ("Leigh Edwards")
Subject: Re: Call $8D $5F
Date: Sun, 23 Feb 1997 12:31:30 GMT

It is gSetOpenAddress. Which is used immediately before gOpenFont, 
gOpenBit to load the bitmap from anywhere within the file.
i.e. it locates the icon bitmap embedded in the program file

VOID gSetOpenAddress(UINT mode, ULONG pos);

Set the file position for the next call to gOpenFont, gOpenFontIndex, 
gInitBit, gOpenBit or gOpenMouseIcon as a function of mode and pos.
The possible values of mode are defined by constants of the form 
G_OPEN_MODE_XXX where XXX is one of:

OFFSET  to indicate that pos is the file position of the data

WORD_PTR_OFFSET to indicate that pos is the file position of a UWORD 
containing the file position of the data

LONG_PTR_OFFSET to indicate that pos is the file position of a ULONG 
containing the file position of the data

NORMAL  to cancel the effect of any previous unused call to 
gSetOpenAddress (pos is ignored)

Hope that helps, 
PLE@CIX.COMPULINK.CO.UK

From: "George Champlin" <GBSoftware@aol.com>
Subject: Can an alarm be cancelled from OPL???
Date: Mon, 24 Feb 1997 22:56:25 +0000

Hello everyone,
I'm setting an alarm within an OPL application, and need to be able to let
the user cancel it.  The OPL manual shows how to set an alarm (page 137),
but there isn't any info on cancelling it.  I haven't found anything in the
SDK either.  Anyone know how to go about doing it?
Thanks,
Geo

From: ple@cix.compulink.co.uk ("Leigh Edwards")
Subject: Re: Can an alarm be cancelled from OPL???
Date: Tue, 25 Feb 1997 09:53:35 GMT

p_iow(VOID *pcb, P_FCANCEL) - C6 page 44 of I/O devices manual in C SDK.

Which (I'm fairly sure!) translates to IOW(h%,4) where h% contains the 
handle of the ALM: device. 

Please use this at your own risk (-8

Cheers, PLE@CIX.COMPULINK.CO.UK

From: Peter.Leyssens@eonic.com (Peter Leyssens)
Subject: Re: gUPDATE...
Date: Fri, 28 Feb 1997 08:58:10 GMT

On Thu, 27 Feb 1997 14:17:38 +0100, aurelien max <maxaurel@etu.utc.fr>
wrote:

>
>  Can someone explain me what's the use of gUPDATE? I thought it was to
>force the system to refresh the screen or not to refresh it. But although
>I write gUPDATE OFF, the screen is still refreshed... So, can I change the
>screen without seing directly the changes on screen, or am I obliged to
>use another screen page to do that and then put it on top? Thanks.
>
gUPDATE off means that it keeps a buffer of graphical changes or
graphical commands.  Whenever that buffer is full, a refresh is
forced.  This saves lots of accesses to the screen.  If you're doing
this because of the speed, I'd advise you to check your algorithm
instead of trying tricks like these : I wrote a mandelbrot program in
OPL and the speedup of gUPDATE off was only 0,9%.

Of course, you can always implement a buffering system yourself and
use a larger buffer...

Peter.

From: ntisdale@cix.compulink.co.uk ("Nigel Tisdale")
Subject: Re: gUPDATE...
Date: Fri, 28 Feb 1997 16:46:58 GMT

gUPDATE OFF will force the screen to only be refreshed by commands that 
return a value e.g. gCREATE, which returns the handle of the new window 
etc... But other graphics commands which don't return a value such as 
gBORDER won't show up until ethier i)gUPDATE ii)gUPDATE ON iii)A graphics 
command which returns a value is called.

Hope this helps,

NTisdale

From: alanc@donor2.demon.co.uk (Alan Clifford)
Subject: Keycode Generator
Date: 01 Mar 97 20:40:16 GMT

Hello "A

Replying to a message of "A Beginner" to All:

 "B> From: "A Beginner" <kishw@hotmail.com>
 "B> Subject: Keycode Generator

 "B> My idea is to generate a unique code dependant on the users name so as
 "B> adding some security against hacking. I would be gratefule if anybody
 "B> could pass on some ideas on this subject or source code for
 "B> generating the registration codes.

You could use the CRC built into the Psion.  So you would give the CRC as the
unique code, the user types it in and the Psion compares it with the CRC of the
user's name.
There follows a little snippet which I used to test the CRC routine before I
added it to one of my programs.

PROC main:
 local name$(128), name2$(128)
 local crc%
 rem name$ = "A"
 name$ = "Alan Clifford"
 name2$ = "12345"
 crc% = crc%:(uadd(addr(name$),1), len(name$), 0)
 print name$
 print crc%
 crc% = crc%:(uadd(addr(name2$),1), len(name2$), crc%)
 print "adding", name2$
 print crc%
 pause 0
ENDP

proc crc%:(buffp%, len%, prevcrc%)
 rem Update crc given a buffer address
 rem Call with prevcrc% set to previous crc or 0
 local reg%(6) rem for os call
 reg%(1) = $2900 rem AX
 reg%(3) = len% rem CX
 reg%(4) = prevcrc% rem DX
 reg%(5) = buffp% rem SI
 os($8B, addr(reg%()))
 return reg%(1)
endp

Alan
(note:  please remove the $, or maybe it's still c, from the address before
replying by email)

From: Jochen Siegenthaler <jochen.siegenthaler@alcatel.ch>
Subject: Re: Comms
Date: Tue, 04 Mar 1997 10:43:58 +0100
Reply-To: jochen.siegenthaler@alcatel.ch
To: Grahame Sutherland <grahame@grahame.demon.co.uk>

Grahame Sutherland wrote:

> Does anyone know how to access the  HandShake Lines (RTS,CTS,DTR etc)
> on the ComPort via OPL? Reading/Writing bytes is no problem but I need
> to check handshaking.

Have a look at the source code of the FreeVT vt100 emulator: its all in
OPL and has full user-settable hardware handshaking. Make sure you get
the latest version.
--
 Jochen Siegenthaler (Alcatel Telecom, Switzerland)
 mailto:jochen.siegenthaler@alcatel.ch
 http://www.alcatel.ch/
 http://ourworld.compuserve.com/homepages/Jochen_Siegenthaler/


From: nicko@nildram.co.uk (Phil Spencer)
Subject: Re: OPL & Help
Date: Wed, 05 Mar 1997 19:35:30 GMT
Reply-To: nicko@nildram.co.uk

Hi,
>I would like to trap the help key to throw up a screen but if I use GET
>or KEY and the code 291 it doesn't work.
>Does a more experienced programmer know how I can do this?

You need to delve deeper into the System for the last key, so try
this:

PROC Helpmnu%:(Page%)
LOCAL Gate%,Pmods%,Mods%,K%
#pragma no_revtran
Gate%=PEEKW($38)
Pmods%=ADDR(Mods%)
K%=ENTERSEND(Gate%,23,#Pmods%)
IF K%=291 AND Mods%=4
Help:(-112) REM CONTROL-HELP was pressed so send an index
RETURN 1
ELSEIF K%=291 AND Mods%<>4 REM normal help requested
Help:(Page%)
RETURN 1
ELSE
RETURN 0
ENDIF
ENDP

This doesn't put the help file "over" the current dialog as you can in
C programs, it clears the dialog (or menu) and shows the help
(assuming your procedure for help is called "Help:" ).  I do this in
all my most important dialogs:

Again::
dINIT
.....
X%=DIALOG
IF Helpmnu%:(1)=1
GOTO Again::
ENDIF
IF X%=0
RETURN
.......etc, etc.

Hope that all helps, if you need any of the more specific code
explaining (I've just pasted all this directly from the OPP code for
my TimeMan program), then please mail me.

Rgds,
Phil
*********************************************************************
****P.K.Spencer - http://homepages.nildram.co.uk/~nicko/index.htm****
*********************************************************************

From: Jochen Siegenthaler <jochen.siegenthaler@alcatel.ch>
Subject: Re: OPL & Help
Date: Thu, 06 Mar 1997 19:43:14 +0100
Reply-To: jochen.siegenthaler@alcatel.ch
To: wilson_glen@jpmorgan.com

Glen A. Wilson wrote:

> I would like to trap the help key to throw up a screen but if I use GET
> or KEY and the code 291 it doesn't work.

In OPL, the DIALOG doesn't distinguish between Esc and Help, both
function the same way.

Luckily, the OS remembers the last key pressed and it is accesible via
OPL. Just use this code after the DIALOG...

	k%=DIALOG REM k%=0 for Esc and Help

	IF k%=0 REM Esc or Help was pressed
		REM check last key
		REM kmod% holds KMOD
		k%=SEND(PEEKW($38),23,kmod%)
	ENDIF

...and now k% will be 291 if the user pressed Help. The key modifier
will be returned in kmod%

Now all you need to do is get the HELPKIT1.ZIP and build your own Psion
help resource file and call it via the built-in help system. All in the
Help Kit. Available in the usual places...
--
 Jochen Siegenthaler (Alcatel Telecom, Switzerland)
 mailto:jochen.siegenthaler@alcatel.ch
 http://www.alcatel.ch/
 http://ourworld.compuserve.com/homepages/Jochen_Siegenthaler/


From: hzk@cix.compulink.co.uk ("Roger Muggleton")
Subject: Re: How can I find out where my OPL appl. is installed
Date: Fri, 7 Mar 1997 22:20:15 GMT

In article <331ECD7D.31A9@siemens.ch>, qlz@siemens.ch (Ronald Queloz) 
wrote:

> Hi netlanders,
> 
> How can I find out where, on which drive A:, B: or M:, my OPL
> OPA-application is installed? I need this information to get the help
> file from the correct drive.
> 
> Thanks in advance.
> 
> :-) Ron.

Try the OPL function CMD$ from the programming manual, e.g.

   myapp$=CMD$(1)

This gives the full path of the running application.

Roger Muggleton
Packet Radio: G0HZK@GB7WIR.#42.GBR.EU
Internet:     hzk@cix.co.uk

From: alanr@rd.bbc.co.uk (Alan Roberts)
Subject: Re: How can I find out where my OPL appl. is installed
Date: 6 Mar 1997 16:51:37 GMT

Ronald Queloz (qlz@siemens.ch) wrote:

: How can I find out where, on which drive A:, B: or M:, my OPL
: OPA-application is installed? I need this information to get the help
: file from the correct drive.

There's a very useful OPL command, CMD, that does all sorts of useful
things. Use it when you first launch the OPA.

CMD$(1) is the full path name of the OPA
CMD$(2) is the full path name of the file it is using
CMD$(3) returns C or O to create a new file or open an existing one
CMD$(4) is no use in OPL
CMD$(5) is the application name as declared in the APP statement

Also look at GETCMD$ for event handling.

Hope that helps.
******* Alan Roberts ******* BBC Research & Development Department *******
* My views, not necessarily Auntie's, but they might be, you never know. *
**************************************************************************


From: alan$@donor2.demon.co.uk (Alan Clifford)
Subject: Re. Creating .DBF files with labels
Date: 10 Mar 97 23:52:10 GMT

Hello G
Replying to a message of G Sessions to All:

 GS> I would greatly appreciate if anyone can assist with some OPL code
 GS> that will  enable me to create a .DBF file with labels already
 GS> defined for each field.

The labels are held as a subrecord in the descriptive record.  I haven't
created a label subrecord but I have created another type of subrecord in the
descriptive record.  This is what the code below does;  you should be able use
it as a starting point to create a label subrecord.  As I worked this out all
by myself, you use the method at your own risk.

Before you start, you need the excellent Psionics files and the programming
manual.  Familiarize yourself with the format of the descriptive record (in
dbf.fmt in Psionics) and ODBINFO (in Advanced Topics, OPL database information
in the programming manual).

I assume you are going to use the file with the Data application.  I am
optimistic that when you load the file into Data, it will create all its bits
around your label subrecord.  Also, even though you created the file with only
one field, dummy$, I think the Data application will modify the field
information record to its own 32 string fields format.  

In the following snippet, you would call the procedure like this:

creat filenam$, c, dummy$
paramid%:(3)  rem use 1 for file a, 2 for b etc.

rem =======snip=========

proc paramid%:(f%)
 rem adds a new subrecord to descriptive record if neccessary
 rem gets or sets the id in an open file, where f% = 1 for file 'a'
 rem returns 0 if successful
 local info%(4), inregs%(6), handle%, flags%, recbuf%
 local datsize%, totsize%, subsize%, subtype%, offset%, idfound%
 local paramid$(21), paramid%
 paramid$ = "ACSORT PARAMETER FILE" rem 21 bytes.  Check if this exists
 paramid% = 10 rem 2 bytes.
 rem paramid% is the parameter file version no.  This can be used for
 rem automatic file conversion if the file structure changes
 idfound% = 1 rem set to 0 if found

 odbinfo info%()
 handle% = peekw(info%(f%))

 rem print "handle%", handle%
 rem print "buffer size?", lenalloc(peekw(uadd(info%(f%), 8)))
 recbuf% = peekw(uadd(info%(f%), 8))
 rem print "start of buffer", recbuf%

 rem get desc record
 rem print "reading descriptive record"
 inregs%(1) = $1700  rem AX
 inregs%(2) = handle% rem BX
 flags% = OS($D8, addr(inregs%()))
 if flags% and 1
  print "parameter file descriptive record read"
  rem print err$(err)
  print "error:", err$(inregs%(1) or $FF00)
  pause 20
 else
  rem print "offset from start", peekw(uadd(info%(f%),2))
  totsize% = inregs%(1) rem datasize 
  rem print "desc record length", totsize%
  rem top of desc record

  rem read sub-records
  offset% = 2
  subtype% = 0  rem 0 for test
  while offset% < (totsize% + 2)
   subtype% = peekb(uadd(recbuf%,offset%+1)) /$10
   subsize% = peekb(uadd(recbuf%,offset%))
   subsize% = subsize% + (peekb(uadd(recbuf%,offset%+1)) and &F) * &100
   rem print "subtype:", subtype%, "size:", subsize%
   if (subtype% = 14) and (subsize% = (len(paramid$) + 1 + 2))
    if peek$(uadd(recbuf%,offset% + 2)) = paramid$
     rem print "ID found"
     rem print peek$(uadd(recbuf%,offset% + 2))
     rem print "version:", peekw(uadd(recbuf%, offset% + 2 + len(paramid$) +1))
     idfound% = 0
    endif
   endif

   offset% = offset% + subsize% +2 rem bytes
  endwh
  rem print "end of desc"

 endif

 rem add id if neccessary
 if idfound% <> 0
  print
  print "writing parameter file descriptive record"
  rem mark the buffer as trashed
  inregs%(1) = $0300  rem AX
  inregs%(2) = handle% rem BX
  flags% = OS($D8, addr(inregs%()))

  rem add the id subrecord on to end of descriptive record
  subsize% = 0
  pokeb uadd(addr(subsize%), 1), 14 * $10
  rem print "subsize", hex$(subsize%);"H"
  subsize% = subsize% + len(paramid$) + 1 + 2
  rem print "subsize", hex$(subsize%);"H"
  rem pause 50 

  pokew uadd(recbuf%,totsize% + 2), subsize%
  poke$ uadd(recbuf%,totsize% + 2 +2), paramid$
  pokew uadd(recbuf%,totsize% + 2 +2 + len(paramid$) + 1), paramid%
  inregs%(1) = $1800  rem AX
  inregs%(2) = handle% rem BX
  inregs%(3) = totsize% + 2 + len(paramid$) + 1 + 2rem CX
  flags% = OS($D8, addr(inregs%()))
  if flags% and 1
   print "descriptive record write error"
   rem print err$(err)
   print "error:", err$(inregs%(1) or $FF00)
   pause 20
  else
   idfound% = 0
   print
   print "file ID added to parameter file"
   pause 50
  endif
 endif

 rem pause 50
 return idfound%
endp

rem =======snip=========

Alan
(note:  please remove the c in alanc in the address before replying by email)
Please remove the '$' in the from line before reply via email. 
Anti-UCE filter in operation.


From: alan$@donor2.demon.co.uk (Alan Clifford)
Subject: Re. Creating .DBF files with labels
Date: 13 Mar 97 01:21:01 GMT

Hello Alan
Replying to a message of Alan Roberts to All:

 AR> G Sessions (gsesh@igubu.saix.net) wrote:
 AR> : I would greatly appreciate if anyone can assist with some OPL code
 AR> that will  : enable me to create a .DBF file with labels already
 AR> defined for each field.

 AR> So would I, any suggestions please.

There's still some debugging code in it but it worked for me.

proc main%:
 local ahcfile$(128)
 local error%, label$(5, 255) rem fixed length makes it easier later on
 ahcfile$ = "\dat\ahctest.dbf"

 label$(1) = "hello"
 label$(2) = "bonjour"
 label$(3) = "buongiorno"
 label$(4) = "guten tag"
 label$(5) = "buenos dias"

 rem open the  file
 if not exist(ahcfile$)
  trap create ahcfile$, c, dummy$, dummy2$
  error% = err
  if error% <> 0
   cls
   print "Parameter file error", err$(error%)
   print ahcfile$
   pause 80 :stop
  else
   ahclabs%:(3, addr(label$()), 5) rem file 'c'
  endif
 else 
  trap open ahcfile$, c, dummy$, dummy2$
  error% = err
  if error% <> 0
   cls
   print "Parameter file error", err$(error%)
   print ahcfile$
   pause 80 :stop
  else
   ahclabs%:(3, addr(label$()), 5) rem file 'c'
  endif
 endif
endp

proc ahclabs%:(f%, plabel%, labct%)
 rem adds a new subrecord to descriptive record if neccessary
 rem writes the labels in an open file, where f% = 1 for file 'a'
 rem returns 0 if successful
 local info%(4), inregs%(6), handle%, flags%, recbuf%
 local datsize%, totsize%, subsize%, subtype%, offset%, labsfnd%
 local ctr%, labsize%

 totsize% = 0
 labsfnd% = 1 rem set to 0 if found

 odbinfo info%()
 handle% = peekw(info%(f%))
 
 recbuf% = peekw(uadd(info%(f%), 8))
 print "start of buffer", recbuf%

 rem get desc record
 rem print "reading descriptive record"
 inregs%(1) = $1700  rem AX
 inregs%(2) = handle% rem BX
 flags% = OS($D8, addr(inregs%()))
 if flags% and 1
  print "parameter file descriptive record read"
  print "error:", err$(inregs%(1) or $FF00)
  pause 20
 else
  totsize% = inregs%(1) rem datasize 
  print "desc record length", totsize%
  rem top of desc record

  rem read sub-records
  offset% = 2
  subtype% = 0  rem 0 for test
  while offset% < (totsize% + 2)
   subtype% = peekb(uadd(recbuf%,offset%+1)) /$10
   subsize% = peekb(uadd(recbuf%,offset%))
   subsize% = subsize% + (peekb(uadd(recbuf%,offset%+1)) and &F) * &100
   print "subtype:", subtype%, "size:", subsize%
   if (subtype% = 4)
    labsfnd% = 0
    print "label subrecord found"
    pause 20
    break
   endif
   
   offset% = offset% + subsize% +2 rem bytes
  endwh
  print "end of desc"
 endif
 
rem print "press a key"
rem get
rem stop

 rem add labels if neccessary
 if labsfnd% <> 0
  print
  print "writing parameter file descriptive record"
  pause 20
  rem mark the buffer as trashed
  inregs%(1) = $0300  rem AX
  inregs%(2) = handle% rem BX
  flags% = OS($D8, addr(inregs%()))

  rem add the lab subrecord on to end of descriptive record
  subsize% = 0
  
  ctr% = 0
  while ctr% < labct%
   print peek$(uadd(plabel%, 256 * ctr%))
   poke$ uadd(recbuf%,totsize% + 2 +2 + subsize%), peek$(uadd(plabel%, 256 * ctr%))
   print peek$(uadd(recbuf%,totsize% + 2 +2 + subsize%))
   subsize% = subsize% + peekb(uadd(plabel%, 256 * ctr%)) + 1
   print "subsize%", subsize%, hex$(subsize%);"H", ctr%
   print "press a key"
   get
   ctr% = ctr% + 1
  endwh
  subsize% = subsize% + 2
  print "subsize", subsize%, hex$(subsize%);"H"
  print "press a key"
  get
  rem stop
  rem pause 50 

  subtype% = 0
  pokeb uadd(addr(subtype%), 1), 4 * $10
  subtype% = subtype% + subsize%
  print "subtype", hex$(subtype%);"H"
  print "press a key"
  get
  
  pokew uadd(recbuf%,totsize% + 2), subtype%

  inregs%(1) = $1800  rem AX
  inregs%(2) = handle% rem BX
  inregs%(3) = totsize% + 2 + subsize% rem CX
  flags% = OS($D8, addr(inregs%()))
  if flags% and 1
   print "descriptive record write error"
   rem print err$(err)
   print "error:", err$(inregs%(1) or $FF00)
   pause 20
  else
   labsfnd% = 0
   print
   print "labels added to parameter file"
   print "press a key"
   get
   rem pause 50
  endif
 endif
  
 rem pause 50
 return labsfnd%
endp

Alan
(note:  please remove the c in alanc in the address before replying by email)
Please remove the '$' in the from line before reply via email. 
Anti-UCE filter in operation.

From: Ian Nimmo-Smith <ian.nimmo-smith@mrc-apu.cam.ac.uk>
Subject: Re: OPL Bug?!?!
Date: Wed, 12 Mar 1997 12:35:28 +0000
To: kmccarthy@rorke.com

kmccarthy@rorke.com wrote:
> 
> I have come across an interesting behavior of OPL. I don't know if it is a
> bug, or if I just don't understand it. But anyway, try this code:
> 
> PROC main:
>   local j%
>   print "0.15/0.05=";
>   print 0.15/0.05
>   print "j%=0.15/0.05"
>   j%=0.15/0.05
>   print "j%=";
>   print j%
>   get
>   cls
> ENDP
> 
> When you run this code, you get this:
> 
> 0.15/0.05=3
> j%=0.15/0.05
> j%=2
> 
> WHY?!?!? I read the section in my friend's 3a OPL manual (I have a 3c and
> no OPL manual) about arithmetic quirks, but could find nothing to explain
> this. The answer is a WHOLE NUMBER, why does it get changed when I try to
> put it into an integer variable? This all comes from trying to verify that
> the dollar ammount entered is divisible by $0.05 (nickel). Is there a
> function to do moduluo(sp) math so I could avoid all this headache and
> just say: "IF (0.15 MOD 0.05)=0" to test to see if nickels go in evenly?
> 
> Any help is greatly appreciated.
> e-mail responses requested (I have no news server and have to use
> dejanews)

There was a discussion about this earlier in the year. It's an
inevitable feature of finite precision floating point calculation.

Try (0.15/0.05)-3 = -4.4408920985e-16 = -epsilon, where epsilon is
(approximately) the smallest number such that (1+epsilon)-1 is greater
than 0. 

To find out more about the world of finte precision arithmetic, try
(1+1e-15)-1=1.110...e-15 and (1+1e-16)-1=0.

So internally 0.15/0.05 has a value just a smidgeon under 3,
(possibly 2.999999999999999+epsilon

Print uses about 12 significant digits. So 0.15/0.05 is printed as 3.

However the INT() function will tell you that it's really less than 3:
INT(0.15/0.05)=2.

Techniques exist for overcoming these problems. In your context you
might do everything in integers (cents). Just drop the decimal point.

Alternatively, to calculate the number of dimes multiply by 20 rather
than divide by 0.05: INT(0.15*20)=3.

Alternatively, try adding on an epsilon: INT(0.15/0.05 + 1e-15) = 3 (but
INT(0.15/0.05 + 1e-16) = 2.

It's all very systematic, even if a little challenging!

Ian Nimmo-Smith

From: Anders Nygren <ehsanyg@aom.ericsson.se>
Subject: Re: OPL Bug?!?!
Date: Thu, 13 Mar 1997 09:36:24 +0100
To: kmccarthy@rorke.com

kmccarthy@rorke.com wrote:
> 
> Ok, I am still having more trouble.
> 
> Ian Nimmo-Smith <ian.nimmo-smith@mrc-apu.cam.ac.uk> sent me a response
> explaining the quirks of floating point math, and that just because print
> prints a 3 doesn't mean the variable has that value necessarily. He

<snip>

> I really hope that OPL (or whatever it's called then) in the series 4 has
> a MOD function. It would be nice to be able to say "if MOD(amt,0.05)=0"
> to test if something fits evenly. Then I wouldn't have to fart around
> with this headache.
> 
So translating Ian's explaination to OPL.
If You want to compare floats, the proper way to do it is 

	if abs(a-b) < delta

Where delta is a suitably small number depending on the accuracy You 
want/need, e.g 0.0001, 0.00000001, ......

Hope it helps
   Anders Nygren


From: alanr@rd.bbc.co.uk (Alan Roberts)
Subject: Re: reading Icons from opa's
Date: 14 Mar 1997 09:52:09 GMT

Gateway 2000 Licensed User (jwhitham@patrol.i-way.co.uk) wrote:

: I seem to remember someone saying something about being able to get at the
: icon embedded in an opa from within the opa.  I've searched all through
: dejanews and can't find anything.  Is this possible, does anyone know how?

It's dead easy. Just open the OPA like any other file and do a gLOADBIT.
But, the clever bit is to tell your code where to start looking for the
PIC data. This line does it:

CALL($5f8d,1,40,0)

The value $40 is the offset for all APP files, the offset for OPA files
depends on the length of the source code (OPL) filename. In my case the
value was $30. If you are dealing with fixed circumstances, peer into
the file (eg. use Hexview from Konstantin Saliy) and look for the offset
to the keyword PIC. If you don't know, at coding time, what OPA you are
going to use, try opening it as a binary file and read it until you get
the PIC keyword. Both techniques work.
-- 
******* Alan Roberts ******* BBC Research & Development Department *******
* My views, not necessarily Auntie's, but they might be, you never know. *
**************************************************************************


From: richardcox@cix.compulink.co.uk ("Richard Cox")
Subject: Re: C++ Compiler for Psion S3a?
Date: Wed, 19 Mar 1997 13:02:01 GMT

In <01bc32b8$66ff9b50$858508c2@pcandi> "Reuscher, Andreas" 
<andreas.reuscher@ubg.co.at> wrote:
> I have the TopSpeed C Compiler and the Psion-SDK. Now I have read in the
> volume 1 of the SDK that there is a C++ Compiler from TopSpeed 
> available.
> Is that right and does the compiler operate with the Psion SDK?
> And if so, where can I get this compiler?

You can use TopSpeed C++ with the SIBO SDK, with some limitations (see 
below). There used to be a "C++ module" for TopSpeed, however that does 
not seem to be available anymore (you could try contacting TopSpeed 
directly... try Clarion on +44 1582 763999).

C++ works perfectly OK with clib, plib and wlib, except that the startup 
code does not call ctors/dtors of static objects (it is only designed for 
C); and many of the prototypes fail to use const for parameters.

OTOH the header libraries for OLIB/HWIM use 'class' as an identifier, so 
its rather difficult to use Psion OO with C++ (and does not really give 
that much benefit--the complexity of two object systems and all that).

BTW. TopSpeed C++ is a rather old implementation of the language, no 
templates and exceptions, let alone the bits added since C++PL 2ed.
-- 
Richard Cox     My opinions are mine and not my employers.
richardcox@cix.compulink.co.uk


From: Jochen Siegenthaler <jochen.siegenthaler@alcatel.ch>
Subject: Re: OPL Bug?!?!
Date: Mon, 17 Mar 1997 11:44:38 +0100

kmccarthy@rorke.com wrote:

> I really hope that OPL (or whatever it's called then) in the series 4 has
> a MOD function. It would be nice to be able to say "if MOD(amt,0.05)=0"
> to test if something fits evenly. 

I use this for a MOD function...

PROC MOD%:(a%,b%)
	REM Returns the remainder of a%/b%
	REM same as Qbasic MOD function
	RETURN a%-(a%/b%)*b%
ENDP

...and never had any problems with it.
--
 Jochen Siegenthaler (Alcatel Telecom, Switzerland)
 mailto:jochen.siegenthaler@alcatel.ch
 http://www.alcatel.ch/
 http://ourworld.compuserve.com/homepages/Jochen_Siegenthaler/


From: brendan@informatik.uni-bremen.de (Brendan W. Breede)
Subject:
Date: Thu, 13 Mar 1997 21:05:40 GMT

In article <858261555.4610@dejanews.com> kmccarthy@rorke.com wrote:

>Also, does anybody have any suggestions for handling currency? The reason
>I am using floats is so I can use dFLOAT to get a dollars and cents from
>the user in a dialog box. It would be nice to be able to get the input as

Do all maths in longints (&) as cents and use local float variables for
the dialog.
___________________________________\____________________Brendan W. Breede
brendan@informatik.uni-bremen.de              \
http://www.informatik.uni-bremen.de/~brendan/  \

