Search found 225 matches

by RockTheSchock
May 22, 2015 11:36
Forum: Community Discussion
Topic: Error in Winsock.bi
Replies: 1
Views: 623

Error in Winsock.bi

I tried EGNP/ TSNE and found some errors in winsock.bi. It seems to be a regression in preprocessor. Sizeof((t)) with 2 parenthesis doesnt work anymore: #Define _A(t) (CLng(sizeof((t))) ) Screen 0 #Print _A(ULong) Print _A(Ulong) Sleep In winsock.bi you will need to fix sizeof((t)) with sizeof(t) #d...
by RockTheSchock
May 21, 2015 14:31
Forum: Community Discussion
Topic: KolibriOS
Replies: 2
Views: 798

KolibriOS

How difficult is it, to port FBC to KolibriOS? Maybe it would be a nice platform as alternative to DOS.

http://kolibrios.org/
http://diamond.kolibrios.org/hll/hll_eng.htm

svn://kolibrios.org/programs/develop
by RockTheSchock
May 19, 2015 12:11
Forum: General
Topic: Passing pointer to member function to another class
Replies: 3
Views: 839

Re: Passing pointer to member function to another class

Use a static method add and member method add. http://forum.qbasic.at/viewtopic.php?p=106890#106890 Type MyUDT Public: Declare Static Sub SetValue(obj As MyUDT, v As Integer) Declare Sub SetValue(v As Integer) value As Integer End Type Type SubInteger As Sub(obj As MyUDT,v As Integer) Sub MyUDT.setV...
by RockTheSchock
May 18, 2015 15:47
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1239

Re: Can I change default initial values?

Wouldn't it be enough to just issue a warning if a variable gets assigned a constant value more than once? @dkl or any other fbc developer. (I did take a brief look into fbc 1.0 sources, i am not an expert!): Just add a CONST_ASIGNMENT flag to "type ASTNODE" which is checked/set if an FBVA...
by RockTheSchock
May 16, 2015 14:39
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1239

Re: Can I change default initial values?

Maybe you can use a variant type and overwrite the let operator. So it s possible to catch initialisation. Or you can modify the compiler let operator to issue a warning.
by RockTheSchock
May 12, 2015 20:39
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3502

Re: FreeBASIC variable initialization

FreeBasic is a statically typed language like C, Java, Pascal ... So Var and Dim are used to ensure that each variable has a type. Additionally with Dim you can define arrays. RockTheSchock, I didn't know about the VAR keyword. Now I have tried it. This is almost what I want. But the VAR keyword is ...
by RockTheSchock
May 12, 2015 13:26
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3502

Re: FreeBASIC variable initialization

Arrays, variables, strings, and user defined types (UDTs) are initialized to zero or null strings by default when they are created. To avoid the overhead of default variable initialization, the Any initializer can be used with Dim to tell the compiler to only reserve the place for the variable in m...
by RockTheSchock
May 11, 2015 6:50
Forum: Projects
Topic: simple expression evaluator demo
Replies: 18
Views: 3321

Re: expression evaluator

RockTheSchock wrote:Sandbox is set to accept only math functions either with math prefix or without.
BasicCoder2 wrote:Error: snadbox.lua:1:attempt to index global '_ENV (a nil value) 13

I am using Lua 5.2.3. Maybe you are using 5.1. There has been a change how to set enviroments.
by RockTheSchock
Apr 28, 2015 16:22
Forum: Projects
Topic: simple expression evaluator demo
Replies: 18
Views: 3321

Re: expression evaluator

Sandbox is set to accept only math functions either with math prefix or without. sandbox.lua env = _ENV.math env.math = _ENV.math function run(code) f, message = load(code,"sandbox","t",env) if not f then return nil, message end return pcall(f) end Replace eval function with this...
by RockTheSchock
Apr 28, 2015 6:16
Forum: Projects
Topic: simple expression evaluator demo
Replies: 18
Views: 3321

Re: expression evaluator

@RockTheSchock, I assume from looking at your code that your expression evaluator outputs an Assembler version of the expression. Well i modified it a bit so it should run with fbc -lang qb. The assembler output isn't right for a bit more complex expressions, but hey it's one of my early work. I am...
by RockTheSchock
Apr 27, 2015 15:41
Forum: Projects
Topic: simple expression evaluator demo
Replies: 18
Views: 3321

Re: expression evaluator

I know that it's fun to write your own expression evaluator. I once tried it with QB: http://forum.qbasic.at/viewtopic.php?t=8538 But if it's more than just for fun, maybe just use a script language like lua or squirrel. http://www.freebasic.net/forum/viewtopic.php?f=3&t=23061&hilit=Lua&...
by RockTheSchock
Apr 27, 2015 13:46
Forum: Tips and Tricks
Topic: String To Byte Array
Replies: 9
Views: 2133

Re: String To Byte Array

If you don't need a copy of the string but only fast access to the data you could just use a byte or ubyte ptr to access the strings data. Dim txt As String = "Hello"&Chr(0)&"World" Dim pbyte As UByte Ptr pbyte = @txt[0] For pbyte As UByte Ptr = @txt[0] To @txt[0] + Len(t...
by RockTheSchock
Apr 24, 2015 7:00
Forum: Community Discussion
Topic: What is wrong with the BASIC language?
Replies: 72
Views: 11721

Re: What is wrong with the BASIC language?

I think FreeBASIC needs to have some features which makes it distinct to C and C++. I am not an expert in C++ but just make 1 or 2 things better than in C++: maybe strings and a working plattform independent bidirectional "open pipe". builtin graphics and string functions could be optimise...
by RockTheSchock
Apr 16, 2015 9:40
Forum: Community Discussion
Topic: What is wrong with the BASIC language?
Replies: 72
Views: 11721

Re: What is wrong with the BASIC language?

quality and completeness of the development system as a whole. I think it is wiser to discuss where FB should be in 5 (and 10) years, and forget World Domination.

That's excactly the point! Look at Lazarus. A powerful IDE with RAD and cross-platform support.
by RockTheSchock
Apr 08, 2015 6:27
Forum: Community Discussion
Topic: FB 1.02 release
Replies: 57
Views: 9245

Re: FB 1.02 release

Integer divde by a constant like "10" isn't optimized at all with gen -gas. I think dividing by a multiple of 10 isn't so uncommon, so evt. this can speed up things enormously(2x to 10x) especially on older CPUs. There are also many other constants that could be optimized. Look at the impl...

Go to advanced search