• Welcome to Jose's Read Only Forum 2023.
 

Is Charles Pegge ok?

Started by Karen Zibowski, July 05, 2020, 08:35:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

Hallo Charles,

how is the current state, can the compiler make 64 and 32 bit executables as well as dll's?

Using PB i currently often run into its limitation, especially about Macro expansion ("Too complex") Error Message.
If the code is designed like that - lets say i have 20 Subprograms that use this Macro, it can not simply be changed.

Charles Pegge

Hi Theo,

Oxygen can produce both exes and dlls in 32 and 64 bit versions. JIT mode and self-compiling are currently limited to 32bit but this is not a significant impediment. JIT mode is like using an interpreter with full machine-code performance.

Re: recursive macro expansion, we have a few traps to avoid memory overflow during compilation, but I can still break through them, so I'll plug those leaks.

Recursive UDT Types are also prone to expansion when they have direct members of the same type, or include another type which includes this type.

Theo Gottwald

For my current usage, JIT-Mode does not look so important.
What components like Linker and Assembler, do you currently use that are from other sources?

Charles Pegge

#48
Oxygen uses its own assembler and linker.

The only external sources I can think of is Gorc.exe for compiling rc resources to res. The compiler can embed res files into the binary.



Theo Gottwald

Thats really good, possibly i could give you PB-Source code for the resources stuff if you want do it on your own.
In such case send me an Mail then i can look for it.
Its better to have full control over the code.

Zlatko Vid

I must find time and test my wrapper aiwnh in 64bit mode

Charles Pegge

Thanks Theo,

There is useful information in those files. In particular RESFMT.txt.

I'll start with menus which are quite well explained, and microsoft provide good examples:

https://docs.microsoft.com/en-us/windows/win32/menurc/using-menus.

By placing the resource compiler inside o2, we will have access to all the equates and other definitions setup in the main app.


Theo Gottwald

#52
If this part is also inside, you have a really complete package.
Next we should discuss "removing the Macro Limitations",
and automatic variables like these from Stan Durham.
These are Variables of the next generation.

I attach these for you and others, including Source code in PB.
HLib 304

Zlatko Vid


QuoteBy placing the resource compiler inside o2, we will have access to all the equates and other definitions setup in the main app.

That would be big plus Charles , IonicWind basic and some others have that long time ago.
all best...

Chris Chancellor

Hello Charles, 
Best that Roland can join this forum too as his contributions at the previous forum are immense, we
have learn a lot of stuff from him.
Could you please convey this message to him?
Thanxx

Charles Pegge

#55
Hi Theo,

We have 5 different kinds of macro in the toolbox, as well as metalanguage. About half of Oxygen's core functions are implemented through macros. In the hierarchy of constructs, macros sit above the rest of the language.

Some are very simple like right

macro right(s,i) {mid(s,-(i))}

Others are complex and adaptive for different types and classes. Here is the latest for redim


  def redim
  =========
  #ifndef %2
    static %1 * %2
    @%2=getmemory 0
  #endif
  scope
    indexbase 1
    bstring _buf_
    strptr(_buf_)=@%2
    int _qb_ = %3
    int _le_ = len _buf_
    int _qn_ = _le_ / sizeof(%1)
    int _i_
    #if match "%4","clear"
      for _i_=1 to _qn_
        #if typecodeof(%2)>=0x200
          #ifdef %1.destructor
            %2[_i_].destructor
          #endif
          #ifdef %1.constructor
            %2[_i_].constructor
          #endif
        #elseif typecodeof(%2)>=0xa0
          %2[_i_]=""
        #else
          %2[_i_]=0
        #endif
      next
    #endif
    if _qb_ > _qn_
      _buf_ += nuls( sizeof(%1) * (_qb_ - _qn_))
      @%2=strptr _buf_
      for _i_=_qn_ +1 to _qb_
        #if typecodeof(%2)>=0x200
          #ifdef %1.constructor
            %2[_i_].constructor
          #endif
        #elseif typecodeof(%2)>=0xa0
          %2[_i_]=""
        #else
          '%2[_i_]=0
        #endif
      next
    elseif _qb_ <  _qn_
      for _i_=_qb_ +1 to _qn_
        #if typecodeof(%2)>=0x200
          #ifdef %1.destructor
            %2[_i_].destructor
          #endif
        #elseif typecodeof(%2)>=0xa0
          %2[_i_]=""
         #else
          '%2[_i_]=0
        #endif
      next
      _buf_ = left( _buf_, sizeof(%1) * _qb_ )
      @%2=strptr _buf_
    endif
  end scope
  end def

Charles Pegge

Hi Aurel,

It might be useful to make some Basic syntax available in the rc file, like equates and multi-line strings. Another idea is to put the resource script directly into the Basic source code:

resource
...
end resource


Hi Chris,

I have asked Roland whether he would like to join us. But like many of us, life is not easy for him at present.

Theo Gottwald

#57
Charles, we have currently a lot of Scammers who want join the Forum.
Because of this i do not accept any new applications from people that i do not know.
So, if you see that your friends join the forum, can you accept their application or tell me to do so?

About the Macros.
To be really good, Macros should be able to react on a variable number of Parameters.
Therefore i must be able to get "the number of given Parameters" and must be able to "conditional compile" depending on the number of Parameters.
Because a Macro with 4 Parameters may need to be compiled to other code then a Macro with just 2 Parameters.

Also you need "Macro local Labels", otherwise you can not really make Macros with labels,
because these Labels could become duplicates if a Macro is called multiple times.

In the same way, you need Macro-Local variables.
These features are most important.

Then it would be nice, to have a way to react on the "Recursion level" which is the number of times that a Macro calls itself.
Then the Macro can expand itself "in a Loop" until a certain Number is reached, which can the n be used to "break the recursion".

These are the most important Macro features, do you have them all ready?

Charles Pegge

#58
Yes Theo,
the macros and metaprogramming can do all of those things. I have not thought about recursion counting before but it works :)

Local symbols are all defined alongside the parameters in the top line. These symbols are made unique for each call of the macro. All macros are late binding so they behave quite similarly to run-time code.


'08:45 25/04/2022
'macro local labels
'macro recursion breaking

macro M(ct,pa,pb,pc,pd,   lb1,lb2,lb3)
======================================

'RECURSION
%= counter = ct-1 '%=' EARLY CALCULATION OF EQUATE
#print counter
'
#if counter>0
  m(counter,100,200)
#endif

'CHECKING PRESENCE OF PARAMETERS
#ifndef pc
  goto lb3
#endif
'
#ifndef pd
  ...
#endif

'LOCAL LABELS
lb1:
  ...
lb2:
  ...
lb3:

end macro

M(3,10,20,30) 'omitting 5th param


Theo Gottwald

Hallo Charles

do your Macros have a maximum nesting or Recusion depth?
Do they have a maximum size limit like in Powerbasic?

I PB i always run into these limits.
"Macro to complex" and like that.