Theo's Forum

IT-Berater: Theo Gottwald (IT-Consultant) => Brians Board => Topic started by: Brian Alvarez on March 08, 2018, 03:58:28 AM

Title: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on March 08, 2018, 03:58:28 AM
 Until now, the engine could compile 64 bit applications with no problems. However since the engine was using plain "string" strings, the calls to external DLL's crashed.

 Today i decided to make a big step and started implementing BSTR as the default string type.

 It is a challenge because now the engine must do much more to compare, concatenate and in general, handle the strings.

 The benefits are that PluriBASIC will support Unicode, as well as being compatible with external DLL's and producing highly compatible DLLs and C++ SLLs, aka LIBs.

 When i finish this, i would like to handle the array order to handle the params backwards. If you know what i mean. This will increase the compatibility with external stuff.

Brian. :)
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on March 09, 2018, 12:57:16 AM

Done. The engine now uses BSTR's. Yay!
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on March 09, 2018, 12:58:23 AM
The string data types supported are:

STRING  (BSTR)
STRINGZ (char)
WSTRING (BSTR)
WSTRINGZ  (wchar_t)
ASCIIZ (LPSTR)

 They all interact correctly when compared and concatenated.

:)
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Theo Gottwald on April 07, 2018, 07:26:58 AM
Sounds good!
Can you cooperate with other programmers who are working on such projects - for example
- Charles Pegge (Oxygen)
- James C. Fuller (bc9Basic)
such a Cooperation would speed up things significantly. Especially as you come now to the part where you need to be compatible
with APIs, DLL's from other Languiages and such.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Chris Chancellor on April 17, 2018, 12:28:21 AM
Brian,  this  O2 Charles Pegge is a maestro and he can help out on your project.

You should register as a member in oxygen basic and see what you can come up with a better product 
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Charles Pegge on April 17, 2018, 10:24:19 AM

I would warmly welcome any compiler development that needs a back-end. Oxygen.dll (141kb) provides all-in-one basic compiling, assembly and linkage, both for PE files and direct JIT execution. The benefit to the Oxygen party would be to establish the best protocols and techniques for creating new compilers :)

The core functions are the minimum required for BASIC, and uses ole strings, like PowerBasic and thinBasic.

It is quite easy to add extensions and specialised syntax such as DDT, which can be decomposed into standard procedures.

As an example, here is our current co2 compiler source (4k), using oxygen.dll.

Code: [Select]

 'Compiler for OxygenBasic
 '========================

 'Charles Pegge
 '12:53 11/06/2015
 '10:17 06/03/2017
 '15:26 13/01/2018

  #compact
  #file "co2.exe" 'Oxygen dependent compiling
  %NoConsole
  uses SysUtil
  uses console

  extern lib "oxygen.dll"
  uses oxygenAPI
  end extern

  BufferObject pr

  sys    a,i
  string s,t,u
  sys    swa,swc,swm          'COMPILER SWITCHES
  string fname,mname,xname    '1st FILE NAME COMPONENTS
  string bfname,bmname,bxname '2nd FILE NAME COMPONENTS
  string er                   'ERROR MESSAGES
  '
  s=lcase CommandLineArgs()
  if not s then goto nofile
  '
  'SWITCHES
  '========
  i=0
  do
    i++ : skiplspace s,i
    if ascb<>45 then exit do
    i++ : skiplspace s,i
    select ascb
    case "i" : swa=ascb '-i intermediate output
    case "a" : swa=ascb '-a asm output
    case "b" : swa=ascb '-b o2 output
    case "c" : swc=ascb '-c compile
    case "m" : swm=ascb '-m do not show messagebox
    end select
  end do
  '
  s=mid s,i
  '
  nofile: 'check
  '=============
  '
  if not s then
  pr.in "
  compiler options:
  <filename>       compile and execute directly in memory
  -a <filename>    list assembly code
  -b <filename>    list o2 machine script
  -c <filename>    <optional filename>  compile to a binary
  -i <filename>    list intermediate code
  -m               output to console
  "
  jmp fwd done
  end if
  '
  'GET FILENAMES
  '=============
  '
  i=1 : xname=".o2bas" 'DEFAULT SOURCE EXTENSION NAME
  fname=ParseFileName(s,i,mname,xname)
  bxname=".exe"'DEFAULT BINARY EXTENSION NAME
  bfname=ParseFileName(s,i,bmname,bxname)
  '
  '
  'ATTEMPT TO GET FILE
  '===================
  '
  t=getfile fname
  if not t then
    pr.in "error 3: file empty or not found: "+fname
    jmp fwd done
  end if
  '
  u=""
  '
  if swc then
    if bfname="" then
      bfname=mname+".exe"
    end if
    u+="#file "+qu+bfname+qu+cr
  end if
  '
  t=u+chr(12)+t
  '
  '
  'NORMAL COMPILE
  '==============

 'o2_mode 0  'read/return null terminated ascii strings
  o2_mode 9   'ascii string (1: byte characters) (8: o2 string)
  '
  select swa
  case "a"  : pr.in o2_prep(t) 'OUTPUT ASSEMBLY CODE
  case "b"  : pr.in o2_view(t) 'OUTPUT O2 MACHINE SCRIPT (AFTER ASSEMBLY CODE)
  case "i"  : pr.in o2_abst(t) 'OUTPUT INTERMEDIATE CODE (BEFORE ASSEMBLY CODE)
  case else :       o2_basic t 'COMPILE TO EXECUTABLE BINARY
  end select
  '
  er=o2_error
  '
  if er then
    pr.in cr+ er
    jmp fwd done
  else
    if swc=0 then
      o2_exec 0
    else
      pr.in cr+"Okay"
    end if
  end if

  done:
  'DISPLAY RESULTS
  sys ho,lew
  string prs=pr.out
  if len(prs) then
   if swm=0 then
      mbox prs
    else
      'sys p=GetCurrentProcess() '-1 parent process
      AttachConsole(-1) 'attach to console of parent process
      output prs
      sys ho=GetStdHandle( STD_OUTPUT_HANDLE )
      if ho<>consout then consout=ho : output prs 'windows 10
      sleep 10
      FreeConsole
    end if
  end if
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 17, 2018, 02:16:04 PM

 Hello Charles, what is oxigen? The syntax looks very different to what i am aiming to...
Can you ellaborate?

 By the way, i already implemented ARRAY SORT. Im very close to compiling PluriBASIC in itself as a 64 bit compiler.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Charles Pegge on April 17, 2018, 04:27:28 PM
Hi Brian,

Oxygen understands the Qbasic/PB genre of Basic syntax, but has additional flexibility, including C notation. It could replace any dependencies on PB or a C compiler at the back-end.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Chris Chancellor on April 17, 2018, 05:45:54 PM
Hello Brian

PB commands can  be converted directly to Oxygenbasic O2 commands and then  be compile to 64bit exe and dll assemblies

and that O2 also allow for inline assembly which has all the features of PB inline assembly codes.

see the http://www.oxygenbasic.org/forum/index.php (http://www.oxygenbasic.org/forum/index.php)
for yourself

and download its latest compiler and sample from
https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasicProgress.zip (https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasicProgress.zip)

Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 17, 2018, 08:39:27 PM

 PluriBASIC is prepared to output code for any platform. So, even if i added an Oxigen mode, i would still like to finish the C++ version.
I also know Qbasic, maybe that will help. I will take a look when i have the chance. :)
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Chris Chancellor on April 28, 2018, 09:06:26 PM
@Brian

As long as your IDE can produce 64bits native code  from PB source code, it would have tremendous
advantage over others. Alternately  if it can emit O2 source codes for which we can later recompile to
 native codes it would be godsend also.

we need native compile exe and dlls bcos they are harder to hack than those MS intermediate language IL
from VB.Net and C#.   the MSIL are in clear text format and any source code it contains can be easily
extracted out by hackers. 

it is the time saving that matter most in any given established company where there are thousands
of programs that need to be converted to 64bits.  I heard of a company which has only converted
some 40% of its codes from PB to Purebasic after a 4 year + non stop conversion effort and he has
3 programmers working full time on it.  sadly the Purebasic language is very weird and this explains
the difficulty involved for this conversion, Purebasic syntax is very different from other basic languages,
it is like going against the grain task to do the conversion. 

this means that there will be a very high demand for your product if you can produce an IDE converter
 that can convert 60 to 70% of the PB programs to native 64bits code.

Just join us at the O2 forum, and you will be able to write the O2 code that you needed.  i myself has already
converted more than 10 of company programs to O2.





Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 28, 2018, 09:14:15 PM
 I might. However, PluriBASIC can already compile 64 bit apps with the help of a c++ compiler.
I am now working on making it compatible with Jose's api headers. I only have two hands, and
my partner is currently away from any computer. Its still going to be a while.

 However, i tend to disagree. I have barely seen any interest in it. Quite the contrary. I am doing
it as a hobby, and it might prrobably never see the light of day. Who knows. But i will still finish it.

Added:
  As a compiler developer, i kind of understand the point of view that Bob Zale once expressed. Creating
a compiler is a huge load of work and if there is not enough market for it, it is not worth it to focus in it.
Unfortunately i also need to make a living and the kind commends of 5 or 6 people, althoug VERY
APPRECIATED, is not enough to invest such long time into the creation of it.

 Even less if the effort i am putting into it is obscured by the ominous situation of releasing it.

 Should an investor with $$ appear, i could focus in it (And I openly express it with the intention of
attracting someone to jump in) and finish it much faster.

 As things are right now, im just a guy with big intentions but very little time. If i had $$ i would invest in
it to even give it away for free. But that is a luxury i unfortunately cannot afford. :(

 This said, PluriBASIC is prepared to add new languages in very little time. I could probably add Oxigen
basic support for it probably in the time i take to lear it + a week to implement it, but i have a tiring job
i need to attend.







Title: Re: PluriBASIC - Progress March 7 2018
Post by: Mike Lobanovsky on April 29, 2018, 12:54:43 AM
... probably in the time i take to lear it + a week to implement it ...

You're obviously underestimating the O2 learning curve. It's a mature low-level BASIC-like language that takes time to master plus probably as much time to select and test thoroughly, among its many features, the ones that would best fit your needs to re-implement PB's higher level functionality to any practical degree of usability.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 05:15:58 AM
You're obviously underestimating the O2 learning curve...

 I didnt mention i would learn it quickly, so i am not underestmating it's learning curve [time?]. That time could be much more than a week. <playfulness>Or probably less? Probably you are also underestimating my humongous I.Q. ;) Hehehe. Jk. </playfulness>

 Anyway, im sure i could have the fundamental basics of O2 (like if/then, for/next), in a couple nights. Maybe i will have a chance to prove it next weekend.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 07:23:14 AM
 I took a look at oxigen basic, and it looks like a BASIC-C++ hybrid.
PluriBASIC should not have any issues generating code for it.

 Charles, Where can i find information for invoking the dll function for compiling the generated code?

 Thx.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 08:07:22 AM
 I went ahead and added an Oxigen basic compiler configuration tab. It seems to work fine.

PluriBASIC is now generating the basic if/then for/next macros and other stuff. According to the online reference, PluriBASIC seems to be generating code that can already be compiled (as soon as i find information on how to invoke the compiler DLL).


Code: [Select]
#COMPILER OXIGEN
#COMPILE EXE
#DIM ALL
#OPTIONS X64
#DATABASE CLOSED

FUNCTION PBMAIN() AS LONG

STDOUT "Hello world"

END FUNCTION

 Other stuff like variable declarations should also be easy to generate. Two nights was an over estimate. I added the basics in 3 hours. Now off to sleep. :)


Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 08:13:00 AM
Looking good.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Mike Lobanovsky on April 29, 2018, 10:41:41 AM
It is OxygenBasic, not Oxigen, Brian.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Chris Chancellor on April 29, 2018, 03:12:24 PM
Hello Brian

to invoke the O2 compiler use shellexecute the  gxo2.exe  in the format below

  C:\OxygenBasicProgress >  gxo2.exe     < filename.o2bas >


or run the batch file as below  ( please change the file name from FindEd.o2bas to your own filename )

Code: [Select]
::@echo off

::Set the Oxygenbasic compiler path
set o2dir=C:\OxygenBasicProgress

::Compile
%o2dir%\gxo2.exe FindEd.o2bas


echo done
pause

Note that the C:\OxygenBasicProgress  is the folder containing the downloaded
and unzipped contents from
https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasicProgress.zip (https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasicProgress.zip)

and the given file name is FindEd.o2bas  in this example
use your own filename
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 07:43:52 PM
It is OxygenBasic, not Oxigen, Brian.

 Thanks mike, i will fix it. :)

 In spanish and other languages its "Oxige...", thats why it is easy to mix words. :)
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 08:18:06 PM
to invoke the O2 compiler use...

 Thanks chris, i will try it later today. :)
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 29, 2018, 11:56:00 PM
Ok i will try it now. Should be easy to do if everything is in place.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 30, 2018, 12:01:14 AM
Charles, is there a way to omit the Messageboxes with syntax errors and instead get the message via STDIN so i can parse the line with the error and highlight it? the -m switch doesnt seem to work for that...

 I would lke to be able to either do that, or make a direct call to the DLL that doesnt pop up messageboxes. Are the DLL declarations available?
Title: Re: PluriBASIC - Progress March 7 2018
Post by: James C. Fuller on April 30, 2018, 12:39:56 AM
Brian,
  In the tools subdirectory is exo2.bas that needs to be compiled with FreeBasic for console output.
It is attached here.
exo2 -c <filename>

James

Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 30, 2018, 03:07:47 AM
Brian,
  In the tools subdirectory is exo2.bas that needs to be compiled with FreeBasic for console output.
It is attached here.
exo2 -c <filename>

James

 Thanks James, i made a version of the Exodus file that doesnt display popup messageboxes. It now works fine and
compiles OxygenBasic applications fine too. Next step is expanding the variety of statements supported by the engine.

 Yaay! :)

 
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Charles Pegge on April 30, 2018, 07:58:19 AM
Hi Brian,

You can now make your own fully customised compiler, using Oxygen.dll directly. My favourite is co2, as it is written in O2. Use o2_mode 9 for oleString i/o, like PB.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on April 30, 2018, 08:19:08 AM

Mode 9, got it.

What is mode 0 for?
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Charles Pegge on April 30, 2018, 12:38:42 PM
These are the i/o modes specified in oxygen.bas: ( bits 1,2 and 8 )
Code: [Select]
'specify string mode for various o2 API functions
'0 ascii char*
'1 ascii char*
'2 unicode wchar*
'8 ole bstring ascii
'9 ole bstring ascii
'10 ole bstring unicode
'--------------------------------------------------
sub o2_mode alias "o2_mode" (byval m as sys) export
'==================================================
  omo=m
End Sub
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Chris Chancellor on September 09, 2018, 03:03:02 PM
Hello Brian
long time no hear

any progress status on your project ?
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on September 10, 2018, 09:57:41 AM
Hello Chris.

The project is pretty advanced. In fact i already use it for my own purposes. Unfortunately the market is not very profittable and i need to focus in other things.

I wish to return to daily progress on it like before but since it is taking too long to generate profit i cant afford it. Thats why i wanted Adam to purchase the project, I believe he is more able to work on it and at the same time pay the bills.

Brian. :)
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Chris Chancellor on September 10, 2018, 04:06:02 PM
Hope that Adam will buy it from you and then resell it to us

at last there is a light at the end of the tunnel
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on September 11, 2018, 06:58:07 AM
A man can hope. Im sure it would help us both a great deal.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Patrice Terrier on September 11, 2018, 08:43:17 AM
Don't you understood that PowerBASIC as you known it, is gone for ever.

No serious programmer should invest on a dead horse.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on September 12, 2018, 02:52:28 AM
Don't you understood that PowerBASIC as you known it, is gone for ever.

Tryiong to mix it so that is not as it was before. I would like it to be more versatile and powerful,
multiplatform and almighty.

No serious programmer should invest on a dead horse.

 Nobody should invest on a dead horse, unless you want an skeleton of a horse or something.
I dont understand the analogy. Perhaps if i had understand it before i would not had things done?
Sometimes thinking like the rest is a major obstacle.

Brian.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Patrice Terrier on September 13, 2018, 10:35:59 AM
Quote
Sometimes thinking like the rest is a major obstacle.

Try to pragmatic,
and ask yourself does there is still a PowerBASIC market to make a living from as a third party addon provider?

Myself and my friend Philip Monteil, were the first PB's addon provider with DV32, in the year 1998 (after the PBDK fiasco).
And the time of PB/DLL was the best period for the addon provider market, because many formal VB programmers where looking for an alternative to their tool of choice. But since that time, PB has always been years back compared to C/C++, mainly because Bob Zale spent too much time on DDT rather than improving the core features of the compiler.

As an example, i can compare the number of GDImage license sold to the PB's group and to the WinDev's one, and the ratio is 1/20 (countless of the 64-bit version), go figureā€¦

If you are retired then keep on your good work, but if you are not, then better to move to a real market to feed your family.


 
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Brian Alvarez on September 13, 2018, 07:42:04 PM
 I believe the PowerBASIC market is big, but most of its fans are holding back because of the storm around it.
I think you are right for the moment though. I believe the people can return to PowerBASIC, but it takes a man
with enough funds to make it great again.
Title: Re: PluriBASIC - Progress March 7 2018
Post by: Patrice Terrier on September 14, 2018, 09:32:06 AM
Quote
I believe the PowerBASIC market is big

So big, that they can even deny access to their main site to all the EU residents, except those using a VPN, ridiculous...