News:

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

Auto increment string

Started by korte, April 19, 2007, 01:15:09 PM

Previous topic - Next topic

korte


I want define 4 charecter string with macro (automatic increment).
The string character letter and/or number but valid dos file name.

sample: (calling macro 3 times)

file_1:
testmac
file_2:
testmac
file_3:
testmac


Want output:
file_1:
db "0001",0
file_2:
db "0002",0
file_3:
db "0003",0

or any non special character
dd "AAAA"
dd "AAAB"
dd "AAAC"

step 1 not condition. Any unique string possible.





korte

Possible define textequ from $?

Jimg

this seems to work-

testmac macro
ifndef dddd
  dddd=0
endif
dddd=dddd+1
arg catstr <">,%dddd,<">
db arg
EndM
tstproc proc
jmp tstret

file_1:
testmac
file_2:
testmac
file_3:
testmac

tstret:
   ret
tstproc endp   

korte

thx

Nice work. :clap:


FontDef macro
local fname
ifndef dddd
                    dddd=0
endif
dddd=dddd+1

arg catstr <">,%dddd,<">
fname:
db  6-@SizeStr(<arg>) dup ("0")
db arg
db ".BMF",0
EndM



Jimg

if you want leading zeros-

FontDef macro
ifndef dddd
  dddd=1000000
endif
dddd=dddd+1
arg catstr <">,@SubStr(%dddd,2),<.BMF">
db arg
EndM

I'm not sure why you defined a local fname other than for documentation?

korte

this is not totaly code my macro.
deleting non relevant code, but fname perchance not delete....


But Next macro problem:




LOGFONT STRUCT
  lfHeight          DWORD      ?
  lfWidth           DWORD      ?
  lfEscapement      DWORD      ?
  lfOrientation     DWORD      ?
  lfWeight          DWORD      ?
  lfItalic          BYTE      ?
  lfUnderline       BYTE      ?
  lfStrikeOut       BYTE      ?
  lfCharSet         BYTE      ?
  lfOutPrecision    BYTE      ?
  lfClipPrecision   BYTE      ?
  lfQuality         BYTE      ?
  lfPitchAndFamily  BYTE      ?
  lfFaceName        32 dup(0)
LOGFONT ENDS

FontDef macro p1,p2,p3,p4
ifndef dddd
  dddd=0
endif
dddd=dddd+1

arg catstr <">,%dddd,<">

p1 label byte
db  6-@SizeStr(<arg>) dup ("0")
db arg
db ".BMF",0
dd p3 ; character group

LOGFONT {p4,FW_NORMAL,0,0,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,VARIABLE_PITCH,FF_SWISS,p2}

Endm

FontProp macro p1,p2
local _prop
org $-sizeof(LOGFONT)
_prop:
org  $+LOGFONT.lf&p1

IF TYPE (LOGFONT.lf&p1)=1
db p2
ELSE
dd p2
ENDIF

org _prop +sizeof(LOGFONT)
endm


    DefineFont "Arial",12
       FontProp Italic,1
       FontProp Width 12



error this line
   IF TYPE (LOGFONT.lf&p1)=1

idea: define font by default data and size
and next lines define special parameter

DefineFont "Arial",12
    FontProp Italic,1
    FontProp Width 12

Problem: how to determinate stuct tag type (byte or dword)

korte

work

if      (type LOGFONT.lf&p1) eq 1


special thanks