Oxygen and c++ expl

Started by Frank Brübach, April 28, 2024, 02:50:51 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Frank Brübach

Hi Charles

I played around with c++ and oxygen and tested this example  and its running Well
I have changed Oxygen.dll for this translation you can find in ZIP folder

Oxygen basic

' oxygen basic c++ translation, 28-04-2024, frank bruebach
'
' a) only "<<" and ">>" doesnt work (double quotation mark)
' b) and "namespace" doesnt know how to use, as function ?

' include <iostream>
' using namespace std;

int main {
const int myAge = 35;
'cout << "I am " << myAge <<

cout "I am "; '\n
cout myAge " years old ";
'cout str(myAge) " years old "; ' this line works too
return 0
}
' output 35 ' ok :-)

' changed oxygen.dll for it, see zip folder

New edit: result must be " I am 35 years old"
The example gives correct result Back I did another example too

Charles Pegge

<< and >> are left-shift and right shift operators. They cannot be redefined though they can be overloaded for UDTs.

namespace symbols are expressed using double dot instead of double colon.

int i=1
namespace nn
int i=2
end namespace
print i "  " nn..i '1  2

Frank Brübach

Good morning all

So far AS I have understood namespace Works in oxygen Like
This expl I have built

' -- oxygen basic
' -- example 1)

' global_var is in the global namespace
int global_var = 10

function outer_function() as integer

    '  outer_var is in the local namespace
    int outer_var = 20

        function inner_function() as integer
        'inner_var is in the nested local namespace
        int inner_var = 30

        print inner_var
        end function

    print outer_var

    inner_function()
end function

' print the value of the global variable
print global_var

' call the outer function and print local and nested local variables
outer_function()

'------------------- //
' -- example 2)
'
'NESTABLE NAMESPACES
int vic=99

namespace maria
  namespace tom
      int vic = 200
  end namespace
end namespace
'
print maria..tom..vic '200
print vic '99