From: "Martin N. Dunstan" <mnd@dcs.st-andrews.ac.uk>
Subject: Re: How do you get File Size
Date: Mon, 19 May 1997 13:01:44 +0100
To: dave@waterhol.demon.co.uk

dave@waterhol.demon.co.uk wrote:
>    Can anyone tell me how to get the size of a file. I've

Two simple ways - the first is to use the FilStatusGet
system call (see the Psionics files for more details)
and is probably the simplest and most efficient method.
The following code might help (I've not tested this
as I've just written it on the fly but it looks okay):

proc filSize&:(file$)
   local fname$(129)
   local status%, result&(4)
   local bx%, cx%, dx%

   fname$ = file$ + chr$(0)   : rem Need CStr
   bx% = uadd(addr(fname$),1) : rem Skip string length
   cx% = addr(result&())      : rem Result buffer
   dx% = addr(status%)        : rem For return status.
   call($0887, bx%, cx%, dx%)
   return result&(2)
endp

   The alternative is to use IOSEEK to seek to 0 bytes
from the end of the file. The variable you used to store
the 0 offset in will be over-written with the offset
relative to the start of the file i.e. the file size in
bytes ;)

The beauty of this method is that it works on almost
any platform you come across. Whether it is efficient
is another matter!

Martin


From: "Clive D.W. Feather" <clive@on-the-train.demon.co.uk>
Subject: Re: ROM Applications
Date: Mon, 19 May 1997 06:54:30 +0100

In article <5ln0m0$8eo$1@zingo.tninet.se>, Mattias Mattsson
<mattem@algonet.se> writes
>Does anyone know the reason why an application copied from ROM can't be run
>in RAM?

Applications executed from ROM are designed to be executed at some fixed
address - the address is determined before the ROM is built, and then
the application is linked to use it.

When it is run from RAM, it will be loaded elsewhere in memory.
Therefore it won't be in the right place to run.

Normal applications are designed to be relocated when run, so that they
can run at any address. ROM applications aren't.

>Can you make any changes to the image file to make this possible?

No.

Clive D.W. Feather    | Director of Software Development  | Home email:
Tel: +44 181 371 1138 | Demon Internet Ltd.               | <clive@davros.org>
Fax: +44 181 371 1037 | <clive@demon.net>                 | Abuse:
Written on my laptop; please observe the Reply-To address | <clive@bofh.org>


From: ttuinstr@gak.nl (Taeke S. Tuinstra)
Subject: OPL IOA/IOWAIT question
Date: Thu, 22 May 1997 07:59:58 GMT

Hello all 

Last days I have been playing around with the IO* OPL keywords an
there are a few things I can't grasp. My questions:

1 Does IOWAIT also return whenever a IOA request form another process
finished or does it only return if an IOA from within the current
process/program finishes?

2. For every time IOWAIT returns and the status is = -46 IOSIGNAL
should be called. Should this be done *after* the signal you are
wating for is received or every time a wrong number is received.

3. The manual says that if you only have 1 request pending on  1
handle IOWAITSTAT can be called. Should I do IOSIGNALs when receiving
wrong numbers. Also what's the advantage of asynch calls when you wait
for 1 IOA

I experimented a lot but still have the feeling I do not understand it
or keep misinterpreting my results. A code snippet or pointer to more
information than in the programming manual would be marvelous.
Thanks 

Taeke.


From: ali-manson@psion.com (Alasdair Manson)
Subject: Re: OPL IOA/IOWAIT question
Date: Fri, 23 May 1997 01:50:31 GMT

>Hello all 
>Last days I have been playing around with the IO* OPL keywords an
>there are a few things I can't grasp. My questions:
>
>1 Does IOWAIT also return whenever a IOA request form another process
>finished or does it only return if an IOA from within the current
>process/program finishes?

IOWAIT is only concerned about the state of asynchronous events
*within* the application itself. i.e. if an asynchronous even
completes in another application, your IOWAIT will not complete.

>2. For every time IOWAIT returns and the status is = -46 IOSIGNAL
>should be called. Should this be done *after* the signal you are
>wating for is received or every time a wrong number is received.

IOSIGNAL need not be called every time an IOWAIT completes. Indeed,
this makes little sense.

>3. The manual says that if you only have 1 request pending on  1
>handle IOWAITSTAT can be called. Should I do IOSIGNALs when receiving
>wrong numbers. Also what's the advantage of asynch calls when you wait
>for 1 IOA

An application with only one event source would do better to use
synchronous IO. Asynchronous IO only practically comes into its own
when you have two event sources and you don't know which will complete
first.

>I experimented a lot but still have the feeling I do not understand it
>or keep misinterpreting my results. A code snippet or pointer to more
>information than in the programming manual would be marvelous.
>Thanks 

Schematically, a simple event loop with two even sources looks like
this:

LOCAL dev1%, dev2%
LOCAL d1stat%, d2stat%

IOOPEN(dev1%, "DEV1:", -1)
IOOPEN(dev2%, "DEV2:", -1)

IOA(dev1%, FUNC, d1stat%, arg1, arg2)
IOA(dev2%, FUNC, d2stat%, arg1, arg2)

DO
	IOWAIT
	if (d1stat% <> -46)
		REM d1 completed
		REM so do something related to d1
	elseif (d2stat% <> -46)
		REM d2 completed
		REM so do something related to d2
	else
		StopBecauseOfBugInEventLoopLogic()
UNTIL 0

That's pretty much it. However, there are a couple of subtleties. The
"something related to d1" could be any one of a number of things but
normally one of two things will happen:

1. Some processing will be done which is relevant to d1 (perhaps the
examination of a keypress or the printing to the screen of data
received at the serial port. In this case, d2 may well be left running
and, when processing is complete, d1 is queued anew. In this case, if,
in the meantime, d2 completed, the IOWAIT will complete immediately
and "something related to d2" will happen.

2. The other event (referred to as d2) will be cancelled (imagine a
timeout on a parallel print for example). In this case, the programmer
would probably wish to cancel d2, do some processing and then requeue
both. In this case, and this may account for some of your confusion,
the code to cancel d2 would look like this:

	IOCANCEL(dev2%)
	IOWAITSTAT d2stat%

It is *crucial* to understand that cancelling an asycnhronous function
with IOCANCEL() DOES NOT STOP THE REQUEST FROM COMPLETING - rather, it
precipitaes its completion. As such, your application is still
signalled and the status word is set to -48 (E_FILE_CANCEL) - the
IOWAITSTAT 'uses up' the signal associated with the cancelled
operation and all is well with the world. But...

If you forget to execute the IOWAITSTAT, there will be a rogue signal
in your process, the IOWAIT will then start completing immediately
every iteration of the event loop. The OS might spot it and panic you
with 148 (or whatever it is - I can't remember) but, if it doesn't you
application will just lock up and be totally unresponsive to your
users.

As we say in Psion, your application will start "thrashing" and might
die from "stray signal death". Needless to say, this is bad fro users
and bad for your batteries. I'd suggest that you always put a check
like the "StopBecauseOfBugInEventLoopLogic()" shown above and you'll
spot this long before it causes any problems. You can also use Spy to
help debug this kind of stuff as it reports the IO semaphore for you.

If you get your head round this, you'll be OK. Finally, there is one
subtlety which I should mention. If your "something related to d1" in
itself includes another even loop, you need to make sure that, if
you've left d2 pending, you get any apparently stray signals, that you
could them up (with a counter) and put them back (with IOSIGNAL) when
you're done - just because your 'mini-event-loop' doesn't know about
them, doesn't mean they're not part of your application. Getting this
wrong is a sure fire road to stray signal death.

Any other questions, feel free to post here or mail me as
ali-manson@psion.com.

Make sense ?
Ali


From: jfmezei <"[nospam]jfmezei"@videotron.ca>
Subject: Re: Q: Using an alarm to trigger Process?
Date: Thu, 22 May 1997 17:14:19 -0500

Simon Wood wrote:
> 
> Does anyone know how I can launch a process via an alarm call, or if this 
> is not possible (as I suspect) 

Alarms are events which are executed by the time manager which is a
process which runs continuously. The time manager only handles sound
alarms. Can't get the time manager to launch a process for you (unless
it is an undocumented feature, one which would be nice BTW).

What you need to do is you write a small OPL program which runs
continuously in the background and makes use of the same system calls
that the Time Manager uses. There is one in particular, a direct
"wake-up" call (specifiy actual time-date, instead of delta-time
(offset).
This call will not only cause your program to resume, but also turn the
PSION back on if it was shut off.

Here is an example from a program which just plays a sound file at a
pre-determined time: (Note: if the PSION was off when the time came,
the password dialog will come up on the screen while your program will
run, but if your program needs input, the user will have to fill out the
password prompt first.

PROC mission:
local ret%,ticks%,vol%,pstat%
local sndfil$(128)
local cx%, dx%, mydate&
local datbeg&,timbeg&
datbeg& = DAYS(DAY,MONTH,YEAR)
timbeg& = mysec&:
dINIT "Mission alarm"
dDATE datbeg&,"Date",datbeg&,DAYS(31,12,2010)
dTIME timbeg&,"Time",1,timbeg&,INT(86399)
DIALOG

REM now go to background

CALL($198D,100,0)
gUPDATE
rem foreground use 0 instead of 100

mydate& = (datbeg& - 25567) * 86400 + timbeg&
cx% = PEEKW(ADDR(mydate&)+2)
dx% = PEEKW(ADDR(mydate&))

rem this is the call that puts your process to sleep. It will be
rem woken up at the time specified in mydate.

CALL($0C89,0,cx%,dx%)

rem now that the program is awake again, it can do what it wants.

sndfil$ = "*MISSION.WVE" + chr$(0)
ticks% = 0
vol% = 0
ret% = CALL($1E86,ADDR(sndfil$)+1,ticks%,vol%,0,pstat%)
IOWAITSTAT pstat%
ENDP

PROC mysec&:
RETURN HOUR*INT(3600) + MINUTE*60
ENDP


From: JosipSagaj@bigfoot.com (Josip Sagaj)
Subject: CPOC - C development system for Psion
Date: Fri, 23 May 1997 01:02:38 GMT

*********************************************************
You can find the CPOC-binaries in comp.psion.binaries ...
*********************************************************

	CPOC C Development System for the Psion 3a
	==========================================
		      Version 0.82
		 25th January, 1996

	INTRODUCTION
	============
	CPOC is an ANSI C compiler for use on the Psion 3a (and
	compatibles).  Unlike the SIBO C SDK available from
	Psion,  CPOC runs on the Psion 3a rather than on a PC
	attached via 3-link.

	The CPOC system also includes an assembler.  This can be
	used directly for those who wish to program in assembler
	rather than C.

	At this release, all components necessary to generate and
	link code are provided.  What is not yet available is the
	set of C libraries that are required to build any non-
	trivial C program.

	At this release only the CPOC front-end, pre-processor
	and C syntax check options are being released.  We had
	hoped to make more available, but have been running into
	technical difficulties in the implementation.  The
	current release does not provide a full C development
	system, and is expected to act as a supplement to a
	system based on some less portable computer.

	Despite this limitation, you are likely to find that CPOC
	is very useful as it does not just provide checking for
	correct ANSI C syntax, but also includes extensive
	warnings concerning dubious or questionable coding
	practices.  The level of warning detail is under user
	control so that you can decide how pedantic you wish the
	compiler phase to be.


	OVERVIEW
	~~~~~~~~
	The CPOC system is an ANSI C development system for use
	on the Psion 3a (and compatible machines).  For those who
	wonder where we derived the name CPOC, it is merely a bit
	of a play on both EPOC (the name of the Psion 3a
	operating system) and "C in my POCket" as a description
	of how it might be used.

	The base CPOC system (the "Starter Kit") provides you
	with the CPOC front-end.  You then need to install
	additional components that are called by the CPOC front-
	end to carry out the compilation process.  To avoid
	having to release the whole CPOC system if a single
	component is upgraded, then these additional components
	are each made available separately.


	The list of components available so far is:
	  -     CPP.IMG         the CPOC pre-processor
	  -     C86CHK.IMG      the CPOC Compile phase
					(syntax check only version)
	  -     C86GEN.IMG      the CPOC compile phase
	(code generation version)
	  -  AS86.IMG           the CPOC assembler phase
	  -  LD86.IMG           the CPOC linker
	  -  AR86.IMG           the CPOC librarian
	The C86 compile phase is provided in two variants.  The
	C86CHK.IMG one is the smaller one and only supports
	syntax checking of your C code, but not the ability to
	generate code from the C source.  This is most suitable
	for those who are using the Psion in conjunction with the
	SIBO C SDK and merely wish a portable C editing/checking
	environment.

	If you are only interested in going as far as editing and
	syntax checking your code on the 3a, then you only need
	the CPP.IMG and C86CHK.IMG programs.   If you intend to
	generate C code
	  You will need to obtain copies of these addition  is
	sufficient to allow  you to edit and syntax check C code.
	It does not include facilities for actually generating
	code from the C source.   The "CPOC Starter Kit" consists
	of the following components:

	  - CPOC Front end for running the system
	  - CPP Pre-processor phase
	  - C86 Compiler phase (syntax checking only)

	The CPOC system can also make use of the ELVIS 'vi' style
	editor. We released the Psion 3a port of this some weeks
	ago.


	FUTURE DEVELOPMENTS AND HOPES
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	The things that are now missing to provide a complete
	Psion hosted C development system are:
	 -      Improvements to the AR86 librarian.
	 -      The building of a ANSI C conformant library
	 -
	We are working on producing the "CPOC Code generator" kit
	that is needed if you actually want to be able to
	generate code on the Psion 3a.  As mentioned above we
	have run into certain technical difficulties and may not
	be able to complete this part of the system as we had
	hoped.   It is planned to consist of the following
	additional components:

	  -     C86 Compiler (syntax checking and code generation)
	  -     AS86 assembler phase
	  -     LD86 linker phase

	Another part of the planned final system (if it ever gets
	there) would be the "CPOC Library" kit consisting of the
	following:
	  -     Header files
	  -     Psion specific libraries
	  -     Library manager and archiver


	Finally there are miscellaneous tools that would be
	useful. Examples are:
	  -     The MAKE project automation tool
	  -     A program debugging environment

	If we cannot produce all the above to run natively hosted
	on the Psion 3a, we could still possibly produce much of
	it to run hosted on a PC.  Feedback on whether this is
	actually likely to be of use would be welcomed.  Our
	current thinking is that most potential users in the PC
	environment would probably already use the existing Psion
	SIBO C SDK.

	To put things in perspective, there are still reasons why
	a serious developer might be still want to use the Psion
	C SDK rather than CPOC:
	  -     Printed documentation is provided.  This is
	essential if you want to use the Psion specific
	libraries.
	  -     The TOPSPEED compiler provided with the Psion C SDK
	generates smaller and faster code than CPOC.
	  -     The Psion C SDK includes additional tools to support
	the Psion OOPS method of programming.
	  -     The Psion C SDK provides support for building
	Dynamic Link Libraries.
	  -     The Psion C SDK includes a Resource compiler
	  -     The Psion C SDK includes a debugger.
	There are no developments planned for CPOC that will
	address these issues

	HARDWARE REQUIREMENTS
	~~~~~~~~~~~~~~~~~~~~~
	The CPOC system will NOT run on a minimal Psion
	configuration.  If your system does not meet the at least
	the specifications mentioned below, then there is no real
	point in even trying to get it to run.

	A recommended minimum system would have the following
	available (either built in or via SSD's):

	 -      At least 512K of base memory.  This implies at least
	one of the following models.
	Psion 3a 512K
	Psion 3a 1Mb
	Psion 3a 2Mb
	 -      About 150Kb of space for the base CPOC software.
	Flash SSD is suitable for this.  If you add in
	optional components as well the size can grow to
	around 300Kb.
	 -      Additional RAM space for source files and temporary
	files.  Typically a value of about 200-300Kb is
	sufficient, although if you have a lot of source on-
	line you might require more.
	 -      Space for any system header files you require. This
	would typically be held on Flash SSD.


	You will see from the above that you should not expect to
	be able to use the CPOC system on a minimal Psion 3a
	system. In practice, we (using 3a/512K models) find that
	the ideal  configuration is about 0.5Mb RAM SSD (or more)
	for source files and temporary files, and about 0.5Mb
	Flash or RAM SSD (or more)  for the system files such as
	the programs and include files.

	The CPOC system will not, therefore, run on the Psion 3a
	256Kb model or the older Psion 3 as these do not have
	sufficient memory.


	INSTALLATION
	~~~~~~~~~~~~
	The "CPOC Starter Kit" comprises of the following files:

	README.TXT      Overview and installation instructions
	CPOC.APP        front-end to the system
	CPP.IMG         Pre-Processor
	C86CHECK.IMG    Compiler with no code generation.
	CPOC.INI        Global Preferences file

	The recommended place to put all the CPOC files is to
	create a \CPOC directory on any drive and put all the
	program files into this directory.  You can then install
	the CPOC.APP program using the Psion-I method.

	It is not necessary for all the CPOC software to be on
	one drive.  The system will automatically search the
	\CPOC\ directory on all drives for any component.  There
	are also a number of other places that are searched if
	not found here. For more details read the on-line help
	built into the CPOC program (press Psion-I for program
	location information).

	In particular it is recommended that the CPOC.INI file be
	placed in a \CPOC\ directory on a RAM drive.  This file
	holds your global preferences, and will be updated
	dynamically as you change such preferences.  Also while
	the CPOC system is in use you will create various project
	files (with .PRJ file extension).  These should ideally
	be placed in the same location as the CPOC.INI file

	You then need to install the


	DOCUMENTATION
	~~~~~~~~~~~~~
	The basic CPOC system is designed to be used without the
	need for comprehensive documentation.  We have therefore
	put all the information we think you will need for basic
	use of the system into the form of on-line help built
	into the CPOC front-end program.


	Once you have installed the CPOC front-end, pressing HELP
	should give you (we hope) enough information to use the
	system effectively.  The HELP is (where relevant) context
	sensitive so that pressing HELP while on a dialog or menu
	option will bring up help specifically on that topic.  If
	you think there is important additional material that we
	need to include in the help system then please let us
	know what it is.

	At a later stage we will make available detailed
	documentation for each of the programs underlying the
	CPOC system.  These will be made available as separate
	items as only advanced users should (we hope) need this
	level of documentation.

	We have not included any basic information on C and how
	to program in C.  We expect any prospective user to
	either already have this or to be prepared to obtain it
	from a suitable source such as a library or bookshop.


	HEADER FILES
	~~~~~~~~~~~~
	We have not (as yet anyway) provided any header files.
	At this point it is not possible to generate runnable
	code using CPOC in isolation, so we expect users of this
	version of CPOC to be using it as an adjunct to a C
	compiler that is already being used on some other
	machine.  On that basis you should copy the header files
	from this other machine to the Psion to use them in
	conjunction with CPOC.

	If there is demand, we can easily provide a set of header
	files that include definitions of all the items defined
	by ANSI  and/or POSIX.  These would not, however, include
	Psion specific material.

	Psion have also graciously given permission to distribute
	include files based on material in the Psion C SDK.  For
	this release we have decided not to do so as we expect
	any serious users would have access to the C SDK, and can
	copy these include files themselves.   However, we are
	prepared to reconsider that decision based upon any
	feedback that we might get. Be warned that the full set
	of Psion header files is very large - particularily if
	you include the OOPS oriented ones as well.


	TEMPORARY FILES
	~~~~~~~~~~~~~~~
	While the CPOC system is running, it will create
	temporary files to pass information between various
	phases of the compilation process.  There must be
	sufficient space on the device set in the user
	preferences to hold these temporary files.   It is
	recommended that you avoid using drive M: for these
	temporary files as this would impact the space available
	for the programs to use.  CPOC will automatically delete
	these temporary files when they are no longer needed.

	SHAREWARE STATUS AND REGISTRATION
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	It is intended that the CPOC software will be made
	available on a shareware basis.   As the software is
	still under active development, you can currently use the
	CPOC software for free. For this release you can use the
	following registration key:
	0114f78e-7f02e2fd
	This key will stop working when we make the 1.0 release
	of  CPOC.  We would welcome, however, any feedback on the
	methods  we have used to encourage registration.   We
	think we have struck a good balance between not crippling
	the software, but also giving just enough incentive to
	make regular users decide to register.

	If by any chance anyone thinks that CPOC is already good
	enough to register even though it is not yet a
	requirement, then we will treat such voluntary
	contributions as counting towards the shareware
	registration fee for the 1.0 release (probably counting
	double for being so honest!).  We have not yet decided on
	the registration fee, but were thinking that something
	like 20 UK pounds(30 US dollars) would be about right -
	again feedback on whether you think would be prepared to
	register the finished product at this price.

	SOURCE AVAILABILITY
	~~~~~~~~~~~~~~~~~~~
	The source is not generally distributed as it is very
	large (several megabytes in size).  The source for the
	everything except the CPOC front-end are available if
	you want them.    To obtain such source then please
	use one of the contact routes mentioned for feedback.

	KNOWN LIMITATIONS AND CONSTRAINTS
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	-       Large files may fail to compile due to the memory
	constraints that are imposed on Psion programs.
	This limitation can be avoided if you keep down the
	size of your source files, and (most important) you
	limit the number of header files that you include.

	-       It is not possible to compile Psion Object Oriented
	programs if they include the <hwimman.g> header file
	(which then includes LOTS of other header files) due
	to these memory constraints.  This constraint can
	sometimes be avoided by only including those headers
	that you actually really need.

	-       If you have a project that contains more than two
	files, and you try to remove files such that there
	will only be one left then the CPOC front-end will
	fail with a PANIC message.  This is a bug that we
	hope to resolve for the next release.

	FEEDBACK
	~~~~~~~~
	Feedback will be welcomed.  For details on the various
	methods whereby we can be contacted look up the help on
	the "About"  menu item while running the CPOC front-end
	program.

	COPYRIGHT
	~~~~~~~~~
	The CPOC system is (c)copyright 1995/1996 by
	K.D. Walker
	and     D.J. Walker
	All rights reserved.

	DISCLAIMER
	~~~~~~~~~~
	Although CPOC has been extensively tested, the authors
	shall not be responsible for any loss of any kind due to
	its use. It is the user's responsibility to establish the
	suitability of the CPOC software for the use to which it
	to be put.

Best greetings from
J. Sagaj
JosipSagaj@bigfoot.com


From: ali-manson@psion.com (Alasdair Manson)
Subject: Re: Icon arrangement in system screen
Date: Fri, 23 May 1997 14:24:21 GMT

On Fri, 23 May 1997 01:18:18 -0500, jfmezei
<"[nospam]jfmezei"@videotron.ca> wrote:

>Actually, there isn't a "system screen". The "desktop" you see is
>actually the output of the WINDOW SERVER. It is the process which 
>handles a lot of the interactivity between you and the PSION.

What ? The System screen which displays your icons is an application
called SYS$SHLL.IMG - it's no different, broadly speaking, than any
other application.

The Window Server is a process called SYS$WSRV (as it happens,
SYS$SHLL is a client of the Window Server (as are all applications
with any UI).

The System Screen is just one possible way of giving the user access
to the machine - there is nothing to stop a developer writing a
replacement - if you call it SYS$SHLL.IMG, you can even override the
ROM-based SYS$SHLL when the machine boots.

regards
Ali


From: brenc@dass.Prestel.Co.UK (Ben Clifford)
Subject: Overriding the system shell (was Re: Icon arrangement in system screen)
Date: Sat, 24 May 1997 02:04:58 +0000

Alasdair Manson <ali-manson@psion.com> wrote:

: The System Screen is just one possible way of giving the user access
: to the machine - there is nothing to stop a developer writing a
: replacement - if you call it SYS$SHLL.IMG, you can even override the
: ROM-based SYS$SHLL when the machine boots.

Hey cool, I just tried that on my 3a - I copied CMDP.IMG to i
LOC::M:\SYS$SHLL.IMG, hit Ctrl-Shift-Psion-K on the system screen and it
rebooted into CMDP.

Unfortunately, I had to hard reset to get rid of it - you can't delete the
file with it running and there is no way to stop it running.

Make sure you have a backup before trying this at home, kids...
 
http://www.GeoCities.COM/SiliconValley/Lakes/7456/
PGP key D4C9C0B1 also available by blank mail to key@dass.prestel.co.uk


From: "Ron Abbott" <ronabb@ihug.co.nz>
Subject: OVAL Grid Control
Date: 27 May 1997 20:14:00 GMT

I am having trouble defining a grid control for a new application.
I have specified the directory (\DAT\) as the database name and the file
name as the Table Name, and defined 4 columns for the grid which match the
field names in type and name.
I am getting Grid/Database synchronisation error.
Any ideas ?


From: damien.lewis@hancorp.com.au (Damien Lewis)
Subject: Re: OVAL Grid Control
Date: Wed, 04 Jun 1997 16:29:35 GMT

"Ron Abbott" <ronabb@ihug.co.nz> wrote:

>I am having trouble defining a grid control for a new application.
>I have specified the directory (\DAT\) as the database name and the file
>name as the Table Name, and defined 4 columns for the grid which match the
>field names in type and name.
>I am getting Grid/Database synchronisation error.
>Any ideas ?

I have just purchased OVAL and have got a grid working without any
problems doing as you described. Do you have an index on your file?
Maybe this is causing some problem.

regards,
Damien

From: "Keld Laursen" <kl@mse-dk.com>
Subject: How do you bind the fields? (was Re: OVAL Grid Control)
Date: 4 Jun 1997 06:15:12 GMT

> "Ron Abbott" <ronabb@ihug.co.nz> wrote:
> >I am having trouble defining a grid control for a new application.
[snip]
> >Any ideas ?

> I have just purchased OVAL and have got a grid working without any
> problems doing as you described. Do you have an index on your file?
> Maybe this is causing some problem.
> regards,
> Damien
> 

I have tried using the grid myself. OVAL continously states that I have
not bound the columns to the database.
How do I do that?
The small booklet coming with OVAL does not show how, and I cannot find =
any help in the VB manuals.
The reference manual, that the booklet refers to is non-existing, and I =
am a C programmer.

Can somebody please show me the way (wail...)?
Description/example will be much appreciated.

Best regards,
Keld Laursen.

MSE Mobile Systems Engineering A/S
Tel: +45 8680 5399
Fax: +45 8680 5339
E-mail: kl@mse-dk.com


From: "Ron Abbott" <ronabb@ihug.co.nz>
Subject: Re: How do you bind the fields? (was Re: OVAL Grid Control)
Date: 4 Jun 1997 11:51:26 GMT

"Binding the columns" involves entering the "Database name" in the
properties (Make sure you only enter the directory name) and the Table name 
(The file name  xxxx.dbf)
Properties are displayed with F4.
Then each column from the grid must have a corresponding field name in the
database

I have made some progress - using numeric as the column type seems to cause
problems even if it is a numeric dbase field, especially if no data has been
entered. I have now displayed a grid by using only string fields.

Ron

Keld Laursen <kl@mse-dk.com> wrote in article
I have tried using the grid myself. OVAL continously states that I have not
bound the columns to the database.
How do I do that?
The small booklet coming with OVAL does not show how, and I cannot find any
help in the VB manuals.
The reference manual, that the booklet refers to is non-existing, and I am
a C programmer.

Can somebody please show me the way (wail...)?
Description/example will be much appreciated.


From: alan$@donor2.demon.co.uk (Alan Clifford)
Subject: OPL: How can I convert date& to a string
Date: 29 May 97 22:40:21 

Hello Stefan
Replying to a message of Stefan Ebert to All:

 SE> How can I convert the date in in the form date& (like given by dDate)
 SE> back to a readable form like "dd.mm.jj"

I wrote this for someone else earlier this week.
Looks like you need to use a system call (see the Psionics files).  I knocked 
this up which seems to work.

proc main:
 local regs%(6), flags%, dayno&(2), broken%(4)
 local date&, time&
 dinit "date test"
 date& = 0 :time& = 0
 ddate date&, "date", 0, 36400
 dtime time&, "time", 1, 0, 86399
 dialog
 dayno&(1) = date&
 dayno&(2) = time&
 regs%(1) = $0600  rem AX
 regs%(5) = addr(dayno&()) rem SI
 regs%(6) = addr(broken%()) rem DI
 flags% = os($89, addr(regs%()))
 rem use flags% to check for system call failure
 print peekb(uadd(addr(broken%()),2)) + 1, "/",
 print peekb(uadd(addr(broken%()),1)) + 1, "/",
 print peekb(addr(broken%())) + 1900
 print peekb(uadd(addr(broken%()),3)), ":",
 print peekb(uadd(addr(broken%()),4)), ":",
 print peekb(uadd(addr(broken%()),5))
 print "press a key to end"
 get
endp

Alan
(Please remove the $ in the address if replying by email)

From: "Martin N. Dunstan" <mnd@dcs.st-andrews.ac.uk>
Subject: Re: OPL: How can I convert date& to a string
Date: Fri, 30 May 1997 13:16:38 +0100
To: Stefan.Ebert@t-online.de

Stefan Ebert wrote:
> How can I convert the date in in the form date& (like given by dDate)
> back to a readable form like "dd.mm.jj"

   Try the SECSTODATE function - you just need to be careful
with overflows and base dates (ddate counts from 01/01/1900
while SECSTODATE counts from 01/01/1970).

Martin

From: Matthew Ashton <matthew@mwashton.demon.co.uk>
Subject: Re: Date/Time conversion help needed
Date: Sat, 31 May 1997 16:38:03 +0100

<vizlmagic@aol.com> writes
>Looking to create a date/time stamp. Using Macsys I can get:
>
>Tue 27 May 1997 19:26:45
>
>with "datim$" 
>
>What I want to know is how do I convert the results to:
>
>May 27, 1997 - 7:26pm
>
>Anyone already do this or know how? 
>

You could use MID$ to get the various parts of DATIM$ and put them in
the right order, then use VAL to get the numbers for the time, convert
it to 12hr time then use NUM$ to convert it back to a string.

Or maybee I'm just doing it the hard way...
-- 
Thomas
Thomas@mwashton.demon.co.uk
http://www.mwashton.demon.co.uk/

From: David@kurzbyrn.demon.co.uk (David Kurtz)
Subject: Re: dDATE
Date: Sun, 01 Jun 97 20:39:34 GMT

nicko@nildram.co.uk "Phil Spencer" writes:
> Hi,
>
> I have a small question for the experts out there.  How can I convert
> the output value from a dDATE into a text value so that I can, for
> instance, print the resultant date.  If there's some easy command to
> do this, I'll kick myself, because I can't find it anywhere in the
> programming book for OPL which I have!  What I'm after is something
> like this:
>
> LOCAL Date&,Date$(30)
> dINIT "Enter date"
> dDATE Date&,"Date",0,DAYS(2059,12,31)
> DIALOG
> REM Some suitable code to convert Date& to text and
> REM then place that text into Date$ goes here!
> GIPRINT "Date set to "+Date$
>
> That's a basic illustration.  Can anyone help?
>
> Thanks in advance,
>
> Phil
>

REM ---------------------------------------------------
REM This procedure converts a day to a displayable date (DD/MM/YYYY) in a
string
PROC Dspdate$:(CalcDat&)
  LOCAL nowt%
  nowt%=Days2Day:(CalcDat&)
  RETURN
RIGHT$("00"+FIX$(day%,0,2),2)+"/"+RIGHT$("00"+FIX$(month%,0,2),2)+"/"+FI
X$(year%,0,4)
ENDP
REM ---------------------------------------------------
REM This appears to be the only way to break a date
REM into days months and years - it also works for
REM dates prior to 01/01/1970
PROC Days2Day:(days&)
     LOCAL dyscent&(2),dateent%(4)
     LOCAL flags%,ax%,bx%,cx%,dx%,si%,di%
     dyscent&(1)=days&
     si%=ADDR(dyscent&())
     di%=ADDR(dateent%())
     ax%=$0600 :REM TimDaySecondsToDate fn.
     flags%=os($89,ADDR(ax%)) :REM TimManager int.
     IF flags% and 1
	  RAISE (ax% or $ff00)
     ELSE
    year%=PEEKB(di%)+1900
    month%=PEEKB(UADD(di%,1))+1
    day%=PEEKB(UADD(di%,2))+1
     RETURN peekw(UADD(di%,6))+1 :REM 112293
REM  RETURN peekw(di%+6)+1 :REM 112293
     ENDIF
ENDP

The above is as used in the program SOLAR from my website
http://www.kurzbyrn.demon.co.uk/psion.htm

David M. Kurtz
----------------------------------------------------------------------
  o__    home: david@kurzbyrn.demon.co.uk  voice: 0118-9462515
 _,>/'_  work: david_kurtz@peoplesoft.com  voice: 0118-9521320
(_) \(_)  web: http://www.kurzbyrn.demon.co.uk


From: heuven@pi.net (Rene Heuven)
Subject: Re: p_date()
Date: Sat, 31 May 1997 12:08:35 GMT

"Jerry Jackson" <jtmcap1@airmail.net> wrote:
>I have a short program that requires  the system date; however the value
>returned by p_date() is negative.

>ULONG sec;
>sec = p_date();
>p_printf("\nsec = %d",sec);

>the result is
>sec = -22095

>Any suggestions would be appreciated.

You make a 'small' mistake within your C programming. ULONG means
unsigned long. You should use something like:

p_printf("\nsec = %ld", sec);

%d is used for signed integer. If this doesnot work try:

char str[32];
str[p_gltob(str, p_date(), 10)] = NULL;

p_gltob converts a ULONG to buffer any radix
[source: SIBO C SDK, Vol. 2: Chapter 4 PLIB].

With kind regards,
Rene Heuven

From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: p_date()
Date: 31 May 1997 09:42:18 -0400

Jerry Jackson <jtmcap1@airmail.net> wrote:
>I have a short program that requires  the system date; however the value
>returned by p_date() is negative.
>
>p_printf("\nsec = %d",sec);

No, this is the problem. You're asking printf to print it as a signed value,
when you want an unsinged value, so change it to

p_printf("\nsec = %u",sec);


From: "Fionn Behrens" <fionn@unix-ag.org>
Date: Mon, 02 Jun 1997 20:00:00 +0100
Reply-To: "fionn" <fionn@unix-ag.uni-siegen.de>
Subject: Re: Reverse Translation

Paul wrote in <3392B3D0.3954@aic.net.au> about "Reverse Translation":

> Daniel Pfund wrote:
>
> > I think the person reverse translated *all* of those programs since the
> > code seems to be for the same "weird" name...
>
> As a soon-to-be Psion owner, I was looking forward to learning OPL and
> writing ShareWare for it.  After all, I have done that for the Amiga and
> enjoyed some limited success.  Anyway, after reading the posts in this
> newsgroup, I have come to the conclusion that:
>
> (1) Psion software can be easily reverse-translated by hackers...

There are ways to protect OPL code from reverse translation. The effectivity
of the various methods (hello to all those zero-stringlength people out
there) depends on your knowledge of the Qcode internals. Looking at (not
reverse translating!) the shareware programs of other authors is generally a
good idea since a few of them have developed quite nice strategies which
can be recombined to make reverse translation a job so hard, that it is
hardly worth the effort.
There is no final anti-revtran protection scheme, alas, but there is none
for assembler, too.

> (2) ...which leads to the question: Why bother writing software?

Most users in the Psion market are remarkably honest and many of them paid
so much money for their Psion that they obviously see no hardship in flipping
out some extra bucks for good software. Have a look at the registration counts
on Steve Litchfield's webpage. Most of the programs listed there are OPL
and some of the authors must have an easy going with the income gained from
their software.

> On the Amiga, my Blitz2 source code was translated to assembly before
> distribution, thus ensuring it was safe from hackers.  There was no way
> possible to reverse-translate the executable back to Blitz2 code again.

No. But hacking the software was as possible as it is with OPL. Not to mention
that the amiga community was full of assembler kids whose days were made by
people not wanting their Blitz-Shareware-Super-Duper programs to be cracked.

> But if OPL can be easily reverse-translated, then what's the point in
> releasing something as ShareWare?  It might as well be FreeWare from the
> start.  Is there some documented method of protecting an OPL program from
> reverse-translation?  And why was this feature available in the first place?

This feature was not available in the first place but became possible trough
a program named RevTran, written by Mike Rudin which did a piece of genius
work, if you ask me. I would never ever have dared to create something like
this in OPL. The usual OPL restrictions cannot be overcome by RevTran though
and the number of revtranslatable variables, line length and such is limited.
In addition the translated OPL code (Qcode) is heavily stack-based and
errors introduced in small snippets of normally unused Qcode (f.e. in
conditionals that never will be executed) are very hard to be traced back or
even be corrected automatically. They usually have to be fixed by hand using
a hex editor (which requires quite a bit of knowledge), else RevTran will
hiccup every time it steps onto them and gratefully quit, leaving a weird
error message.

The guy who posted the shareware codes used RevTran to decode some programs
that seem to have been not or only very lightly protected. Programs like
Shangai which are also in OPL seem to use more effective protection schemes
which proved to be too hard for him which was why he asked for their code,
obviously.

Last but not least you can use a different approach for your software and do
like Barry C. does with his Reader program: Distribute a limited public
demo and send the full (personalized) version to registered users only.
A program with no key file routines obviously cannot be compromised by
fake registrations. And the possibility of a registered user giving away
his personalized copy to a hacker for cracking converges to zero in the
Psion marked as I got to know it.

Hope this gave you some new insights.

f'up set to programmer

Regards,
Fionn 

From: "Yvonne Budel" <BudelY@tref.nl>
Subject: CRC question
Date: 2 Jun 1997 17:55:20 GMT

Hello,
I tried to use the crc interrupt on a buffer containing 1 zero byte using

proc crctst:
	local crc%,frame$(255)
	frame$=chr$(0)
	crc%=CALL($298b,0,len(frame$),$FFFF,uadd(addr(frame$),1))
	print hex$(crc%)
	get
endp

I get $E1F0
Using a C algorithm from another source (irlap11.doc on www.irda.com) I get
$0F87, which seems to be correct.
Should I call the interrupt in another way?
(The value of $FFFF as "previous checksum" is intentional.)

In confusion awaiting a reply,
Fons Botman

Fn $8B Sub $29
GenCrc
    AX: -> CRC
    CX: buffer length
    DX: previous CRC
    SI: buffer
Calculates the CCITT Cyclic Redundancy Checksum using the X^16+X^12+X^5+1
polynomial. If the buffer is to be checked standalone, use zero as the
previous checksum. If several blocks are to be checksummed as if they 
were one long block, use 0 for the first block, and the previous result 
for the remainder.

From: "Martin N. Dunstan" <mnd@dcs.st-andrews.ac.uk>
Subject: Re: CRC question
Date: Tue, 03 Jun 1997 11:31:21 +0100
To: Yvonne Budel <BudelY@tref.nl>

Yvonne Budel wrote:
> proc crctst:
>         local crc%,frame$(255)
>         frame$=chr$(0)
>         crc%=CALL($298b,0,len(frame$),$FFFF,uadd(addr(frame$),1))
>         print hex$(crc%)
>         get
> endp
>
> I get $E1F0
> Using a C algorithm from another source (irlap11.doc on www.irda.com) I get
>$0F87,

   There are a whole variety of methods for calculating CRC's so
you need to make sure that your C program is generating the same
type of CRC as the Psion one. Check things like byte ordering,
the polynomial used etc. and see if they agree. It does work:
I've used a C version on UNIX which generated the same values
as GenCRC for a PIC<->PBM file converter I wrote. It also gives
$E1F0 as the result for a single byte of value 0 and initial
CRC of value -1.

Martin

From: Jim Pollock <jpollock@ix.netcom.com>
Subject: Re: CRC question
Date: Sun, 08 Jun 1997 08:50:38 -0700
Reply-To: jpollock@ix.netcom.com

Yvonne Budel wrote:
> 
> Hello,
> 
> I tried to use the crc interrupt on a buffer containing 1 zero byte using
> 
> proc crctst:
>         local crc%,frame$(255)
>         frame$=chr$(0)
>         crc%=CALL($298b,0,len(frame$),$FFFF,uadd(addr(frame$),1))
>         print hex$(crc%)
>         get
> endp
> 
> I get $E1F0
> Using a C algorithm from another source (irlap11.doc on www.irda.com) I get
> $0F87,
> which seems to be correct.
> Should I call the interrupt in another way?
> (The value of $FFFF as "previous checksum" is intentional.)
> 
> In confusion awaiting a reply,
> 
> Fons Botman
> 
> Fn $8B Sub $29
> GenCrc
>     AX: -> CRC
>     CX: buffer length
>     DX: previous CRC
>     SI: buffer
> Calculates the CCITT Cyclic Redundancy Checksum using the X^16+X^12+X^5+1
> polynomial. If the buffer is to be checked standalone, use zero as the
> previous
> checksum. If several blocks are to be checksummed as if they were one long
> block, use 0 for the first block, and the previous result for the
> remainder.

The Psion treats the bits of a word in reverse order from the irda
standard. If you notice $E1F0 does equal $0F87 if you flip the bits end
for end. Look at the numbers in binary.

$E1F0 = 1110 0001 1111 0000
$0F87 = 0000 1111 1000 0111

This is one of the things I found when writing my IR Communications
programs.

http://www.geocities.com/SiliconValley/Lakes/3947/

Jim Pollock


From: "estrad" <estrad@worldonline.nl>
Subject: printing a bitmap (*.pic)
Date: 4 Jun 1997 12:28:33 GMT

I want to print a bitmap with opl-source. How can I do this??????
I want to do this on a Hewlet Packard IIp.
Can anyone please help me????? I need it very soon!!

Thanks!!
Esther


From: "Keld Laursen" <kl@mse-dk.com>
Subject: Re: printing a bitmap (*.pic)
Date: 5 Jun 1997 07:06:20 GMT

> I want to print a bitmap with opl-source. How can I do this??????
> I want to do this on a Hewlet Packard IIp.
> Can anyone please help me????? I need it very soon!!
>=20
> Thanks!!
>=20
> Esther
> 

Hi, Esther

The approach I would use is like this:

Use gPEEKLINE(id%,xstart%,ystart%,data%(),width%)
This peeks a line into an integer array. Beware that you get 16 pixels =
per integer, with the leftmost pixel in the least significant bit.

I assume here, that I have already found out how many integers I will =
need:
rem init printer
string$=3Dchr$(27)+"*t300R" : rem set resolution. Resolution can be 75, =
100,150 and 300 dpi.
rem output to printer
rem this is to initialize output
string$=3Dchr$(27)+"*P"+fix$(x_pos_on_paper%,0,3)+"X"
string$=3Dstring$+chr$(27)+"*P"++fix$(y_pos_on_paper%,0,3)+"Y" rem set x =
and y position for output of this line
string$=3Dstring$+chr$(27)+"*r1A" rem start raster graphics at this =
line.
rem print string to printer
rem loop to output one single line
i%=3D1
string$=3Dchr$(27)+"*b"+fix$(antalbytes%,0,3)+"W" rem st
while(i%<maxinteger%)
	high%=3Ddata(i%)/256
	low%=3Ddata(i%) AND 255
	string$=3Dstring$+CHR$(low%)+chr$(high%)
	i%=3Di%+1
endwh
rem output line to printer
rem when the last line is output:
string$=3Dchr$(27)+"*rB"
rem output to printer

The printer commands used in the above are:
ESC*t#R, where # is the resolution you want to print in
ESC*P#X, where # is the x position on the paper (in the current =
resolution) horrisontal.
ESC*P#Y, where # is the y position on the paper (in the current =
resolution) vertical.
ESC*r1A is the command to start raster graphics at current cursor =
position
ESC*b#W(data), where # is the number of bytes and (data) is the string =
of bytes to be output.
ESC*rB is the command to end raster graphics.

You only need to position your cursor on the paper once, as you only =
need to start/end the raster graphics once.
For every graphic line you print, the cursor automatically returns to =
the (x,y+1) position for the next graphic line.

To make your graphics happen, you need to send a chr$(12) to the printer =
as the last thing. This will make the printer
eject the page.

Hope this helps
Keld Laursen
MSE Mobile Systems Engineering A/S
Tel: +45 8680 5399
Fax: +45 8680 5339
E-mail: kl@mse-dk.com


From: alan$@donor2.demon.co.uk (Alan Clifford)
Subject: Psion 3C Alarm
Date: 07 Jun 97 00:24:24 

Hello All

I've had a report that my Alarm Enhancer program doesn't work on the Psion 3C. 
I'm not altogether suprised considering it reads from the time process memory.

Help.

I'd like a copy or two of the time process memory from the 3c.  Below is a
small program that copies 8k of memory to \temp\temp.bin.  Please send me this
file so I can have a poke around.  Also, can you ensure that there is at least
one alarm set in Time and at least 1 in Agenda.

Also, the timpid% and almpid% should be the same.  Please let me know if they
are not.

Thanks in advance.

proc main:
 rem get alarm id
 local almpid%, timproc$(9), timpid%
 local regs%(6), flags%
 local block&(2048)
 local fd%, fname$(128)

 almpid% = call($2D8B,0,0,0,0,0)
 print "almpid", almpid%
 timproc$ = "TIME.$06" + chr$(0)
 timpid% = call($0188,uadd(addr(timproc$),1), 0,0,0,0)
 print "timpid", timpid%

 REM READ FROM ALARM BLOCK
 rem find the alarm block
 regs%(1) = $0000
 regs%(2) = almpid%
 regs%(3) = 8192
 regs%(5) = $0000
 regs%(6) = addr(block&())
 flags% = os($91, addr(regs%()),addr(regs%()))
 if flags% and 1
  print "alarm block read error"
  print "error:", err$(regs%(1) or $FF00)
  get
  stop
 endif

 rem save 8k to file
 print "open file"
 trap mkdir "\temp"
 ioopen(fd%, "\temp\temp.bin", ($0002 or $0100))
 print "write file"
 iowrite(fd%, addr(block&()), 8192)
 ioclose(fd%)
 print "press a key to end"
 get
endp

Alan
(Please remove the $ in the address if replying by email)

