home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume4
/
xgen
/
part03
/
hash_help.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-29
|
2KB
|
82 lines
#define MAX_NUM_WIDGETS 200
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/Intrinsic.h>
#include <X11/CompositeP.h>
#include <X11/CommandP.h>
#include <X11/LabelP.h>
#include <X11/Box.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Viewport.h>
#include <X11/Form.h>
#include <X11/Core.h>
#include <X11/VPaned.h>
#include "application.h"
extern char *string[];
static struct _widget_help widget_help[ MAX_NUM_WIDGETS ];
enter_hash_help( widget_ptr, help_msg )
Widget widget_ptr;
char *help_msg;
{
struct _widget_help *help_item;
static int i = 0;
int key;
if( i == 0)
{
for ( i =0; i<MAX_NUM_WIDGETS; i++)
{
widget_help[i].widget_ptr= NULL;
}
}
if( help_msg == NULL )
return;
key = ((long)(widget_ptr))%MAX_NUM_WIDGETS;
while( widget_help[key].widget_ptr != NULL)
key = ++key%MAX_NUM_WIDGETS;
widget_help[key].widget_ptr = widget_ptr;
/* printf(" help_msg %s\n",help_msg);
*/
widget_help[key].help_msg = (char *)malloc(
(strlen(help_msg)+1) * sizeof( char ));
strcpy(widget_help[key].help_msg , help_msg);
return;
}
char *get_hash_help(widget_ptr)
Widget widget_ptr;
{
int key;
key = ((long)widget_ptr)%MAX_NUM_WIDGETS;
/*printf(" %d key\n", key);
printf( "widget_ptr %d widget_he %d\n", widget_ptr, widget_help[key].widget_ptr);
*/
while(widget_ptr != widget_help[key].widget_ptr)
{
key++;
if( key > MAX_NUM_WIDGETS )
return(NULL);
}
/*printf("msg %s\n", widget_help[key].help_msg);
*/
return(widget_help[key].help_msg);
}