Got an idea for enhancing PureBasic? New command(s) you'd like to see?
-
Leonhard
- User

- Posts: 55
- Joined: Fri Jun 16, 2006 7:43 am
Post
by Leonhard »
1. Virtual Pointer:Code: Select all
Define (*)Pointer.String = AllocateMemory(SizeOf(String))
Pointer\s = "Hello, World!"
Debug Pointer
2. expression-pointer with datatype:Code: Select all
DataSection
label:
Data.l ?label_2
label_2:
Data.s "Hello, World!"
EndDataSection
Debug (?label).String\s ;/ Give "Hello, World!"
3. complex macros:Code: Select all
MacroX List "NewXArray" name.StructureName(Elements) ;/ Create a list of Elements
Code: ;/ the intern Macro-Code
Macro name(useElements)
(name+(SizeOf(StructureName)*useElements)).StructureName
EndMacro
Free: ;/ by 'End' call
FreeMemory(name)
Return: ;/ return of the Macro
(*)name.StructureName = AllocateMemory(SizeOf(StructureName)*(Elements + 1))
EndMacroX
Define NewXArray MyArray.String(1) ;Define (*)MyArray.String = AllocateMemory(SizeOf(String)*(1 + 1))
MyArray(0)\s = "Hello" ; (MyArray+(SizeOf(String)*0)).String
MyArray(1)\s = "World" ; (MyArray+(SizeOf(String)*1)).String
End 1 ; FreeMemory(MyArray)
-
Chrono Syndrome
- Enthusiast

- Posts: 169
- Joined: Thu Oct 05, 2006 6:44 am
-
Contact:
Post
by Chrono Syndrome »
Interesting ideas...
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
-
Leonhard
- User

- Posts: 55
- Joined: Fri Jun 16, 2006 7:43 am
Post
by Leonhard »
Comments?
-
Rescator
- Addict

- Posts: 1769
- Joined: Sat Feb 19, 2005 5:05 pm
- Location: Norway
Post
by Rescator »
3. complex macros:
is very close to how a procedure works (esp. the return part)
-
Leonhard
- User

- Posts: 55
- Joined: Fri Jun 16, 2006 7:43 am
Post
by Leonhard »
Whis this macros can you create new keywords!
Procedures are not so optimized.
-
Trond
- Always Here

- Posts: 7446
- Joined: Mon Sep 22, 2003 6:45 pm
- Location: Norway
Post
by Trond »
Procedures are not so optimized.
What do you mean?
-
Leonhard
- User

- Posts: 55
- Joined: Fri Jun 16, 2006 7:43 am
Post
by Leonhard »
Procedures must you write the Parameters in the steak. At Macros is it not so.