Author Topic: OxygenBasic includes  (Read 11671 times)

0 Members and 1 Guest are viewing this topic.

John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #15 on: September 16, 2013, 08:41:49 PM »
I have been thinking about the best way to create a include file translator in ScriptBasic. My thoughts at this point is to create an associative array key statements of an include file and the value will be the indirect address to a function.

Code: [Select]
_h{"#INCLUDE"} = ADDRESS(o2_include())
_h("FUNCTION"} = ADDRESS(o2_function())

The associative array would be a translation function dictionary for the parser.


John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #16 on: September 18, 2013, 08:56:41 PM »
I ran into a VB5/6 Win32API viewer that may be a better resource to use than the declared PB only use includes from PowerBASIC/Jose Roca.

ActiveVB site



Quote
If you work a lot with the Windows API you may have noticed that the win32api.txt text file distributed with VB is completely out of date. This file is based on Windows 95 header files. Lots of new library function have been introduced with Windows 98, Windows 2000, Windows ME, and Windows XP. If you want to use these functions you can search the internet for their declaration. This takes a lot of time and and may even be unsuccessful.

For that purpose we have developed ApiViewer 2004, which is meant to replace the Microsoft API viewer utility. The database contains the most up to-date declarations taken from the most current Windows XP header files: 6 500 declarations for functions and 55 000 constants. In contrast to this win32api.txt contains only 1 500 declarations for functions and 5 000 constants. So why not simply release a new version of win32api.txt? Maybe you donít believe it but the Microsoft API viewer utilitycrashes with an overflow error when trying to load the new version of the file.

Another resource that may be helpful and is similar is the API-Guide.
« Last Edit: September 18, 2013, 09:21:35 PM by John »

kryton9

  • Hero Member
  • *****
  • Posts: 721
Re: OxygenBasic includes
« Reply #17 on: September 19, 2013, 01:45:54 PM »
Thanks John, nice find for useful stuff!

John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #18 on: September 19, 2013, 05:42:15 PM »
The APIViewer can generates PowerBASIC syntax API references along with PureBASIC and MS micro assembler instructions. (and others)

I saved the win32api as a text file and attached it as a zip.

Maybe this can be used as a base for the O2 Windows include.



X
« Last Edit: September 19, 2013, 06:56:58 PM by John »

John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #19 on: September 19, 2013, 07:24:50 PM »
Charles had mentioned that he would prefer that we use the MinGW-gcc include files for O2.

Attached is the windows.nim in colorized syntax printed to a PDF.

@Charles - Is this parsable from O2 or would you need it in a more O2 standard declare format?



X

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3745
    • Oxygen Basic
Re: OxygenBasic includes
« Reply #20 on: September 20, 2013, 12:10:53 AM »
No the Nimrod API is new territory.

But your API Viewer output looks promising, John. Is this frozen at year 2004?
« Last Edit: September 20, 2013, 12:27:14 AM by Charles Pegge »

John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #21 on: September 20, 2013, 07:56:09 AM »
The API-Viewer looks to be a vintage 2004 era tool. It seems to have what is needed for Win32.

I think the Nimrod version of the MinGW-gcc includes (and all the supporting libraries) is the most up to date. I plan on using them to generate the DLLC API definitions.


John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #22 on: September 28, 2013, 12:52:11 PM »
Now that everyone has had time to think about include files for OxygenBasic, where are we going with this? I'm trying to facilitate some action on this but someone needs to stand up and provide some leadership in getting this done. Charles is overwhelmed with the compiler and I don't want to distract him (other than guidance) with creating includes for O2.

It seems Jose Roca has only a casual interest in O2 and open source projects isn't his thing. He would have been the best person to manage this effort. He is a smart guy and O2 is too attractive of a BASIC compiler to ignore. I'm counting on that he will see the light soon.




Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3745
    • Oxygen Basic
Re: OxygenBasic includes
« Reply #23 on: September 29, 2013, 12:10:40 AM »
To improve compatibility with these large API headers, I am working on a true preprocessor, which will perform most macro/equate substitutions in the first pass instead of progressively in later passes. (It is what Emil had requested.)

This will make the compiler more efficient for handling the 50,000+  equates of MS windows (circa 2004).

It may entail some minor sacrifices, such as local equates - but I think I am the only one playing with them so far.

But I'm still in favour of simplified APIs, like Peter's and Aurel's, and I will maintain Oxygen's small collection of headers to support all the examples and tools.

John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #24 on: September 29, 2013, 12:14:57 AM »
Thanks Charles for the update where includes stand.

OT:  Can a 64 bit version DLLC be created at this time?

Peter

  • Full Member
  • ***
  • Posts: 161
Re: OxygenBasic includes
« Reply #25 on: September 29, 2013, 05:38:14 AM »
Quote
But I'm still in favour of simplified APIs, like Peter's

Yes, follow my way, other ways lead you in to maze.

kryton9

  • Hero Member
  • *****
  • Posts: 721
Re: OxygenBasic includes
« Reply #26 on: September 29, 2013, 11:54:07 AM »
All the languages that I tinkered with all in the end have to deal with the api or have wrappers for them. Some of the bigger languages have tools to convert header files, but none of the languages can keep up with all the new libraries that are coming out each year. That is why I decided to bite the bullet and learn c++ a couple of years back.

I think the only way to really save a language from never ending header headaches, is to be a front end language to a well supported and documented cross platform compiler. I know this is easier said then done, but if I had Charles' brains I would go that route. He would have access to all the power that gcc offers to do anything and a really proven compiler. gcc has no good BASIC front end, they can compile all of these languages, so front ends for these wide range of languages have been written.
Quote
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc++, libgcj,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom.

Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 3745
    • Oxygen Basic
Re: OxygenBasic includes
« Reply #27 on: September 29, 2013, 12:49:02 PM »
John,

64 bit DLLC will require some weird stuff to pass parameters using the 64 bit calling convention. Apart from that, the source code is written to be 32/64 bit compliant. If you have a 64 bit version of libscriba.dll available , that would  be great for testing.

Kent,

The C emitter will take us on the journey in the direction of a GCC front end. There is much to learn about how GCC works, but only the top end of Oxygen (~20%) would be needed. Ultimately, OxygenBasic might be abstracted to a language specification, shedding its machine code origins entirely. :)

John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #28 on: September 29, 2013, 02:42:29 PM »
Quote
OxygenBasic might be abstracted to a language specification, shedding its machine code origins entirely.



John

  • Hero Member
  • *****
  • Posts: 3249
Re: OxygenBasic includes
« Reply #29 on: September 29, 2013, 03:21:51 PM »
Here is a download of the 64 bit version of SB that Armando created with MinGW-gcc. The archive includes the 64 bit libscriba.dll.

SB Windows 64 bit
« Last Edit: September 29, 2013, 03:33:00 PM by John »