Re: Addendum to prior post (newbie crosspost)

From: Mathew Earle Reuther (
Date: 06/25/02

> the reason you get the error for flag and not obj is in how the macro is
> set up to be called.
> GET_OBJ_PERM(obj) needs to be GET_OBJ_PERM(obj, flag) for it to work

uhm, ok?

> this also is not right unless the bitvector is an array which it
> probably is not and from your other post you specified you were calling
> the macro like this "GET_OBJ_PERM(obj+i) = t[9];". If for your original
> post your macro was: GET_OBJ_PERM(obj) ((obj)->obj_flags.bitvector) this
> should be correct though i'd would make sure that the perm obj affects
> variable was named bitvector but also lets go with Viper's addition
> about 128 bit then the macro should be GET_OBJ_PERM(obj, flag)
> (IS_SET_AR((obj)->obj_flags.bitvector, flag)).
> this is only suitable for checking wether a flag is set and should and
> should probably be renamed OBJ_PERM(obj, flag).... For assignment there
> are two ways to go, direct access to the variable(not necessarily good)
> and change the macro to  GET_OBJ_PERM(obj) macro listed above. The
> second method means you have access to the variable and you can assign
> away IF it's not an array otherwise this would be the proper way to use
> it:
> GET_OBJ_PERM(obj+1)[0] = t[9]; This will assign t[9] to position 0 of
> the array which if your file does not have all 4 integers for 128bit
> then would suffice assuming you had cleared the array to all 0s.

Ok, you said things about if x is an array blah blah blah.  Suffice it to
say that my c knowledge is inadequate for this task.  However I'm the only
person I've got who wants to spend time working on my ideas, so I'm stuck.
My problem is I have no idea what you mean when you say "it's right if
it's an array" . . . well, unless I can figure out WHAT an array looks
like, and what specific thing is supposed to be an array, this helps me
not at all.

The thing which confuses me is that I would expect OLC/128bits to be
fairly common modifications.  Yet digging in the archives has shown me
nobody asking questions about the kinds of things I have been running into

> Anyways i hope this helps you understand the use of macros in C better

No, confuses me even more, actually.  I'm trying to figure out what I am
actually supposed to do now.  And on top of that, I moved from one
codebase I was working on to another.  (I decided to apply 128bit after
OLC and see what happened . . . and I've got a massively different set of
errors now.)

My current GET_OBJ_PERM in utils.h:

#define GET_OBJ_PERM(obj)       ((obj, flag)->obj_flags.bitvector[(i)])

My current reference to object flags in db.c:

  /* Object flags checked in check_object(). */
  GET_OBJ_TYPE(obj_proto + i) = t[0];
  GET_OBJ_EXTRA(obj_proto + i)[0] = asciiflag_conv(f1);
  GET_OBJ_EXTRA(obj_proto + i)[1] = asciiflag_conv(f2);
  GET_OBJ_EXTRA(obj_proto + i)[2] = asciiflag_conv(f3);
  GET_OBJ_EXTRA(obj_proto + i)[3] = asciiflag_conv(f4);
  GET_OBJ_WEAR(obj_proto + i)[0] = asciiflag_conv(f5);
  GET_OBJ_WEAR(obj_proto + i)[1] = asciiflag_conv(f6);
  GET_OBJ_WEAR(obj_proto + i)[2] = asciiflag_conv(f7);
  GET_OBJ_WEAR(obj_proto + i)[3] = asciiflag_conv(f8);
  GET_OBJ_PERM(obj_proto + i) = t[9];

I am trying to understand what you're saying.  It sounds like you are
saying the macro was originally correct . . . yet it failed to compile in
the form:
#define GET_OBJ_PERM(obj)       ((obj)->obj_flags.bitvector)

If the macro WAS correct, why would it fail to compile?  Was there some
sort of an issue with the way I was using GET_OBJ_PERM in the above object
flagging routine?  If so, what format would I want to use?

And if it wasn't correct, what is?

Sorry for all the (probably) very stupid questions, but I just don't get
it yet.

> Ron
> --
>    +---------------------------------------------------------------+
>    | FAQ: |
>    | Archives: |
>    | Newbie List:   |
>    +---------------------------------------------------------------+

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT