s390guy / SATK

Toolkit for creating baremetal programs targeting mainframe compatible systems
GNU General Public License v3.0
42 stars 6 forks source link

Unexpected behavior defining empty MACRO #36

Open Fish-Git opened 1 year ago

Fish-Git commented 1 year ago

The following works fine:

         MACRO
&LABEL   FISHTEST &whatever
         MEND
         END

ISSUE 1:

The following causes an INTERNAL ERROR:

         MACRO
&LABEL   FISH_X &whatever
         MEND
         END

Notice the macro name contains an "_" (underscore). This results in:

Solution Build begun at 5/12/2023 4:18:19 PM
SVN: 5991-modified

1>------ Build started: Project: ASMATEST, Configuration: Debug Win32 ------
1>Performing Makefile project actions
1>asma.py Copyright (C) 2014-2022 Harold Grovesteen
1>Phase 'pass0_1' INTERNAL ERROR WHILE PROCESSING THIS STATEMENT
1>    [3]          MEND
1>Traceback (most recent call last):
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\tools\asma.py", line 426, in <module>
1>    ASMA(tool,dm).run()
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\tools\asma.py", line 150, in run
1>    result=self.assembler.assemble(filename=self.source)
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\asma\assembler.py", line 1531, in assemble
1>    return self.SP.run(self,filename)
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\asma\assembler.py", line 3559, in run
1>    return self.process()   # Return the result of last phase run
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\asma\asmbase.py", line 1657, in process
1>    self.result=phase(self.asm,fail=self.asm.fail)  # Execute it!
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\asma\assembler.py", line 3405, in Pass0_1
1>    self.getStmts0_1(asm,fail=fail,debug=debug)
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\asma\assembler.py", line 3382, in getStmts0_1
1>    macdefn=mb.defining(s,debug=False)
1>  File "C:\Users\Fish\Documents\Visual Studio 2008\Projects\Hercules\_Git\_Harold\SATK-0\asma\asmmacs.py", line 1703, in defining
1>    raise assembler.AssemblerError(line=stmt.lineno,linepos=flds.oppos,\
1>NameError: name 'flds' is not defined
1>Project : error PRJ0002 : Error result 1 returned from 'C:\Windows\SysWow64\cmd.exe'.
1>Build Time 0:00
1>Build log was saved at "file://c:\Users\Fish\Documents\Visual Studio 2008\Projects\MyProjects\ASMA-0\ASMATEST\BuildLog.htm"
1>ASMATEST - 1 error(s), 0 warning(s)

1>ASMATEST - 1 error(s), 0 warning(s)

Solution Build ended at 5/12/2023 4:18:21 PM
Solution Build duration 00:00:01

ISSUE 2:

The following minor change causes a compilation error:

         MACRO
&LABEL   FISH_X &whatever
         MEXIT
         MEND
         END

Notice I added a MEXIT immediately before the MEND. This results in a "operation field contains an invalid char: _" compilation error:

ASMA Ver. 0.2.1                                                                                     12 May 2023 16:27:32  Page     1

  LOC        OBJECT CODE       ADDR1     ADDR2    STMT

                                                     1          MACRO
                                                     2 &LABEL   FISH_X &whatever
          ** [2] @[2]-1 operation field contains an invalid char: _
                                                     3          MEXIT
                                                     4          MEND
                                                     5          END
ASMA Ver. 0.2.1                                                                                     12 May 2023 16:27:32  Page     2

     SYMBOL        TYPE  VALUE   LENGTH  DEFN  REFERENCES

IMAGE               1    000000       0     0
ASMA Ver. 0.2.1                                                                                     12 May 2023 16:27:32  Page     3

MACRO  DEFN  REFERENCES

MEXIT     3
ASMA Ver. 0.2.1                                                                                     12 May 2023 16:27:32  Page     4

   DESC    SYMBOL  SIZE  POS  ADDR

Entry: not defined

Image      IMAGE      0  0-0  0-0
  Region              0  0-0  0-0
    CSECT             0  0-0  0-0
ASMA Ver. 0.2.1                                                                                     12 May 2023 16:27:32  Page     5

   STMT                                           FILE NAME

1     c:\Users\Fish\Documents\Visual Studio 2008\Projects\MyProjects\ASMA-0\ASMATEST\ASMATEST.asm

** ERRORS FOUND: 1 **

[2] @[2]-1 operation field contains an invalid char: _


If I then remove the underscore:

         MACRO
&LABEL   FISHX &whatever
         MEXIT
         MEND
         END

Then it works fine!

I could not find any mention anywhere in the documentation regarding "_" (underscore) being an invalid character for a macro's name. Is this a bug in ASMA? Or an undocumented limitation of ASMA?

Thanks!

s390guy commented 1 year ago

Oh good. You found your own work around. :-) Issue 1 - definitely a bug. Usually a typo. Issue 2 - do not know why it is doing that. Bug or WAD or WAD for a reason?