Re: [Ql-Users] RET_STK and debugging SBASIC code

2014-07-08 Thread Wolfgang Lenerz

Hi Michael,


PICK$ will select the nth item from the list that follows the n.

Consider  PICK$(n, "aaa", "bbb", "ccc", "ddd", "etc")

If n is 1 then PICK$ will return "aaa" because it is the 1st item in the list.  If n is 5 
then "etc" would be returned because it is the 5th item.  The parameters of PICK$ can be of 
any type: they will be coerced into strings.  Expressions can be supplied, for example, dev$ & 
file$.



Ah OK, thanks.


There is a particular problem that PICK$ may help us to solve.  Occasionally, 
we may want to iterate through a list of items.  If these items are strings, 
then we may well reach for a FOR loop and do something like . . .

(...)

Which version do you prefer?


I'd probably use an array.



Thanks though, this looks like an interesting keyword!

Wolfgang

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


[Ql-Users] RET_STK and debugging SBASIC code

2014-07-08 Thread Michael Bulford
Hi Wolfgang,

PICK$ will select the nth item from the list that follows the n.

Consider  PICK$(n, "aaa", "bbb", "ccc", "ddd", "etc")

If n is 1 then PICK$ will return "aaa" because it is the 1st item in the list.  
If n is 5 then "etc" would be returned because it is the 5th item.  The 
parameters of PICK$ can be of any type: they will be coerced into strings.  
Expressions can be supplied, for example, dev$ & file$.
 
There is a particular problem that PICK$ may help us to solve.  Occasionally, 
we may want to iterate through a list of items.  If these items are strings, 
then we may well reach for a FOR loop and do something like . . .

FOR x$ = "aaa", "bbb", "ccc", "ddd", "etc" 

Unfortunately, this is not allowed.  The identifier for a FOR loop has to be 
numeric, either floating point or integer.  This leaves us with a problem: how 
to do the above? 
There is a way to do this.  A normal numeric FOR loop could be used, and then 
assign values to x$ depending on the FOR loop index, like this . . .

FOR n = 1 TO 5 
  SELect ON n = 1 : x$ = "aaa" : = 2 : x$ = "bbb" : = 3 : x$ = "ccc" : = 4 : x$ 
= "ddd" : = 5 : x$ = "etc"

This can also be done using PICK$ . . .

FOR n = 1 TO 5 
  X$ = PICK$(n, "aaa", "bbb", "ccc", "ddd", "etc")

Which version do you prefer?

The version using PICK$ may be more readable, but please bear in mind the 
following.  PICK$ will evaluate all of its parameters before deciding  which 
value to return, so, in terms of efficiency, this would not be the best choice. 
 If outright execution speed is top priority, then the Select version should be 
chosen.

What I like about PICK$ is the readability factor.  I use PICK$ in my own 
programs and can recommend it.

Michael
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] EasyPointer 4 query.

2014-07-08 Thread Wolfgang Lenerz

Hi,


Having recently returned to the QL and more specifically, to SuperBASIC
programming with EasyPointer 4, I am trying to avoid doing a lot of time
consuming work to no avail. I understand that there is a limit to the
number of objects (loose items, application windows, etc.)


Ummm, yes and no.

Leaving aside memory constraints, loose menu items have an item number, 
which is word sized. So, presuming the item number to be a signed value, 
 a max nbr of 32768 items with unique item numbers are possible. Mind, 
the documentation doesn't state that the item numbers have to be unique, 
but if you're programming in SBASIC under QPTR, they'd better be, 
because I believe that is what is returned as the item hit. I'm not sure 
what Easyptr does in this respect.


As to application subwindows themselves, there is no limit to the number 
of these appsub windows I'm aware of.


For objects (menu items) in a menu application subwindow : again, there 
is no linit of objects per se. Objects, too, have an item number, but 
several objects may have the same item number. However, here again, the 
QPTR basic interface returns the item number and if two objects have the 
same number you won't be able to tell which menu item was hit...


Finally, at least as far as QPTR is concerned, the objects or loose menu 
items are created using arrays, which means that there is a maximum of 
32768 loose menu items you can create, and 32768  objects for a single 
application menu object list (You could have several objects lists - but 
only one loose menu items list).


As an indication : I use my backup program sometimes to copy all files 
of one qxl.win container to an empty one. The program creates a list of 
all files that need to be backed up (and if the destination is empty, 
that means all files on the source need to be backed up). The list is 
then sorted and made into objects in a menu application subwindow.


So far, no problem with about 15000 objects.


HTH

Wolfgang






___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] EasyPointer 4 query.

2014-07-08 Thread Dilwyn Jones
Certainly, in my time I have written some programs with a very large number 
of loose items and I don't remember running into a limit with any of them, 
or for that matter seeing the answer to your question anywhere, John.


Since application window menus are usually created using arrays, those menus 
can be no bigger than the arrays (or the free memory available), but apart 
from that, I have never run into problems. One example I will cite is that 
of creating a menu to select a file from the entire content of my hard disk. 
Creating an array big enough for that list of files can be, ummm, a bit of a 
problem, as the emulator quickly runs out of memory!!!


Of course there is the practical issue that writing (or trying to write) a 
program big enough to run into limits on array size or number of loose items 
and info windows in SuperBASIC is likely to be a bit clumsy and impractical 
anyway.


While I appreciate it would be handy to have the limits documented, in 
practice - apart from what Tobias mentioned - you are very, very unlikely to 
run into any such limits.


Dilwyn

-Original Message- 
From: tobias.froesc...@t-online.de

Sent: Tuesday, July 08, 2014 5:28 PM
To: ql-us...@q-v-d.com
Subject: Re: [Ql-Users] EasyPointer 4 query.

John,

to my information, ther really is only one limitation built into the pointer 
environment (and no additional one in EasyPtr), which is the ability to 
selectively re-draw information sub-windows. As this call takes a 32-bit bit 
field as argument, you can only selectively re-draw the first 32 information 
sub-windows per window definition (WM.IDRW would be the relevant call). 
Other than that one (which you are not very likely to hit and if hit, 
wouldn't be a severe limitation), I'm not aware of any other limits.


Tobias

-Original-Nachricht-
Betreff: [Ql-Users] EasyPointer 4 query.
Datum: Tue, 08 Jul 2014 17:11:45 +0200
Von: John Gilpin 
An: ql-users 

Having recently returned to the QL and more specifically, to SuperBASIC
programming with EasyPointer 4, I am trying to avoid doing a lot of time
consuming work to no avail. I understand that there is a limit to the
number of objects (loose items, application windows, etc.) that can be
drawn onto one menu. I am convinced that I have read about this recently
either in the EasyPointer 4 Manual or in Norman Dunbar's splendid
tutorial articles in QUANTA Magazine in May, June and July 1994, but
having re-read these repeatedly, I still cannot find the reference I am
looking for.

Can anyone out there help me not only with this information but also
where it can be found. (Something like this, I like to highlight in the
publication (manual etc) so that if I need it again, it stands out, thus
avoiding having to re-read with great concentration, to find it.)

Thanks in advance,

Kind Regards,

John Gilpin.
QUANTA Membership Secretary
and QUANTA Treasurer
membership @quanta.org.uk
treasurer @quanta.org.uk

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm



___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm 


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] EasyPointer 4 query.

2014-07-08 Thread tobias.froesc...@t-online.de
John,

to my information, ther really is only one limitation built into the pointer 
environment (and no additional one in EasyPtr), which is the ability to 
selectively re-draw information sub-windows. As this call takes a 32-bit bit 
field as argument, you can only selectively re-draw the first 32 information 
sub-windows per window definition (WM.IDRW would be the relevant call). Other 
than that one (which you are not very likely to hit and if hit, wouldn't be a 
severe limitation), I'm not aware of any other limits.

Tobias

-Original-Nachricht-
Betreff: [Ql-Users] EasyPointer 4 query.
Datum: Tue, 08 Jul 2014 17:11:45 +0200
Von: John Gilpin 
An: ql-users 

Having recently returned to the QL and more specifically, to SuperBASIC 
programming with EasyPointer 4, I am trying to avoid doing a lot of time 
consuming work to no avail. I understand that there is a limit to the 
number of objects (loose items, application windows, etc.) that can be 
drawn onto one menu. I am convinced that I have read about this recently 
either in the EasyPointer 4 Manual or in Norman Dunbar's splendid 
tutorial articles in QUANTA Magazine in May, June and July 1994, but 
having re-read these repeatedly, I still cannot find the reference I am 
looking for.

Can anyone out there help me not only with this information but also 
where it can be found. (Something like this, I like to highlight in the 
publication (manual etc) so that if I need it again, it stands out, thus 
avoiding having to re-read with great concentration, to find it.)

Thanks in advance,

Kind Regards,

John Gilpin.
QUANTA Membership Secretary
and QUANTA Treasurer
membership @quanta.org.uk
treasurer @quanta.org.uk

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm



___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


[Ql-Users] EasyPointer 4 query.

2014-07-08 Thread John Gilpin
Having recently returned to the QL and more specifically, to SuperBASIC 
programming with EasyPointer 4, I am trying to avoid doing a lot of time 
consuming work to no avail. I understand that there is a limit to the 
number of objects (loose items, application windows, etc.) that can be 
drawn onto one menu. I am convinced that I have read about this recently 
either in the EasyPointer 4 Manual or in Norman Dunbar's splendid 
tutorial articles in QUANTA Magazine in May, June and July 1994, but 
having re-read these repeatedly, I still cannot find the reference I am 
looking for.


Can anyone out there help me not only with this information but also 
where it can be found. (Something like this, I like to highlight in the 
publication (manual etc) so that if I need it again, it stands out, thus 
avoiding having to re-read with great concentration, to find it.)


Thanks in advance,

Kind Regards,

John Gilpin.
QUANTA Membership Secretary
and QUANTA Treasurer
membership @quanta.org.uk
treasurer @quanta.org.uk

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm