DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ C T c

⟦6081b1662⟧ TextFile

    Length: 8995 (0x2323)
    Types: TextFile
    Names: »C0_INIT_C«, »c0_init.c«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 
└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦f2882457c⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦f2882457c⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦f2882457c⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦f2882457c⟧ 
            └─ ⟦this⟧ »C/c0_init.c« 

TextFile

static char rcsid_c0_init_c[] = "$Id: c0_init.c,v 1.8 91/04/12 15:07:42 ed Exp $";

/******************************************************************************
*******************************************************************************
*
*  (c) Copyright 1990, Non Standard Logics S.A.
*  ALL RIGHTS RESERVED
*  
*  	THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED
*  AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND
*  WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR
*  ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
*  AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE
*  SOFTWARE IS HEREBY TRANSFERRED.
*  
*  	THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
*  NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY 
*  Non Standard Logics S.A. OR ITS THIRD PARTY SUPPLIERS.
*  
*  	Non Standard Logics S.A. AND ITS THIRD PARTY SUPPLIERS,
*  ASSUME NO RESPONSIBILITY FOR THE USE OR INABILITY TO USE ANY OF ITS
*  SOFTWARE .   Non Standard Logics S.A 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.
*  
*  (c) Copyright 1990, Non Standard Logics S.A.  Unpublished - all
*  rights reserved under the Copyright laws of France
*  
*  Non Standard Logics S.A.
*  57-59 rue Lhomond,
*  75005 Paris.
*  France.
*  
* XFaceMaker is a registered trademark of Non Standard Logics S.A.
*
*******************************************************************************
******************************************************************************/

#include <stdio.h>

#include <X11/IntrinsicP.h>
#include <X11/Shell.h>
#include <Xm/XmP.h>
#include <Xm/Label.h>

#undef XtDisplay
#undef XtScreen
#undef XtWindow
#undef XtClass
#undef XtSuperClass
#undef XtIsManaged
#undef XtIsRealized
#undef XtIsSensitive

static Widget toplevel = 0;
static char AppName[256];

FmLoadFileDataBase(w, file)
Widget w;
char *file;
{
	XrmDatabase fdb;
	XrmDatabase db = XtDatabase(XtDisplay(w));
	
	fdb = XrmGetFileDatabase(file);
	if(fdb == 0){
		fprintf (stderr, "no such database file %s\n", file);
		return;
	}
	XrmMergeDatabases(fdb, &db);
	
}

/* Imprime dans 'str' le path absolu du Widget 'w'.
 * Retourne la fin de la chaine.
 */
static char *PutPath(str, w)
char *str;
Widget w;
{
	Widget parent;
	
	if(!w)
		return(str);
	
	if(parent = XtParent(w))
		str = PutPath(str, parent);

	strcpy(str, XrmQuarkToString(w->core.xrm_name));
	str += strlen(str);
	*str++ = '.';
	
	return(str);
}

FmLoadStringDataBase(w, str, name
#ifdef STANDC
                                 , db
#endif
				     )
Widget w;
char *str[];
char *name;
#ifdef STANDC
XrmDatabase db;
#endif
{
	XrmDatabase fdb;
#ifndef STANDC
	XrmDatabase db;
#endif
	char *p;
	int length = 0;
	char *database_string, *dp;
	char path[1024];
	char *pp;
	int pathlen;
	int i;

#ifndef STANDC
	db = XtDatabase(XtDisplay(toplevel));
#endif
		
	/* D'abord, on calcule le path absolu du Widget de toplevel.
	 * Son parent est 'w', et son nom est 'name'.
	 *
	 * Si 'w' est nul, alors c'est un application shell, et son
	 * nom est celui de l'application (enregistre' dans AppName
	 * par FmInitialize).
	 *
	 * Si le nom est nul, on met '*' a` la place.
	 */
	if (w) {
		pp = PutPath(path, w);
		if(name){
			strcpy(pp, name);
			pp += strlen(name);
			*pp++ = '.';
		} else {
			*pp++ = '*';
		}
	} else {
		if(AppName[0])
			strcpy(path, AppName);
		else if(name)
			strcpy(path, name);
		else
			strcpy(path, "*");
		pp = path + strlen(path);
		*pp++ = '.';
	}
	*pp = '\0';
	pathlen = pp - path;
	
	/*
	 * D'abord, on calcule la longueur totale de la string.
	 */
	for (i = 0; p = str[i]; i ++) {
		/*          path <resource:val> \n	 */
		length += pathlen + strlen(p) + 1;
	}
	
	/*
	 * Ensuite, on fabrique la nouvelle.
	 */
	
	if(length == 0)
		return;
	
	database_string = XtMalloc(length + 1);
	dp = database_string;
	
	for (i = 0; p = str[i]; i ++)	{
		
		strncpy(dp, path, pathlen);
		dp += pathlen;
		
		strcpy(dp, p);
		dp += strlen(p);
		
		*dp++ = '\n';
	}

	*dp = 0;

	if(*database_string){
#ifdef DEBUG
printf("***database_string:***\n%s\n", database_string);
#endif
		fdb = XrmGetStringDatabase(database_string);
		if(fdb == 0){
			fprintf (stderr, "Error Loading string database\n");
			return;
		} 
		XrmMergeDatabases(fdb, &db);
	}
	
	XtFree(database_string);
}

#ifdef CONVERTTOPOINTER
static void XmCvtStringToPointer (args, num_args, from_val, to_val)
XrmValuePtr args;
Cardinal * num_args;
XrmValue * from_val;
XrmValue * to_val;
{
	static char *s = 0;
	
	if(from_val -> addr) {
		s = XtMalloc(strlen(from_val -> addr) + 1);
		strcpy(s, from_val -> addr);
	} 
	to_val->addr = (caddr_t) &s;
   	to_val->size = sizeof(caddr_t);
}
#endif

/*ARGSUSED*/
static void CvtStringToXmString (args, num_args, from_val, to_val)
XrmValuePtr args;
Cardinal * num_args;
XrmValue * from_val;
XrmValue * to_val;

{
   char  *s;
   static XmString i;

   if (from_val->addr == NULL)
      return;

   to_val->addr = (caddr_t) &i;
   to_val->size = sizeof(caddr_t);

   s = from_val->addr;

   i = XmStringCreateLtoR (s, XmSTRING_DEFAULT_CHARSET);

   if (i == NULL)
   {
      to_val->addr = NULL;
      to_val->size = 0;
      XtStringConversionWarning ((char *)from_val->addr, XmRXmString);
   }
}

extern void XmCvtStringToUnitType();

#ifdef EXTRA_QUARKS
XrmQuark XtQPixmap;
XrmQuark XtQWindow;
XrmQuark XtQColor;
XrmQuark XtQCursor;
XrmQuark XtQDisplay;
XrmQuark XtQFile;
XrmQuark XtQFont;
XrmQuark XtQFontStruct;
XrmQuark XtQPixel;
XrmQuark XtQPointer;
XrmQuark XtQUnsignedChar;
#endif

Widget FmInitialize(name, class, options, num_options, argc, argv)
String name, class;
XrmOptionDescRec *options;
Cardinal num_options;
int *argc;
char **argv;
{
	char *slash;
	
#ifdef EXTRA_QUARKS
	XtQWindow = XrmStringToQuark("Window");
	XtQColor = XrmStringToQuark("Color");
	XtQCursor = XrmStringToQuark("Cursor");
	XtQDisplay = XrmStringToQuark("Display");
	XtQFile = XrmStringToQuark("File");
	XtQFont = XrmStringToQuark("Font");
	XtQFontStruct = XrmStringToQuark("FontStruct");
	XtQPixel = XrmStringToQuark("Pixel");
	XtQPointer = XrmStringToQuark("Pointer");
	XtQUnsignedChar = XrmStringToQuark("UnsignedChar");
#endif
	if(toplevel)
		return(toplevel);
	
	toplevel = XtInitialize(name, class, options, num_options, argc, argv);
	
	/* Enregistrer le nom de l'appli
	 * (c'est le dernier composant de argv[0]).
	 */
	slash = rindex(argv[0], '/');
	if(slash)
		slash++;
	else
		slash = argv[0];
	strcpy(AppName, slash);
	
	/* Xm converters are normally registered automatically
	 * in Manager or Primitive class initialisation.
	 * We must register them here, so that our own converters
	 * will override them.
	 */
	XmRegisterConverters();
	XtAddConverter (XmRString, XmRXmString, CvtStringToXmString, NULL, 0);
	XtAddConverter (XmRString, XmRUnitType, XmCvtStringToUnitType, NULL, 0);
#ifdef CONVERTTOPOINTER
	XtAddConverter (XmRString, XmRPointer, XmCvtStringToPointer, NULL, 0);
#endif
	FaceInit();
	
	return(toplevel);
}

static char *default_argv[] = {
	"xfm2", 0
};
static int default_argc = 1;

Widget FmToplevel()
{
	if(!toplevel)
		toplevel = FmInitialize("xfm2", "Xfm2", NULL, 0, &default_argc, default_argv);
	return(toplevel);
}

Widget FmAppShell(w)
Widget w;
{
	Widget parent;
	
	while(parent = XtParent(w))
		w = parent;
	
	if(w != toplevel && w->core.widget_class == applicationShellWidgetClass)
		return(w);
	else
		return(0);
}

void FmSetHints(shell, x, y, width, height)
Widget shell;
int x, y, width, height;
{
	XSizeHints hints;
	
	hints.flags = 0;
	if(x > 0 || y > 0){
		hints.x = x;
		hints.y = y;
		hints.flags |= USPosition;
	} else {
		x = shell->core.x;
		y = shell->core.y;
	}
	if(width > 0 && height > 0){
		hints.width = width;
		hints.height = height;
		hints.flags |= USSize;
	} else {
		width = shell->core.width;
		height = shell->core.height;
	}
	if(hints.flags && XtWindow(shell))
		XSetNormalHints (XtDisplay(shell), XtWindow(shell), &hints);	
	if(width > 0 && height > 0)
		XtConfigureWidget(shell, x, y, width, height, shell->core.border_width);
}

Widget FmRealizeToplevel()
{
	static Widget	panel;
	XSizeHints      hints;
	Display *dpy;
	Widget toplevel;
	
	toplevel = FmToplevel();

	if(panel)
		return(toplevel);
	
	dpy = XtDisplay(toplevel);
	panel = XtCreateManagedWidget ("XFaceMaker2 (Version 1.0.3)", xmLabelWidgetClass, toplevel , NULL, 0);
	
	XtSetMappedWhenManaged(toplevel, FALSE);
	XtRealizeWidget(toplevel);
	
	FmSetHints(panel,
		   DisplayWidth(dpy, DefaultScreen(dpy)) - panel -> core.width, 0,
		   panel -> core.width,
		   panel -> core.height);
	
	XtMapWidget(toplevel);
	
	return(toplevel);
}

void FmLoop()
{
	XtMainLoop();
}

int
FmMustSkip(w)
Widget w;
{
	if(XmIsMenuShell(w)
	|| ((w = XtParent(w))
	  && XmIsScrolledWindow(w)))
		return(1);
	return(0);
}

FmDeleteObject(w)
Widget w;
{
	XtDestroyWidget(w);
}