Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

24 Apr, 2024: Testing a new version of the Overboard here. If you have an issue post about it to rocksolid.nodes.help (I know. Everyone on Usenet has issues)


computers / comp.os.vms / DEC Basic and dynamic memory ?

SubjectAuthor
* DEC Basic and dynamic memory ?Simon Clubley
+* Re: DEC Basic and dynamic memory ?seasoned_geek
|`* Re: DEC Basic and dynamic memory ?Simon Clubley
| +* Re: DEC Basic and dynamic memory ?Arne Vajhøj
| |`* Re: DEC Basic and dynamic memory ?Simon Clubley
| | `* Re: DEC Basic and dynamic memory ?Arne Vajhøj
| |  `* Re: DEC Basic and dynamic memory ?Simon Clubley
| |   +- Re: DEC Basic and dynamic memory ?Arne Vajhøj
| |   `* Re: DEC Basic and dynamic memory ?Dave Froble
| |    +- Re: DEC Basic and dynamic memory ?Arne Vajhøj
| |    `* Re: DEC Basic and dynamic memory ?Simon Clubley
| |     `- Re: DEC Basic and dynamic memory ?Dave Froble
| +* Re: DEC Basic and dynamic memory ?Dave Froble
| |`- Re: DEC Basic and dynamic memory ?Simon Clubley
| `- Re: DEC Basic and dynamic memory ?Arne Vajhøj
+* Re: DEC Basic and dynamic memory ?Arne Vajhøj
|`* Re: DEC Basic and dynamic memory ?Dave Froble
| +* Re: DEC Basic and dynamic memory ?Arne Vajhøj
| |`* Re: DEC Basic and dynamic memory ?Simon Clubley
| | +* Re: DEC Basic and dynamic memory ?Arne Vajhøj
| | |`* Re: DEC Basic and dynamic memory ?Simon Clubley
| | | +* Re: DEC Basic and dynamic memory ?Arne Vajhøj
| | | |`* Re: DEC Basic and dynamic memory ?Simon Clubley
| | | | +- Re: DEC Basic and dynamic memory ?Arne Vajhøj
| | | | `- Re: DEC Basic and dynamic memory ?Dave Froble
| | | `* Re: DEC Basic and dynamic memory ?Dave Froble
| | |  `* Re: DEC Basic and dynamic memory ?Simon Clubley
| | |   +- Re: DEC Basic and dynamic memory ?Arne Vajhøj
| | |   +- Re: DEC Basic and dynamic memory ?Craig A. Berry
| | |   `* Re: DEC Basic and dynamic memory ?Dave Froble
| | |    `* Re: DEC Basic and dynamic memory ?Arne Vajhøj
| | |     `* Re: DEC Basic and dynamic memory ?Dave Froble
| | |      `- Re: DEC Basic and dynamic memory ?Simon Clubley
| | `* Re: DEC Basic and dynamic memory ?Bill Gunshannon
| |  `- Re: DEC Basic and dynamic memory ?Arne Vajhøj
| `- Re: DEC Basic and dynamic memory ?Arne Vajhøj
+- Re: DEC Basic and dynamic memory ?Dave Froble
+- Re: DEC Basic and dynamic memory ?Stephen Hoffman
`* Re: DEC Basic and dynamic memory ?Richard Maher
 `- Re: DEC Basic and dynamic memory ?VAXman-

Pages:12
DEC Basic and dynamic memory ?

<st1hr5$c5h$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20364&group=comp.os.vms#20364

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: DEC Basic and dynamic memory ?
Date: Fri, 28 Jan 2022 19:57:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <st1hr5$c5h$1@dont-email.me>
Injection-Date: Fri, 28 Jan 2022 19:57:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7d59e8ae9bb1f8e037ea6aa3ac673804";
logging-data="12465"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182Q/7ubSiCJMLDqYVjYx+F8GewEtM7XVA="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:aUASHsHp9qr+fGy9XnRLabOAUAw=
 by: Simon Clubley - Fri, 28 Jan 2022 19:57 UTC

On 2022-01-28, Dave Froble <davef@tsoft-inc.com> wrote:
> On 1/28/2022 12:31 PM, John Reagan wrote:
>> 4) As we've discussed the BASIC cross-compiler is still not available due to G2L not being
>> able to totally handle how the BASIC MAP statement is described to GEM. The GEM to
>> LLVM module for common blocks is radically different. Could you write a DIRECTORY
>> replacement in BASIC without using MAP?
>
> Why, yes, I'm rather sure I could. For example, from one of my routines:
>
> RECORD FABBLK !
> RECORD NAMBLK !
> RECORD FIBBLK ! FIB structure
>
> And now I'm waiting for you to say that the Basic RECORD statement has the same
> problems as MAP.
>

How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
a custom data structure in dynamic memory and then walk the tree
either depth-first or breadth-first ?

I've had a quick look at the dynamic storage section of the DEC Basic user
manual, but I don't see how you link a set of nodes together into a tree.
However, as mentioned previously, I don't know DEC Basic and searching
for the word pointer didn't reveal anything appropriate, so I assume
it's another keyword I am not aware of.

In addition, how easy is this to do if the nodes are not all of the
same record type, but have a common tag at the start of each record
to say what kind of record it actually is ? I see you have variant
records in DEC Basic. Do they also work in a dynamic memory based
tree structure ?

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: DEC Basic and dynamic memory ?

<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20370&group=comp.os.vms#20370

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ad4:5c61:: with SMTP id i1mr7302731qvh.90.1643407746820;
Fri, 28 Jan 2022 14:09:06 -0800 (PST)
X-Received: by 2002:ac8:588a:: with SMTP id t10mr1107348qta.540.1643407746640;
Fri, 28 Jan 2022 14:09:06 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Fri, 28 Jan 2022 14:09:06 -0800 (PST)
In-Reply-To: <st1hr5$c5h$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=38.240.143.133; posting-account=z_53ZAoAAABPLJW38_4Jh_R33ylRkSCo
NNTP-Posting-Host: 38.240.143.133
References: <st1hr5$c5h$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
Subject: Re: DEC Basic and dynamic memory ?
From: rol...@logikalsolutions.com (seasoned_geek)
Injection-Date: Fri, 28 Jan 2022 22:09:06 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 37
 by: seasoned_geek - Fri, 28 Jan 2022 22:09 UTC

On Friday, January 28, 2022 at 1:57:28 PM UTC-6, Simon Clubley wrote:
>
> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
> a custom data structure in dynamic memory and then walk the tree
> either depth-first or breadth-first ?
>

The statement that you want is

DIM

create a (I haven't hacked BASIC for a while and didn't log into Eisner to test this so take the concept, not the syntax, as being pure)

RECORD SOME_RECORD
STRING IN_USE=1%
STRING SOME_KEY_VALUE=15%
INTEGER PREV_REC
INTEGER NEXT_REC
STRING WHOLE_LOT_OF_STUFF=255%
! other fields
END RECORD

As you learned in data structures class, you put the subscripts in as you add records.
You have to keep the doubly linked list in order yourself, but if you set IN_USE to CVT%$(255%) or even just "Z" for every empty record you can even sort well.

Oh, you don't like it as a doubly linked list?

RECORD SOME_RECORD
STRING IN_USE=1%
STRING SOME_KEY_VALUE=15%
INTEGER LEFT_NODE
INTEGER RIGHT_NODE
INTEGER PARENT_NODE
STRING WHOLE_LOT_OF_STUFF=255%
! other fields
END RECORD

You can even redimension if need be.

Re: DEC Basic and dynamic memory ?

<61f49984$0$697$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20378&group=comp.os.vms#20378

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Fri, 28 Jan 2022 20:33:48 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st1hr5$c5h$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 215
Message-ID: <61f49984$0$697$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 13ebfba3.news.sunsite.dk
X-Trace: 1643420037 news.sunsite.dk 697 arne@vajhoej.dk/68.9.63.232:63734
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Sat, 29 Jan 2022 01:33 UTC

On 1/28/2022 2:57 PM, Simon Clubley wrote:
> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
> a custom data structure in dynamic memory and then walk the tree
> either depth-first or breadth-first ?
>
> I've had a quick look at the dynamic storage section of the DEC Basic user
> manual, but I don't see how you link a set of nodes together into a tree.
> However, as mentioned previously, I don't know DEC Basic and searching
> for the word pointer didn't reveal anything appropriate, so I assume
> it's another keyword I am not aware of.
>
> In addition, how easy is this to do if the nodes are not all of the
> same record type, but have a common tag at the start of each record
> to say what kind of record it actually is ? I see you have variant
> records in DEC Basic. Do they also work in a dynamic memory based
> tree structure ?

Basic is different than C and Pascal. You do not call a dynamic
allocation function and get back a machine address that you need
to free later.

But you can do a tree by using a dynamic sized array and indexes
into that as "pointers".

And Basic map dynamic is similar to C union.

Example code (maybe not super elegant - either because
it is not the right language for the task or because my Basic
skills are very limited - but it seems to work):

$ typ tree.bas
record treenoderec
long v
long styp
string s = 512
long pnode
long lnode
long rnode
end record

declare integer constant STRING_TYP = 1
declare integer constant INTEGER_TYP = 2
declare integer constant DECIMAL_TYP = 3
$ typ dyn.bas
program dyn

%include "tree.bas"

external sub tree_insert(treenoderec dim(), long, long, long, string)
external sub tree_print(treenoderec dim())
external sub tree_dump(treenoderec dim(), long)

declare long top
declare long capacity
top = 0
capacity = 1
dim treenoderec tree (1 to capacity)
map (u) string sv = 512
map dynamic (u) long iv
map dynamic (u) decimal zv

declare long i, j

for i = 1 to 10
sv = "Nothing"
call tree_insert(tree(), top, rnd * 1000, STRING_TYP, sv)
if top = capacity then
gosub extend_tree_array
end if
next i
iv = 123
call tree_insert(tree(), top, 499, INTEGER_TYP, sv)
zv = 123.45
call tree_insert(tree(), top, 501, DECIMAL_TYP, sv)
call tree_dump(tree(), top)
call tree_print(tree())
exit program

extend_tree_array:
dim treenoderec temp(1 to capacity)
for j = 1 to capacity
temp(j) = tree(j)
next j
capacity = 2 * capacity
dim treenoderec tree (1 to capacity)
for j = 1 to capacity / 2
tree(j) = temp(j)
next j
return

end program
! sub tree_update(treenoderec tree(), long top, long ix)

%include "tree.bas"

if tree(top)::v < tree(ix)::v then
if tree(ix)::lnode = 0 then
tree(ix)::lnode = top
tree(top)::pnode = ix
else
call tree_update(tree(), top, tree(ix)::lnode)
end if
else
if tree(ix)::rnode = 0 then
tree(ix)::rnode = top
tree(top)::pnode = ix
else
call tree_update(tree(), top, tree(ix)::rnode)
end if
end if

end sub
! sub tree_insert(treenoderec tree(), long top, long v, long styp, string s)

%include "tree.bas"

external sub tree_update(treenoderec dim(), long, long)

declare long ix

top = top + 1
tree(top)::v = v
tree(top)::styp = styp
tree(top)::s = s
tree(top)::lnode = 0
tree(top)::rnode = 0
if top = 1 then
tree(top)::pnode = 0
else
call tree_update(tree(), top, 1)
end if

end sub
! sub tree_print_part(treenoderec tree(), long ix)

%include "tree.bas"

map (u) string sv = 512
map dynamic (u) long iv
map dynamic (u) decimal zv

if tree(ix)::lnode > 0 then
call tree_print_part(tree(), tree(ix)::lnode)
end if
sv = tree(ix)::s
if tree(ix)::styp = STRING_TYP then
print tree(ix)::v, trm$(sv)
end if
if tree(ix)::styp = INTEGER_TYP then
print tree(ix)::v, iv
end if
if tree(ix)::styp = DECIMAL_TYP then
print tree(ix)::v, zv
end if
if tree(ix)::rnode > 0 then
call tree_print_part(tree(), tree(ix)::rnode)
end if

end sub
! sub tree_print(treenoderec tree())

%include "tree.bas"

external sub tree_print_part(treenoderec dim(), long)

call tree_print_part(tree(), 1)

end sub
! sub tree_dump(treenoderec tree(), long top)

%include "tree.bas"

declare long i

for i = 1 to top
print
i,tree(i)::v,tree(i)::styp,tree(i)::pnode,tree(i)::lnode,tree(i)::rnode
next i

end sub
$ bas dyn
$ lin dyn
$ run dyn
1 763 1 0 2 3
2 179 1 1 0 5
3 902 1 1 4 0
4 889 1 3 7 0
5 387 1 2 8 6
6 475 1 5 0 9
7 882 1 4 0 0
8 185 1 5 0 10
9 638 1 6 11 0
10 269 1 8 0 0
11 499 2 9 0 12
12 501 3 11 0 0
179 Nothing
185 Nothing
269 Nothing
387 Nothing
475 Nothing
499 123
501 123.44
638 Nothing
763 Nothing
882 Nothing
889 Nothing
902 Nothing

Arne

Re: DEC Basic and dynamic memory ?

<st2ii8$5oj$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20382&group=comp.os.vms#20382

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dav...@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sat, 29 Jan 2022 00:16:00 -0500
Organization: A noiseless patient Spider
Lines: 224
Message-ID: <st2ii8$5oj$1@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me>
<61f49984$0$697$14726298@news.sunsite.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 29 Jan 2022 05:15:52 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="049b2048cd90355e97202a77db2e8642";
logging-data="5907"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GMv+97DlWkbJtX1h6Inzilfp7CNFM7YE="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:cPic6oW7UXW78aGI6g8dSPRYSXU=
In-Reply-To: <61f49984$0$697$14726298@news.sunsite.dk>
 by: Dave Froble - Sat, 29 Jan 2022 05:16 UTC

On 1/28/2022 8:33 PM, Arne Vajhøj wrote:
> On 1/28/2022 2:57 PM, Simon Clubley wrote:
>> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
>> a custom data structure in dynamic memory and then walk the tree
>> either depth-first or breadth-first ?
>>
>> I've had a quick look at the dynamic storage section of the DEC Basic user
>> manual, but I don't see how you link a set of nodes together into a tree.
>> However, as mentioned previously, I don't know DEC Basic and searching
>> for the word pointer didn't reveal anything appropriate, so I assume
>> it's another keyword I am not aware of.
>>
>> In addition, how easy is this to do if the nodes are not all of the
>> same record type, but have a common tag at the start of each record
>> to say what kind of record it actually is ? I see you have variant
>> records in DEC Basic. Do they also work in a dynamic memory based
>> tree structure ?
>
> Basic is different than C and Pascal. You do not call a dynamic
> allocation function and get back a machine address that you need
> to free later.
>
> But you can do a tree by using a dynamic sized array and indexes
> into that as "pointers".
>
> And Basic map dynamic is similar to C union.
>
> Example code (maybe not super elegant - either because
> it is not the right language for the task or because my Basic
> skills are very limited - but it seems to work):
>
> $ typ tree.bas
> record treenoderec
> long v
> long styp
> string s = 512
> long pnode
> long lnode
> long rnode
> end record
>
> declare integer constant STRING_TYP = 1
> declare integer constant INTEGER_TYP = 2
> declare integer constant DECIMAL_TYP = 3
> $ typ dyn.bas
> program dyn
>
> %include "tree.bas"
>
> external sub tree_insert(treenoderec dim(), long, long, long, string)
> external sub tree_print(treenoderec dim())
> external sub tree_dump(treenoderec dim(), long)
>
> declare long top
> declare long capacity
> top = 0
> capacity = 1
> dim treenoderec tree (1 to capacity)
> map (u) string sv = 512
> map dynamic (u) long iv
> map dynamic (u) decimal zv
>
> declare long i, j
>
> for i = 1 to 10
> sv = "Nothing"
> call tree_insert(tree(), top, rnd * 1000, STRING_TYP, sv)
> if top = capacity then
> gosub extend_tree_array
> end if
> next i
> iv = 123
> call tree_insert(tree(), top, 499, INTEGER_TYP, sv)
> zv = 123.45
> call tree_insert(tree(), top, 501, DECIMAL_TYP, sv)
> call tree_dump(tree(), top)
> call tree_print(tree())
> exit program
>
> extend_tree_array:
> dim treenoderec temp(1 to capacity)
> for j = 1 to capacity
> temp(j) = tree(j)
> next j
> capacity = 2 * capacity
> dim treenoderec tree (1 to capacity)
> for j = 1 to capacity / 2
> tree(j) = temp(j)
> next j
> return
>
> end program
> !
> sub tree_update(treenoderec tree(), long top, long ix)
>
> %include "tree.bas"
>
> if tree(top)::v < tree(ix)::v then
> if tree(ix)::lnode = 0 then
> tree(ix)::lnode = top
> tree(top)::pnode = ix
> else
> call tree_update(tree(), top, tree(ix)::lnode)
> end if
> else
> if tree(ix)::rnode = 0 then
> tree(ix)::rnode = top
> tree(top)::pnode = ix
> else
> call tree_update(tree(), top, tree(ix)::rnode)
> end if
> end if
>
> end sub
> !
> sub tree_insert(treenoderec tree(), long top, long v, long styp, string s)
>
> %include "tree.bas"
>
> external sub tree_update(treenoderec dim(), long, long)
>
> declare long ix
>
> top = top + 1
> tree(top)::v = v
> tree(top)::styp = styp
> tree(top)::s = s
> tree(top)::lnode = 0
> tree(top)::rnode = 0
> if top = 1 then
> tree(top)::pnode = 0
> else
> call tree_update(tree(), top, 1)
> end if
>
> end sub
> !
> sub tree_print_part(treenoderec tree(), long ix)
>
> %include "tree.bas"
>
> map (u) string sv = 512
> map dynamic (u) long iv
> map dynamic (u) decimal zv
>
> if tree(ix)::lnode > 0 then
> call tree_print_part(tree(), tree(ix)::lnode)
> end if
> sv = tree(ix)::s
> if tree(ix)::styp = STRING_TYP then
> print tree(ix)::v, trm$(sv)
> end if
> if tree(ix)::styp = INTEGER_TYP then
> print tree(ix)::v, iv
> end if
> if tree(ix)::styp = DECIMAL_TYP then
> print tree(ix)::v, zv
> end if
> if tree(ix)::rnode > 0 then
> call tree_print_part(tree(), tree(ix)::rnode)
> end if
>
> end sub
> !
> sub tree_print(treenoderec tree())
>
> %include "tree.bas"
>
> external sub tree_print_part(treenoderec dim(), long)
>
> call tree_print_part(tree(), 1)
>
> end sub
> !
> sub tree_dump(treenoderec tree(), long top)
>
> %include "tree.bas"
>
> declare long i
>
> for i = 1 to top
> print i,tree(i)::v,tree(i)::styp,tree(i)::pnode,tree(i)::lnode,tree(i)::rnode
> next i
>
> end sub
> $ bas dyn
> $ lin dyn
> $ run dyn
> 1 763 1 0 2 3
> 2 179 1 1 0 5
> 3 902 1 1 4 0
> 4 889 1 3 7 0
> 5 387 1 2 8 6
> 6 475 1 5 0 9
> 7 882 1 4 0 0
> 8 185 1 5 0 10
> 9 638 1 6 11 0
> 10 269 1 8 0 0
> 11 499 2 9 0 12
> 12 501 3 11 0 0
> 179 Nothing
> 185 Nothing
> 269 Nothing
> 387 Nothing
> 475 Nothing
> 499 123
> 501 123.44
> 638 Nothing
> 763 Nothing
> 882 Nothing
> 889 Nothing
> 902 Nothing
>
> Arne
>

Arne, I have difficulty following your code examples. Is it me, or you?

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: DEC Basic and dynamic memory ?

<st2je1$9fl$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20383&group=comp.os.vms#20383

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dav...@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sat, 29 Jan 2022 00:30:49 -0500
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <st2je1$9fl$1@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 29 Jan 2022 05:30:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="049b2048cd90355e97202a77db2e8642";
logging-data="9717"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FiXymtEYTLML7xau5z9teRZ0fBujbzyw="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:K8tW+Sh+RgpWwSY4OyPMSOAJRkU=
In-Reply-To: <st1hr5$c5h$1@dont-email.me>
 by: Dave Froble - Sat, 29 Jan 2022 05:30 UTC

On 1/28/2022 2:57 PM, Simon Clubley wrote:
> On 2022-01-28, Dave Froble <davef@tsoft-inc.com> wrote:
>> On 1/28/2022 12:31 PM, John Reagan wrote:
>>> 4) As we've discussed the BASIC cross-compiler is still not available due to G2L not being
>>> able to totally handle how the BASIC MAP statement is described to GEM. The GEM to
>>> LLVM module for common blocks is radically different. Could you write a DIRECTORY
>>> replacement in BASIC without using MAP?
>>
>> Why, yes, I'm rather sure I could. For example, from one of my routines:
>>
>> RECORD FABBLK !
>> RECORD NAMBLK !
>> RECORD FIBBLK ! FIB structure
>>
>> And now I'm waiting for you to say that the Basic RECORD statement has the same
>> problems as MAP.
>>
>
> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
> a custom data structure in dynamic memory and then walk the tree
> either depth-first or breadth-first ?

Linked lists are rather basic (sic) ..

> I've had a quick look at the dynamic storage section of the DEC Basic user
> manual, but I don't see how you link a set of nodes together into a tree.
> However, as mentioned previously, I don't know DEC Basic and searching
> for the word pointer didn't reveal anything appropriate, so I assume
> it's another keyword I am not aware of.

No, it is because you're attempting to use methods you'd use in C. Different
methods in Basic.

> In addition, how easy is this to do if the nodes are not all of the
> same record type, but have a common tag at the start of each record
> to say what kind of record it actually is ? I see you have variant
> records in DEC Basic. Do they also work in a dynamic memory based
> tree structure ?

Unless you're going to do your own LIB$Get_VM Basic doesn't do dynamic memory in
that manner. You can, but probably should not. I tend to assign adequate
storage for the task at hand.

An example of how I'd approach any such need:

Record NODES
Long ForwardLink
Long BackLink
Word InUse
String N$=64
End Record

DIM NODES List(999)

Might also:

DIM NODES List2(999)
DIM NODES List3(9999)

I'd probably have an integer variable pointing to the start of the list. Would
not have to be consecutive if nodes were being added and deleted. Could have an
integer pointing to beginning of unused nodes. (I avoid using the word POINTER,
though that's what they would be.)

Not going to go much further, other than to say that I've used linked lists,
tree structures, and such many times.

If you really want to get into such, take a look at my RMS_LOCKS.BAS on the VMS
freeware.

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: DEC Basic and dynamic memory ?

<st3rld$gl7$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20392&group=comp.os.vms#20392

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: seaoh...@hoffmanlabs.invalid (Stephen Hoffman)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sat, 29 Jan 2022 11:57:17 -0500
Organization: HoffmanLabs LLC
Lines: 40
Message-ID: <st3rld$gl7$1@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="8968a7bb382e4532597daf7f10deec10";
logging-data="17063"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+V2JLL3JpIPTqF+YiSuue828yH1brT1z0="
User-Agent: Unison/2.2
Cancel-Lock: sha1:jqw83lcM9e+j/gM1eEvz3Juw8Ts=
 by: Stephen Hoffman - Sat, 29 Jan 2022 16:57 UTC

On 2022-01-28 19:57:26 +0000, Simon Clubley said:

> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of a
> custom data structure in dynamic memory and then walk the tree either
> depth-first or breadth-first ?

MAP DYNAMIC and REMAP are the operators you're looking for, for the
approach you're envisioning.

Maybe involving the LIBRTL tree routines.

It's a slog. Lots of glue code. But it's workable.

Pragmatically, more than a few BASIC apps store will dynamic data
structures in key-value or other persistent file storage.

Not that I've met many BASIC apps that have used red-black or other trees.

With SSDs et al, the performance penalty for (misusing?) persistent
storage is much lower.

Without language support for pointers (for the ugly approach) and
without object support (for the cleaner approach), BASIC dynamic memory
data structures get clunky.

Moderate- and larger-sized apps necessarily also become multiple
sub-two-tebibyte storage chunks too, with all the "fun" that entails.

BASIC is a ripe target for 64-bit addressing and for the addition of
object support, as I've commented before.

With that, the binary tree can be implemented within the object
run-time (once, not everywhere), and the developer can (largely) ignore
the tree implementation details.

--
Pure Personal Opinion | HoffmanLabs LLC

Re: DEC Basic and dynamic memory ?

<61f580e4$0$704$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20395&group=comp.os.vms#20395

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sat, 29 Jan 2022 13:00:57 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st2ii8$5oj$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 57
Message-ID: <61f580e4$0$704$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 5335865c.news.sunsite.dk
X-Trace: 1643479268 news.sunsite.dk 704 arne@vajhoej.dk/68.9.63.232:53035
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Sat, 29 Jan 2022 18:00 UTC

On 1/29/2022 12:16 AM, Dave Froble wrote:
> On 1/28/2022 8:33 PM, Arne Vajhøj wrote:
>> On 1/28/2022 2:57 PM, Simon Clubley wrote:
>>> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
>>> a custom data structure in dynamic memory and then walk the tree
>>> either depth-first or breadth-first ?
>>>
>>> I've had a quick look at the dynamic storage section of the DEC Basic
>>> user
>>> manual, but I don't see how you link a set of nodes together into a
>>> tree.
>>> However, as mentioned previously, I don't know DEC Basic and searching
>>> for the word pointer didn't reveal anything appropriate, so I assume
>>> it's another keyword I am not aware of.
>>>
>>> In addition, how easy is this to do if the nodes are not all of the
>>> same record type, but have a common tag at the start of each record
>>> to say what kind of record it actually is ? I see you have variant
>>> records in DEC Basic. Do they also work in a dynamic memory based
>>> tree structure ?
>>
>> Basic is different than C and Pascal. You do not call a dynamic
>> allocation function and get back a machine address that you need
>> to free later.
>>
>> But you can do a tree by using a dynamic sized array and indexes
>> into that as "pointers".
>>
>> And Basic map dynamic is similar to C union.
>>
>> Example code (maybe not super elegant - either because
>> it is not the right language for the task or because my Basic
>> skills are very limited - but it seems to work):
>>
>> $ typ tree.bas
>> record treenoderec

>> $ typ dyn.bas
>> program dyn
>>
>> %include "tree.bas"

> Arne, I have difficulty following your code examples.  Is it me, or you?

Probably me.

:-)

In this case Simon outlined a problem where Pascal and C are obvious
languages and me with no Basic experience wrote some Basic code - that
is almost ensure an "unsual style". Or to put it another way: I am
(or was) a Fortran programmer and Fortran programmers can program
in Fortran in any language. :-)

Arne

Re: DEC Basic and dynamic memory ?

<61f58596$0$702$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20397&group=comp.os.vms#20397

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sat, 29 Jan 2022 13:20:59 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st2ii8$5oj$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 96
Message-ID: <61f58596$0$702$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 5335865c.news.sunsite.dk
X-Trace: 1643480470 news.sunsite.dk 702 arne@vajhoej.dk/68.9.63.232:53870
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Sat, 29 Jan 2022 18:20 UTC

On 1/29/2022 12:16 AM, Dave Froble wrote:
> On 1/28/2022 8:33 PM, Arne Vajhøj wrote:
>> On 1/28/2022 2:57 PM, Simon Clubley wrote:
>>> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
>>> a custom data structure in dynamic memory and then walk the tree
>>> either depth-first or breadth-first ?
>>>
>>> I've had a quick look at the dynamic storage section of the DEC Basic
>>> user
>>> manual, but I don't see how you link a set of nodes together into a
>>> tree.
>>> However, as mentioned previously, I don't know DEC Basic and searching
>>> for the word pointer didn't reveal anything appropriate, so I assume
>>> it's another keyword I am not aware of.
>>>
>>> In addition, how easy is this to do if the nodes are not all of the
>>> same record type, but have a common tag at the start of each record
>>> to say what kind of record it actually is ? I see you have variant
>>> records in DEC Basic. Do they also work in a dynamic memory based
>>> tree structure ?

>> $ typ tree.bas
>> record treenoderec

>> $ typ dyn.bas
>> program dyn
>>
>> %include "tree.bas"

> I have difficulty following your code examples.

If I were to try to explain the code then I needed 3 things.

1) a tree structure

which I did with an array of records and using element indexes
instead of traditional pointers/addresses.

>> record treenoderec
....
>>    long pnode
>>    long lnode
>>    long rnode
>> end record

>> declare long top
>> declare long capacity

>> dim treenoderec tree (1 to capacity)

>> sub tree_insert(treenoderec tree(), long top, ...)

>> sub tree_print(treenoderec tree())

2) dynamic allocation

which I did with DIM when the trees backing array needed
to be extended.

>> if top = capacity then
>> gosub extend_tree_array
>> end if

>> extend_tree_array:
>> dim treenoderec temp(1 to capacity)
>> for j = 1 to capacity
>> temp(j) = tree(j)
>> next j
>> capacity = 2 * capacity
>> dim treenoderec tree (1 to capacity)
>> for j = 1 to capacity / 2
>> tree(j) = temp(j)
>> next j
>> return

3) support for different types (C union, Pascal case record)

which I did with MAP and MAP DYNAMIC.

>> record treenoderec
....
>> long styp
>> string s = 512
....
>> end record

>> declare integer constant STRING_TYP = 1
>> declare integer constant INTEGER_TYP = 2
>> declare integer constant DECIMAL_TYP = 3

>> map (u) string sv = 512
>> map dynamic (u) long iv
>> map dynamic (u) decimal zv

Arne

Re: DEC Basic and dynamic memory ?

<st4t2h$gh9$2@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20421&group=comp.os.vms#20421

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!DkYGYmPW3YiGERopO5z+Ig.user.46.165.242.75.POSTED!not-for-mail
From: maher_rj...@hotmail.com (Richard Maher)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 10:27:31 +0800
Organization: Aioe.org NNTP Server
Message-ID: <st4t2h$gh9$2@gioia.aioe.org>
References: <st1hr5$c5h$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="16937"; posting-host="DkYGYmPW3YiGERopO5z+Ig.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Richard Maher - Sun, 30 Jan 2022 02:27 UTC

On 29/01/2022 3:57 am, Simon Clubley wrote:
> On 2022-01-28, Dave Froble <davef@tsoft-inc.com> wrote:
>> On 1/28/2022 12:31 PM, John Reagan wrote:
>>> 4) As we've discussed the BASIC cross-compiler is still not available due to G2L not being
>>> able to totally handle how the BASIC MAP statement is described to GEM. The GEM to
>>> LLVM module for common blocks is radically different. Could you write a DIRECTORY
>>> replacement in BASIC without using MAP?
>>
>> Why, yes, I'm rather sure I could. For example, from one of my routines:
>>
>> RECORD FABBLK !
>> RECORD NAMBLK !
>> RECORD FIBBLK ! FIB structure
>>
>> And now I'm waiting for you to say that the Basic RECORD statement has the same
>> problems as MAP.
>>
>
> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
> a custom data structure in dynamic memory and then walk the tree
> either depth-first or breadth-first ?
>
> I've had a quick look at the dynamic storage section of the DEC Basic user
> manual, but I don't see how you link a set of nodes together into a tree.
> However, as mentioned previously, I don't know DEC Basic and searching
> for the word pointer didn't reveal anything appropriate, so I assume
> it's another keyword I am not aware of.
>
> In addition, how easy is this to do if the nodes are not all of the
> same record type, but have a common tag at the start of each record
> to say what kind of record it actually is ? I see you have variant
> records in DEC Basic. Do they also work in a dynamic memory based
> tree structure ?
>
> Simon.
>

I'd employ Lib$ malloc, realloc, and calloc

Re: DEC Basic and dynamic memory ?

<00B6F93D.4D6FD499@SendSpamHere.ORG>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20427&group=comp.os.vms#20427

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!pr9o9uw/KLhPSFYv2ok3sg.user.46.165.242.75.POSTED!not-for-mail
From: VAXm...@SendSpamHere.ORG
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 13:39:04 GMT
Organization: c.2022 Brian Schenkenberger. Prior employers of copyright holder and their agents must first obtain written permission to copy this posting.
Message-ID: <00B6F93D.4D6FD499@SendSpamHere.ORG>
References: <st1hr5$c5h$1@dont-email.me> <st4t2h$gh9$2@gioia.aioe.org>
Reply-To: VAXman- @SendSpamHere.ORG
Injection-Info: gioia.aioe.org; logging-data="53793"; posting-host="pr9o9uw/KLhPSFYv2ok3sg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: VAXm...@SendSpamHere.ORG - Sun, 30 Jan 2022 13:39 UTC

In article <st4t2h$gh9$2@gioia.aioe.org>, Richard Maher <maher_rjSPAMLESS@hotmail.com> writes:
>On 29/01/2022 3:57 am, Simon Clubley wrote:
>> On 2022-01-28, Dave Froble <davef@tsoft-inc.com> wrote:
>>> On 1/28/2022 12:31 PM, John Reagan wrote:
>>>> 4) As we've discussed the BASIC cross-compiler is still not available due to G2L not being
>>>> able to totally handle how the BASIC MAP statement is described to GEM. The GEM to
>>>> LLVM module for common blocks is radically different. Could you write a DIRECTORY
>>>> replacement in BASIC without using MAP?
>>>
>>> Why, yes, I'm rather sure I could. For example, from one of my routines:
>>>
>>> RECORD FABBLK !
>>> RECORD NAMBLK !
>>> RECORD FIBBLK ! FIB structure
>>>
>>> And now I'm waiting for you to say that the Basic RECORD statement has the same
>>> problems as MAP.
>>>
>>
>> How easy is it in DEC Basic to build a tree of (say) 1000 nodes of
>> a custom data structure in dynamic memory and then walk the tree
>> either depth-first or breadth-first ?
>>
>> I've had a quick look at the dynamic storage section of the DEC Basic user
>> manual, but I don't see how you link a set of nodes together into a tree.
>> However, as mentioned previously, I don't know DEC Basic and searching
>> for the word pointer didn't reveal anything appropriate, so I assume
>> it's another keyword I am not aware of.
>>
>> In addition, how easy is this to do if the nodes are not all of the
>> same record type, but have a common tag at the start of each record
>> to say what kind of record it actually is ? I see you have variant
>> records in DEC Basic. Do they also work in a dynamic memory based
>> tree structure ?
>>
>> Simon.
>>
>
>I'd employ Lib$ malloc, realloc, and calloc

How C senor.

--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG

I speak to machines with the voice of humanity.

Re: DEC Basic and dynamic memory ?

<st77v4$cu9$3@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20441&group=comp.os.vms#20441

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 23:45:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <st77v4$cu9$3@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me> <82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
Injection-Date: Sun, 30 Jan 2022 23:45:41 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a62e9b046f46f9d318db962801f8fbe";
logging-data="13257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZcFsP7z8Hd4Mdu2/ylysXHZ66GsQNfKQ="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:wClJ+QOJ1S+XSJdNVjXPX/313vY=
 by: Simon Clubley - Sun, 30 Jan 2022 23:45 UTC

On 2022-01-28, seasoned_geek <roland@logikalsolutions.com> wrote:
>
> Oh, you don't like it as a doubly linked list?
>
> RECORD SOME_RECORD
> STRING IN_USE=1%
> STRING SOME_KEY_VALUE=15%
> INTEGER LEFT_NODE
> INTEGER RIGHT_NODE
> INTEGER PARENT_NODE
> STRING WHOLE_LOT_OF_STUFF=255%
> ! other fields
> END RECORD
>
> You can even redimension if need be.

If _that's_ how you do a tree in DEC Basic, then yuck, yuck, yuck!!!

For starters, what about when you want to prune the tree and insert
new branches and leaf nodes while you are processing it ?

My question was driven by Arne's comment that he would prefer DEC Basic
over C for userland applications. If you are going to replace C, then
you need a language that can do everything C can, and do it better.

That's certainly true for Pascal, but not true for DEC Basic based
on what I see above. DEC Basic might be suitable for some less complex
programs, but certainly not all of the userland programs.

For example, could you cleanly write a CDU replacement or a TPU
replacement in DEC Basic ? I've never seen the source code for either
of them, but I would expect both of those to use variable sized
tree building and processing because of the parsing they do.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: DEC Basic and dynamic memory ?

<st78fe$cu9$4@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20443&group=comp.os.vms#20443

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 23:54:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <st78fe$cu9$4@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me> <61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me> <61f580e4$0$704$14726298@news.sunsite.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 30 Jan 2022 23:54:23 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a62e9b046f46f9d318db962801f8fbe";
logging-data="13257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sVN79BZKZVMFCmHQq8625t+y9yvo69X4="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:6VjI8dLhhs/sBGIcG/cNokNaGDk=
 by: Simon Clubley - Sun, 30 Jan 2022 23:54 UTC

On 2022-01-29, Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 1/29/2022 12:16 AM, Dave Froble wrote:
>
>> Arne, I have difficulty following your code examples.  Is it me, or you?
>

Well, Arne didn't use line numbers so that may be throwing you. :-)

> Probably me.
>
>:-)
>
> In this case Simon outlined a problem where Pascal and C are obvious
> languages and me with no Basic experience wrote some Basic code - that
> is almost ensure an "unsual style". Or to put it another way: I am
> (or was) a Fortran programmer and Fortran programmers can program
> in Fortran in any language. :-)
>

Thanks for the demo program Arne.

The approach you are forced to use in DEC Basic is way more ugly than
doing it in C or Pascal.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: DEC Basic and dynamic memory ?

<61f72543$0$698$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20444&group=comp.os.vms#20444

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 18:54:39 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st77v4$cu9$3@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 47
Message-ID: <61f72543$0$698$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: ae3bc993.news.sunsite.dk
X-Trace: 1643586883 news.sunsite.dk 698 arne@vajhoej.dk/68.9.63.232:51685
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Sun, 30 Jan 2022 23:54 UTC

On 1/30/2022 6:45 PM, Simon Clubley wrote:
> On 2022-01-28, seasoned_geek <roland@logikalsolutions.com> wrote:
>> Oh, you don't like it as a doubly linked list?
>>
>> RECORD SOME_RECORD
>> STRING IN_USE=1%
>> STRING SOME_KEY_VALUE=15%
>> INTEGER LEFT_NODE
>> INTEGER RIGHT_NODE
>> INTEGER PARENT_NODE
>> STRING WHOLE_LOT_OF_STUFF=255%
>> ! other fields
>> END RECORD
>>
>> You can even redimension if need be.
>
> If _that's_ how you do a tree in DEC Basic, then yuck, yuck, yuck!!!
>
> For starters, what about when you want to prune the tree and insert
> new branches and leaf nodes while you are processing it ?
>
> My question was driven by Arne's comment that he would prefer DEC Basic
> over C for userland applications. If you are going to replace C, then
> you need a language that can do everything C can, and do it better.
>
> That's certainly true for Pascal, but not true for DEC Basic based
> on what I see above. DEC Basic might be suitable for some less complex
> programs, but certainly not all of the userland programs.
>
> For example, could you cleanly write a CDU replacement or a TPU
> replacement in DEC Basic ? I've never seen the source code for either
> of them, but I would expect both of those to use variable sized
> tree building and processing because of the parsing they do.

It is actually not that different from the C/Pascal way.

It just use array indexes instead of pointers/addresses.

So 3 integers instead of 3 pointers.

You can do tree's, hash tables's etc. that way.

Just a different way of thinking.

Arne

Re: DEC Basic and dynamic memory ?

<61f7265c$0$698$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20445&group=comp.os.vms#20445

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 18:59:18 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me>
<61f580e4$0$704$14726298@news.sunsite.dk> <st78fe$cu9$4@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st78fe$cu9$4@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 18
Message-ID: <61f7265c$0$698$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: ae3bc993.news.sunsite.dk
X-Trace: 1643587164 news.sunsite.dk 698 arne@vajhoej.dk/68.9.63.232:51830
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Sun, 30 Jan 2022 23:59 UTC

On 1/30/2022 6:54 PM, Simon Clubley wrote:
> On 2022-01-29, Arne Vajhøj <arne@vajhoej.dk> wrote:
>> In this case Simon outlined a problem where Pascal and C are obvious
>> languages and me with no Basic experience wrote some Basic code - that
>> is almost ensure an "unsual style". Or to put it another way: I am
>> (or was) a Fortran programmer and Fortran programmers can program
>> in Fortran in any language. :-)
>
> Thanks for the demo program Arne.
>
> The approach you are forced to use in DEC Basic is way more ugly than
> doing it in C or Pascal.

Ugly or just unfamiliar?

Arne

Re: DEC Basic and dynamic memory ?

<st78vs$cu9$5@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20447&group=comp.os.vms#20447

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Mon, 31 Jan 2022 00:03:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <st78vs$cu9$5@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me> <82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com> <st77v4$cu9$3@dont-email.me> <61f72543$0$698$14726298@news.sunsite.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 31 Jan 2022 00:03:08 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a62e9b046f46f9d318db962801f8fbe";
logging-data="13257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fNf59/eDrTbTK6+pB4m+jb8Qu/AEHlWU="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:Pzd7Fp+pe7uK0veAQi6HIeIxics=
 by: Simon Clubley - Mon, 31 Jan 2022 00:03 UTC

On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>
> It is actually not that different from the C/Pascal way.
>
> It just use array indexes instead of pointers/addresses.
>
> So 3 integers instead of 3 pointers.
>
> You can do tree's, hash tables's etc. that way.
>
> Just a different way of thinking.
>

Except you have to manage those integers yourself unlike the Pascal
or C approach, especially if you want to prune or add nodes while you
are processing the tree. There's also the required copying of the
current data every time you grow the tree.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: DEC Basic and dynamic memory ?

<61f728c2$0$703$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20448&group=comp.os.vms#20448

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 19:09:34 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me> <61f72543$0$698$14726298@news.sunsite.dk>
<st78vs$cu9$5@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st78vs$cu9$5@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 32
Message-ID: <61f728c2$0$703$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: b23f40ae.news.sunsite.dk
X-Trace: 1643587779 news.sunsite.dk 703 arne@vajhoej.dk/68.9.63.232:52090
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Mon, 31 Jan 2022 00:09 UTC

On 1/30/2022 7:03 PM, Simon Clubley wrote:
> On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>>
>> It is actually not that different from the C/Pascal way.
>>
>> It just use array indexes instead of pointers/addresses.
>>
>> So 3 integers instead of 3 pointers.
>>
>> You can do tree's, hash tables's etc. that way.
>>
>> Just a different way of thinking.
>
> Except you have to manage those integers yourself unlike the Pascal
> or C approach, especially if you want to prune or add nodes while you
> are processing the tree.

They get assigned when new nodes are added and they are used to
walk the tree. I don't think C/Pascal pointers would be different
in that regard.

Pascal pointers would be more type safe though.

> There's also the required copying of the
> current data every time you grow the tree.

That is common practice in many languages for dynamic
sized data structures needing linear backing.

Arne

Re: DEC Basic and dynamic memory ?

<st79ce$cu9$6@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20449&group=comp.os.vms#20449

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Mon, 31 Jan 2022 00:09:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <st79ce$cu9$6@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me> <61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me> <61f580e4$0$704$14726298@news.sunsite.dk> <st78fe$cu9$4@dont-email.me> <61f7265c$0$698$14726298@news.sunsite.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 31 Jan 2022 00:09:50 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a62e9b046f46f9d318db962801f8fbe";
logging-data="13257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xOj9h6mBkQ19f3Zrq6TePEZ7VQH3HOHc="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:XFL0xjfOO1QxS67JEK+dk1QW9Xk=
 by: Simon Clubley - Mon, 31 Jan 2022 00:09 UTC

On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 1/30/2022 6:54 PM, Simon Clubley wrote:
>> On 2022-01-29, Arne Vajhøj <arne@vajhoej.dk> wrote:
>>> In this case Simon outlined a problem where Pascal and C are obvious
>>> languages and me with no Basic experience wrote some Basic code - that
>>> is almost ensure an "unsual style". Or to put it another way: I am
>>> (or was) a Fortran programmer and Fortran programmers can program
>>> in Fortran in any language. :-)
>>
>> Thanks for the demo program Arne.
>>
>> The approach you are forced to use in DEC Basic is way more ugly than
>> doing it in C or Pascal.
>
> Ugly or just unfamiliar?
>

Ugly because of all the tree management stuff you have to do for
yourself that you get for free in C or Pascal.

In addition, there's the overhead of copying the tree everytime
you run out of allocated spare space and need to extend it.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: DEC Basic and dynamic memory ?

<st79m3$cu9$7@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20450&group=comp.os.vms#20450

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Mon, 31 Jan 2022 00:14:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <st79m3$cu9$7@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me> <82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com> <st77v4$cu9$3@dont-email.me> <61f72543$0$698$14726298@news.sunsite.dk> <st78vs$cu9$5@dont-email.me> <61f728c2$0$703$14726298@news.sunsite.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 31 Jan 2022 00:14:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2a62e9b046f46f9d318db962801f8fbe";
logging-data="13257"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0BIBwNCLj1Tr/nzg4O1CKLsgxOWrA3Cs="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:0t0C7WuQ5h3C9B6TdzFo3yHbAvI=
 by: Simon Clubley - Mon, 31 Jan 2022 00:14 UTC

On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 1/30/2022 7:03 PM, Simon Clubley wrote:
>> There's also the required copying of the
>> current data every time you grow the tree.
>
> That is common practice in many languages for dynamic
> sized data structures needing linear backing.
>

But elsewhere you have the choice of whether to use something
like a Vector or if you need to build a tree structure yourself.

Specifying the growth increment of a linear structure is also
a tradeoff but you are not forced to use a linear structure if
you can build real trees and that's a better choice.

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: DEC Basic and dynamic memory ?

<61f73287$0$700$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20458&group=comp.os.vms#20458

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 19:51:20 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me> <61f72543$0$698$14726298@news.sunsite.dk>
<st78vs$cu9$5@dont-email.me> <61f728c2$0$703$14726298@news.sunsite.dk>
<st79m3$cu9$7@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st79m3$cu9$7@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 25
Message-ID: <61f73287$0$700$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: b23f40ae.news.sunsite.dk
X-Trace: 1643590279 news.sunsite.dk 700 arne@vajhoej.dk/68.9.63.232:53577
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Mon, 31 Jan 2022 00:51 UTC

On 1/30/2022 7:14 PM, Simon Clubley wrote:
> On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>> On 1/30/2022 7:03 PM, Simon Clubley wrote:
>>> There's also the required copying of the
>>> current data every time you grow the tree.
>>
>> That is common practice in many languages for dynamic
>> sized data structures needing linear backing.
>
> But elsewhere you have the choice of whether to use something
> like a Vector or if you need to build a tree structure yourself.
>
> Specifying the growth increment of a linear structure is also
> a tradeoff but you are not forced to use a linear structure if
> you can build real trees and that's a better choice.

Typical you will have both a linear data structure and trees.

I was not trying to make linear and trees the same.

My point was that the reallocating double size concept
is considered acceptable effective in the industry.

Arne

Re: DEC Basic and dynamic memory ?

<st7c9l$b7u$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20459&group=comp.os.vms#20459

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dav...@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 19:58:58 -0500
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <st7c9l$b7u$1@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 31 Jan 2022 00:59:33 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ae5ed13710ccd4c3c10b0c89063cf886";
logging-data="11518"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TOTa/TTp8wXKWc+itZfcWB5RMzov9dZg="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:T4x4VCUfgjzUbAOUzFZehIvQulg=
In-Reply-To: <st77v4$cu9$3@dont-email.me>
 by: Dave Froble - Mon, 31 Jan 2022 00:58 UTC

On 1/30/2022 6:45 PM, Simon Clubley wrote:
> On 2022-01-28, seasoned_geek <roland@logikalsolutions.com> wrote:
>>
>> Oh, you don't like it as a doubly linked list?
>>
>> RECORD SOME_RECORD
>> STRING IN_USE=1%
>> STRING SOME_KEY_VALUE=15%
>> INTEGER LEFT_NODE
>> INTEGER RIGHT_NODE
>> INTEGER PARENT_NODE
>> STRING WHOLE_LOT_OF_STUFF=255%
>> ! other fields
>> END RECORD
>>
>> You can even redimension if need be.
>
> If _that's_ how you do a tree in DEC Basic, then yuck, yuck, yuck!!!

Are you trying to show some bias?

Some people show you some very simple uses of the RECORD statement, and because
they are not fleshed out, you don't see the use. Hey, i do this for
compensation, cough up some money and I'll write any application you want in Basic.

Basically (sic) the RECORD statement is a method of defining structures, and it
can be very flexible. Also understandable. Can you say that about C?

> For starters, what about when you want to prune the tree and insert
> new branches and leaf nodes while you are processing it ?

Can be done. I haven't yet seen any applications where such is needed.
Usually, an application is designed for a specific need, and then Basic can be
used to implement the application.

> My question was driven by Arne's comment that he would prefer DEC Basic
> over C for userland applications. If you are going to replace C, then
> you need a language that can do everything C can, and do it better.

Anything application wise you can do in C, I can duplicate in Basic, and many
times much easier.

Do programmers do their own memory management in Basic? Not if they don't have
to. But it can be done. Why? Because on VMS, playing around with memory is an
OS thing, not a language thing.

> That's certainly true for Pascal, but not true for DEC Basic based
> on what I see above. DEC Basic might be suitable for some less complex
> programs, but certainly not all of the userland programs.

Suitable is a nebulous term. Suitable for whom?

> For example, could you cleanly write a CDU replacement or a TPU
> replacement in DEC Basic ? I've never seen the source code for either
> of them, but I would expect both of those to use variable sized
> tree building and processing because of the parsing they do.

Just why do you think Basic cannot do this?

I will admit that VSI Basic has some issues. All of them are implementation
specific, not language specific. That is a rather important distinction.

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: DEC Basic and dynamic memory ?

<61f73556$0$703$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20460&group=comp.os.vms#20460

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 20:03:14 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me>
<61f580e4$0$704$14726298@news.sunsite.dk> <st78fe$cu9$4@dont-email.me>
<61f7265c$0$698$14726298@news.sunsite.dk> <st79ce$cu9$6@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st79ce$cu9$6@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 44
Message-ID: <61f73556$0$703$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 11d80bd8.news.sunsite.dk
X-Trace: 1643590998 news.sunsite.dk 703 arne@vajhoej.dk/68.9.63.232:53950
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Mon, 31 Jan 2022 01:03 UTC

On 1/30/2022 7:09 PM, Simon Clubley wrote:
> On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>> On 1/30/2022 6:54 PM, Simon Clubley wrote:
>>> On 2022-01-29, Arne Vajhøj <arne@vajhoej.dk> wrote:
>>>> In this case Simon outlined a problem where Pascal and C are obvious
>>>> languages and me with no Basic experience wrote some Basic code - that
>>>> is almost ensure an "unsual style". Or to put it another way: I am
>>>> (or was) a Fortran programmer and Fortran programmers can program
>>>> in Fortran in any language. :-)
>>>
>>> Thanks for the demo program Arne.
>>>
>>> The approach you are forced to use in DEC Basic is way more ugly than
>>> doing it in C or Pascal.
>>
>> Ugly or just unfamiliar?
>
> Ugly because of all the tree management stuff you have to do for
> yourself that you get for free in C or Pascal.

What is all the tree management stuff?

When the node is inserted the code walks down from the top of the tree
find parent for the new node, update either the parents left or right
node "pointer" to point to the new node and both left and right
"pointer" of the new node is set to 0.

That is fundamentally what you will do in C or Pascal as well.

I expect the code in C or Pascal to look reasonable similar.

> In addition, there's the overhead of copying the tree everytime
> you run out of allocated spare space and need to extend it.

There is some source code overhead of having to code that
manual. And I agree that part is ugly.

Runtime there is no guarantee that the copying will actually
be more expensive than all the allocation/deallocation of
a traditional solution.

Arne

Re: DEC Basic and dynamic memory ?

<st7cq4$e4g$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20461&group=comp.os.vms#20461

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dav...@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 20:07:45 -0500
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <st7cq4$e4g$1@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me> <61f72543$0$698$14726298@news.sunsite.dk>
<st78vs$cu9$5@dont-email.me> <61f728c2$0$703$14726298@news.sunsite.dk>
<st79m3$cu9$7@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 31 Jan 2022 01:08:20 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ae5ed13710ccd4c3c10b0c89063cf886";
logging-data="14480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TPt///ca4lik6DzKx5lCUOKoAKG7iAJk="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:G4eT6Vy40CKQibVzsjbR9XzM/k4=
In-Reply-To: <st79m3$cu9$7@dont-email.me>
 by: Dave Froble - Mon, 31 Jan 2022 01:07 UTC

On 1/30/2022 7:14 PM, Simon Clubley wrote:
> On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>> On 1/30/2022 7:03 PM, Simon Clubley wrote:
>>> There's also the required copying of the
>>> current data every time you grow the tree.
>>
>> That is common practice in many languages for dynamic
>> sized data structures needing linear backing.
>>
>
> But elsewhere you have the choice of whether to use something
> like a Vector or if you need to build a tree structure yourself.
>
> Specifying the growth increment of a linear structure is also
> a tradeoff but you are not forced to use a linear structure if
> you can build real trees and that's a better choice.
>
> Simon.
>

Where do you come up with the idea that in Basic the nodes in a tree must be
linear? They rarely are. There usually are forward and backward pointers in a
linked list / tree. Logically linear, but not physically linear.

You're not appearing very knowledgeable Simon.

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: DEC Basic and dynamic memory ?

<st7ct6$e4g$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20462&group=comp.os.vms#20462

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: dav...@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: DEC Basic and dynamic memory ?
Date: Sun, 30 Jan 2022 20:09:24 -0500
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <st7ct6$e4g$2@dont-email.me>
References: <st1hr5$c5h$1@dont-email.me>
<61f49984$0$697$14726298@news.sunsite.dk> <st2ii8$5oj$1@dont-email.me>
<61f580e4$0$704$14726298@news.sunsite.dk> <st78fe$cu9$4@dont-email.me>
<61f7265c$0$698$14726298@news.sunsite.dk> <st79ce$cu9$6@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 31 Jan 2022 01:09:58 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ae5ed13710ccd4c3c10b0c89063cf886";
logging-data="14480"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wysLj0Klz8vvrZx03Bp3WJGM32U1RZWk="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:UscgsYKWrzWcFESyMQBEV4Be6Zk=
In-Reply-To: <st79ce$cu9$6@dont-email.me>
 by: Dave Froble - Mon, 31 Jan 2022 01:09 UTC

On 1/30/2022 7:09 PM, Simon Clubley wrote:
> On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>> On 1/30/2022 6:54 PM, Simon Clubley wrote:
>>> On 2022-01-29, Arne Vajhøj <arne@vajhoej.dk> wrote:
>>>> In this case Simon outlined a problem where Pascal and C are obvious
>>>> languages and me with no Basic experience wrote some Basic code - that
>>>> is almost ensure an "unsual style". Or to put it another way: I am
>>>> (or was) a Fortran programmer and Fortran programmers can program
>>>> in Fortran in any language. :-)
>>>
>>> Thanks for the demo program Arne.
>>>
>>> The approach you are forced to use in DEC Basic is way more ugly than
>>> doing it in C or Pascal.
>>
>> Ugly or just unfamiliar?
>>
>
> Ugly because of all the tree management stuff you have to do for
> yourself that you get for free in C or Pascal.
>
> In addition, there's the overhead of copying the tree everytime
> you run out of allocated spare space and need to extend it.

Bullshit! Just not true.

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: DEC Basic and dynamic memory ?

<61f7389a$0$692$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20463&group=comp.os.vms#20463

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 20:17:15 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st77v4$cu9$3@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 17
Message-ID: <61f7389a$0$692$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 11d80bd8.news.sunsite.dk
X-Trace: 1643591834 news.sunsite.dk 692 arne@vajhoej.dk/68.9.63.232:54241
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Mon, 31 Jan 2022 01:17 UTC

On 1/30/2022 6:45 PM, Simon Clubley wrote:
> For example, could you cleanly write a CDU replacement or a TPU
> replacement in DEC Basic ? I've never seen the source code for either
> of them, but I would expect both of those to use variable sized
> tree building and processing because of the parsing they do.

I think Basic could do the parsing and tree structure
fine.

But I would be skeptical about whether Basic is the right language
to actually do what those do. CDU must be messing around in P1
space. And TPU is actually is combo of compiler/interpreter
and editor.

Arne

Re: DEC Basic and dynamic memory ?

<61f738e3$0$692$14726298@news.sunsite.dk>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=20464&group=comp.os.vms#20464

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Sun, 30 Jan 2022 20:18:27 -0500
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Subject: Re: DEC Basic and dynamic memory ?
Content-Language: en-US
Newsgroups: comp.os.vms
References: <st1hr5$c5h$1@dont-email.me>
<82991c18-6e6f-4fd6-a1f5-faf8492d7938n@googlegroups.com>
<st77v4$cu9$3@dont-email.me> <61f72543$0$698$14726298@news.sunsite.dk>
<st78vs$cu9$5@dont-email.me> <61f728c2$0$703$14726298@news.sunsite.dk>
<st79m3$cu9$7@dont-email.me> <st7cq4$e4g$1@dont-email.me>
From: arn...@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <st7cq4$e4g$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 27
Message-ID: <61f738e3$0$692$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 11d80bd8.news.sunsite.dk
X-Trace: 1643591907 news.sunsite.dk 692 arne@vajhoej.dk/68.9.63.232:54241
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Mon, 31 Jan 2022 01:18 UTC

On 1/30/2022 8:07 PM, Dave Froble wrote:
> On 1/30/2022 7:14 PM, Simon Clubley wrote:
>> On 2022-01-30, Arne Vajhøj <arne@vajhoej.dk> wrote:
>>> On 1/30/2022 7:03 PM, Simon Clubley wrote:
>>>>                            There's also the required copying of the
>>>> current data every time you grow the tree.
>>>
>>> That is common practice in many languages for dynamic
>>> sized data structures needing linear backing.
>>>
>>
>> But elsewhere you have the choice of whether to use something
>> like a Vector or if you need to build a tree structure yourself.
>>
>> Specifying the growth increment of a linear structure is also
>> a tradeoff but you are not forced to use a linear structure if
>> you can build real trees and that's a better choice.
>
> Where do you come up with the idea that in Basic the nodes in a tree
> must be linear?  They rarely are.  There usually are forward and
> backward pointers in a linked list / tree.  Logically linear, but not
> physically linear.

I would call my example for logical tree physical linear.

Arne

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor