Search found 12071 matches

by fxm
Jun 24, 2024 15:12
Forum: Beginners
Topic: Simple Parser
Replies: 4
Views: 256

Re: Simple Parser

I corrected the split() function and the call to it: Function Split(ByVal inputs As String, ByVal delimiter As String, tokens() As String) As Integer Dim token As String = "" Dim tokenCount As Integer = 0 For i As Integer = 1 To Len(inputs) If Mid(inputs, i, 1) = delimiter Then If token <>...
by fxm
Jun 23, 2024 12:29
Forum: Community Discussion
Topic: UnlockMe #1 - Fun Game
Replies: 5
Views: 326

Re: UnlockMe #1 - Fun Game

Simply:
*Cptr(Boolean Ptr, @sec) = True
by fxm
Jun 20, 2024 15:11
Forum: Sources, Examples, Tips and Tricks
Topic: Auto-Sized Zstring Object
Replies: 12
Views: 2088

Re: Auto-Sized Zstring Object

Simpler 'Variable-Length Zstring' Object, using an internal private var-len string for auto-sizing: ' Variable-Length Zstring Object ' ' Structure 'VarLenZstring' defining an auto-sized Zstring object ' where memory allocation is implicitly handled by a private member String. ' - Different public me...
by fxm
Jun 20, 2024 11:56
Forum: Projects
Topic: LZLE List Engine with user friendly powerfull syntax - BETA 0.997a
Replies: 103
Views: 45354

Re: LZLE List Engine with user friendly powerfull syntax - BETA 0.997a

From version fbc 1.10.0 (parser fix), compile errors due to a space inserted in the middle of the '->' operator.
Solution: Replace '- >' with '->' everywhere.
by fxm
Jun 20, 2024 9:04
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

Nb : in my use case, I do not need to keep previous value. 'Reallocation' is just for size. In your specific case (no data to keep), the 3 lines: Dim As Any Ptr p = Allocate(...) Swap This.myPtr, p Deallocate(p) are at execution faster or equal to the single line: This.myPtr = Reallocate(This.myPtr...
by fxm
Jun 20, 2024 8:17
Forum: Beginners
Topic: Load extern DLL file
Replies: 3
Views: 279

Re: Load extern DLL file

and when you call the dll procedure, the procedure pointer name must always be followed by parentheses containing the argument(s) compatible with the declaration (if no argument, empty parentheses).
Example in your case:
Print HelloBatman(string_argument)
by fxm
Jun 19, 2024 12:27
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

Replacing allocate+swap by reallocate is not a problem, very small benefit expected. But, concept consequence in a member procedural body: - something like (1 line): This.myPtr = Reallocate(This.myPtr, ...) - instead of (4 lines): Dim As Any Ptr p = Allocate(...) Swap This.myPtr, p FB_memcopy(Byval...
by fxm
Jun 19, 2024 9:01
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

Context : I needed a pre allocated zstring available for being used very fast (no need to reallocate) The size shall be known, logically fixed, but with possible resize to bigger size (never smaller) The zstring is in a class. The zstring resize request is inside a property of this class. As the pr...
by fxm
Jun 19, 2024 8:27
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

Example of exhaustive testing after REALLOCATE: Sub resize(Byval p As Any Ptr, Byval size As Longint) Dim As Any Ptr tp = Reallocate(p, size) If tp > 0 Then Print "REALLOCATE succeeded for " & size & " bytes" If tp <> p Then Print "memory moved" ' Deallocate(myP...
by fxm
Jun 18, 2024 20:31
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

I supposed the new allocated could find available memory outside the class wheras the reallocate was trying finding space into the same area inside class definition ?? (Or reallocate did break class desc integrity) REALLOCATE first attempts to resize the memory already allocated without moving its ...
by fxm
Jun 18, 2024 11:22
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

I use Swap in lzle code (hashtag). I use it little, but it is particularly useful and critical in its context, because it allows to exchange pointer names of different scopes, in a context in which "Reallocate" could not be used because the success of the allocation shall be guaranteed (f...
by fxm
Jun 17, 2024 13:56
Forum: Community Discussion
Topic: Freebasic 1.20.0 Development
Replies: 295
Views: 29648

Re: Freebasic 1.20.0 Development

Many, many other names, like now SWAP, are also in the quirk word class (see src/compiler/symb-keyword.bas).
Therefore this does not mean that they are necessarily sure to be deleted in the future.
by fxm
Jun 16, 2024 19:42
Forum: Beginners
Topic: Parse function
Replies: 9
Views: 471

Re: Parse function

The value of a function can be returned in three ways: - 'Return' keyword followed by a value exits the function immediately, and returns that value to the caller. - Functions can also return values by assigning the 'Function' keyword or the 'function_identifier' to the desired return value (but 'F...
by fxm
Jun 16, 2024 9:15
Forum: Beginners
Topic: Parse function
Replies: 9
Views: 471

Re: Parse function

Finally, a sequential pass searching only for occurrences of the delimiter: (this version supports delimiters of one character or more) FUNCTION PARSE(expression AS STRING, delimiter AS STRING = ",", index AS INTEGER) AS STRING DIM count AS INTEGER = 1 DIM d As INTEGER = 1 DIM f AS INTEGER...
by fxm
Jun 16, 2024 8:27
Forum: Beginners
Topic: Parse function
Replies: 9
Views: 471

Re: Parse function

First of all, by keeping your principle of a sequential pass character by character, one can improve your procedure body a little: FUNCTION PARSE(expression AS STRING, delimiter AS STRING = ",", index AS INTEGER) AS STRING DIM count AS INTEGER = 1 DIM temp AS STRING = "" FOR i AS...