;Use for making strings unicode null terminated
;in .code:
;INVOKE DeleteFile, L("c:\things\hola.txt")
;in .data:
;pString DD TEXT("hola",020h,10,13)
;
;take care: ! is scape character
;so:
; for < we put !<
; for > we put !>

; for ! we put !!
;
;a better solution it's put this chars in hex:
; ! 021h
; " 022h
; ' 027h
; < 03Ch
; > 03Eh
: rest of chars between " "

L MACRO y:VARARG
LOCAL nam
.DATA
nam LABEL BYTE
FOR cad, <&y>
car1 EQU @SubStr(<&cad>,1,1)
IFIDN car1,<!">
i = 1
t EQU @SizeStr(<&cad>)-2
palabra EQU @SubStr(<&cad>,2,%t)

WHILE (i LE t)

car EQU @SubStr(%palabra,%i,1)

car1 EQU @CatStr (%car,<!">)
car2 EQU @CatStr (<!">,%car1)

BYTE car2
BYTE 0
i = i + 1

ENDM
ELSE
BYTE cad
BYTE 0
ENDIF
ENDM
BYTE 0
BYTE 0
.CODE
EXITM <OFFSET nam>
ENDM




:rolleyes:
Posted on 2002-09-05 19:33:27 by kartofen
Since Unicode characters are words:
L MACRO y:VARARG

LOCAL nam,cad,car
CONST SEGMENT
nam LABEL WORD
FOR cad, <&y>
car EQU @SubStr(<&cad>,1,1)
IFIDN car,<!">
t = @SizeStr(<&cad>)
i = 2
WHILE i LT t
car EQU @SubStr(&cad,i,1)
WORD @CatStr (<!">, %car, <!">)
i = i + 1
ENDM
ELSE
WORD cad
ENDIF
ENDM
WORD 0
CONST ENDS
EXITM <OFFSET nam>
ENDM
Also, there are a few optimizations and now we can specify word sized Unicode characters amongst the ANSI strings... :) Use like:
invoke MessageBoxW, 0, \

L("Hello,", 13, 10, "World!!", 13, 10, 0133h), \
L("Just a test:"), MB_OK
Posted on 2002-09-29 23:32:25 by bitRAKE