Hello, all!
I know ALL about the numeric array technique on the web page, etc., etc.
I want to talk VERY specifically about DYNAMIC STRING ARRAYS IN TYPES.
^^^^^^^ ^^^^^
What we don't need to discuss: fixed length strings - know how to do deal
with those.
Let me pose an example to you, then a proposal of a NEW feature for PB:
My BBS uses Turbo Pascal structures which stores message area information
within an array, in a type structure. The structure essentially
reads an array block from 1 to "maxmsgareas", and each element of the
array can not exceed 35 characters, and are null padded. The "maxmsgareas"
was defined earlier in the structure - based on an $IF constant
declaration, so - even the total number of message areas can vary
from 200 to 500, depending on that constant.
With me so far?
I'm trying to make it clear that the data files are dynamic, meaning
an array from 1 to 200, or possibly 1 to 500 elements exists, and
each element can be 35 chars, null padded.
OK... Turbo Pascal has, built into is language, ARRAY types for
strings, with defined lengths for strings.
HOW do I do this (dynamic STRING arrays) in PB 3.2?
PROPOSED *IDEA* FOR COMMAND SYNTAX (EXAMPLE):
----------------------------------------------------------------------
%GOLDBASE=1
TYPE MsgBase
$IF %GOLDBASE
maxmsgareas=500
$ELSE
maxmsgareas=200
$ENDIF
AreaTitle as string array (1 to maxmsgareas) * 35
END TYPE
---------------------------------------------------------------------
(the above cannot work, there is no such command as "string array")
Look carefully at the above proposal. The highest element of the array
can VARY, is NOT static. It's dynamic. Yes, people, I know I
could do this instead:
Areaname as string * 7000 'then parse the string, 35 chars * 200 = 7000
BUT, when converting Turbo Pascal or C structures over, this is a royal
pain in the you know what, and also does NOT take into consideration
dynamic elements of the array.
So, my question (after you've seen the facts) is this:
WHEN, HOW, WILL (?) Power Basic support ARRAY TYPES for strings in TYPE
structures, complete with dynamic allocation of the elements?? Could
it be done in the syntax similar to what I proposed above? I am
glad pointers made it in to 3.2, but -- not installing this array
stuff -- it's long overdue, would everyone here agree or not?
Better ideas??? HELP!!! All I wanna do is use string array types in
PB 3.2 TYPE statements, read the data into the buffer, period, end
of story. I don't wanna program bells and whistles... but right now
it appears I do.
-James (SysOp/AD Message System)
--- QuickBBS 2.80 GoldBase (Zeta-2.0a)
---------------
* Origin: [Team QuickBBS] [Team OmegaSoft] [PB Fanatic!] (FIDONET 1:109/611)
|