Anybody help with this ?
I need to convert this:- ***Array[] to PB. This is a pointer to a pointer to a pointer to an array.
Also this:- something->that This is something to do with objects.
Any help welcomed.
Alan
C++ to PB
the first one would be something like PeekL(PeekL(PeekL(...)))
the second one... ain't got a clue
the second one... ain't got a clue
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: C++ to PB
No.. that's just nasty!!chippy73 wrote:Anybody help with this ?
I need to convert this:- ***Array[] to PB. This is a pointer to a pointer to a pointer to an array.

That's a way of accessing a field or procedure in a class (structure)... OO stuff..chippy73 wrote: Also this:- something->that This is something to do with objects.
PB is not able to do this stuff easily (yet), without mocking around like crazy with interfaces and stuff...
I guess you'll have to look up Interface in the help file..
Basically what you have to do is to make an interface with integer fields,
which in turn have to be used as pointers to a procedure, then to be used in a structure..
(I hope I got it right)
AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Re: C++ to PB
It's pretty much impossible to translate this without any further code.
something->that can be used as a reference to a pointer to a structure or to a class.
If it's not a pointer to a class it may simply be *something\that in PB.
something->that can be used as a reference to a pointer to a structure or to a class.
If it's not a pointer to a class it may simply be *something\that in PB.
Good programmers don't comment their code. It was hard to write, should be hard to read.
This is typical of the code that I am trying to convert to PB.....
Hope that helps
Alan
Code: Select all
Idx=0
While Idx<SymbolsPerLine
Idx=Idx+1
Symbol[Idx]->ClearCorrection()
Symbol[Idx]->Scan_Init()
Wend
For(Idx=0: Idx<SymbolsPerLine: Idx++)
CorrectSymbol(Idx)
Idx=0
While Idx<SymbolsPerLine
Idx=Idx+1
Symbol[Idx]->AddCorrection(Weight);
Symbol[Idx]->Decode()
Wend
Alan
PB v3.94 PVXP v2.13 JaPBe v2.5.4.22
For ***Array use somthing like this:
For something->that you'll want to use an Interface.
If you have the class declaration then converting this to an Interface isn't too difficult. Take a look at the following posts:
An example using interfaces.
viewtopic.php?t=9553&highlight=ipbfriendly
An example of converting some complex C++ classes to PB:
viewtopic.php?t=11827&highlight=winnie
Code: Select all
Structure StaticArray
Values.l[5]
EndStructure
DefType.StaticArray SA
SA\Values[0] = 1
SA\Values[1] = 2
SA\Values[2] = 4
SA\Values[3] = 8
SA\Values[4] = 16
*ThirdPointer = @SA
*SecondPointer = @*ThirdPointer
*FirstPointer = @*SecondPointer
;Note that we are using a pointer (begins with *) so only two peeks are needed to go 3 pointers deep.
*ReferencingSA.StaticArray = PeekL(PeekL(*FirstPointer))
Debug *ReferencingSA\Values[0]
Debug *ReferencingSA\Values[1]
Debug *ReferencingSA\Values[2]
Debug *ReferencingSA\Values[3]
Debug *ReferencingSA\Values[4]
Debug *ReferencingSA\Values[5]
Structure ThreePointersDeep
If you have the class declaration then converting this to an Interface isn't too difficult. Take a look at the following posts:
An example using interfaces.
viewtopic.php?t=9553&highlight=ipbfriendly
An example of converting some complex C++ classes to PB:
viewtopic.php?t=11827&highlight=winnie