Author Topic: Documentation  (Read 65810 times)

0 Members and 1 Guest are viewing this topic.

JRS

  • Guest
Re: Documentation
« Reply #15 on: September 26, 2018, 08:16:00 PM »
Quote
print *p

Do you really believe that this is a good way to learn a language?

The natural reaction will be to become angry quickly and send the compiler to hell.

It has been my experience that Charles or one of the other forum members will respond in a timely manner. Many improvements started off as a question.

  • Guest
Re: Documentation
« Reply #16 on: September 26, 2018, 08:16:28 PM »
I have written a markdown page documenting the operators. As the help file does not provide any useful information for them, I have needed to do some guess work. Therefore, I don't know if all the information is correct. Also better usage examples for the logical and bitwise operators are needed.

See: https://github.com/JoseRoca/WinPBX/blob/master/docs/Oxygen/Operators.md
« Last Edit: September 26, 2018, 08:26:27 PM by José Roca »

JRS

  • Guest
Re: Documentation
« Reply #17 on: September 26, 2018, 08:19:46 PM »
Thanks José!

I love your documentation style.

JRS

  • Guest
Re: Documentation
« Reply #18 on: September 26, 2018, 08:34:15 PM »
You should have Charles give you editing permission on the O2 Github wiki.

Check out the only issue on O2 Github. Persistence produces results.

José Roca

  • Guest
Re: Documentation
« Reply #19 on: September 26, 2018, 08:46:42 PM »
Better create a docs folder and build there markdown pages.

JRS

  • Guest
Re: Documentation
« Reply #20 on: September 26, 2018, 09:29:46 PM »
Charles,

I think it would be wise to give José the same project admin rights on the Github O2 repository as Mike has moderating the forum.

Aurel

  • Guest
Re: Documentation
« Reply #21 on: September 26, 2018, 11:45:32 PM »
Jose
What this example must do?
ASCIIZ s * 260
s = "Test string"
DIM p AS ASCIIZ PTR = @s
print *p

José Roca

  • Guest
Re: Documentation
« Reply #22 on: September 27, 2018, 12:17:47 AM »
In other Basic dialect it will print the content of the string. In O2, I don't know. It apparently does not support "PTR". I would like to know how can do it in O2.

  • Guest
Re: Documentation
« Reply #23 on: September 27, 2018, 12:43:27 AM »
This compiles, but only prints "Test str".

Code: [Select]
ASCIIZ s * 260
s = "Test string"
DIM p AS char AT STRPTR(s)
print p

This works

Code: [Select]
char s = "Test string"
DIM p AS char AT STRPTR(s)
print p

But it is not what I intended to do.

If I call a function that returns a pointer to am asciiz string, i.e. an asciiz ptr, how I can deference that pointer?

Aurel

  • Guest
Re: Documentation
« Reply #24 on: September 27, 2018, 12:50:10 AM »
Yes Jose some things in 02 are little bit crazy
but this work, i often forget what is what  ::)

Code: [Select]
string s
s = "Test String"
@p = s  'adress of p hold s
print p ' show "Test String"

Aurel

  • Guest
Re: Documentation
« Reply #25 on: September 27, 2018, 12:56:49 AM »
This works too..

Code: [Select]
string s
s = "Test String"
char p[10] = s  'adress of p hold s
print  p ' show "Test String"

also i think that bstring work too  :)

Charles Pegge

  • Guest
Re: Documentation
« Reply #26 on: September 27, 2018, 01:28:56 AM »
José,

o2 retro-syntax is not perfect but here are some working variations:

Code: [Select]
DIM s AS ASCIIZ*260
'
'DIM s(260) AS ASCIIZ
'char s[260]
'
s = "Test string"
'
DIM p AS ASCIIZ PTR : @p = STRPTR s
'
'char*p=strptr s
'
'ASCIIZ p AT STRPTR s
'
print p


Commandline example:
Code: [Select]
  uses corewin
  '
  'wchar* cmdline = GetCommandLineW
  '
  'dim wchar*cmdline : @cmdline=GetCommandLineW
 
  'wchar ptr cmdline = GetCommandLineW
  '
  dim cmdline as wchar ptr
  @cmdline=GetCommandLineW
  '
  print cmdline

All string types are automatically derefereced to the char-level in an expression.

Similarly, strptr will always return the char address.

José Roca

  • Guest
Re: Documentation
« Reply #27 on: September 27, 2018, 01:54:18 AM »
Thanks, Charles. I had tried everything except @p.

  • Guest
Re: Documentation
« Reply #28 on: September 27, 2018, 01:58:26 AM »
Using "?" for casting is also unusual to me.

print hex(?f)

I think that I will use

print hex( (int) f )

or

print hex( cast(int) f)

I don't mind to type more if it makes the code less cryptic.

  • Guest
Re: Documentation
« Reply #29 on: September 27, 2018, 02:26:26 AM »
The char data type looks cool.

Code: [Select]
CHAR c = "Test string"
c += " - more text"
print c

It grows as if it was a dynamic null terminated string!