DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

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

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T i

⟦175c05283⟧ TextFile

    Length: 3891 (0xf33)
    Types: TextFile
    Names: »iinit.c«

Derivation

└─⟦a05ed705a⟧ Bits:30007078 DKUUG GNU 2/12/89
    └─⟦ff23ba0e6⟧ »./ghostscript-1.3.tar.Z« 
        └─⟦a24a58cd3⟧ 
            └─⟦this⟧ »iinit.c« 

TextFile

/* Copyright (C) 1989 Aladdin Enterprises.  All rights reserved.
   Distributed by Free Software Foundation, Inc.

This file is part of Ghostscript.

Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing.  Refer
to the Ghostscript General Public License for full details.

Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License.  A copy of this license is supposed to have been
given to you along with Ghostscript so you can know your rights and
responsibilities.  It should be in a file named COPYING.  Among other
things, the copyright notice and this notice must be preserved on all
copies.  */

/* iinit.c */
/* Initialize internally known objects for GhostScript interpreter */
#include <stdio.h>			/* for stream.h */
#include "ghost.h"
#include "dict.h"
#include "oper.h"
#include "store.h"

/* Implementation parameters */
#define systemdict_size 300

/* Standard objects */
ref true, false, mark, null;
/* Standard dictionaries */
ref name_errordict;
extern ref dstack[];
#define systemdict (dstack[0])
/* Error names */
ref name_ErrorNames;
/* Font-related objects */
ref name_FontDirectory;
/* Names of system-known keys in font dictionaries */
ref name_FontMatrix;
ref name_FontType;
ref name_FontBBox;
ref name_Encoding;
ref name_BuildChar;
ref name_FID;

/* Enter a name and value into systemdict */
void
initial_enter_name(char *nstr, ref *pref)
{	ref nref;
	name_enter(nstr, &nref);
	if ( dict_put(&systemdict, &nref, pref) )
		printf("dict_put failed"), exit(1);
}

/* Enter an operator into systemdict. */
/* The first character of the name is a digit */
/* giving the minimum acceptable number of operands. */
void
initial_enter_op(char *nstr, op_proc *proc)
{	ref oper;
	make_tasv(&oper, t_operator, a_executable, *nstr - '0', opproc, proc);
	interp_fix_op(&oper);		/* optimize if possible */
	initial_enter_name(nstr + 1, &oper);
}

/* Initialize objects other than operators */
void
obj_init()
{
	/* Initialize the standard objects */
	make_tv(&true, t_boolean, index, 1);
	make_tv(&false, t_boolean, index, 0);
	make_tv(&mark, t_mark, intval, 0);
	make_tv(&null, t_null, intval, 0);

	/* Create the system dictionary */
	dict_create(systemdict_size, &systemdict);
	dstack[1] = dstack[0];		/* just during initialization */

	/* Initialize the predefined names other than operators */
	initial_enter_name("mark", &mark);
	initial_enter_name("null", &null);

	/* Create the names of the standard elements of */
	/* a font dictionary. */
	name_enter("FontMatrix", &name_FontMatrix);
	name_enter("FontType", &name_FontType);
	name_enter("FontBBox", &name_FontBBox);
	name_enter("Encoding", &name_Encoding);
	name_enter("BuildChar", &name_BuildChar);
	name_enter("FID", &name_FID);

	/* Create other system-known names */
	name_enter("FontDirectory", &name_FontDirectory);
	name_enter("errordict", &name_errordict);
	name_enter("ErrorNames", &name_ErrorNames);
}

/* Initialize the operators */
void
op_init()
{	zarith_op_init();
	zarray_op_init();
	zcontrol_op_init();
	zdict_op_init();
	zfile_op_init();
	zgeneric_op_init();
	zmath_op_init();
	zmisc_op_init();
	zrelbit_op_init();
	zstack_op_init();
	zstring_op_init();
	ztype_op_init();
	zvmem_op_init();
	zdevice_op_init();
	zgstate_op_init();
	zht_op_init();
	zmatrix_op_init();
	zpaint_op_init();
	zpath_op_init();
	zpath2_op_init();
	zchar_op_init();
	zcolor_op_init();
	zfont_op_init();
}
/* This routine is called by the individual zxxx_op_init routines. */
void
z_op_init(op_def *op_table)
{	op_def *def = op_table;
	while ( def->name )
		initial_enter_op(def->name, def->proc),
		def++;
}