Author Topic: MAKELANGID macro error ?  (Read 6146 times)

guga

  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
MAKELANGID macro error ?
« on: July 17, 2012, 12:04:50 PM »
I´m mine version of VS2010, i have the following macros:
Code: [Select]
#define MAKELANGID(p, s)       ((((WORD  )(s)) << 10) | (WORD  )(p))
#define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
#define SUBLANGID(lgid)        ((WORD  )(lgid) >> 10)

But, in fact. It seems to me wrong....shouldn´t they be this ?
Code: [Select]
#define MAKELANGID(p, s)       ((((WORD  )(s)) << 0x10) | (WORD  )(p))
#define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
#define SUBLANGID(lgid)        ((WORD  )(lgid) >> 0x10)

Or am i missing something i the C Syntax ?

Btw: How is the syntax for such macro for masm ?

Best Regards,

guga
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MAKELANGID macro error ?
« Reply #1 on: July 17, 2012, 12:19:47 PM »
guga,

You usually just plonk the right number in its place. The C macro is to get around the type checking in C.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

guga

  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
Re: MAKELANGID macro error ?
« Reply #2 on: July 17, 2012, 12:34:14 PM »
Hi steve....

Didn´t followed it...What "plonk" means ?

"The C macro is to get around the type checking in C."
Ok....but in C, the value 10 is in hexadecimal notation ? I thought in C what was in hex was followed by "0x" only

Not sure if i understood, because if 10 is really (ten), then the macro seems to produce a wrong result. But if "10" means "sixteen" (hex converted from 0x10) then it works ok, right ? Or i´m still missing something on the syntax ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MAKELANGID macro error ?
« Reply #3 on: July 17, 2012, 12:41:54 PM »
guga,

Depends what you are doing with it, I answered the question for using an assembler where you simply place (PLONK) the number where you need it. You know how to use either HEX or DECIMAL notation, just place the value you need in the right place when using an assembler. If you are writing this code in C, use the C macro format as it gets around the C type checking.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

guga

  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
Re: MAKELANGID macro error ?
« Reply #4 on: July 17, 2012, 12:51:18 PM »
Hmm...many tks...I think i got it now.

This was somewhat strange for me, since it was producing wrong results (The C macro, i mean). For example, if i wanted to use such a macro in InitMUILanguage function. (or others that uses LANGID data type)

I found this macro because i´m trying to build a h2inc for RosAsm (and probably will be able to export masm syntax too) to make easier build newer equates/structures/guid/functions sets. I know we have at least 2 great tools for such thing in masm, but for rosasm it is lacking such tool. So, if i succeed to make it works correctly, it will build a sort of database that can be used to port either to rosasm or masm or others assemblers as well.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: MAKELANGID macro error ?
« Reply #5 on: July 17, 2012, 08:51:27 PM »
the primary language ID is 10 bits wide - the sublanguage ID is 6 bits wide   :P
i think what Hutch means by "plonk" is - we generally use word values that are already put together
Code: [Select]
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 0x4E4
  END
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318691%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx

over here, "plonk" is the sound my fishing tackle makes when it hits the water
you know how those Aussie guys are a little different
it comes from being upside down all day     :biggrin:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MAKELANGID macro error ?
« Reply #6 on: July 18, 2012, 08:32:36 AM »
 :biggrin:

Now I know you don't speak English, "plonk" is a sound when you place something in a carefree manner at a location. You fishing tackle hitting the water probably qualifies.  :P
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: MAKELANGID macro error ?
« Reply #7 on: July 18, 2012, 11:08:09 PM »
 :lol:

i must be thinking of "plunk"   :biggrin:

brethren

  • Guest
Re: MAKELANGID macro error ?
« Reply #8 on: July 20, 2012, 07:59:49 AM »
:biggrin:

Now I know you don't speak English, "plonk" is a sound when you place something in a carefree manner at a location. You fishing tackle hitting the water probably qualifies.  :P

talking about the english language heres a derived term
plonker :badgrin:
1.(UK, slang, mildly pejorative) A fool
2.(UK, slang, dated) A man who sanctions sexual relationships between his girlfriend and his male friends.

btw ignore me, i'm drunk on cheap plonk :biggrin:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MAKELANGID macro error ?
« Reply #9 on: July 20, 2012, 08:53:52 AM »
Ah, the quality of your code drops with cheap plonk. I have just added another bottle of an old favourite, a beautifully dry Speyside pure malt distilled by Rothes distillery called Glen Grant. Not the most expensive but the hallmark of a very good pure malt, ugly bottle, stick on labels, very light colour and dryer than vinegar. I would rather pay for the booze than the bottle.  :P
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: MAKELANGID macro error ?
« Reply #10 on: July 20, 2012, 12:16:24 PM »
the word Z uses from time to time is "wanker" - lol
similar slang terms are "Happy Larry" or "Happy Wally"
depending on what part of England you are from
those 2 crack me up 

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: MAKELANGID macro error ?
« Reply #11 on: July 20, 2012, 03:38:02 PM »
Usually "wanker" refers to a person who gives the appearance of suffering from manual self delusion, a "Wally" is basically UK slang that has a similar usage to the term "Yobbo" here in OZ, someone who is dumb, clumsy or acts in bad taste among many other maladies. Then there is the "jerk", occasional loan words like "malaka" (a reference to a lack of masculinity) and a whole host of OZ idiom that is too robust for international consumption.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: MAKELANGID macro error ?
« Reply #12 on: July 20, 2012, 10:37:44 PM »
wanker, happy larry, happy wally
my interpretation is they all mean about the same thing - lol
a guy with onanistic habits   :P

npnw

  • Member
  • **
  • Posts: 151
Re: MAKELANGID macro error ?
« Reply #13 on: July 31, 2012, 01:24:51 PM »
BS What flows in this forum !  :biggrin: