News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

jne problem in macro

Started by bushpilot, December 20, 2004, 09:11:41 PM

Previous topic - Next topic

bushpilot

The following macro:

_print(FileType,buffer,length) = \
   cmp d[FileType],FILE_TYPE_CHAR \
   jne > 1 \
   invoke WriteConsole,[print_handle],buffer,length,addr _CharsWritten,NULL \
   1: \
  #ifdef UNICODE                                                                                  \
     invoke WideCharToMultiByte,CP_ACP,WC_SEPCHARS,buffer,length,addr _Converted$,2048,NULL,NULL \
     invoke WriteFile,[print_handle],addr _Converted$,eax,addr _CharsWritten,NULL \
  #else \
     invoke WriteFile,[print_handle],buffer,length,addr _CharsWritten,NULL \
  #endif


gives the following error:

QuoteError!
Line 1512 of assembler source file (basm.asm):-
Macro contained a forward jump to nowhere
jne > 1                \
   invoke WriteConsole,[print_handle],addr _string_5,42,addr _CharsWritten,NULL                     \
   1:                  \
  #ifdef UNICODE                  \
     invoke WideCharToMultiByte,CP_ACP,WC_SEPCHARS,addr _string_5,42,addr _Converted$,2048,NULL,NULL  \
     invoke WriteFile,[print_handle],addr _Converted$,eax,addr _CharsWritten,NULL                 \
  #else                  \
     invoke WriteFile,[print_handle],addr _string_5,42,addr _CharsWritten,NULL                      \
  #endif
Defined in Line 448 of the include file c:\basm32\bin\ANSI.inc:
WriteConsole = WriteConsoleA
OBJ file not made

Any suggestions?

Greg

donkey

Hi BushPilot,

I have found that I get this when I use a jump in a macro that has to jump past an equate, for example in your macro WriteConsole equ WriteConsoleA. Just use the full out ANSI or Unicode version of WriteConsole and it should be fine.


_print(FileType,buffer,length) = \
   cmp d[FileType],FILE_TYPE_CHAR \
   jmp > \
   invoke WriteConsoleA,[print_handle],buffer,length,addr _CharsWritten,NULL \
   : \
  #ifdef UNICODE  \
     invoke WideCharToMultiByte,CP_ACP,WC_SEPCHARS,buffer,length,addr _Converted$,2048,NULL,NULL \
     invoke WriteFile,[print_handle],addr _Converted$,eax,addr _CharsWritten,NULL \
  #else \
     invoke WriteFile,[print_handle],buffer,length,addr _CharsWritten,NULL \
  #endif
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

bushpilot