Recent Posts

Pages: [1] 2 3 ... 10
1
Bugs & Feature Requests / Issue with version 0.2.1
« Last post by Arnold on June 26, 2019, 02:43:22 PM »
Hi Charles,

print val("+15") ", " val("-12") will output: 0, -12. Should this not be 15 ?
2
Bugs & Feature Requests / Re: Error: Brackets not closed
« Last post by Brian Alvarez on June 25, 2019, 12:49:12 PM »
Thanks Charles, It's good to know! I will use what i have for the moment. :)

 By the way, the example above compiles and runs fine also in 64 bit mode if i compile for console mode,
just add uses console below the uses rtl64 line. Its a bit weird.

3
Bugs & Feature Requests / Re: Error: Brackets not closed
« Last post by Charles Pegge on June 25, 2019, 12:37:28 PM »

Hi Brian,

Your iteration example will work with version 0.2.1 (oxygenbasic progress)

Code: [Select]
int i = 0
   
   for (i = 0; i < 10; i++)
      {
         print i
      }
4
General / Re: Override print?
« Last post by Charles Pegge on June 25, 2019, 12:31:21 PM »
Hi Roland,

You can create any number of override functions providing they do not contain optional or default params.
5
Bugs & Feature Requests / Re: Error: Brackets not closed
« Last post by Brian Alvarez on June 25, 2019, 12:25:33 PM »
 I would like to implement c-style blocks, in fact i already did. But this (ugly) code that "emulates" c-style blocks runs only in 32 bit mode:

Code: [Select]
#COMPILE EXE
#COMPILER OXYGEN
#OPTIONS X32 CONSOLE
#DIM ALL

int function PBMAIN() {
        for (int i = 0; i < 10; i++) {
                stdout i       
            }
    }

 Please give it a try... maybe this will give a clue why my operators sometimes causes an error that compiles but doesnt run...

 Please ignore unnecessary declarations and code, i will make it cleaner later.  This 32bit example compiles and runs fine:

Code: [Select]
'Generated with PluriBASIC 6.0.237326.0

$ filename "C:\Users\Diamante\Documents\PluriBASIC\EJEMPLOS\c_style.exe"

uses rtl32
uses console

DIM STRING 又YSTEM_UDT_OFFSETS(0)
STRING 三MPS = "" ' a temporary string.
DECLARE FUNCTION 二etLastError        Lib "Kernel32.dll" Alias "GetLastError" () AS LONG
DECLARE FUNCTION 二etAsyncKeyState    Lib "User32.dll"   Alias "GetAsyncKeyState" (ByVal vKey AS LONG) AS short
DECLARE SUB 又leep                    lib "Kernel32.dll" alias "Sleep" (dword mSec)

function 儿NI_QUAD(dword v1, v2) as quad
    quad v = 0
    copy @v+0, @v2, 4
    copy @v+4, @v1, 4
    return v
end function

DECLARE FUNCTION 力penProcess         Lib "KERNEL32.DLL"  Alias "OpenProcess" (ByVal dwDesiredAccess AS DWORD, ByVal bInheritHandle AS LONG, ByVal dwProcessId AS SYS) AS SYS
DECLARE FUNCTION 三erminateProcess    Lib "KERNEL32.DLL"  Alias "TerminateProcess" ( ByVal hProcess AS SYS, ByVal uExitCode AS DWORD) AS LONG
DECLARE FUNCTION 七loseHandle         Lib "KERNEL32.DLL"  Alias "CloseHandle" (ByVal hObject AS SYS) AS LONG
DECLARE FUNCTION 二etCurrentProcessId Lib "KERNEL32.DLL"  Alias "GetCurrentProcessId" () AS SYS
DECLARE FUNCTION 上riteConsole     LIB "KERNEL32.DLL" ALIAS "WriteFile" (BYVAL hFile AS SYS, lpBuffer AS ANY, BYVAL nNumberOfBytesToWrite AS dword, lpNumberOfBytesWritten AS dword, lpReserved AS long) AS LONG
DECLARE FUNCTION 乙llocConsole     LIB "KERNEL32.DLL" ALIAS "AllocConsole" () AS LONG
DECLARE FUNCTION 了lushFileBuffers LIB "KERNEL32.DLL" ALIAS "FlushFileBuffers" (BYVAL hFile AS SYS) AS LONG
DECLARE FUNCTION 二etStdHandle     LIB "KERNEL32.DLL" Alias "GetStdHandle" (ByVal nStdHandle AS DWORD) AS SYS

' STARTS PLURIBASIC_PREPARE.BIN
' This code is executed before anything else, if you want to do something after defining other things, see PLURIBASIC_INIT

int 夕 = 0
' STARTS SYSTEM_OPERATORS.BIN

FUNCTION 丁ytOvf(byte b) AS byte
    return b
END FUNCTION

FUNCTION 又TRDIF(STRING a, STRING b) AS INT
   IF (a = b) THEN
       return 0
   else
       return -1
   end if
END FUNCTION

FUNCTION 又TREQL(STRING a, STRING b) AS INT
   IF (a = b) THEN
       return -1
   else
       return 0
   end if
END FUNCTION

FUNCTION 儿STRUE(byval quad v1) AS QUAD   
    IF v1 = 0 then
        return 0
    ELSE
        return -1
    END IF
END FUNCTION

FUNCTION 儿SFALSE(byval quad v1) AS QUAD
    IF v1 = 0 then
        return -1
    ELSE
        return 0
    END IF
END FUNCTION

FUNCTION 刁OT(byval quad v1) AS QUAD
    dword w1
    dword w2
    quad r   
    copy @w1, @v1, 4
    copy @w2, @v1+4, 4   
    w1 = not(w1)
    w2 = not(w2)   
    copy @r,   @w1, 4
    copy @r+4, @w2, 4
    return r
END FUNCTION

FUNCTION 乙ND(byval quad v1, v2) as quad
    dword w1
    dword w2
    quad r
    copy @w1, @v1, 4
    copy @w2, @v2, 4   
    w1 = (w1 and w2)   
    copy @r, @w1, 4   
    copy @w1, @v1+4, 4
    copy @w2, @v2+4, 4
    w1 = (w1 and w2)   
    copy @r+4, @w1, 4   
    return r   
end function

FUNCTION 力R(byval int v1, v2) as int
    return v1 or v2
end function

'FUNCTION 力R(byval quad v1, v2) as quad
'    dword w1
'    dword w2
'    quad r
'    copy @w1, @v1, 4
'    copy @w2, @v2, 4   
'    w1 = (w1 or w2)   
'    copy @r, @w1, 4   
'    copy @w1, @v1+4, 4
'    copy @w2, @v2+4, 4
'    w1 = (w1 or w2)   
'    copy @r+4, @w1, 4   
'    return r   
'end function

FUNCTION 儿MP(byval quad v1, v2) as quad
    if v1 then return -1
    if v2 then return -1
end function

FUNCTION 九QV(byval quad v1, v2) as quad
    if v1=0 then return 0
    if v2=0 then return 0
    return -1
end function

FUNCTION 刀OD(quad v1, v2) as quad
    return MOD(v1, v2)
end function
' END OF SYSTEM_OPERATORS.BIN
' CONTINUES (12) PLURIBASIC_PREPARE.BIN



#DEF HANDLE SYS






TYPE 又YSNMHDR
    hwndFrom AS SYS
    idFrom   AS SYS
    Code     AS DWORD
END TYPE


class 又YSF


                             
    FUNCTION CONSTRUCTOR()
    END FUNCTION       
           
END CLASS

new 又YSF EXE()

   
MACRO 又TRCODE(dc)
    numberformat(dc,1,0,1,0,0)
    string ss = str(v)
    numberformat       
    if v < 0 then
        return ltrim(ss)
    else
        return " " + ltrim(ss)
    end if
END MACRO


FUNCTION 又TR(double v, byref long d = 0) as string
    long d2 = 6
    if @d then d2 = d
    又TRCODE(d2)
END FUNCTION

 FUNCTION 又TR(single v, byref long d = 0) as string
    long d2 = 6
    if @d then d2 = d
    又TRCODE(d2)
END FUNCTION

FUNCTION 又TR(quad v, byref long d = 0) as string
    又TRCODE(0)   
END FUNCTION


' END OF STR$.BIN
' STARTS PRINTR.BIN

SUB 儿NITCONSOLE()
    STATIC Allc AS LONG
    IF Allc=0 THEN
        乙llocConsole()
        Allc = 1
    END IF   
END SUB

MACRO 又TDOUT() 
  INT lWritten = 0     
  SYS hFile    = 0
  INT Btc      = 0 
 
  儿NITCONSOLE()
 
  if cr=1 then s += chr(13, 10)
  if cr=2 then s += "</br>"     
 
  又leep(0)
 
  hFile = 二etStdHandle(-11)
 
  FOR Btc = 1 TO 50     
     IF ((Btc*32000)-31999) > len(s) THEN EXIT FOR
     TTsnd = MID(s, ((Btc*32000)-31999), 32000)
     上riteConsole(hFile, ByVal StrPtr(TTsnd), byval Len(TTsnd), lWritten, ByVal 0)
  NEXT Btc
 
  '了lushFileBuffers(hFile)
 
END MACRO

SUB 匕RINTASZ(ASCIIZ c[0], byval int cr)
    STRING TTsnd = ""
    string s = c   
    又TDOUT()     
END SUB

SUB 匕RINTSTR(STRING c, byval int cr)
    STRING TTsnd = ""
    STRING s     = c
    又TDOUT()     
END SUB

SUB 匕RINTJSN(STRING c, byval int cr)
    STRING TTsnd = ""
    STRING s     = c
    又TDOUT()     
END SUB

SUB 匕RINTSTZ(ZSTRING c[0], byval int cr)
    STRING TTsnd = ""
    STRING s     = c
    又TDOUT()     
END SUB
               
SUB 匕RINTWST(WSTRING c, byval int cr)
    STRING TTsnd = ""
    STRING s     = c               
    又TDOUT()
END SUB

SUB 匕RINTWSZ(ZSTRING2 c[0], byval int cr)
    WSTRING TTsnd = ""
    WSTRING s     = c       
    又TDOUT()     
END SUB

DECLARE FUNCTION PBMAIN() AS INT

' Initializes various things in the script.
FUNCTION PluriBASIC_Initialize() AS LONG
END FUNCTION

FUNCTION PBMAIN() AS INT
   INT 卜ETVAL = 0
   INT i
   i = 0
   int 夕te0003
   for 夕te0003 = 0 to 2 step 1
      if (夕te0003 = 2) then 夕te0003 = 1
      if (夕te0003 > 0) then
         i = ((i) + 1)
      end if
      if ((i < 10) = 0) then exit for
      匕RINTSTR(又TR(i), 1)
   NEXT
   RETURN 卜ETVAL
END FUNCTION

PBMAIN() ' invoke entry point

This 64 bit example compiles fine but doesnt run, it complains about not being a valid win32 application? Isnt it a 64 bit application?:

Code: [Select]
'Generated with PluriBASIC 6.0.237326.0

$ filename "C:\Users\Diamante\Documents\PluriBASIC\EJEMPLOS\c_style.exe"

uses rtl64

DIM STRING 又YSTEM_UDT_OFFSETS(0)
STRING 三MPS = "" ' a temporary string.
DECLARE FUNCTION 二etLastError        Lib "Kernel32.dll" Alias "GetLastError" () AS LONG
DECLARE FUNCTION 二etAsyncKeyState    Lib "User32.dll"   Alias "GetAsyncKeyState" (ByVal vKey AS LONG) AS short
DECLARE SUB 又leep                    lib "Kernel32.dll" alias "Sleep" (dword mSec)

function 儿NI_QUAD(dword v1, v2) as quad
    quad v = 0
    copy @v+0, @v2, 4
    copy @v+4, @v1, 4
    return v
end function

DECLARE FUNCTION 力penProcess         Lib "KERNEL32.DLL"  Alias "OpenProcess" (ByVal dwDesiredAccess AS DWORD, ByVal bInheritHandle AS LONG, ByVal dwProcessId AS SYS) AS SYS
DECLARE FUNCTION 三erminateProcess    Lib "KERNEL32.DLL"  Alias "TerminateProcess" ( ByVal hProcess AS SYS, ByVal uExitCode AS DWORD) AS LONG
DECLARE FUNCTION 七loseHandle         Lib "KERNEL32.DLL"  Alias "CloseHandle" (ByVal hObject AS SYS) AS LONG
DECLARE FUNCTION 二etCurrentProcessId Lib "KERNEL32.DLL"  Alias "GetCurrentProcessId" () AS SYS
DECLARE FUNCTION 上riteConsole     LIB "KERNEL32.DLL" ALIAS "WriteFile" (BYVAL hFile AS SYS, lpBuffer AS ANY, BYVAL nNumberOfBytesToWrite AS dword, lpNumberOfBytesWritten AS dword, lpReserved AS long) AS LONG
DECLARE FUNCTION 乙llocConsole     LIB "KERNEL32.DLL" ALIAS "AllocConsole" () AS LONG
DECLARE FUNCTION 了lushFileBuffers LIB "KERNEL32.DLL" ALIAS "FlushFileBuffers" (BYVAL hFile AS SYS) AS LONG
DECLARE FUNCTION 二etStdHandle     LIB "KERNEL32.DLL" Alias "GetStdHandle" (ByVal nStdHandle AS DWORD) AS SYS

' STARTS PLURIBASIC_PREPARE.BIN
' This code is executed before anything else, if you want to do something after defining other things, see PLURIBASIC_INIT

int 夕 = 0
' STARTS SYSTEM_OPERATORS.BIN

FUNCTION 丁ytOvf(byte b) AS byte
    return b
END FUNCTION

FUNCTION 又TRDIF(STRING a, STRING b) AS INT
   IF (a = b) THEN
       return 0
   else
       return -1
   end if
END FUNCTION

FUNCTION 又TREQL(STRING a, STRING b) AS INT
   IF (a = b) THEN
       return -1
   else
       return 0
   end if
END FUNCTION

FUNCTION 儿STRUE(byval quad v1) AS QUAD   
    IF v1 = 0 then
        return 0
    ELSE
        return -1
    END IF
END FUNCTION

FUNCTION 儿SFALSE(byval quad v1) AS QUAD
    IF v1 = 0 then
        return -1
    ELSE
        return 0
    END IF
END FUNCTION

FUNCTION 刁OT(byval quad v1) AS QUAD
    dword w1
    dword w2
    quad r   
    copy @w1, @v1, 4
    copy @w2, @v1+4, 4   
    w1 = not(w1)
    w2 = not(w2)   
    copy @r,   @w1, 4
    copy @r+4, @w2, 4
    return r
END FUNCTION

FUNCTION 乙ND(byval quad v1, v2) as quad
    dword w1
    dword w2
    quad r
    copy @w1, @v1, 4
    copy @w2, @v2, 4   
    w1 = (w1 and w2)   
    copy @r, @w1, 4   
    copy @w1, @v1+4, 4
    copy @w2, @v2+4, 4
    w1 = (w1 and w2)   
    copy @r+4, @w1, 4   
    return r   
end function

FUNCTION 力R(byval int v1, v2) as int
    return v1 or v2
end function

'FUNCTION 力R(byval quad v1, v2) as quad
'    dword w1
'    dword w2
'    quad r
'    copy @w1, @v1, 4
'    copy @w2, @v2, 4   
'    w1 = (w1 or w2)   
'    copy @r, @w1, 4   
'    copy @w1, @v1+4, 4
'    copy @w2, @v2+4, 4
'    w1 = (w1 or w2)   
'    copy @r+4, @w1, 4   
'    return r   
'end function

FUNCTION 儿MP(byval quad v1, v2) as quad
    if v1 then return -1
    if v2 then return -1
end function

FUNCTION 九QV(byval quad v1, v2) as quad
    if v1=0 then return 0
    if v2=0 then return 0
    return -1
end function

FUNCTION 刀OD(quad v1, v2) as quad
    return MOD(v1, v2)
end function
' END OF SYSTEM_OPERATORS.BIN
' CONTINUES (12) PLURIBASIC_PREPARE.BIN



#DEF HANDLE SYS






TYPE 又YSNMHDR
    hwndFrom AS SYS
    idFrom   AS SYS
    Code     AS DWORD
END TYPE


class 又YSF


                             
    FUNCTION CONSTRUCTOR()
    END FUNCTION       
           
END CLASS

new 又YSF EXE()


' END OF PLURIBASIC_PREPARE.BIN
' STARTS STR$.BIN
    'int dp   ' DECIMAL PLACES
    'int trz  ' STRIP TRAILING ZEROS
    'int sn   ' SCIENTIFIC NOTATION BY DEFAULT
    'int sdp  ' INHIBIT ZERO BEFORE DECIMAL POINT
    'int sns  ' LEADING SPACE FOR NON NEGATIVE NUMBERS
    'int lps  ' LEAD PADDING SPACES

    'numberformat(8,0,0,0,1,0) 'default settings

    'numberformat 'return to default
   
MACRO 又TRCODE(dc)
    numberformat(dc,1,0,1,0,0)
    string ss = str(v)
    numberformat       
    if v < 0 then
        return ltrim(ss)
    else
        return " " + ltrim(ss)
    end if
END MACRO


FUNCTION 又TR(double v, byref long d = 0) as string
    long d2 = 6
    if @d then d2 = d
    又TRCODE(d2)
END FUNCTION

 FUNCTION 又TR(single v, byref long d = 0) as string
    long d2 = 6
    if @d then d2 = d
    又TRCODE(d2)
END FUNCTION

FUNCTION 又TR(quad v, byref long d = 0) as string
    又TRCODE(0)   
END FUNCTION


' END OF STR$.BIN
' STARTS PRINTR.BIN

SUB 儿NITCONSOLE()
    STATIC Allc AS LONG
    IF Allc=0 THEN
        乙llocConsole()
        Allc = 1
    END IF   
END SUB

MACRO 又TDOUT() 
  INT lWritten = 0     
  SYS hFile    = 0
  INT Btc      = 0 
 
  儿NITCONSOLE()
 
  if cr=1 then s += chr(13, 10)
  if cr=2 then s += "</br>"     
 
  又leep(0)
 
  hFile = 二etStdHandle(-11)
 
  FOR Btc = 1 TO 50     
     IF ((Btc*32000)-31999) > len(s) THEN EXIT FOR
     TTsnd = MID(s, ((Btc*32000)-31999), 32000)
     上riteConsole(hFile, ByVal StrPtr(TTsnd), byval Len(TTsnd), lWritten, ByVal 0)
  NEXT Btc
 
  '了lushFileBuffers(hFile)
 
END MACRO

SUB 匕RINTASZ(ASCIIZ c[0], byval int cr)
    STRING TTsnd = ""
    string s = c   
    又TDOUT()     
END SUB

SUB 匕RINTSTR(STRING c, byval int cr)
    STRING TTsnd = ""
    STRING s     = c
    又TDOUT()     
END SUB

SUB 匕RINTJSN(STRING c, byval int cr)
    STRING TTsnd = ""
    STRING s     = c
    又TDOUT()     
END SUB

SUB 匕RINTSTZ(ZSTRING c[0], byval int cr)
    STRING TTsnd = ""
    STRING s     = c
    又TDOUT()     
END SUB
               
SUB 匕RINTWST(WSTRING c, byval int cr)
    STRING TTsnd = ""
    STRING s     = c               
    又TDOUT()
END SUB

SUB 匕RINTWSZ(ZSTRING2 c[0], byval int cr)
    WSTRING TTsnd = ""
    WSTRING s     = c       
    又TDOUT()     
END SUB

' END OF PRINTR.BIN
' STARTS PLURIBASIC_INIT.BIN
' This code is executed before anything else, if you want to do something before nything else, see PLURIBASIC_PREPARE
' END OF PLURIBASIC_INIT.BIN
' STARTS CALLBACKDATA.BIN
' END OF CALLBACKDATA.BIN


DECLARE FUNCTION PBMAIN() AS INT


' Initializes various things in the script.
FUNCTION PluriBASIC_Initialize() AS LONG
END FUNCTION

FUNCTION PBMAIN() AS INT
   INT 卜ETVAL = 0
   INT i
   i = 0
   int 夕te0003
   for 夕te0003 = 0 to 2 step 1
      if (夕te0003 = 2) then 夕te0003 = 1
      if (夕te0003 > 0) then
         i = ((i) + 1)
      end if
      if ((i < 10) = 0) then exit for
      匕RINTSTR(又TR(i), 1)
   NEXT
   RETURN 卜ETVAL
END FUNCTION

PBMAIN() ' invoke entry point

I hope its not the 32bit declarations, those are not used, i am hoping they dont break something for 64bit applications.+

6
Bugs & Feature Requests / Error: Brackets not closed
« Last post by Brian Alvarez on June 25, 2019, 12:13:24 PM »

Hello Charles, this code:

Code: [Select]
   int i = 0
   
   for (i = 0; i < 10; i++)
      {
         print i
      }

Doesnt compile. Shows this error:

Code: [Select]
ERROR: ALERT: e000 brackets not closed
WORD: 0
IN: pbmain
LINE: 180
FILE: "main source

Is this for/next format supported in this update? I dont know if you added it for this update or not.
7
General / Re: Override print?
« Last post by Arnold on June 25, 2019, 09:48:10 AM »
Hi James,

this is true. Therefore in my example I commented out: uses console. Then printl will give an error in any case. But perhaps my question is only academic. Using print "" or print chr(13,10) will always work.

Roland
8
General / Re: Override print?
« Last post by jcfuller on June 25, 2019, 07:06:51 AM »
Roland,
  Why would you want to do that with a message box?
With console just use printl
Code: [Select]

use console
printl "Hello"
printl
printl "Goodbye"

waitkey

James
9
General / Override print?
« Last post by Arnold on June 25, 2019, 06:09:12 AM »
Hi Charles,

using a print statement without argument gives an error message (Linker found unidentified names). Using print "" or print chr(13,10) will solve the problem. I wonder if it's legitimate to use an overriding function?

Code: [Select]
'uses console

sub print
  'print ""
  print chr(13,10)
end sub 


'print
print "Hello"
print
print "Goodbye"

'waitkey

I am not sure if side effects are expected if I try to override print in this way?

Roland
10
Example Code / Re: Custom Controls in OxygenBasic
« Last post by Charles Pegge on June 23, 2019, 05:57:06 AM »
Got it. I can't see any more.
Pages: [1] 2 3 ... 10