Hi,
Attachment contains sources and binaries for 3 small programs:
Error : prints out all known errno's and corresponding error messages
fnf : tries to open non-existent file and shows error message by calling error , error_at_line or perror
depending on user choice ( read comments in fnf.asm )
fnfc : tries to open non-existent file and shows error message . Demonstrates usage of GCC magic constant -
__FUNCTION__
NOTE: UASM has new builtin variable @ProcLine . Would it be logical to implement something like
@CurrProc or @ProcName ?
@Line has been around for a while, and @ProcName can be implemented in the PROLOG:include \Masm32\MasmBasic\Res\JBasic.inc ; ## console demo, builds in 32- or 64-bit mode with ML, UAsm, AsmC ##
.code
MyTest proc
nop
% echo ## the name of this procedure is jbProc$ ## ; see build output
tmp$ CATSTR <Str$("This is proc >, jbProc$, < starting in line %i\n", jbPrologRun)>
Print tmp$
ret
MyTest endp
Init ; OPT_64 1 ; 1=use 64 bit assembly
PrintLine Chr$("This code was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format")
jinvoke MyTest
Inkey "That was easy"
EndOfCode
Output:This code was assembled with ml64 in 64-bit format
This is proc MyTest starting in line 3
That was easy
Quote from: jj2007 on January 04, 2018, 09:05:26 PM
@Line has been around for a while ...
@ProcLine is a little bit different :
Quote from: uasm246_ext.pdf
@ProcLine, indicates the current source code line number relative to the start of the current procedure.
Can you post source code for your
jbProc ?
Relative to the proc start is easy. too:
include \Masm32\MasmBasic\Res\JBasic.inc ; ## console demo, builds in 32- or 64-bit mode with ML, UAsm, AsmC ##
.code
MyTest proc
nop
% echo ## the name of this procedure is jbProc$ ## ; see build output
tmp$ CATSTR <Str$("This is proc >, jbProc$, < starting in line %i\n", @Line-jbPrologRun)>
Print tmp$
ret
MyTest endp
Output:
This is proc MyTest starting in line 4
Quote from: GoneFishing on January 04, 2018, 09:16:00 PM
Can you post source code for your jbProc ?
It's included in the MasmBasic package as \Masm32\MasmBasic\Res\JBasic.inc
Thanks. I'll look into JBasic.inc
Now let's wait for JOHNSA
EDIT: Oh, I've forgotten that I had already played with this kind of helper macro for obtaining proc name. It was easy. Still having builtin little magic trick like @ProcName or @CurrProcName or @ProcCurr would be great !
Hey,
We can definitely add it in. I will do so and include it in the next update. @ProcName ok with everyone?
@ProcName is in, the stack alignment issue is sorted and a bunch of other pending changes. 2.46.6 packages are up :)
Great!
I'll check it tomorrow .