• Welcome to Jose's Read Only Forum 2023.
 

Modules for O2

Started by Charles Pegge, August 16, 2022, 07:08:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge


Illustrating the use of relative namespace expressions, encapsulating console.inc in a module:


==============
module console
==============
  namespace cn
  uses console
  end namespace
  '
  interface
  ---------
  'relative namespaces with prefixed ..
  $ cprint  ..cn..output
  $ cwait   ..cn..getkey
  $ tab     ..cn..tab
  $ cr      ..cn..cr
end module
'
cprint 12345 tab "okay" cr
cwait


Update:

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

Charles Pegge

#16
I've found a way to use macros (equates) as prefixes.

So namespaces-refs can be consolidated into a single dotted word.

$ cns ..cn.. 'prefix macro
cns.output( )


'with macro prefixes
'
==============
module console
==============
  namespace cn
  uses console
  end namespace
  '
  $ cns ..cn.. 'prefix macro
  '
end module
'
cns.output 12345 cns.tab "okay" cns.cr
cns.getkey


Access to the parent module is now possible. I might be better to consider the inner-modules as servers, and the outer-modules as clients of the inner modules.

We can use a macro to define the client prefix, a triple dot
$ client ...
then refer to any client symbol, such as x
client.x


'with macro prefixes
'Accessing parent / client symbols
'
$ client ...
int x=0
print client.x '0
namespace aa
  int x=2
  print client.x '0
  namespace bb
    int x=4
    print client.x '2
    namespace cc
      int x=6
      print client.x '4
    end namespace
    'print ..cc..x '6
  end namespace
end namespace




Update:

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

Eduardo Jorge

It's already in OxygenBasic050P6.zip, I don't know what modifications it had, but in my opinion for general use oxygen lacks few details to make it easier for people who just want to program a few functions.
an "IDE" easy to install and with good tools, and arrays without having to use macros
with that it would be enough for most people with more basic usage.
And as I said before, on the other forum, not everyone needs top-of-the-line tools, sometimes you just want to assemble simple things quickly and easily, and oxygen allows that.
but it has to facilitate the use of people who are starting and just want that, ease.
with more people using it, more interested people will appear, even people with more capacity to contribute.

Zlatko Vid

Quotean "IDE" easy to install and with good tools, and arrays without having to use macros

well ...o2 already have "IDE"  or editor..s
OXIDE ..by Charles
AurelEdit by ME
and O2H_Edit by Arnold (i think)

i know that my editor is not "the best" and is not featured with things but work well
and is written in o2

for arrays...o2 arrays work well ..what you mean under macros ..i don't have a clue

Nicola_Piano

Quote from: Charles Pegge on August 30, 2022, 07:11:06 PM
I've found a way to use macros (equates) as prefixes.

So namespaces-refs can be consolidated into a single dotted word.

$ cns ..cn.. 'prefix macro
cns.output( )


'with macro prefixes
'
==============
module console
==============
  namespace cn
  uses console
  end namespace
  '
  $ cns ..cn.. 'prefix macro
  '
end module
'
cns.output 12345 cns.tab "okay" cns.cr
cns.getkey


Access to the parent module is now possible. I might be better to consider the inner-modules as servers, and the outer-modules as clients of the inner modules.

Hi,
with P12 it returns error on the 4th line to the name "console". If I take this off and just leave "Module" it works.
But what if I want to put more modules?

Frank Brübach

#20
Hi Charles, glad to see you are still alive .. I am looking for an old example you have done  some years ago UI tbgl oxygen you have built with Pete for thin basic oxygen forum did you create this example for oxygen complete too? Would be great to have some reply..  I am looking for an opengl example with controls like Buttons etcpp best regards Frank