Another OOP PreCompiler

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
SofT MANiAC
Enthusiast
Enthusiast
Posts: 142
Joined: Mon Sep 17, 2007 10:28 am
Location: P.O.P
Contact:

Post by SofT MANiAC »

Welcome back! :D
POiNT.OF.PRESENCE group
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post by mk-soft »

Thanks :wink:

many to do in my job.


Have anyone tested my precompiler under X64 compiler? It´s ok?

GT 8)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post by mk-soft »

Update v0.42

Now two precompiler for X86 and X64
Precompiler X64 for 32 and 64 Bit for PB version 4.30

I can´t testing X64 mode!

GT :wink:
Last edited by mk-soft on Sun Jun 21, 2009 9:11 pm, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post by mk-soft »

Update v0.43

NEW
- Method DestroyObject

Example

Code: Select all

; Example - avoidance of memory leak with method InitObject and DestroyObject

Class(MemClass)
  *mem1
  *mem2
EndClass

; Init memory
Method MemClass_InitObject(*this.MemClass) ; <- NewObject calling InitObject
  With *this
    Debug "InitObject: AllocateMemory."
    \mem1 = AllocateMemory(10*1024)
    \mem2 = AllocateMemory(20*1024)
  EndWith
EndMethod

Method MemClass_GetMemPointer(*this.MemClass, number.l)
  Select number
    Case 1 : ProcedureReturn *this\mem1
    Case 2 : ProcedureReturn *this\mem2
    Default : ProcedureReturn 0
  EndSelect
EndMethod

Method MemClass_DestroyObject(*this.MemClass) ; <- DeleteObject or Release calling DestroyObject
  
  Debug "DestroyObject: Free Memory."
  FreeMemory(*this\mem1)
  FreeMemory(*this\mem2)
  
EndMethod

; Test Part 3
Debug "Test Part 3"
Debug ""
Debug "Mem Test 1"
*mem.IMemClass = NewObject(MemClass)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
*mem\Release()
Debug ""

Debug "Mem Test 2"
*mem.IMemClass = NewObject(MemClass)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
DeleteObject(*mem)
Debug ""

Debug "Mem Test 3"
*mem.IMemClass = NewObject(MemClass)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
*mem\Release()
Debug ""
GT :wink:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
rko
User
User
Posts: 21
Joined: Thu Jul 17, 2008 1:44 pm
Location: germany

Post by rko »

hi,
i see this for the first time. it nead. is there any chance that the methods be in the class? ex.:

Code: Select all

Class(MemClass)
  *mem1
  *mem2
; Init memory

Method InitObject() ; <- NewObject calling InitObject
  With *this
    Debug "InitObject: AllocateMemory."
    \mem1 = AllocateMemory(10*1024)
    \mem2 = AllocateMemory(20*1024)
  EndWith
EndMethod
EndClass
would give the added effect to be able to drop the "MemClass_" and the "*this.MemClass".javascript:emoticon(':P')
it would not be needed then

it would be neat to have class methods with the same name, but a different signature:

Code: Select all

Method xxx(somevar.s) ; <- NewObject calling

Code: Select all

Method xxx(somevar.i) ; <- NewObject calling
it would be neat to have get some syntactic sugar for getters and setter like in c# or other languages.

maybe some of it is possible - it would make thinks easier to read and to maintain. thanks for nice tool

rko
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post by mk-soft »

Update v0.43 ref 14240

-Bugfix DestroyObject

GT

P.S.

The methods within Class to programming for to a substantial larger expenditure in the case of the translation Main and all Inc. charge files. Thus even to larger sources of error. With the structure which I need I did not select the Scourecode to change and all necessities can with macros and as soon as additional Inc. charge files, which are merged clean, to cover. Thus the error tracing functions with PB as used.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post by mk-soft »

Update v0.44

New:
Method Class_InitObject(...) now with parameters.
When InitObject() without parameters can calling NewObject(ClassName) for compatible old projects, but using parameters calling NewClassName(para1, etc)
sorry for my english
example

Code: Select all


; Example Part 3 - avoidance of memory leak with method InitObject and DestroyObject

Class(MemClass)
  *mem1
  *mem2
EndClass

; Init memory
Method MemClass_InitObject(*this.MemClass, size.i) ; <- NewMemClass calling InitObject
  With *this
    Debug "InitObject: AllocateMemory."
    \mem1 = AllocateMemory(size*1024)
    \mem2 = AllocateMemory(size*1024)
  EndWith
EndMethod

Method MemClass_GetMemPointer(*this.MemClass, number.l)
  Select number
    Case 1 : ProcedureReturn *this\mem1
    Case 2 : ProcedureReturn *this\mem2
    Default : ProcedureReturn 0
  EndSelect
EndMethod

Method MemClass_DestroyObject(*this.MemClass) ; <- DeleteObject or Release calling DestroyObject
  
  Debug "DestroyObject: Free Memory."
  FreeMemory(*this\mem1)
  FreeMemory(*this\mem2)
  
EndMethod

; Test Part 3
Debug "Test Part 3"
Debug ""
Debug "Mem Test 1"
*mem.IMemClass = NewMemClass(10)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
DeleteObject(*mem)
;*mem\Release()
Debug ""

Debug "Mem Test 2"
*mem.IMemClass = NewMemClass(10)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
DeleteObject(*mem)
;*mem\Release()
Debug ""

Debug "Mem Test 3"
*mem.IMemClass = NewMemClass(10)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
DeleteObject(*mem)
;*mem\Release()
Debug ""

Debug "Mem Test 4"
*mem.IMemClass = NewMemClass(10)
Debug "Address of Obj : " + Str(*mem)
Debug "Address of mem1: " + Str(*mem\GetMemPointer(1))
Debug "Address of mem2: " + Str(*mem\GetMemPointer(2))
DeleteObject(*mem)
;*mem\Release()
Debug ""
GT :wink:
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Post by mk-soft »

Update v0.45

Bugfix:
- Memory manager

Sorry... Big Bug at version 0.44
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Sabour
User
User
Posts: 31
Joined: Sun Apr 02, 2006 7:41 am

Re: Another OOP PreCompiler

Post by Sabour »

WOW!!!! THANK YOU!!!!
Post Reply