flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Eqtype does not recognize <"Hello"," World |
Author |
|
rCX 28 May 2009, 18:54
I was using revolution's method to concat strings and I found that eqtype does not recognize angled brackets.
Code: org 100h use16 macro type_test A* { if A eqtype "a" display "String",0Ah else if A eqtype <> display "Concated String",0Ah end if } type_test "Hello World" ;Prints "String" type_test <"Hello World"> ;Prints "String" type_test <"Hello"," World"> ;Doesn't print anything EDIT: Probably not a bug... Last edited by rCX on 29 May 2009, 01:03; edited 1 time in total |
|||
28 May 2009, 18:54 |
|
rCX 28 May 2009, 19:28
hmm... Is there any way to consistently identify something as a string regardless of how many substrings there are?
Code: type_test <"Hello"," World"> ;Gives "Concated String" type_test <"Hello","Wor","ld">;Gives nothing... I used fasmpre and its output is below. Apparently the preprocessor does not convert 'Hello',' Wor','ld' to 'Hello World' before performing eqtype Code: ;macro type_test A* ;{ ; if A eqtype 'a' ; display 'String',0Ah ; else if A eqtype 'a','a' ; display 'Concated String',0Ah ; end if ;} ;type_test 'Hello World' if 'Hello World' eqtype 'a' display 'String',0Ah else if 'Hello World' eqtype 'a','a' display 'Concated String',0Ah end if ;type_test<'Hello World'> if 'Hello World' eqtype 'a' display 'String',0Ah else if 'Hello World' eqtype 'a','a' display 'Concated String',0Ah end if ;type_test<'Hello',' Wor','ld'> if 'Hello',' Wor','ld' eqtype 'a' display 'String',0Ah else if 'Hello',' Wor','ld' eqtype 'a','a' display 'Concated String',0Ah end if |
|||
28 May 2009, 19:28 |
|
Madis731 28 May 2009, 19:54
From FASM.PDF (2.3. PREPROCESSOR DIRECTIVES) modified example:
Code: macro append item { list equ match any, list \{ list equ list,item \} match , list \{ list equ item \} display list } append <"Hi", ",",32,"Hello World",13,10,""> |
|||
28 May 2009, 19:54 |
|
rCX 28 May 2009, 20:49
but the code...
Code: macro type_test A* { if A eqtype "a" display "String",13, 10 else if A eqtype <"a"," a"> display "Concated String", 13, 10 end if } ...won't identify list as a "string" or "concated string" |
|||
28 May 2009, 20:49 |
|
bitRAKE 29 May 2009, 00:15
Code: type_test <<"Hello","World">> It is important to note: EQTYPE is assemble-time whereas MATCH is done by the pre-processor. All macros have finished by the time EQTYPE is being resolved. rCX, I am certain you are already aware of this - I'm just stating the obvious for completeness of the discussion. EQTYPE counts items. So, a general test is not possible with EQTYPE. <<"Hello","Cruel","World">> would require another IF, etc... |
|||
29 May 2009, 00:15 |
|
rCX 10 Jun 2009, 06:16
Another question... Is there a way to use escape sequences in strings? e.g...
Quote: " I said \"hi\". " ...or... Quote: "bye\0" |
|||
10 Jun 2009, 06:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.