Latest oxygen package

Started by Frank Brübach, October 04, 2023, 04:19:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Frank Brübach

Good morning Charles hi all

Any News about next oxygen Update?

Good Luck and Progress

Regards Frank
  •  

Charles Pegge

I've just released 07P9

https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasic07P9.zip

https://sourceforge.net/projects/oxygenbasic/postdownload

mostly technical but improved redim

QuoteRELEASE 0.7.0P9  21/12/2023

20:52 19/12/2023 Support C-style multidim x[..][..].. (rarray fixsqbr)
09:06 19/12/2023 Support C-style if(..) / While(..) for(...) single statement (tran.inc captsr)
22:26 09/12/2023 Restore Remap (lang.inc)
21:39 08/12/2022 Fix sub-array indexing (expr.inc arcc=0)
17:48 02/12/2023 New Instrp pattrn search '*' '?' (parseutil.inc)
17:45 02/12/2023 Rework Inkey and Get. Make KeyRecord available (console.inc)
18:51 30/11/2023 Create Ogl.inc to contain Opengl Headers
22:44 23/11/2023 Fix operator finding (meta.inc findop)
22:27 16/11/2023 Redesign redim and array_mep
22:27 16/11/2023 Revoke overlay
22:27 16/11/2023 Redesign dim attributes table (ubound)
02:46 14/11/2023 Fix ubound() and elements() for 1d arrays (decl.inc lang.inc)

Nicola


Charles Pegge

Here is a demo of a redim array being passed to a function:

'PASSING A REDIM ARRAY
'CP 22 Dec 2023

uses console

def show
  print "%1" tab %1 cr
end def
'
function f(int *rr[redim])
==========================
print "carried param dimensions" cr cr
show (ubound(rr))
show (ubound(rr,1))
show (ubound(rr,2))
show (ubound(rr,3))
print cr
redim int rr(4,3,4) 'expand array
end function
'
'
redim int r[2,3,4]
print "initial dimensions" cr cr
show (ubound(r))
show (ubound(r,1))
show (ubound(r,2))
show (ubound(r,3))
print cr
f(r)
print "altered dimensions after call" cr cr
show (ubound(r))
show (ubound(r,1))
show (ubound(r,2))
show (ubound(r,3))
print cr
'
print "ok" cr
wait

Charles Pegge

#19
This version also supports C-style multidimensional arrays:

dim int a[1][2][3]
'19/12/2023
dim int a[1][2][3]
int b
'print dims(a)+"  "+ubound(a)
a[1,1,2]=34
print a[1,1,2]
b=a[1][1][2]
print b

Pierre Bellisle

  •  

Theo Gottwald

@Charles, does it support redimension without destroying the content?
Which will need you to internally move the data to a temporary array and then copy them back.
This would be an interesting feature.

Charles Pegge

Yes Theo,

The content is preserved by default. The dynamic array content is held in an OleString, so it can be manipulated like a string.

To clear the content:
redim int v[n] clear

Nicola

wow Charles, this is new. 
Very good!

Eduardo Jorge

hello everyone, with a stone age computer here,
Charles Pegge would it be possible to use the oxygen dll from within vba and have values returned?
  •  

Nicola

Hi Charles.
Is Reindex still supported? If so, could you explain its use?

Cheers

Charles Pegge

Hi Eduardo,

It's probably best to use Oxygen to develop DLLs that interface with VBA for your data processing.

Charles Pegge

#27
Hi Nicola,

Reindex takes a a filter macro and a sort macro, and data count. It does not touch your primary data, but produces index arrays for the data. It is primarily designed for database work.

Here is a test example:
'09/12/2022
'REINDEX TESTS
uses console
'indexbase 0
'int d={9,8,7,6,5,4,3,2,1,0}
'int d={8,9,6,7,4,5,2,3,0,1}
redim int d(100)
d={8,9,6,7,4,5,2,3,0,1} 'raw data
redim int d(10)
int m=10
'
macro filter(r,i)
=================
if d[i]>=5
  r=1
endif
end macro
'
macro compare(r,i,j)
====================
'if d[i]>d[j] 'ascending
if d[i]<d[j] 'descending
  r=1
endif
end macro
'
reindex idx,m,n,filter,compare
'
'  idx     index to be created
'  m       count of data elements
'  n       count of resulting index
'  filter  filter macro
'  compare comparison macro
'
'PARTIAL USE OF REINDEX
'reindex idx,m,n,filter
'reindex idx,m,n,,compare
'reindex idx,m,n
'reindex idx,m : int n=m
'
'RESULTS
'=======
print "total " n cr cr
print "#"  tab "INDEX" tab "DATA" cr
int i,j
for i=indexbase to n+indexbase-1
  j=idx[i]
  print i tab j tab d[j] cr
next
print cr cr
del idx
wait

Nicola

Thanks Charles.

Another clarification: how is the behavior of "clear" with string arrays? In a previous note you wrote "to flush an array's contents, redim it with 0 elements first. But avoid doing this with arrays of strings; the orphaned strings are not garbage-collected until the end of the program, and will accumulate on each iteration where the redim reduces the number of elements."



Charles Pegge

This has been improved. The old strings are now flushed from memory, and replaced with new null strings. Similarly, the destructors of objects are invoked, and each object is initialized by its constructor, wherever these procedures are defined.

redim reindex new and del are all macros defined in inc\self\lang.inc as outer core commands.