Having a problem with lvalues

From: Nicholas S. Wourms (prospero@bbs.x-net.net)
Date: 12/20/96


Alright, I have been working on a piece of code for awhile, but I have got
stuck on one macro that seems to cause a whole bunch of errors.  I have,
IMHO defined the macro correctly.  Any help rendered would be greatly
appreciated.  Thank you in advance.

The macro is:
OLC_MPROGL(d)
The define is:
#define OLC_MOBPRGL(d)  ((d)->olc->mprogl)
The struct is:
  struct mob_prog_data *mprogl;


The errors I get are:
medit.c: In function `medit_setup_new':
medit.c:139: invalid lvalue in assignment
medit.c: In function `medit_setup_existing':
medit.c:158: invalid lvalue in assignment
medit.c:159: warning: assignment makes pointer from integer without a cast
medit.c:161: invalid type argument of `->'
medit.c:162: invalid type argument of `->'
medit.c:163: invalid type argument of `->'
medit.c:165: invalid type argument of `->'
medit.c:166: invalid type argument of `->'
medit.c:169: invalid lvalue in assignment
medit.c:170: warning: assignment makes pointer from integer without a cast
medit.c: In function `medit_save_internally':
medit.c:341: warning: assignment makes pointer from integer without a cast
medit.c:343: invalid type argument of `->'
medit.c:346: invalid lvalue in assignment
medit.c: In function `medit_disp_mprog':
medit.c:637: warning: initialization makes pointer from integer without a cast
medit.c: In function `medit_parse':
medit.c:1080: warning: assignment makes pointer from integer without a cast
medit.c:1085: invalid lvalue in assignment
medit.c:1091: warning: assignment makes pointer from integer without a cast
medit.c:1112: warning: assignment makes pointer from integer without a cast
medit.c:1115: warning: comparison between pointer and integer
medit.c:1115: invalid lvalue in assignment
medit.c:1115: warning: assignment makes pointer from integer without a cast

What am I doing wrong?  What does the above mean?

Here's the corresponding lines of code:
<SNIP LINES 138-141>
  GET_CHA(mob) = 11;
  OLC_MPROGL(d) = NULL;
  OLC_MPROG(d) = NULL; 
  OLC_MOB(d) = mob;

<LINES 155-172> 
  CREATE(mob, struct char_data, 1);
  copy_mobile(mob, mob_proto + rmob_num);
  if (GET_MPROG(mob))
      CREATE(OLC_MPROGL(d), MPROG_DATA, 1);
      head = OLC_MPROGL(d);
    for (temp = GET_MPROG(mob); temp;temp = temp->next) {
      OLC_MPROGL(d)->type = temp->type;
      OLC_MPROGL(d)->arglist = str_dup(temp->arglist);
      OLC_MPROGL(d)->comlist = str_dup(temp->comlist);
      if (temp->next) {
        CREATE(OLC_MPROGL(d)->next, MPROG_DATA, 1);
        OLC_MPROGL(d) = OLC_MPROGL(d)->next;
      }
    }
  OLC_MPROGL(d) = head;
  OLC_MPROG(d) = OLC_MPROGL(d);
  OLC_MOB(d) = mob;
  medit_disp_menu(d);

<LINES 340-347>
    /* ADD this bit to the end of medit_save_internally for MOB_PROGS*/
    GET_MPROG(OLC_MOB(d)) = OLC_MPROGL(d);
    if (OLC_MPROGL(d))
      GET_MPROG_TYPE(OLC_MOB(d)) = OLC_MPROGL(d)->type;
    else
      GET_MPROG_TYPE(OLC_MOB(d)) = 0;
    OLC_MPROGL(d) = NULL;
  }

<LINES 636-637>
void medit_disp_mprog(struct descriptor_data *d) {
  struct mob_prog_data *mprog = OLC_MPROGL(d);

<LINES 1072-1118>
 case MEDIT_MPROG: {
    i=atoi(arg);
      
    if (i == 0)
      medit_disp_menu(d);
    else if (i == d->edit_number2) {
      struct mob_prog_data *temp;
      CREATE(temp, struct mob_prog_data, 1);
      temp->next = OLC_MPROGL(d);
      temp->type = -1;
      temp->arglist = NULL;
      temp->comlist = NULL;
      OLC_MPROG(d) = temp;
      OLC_MPROGL(d) = temp;
      OLC_MODE(d) = MEDIT_CHANGE_MPROG;
      medit_change_mprog (d);
    } else if (i < d->edit_number2) {
      struct mob_prog_data *temp;
      int x=1;
      for (temp = OLC_MPROGL(d);temp && x < i;temp=temp->next)
        x++;
      OLC_MPROG(d) = temp;
      OLC_MODE(d) = MEDIT_CHANGE_MPROG;
      medit_change_mprog (d);
    } else if (i == d->edit_number2+1) {
      send_to_char ("Which mob prog do you want to purge? ", d->character);
      OLC_MODE(d) = MEDIT_PURGE_MPROG;
    } else
      medit_disp_menu(d);
  }   
  return;
  case MEDIT_PURGE_MPROG: {
    struct mob_prog_data *temp;
    int x=1;
  
    i=atoi(arg);
    if (i <= 0 || i >= d->edit_number2) {
      medit_disp_mprog (d);
      return;
    }
    for (temp = OLC_MPROGL(d);temp && x < i;temp=temp->next)
      x++;
    OLC_MPROG(d) = temp;
    REMOVE_FROM_LIST(OLC_MPROG(d), OLC_MPROGL(d), next)
    free(OLC_MPROG(d)->arglist);
    free(OLC_MPROG(d)->comlist);
    free(OLC_MPROG(d));
</SNIP>
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST