|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U h
Length: 6981 (0x1b45)
Types: TextFile
Notes: UNIX file
Names: »hellom.c«
└─⟦a85bd4a7c⟧ Bits:30004636/disk2.imd INTERACTIVE Motif Environment Development System
└─⟦a85bd4a7c⟧ UNIX Filesystem
└─⟦this⟧ »xt/new/usr/lib/X11/examples/hellomotif/hellom.c«
#ifdef REV_INFO
#ifndef lint
static char SCCSID[] = "OSF/Motif: @(#)hellom.c 1.1 - 89/08/30 - 11:46:50";
#endif /* lint */
#endif /* REV_INFO */
/******************************************************************************
*******************************************************************************
*
* (c) Copyright 1989, OPEN SOFTWARE FOUNDATION, INC.
* (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
* ALL RIGHTS RESERVED
*
* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
* NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY OPEN SOFTWARE
* FOUNDATION, INC. OR ITS THIRD PARTY SUPPLIERS
*
* OPEN SOFTWARE FOUNDATION, INC. AND ITS THIRD PARTY SUPPLIERS,
* ASSUME NO RESPONSIBILITY FOR THE USE OR INABILITY TO USE ANY OF ITS
* SOFTWARE . OSF SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
* KIND, AND OSF EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES, INCLUDING
* BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE.
*
* Notice: Notwithstanding any other lease or license that may pertain to,
* or accompany the delivery of, this computer software, the rights of the
* Government regarding its use, reproduction and disclosure are as set
* forth in Section 52.227-19 of the FARS Computer Software-Restricted
* Rights clause.
*
* (c) Copyright 1989, Open Software Foundation, Inc. Unpublished - all
* rights reserved under the Copyright laws of the United States.
*
* RESTRICTED RIGHTS NOTICE: Use, duplication, or disclosure by the
* Government is subject to the restrictions as set forth in subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
* at DFARS 52.227-7013.
*
* Open Software Foundation, Inc.
* 11 Cambridge Center
* Cambridge, MA 02142
* (617)621-8700
*
* RESTRICTED RIGHTS LEGEND: This computer software is submitted with
* "restricted rights." Use, duplication or disclosure is subject to the
* restrictions as set forth in NASA FAR SUP 18-52.227-79 (April 1985)
* "Commercial Computer Software- Restricted Rights (April 1985)." Open
* Software Foundation, Inc., 11 Cambridge Center, Cambridge, MA 02142. If
* the contract contains the Clause at 18-52.227-74 "Rights in Data General"
* then the "Alternate III" clause applies.
*
* (c) Copyright 1989, Open Software Foundation, Inc.
* ALL RIGHTS RESERVED
*
*
* Open Software Foundation is a trademark of The Open Software Foundation, Inc.
* OSF is a trademark of Open Software Foundation, Inc.
* OSF/Motif is a trademark of Open Software Foundation, Inc.
* Motif is a trademark of Open Software Foundation, Inc.
* DEC is a registered trademark of Digital Equipment Corporation
* DIGITAL is a registered trademark of Digital Equipment Corporation
* X Window System is a trademark of the Massachusetts Institute of Technology
*
*******************************************************************************
******************************************************************************/
#include <stdio.h>
#include <Mrm/MrmAppl.h> /* Motif Toolkit */
static MrmHierarchy s_MrmHierarchy; /* MRM database hierarch id */
static char *vec[]={"hellomotif.uid"};
/* MRM database file list */
static MrmCode class ;
static void helloworld_button_activate();
static MrmCount regnum = 1 ;
static MRMRegisterArg regvec[] = {
{"helloworld_button_activate",(caddr_t)helloworld_button_activate}
};
/*
* Main program
*/
int main(argc, argv)
int argc;
char **argv;
{
/*
* Declare the variables to contain the two widget ids
*/
Widget toplevel, helloworldmain;
Arg arglist[1] ;
/*
* Initialize the MRM
*/
printf("Calling MrmInitialize\n");
MrmInitialize ();
printf("Returned MrmInitialize\n");
printf("Calling XtInitialize\n");
/*
* Initialize the toolkit. This call returns the id of the "toplevel"
* widget. The applications "main" widget must be the only child
* of this widget.
*/
toplevel = XtInitialize(
"Hi", /* application name */
"helloworldclass", /* application class */
NULL, 0, /* options */
&argc, argv); /* command line parameters */
printf("Returned from XtInitialize\n");
printf("Calling XtSetArg and XtSetValues\n");
XtSetArg (arglist[0], XtNallowShellResize, TRUE) ;
XtSetValues (toplevel, arglist, 1) ;
printf("Returned from XtSetArg and XtSetValues\n");
/*
* Define the Mrm.hierarchy (only 1 file)
*/
printf("Calling MrmOpenHierarchy\n");
if (MrmOpenHierarchy (1, /* number of files */
vec, /* files */
NULL, /* os_ext_list (null) */
&s_MrmHierarchy) /* ptr to returned id */
!= MrmSUCCESS) {
printf ("can't open hierarchy\n");
}
printf("Returned from MrmOpenHierarchy\n");
/*
* Register our callback routines so that the resource manager can
* resolve them at widget-creation time.
*/
printf("Calling MrmRegisterNames\n");
if (MrmRegisterNames (regvec, regnum)
!= MrmSUCCESS)
printf("can't register names\n");
printf("Returned from MrmRegisterNames\n");
/*
* Call MRM to fetch and create the pushbutton and its container
*/
printf("Calling MrmFetchWidget\n");
if (MrmFetchWidget (s_MrmHierarchy,
"helloworld_main",
toplevel,
&helloworldmain,
&class)
!= MrmSUCCESS)
printf("can't fetch interface\n");
printf("Returned from MrmFetchWidget\n");
/*
* Make the toplevel widget "manage" the main window (or whatever the
* the uil defines as the topmost widget). This will
* cause it to be "realized" when the toplevel widget is "realized"
*/
printf("Calling XtManageChild\n");
XtManageChild(helloworldmain);
printf("Returned from XtManageChild\n");
/*
* Realize the toplevel widget. This will cause the entire "managed"
* widget hierarchy to be displayed
*/
printf("Calling XtRealizeWidget\n");
XtRealizeWidget(toplevel);
printf("Returned from XtRealizeWidget\n");
/*
* Loop and process events
*/
printf("Calling XtMainLoop\n");
XtMainLoop();
/* UNREACHABLE */
return (0);
}
static void helloworld_button_activate( widget, tag, callback_data )
Widget widget;
char *tag;
XmAnyCallbackStruct *callback_data;
{
Arg arglist[2];
static int call_count = 0;
printf("In hello_world_button_activate\n");
call_count += 1 ;
switch ( call_count )
{
case 1:
XtSetArg( arglist[0], XmNlabelString,
XmStringLtoRCreate("Goodbye\nWorld!",""));
XtSetArg( arglist[1], XmNx, 11 );
XtSetValues( widget, arglist, 2 );
break ;
case 2:
exit(1);
break ;
}
}