flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
CandyMan
How to distinguish the label and constant?
Code: ThisIsConst = 10 ThisIsLabel: if ThisIsLabel eqtype 0 end if _________________ smaller is better |
|||
![]() |
|
shutdownall
Strange request - for what do you need it exactly ?
You should know if you define a label or a constant. ![]() |
|||
![]() |
|
CandyMan
Thanks!
|
|||
![]() |
|
revolution
shutdownall wrote: Strange request - for what do you need it exactly ? |
|||
![]() |
|
baldr
revolution,
Surely for a macro (but if doesn't fit well). There should be some synergy between preprocessor and interpreter (at least we have rept for some calc), probably in 2.0 it'll prosper wildly. ![]() |
|||
![]() |
|
seapoint
Recently I had a similar problem, but I wanted to discern between normal labels and everything else. The simplest way is just to use regexp in python
Code: import sys, re def main(argv): if len(argv) < 3: print "usage: %s <source asm> <output asm>" % argv[0] else: output_file = open(argv[2], 'w') input_file = open(argv[1], 'r') out = add_labels(input_file.read()) output_file.write(out) def add_labels(source): labels = [label[:-1] for label in re.findall("\w+:", source)] return "_ALL_LABELS equ %s\n" % ",".join(labels) + source if __name__ == "__main__": main(sys.argv) then you can just use if arg in <_ALL_LABELS>. For dynamic labels (generated by macros) I guess you can first preprocess asm source using fasm and get all labels from that? It would be great if fasm was written in python, with all "macros" as full python code. Literally everything would be possible, and it would probably be much faster, too. Maybe someday... |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.