ftp.nice.ch/peanuts/GeneralData/Documents/adobe/DPS.Purple.Scroll.tar.gz#/NX_Scroll/iparserhooks.m

This is iparserhooks.m in view mode; [Download] [Up]

/*
 * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
 *
 * (b)  If this Sample Code is distributed as part of the Display PostScript
 *	System Software Development Kit from Adobe Systems Incorporated,
 *	then this copy is designated as Development Software and its use is
 *	subject to the terms of the License Agreement attached to such Kit.
 *
 * (c)  If this Sample Code is distributed independently, then the following
 *	terms apply:
 *
 * (d)  This file may be freely copied and redistributed as long as:
 *	1) Parts (a), (d), (e) and (f) continue to be included in the file,
 *	2) If the file has been modified in any way, a notice of such
 *      modification is conspicuously indicated.
 *
 * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
 *	Adobe Systems Incorporated.
 * 
 * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
 *	CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
 *	AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
 *	ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
 *	OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
 *	WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
 *	WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
 *	DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
 *	FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
 *	OF THIRD PARTY RIGHTS.
 */

/*
 *	iparserhooks.m
 *
 *	Version:	2.0
 *	Author:	Ken Anderson, Ken Fromm
 *	History:
 *			03-07-91		Added this comment.
 */

#import "iinterpreter.h"
#import "iinterpreterhooks.h"
#import "Graphic.h"
#import <dpsclient/dpsclient.h>
#import <stdio.h>

extern char		yytext[];
extern int			yyleng;

void i_int()
{
	int	avalue;

	sscanf(yytext,"%d", &avalue);
	ipushint(avalue);
}

void i_real()
{
	float	 avalue;

	sscanf(yytext,"%f", &avalue);
	ipushreal(avalue);
}

/* Omit the preceding slash. */
void i_literal()
{
	ipushname(&yytext[1], yyleng-1);
}

void i_name()
{
	printf("%s\n", yytext);
}

void i_array()
{
}

/* Disregard the open and close parens. */
void i_string()
{
	ipushstring(&yytext[1], yyleng-2);		
}

void i_f()
{
	iinsertPath(FILL);
}

void i_s()
{
	iinsertPath(STROKE);
}

void i_clip()
{
	iinsertPath(CLIP);
}

void i_T()
{
	iclear();
}

void i_A()
{
	iclear();
}

void i_W()
{
	iclear();
}

void i_AW()
{
	iclear();
}

void i_m()
{
	iinsertPathOp(dps_moveto,2);
}

void i_lineto()
{
	iinsertPathOp(dps_lineto,2);
}

void i_L()
{
	int		i, index;

	ipopint(&index);
	for (i = index; i > 0; i--)
		iinsertPathOp(dps_lineto,2);
}

void i_r()
{
	iinsertPathOp(dps_rlineto,2);
}

void i_R()
{
	int		i, index;

	ipopint(&index);
	for (i = index; i > 0; i--)
		iinsertPathOp(dps_rlineto,2);
}

void i_l()
{
	iinsertPathOp(dps_moveto,2);
	iinsertPathOp(dps_lineto,2);
	iinsertPath(STROKE);
}

void i_x()
{
	ipushreal(0.0);
	iinsertPathOp(dps_rlineto,2);
}

void i_y()
{
	ipushreal(0.0);
	iroll(2,1);
	iinsertPathOp(dps_rlineto,2);
}

void i_X()
{
	iinsertPathOp(dps_moveto,2);
	ipushreal(0.0);
	iinsertPathOp(dps_rlineto,2);
	iinsertPath(STROKE);
}

void i_Y()
{
	iinsertPathOp(dps_moveto,2);
	ipushreal(0.0);
	iroll(2,1);
	iinsertPathOp(dps_rlineto,2);
	iinsertPath(STROKE);
}

void i_c()
{
	iinsertPathOp(dps_curveto,6);
}

void i_cp()
{
	iinsertPathOp(dps_closepath,0);
}

void i_w()
{
	float		avalue;
	
	ipopreal(&avalue);
	ii_setlinewidth(avalue);
}

void i_g()
{
	float		avalue;
	
	ipopreal(&avalue);
	ii_setgray(avalue);
}

void i_j()
{
	int		avalue;
	
	ipopint(&avalue);
	ii_setlinejoin(avalue);
}

void i_d()
{
	/* setdash not implemented */
	iclear();
}

void i_miter()
{
	float		avalue;
	
	ipopreal(&avalue);
	ii_setmiterlimit(avalue);
}

void i_cap()
{
	float		avalue;
	
	ipopreal(&avalue);
	ii_setlinecap(avalue);
}

void i_RGB()
{
	float		r, g, b;
	
	ipopreal(&b);
	ipopreal(&g);
	ipopreal(&r);
	ii_setrgbcolor(r, g, b);
}

void i_F()
{
	/*  setfont not implemented */
	iclear();
}

void i_MF()
{
	/*  makefont not implemented */
	iclear();
}

void i_FF()
{
	/*  setfont not implemented */
	iclear();
}

void i_DF()
{
	/*  definefont not implemented */
	iclear();
}

void i_IMASK()
{
	/*  imagemask not implemented */
	iclear();
}

void i_IMAGE()
{
	/*  image not implemented */
	iclear();
}

void i_BPAGE()
{
	ipop();
}

void i_EPAGE()
{
	int	page_num;
	
	ipopint(&page_num);
	iinsertPage(page_num);
}

void i_REMAP()
{
	iclear();
}

void i_RECODE()
{
	iclear();
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.