ftp.nice.ch/pub/next/developer/objc/dps/AdobeExamples.N.bs.tar.gz#/AdobeExamples/NX_ImportInt/epsfwraps.c

This is epsfwraps.c in view mode; [Download] [Up]

/* epsfwraps.c generated from epsfwraps.psw
   by unix pswrap V1.009  Wed Apr 19 17:50:24 PDT 1989
 */

#include <dpsclient/dpsfriends.h>
#include <string.h>

#line 1 "epsfwraps.psw"

/*
 * (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.
 */

/*
 *	epsfwraps.psw
 *
 *	Version:	2.0
 *	Author:	Ken Fromm
 *	History:
 *			03-07-91		Added this comment.
 */

/*  Sets the state for inclusion. */
#line 52 "epsfwraps.c"
void PSWBeginEpsf( void )
{
  typedef struct {
    unsigned char tokenType;
    unsigned char topLevelCount;
    unsigned short nBytes;

    DPSBinObjGeneric obj0;
    DPSBinObjGeneric obj1;
    DPSBinObjGeneric obj2;
    DPSBinObjGeneric obj3;
    DPSBinObjGeneric obj4;
    DPSBinObjGeneric obj5;
    DPSBinObjGeneric obj6;
    DPSBinObjGeneric obj7;
    DPSBinObjGeneric obj8;
    DPSBinObjGeneric obj9;
    DPSBinObjGeneric obj10;
    DPSBinObjGeneric obj11;
    DPSBinObjGeneric obj12;
    DPSBinObjGeneric obj13;
    DPSBinObjGeneric obj14;
    DPSBinObjGeneric obj15;
    DPSBinObjGeneric obj16;
    DPSBinObjGeneric obj17;
    DPSBinObjGeneric obj18;
    DPSBinObjGeneric obj19;
    DPSBinObjGeneric obj20;
    DPSBinObjGeneric obj21;
    DPSBinObjGeneric obj22;
    DPSBinObjGeneric obj23;
    DPSBinObjGeneric obj24;
    DPSBinObjGeneric obj25;
    DPSBinObjGeneric obj26;
    DPSBinObjGeneric obj27;
    DPSBinObjGeneric obj28;
    DPSBinObjGeneric obj29;
    DPSBinObjGeneric obj30;
    DPSBinObjGeneric obj31;
    DPSBinObjGeneric obj32;
    DPSBinObjGeneric obj33;
    DPSBinObjGeneric obj34;
    DPSBinObjGeneric obj35;
    DPSBinObjGeneric obj36;
    DPSBinObjGeneric obj37;
    DPSBinObjGeneric obj38;
    DPSBinObjGeneric obj39;
    DPSBinObjGeneric obj40;
    DPSBinObjGeneric obj41;
    DPSBinObjGeneric obj42;
    DPSBinObjGeneric obj43;
    } _dpsQ;
  static const _dpsQ _dpsStat = {
    DPS_DEF_TOKENTYPE, 34, 356,
    {DPS_LITERAL|DPS_NAME, 0, 0, 0},	/* EPSFsave */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 138},	/* save */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 51},	/* def */
    {DPS_LITERAL|DPS_NAME, 0, 0, 0},	/* EPSFcountdict */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 271},	/* countdictstack */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 51},	/* def */
    {DPS_LITERAL|DPS_NAME, 0, 0, 0},	/* EPSFcount */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 26},	/* count */
    {DPS_LITERAL|DPS_INT, 0, 0, 1},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 169},	/* sub */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 51},	/* def */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 182},	/* userdict */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 13},	/* begin */
    {DPS_LITERAL|DPS_NAME, 0, DPSSYSNAME, 161},	/* showpage */
    {DPS_EXEC|DPS_ARRAY, 0, 0, 352},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 51},	/* def */
    {DPS_LITERAL|DPS_INT, 0, 0, 0},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 150},	/* setgray */
    {DPS_LITERAL|DPS_INT, 0, 0, 0},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 153},	/* setlinecap */
    {DPS_LITERAL|DPS_INT, 0, 0, 1},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 155},	/* setlinewidth */
    {DPS_LITERAL|DPS_INT, 0, 0, 0},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 154},	/* setlinejoin */
    {DPS_LITERAL|DPS_INT, 0, 0, 10},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 346},	/* setmiterlimit */
    {DPS_LITERAL|DPS_ARRAY, 0, 0, 352},
    {DPS_LITERAL|DPS_INT, 0, 0, 0},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 148},	/* setdash */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 111},	/* newpath */
    {DPS_LITERAL|DPS_NAME, 0, 0, 0},	/* languagelevel */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 186},	/* where */
    {DPS_EXEC|DPS_ARRAY, 0, 6, 272},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 84},	/* if */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 117},	/* pop */
    {DPS_EXEC|DPS_NAME, 0, 0, 0},	/* languagelevel */
    {DPS_LITERAL|DPS_INT, 0, 0, 1},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 109},	/* ne */
    {DPS_EXEC|DPS_ARRAY, 0, 4, 320},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 84},	/* if */
    {DPS_LITERAL|DPS_BOOL, 0, 0, 0},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 350},	/* setstrokeadjust */
    {DPS_LITERAL|DPS_BOOL, 0, 0, 0},
    {DPS_EXEC|DPS_NAME, 0, 0, 0},	/* setoverprint */
    }; /* _dpsQ */
  _dpsQ _dpsF;	/* local copy  */
  register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
  register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
  static long int _dpsCodes[6] = {-1};
  {
if (_dpsCodes[0] < 0) {
    static const char * const _dps_names[] = {
	"EPSFsave",
	"EPSFcountdict",
	"EPSFcount",
	"languagelevel",
	(char *) 0 ,
	"setoverprint"};
    long int *_dps_nameVals[6];
    _dps_nameVals[0] = &_dpsCodes[0];
    _dps_nameVals[1] = &_dpsCodes[1];
    _dps_nameVals[2] = &_dpsCodes[2];
    _dps_nameVals[3] = &_dpsCodes[3];
    _dps_nameVals[4] = &_dpsCodes[4];
    _dps_nameVals[5] = &_dpsCodes[5];

    DPSMapNames(_dpsCurCtxt, 6, _dps_names, _dps_nameVals);
    }
  }

  _dpsF = _dpsStat;	/* assign automatic variable */

  _dpsP[0].val.nameVal = _dpsCodes[0];
  _dpsP[3].val.nameVal = _dpsCodes[1];
  _dpsP[6].val.nameVal = _dpsCodes[2];
  _dpsP[30].val.nameVal = _dpsCodes[3];
  _dpsP[35].val.nameVal = _dpsCodes[4];
  _dpsP[43].val.nameVal = _dpsCodes[5];
  DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,356);
}
#line 58 "epsfwraps.psw"


/*  Resets the state after inclusion. */
#line 191 "epsfwraps.c"
void PSWEndEpsf( void )
{
  typedef struct {
    unsigned char tokenType;
    unsigned char topLevelCount;
    unsigned short nBytes;

    DPSBinObjGeneric obj0;
    DPSBinObjGeneric obj1;
    DPSBinObjGeneric obj2;
    DPSBinObjGeneric obj3;
    DPSBinObjGeneric obj4;
    DPSBinObjGeneric obj5;
    DPSBinObjGeneric obj6;
    DPSBinObjGeneric obj7;
    DPSBinObjGeneric obj8;
    DPSBinObjGeneric obj9;
    DPSBinObjGeneric obj10;
    DPSBinObjGeneric obj11;
    DPSBinObjGeneric obj12;
    DPSBinObjGeneric obj13;
    } _dpsQ;
  static const _dpsQ _dpsStat = {
    DPS_DEF_TOKENTYPE, 12, 116,
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 26},	/* count */
    {DPS_EXEC|DPS_NAME, 0, 0, 0},	/* EPSFcount */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 169},	/* sub */
    {DPS_EXEC|DPS_ARRAY, 0, 1, 104},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 131},	/* repeat */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 271},	/* countdictstack */
    {DPS_EXEC|DPS_NAME, 0, 0, 0},	/* EPSFcountdict */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 169},	/* sub */
    {DPS_EXEC|DPS_ARRAY, 0, 1, 96},
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 131},	/* repeat */
    {DPS_EXEC|DPS_NAME, 0, 0, 0},	/* EPSFsave */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 132},	/* restore */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 57},	/* end */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 117},	/* pop */
    }; /* _dpsQ */
  _dpsQ _dpsF;	/* local copy  */
  register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
  register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
  static long int _dpsCodes[3] = {-1};
  {
if (_dpsCodes[0] < 0) {
    static const char * const _dps_names[] = {
	"EPSFcount",
	"EPSFcountdict",
	"EPSFsave"};
    long int *_dps_nameVals[3];
    _dps_nameVals[0] = &_dpsCodes[0];
    _dps_nameVals[1] = &_dpsCodes[1];
    _dps_nameVals[2] = &_dpsCodes[2];

    DPSMapNames(_dpsCurCtxt, 3, _dps_names, _dps_nameVals);
    }
  }

  _dpsF = _dpsStat;	/* assign automatic variable */

  _dpsP[1].val.nameVal = _dpsCodes[0];
  _dpsP[6].val.nameVal = _dpsCodes[1];
  _dpsP[10].val.nameVal = _dpsCodes[2];
  DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,116);
}
#line 65 "epsfwraps.psw"


/*
*	Positions the Epsf file within the document. The first four
*	floats are the origin and size within the document. The next
*	four are the original origin and size. The Angle is the 
*	amount of rotation in degrees.
*/
#line 266 "epsfwraps.c"
void PSWSetEpsf(float OriginX, float OriginY, float Width, float Height, float OrigOriginX, float OrigOriginY, float OrigWidth, float OrigHeight, float Angle)
{
  typedef struct {
    unsigned char tokenType;
    unsigned char topLevelCount;
    unsigned short nBytes;

    DPSBinObjReal obj0;
    DPSBinObjReal obj1;
    DPSBinObjGeneric obj2;
    DPSBinObjReal obj3;
    DPSBinObjGeneric obj4;
    DPSBinObjReal obj5;
    DPSBinObjReal obj6;
    DPSBinObjGeneric obj7;
    DPSBinObjReal obj8;
    DPSBinObjReal obj9;
    DPSBinObjGeneric obj10;
    DPSBinObjGeneric obj11;
    DPSBinObjReal obj12;
    DPSBinObjGeneric obj13;
    DPSBinObjReal obj14;
    DPSBinObjGeneric obj15;
    DPSBinObjGeneric obj16;
    DPSBinObjReal obj17;
    DPSBinObjReal obj18;
    DPSBinObjReal obj19;
    DPSBinObjReal obj20;
    DPSBinObjGeneric obj21;
    } _dpsQ;
  static const _dpsQ _dpsStat = {
    DPS_DEF_TOKENTYPE, 22, 180,
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OriginX */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OriginY */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 173},	/* translate */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: Angle */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 136},	/* rotate */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: Width */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigWidth */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 54},	/* div */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: Height */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigHeight */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 54},	/* div */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 139},	/* scale */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigOriginX */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 110},	/* neg */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigOriginY */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 110},	/* neg */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 173},	/* translate */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigOriginX */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigOriginY */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigWidth */
    {DPS_LITERAL|DPS_REAL, 0, 0, 0},	/* param: OrigHeight */
    {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 127},	/* rectclip */
    }; /* _dpsQ */
  _dpsQ _dpsF;	/* local copy  */
  register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
  register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
  _dpsF = _dpsStat;	/* assign automatic variable */

  _dpsP[0].val.realVal = OriginX;
  _dpsP[1].val.realVal = OriginY;
  _dpsP[5].val.realVal = Width;
  _dpsP[8].val.realVal = Height;
  _dpsP[12].val.realVal =
  _dpsP[17].val.realVal = OrigOriginX;
  _dpsP[14].val.realVal =
  _dpsP[18].val.realVal = OrigOriginY;
  _dpsP[6].val.realVal =
  _dpsP[19].val.realVal = OrigWidth;
  _dpsP[9].val.realVal =
  _dpsP[20].val.realVal = OrigHeight;
  _dpsP[3].val.realVal = Angle;
  DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,180);
}
#line 80 "epsfwraps.psw"



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