Search found 224 matches

by gothon
Jan 22, 2014 3:16
Forum: Beginners
Topic: Single RGB color value possible?(solved)
Replies: 3
Views: 874

Re: Single RGB color value possible?

Is it somehow possible to use a single value to increment an rgb color value? 256 ^ 3 = 16777216. Actually it is. In fact 32bit (and 24bit) color values are usually manipulated as a single 32bit value. Look at the implementation of RGB: KeyPgRgb Note: 256 ^ 3 - 1 = 16777215 = &h00FFFFFF where t...
by gothon
Jan 20, 2014 6:28
Forum: Beginners
Topic: Array questions(solved)
Replies: 14
Views: 1744

Re: Array questions

Hello, this example hides the complexity in a series if macros I have been developing. Like the other examples here there is a loop which calls the destructor of CustomType. This is necessary to free the dynamically allocated string inside it, however after doing that the layer is quickly reallocate...
by gothon
Jan 11, 2014 17:17
Forum: General
Topic: 64bit ops using the heap depend on build options. [Fixed]
Replies: 5
Views: 704

Re: 64bit operations using the heap depend on build options.

Thank you dkl, it appears to be fixed now.
by gothon
Jan 06, 2014 23:19
Forum: General
Topic: FFT algorithm - help [Solved]
Replies: 5
Views: 786

Re: FFT algorithm - help

Your program does not compile as posted. error 41: Variable not declared, pi2 in 'myData(i) = 100*Sin(i*pi2/100)' However I can fix this by adding the line: [code file= :3kudffjo]Const pi2 = 8*Atn(1) With it compiling you need to find out why it crashes. If you compile using option -exx and run the ...
by gothon
Dec 20, 2013 15:56
Forum: Community Discussion
Topic: Miscalleneous bugs in the 32bit compiler
Replies: 27
Views: 2352

Re: Miscalleneous bugs in the 32bit compiler

@MichaelW and dodicat: That's why I'd prefer rol and ror included in Freebasic. My ASM was likely the only one I could find with google at all. So, should I compile with -gas and include that code in my "patch" file, because it's the fastest way? I'm a litte new on all that stuff and I us...
by gothon
Dec 18, 2013 23:53
Forum: Community Discussion
Topic: Miscalleneous bugs in the 32bit compiler
Replies: 27
Views: 2352

Re: Miscalleneous bugs in the 32bit compiler

4. rol and ror (bit rotate right and left) are not supported, but used often in crypto. Its true that bit rotations are not widely supported in high level languages. Outside of cryptography they are not used much. However you can use code such as: #Define Rol(X, Y) (((X) Shl (Y)) Or ((X) Shr (8*Siz...
by gothon
Nov 20, 2013 19:58
Forum: Libraries
Topic: SDL2 package (version 2.0.1)
Replies: 22
Views: 9398

Re: SDL2 package (version 2.0.1)

What about adding a separate header that includes the main header and adds your code? I don't see why it would be a problem since the linker is smart enough not to bind unused libraries, although it would be preferred if there were a simple switch we could use to decide between static linking and d...
by gothon
Nov 20, 2013 16:03
Forum: Libraries
Topic: SDL2 package (version 2.0.1)
Replies: 22
Views: 9398

Re: SDL2 package (version 2.0.1)

Thanks TJF, good work here. I just signed up to thank you for the updated headers! I've been looking for them for a few weeks now. I even tried to do it myself, but I was completely lost haha. :) The renderer example works fine for me, by the way. Also, would it be too bold to ask if there is any ch...
by gothon
Sep 14, 2013 5:40
Forum: Community Discussion
Topic: Inline functions
Replies: 9
Views: 1926

Re: Inline functions

In theory it should be possible to make llvm perform an inlining optimization pass on the program after it has been linked. That is if every module is compiled to llvm bit-code, then linked by the llvm linker. However in C inline functions are often defined in headers inside their declaration so tha...
by gothon
Aug 11, 2013 6:36
Forum: Tips and Tricks
Topic: Recursive Macros!
Replies: 2
Views: 1496

Recursive Macros!

It was mentioned recently that recursive macros are not supported by freebasic: http://www.freebasic.net/forum/viewtopic.php?f=2&t=21461&start=30#p190005 Well this is officially true, I have actually managed to implement working recursive macros. Ex: #Include "MakeNVars.bi" MakeNVa...
by gothon
Aug 09, 2013 19:20
Forum: Beginners
Topic: Dynamic arrays question(deleting single element fom array)
Replies: 63
Views: 5900

Re: 'Sizeof' does not compile with a dereferenced string ptr

I noticed this too. There is also some difficulty writing macros to compare types. Take example #2 from http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgTypeof and just switch the types: Dim As Integer foo #print TypeOf(foo) #if TypeOf(foo) = String #print "Never happened!" #endif and yo...
by gothon
Aug 09, 2013 4:25
Forum: Beginners
Topic: ld: cannot find -lXrandr
Replies: 2
Views: 1133

Re: ld: cannot find -lXrandr

Seems like you are missing some required packages. You can probably install Xrandr by typing something like: sudo apt-get install libxrandr-dev at a terminal window. (and entering you admin password if needed) You should probably look at the list of required packages on the threads at the Linux foru...
by gothon
Aug 09, 2013 4:13
Forum: Beginners
Topic: Dynamic arrays question(deleting single element fom array)
Replies: 63
Views: 5900

Re: Dynamic arrays question(deleting single element fom arra

Another version from macro of gothon, more compact by using "reallocate": #Macro remove_element(array, sizeOfArray, indexToRemove) memcpy(array+(indexToRemove), array+(indexToRemove)+1, _ ((sizeOfArray) - (indexToRemove) - 1)*sizeof(*array)) array = reallocate(array, ((sizeOfArray) - 1)*s...
by gothon
Aug 03, 2013 0:32
Forum: Beginners
Topic: Dynamic arrays question(deleting single element fom array)
Replies: 63
Views: 5900

Re: Dynamic arrays question(deleting single element fom arra

Is there a way to make this function sutable for any type of array? Like make it universal. For now i have CAMERA type. Using macros with 'TypeOf' you can effectively have parameterized data types; perhaps something like the following is what you are looking for? #include "crt/string.bi" ...
by gothon
Jul 27, 2013 10:15
Forum: General
Topic: Beautify
Replies: 16
Views: 2281

Re: Command-based procedures adaptation

Hmm tough one. I'm thinking it can probably be done like this: Dim As String TempStr Open "dest.bas" For Output As #1 Open Pipe "./FBeauty < file.ext" For Input As #2 Do Until EOF(2) Line Input #2, TempStr Print #1, TempStr Loop Close #2 Close #1 Here we are still using the shell...

Go to advanced search