News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

name word as a member of a structure

Started by LordAdef, October 20, 2020, 08:29:52 AM

Previous topic - Next topic

LordAdef

Hello everyone!
So, The code below gives me no name conflict (I am on UASM):
Quote.data?
name dd ?
However, I get a syntax error when 'name' is a structure member:
QuotesomeStruct STRUCT   
   foo     dd ?   
   name dd ?
someStruct ends
I am playing around with the BASS library and there are two structures with 'name' members.I am sure this is very stupid, but 'name' is clashing with what?

Vortex

Hello,

Reading \masm32\include\windows.inc :

IMAGE_SECTION_HEADER STRUCT
    Name1 db IMAGE_SIZEOF_SHORT_NAME dup(?)
    union Misc
        PhysicalAddress dd  ?
        VirtualSize dd      ?
    ends
    VirtualAddress dd       ?
    SizeOfRawData dd        ?
    PointerToRawData dd     ?
    PointerToRelocations dd ?
    PointerToLinenumbers dd ?
    NumberOfRelocations dw  ?
    NumberOfLinenumbers dw  ?
    Characteristics dd      ?
IMAGE_SECTION_HEADER ENDS

IMAGE_SYMBOL STRUCT
    union N
        ShortName db 8 dup(?)
        struct Name1
            Short1 dd       ?
            Long1 dd        ?
        ends
        LongName dd 2 dup(?)
    ends
    Value dd                ?
    SectionNumber dw        ?
    Type1 dw                ?
    StorageClass db         ?
    NumberOfAuxSymbols db   ?
IMAGE_SYMBOL ENDS


Iczelion's explanation :

QuoteField Meanings Name1 Actually the name of this field is "name" but the word "name" is an MASM keyword so we have to use "Name1" instead.

HSE

Hi Alex!

You can to try AsmC, because Nidud modified reserved words to make developments compatibles with name, type, etc very usual in libraries.

Regards. HSE
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on October 20, 2020, 09:49:23 AM
You can to try AsmC, because Nidud modified reserved words to make developments compatibles with name, type, etc very usual in libraries.

Which implies that in order to use AsmC your commandline needs /Zne or /Znk - otherwise you get a bunch of meaningless error messages. Recent versions of RichMasm check for AsmC and add /Znk automatically, but if you have used e.g. OPT_DebugA /Fl to force a listing, assembly will fail unless you add manually /Znk :cool:

error A2006: undefined symbol : type

HSE

Quote from: jj2007 on October 20, 2020, 11:24:29 AM
Which implies that in order to use AsmC your commandline needs /Zne or /Znk

No. /Znk disable modifications and you have reserved word name again, instead of .name .
Apparently if you want to use libraries with name, type, etc, then you have to change your code. It's not my case.
Equations in Assembly: SmplMath

jj2007

You seem to have a lot of experience, HSE, perhaps you can help me: Why do I get these errors with AsmC if I don't put /Zne o /Znk?

tmp_file.asm(2234) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  Dim(59)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2234): Main line code
tmp_file.asm(2235) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  Dim(59)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2235): Main line code
tmp_file.asm(2290) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  tmp_file.asm(2290): Main line code
tmp_file.asm(2290) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 1: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2290): Main line code
tmp_file.asm(2290) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 2: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2290): Main line code
tmp_file.asm(2292) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  tmp_file.asm(2292): Main line code
tmp_file.asm(2292) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 1: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2292): Main line code
tmp_file.asm(2292) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 2: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2292): Main line code
tmp_file.asm(2314) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  tmp_file.asm(2314): Main line code
tmp_file.asm(2315) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  tmp_file.asm(2315): Main line code
tmp_file.asm(2317) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  Dim(59)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2317): Main line code
tmp_file.asm(2329) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Instr_(41)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2329): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(1)[tmp_file.asm]: Macro called from
  wCL$(18)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(11)[tmp_file.asm]: Macro called from
  wCL$(18)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(19)[tmp_file.asm]: Macro called from
  wCL$(18)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(21)[tmp_file.asm]: Macro called from
  wCL$(18)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
## Invalid type of eax ##
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(1)[tmp_file.asm]: Macro called from
  wCL$(70)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(11)[tmp_file.asm]: Macro called from
  wCL$(70)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(19)[tmp_file.asm]: Macro called from
  wCL$(70)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
tmp_file.asm(2338) : error A2006: undefined symbol : TYPE
m2m(21)[tmp_file.asm]: Macro called from
  wCL$(70)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2338): Main line code
## Invalid type of eax ##
tmp_file.asm(2344) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Instr_(41)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2344): Main line code
tmp_file.asm(2363) : error A2006: undefined symbol : TYPE
m2m(1)[tmp_file.asm]: Macro called from
  tmp_file.asm(2363): Main line code
tmp_file.asm(2363) : error A2006: undefined symbol : TYPE
m2m(11)[tmp_file.asm]: Macro called from
  tmp_file.asm(2363): Main line code
tmp_file.asm(2363) : error A2006: undefined symbol : TYPE
m2m(19)[tmp_file.asm]: Macro called from
  tmp_file.asm(2363): Main line code
tmp_file.asm(2363) : error A2006: undefined symbol : TYPE
m2m(21)[tmp_file.asm]: Macro called from
  tmp_file.asm(2363): Main line code
## Invalid type of tpf.tfStartWithFindCt ##
tmp_file.asm(2448) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Instr_(76)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2448): Main line code
tmp_file.asm(2449) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Instr_(41)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2449): Main line code
tmp_file.asm(2490) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Rinstr(34)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2490): Main line code
tmp_file.asm(2490) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Mid$(15)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2490): Main line code
tmp_file.asm(2490) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  Cat$(9)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2490): Main line code
tmp_file.asm(2490) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 2: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    Cat$(9)[MasmBasic.inc]: Macro called from
     tmp_file.asm(2490): Main line code
tmp_file.asm(2501) : error A2006: undefined symbol : TYPE
m2m(1)[tmp_file.asm]: Macro called from
  Exit(54)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2501): Main line code
tmp_file.asm(2501) : error A2006: undefined symbol : TYPE
m2m(11)[tmp_file.asm]: Macro called from
  Exit(54)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2501): Main line code
tmp_file.asm(2501) : error A2006: undefined symbol : TYPE
m2m(19)[tmp_file.asm]: Macro called from
  Exit(54)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2501): Main line code
tmp_file.asm(2501) : error A2006: undefined symbol : TYPE
m2m(21)[tmp_file.asm]: Macro called from
  Exit(54)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2501): Main line code
## Invalid type of edi ##
tmp_file.asm(2581) : error A2006: undefined symbol : type
movi(7)[tmp_file.asm]: Macro called from
  tmp_file.asm(2581): Main line code
tmp_file.asm(2671) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  Dim(59)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2671): Main line code
tmp_file.asm(2672) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  Dim(59)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2672): Main line code
tmp_file.asm(2676) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Instr_(76)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2676): Main line code
tmp_file.asm(2707) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  Left$(12)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2707): Main line code
tmp_file.asm(2707) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  Left$(15)[MasmBasic.inc]: Macro called from
   tmp_file.asm(2707): Main line code
tmp_file.asm(2707) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  tmp_file.asm(2707): Main line code
tmp_file.asm(2723) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  itxtFile$(119)[tmp_file.asm]: Macro called from
   tmp_file.asm(2723): Main line code
tmp_file.asm(2723) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 1: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2723): Main line code
tmp_file.asm(2724) : error A2006: undefined symbol : type
PushPlusMinus(53)[MasmBasic.inc]: Macro called from
  itxt$(119)[tmp_file.asm]: Macro called from
   tmp_file.asm(2724): Main line code
tmp_file.asm(2976) : error A2006: undefined symbol : type
Let(127)[MasmBasic.inc]: Macro called from
  tmp_file.asm(2976): Main line code
tmp_file.asm(2976) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 2: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2976): Main line code
tmp_file.asm(2976) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 3: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2976): Main line code
tmp_file.asm(2976) : error A2006: undefined symbol : type
PushString(107)[MasmBasic.inc]: Macro called from
  MacroLoop(39): iteration 4: Macro called from
   Let(226)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2976): Main line code
tmp_file.asm(2977) : error A2006: undefined symbol : type
ChkNum(98)[MasmBasic.inc]: Macro called from
  MacroLoop(120): iteration 10: Macro called from
   Str$(262)[MasmBasic.inc]: Macro called from
    tmp_file.asm(2977): Main line code
tmp_file.asm(2977) : error A2006: undefined symbol : type
tmp_file.asm(2977) : fatal error A1012: error count exceeds 100; stopping assembly
*** Assembly error ***

HSE

Quote from: HSE on October 20, 2020, 10:45:16 PM
Apparently if you want to use libraries with name, type, etc, then you have to change your code. It's not my case.
Equations in Assembly: SmplMath

jj2007

Congrats that so far you have been able to avoid type in your code, HSE :thumbsup:

include \masm32\include\masm32rt.inc ; pure Masm32, no MasmBasic required
PrintAny MACRO arg
  if type(arg) eq REAL8
invoke crt_printf, chr$("%f", 13, 10), arg
  else
invoke crt_printf, chr$("%i", 13, 10), arg
  endif
ENDM
.data
MyInt dd 123
MyR8 REAL8 123.0

.code
start: PrintAny MyInt
PrintAny MyR8
inkey "ok?"
exit
end start

tmp_file.asm(14) : error A2006: undefined symbol : type
PrintAny(1)[tmp_file.asm]: Macro called from
  tmp_file.asm(14): Main line code
tmp_file.asm(15) : error A2006: undefined symbol : type
PrintAny(1)[tmp_file.asm]: Macro called from
  tmp_file.asm(15): Main line code
*** Assembly error ***

TouEnMasm

Here a list of reserved words

lenght = alenght
low = alow
hight = ahight
size = asize
type = atype
width = awidth
c = ccc
addr = aaddr
name = aname
offset = aoffset
GROUP = agroup
fwait = afwait
type = atype
width = width1
Add = Add1
ch = ch1
end = end1
div = div1
st = st1
PROC = PROC1
Push = Push1
Pop = Pop1
Wait = Wait1
invoke = invoke1
lock = lock1
Name = Name1
HighWord = HighWord1
fs = regfs
Size = size1
offset = offset1
Segment = Segment1
Mode = Mode1
far = far1
addr = addr1
si = regsi
di = regdi
bx = regbx
ax = regax
cx = regcx
dx = regdx
length = length1
type = type1
List = List1
pascal = pascal1
far = far1
near = near1
equ = equ1
in = in1
out = OUT1
mask = imask
mm = amm1
str = str1
rcl = arcl
dr0 = iDr0
dr1 = iDr1
dr2 = iDr2
dr3 = iDr3
dr6 = iDr6
dr7 = iDr7
edi = regEdi
esi = regEsi
ebx = regEbx
edx = regEdx
ecx = regEcx
eax = regEax
ebp = regEbp
esp = regEsp
rax = regrax
rbx = regrbx
rcx = regrcx
rdx = regrdx
rsi = regrsi
rdi = regrdi
rbp = regrbp
rsp = regrsp
r8 = regr8
r9 = regr9
r10 = regr10
r11 = regr11
r12 = regr12
r13 = regr13
r14 = regr14
r15 = regr15
Irp = aIrp
Short = Short1
Group = Group1
pascal = pascal1
PASCAL = PASCAL1
CONST = CONST1
pause = pause1
Prefetch = Prefetch1
FileSystemType = FileSystemType1
Internal =aInternal


To avoid errors,there is just to add a letter and there is no more roblems.

Fa is a musical note to play with CL

jj2007

Quote from: TouEnMasm on October 21, 2020, 12:05:39 AM
Here a list of reserved words

type = atype


To avoid errors,there is just to add a letter and there is no more roblems.

Wow, could it be so simple?
  if atype(arg) eq REAL8
Oops, apparently not: Error A2102: Symbol not defined : atype

Btw lenght and hight were never reserved words. You can use them freely in your code :cool:

TouEnMasm

 JJ,in wich langage are You.You seem a little lost.
Those I have given are in use with UASM to AVOID the syntax error when used in STRUCT and others case.
Fa is a musical note to play with CL

HSE

 :biggrin:

Quote from: jj2007 on October 20, 2020, 11:09:58 PM
Congrats that so far you have been able to avoid type in your code, HSE :thumbsup:
Quote from: HSE on October 20, 2020, 10:45:16 PM
... if you want to use libraries with name, type, etc, ... It's not my case.
I use /Znk.
Equations in Assembly: SmplMath

jj2007

Yep. I find it just a little bit weird to break by default a key function of the assembler. Probably nidud never used macros :cool:

jj2007

Quote from: TouEnMasm on October 21, 2020, 01:21:52 AM
JJ,in wich langage are You.You seem a little lost.
Those I have given are in use with UASM to AVOID the syntax error when used in STRUCT and others case.


Masm and clones. I.e. not French :rolleyes:

nidud

#14
deleted