FreeBASIC 1.08 Development

For other topics related to the FreeBASIC project or its community.
Pim Scheffers
Posts: 51
Joined: Jun 29, 2014 17:15

Re: FreeBASIC 1.08 Development

Postby Pim Scheffers » Sep 07, 2020 4:49

Getting more and more excited for 1.08 :-)

Great work!
marcov
Posts: 3010
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: FreeBASIC 1.08 Development

Postby marcov » Sep 07, 2020 7:52

coderJeff wrote: __FB_ARG_LEFTOF__(arg,sep) to get the left of separator of a macro argument
__FB_ARG_RIGHTOF__(arg,sep) to get the right of separator of a macro argument
__FB_ARG_COUNT__(args...) to count the number of arguments in a list


I can get the count, but it must be 1 or 2, since I can only get the right or the left, but no way to get list item 2 (the middle one) when there are 3 items?

FB_ARG_MIDOF__(arg,sep,cnt) ? :-)
coderJeff
Site Admin
Posts: 3308
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Postby coderJeff » Sep 07, 2020 13:45

marcov wrote:FB_ARG_MIDOF__(arg,sep,cnt) ? :-)


I was thinking about something similar, like getting the N-th argument. But there's some technical limitations on how fbc handles variadic argument lists under the hood, making this actually quite difficult without some major modifications.

Thanks, a few thoughts:
- Maybe I should have named the argument counting macro as __FB_COUNT_ARGS__( args... ), as it can expect a list of arguments, either empty, or separated with fbc's argument separator: the comma ',' and respects parentheses levels '(' ... ')' for any expressions.
- the 'leftof' and 'rightof' macros work on a **list of tokens**, as would be in a single argument: 'arg' may contain comma and parentheses, but have no special meaning to 'leftof' and 'rightof' operation.

As I have time I'll try add some more info and details to Basic-Macros in fbc 1.08.
coderJeff
Site Admin
Posts: 3308
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Postby coderJeff » Sep 08, 2020 1:46

Dang, another bug with the optional parens() feature. Have to fix this one for sure as can break existing code.

Code: Select all

#define X(arg) some expr
Type T
   X as integer  '' <<< error
End Type

It's due the symbol name look ups. Previous only 'X(' could indicate the macro, but now because parens are optional, causes disaster.

So, I'm thinking of something like:

Code: Select all

#macro somename ? ( arg1, arg2, args... )
   '' ...
#endmacro

Using '?' to indicate default parens() only, Otherwise, macros and defines just work like they always did by default. Though I'm not crazy about the syntax, I could at least leave the feature alone for a knowing it's not breaking any existing code.
RockTheSchock
Posts: 231
Joined: Mar 12, 2006 16:25

Re: FreeBASIC 1.08 Development

Postby RockTheSchock » Sep 08, 2020 9:51

I had some ideas a while ago making macros much more powerfull. Introducing some macro statements for context handling would be great.

https://www.freebasic.net/forum/viewtopic.php?f=2&t=28465&p=270769#p270769
fxm
Posts: 9934
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: FreeBASIC 1.08 Development

Postby fxm » Sep 09, 2020 5:34

fxm wrote:
coderJeff wrote:The intent I have is that built-in string functions with '$' suffix should have no warning unless '-w suffix' was given. Currently only works properly with the quirk stuff - MID$, MK..$, TRIM$, etc. It doesn't work right with the other built-ins like LEFT$, COMMAND$, SPACE$, etc

These warnings will must also be masked in '-lang qb' or '-lang fblite', and this even with '-w suffix' compile option activated.

It might be nice to complete the fbc update for anything related to the "$" suffix.
I'm waiting for this to update the documentation (21 keywords impacted).
jevans4949
Posts: 1156
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FreeBASIC 1.08 Development

Postby jevans4949 » Sep 09, 2020 15:34

Will the 1,08 release include the gas64 option?
SARG
Posts: 1142
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FreeBASIC 1.08 Development

Postby SARG » Sep 09, 2020 20:46

jevans4949 wrote:Will the 1,08 release include the gas64 option?
CoderJeff and I are working on that.
Why are you interested ?
jevans4949
Posts: 1156
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FreeBASIC 1.08 Development

Postby jevans4949 » Sep 09, 2020 21:55

SARG wrote:
jevans4949 wrote:Will the 1,08 release include the gas64 option?
CoderJeff and I are working on that.
Why are you interested ?

Been trying to work out how to use it. Have a few modules which have simple 32-bit routines, although I will probably need to re-wite these.
D.J.Peters
Posts: 8169
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC 1.08 Development

Postby D.J.Peters » Sep 09, 2020 23:58

I'm waiting so long for !
wInkey() we have wString but no wString input :-(
(it makes no sense to write an editor or a GUI complete in FreeBASIC without unicode or UTF user input !)

For shader code or any script language, Lua, OpenCL, libtcc, libsquirrel ... we need vebatim strings.
(ignore CR and LF inside a string thats all)
var code = "main () {
source code;
source code source code source code;
mopre source code;
source code source code;
source code; }"

I saw and use in a modern language "spin" underscore '_' in any literal number are allowed and I like it.

var myNmber = &H00_CAFFEE_DEAD_BEEF
vat myBitmask = &B1010_0011_1010_0000_11111111_1100
var myDec = 100_000
var myFloat = 2_600_000.5

Joshy
Last edited by D.J.Peters on Sep 10, 2020 0:04, edited 1 time in total.
SARG
Posts: 1142
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FreeBASIC 1.08 Development

Postby SARG » Sep 10, 2020 0:01

jevans4949 wrote:Been trying to work out how to use it. Have a few modules which have simple 32-bit routines, although I will probably need to re-wite these.
Currently the provided version of the exe can be used as the 32bit version of fbc : asm code is directly emitted. Just replace fbc by fbc64_gas64.
In the future adding of the option -gen gas should be necessary.
About your existing routines more than probable.
jj2007
Posts: 1692
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: FreeBASIC 1.08 Development

Postby jj2007 » Sep 10, 2020 9:24

D.J.Peters wrote:For shader code or any script language, Lua, OpenCL, libtcc, libsquirrel ... we need vebatim strings.
(ignore CR and LF inside a string thats all)
var code = "main () {
source code;
source code source code source code;
mopre source code;
source code source code;
source code; }"
Interesting idea.You could realise it with a filter/preprocessor that checks for lines with only one quote. I am surprised, though, that line continuation doesn't work with literal strings:

Code: Select all

var code = "main () {"
code=code+Chr(13, 10)+"source code;"
code=code+Chr(13, 10)+"source code source code source code;"
code=code+Chr(13, 10)+"more source code;"
code=code+Chr(13, 10)+"source code source code;"
code=code+Chr(13, 10)+"source code; }"
Print code

#if 0 ' strangely enough, these are not allowed:
code=code+Chr(13, 10, "source code;")   ' error 58: Type mismatch

code="Line _
continuation _
does not work _
with strings"

#endif
angros47
Posts: 1673
Joined: Jun 21, 2005 19:04

Re: FreeBASIC 1.08 Development

Postby angros47 » Sep 10, 2020 10:02

Code: Select all

code="Line "+_
"continuation "+_
"can actually work "+_
"with strings"
jj2007
Posts: 1692
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: FreeBASIC 1.08 Development

Postby jj2007 » Sep 10, 2020 11:23

angros47 wrote:

Code: Select all

code="Line "+_
"continuation "+_
"can actually work "+_
"with strings"
Right, that works (although it remains somewhat clumsy):

Code: Select all

asm int 3
code="Line "+_
Chr(13, 10)+"continuation "+_
Chr(13, 10)+"can actually work "+_
Chr(13, 10)+"with strings"
asm nop
... and it's even OK under the hood, the compiler works with one single string:

Code: Select all

   int3
   push 0
   push 37
   push offset 0040608C               ; ³Arg3 = ASCII "Line ",CR,LF,"continuation ",CR,LF,"can actually work ",CR,LF,"with strings"
   push -1
   lea eax, [ebp-10]
   push eax
   call 00401CD0                                        ; create the string
   nop
coderJeff
Site Admin
Posts: 3308
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: FreeBASIC 1.08 Development

Postby coderJeff » Sep 10, 2020 13:39

With /' ... '/ used for multi-line comments, maybe /" ... "/ for multi-line strings -- for some symmetry.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests