delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/14/21:48:31

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: HELP: Generic array pointer passed to function.
Date: Sat, 14 Mar 1998 21:25:11 -0500
Organization: Cornell University (http://www.cornell.edu/)
Lines: 68
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <350B3C07.575D7E62@cornell.edu>
References: <350B4789 DOT 282833FC AT wpol DOT com>
NNTP-Posting-Host: cu-dialup-1510.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John & Sue Kissell wrote:
> 
>  I need help in how to describe a generic array pointer passed to a
> function.

i don't think you ment array pointer here.

anyway, for your purposes, you might want to consider the following:
(i will have to add that this is kinda off-topic, but i thought it might
be useful. in any case, this sort of C questions would get better
answers in forums such as comp.lang.c.moderated.)

i have a feeling the code below makes a case for using C++ ;-)

/*
 * constants for different kinds of windows
 * for code that might need the information
 */

#define WT_WINDOW 0
#define WT_BUTTON 1
/* etc */

typedef struct TAG_BUTTON_DATA
{
   int    x1;
   int    y1;
   int    x2;
   int    y2;
   int    state;
   int    frame;
} BUTTON_DATA;

typedef struct TAG_WINDOW_DATA
{
 char* title;
} WINDOW_DATA;

typedef union TAG_DATA
{
  BUTTON_DATA button;
  WINDOW_DATA window;
} DATA;

typedef struct TAG_WINDOW_T
{
  int type;
  int length;
  int height;
  int x;
  int y;
  COLOR_GROUP *color;
  BITMAP *map;
  DATA d;
} WINDOW_T;
  
void paste(WINDOW_T *w, BITMAP *m)
{
  int tmp=mouseflag;
  if (tmp)
    MouseOFF();
  blit(w->map, m, 0, 0, w->x, w->y, w->length, w->height);
  if (tmp)
    MouseON();
  return;
}

  -- Sinan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019