[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 |
Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit |
Moderator: | STAR::VATNE |
|
Created: | Mon Oct 30 1989 |
Last Modified: | Mon Dec 31 1990 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3726 |
Total number of notes: | 19516 |
1527.0. "Hello world problem
helloworld problem
" by LSNCSC::BLANC (Phil Lausanne-CH SSG DTN 753-2324 4-OCT-1989 16:53) Wed Oct 04 1989 12:51
HI,
here follow a program working well on DECStation ultirx v3.1 but not
on VAXstation ultrix v3.0 or v3.1 I have the error
size of shared memory: 688
shared memory region successfully created and attached to
Bus error (core dumped)
On low memory VAXstation 3100 ( 8 mbytes) I get
XIO not enough core
Can you help to diagnose ??
Thanks
Phil
/* */
/* Hello world example in the XUI toolkit manual */
/* */
#ifdef vms
#include <decw$include/X.h>
#include <decw$include/Xlib.h>
#include <decw$include/Xutil.h>
#else
#include <X11/DwtAppl.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
#include <stdio.h>
#define SHMKEY (key_t) 0x10
#define ERR ((data_and_status *) -1)
static DRMHierarchy s_DRMHierarchy;
static char *vec[]={"helloworld.uid"};
static DRMCode class;
static void helloworld_button_activate();
static DRMCount regnum=1;
static DRMRegisterArg regvec[] = {
{"helloworld_button_activate", (caddr_t)helloworld_button_activate}
};
/* static DwtCallback callback_arg[2]; */
/******* main program *********/
int main (argc,argv)
unsigned int argc;
char **argv;
{
typedef char data_and_status[688];
Widget toplevel, helloworldmain;
Arg arglist[1];
data_and_status *shared_buf;
int shmid,shared_memory_length;
DwtInitializeDRM ();
/*
create a shared memory region
*/
shared_memory_length = sizeof(data_and_status);
printf("size of shared memory: %d\n",shared_memory_length);
if ((shmid = shmget(SHMKEY,shared_memory_length,0600|IPC_CREAT)) < 0)
perror("create shared memory is bad");
if ((shared_buf = (data_and_status *) shmat(shmid,0,0)) == ERR)
perror ("attach shared memory did not work");
printf("shared memory region successfully created and attached to\n");
toplevel = XtInitialize
("Salut", "helloworldclass" ,NULL, 0, &argc, argv);
XtSetArg (arglist[0], XtNallowShellResize, TRUE);
XtSetValues (toplevel, arglist, 1);
if (DwtOpenHierarchy (1,vec,NULL,&s_DRMHierarchy) != DRMSuccess)
{
printf ("can't open hiercharchy\n");
}
DwtRegisterDRMNames (regvec, regnum);
if (DwtFetchWidget (s_DRMHierarchy, "helloworld_main_window",toplevel,
&helloworldmain, &class ) != DRMSuccess)
printf ("can't fetch interface\n");
XtManageChild(helloworldmain);
XtRealizeWidget(toplevel);
XtInstallAllAccelerators(helloworldmain,helloworldmain);
XtMainLoop();
}
/*
Callback function
*/
static void helloworld_button_activate(widget, tag, callback_data)
Widget widget;
char *tag;
DwtAnyCallbackStruct *callback_data;
{
Arg arglist[2];
DwtCompString good_bye;
DwtCompStringContext context;
char *text_return = "good bye world text";
long charset_return;
Boolean direction_r_to_l_return;
long lang_return;
long rend_return;
int return_code;
static int call_count = 0;
call_count += 1;
switch (call_count)
{
case 1:
good_bye = DwtLatin1String("Goodbye\nworld!");
XtSetArg( arglist[0], DwtNlabel,
good_bye);
XtSetArg( arglist[1], DwtNx, 11);
XtSetValues( widget, arglist, 2);
break;
case 2:
exit(1);
break;
}
}
T.R | Title | User | Personal Name | Date | Lines
|
---|