FreeBASIC 1.08 Development
-
- Posts: 54
- Joined: Jun 29, 2014 17:15
Re: FreeBASIC 1.08 Development
Getting more and more excited for 1.08 :-)
Great work!
Great work!
Re: FreeBASIC 1.08 Development
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?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
FB_ARG_MIDOF__(arg,sep,cnt) ? :-)
Re: FreeBASIC 1.08 Development
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.marcov wrote:FB_ARG_MIDOF__(arg,sep,cnt) ? :-)
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.
Re: FreeBASIC 1.08 Development
Dang, another bug with the optional parens() feature. Have to fix this one for sure as can break existing code.
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:
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.
Code: Select all
#define X(arg) some expr
Type T
X as integer '' <<< error
End Type
So, I'm thinking of something like:
Code: Select all
#macro somename ? ( arg1, arg2, args... )
'' ...
#endmacro
-
- Posts: 252
- Joined: Mar 12, 2006 16:25
Re: FreeBASIC 1.08 Development
I had some ideas a while ago making macros much more powerfull. Introducing some macro statements for context handling would be great.
viewtopic.php?f=2&t=28465&p=270769#p270769
viewtopic.php?f=2&t=28465&p=270769#p270769
Re: FreeBASIC 1.08 Development
It might be nice to complete the fbc update for anything related to the "$" suffix.fxm wrote:These warnings will must also be masked in '-lang qb' or '-lang fblite', and this even with '-w suffix' compile option activated.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
I'm waiting for this to update the documentation (21 keywords impacted).
-
- Posts: 1186
- Joined: May 08, 2006 21:58
- Location: Crewe, England
Re: FreeBASIC 1.08 Development
Will the 1,08 release include the gas64 option?
Re: FreeBASIC 1.08 Development
CoderJeff and I are working on that.jevans4949 wrote:Will the 1,08 release include the gas64 option?
Why are you interested ?
-
- Posts: 1186
- Joined: May 08, 2006 21:58
- Location: Crewe, England
Re: FreeBASIC 1.08 Development
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.SARG wrote:CoderJeff and I are working on that.jevans4949 wrote:Will the 1,08 release include the gas64 option?
Why are you interested ?
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FreeBASIC 1.08 Development
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
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.
Re: FreeBASIC 1.08 Development
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.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.
In the future adding of the option -gen gas should be necessary.
About your existing routines more than probable.
Re: FreeBASIC 1.08 Development
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: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; }"
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
Re: FreeBASIC 1.08 Development
Code: Select all
code="Line "+_
"continuation "+_
"can actually work "+_
"with strings"
Re: FreeBASIC 1.08 Development
Right, that works (although it remains somewhat clumsy):angros47 wrote:Code: Select all
code="Line "+_ "continuation "+_ "can actually work "+_ "with strings"
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
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
Re: FreeBASIC 1.08 Development
With /' ... '/ used for multi-line comments, maybe /" ... "/ for multi-line strings -- for some symmetry.