aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/config/pswrap
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/config/pswrap')
-rw-r--r--nx-X11/config/pswrap/Imakefile27
-rw-r--r--nx-X11/config/pswrap/lexer.l814
-rw-r--r--nx-X11/config/pswrap/main.c225
-rw-r--r--nx-X11/config/pswrap/psw.c1961
-rw-r--r--nx-X11/config/pswrap/psw.h92
-rw-r--r--nx-X11/config/pswrap/pswdict.c180
-rw-r--r--nx-X11/config/pswrap/pswdict.h76
-rw-r--r--nx-X11/config/pswrap/pswfile.c87
-rw-r--r--nx-X11/config/pswrap/pswparser.y278
-rw-r--r--nx-X11/config/pswrap/pswpriv.h177
-rw-r--r--nx-X11/config/pswrap/pswrap.man141
-rw-r--r--nx-X11/config/pswrap/pswsemantics.c551
-rw-r--r--nx-X11/config/pswrap/pswsemantics.h63
-rw-r--r--nx-X11/config/pswrap/pswstring.c140
-rw-r--r--nx-X11/config/pswrap/pswtypes.h49
-rw-r--r--nx-X11/config/pswrap/pswversion.h42
-rw-r--r--nx-X11/config/pswrap/sysname_gen.c429
-rw-r--r--nx-X11/config/pswrap/systemnames.c47
-rw-r--r--nx-X11/config/pswrap/yyerror.c77
19 files changed, 5456 insertions, 0 deletions
diff --git a/nx-X11/config/pswrap/Imakefile b/nx-X11/config/pswrap/Imakefile
new file mode 100644
index 000000000..98f845d62
--- /dev/null
+++ b/nx-X11/config/pswrap/Imakefile
@@ -0,0 +1,27 @@
+XCOMM $XFree86: xc/config/pswrap/Imakefile,v 1.8tsi Exp $
+
+ FRIENDSDEF = -DFRIENDSFILE='"<DPS/dpsfriends.h>"'
+ DEFINES = -DXENVIRONMENT
+ DEPLIBS =
+ YFLAGS = -d
+EXTRA_LIBRARIES = LexLib
+
+SRCS = main.c pswdict.c pswfile.c \
+ systemnames.c psw.c pswstring.c pswsemantics.c
+
+OBJS = main.o pswparser.o lexer.o pswdict.o pswfile.o \
+ systemnames.o psw.o pswstring.o pswsemantics.o
+
+#if CrossCompiling
+ComplexHostProgramTarget(pswrap)
+#else
+ComplexProgramTarget(pswrap)
+#endif
+
+pswraponly:: $(PROGRAM)
+
+SpecialObjectRule(pswfile.o,pswfile.c,$(FRIENDSDEF))
+
+LexFile(lexer)
+
+YaccFile(pswparser,$(YFLAGS))
diff --git a/nx-X11/config/pswrap/lexer.l b/nx-X11/config/pswrap/lexer.l
new file mode 100644
index 000000000..fdd6d03c2
--- /dev/null
+++ b/nx-X11/config/pswrap/lexer.l
@@ -0,0 +1,814 @@
+%{
+/*
+ * lexer.l
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86: xc/config/pswrap/lexer.l,v 1.10 2001/10/28 03:32:03 tsi Exp $ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pswpriv.h"
+#include "pswparser.h"
+
+/* flex of EMX seems to be too old */
+#if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT) && !defined(__UNIXOS2__)
+int yylineno = 1;
+#endif
+
+static int parens = 0; /* current paren balancing */
+static char *sbody; /* cur pointer into string_temp */
+static int curleng = 0; /* current scanned string length */
+static int strlineno; /* start line of current string */
+
+static int nonComment = true; /* are we outside C comments? */
+static int newLine = true; /* are we starting a new line? */
+static int hexstringerrs = 0; /* found an error in this hex string */
+
+int errorCount = 0; /* number of non-fatal errors */
+
+#ifdef PSWDEBUG
+int lexdebug = 1; /* debug flag */
+#define DEBUGP(x) {if (lexdebug) { fprintf x ; };}
+#else /* PSWDEBUG */
+#define DEBUGP(x)
+#endif /* PSWDEBUG */
+
+#undef YYLMAX
+#define YYLMAX 16384
+
+/* ErrIntro prints a standard intro for error messages;
+ * change it if your system uses something else. We have many options:
+ *
+ * to match Macintosh: #define FMT "File \"%s\"; Line %d # "
+ * to match BSD cc: #define FMT "\"%s\", line %d: "
+ * to match gcc: #define FMT "%s:%d: "
+ * to match Mips cc: #define FMT "pswrap: Error: %s, line %d: "
+ */
+#define INTRO "# In function %s -\n"
+
+#ifdef macintosh
+#define FMT "File \"%s\"; Line %d # "
+#else /* macintosh */
+#define FMT "\"%s\", line %d: "
+#endif /* macintosh */
+
+void ErrIntro(int line)
+{
+ if (! reportedPSWName && currentPSWName) {
+ reportedPSWName = 1;
+ fprintf(stderr,INTRO,currentPSWName);
+ }
+ fprintf(stderr,FMT,ifile,line);
+ errorCount++;
+}
+
+
+void yyerror(char *errmsg)
+{
+ ErrIntro(yylineno);
+ fprintf(stderr,"%s near text \"%s\"\n",errmsg,yytext);
+}
+%}
+
+%o 3500
+%a 2500
+
+%START PS STR HEX DEF SUB
+
+DIGIT ([0-9])
+HEXDIGIT ([a-fA-F0-9])
+RADIXDIGIT ([a-zA-Z0-9])
+LETTER ([a-zA-Z])
+SIGN ([+-])
+EXP ([eE]{SIGN}?{DIGIT}+)
+W ([ \t\n\r])
+
+%%
+
+<PS>^defineps { /* inside a wrap - just a PS token */
+ if (nonComment) {
+ newLine = false;
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ DEBUGP((stderr,"PSNAME ->%s\n",yytext));
+ return PSNAME;
+ }
+}
+
+<DEF>^defineps { /* treat as a C name inside the def part */
+ if (nonComment) {
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ DEBUGP((stderr,"CNAME ->%s\n",yytext));
+ return CNAME;
+ }
+}
+
+<STR>^defineps { /* part of string text */
+ register int i = yyleng;
+ register unsigned char *c = (unsigned char *) yytext;
+
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += yyleng;
+ for (; i > 0; --i) *sbody++ = *c++;
+}
+
+^{W}*defineps { /* start of a wrap definition */
+ if (nonComment) {
+ BEGIN DEF;
+ DEBUGP((stderr,"DEFINEPS\n"));
+ return DEFINEPS;
+ } else ECHO;
+}
+
+<PS>endps { /* end of a wrap */
+ if (nonComment){
+ if (newLine) {
+ newLine = false;
+ DEBUGP((stderr,"ENDPS\n"));
+ BEGIN 0;
+ return ENDPS;
+ } else {
+ DEBUGP((stderr,"PSNAME %s\n",yytext));
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ return PSNAME;
+ }
+ }
+}
+
+<DEF>^endps { /* treat as a C name inside the def part? */
+ if (nonComment) {
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ DEBUGP((stderr,"CNAME ->%s\n",yytext));
+ return CNAME;
+ }
+}
+
+<STR>^defineps { /* part of string text */
+ register int i = yyleng;
+ register unsigned char *c = (unsigned char *) yytext;
+
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += yyleng;
+ for (; i > 0; --i) *sbody++ = *c++;
+}
+
+endps { /* BOGUS end of a wrap */
+ if (nonComment) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"endps without matching defineps\n");
+ } else ECHO;
+}
+
+%{
+ /* real definition stuff */
+%}
+
+<DEF>"/*" { /* C comments on */
+ nonComment = false;
+}
+
+<DEF>"*/" { /* C comments off */
+ nonComment = true;
+}
+
+<DEF>"(" { /* formals start */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->(\n"));
+ return '(';
+ }
+}
+
+<DEF>")" { /* formals end */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->)\n"));
+ BEGIN PS;
+ return ')';
+ }
+}
+
+<DEF>[|,;[\]*:] { /* special single chars */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->%c\n",yytext[0]));
+ return (yytext[0]);
+ }
+}
+
+%{
+ /* formals type names */
+%}
+
+<DEF>"static" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->static\n"));
+ return STATIC;
+ }
+}
+
+<DEF>"boolean" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->boolean\n"));
+ return BOOLEAN;
+ }
+}
+
+<DEF>"char" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->char\n"));
+ return CHAR;
+ }
+}
+
+<DEF>"int" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->int\n"));
+ return INT;
+ }
+}
+
+<DEF>"short" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->short\n"));
+ return SHORT;
+ }
+}
+
+<DEF>"long" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->long\n"));
+ return LONG;
+ }
+}
+
+<DEF>"unsigned" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->unsigned\n"));
+ return UNSIGNED;
+ }
+}
+
+<DEF>"float" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->float\n"));
+ return FLOAT;
+ }
+}
+
+<DEF>"double" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->double\n"));
+ return DOUBLE;
+ }
+}
+
+<DEF>"userobject" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->userobject\n"));
+ return USEROBJECT;
+ }
+}
+
+<DEF>"numstring" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->numstring\n"));
+ return NUMSTRING;
+ }
+}
+
+<DEF>"DPSContext" {
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->DPScontext\n"));
+ return PSCONTEXT;
+ }
+}
+
+%{
+ /* C format numbers in formals part */
+%}
+
+<DEF>[1-9]{DIGIT}* { /* base 10 number */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->CINTEGER %s\n",yytext));
+ yylval.intobj = atoi((char *) yytext);
+ return CINTEGER;
+ }
+}
+
+<DEF>0{DIGIT}* { /* octal number (and zero) */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->CINTEGER %s\n",yytext));
+ /* I have no idea why the cast is needed in the next line,
+ but it seems to make the compiler happy on alpha */
+ sscanf((char *) yytext,"%lo",&yylval.intobj);
+ return CINTEGER;
+ }
+}
+
+<DEF>0[xX]{HEXDIGIT}+ { /* hex number */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->CINTEGER %s\n",yytext));
+ /* See previous comment... */
+ sscanf((char *) yytext,"0x%lx",&yylval.intobj);
+ return CINTEGER;
+ }
+}
+
+<DEF>[a-zA-Z_][a-zA-Z0-9_]* { /* C identifier */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->CNAME %s\n",yytext));
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ return CNAME;
+ }
+}
+
+<DEF>{W}+ {
+}
+
+<DEF>[^a-zA-Z0-9_|,;[\]*:\(\)/ \t\n\r]+ { /* all else - ERROR */
+ if (nonComment) {
+ DEBUGP((stderr,"DEF ->JUNK %s\n",yytext));
+ ErrIntro(yylineno);
+ fprintf(stderr,"invalid characters '%s' in definition\n",
+ yytext);
+ }
+}
+
+
+%{
+ /* body part - PostScript code */
+%}
+
+<PS>\%.* { /* a PS comment, ignore */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"comment %s\n",yytext));
+ /* yylval = yytext; return PSCOMMENT; */
+ }
+}
+
+<PS>{SIGN}?{DIGIT}+ { /* a decimal integer */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PSINTEGER ->%s\n",yytext));
+ yylval.intobj = atoi((char *) yytext);
+ return PSINTEGER;
+ }
+}
+
+<PS>{DIGIT}+#{RADIXDIGIT}+ { /* a radix number */
+#define MAX_ULONG ((unsigned long) -1)
+ unsigned base = 0;
+ unsigned char *s = (unsigned char *) yytext;
+ register unsigned long x, limit;
+ register unsigned long i = 0;
+
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PSINTEGER radix->%s\n",yytext));
+ while (*s != '#') {
+ base *= 10;
+ base += *s++ - '0';
+ if (base > 32) break;
+ }
+
+ if ((base < 2) || (base > 36)) {goto error;}
+ else {
+ limit = MAX_ULONG / base;
+ s++; /* skip # sign */
+ while (*s != '\0') {
+ if (i > limit) goto error;
+ i *= base;
+ if (isdigit(*s)) { x = *s - '0';}
+ else { x = (*s | 040) - ('a'-10);}
+ if (x >= base) goto error;
+ if (x > (MAX_ULONG - i)) goto error;
+ i += x;
+ s++;
+ }
+ }
+ yylval.intobj = i;
+ return PSINTEGER;
+
+ error:;
+ ErrIntro(yylineno);
+ fprintf(stderr,"invalid radix number %s\n",yytext);
+ yylval.intobj = 0; /* ERROR */
+ return PSINTEGER;
+ }
+}
+
+<PS>(({SIGN}?{DIGIT}+(\.{DIGIT}*)?{EXP}?)|({SIGN}?{DIGIT}*\.{DIGIT}+{EXP}?)) {
+ /* a float */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PSREAL ->%s\n",yytext));
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object,yytext);
+ return PSREAL;
+ }
+}
+
+<PS>"(" { /* start PS string */
+ if (nonComment) {
+ newLine = false;
+ BEGIN STR;
+ parens=1;
+ sbody = string_temp;
+ curleng = 0;
+ strlineno = yylineno;
+ *sbody = '\0';
+ }
+}
+
+%{
+ /* inside PS strings */
+%}
+
+<STR>"(" { /* balancing parens */
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += yyleng;
+ parens++;
+ *sbody++ = '(';
+}
+
+<STR>")" { /* balancing parens or end string */
+ if ((--parens) == 0) {
+ BEGIN PS;
+ *sbody = '\0';
+ yylval.object = psw_malloc(strlen(string_temp) + 1);
+ strcpy(yylval.object, string_temp);
+ DEBUGP((stderr,"PSSTRING ->%s\n",string_temp));
+ return PSSTRING;
+ }
+ else if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += yyleng;
+ *sbody++ = ')';
+}
+
+<STR>"\\"[0-7]([0-7]?)([0-7]?) { /* quoted octal byte */
+ if (4 + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += 4;
+ sprintf(sbody,"\\%3.3s",(yytext + 1));
+ while (*sbody) {
+ if (*sbody == ' ') *sbody = '0';
+ sbody++;
+ }
+}
+
+
+<STR>"\\\n" { /* ignore quoted newline */
+}
+
+<STR>"\\\\" { /* keep quoted backslashes in */
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ *sbody++ = '\\';
+ *sbody++ = '\\';
+ curleng += 2;
+}
+
+
+<STR>("\\".) { /* other quoted char, including parens */
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ switch (yytext[1]) {
+ case 'b':
+ *sbody++ = '\b';
+ break;
+ case 'f':
+ *sbody++ = '\f';
+ break;
+ case 'n':
+ *sbody++ = '\012';
+ break;
+ case 'r':
+ *sbody++ = '\015';
+ break;
+ case 't':
+ *sbody++ = '\t';
+ break;
+ default:
+ *sbody++ = yytext[1];
+ break;
+ }
+ curleng++;
+}
+
+
+<STR>"\n" { /* newline in a string */
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += yyleng;
+
+ *sbody++ = '\n';
+}
+
+<STR>[^()\\\n]+ { /* anything else */
+ register int i = yyleng;
+ register unsigned char *c = (unsigned char *) yytext;
+
+ if (yyleng + curleng >= maxstring) {
+ stringerr(1);
+ BEGIN PS;
+ *sbody = '\0';
+ return PSSTRING;
+ }
+ curleng += yyleng;
+ for (; i > 0; --i) *sbody++ = *c++;
+}
+
+%{
+ /* hexidecimal strings "< >" */
+%}
+
+<PS>"<" { /* begin hex string */
+ if (nonComment) {
+ newLine = false;
+ BEGIN HEX;
+ sbody = string_temp;
+ *sbody = '\0';
+ curleng = 0;
+ strlineno = yylineno;
+ hexstringerrs = 0;
+ }
+}
+
+<HEX>{W}+ { /* hex whitespace */
+ /* ignore */
+}
+
+<HEX>[0-9A-Fa-f]+ { /* hex string data */
+ if (yyleng + curleng >= maxstring) {
+ stringerr(2);
+ *sbody = '\0';
+ BEGIN PS;
+ return PSHEXSTRING;
+ }
+ curleng += yyleng;
+ strcpy(sbody,yytext);
+ sbody += yyleng;
+}
+
+<HEX>">" { /* end hex string */
+ BEGIN PS;
+ *sbody = '\0';
+ DEBUGP((stderr,"PSHEXSTRING ->%s\n",string_temp));
+ yylval.object = psw_malloc(strlen(string_temp) + 1);
+ strcpy(yylval.object, string_temp);
+ return PSHEXSTRING;
+}
+
+<HEX>[^a-fA-F0-9> \t\n\r]+ { /* ERROR */
+ if (hexstringerrs == 0) { /* only complain once per string */
+ ErrIntro(yylineno);
+ fprintf(stderr,"invalid characters in hex string '%s'\n",yytext);
+ hexstringerrs++;
+ }
+}
+
+
+%{
+ /* straight postscript */
+%}
+
+<PS>"<<" { /* just a PS token (for level 2 compatablity) */
+ if (nonComment) {
+ newLine = false;
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ DEBUGP((stderr,"PSNAME ->%s\n",yytext));
+ return PSNAME;
+ }
+}
+
+<PS>">>" { /* just a PS token (for level 2 compatablity) */
+ if (nonComment) {
+ newLine = false;
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ DEBUGP((stderr,"PSNAME ->%s\n",yytext));
+ return PSNAME;
+ }
+}
+
+<PS>[\[\]\{\}] { /* PS self delimiter */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PS ->%s\n",yytext));
+ return (yytext[0]);
+ }
+}
+
+<PS>"true"|"false" { /* boolean */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PSBOOLEAN %s\n",yytext));
+ yylval.intobj = (*yytext == 't');
+ return PSBOOLEAN;
+ }
+}
+
+<PS>"/"[^ <>\(\)\[\]\{\}\%\/\t\n\r]* { /* literal name */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PSLITNAME %s\n",yytext));
+ yylval.object = psw_malloc(strlen(yytext));
+ strcpy(yylval.object, yytext+1);
+ return PSLITNAME;
+ }
+}
+
+<PS>[^ <>\(\)\[\]\{\}\%\/\\\t\n\r]+ { /* executable name */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PSNAME %s\n",yytext));
+ yylval.object = psw_malloc(strlen(yytext) + 1);
+ strcpy(yylval.object, yytext);
+ return PSNAME;
+ }
+}
+
+<PS>"*/" { /* special case */
+ if (nonComment) {
+ newLine = false;
+ unput('/');
+ yylval.object = psw_malloc(2);
+ strcpy(yylval.object, "*");
+ return PSNAME;
+ }
+}
+
+<PS>"\\"[^ <>\(\)\[\]\{\}\%\/\\\t\n\r]+/"[" { /* \name[index] */
+ if (nonComment) {
+ DEBUGP((stderr,"\\PSNAME %s\n",yytext));
+ yylval.object = psw_malloc(strlen(yytext));
+ strcpy(yylval.object, yytext+1);
+ BEGIN SUB;
+ return PSSUBNAME;
+ }
+}
+
+<SUB>[\[][^ \t\]]*[\]] { /* [index] */
+ if (nonComment) {
+ int len = strlen(yytext);
+ DEBUGP((stderr,"PSINDEX %s\n",yytext));
+ if (len == 2) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"parameter index expression empty\n");
+ yylval.object = "0";
+ }
+ else {
+ yylval.object = psw_malloc(len);
+ strncpy(yylval.object, yytext+1, len-2);
+ yylval.object[len-2] = '\0';
+ }
+ BEGIN PS;
+ return PSINDEX;
+ }
+}
+
+<SUB>[\[][^\]]*[\]] { /* error */
+ if (nonComment) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"parameter index expression error\n");
+ yylval.object = "0";
+ BEGIN PS;
+ return PSINDEX;
+ }
+}
+
+<PS>[\)\>\\]+ { /* ERROR */
+ if (nonComment) {
+ newLine = false;
+ DEBUGP((stderr,"PS JUNK ->%s\n",yytext));
+ ErrIntro(yylineno);
+ fprintf(stderr,"invalid characters '%s'\n",yytext);
+ }
+}
+
+<PS>[ \t\r]+ { }
+
+<PS>[\n]+ {
+ newLine = true;
+}
+
+[ \t]+ { /* passthru stuff */
+ ECHO;
+}
+
+\n {
+ outlineno++;
+ ECHO;
+};
+
+"/*" { /* C comments on */
+ nonComment = false;
+ ECHO;
+}
+
+"*/" { /* C comments off */
+ if (!nonComment) {
+ nonComment = true;
+ ECHO;
+ }
+}
+
+%%
+
+int yywrap (void) {
+ if (!feof(yyin))
+ return (0);
+/* The following appears not to work with flex. As it is error
+ handling code, we just comment it out. */
+#if !defined(FLEX_SCANNER)
+ if (yybgin != (yysvec+1)) { /* make sure we are in state 0 */
+ ErrIntro(yylineno);
+ fprintf(stderr,"end of input file/missing endps\n");
+ }
+#endif
+ return (1);
+}
+
+void stringerr(int type)
+{
+ ErrIntro(strlineno);
+ fprintf(stderr,"%sstring too long (caught at line %d)\n",
+ ((type==1)?"":"hex "),yylineno);
+ errorCount++;
+ return;
+}
diff --git a/nx-X11/config/pswrap/main.c b/nx-X11/config/pswrap/main.c
new file mode 100644
index 000000000..0f7227a6c
--- /dev/null
+++ b/nx-X11/config/pswrap/main.c
@@ -0,0 +1,225 @@
+/*
+ * main.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86: xc/config/pswrap/main.c,v 1.4 2000/06/07 19:50:47 tsi Exp $ */
+
+#include <stdio.h>
+
+#ifdef XENVIRONMENT
+#include <X11/Xos.h>
+#else
+#include <string.h>
+#endif
+
+#define SLASH '/'
+#include <ctype.h>
+#include <stdlib.h>
+#include "pswpriv.h"
+
+#define MIN_MAXSTRING 80 /* min allowable value of maxstring */
+
+/* global data */
+char *prog; /* program name */
+char *special_h = NULL; /* -f option */
+char *hfile = NULL; /* name of -h file */
+char *ofile = NULL; /* name of -o file */
+char *ifile = NULL; /* name of input file */
+int gotInFile = 0; /* got an explicit input file name */
+int doANSI = 0; /* got -a (ansi) flag for -h file */
+int pad = 0; /* got -p (padding) flag */
+boolean noUserNames = false; /* got -n (don't use usernames) flag */
+int reentrant = 0; /* automatic vars for generated BOS */
+int bigFile = 0; /* got -b flag => call free */
+FILE *header; /* stream for -h file output */
+char headid[200]; /* id for header file #include */
+int maxstring = 2000; /* -s max string length to scan */
+char *string_temp; /* string buffer of above size */
+int outlineno = 1; /* output line number */
+int nWraps = 0; /* total number of wraps */
+#ifdef __MACH__
+char *shlibInclude = NULL; /* special file to be #included at top of */
+ /* file. Used only when building shlibs */
+#endif /* __MACH__ */
+
+static void Usage(void)
+{
+ fprintf(stderr,"Usage: pswrap [options] [input-file]\n");
+ fprintf(stderr," -a produce ANSI C procedure prototypes\n");
+ fprintf(stderr," -b process a big file\n");
+ fprintf(stderr," -f filename include special header\n");
+ fprintf(stderr," -h filename specify header filename\n");
+ fprintf(stderr," -o filename specify output C filename\n");
+ fprintf(stderr," -r make wraps re-entrant\n");
+ fprintf(stderr," -s length set maximum string length\n");
+ exit(1);
+}
+
+static void ScanArgs(int argc, char *argv[])
+{
+ char *slash; /* index of last / in hfile */
+ char *c; /* pointer into headid for conversion */
+ int i = 0;
+
+ prog = argv[i++];
+ slash = rindex(prog,SLASH);
+ if (slash)
+ prog = slash + 1;
+ while (i < argc) {
+ if (*argv[i] != '-') {
+ if (ifile != NULL) {
+ fprintf(stderr, "%s: Only one input file can be specified.\n", prog);
+ Usage();
+ } else {
+ ifile = argv[i];
+ }
+ } else {
+ switch (*(argv[i]+1)) {
+ case 'a':
+ doANSI++;
+ reentrant++;
+ break;
+ case 'b':
+ bigFile++;
+ break;
+#ifdef PSWDEBUG
+ case 'd':
+ lexdebug++;
+ break;
+#endif /* PSWDEBUG */
+ case 'f':
+ special_h = argv[++i];
+ break;
+ case 'h':
+ hfile = argv[++i];
+ slash = rindex(hfile,SLASH);
+ strcpy(headid, slash ? slash+1 : hfile);
+ for (c = headid; *c != '\0'; c++) {
+ if (*c == '.') *c = '_';
+ else if (isascii(*c) && islower(*c)) *c = toupper(*c);
+ }
+ break;
+ case 'o':
+ ofile = argv[++i];
+ break;
+ case 'r':
+ reentrant++;
+ break;
+ case 's':
+ if ((maxstring = atoi(argv[++i])) < MIN_MAXSTRING) {
+ fprintf(stderr,"%s: -s %d is the minimum\n", prog, MIN_MAXSTRING);
+ maxstring = MIN_MAXSTRING;
+ }
+ break;
+ case 'w':
+ break;
+#ifdef __MACH__
+ case 'S':
+ shlibInclude = argv[++i];
+ break;
+#endif /* __MACH__ */
+ case 'n':
+ noUserNames = true;
+ break;
+ case 'p':
+ pad++;
+ break;
+ default:
+ fprintf(stderr, "%s: bad option '-%c'\n", prog, *(argv[i]+1));
+ Usage();
+ break;
+ } /* switch */
+ } /* else */
+ i++;
+ } /* while */
+} /* ScanArgs */
+
+int main(int argc, char *argv[])
+{
+ int retval; /* return from yyparse */
+
+ ScanArgs(argc, argv);
+
+ if (ifile == NULL)
+ ifile = "stdin";
+ else {
+ gotInFile = 1;
+ if (freopen(ifile,"r",stdin) == NULL) {
+ fprintf(stderr, "%s: can't open %s for input\n", prog, ifile);
+ exit(1);
+ }
+ }
+ if ((string_temp = (char *) malloc((unsigned) (maxstring+1))) == 0) {
+ fprintf(stderr, "%s: can't allocate %d char string; try a smaller -s value\n", prog, maxstring);
+ exit(1);
+ }
+ if (ofile == NULL)
+ ofile = "stdout";
+ else {
+#ifdef __MACH__
+ (void)unlink(ofile);
+#endif /* __MACH__ */
+ if (freopen(ofile,"w",stdout) == NULL) {
+ fprintf(stderr, "%s: can't open %s for output\n", prog, ofile);
+ exit(1);
+ }
+ }
+ InitOFile();
+
+ if (hfile != NULL) {
+#ifdef __MACH__
+ (void)unlink(hfile);
+#endif /* __MACH__ */
+ if ((header = fopen(hfile,"w")) == NULL) {
+ fprintf(stderr, "%s: can't open %s for output\n", prog, hfile);
+ exit(1);
+ }
+ }
+ if (header != NULL) InitHFile();
+
+ InitWellKnownPSNames();
+
+ if ((retval = yyparse()) != 0)
+ fprintf(stderr,"%s: error in parsing %s\n",prog,ifile);
+ else if (errorCount != 0) {
+ fprintf(stderr,"%s: errors were encountered\n",prog);
+ retval = errorCount;
+ }
+
+ if (hfile != NULL) FinishHFile();
+
+ exit (retval);
+}
diff --git a/nx-X11/config/pswrap/psw.c b/nx-X11/config/pswrap/psw.c
new file mode 100644
index 000000000..f50f87a8b
--- /dev/null
+++ b/nx-X11/config/pswrap/psw.c
@@ -0,0 +1,1961 @@
+/*
+ * psw.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86: xc/config/pswrap/psw.c,v 1.5 2000/06/07 21:36:56 tsi Exp $ */
+
+/***********/
+/* Imports */
+/***********/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef XENVIRONMENT
+#include <X11/Xos.h>
+#else
+#include <string.h>
+#endif
+
+#include "pswdict.h"
+#include "pswpriv.h"
+#include "pswsemantics.h"
+
+#define DPS_HEADER_SIZE 4
+#define DPS_LONG_HEADER_SIZE 8
+#define DPS_BINOBJ_SIZE 8 /* sizeof(DPSBinObjGeneric) */
+#define WORD_ALIGN 3
+#define HNUMTOKEN 149
+#define NUMSTR_HEADER_SIZE 4
+#define MAXSTRINGS 256 /* maximum number of non-duplcated strings */
+
+#define datafil stdout /* send statics to stdout (with code) */
+
+/********************/
+/* Global Variables */
+/********************/
+
+/* Wrap-specific globals */
+
+static char *ctxName;
+
+static TokenList nameTokens;
+static int nNames;
+static TokenList namedInputArrays, namedInputStrings;
+static TokenList literalStrings;
+static boolean writable; /* encoding is not constant */
+static boolean twoStatics; /* true if strings are separate from objects */
+static boolean large;
+static int dpsHeaderSize;
+static int stringBytes;
+
+/**************************/
+/* Procedure Declarations */
+/**************************/
+
+
+/**********************/
+/* Utility procedures */
+
+
+#define CantHappen() { fprintf(stderr, "CantHappen"); abort(); }
+
+#define Assert(b) if (!(b)) { CantHappen(); }
+
+#define SafeStrCpy(dst,src) \
+ dst = psw_malloc(strlen(src)+1) , \
+ strcpy(dst, src)
+
+static long NumArgs(Args args)
+{
+ register long n = 0;
+ register Arg arg;
+ register Item item;
+ for (arg = args; arg; arg = arg->next)
+ for (item = arg->items; item; item = item->next)
+ n++;
+ return n;
+}
+
+static int NumTokens(Body body)
+{
+ register int n = 0;
+ while (body) { n++; body = body->next; }
+ return n;
+}
+
+static TokenList ConsToken (Token t, TokenList ll)
+{
+ TokenList tt = (TokenList) psw_calloc(sizeof(TokenListRec), 1);
+ tt->token = t;
+ tt->next = ll;
+ return tt;
+}
+
+static TokenList ConsNameToken (Token t, TokenList ll)
+{
+ TokenList temp, tt = (TokenList) psw_calloc(sizeof(TokenListRec), 1);
+
+ tt->token = t;
+ tt->next = ll;
+ if(ll == NULL)
+ return (tt);
+ temp = ll;
+ while((temp->next != NULL) && strcmp((char *)(temp->token->val), (char *)(t->val)))
+ temp = temp->next;
+ tt->next = temp->next;
+ temp->next = tt;
+ return (ll);
+}
+
+static boolean IsCharType(Type t)
+{
+ return (t == T_CHAR || t == T_UCHAR);
+}
+
+static boolean IsNumStrType(Type t)
+{
+ return (t == T_NUMSTR
+ || t == T_FLOATNUMSTR
+ || t == T_LONGNUMSTR
+ || t == T_SHORTNUMSTR);
+}
+
+static boolean IsPadNumStrType(Type t)
+{
+ return (t == T_NUMSTR || t == T_SHORTNUMSTR);
+}
+
+/*************************/
+/* Type-code conversions */
+
+static char *TypeToText(Type type)
+{
+ switch ((int) type) {
+ case T_CONTEXT:
+ return "DPSContext";
+ case T_BOOLEAN:
+ return "int";
+ case T_FLOAT:
+ return "float";
+ case T_DOUBLE:
+ return "double";
+ case T_CHAR:
+ return "char";
+ case T_UCHAR:
+ return "unsigned char";
+ case T_USEROBJECT:
+ case T_INT:
+ return "int";
+ case T_LONGINT:
+ return "long int";
+ case T_SHORTINT:
+ return "short int";
+ case T_ULONGINT:
+ return "unsigned long int";
+ case T_USHORTINT:
+ return "unsigned short int";
+ case T_UINT:
+ return "unsigned int";
+ case T_NUMSTR:
+ return "int";
+ case T_FLOATNUMSTR:
+ return "float";
+ case T_LONGNUMSTR:
+ return "long int";
+ case T_SHORTNUMSTR:
+ return "short int";
+ default:
+ CantHappen();
+ }
+ /*NOTREACHED*/
+}
+
+static char *CTypeToDPSType(int type)
+{
+ switch (type) {
+ case T_BOOLEAN:
+ return("DPS_BOOL");
+ case T_INT:
+ case T_LONGINT:
+ case T_SHORTINT:
+ case T_UINT:
+ case T_ULONGINT:
+ case T_USHORTINT:
+ case T_USEROBJECT:
+ return("DPS_INT");
+ case T_FLOAT:
+ case T_DOUBLE:
+ return("DPS_REAL");
+ case T_CHAR:
+ case T_UCHAR:
+ return("DPS_STRING");
+ default: CantHappen();
+ }
+ /*NOTREACHED*/
+}
+
+static char *CTypeToResultType(int type)
+{
+ switch (type) {
+ case T_BOOLEAN:
+ return("dps_tBoolean");
+ case T_USEROBJECT:
+ case T_INT:
+ return("dps_tInt");
+ case T_LONGINT:
+ return("dps_tLong");
+ case T_SHORTINT:
+ return("dps_tShort");
+ case T_UINT:
+ return("dps_tUInt");
+ case T_ULONGINT:
+ return("dps_tULong");
+ case T_USHORTINT:
+ return("dps_tUShort");
+ case T_FLOAT:
+ return("dps_tFloat");
+ case T_DOUBLE:
+ return("dps_tDouble");
+ case T_CHAR:
+ return("dps_tChar");
+ case T_UCHAR:
+ return("dps_tUChar");
+ case T_NUMSTR:
+ return("dps_tInt");
+ case T_FLOATNUMSTR:
+ return("dps_tFloat");
+ case T_LONGNUMSTR:
+ return("dps_tLong");
+ case T_SHORTNUMSTR:
+ return("dps_tShort");
+ default: CantHappen();
+ }
+ /*NOTREACHED*/
+}
+
+static void FreeTokenList(TokenList tokenList)
+{
+ register TokenList tl;
+ if (bigFile)
+ while (tokenList) {
+ tl = tokenList->next;
+ free((char *)tokenList);
+ tokenList = tl;
+ }
+}
+
+
+/********************************************/
+/* Support procedures that generate no code */
+
+static void SetNameTag(Token t)
+{
+ PSWDictValue tag;
+ Assert(t->type == T_NAME || t->type == T_LITNAME);
+ tag = PSWDictLookup(wellKnownPSNames, (char *)(t->val));
+ if (tag == -1) { /* this is not a well-known name */
+ if (noUserNames)
+ t->wellKnownName = false;
+ else {
+ nameTokens = ConsNameToken(t, nameTokens);
+ nNames++;
+ }
+ }
+ else { /* a well-known (system) name */
+ t->wellKnownName = true;
+ t->body.cnst = tag;
+ }
+}
+
+/* If the wrap has result parameters, DPSAwaitReturnValues
+ must be told when execution if the body is complete. The
+ following boilerplate is tacked on to the end of the body
+ for this purpose by AppendResultFlush:
+ 0 doneTag printobject flush
+ where doneTag = (last result parameter tag + 1).
+*/
+static Body AppendResultFlush(Body body, long n)
+{
+ Token t, token;
+ char *ss;
+
+ if (body == NULL) return NULL;
+ for (t = body; t->next; t = t->next) ;
+
+ token = PSWToken(T_INT, 0L);
+ token->next = PSWToken(T_INT, (char *)(long)n);
+
+ SafeStrCpy(ss, "printobject");
+ token->next->next = PSWToken(T_NAME, ss);
+
+ SafeStrCpy(ss, "flush");
+ token->next->next->next = PSWToken(T_NAME, ss);
+
+ t->next = token;
+ return body;
+}
+
+
+/*****************************************/
+/* Support procedures that generate code */
+
+static void EmitArgPrototypes(FILE *stm, Header hdr)
+{
+ register Arg arg;
+ register Item item;
+ for (arg = hdr->inArgs; arg; arg = arg->next) {
+ fprintf(stm, "%s ", TypeToText(arg->type));
+ for (item = arg->items; item; item = item->next) {
+ if (item->starred) fprintf(stm, "*");
+ fprintf(stm, item->name);
+ if (item->subscripted) fprintf(stm, "[]");
+ if (item->next) fprintf(stm, ", ");
+ }
+ fprintf(stm, "; ");
+ }
+ for (arg = hdr->outArgs; arg; arg = arg->next) {
+ fprintf(stm, "%s ", TypeToText(arg->type));
+ for (item = arg->items; item; item = item->next) {
+ if (item->starred) fprintf(stm, "*");
+ fprintf(stm, item->name);
+ if (item->subscripted) fprintf(stm, "[]");
+ if (item->next) fprintf(stm, ", ");
+ }
+ fprintf(stm, "; ");
+ }
+}
+
+/* use default promotions in prototypes unless it's a pointer/array */
+static char *TypeToDefault(int type)
+{
+ char *result = TypeToText(type);
+ switch (type) {
+ case T_FLOAT: result = "double"; break;
+ case T_USHORTINT: result = "unsigned"; break;
+ case T_SHORTINT: result = "int"; break;
+ }
+ return result;
+}
+
+static void EmitANSIPrototypes(FILE *stm, Header hdr)
+{
+ register Arg arg;
+ register Item item;
+ register char *type;
+
+ if ((hdr->inArgs == NULL) && (hdr->outArgs == NULL)) {
+ fprintf(stm, " void "); return;
+ }
+ for (arg = hdr->inArgs; arg; arg = arg->next) {
+ type = TypeToText(arg->type);
+ for (item = arg->items; item; item = item->next) {
+ if (arg->type == T_CONTEXT) ctxName = item->name;
+ fprintf(stm, "%s%s %s%s",
+ (item->starred || item-> subscripted) ? "const " : "",
+ (item->starred || item-> subscripted) ? type : TypeToDefault(arg->type),
+ item->starred ? "*" : "", item->name);
+ if (item->subscripted) fprintf(stm, "[]");
+ if (item->next) fprintf(stm, ", ");
+ }
+ if (arg->next) fprintf(stm, ", ");
+ }
+ if (hdr->inArgs && hdr->outArgs) fprintf(stm, ", ");
+ for (arg = hdr->outArgs; arg; arg = arg->next) {
+ type = TypeToText(arg->type);
+ for (item = arg->items; item; item = item->next) {
+ fprintf(stm, "%s %s%s",
+ (item->starred || item-> subscripted) ? type : TypeToDefault(arg->type),
+ item->starred ? "*" : "",
+ item->name);
+ if (item->subscripted) fprintf(stm, "[]");
+ if (item->next) fprintf(stm, ", ");
+ }
+ if (arg->next) fprintf(stm, ", ");
+ }
+}
+
+/* Procedures for generating type declarations in the body */
+
+static void StartBinObjSeqDef(void)
+{
+ /* start type defn of binobjseq */
+ printf(" typedef struct {\n");
+ printf(" unsigned char tokenType;\n");
+ if(large) {
+ printf(" unsigned char sizeFlag;\n");
+ printf(" unsigned short topLevelCount;\n");
+ printf(" unsigned int nBytes;\n\n");
+ outlineno++;
+ } else {
+ printf(" unsigned char topLevelCount;\n");
+ printf(" unsigned short nBytes;\n\n");
+ }
+ outlineno += 5;
+}
+
+static void EmitFieldType(Token t)
+{
+ if ((t->type == T_FLOAT)
+ || (t->type == T_NAME && t->namedFormal
+ && (!t->namedFormal->subscripted)
+ && (t->namedFormal->type == T_FLOAT || t->namedFormal->type == T_DOUBLE))
+ || ((t->type == T_SUBSCRIPTED) && ((t->namedFormal->type == T_FLOAT)
+ || (t->namedFormal->type == T_DOUBLE))))
+ {
+ printf(" DPSBinObjReal");
+ } else {
+ printf(" DPSBinObjGeneric");
+ }
+ printf (" obj%d;\n", t->tokenIndex); outlineno++;
+}
+
+static int CheckSize(Body body)
+{
+ Adr nextAdr;
+ register TokenList bodies = NULL;
+ register TokenList tl;
+ boolean firstBody = true;
+ PSWDict wrapDict;
+ int strCount = 0;
+
+ bodies = ConsToken(body, (TokenList) NULL); /* the work list */
+
+ wrapDict = CreatePSWDict(MAXSTRINGS); /* dictionary of strings in the wrap */
+
+ nextAdr.cnst = 0;
+ nextAdr.var = NULL;
+ namedInputArrays = NULL;
+ namedInputStrings = NULL;
+ literalStrings = NULL;
+
+ while (bodies) {
+ register Token t;
+ register TokenList c = bodies;
+ bodies = c->next;
+
+ if (firstBody) firstBody = false;
+ else {
+ c->token->body = nextAdr;
+ c->token = (Body)c->token->val;
+ }
+ for (t = c->token; t; t = t->next) {
+ /* foreach token in this body */
+ nextAdr.cnst += DPS_BINOBJ_SIZE;
+
+
+ switch (t->type) {
+ case T_STRING: /* token is a string literal */
+ case T_HEXSTRING: /* token is a hexstring literal */
+ if (t->namedFormal == NULL) {
+ if ((t->type == T_STRING) ? PSWStringLength(t->val)
+ : PSWHexStringLength(t->val))
+ literalStrings = ConsToken(t, literalStrings);
+ }
+ else {
+ Assert(IsCharType(t->namedFormal->type));
+ namedInputStrings = ConsToken(t, namedInputStrings);
+ }
+ break;
+
+ case T_NAME:
+ if (t->namedFormal != NULL) {
+ if (IsCharType(t->namedFormal->type) ||
+ IsNumStrType(t->namedFormal->type))
+ namedInputStrings = ConsToken(t, namedInputStrings);
+ else
+ if (t->namedFormal->subscripted)
+ namedInputArrays = ConsToken(t, namedInputArrays);
+ } else {
+ if (noUserNames) {
+ SetNameTag(t);
+ if (!t->wellKnownName)
+ literalStrings = ConsToken(t, literalStrings);
+ }
+ }
+ break;
+
+ case T_LITNAME:
+ if (t->namedFormal != NULL) {
+ namedInputStrings = ConsToken(t, namedInputStrings);
+ writable = true;
+ } else {
+ if (noUserNames) {
+ SetNameTag(t);
+ if (!t->wellKnownName)
+ literalStrings = ConsToken(t, literalStrings);
+ }
+ }
+ break;
+
+ case T_SUBSCRIPTED:
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ break;
+
+ case T_ARRAY:
+ bodies = ConsToken(t, bodies);
+ break;
+ case T_PROC:
+ bodies = ConsToken(t, bodies);
+ break;
+ default:
+ CantHappen();
+ } /* switch */
+ } /* for */
+ free(c);
+ } /* while */
+
+
+ for (tl = namedInputArrays; tl; tl = tl->next) {
+ Token t = tl->token;
+ if (t->namedFormal->subscript->constant)
+ nextAdr.cnst += t->namedFormal->subscript->val * DPS_BINOBJ_SIZE;
+ }
+
+ for (tl = literalStrings; tl; tl = tl->next) {
+ Token t = tl->token;
+ int ln;
+ if (PSWDictLookup(wrapDict, (char *)t->val) == -1) {
+ if (strCount <= MAXSTRINGS) {
+ PSWDictEnter(wrapDict, t->val, 0);
+ strCount++;
+ }
+ if (t->type == T_STRING || t->type == T_NAME || t->type == T_LITNAME)
+ ln = PSWStringLength((char *)t->val);
+ else
+ ln = PSWHexStringLength((char *)t->val);
+ nextAdr.cnst += ln;
+ }
+ }
+
+ /* process name and litname tokens that reference formal string arguments */
+ for (tl = namedInputStrings; tl; tl = tl->next) {
+ Token t = tl->token;
+ if (t->namedFormal->subscripted && t->namedFormal->subscript->constant) {
+ if (IsNumStrType(t->namedFormal->type))
+ nextAdr.cnst += NUMSTR_HEADER_SIZE;
+ else
+ if(pad) {
+ int length;
+ length = t->namedFormal->subscript->val + WORD_ALIGN;
+ length &= ~WORD_ALIGN;
+ nextAdr.cnst += length;
+ } else
+ nextAdr.cnst += t->namedFormal->subscript->val;
+ }
+ }
+
+ DestroyPSWDict(wrapDict);
+ if (nextAdr.cnst > 0xffff)
+ return(1);
+ else
+ return(0);
+
+} /* CheckSize */
+
+static void BuildTypesAndAssignAddresses(
+ Body body, Adr *sz, long int *nObjs, unsigned *psize)
+{
+ long int objN = 0;
+ Adr nextAdr;
+ register TokenList bodies = NULL;
+ register TokenList tl;
+ boolean firstBody = true;
+ PSWDict wrapDict;
+ int strCount = 0;
+
+ bodies = ConsToken(body, (TokenList) NULL); /* the work list */
+
+ wrapDict = CreatePSWDict(MAXSTRINGS); /* dictionary of strings in the wrap */
+
+ nextAdr.cnst = 0;
+ nextAdr.var = NULL;
+ namedInputArrays = NULL;
+ namedInputStrings = NULL;
+ literalStrings = NULL;
+ writable = false;
+ stringBytes = 0;
+
+ /* emit boilerplate for the binobjseq record type */
+ StartBinObjSeqDef();
+
+ while (bodies) {
+ register Token t;
+ register TokenList c = bodies;
+ bodies = c->next;
+
+ if (firstBody) firstBody = false;
+ else {
+ c->token->body = nextAdr;
+ c->token = (Body)c->token->val;
+ }
+ for (t = c->token; t; t = t->next) {
+ /* foreach token in this body */
+ t->adr = nextAdr;
+ nextAdr.cnst += DPS_BINOBJ_SIZE;
+ t->tokenIndex = objN++;
+
+ /* emit the token type as the next record field */
+ EmitFieldType(t);
+
+ switch (t->type) {
+ case T_STRING: /* token is a string literal */
+ case T_HEXSTRING: /* token is a hexstring literal */
+ if (t->namedFormal == NULL) {
+ if ((t->type == T_STRING) ? PSWStringLength(t->val)
+ : PSWHexStringLength(t->val))
+ literalStrings = ConsToken(t, literalStrings);
+ }
+ else {
+ Assert(IsCharType(t->namedFormal->type));
+ namedInputStrings = ConsToken(t, namedInputStrings);
+ if (!(t->namedFormal->subscripted && t->namedFormal->subscript->constant))
+ writable = true;
+ }
+ break;
+
+ case T_NAME:
+ if (t->namedFormal == NULL) {
+ SetNameTag(t);
+ if(noUserNames) {
+ if (!t->wellKnownName)
+ literalStrings = ConsToken(t, literalStrings);
+ }
+ } else
+ if (IsCharType(t->namedFormal->type)
+ || IsNumStrType(t->namedFormal->type)) {
+ namedInputStrings = ConsToken(t, namedInputStrings);
+ if (!(t->namedFormal->subscripted
+ && t->namedFormal->subscript->constant))
+ writable = true;
+ } else
+ if (t->namedFormal->subscripted) {
+ namedInputArrays = ConsToken(t, namedInputArrays);
+ if (!(t->namedFormal->subscript->constant))
+ writable = true;
+ } else
+ writable = true;
+ break;
+
+ case T_LITNAME:
+ Assert(t->namedFormal == NULL || IsCharType(t->namedFormal->type));
+ if (t->namedFormal == NULL) {
+ SetNameTag(t);
+ if (noUserNames) {
+ if (!t->wellKnownName)
+ literalStrings = ConsToken(t, literalStrings);
+ }
+ } else {
+ namedInputStrings = ConsToken(t, namedInputStrings);
+ writable = true;
+ }
+ break;
+
+ case T_SUBSCRIPTED:
+ writable = true;
+ break;
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ break;
+
+ case T_ARRAY:
+ bodies = ConsToken(t, bodies);
+ break;
+ case T_PROC:
+ bodies = ConsToken(t, bodies);
+ break;
+ default:
+ CantHappen();
+ } /* switch */
+ } /* for */
+ free(c);
+ } /* while */
+
+ *psize = nextAdr.cnst;
+
+ if(nNames)
+ writable = true; /* SetNameTag couldn't find the name */
+
+ if (namedInputArrays && literalStrings) {
+ twoStatics = true;
+ printf(" } _dpsQ;\n\n");
+ printf(" typedef struct {\n");
+ outlineno += 3;
+ }
+ else twoStatics = false;
+
+ for (tl = namedInputArrays; tl; tl = tl->next) {
+ Token t = tl->token;
+ Assert(t && t->type == T_NAME && t->namedFormal);
+ Assert(t->namedFormal->subscripted && !t->namedFormal->starred);
+
+ /* this input array token requires its own write binobjs call */
+ t->body = nextAdr;
+ if (t->namedFormal->subscript->constant)
+ nextAdr.cnst += t->namedFormal->subscript->val * DPS_BINOBJ_SIZE;
+ }
+
+ for (tl = literalStrings; tl; tl = tl->next) {
+ Token t = tl->token;
+ int ln;
+ PSWDictValue loc;
+
+ loc = PSWDictLookup(wrapDict, (char *)t->val);
+ if (loc == -1) {
+ t->body = nextAdr;
+ if (strCount <= MAXSTRINGS) {
+ PSWDictEnter(wrapDict, (char *)t->val, nextAdr.cnst);
+ strCount++;
+ }
+ if (t->type == T_STRING || t->type == T_NAME || t->type == T_LITNAME)
+ ln = PSWStringLength((char *)t->val);
+ else
+ ln = PSWHexStringLength((char *)t->val);
+ nextAdr.cnst += ln;
+ stringBytes += ln;
+
+ /* emit the string type as the next record field */
+ printf(" char obj%ld[%d];\n", objN++, ln); outlineno++;
+ } else {
+ t->body = nextAdr;
+ t->body.cnst = loc;
+ }
+ }
+
+ /* process name and litname tokens that reference formal string arguments */
+ for (tl = namedInputStrings; tl; tl = tl->next) {
+ Token t = tl->token;
+ t->body = nextAdr;
+ if (t->namedFormal->subscripted && t->namedFormal->subscript->constant) {
+ if (IsNumStrType(t->namedFormal->type)) {
+ nextAdr.cnst += NUMSTR_HEADER_SIZE;
+ writable = true;
+ } else
+ if(pad) {
+ int length;
+ length = t->namedFormal->subscript->val + WORD_ALIGN;
+ length &= ~WORD_ALIGN;
+ nextAdr.cnst += length;
+ } else
+ nextAdr.cnst += t->namedFormal->subscript->val;
+ }
+ }
+
+ /* emit boilerplate to end the last record type */
+ if (twoStatics) printf(" } _dpsQ1;\n");
+ else printf(" } _dpsQ;\n");
+ outlineno++;
+
+ *nObjs = objN;
+ /* total number of objects plus string bodies in objrecs */
+
+ *sz = nextAdr;
+ DestroyPSWDict(wrapDict);
+} /* BuildTypesAndAssignAddresses */
+
+
+/* Procedures for generating static declarations for local types */
+
+static void StartStatic(boolean first)
+{
+ /* start static def for bin obj seq or for array data (aux) */
+ if (first) {
+ if(reentrant && writable) {
+ if(doANSI)
+ printf(" static const _dpsQ _dpsStat = {\n");
+ else
+ printf(" static _dpsQ _dpsStat = {\n");
+ } else {
+ if (doANSI)
+ printf(" static const _dpsQ _dpsF = {\n");
+ else
+ printf(" static _dpsQ _dpsF = {\n");
+ }
+ } else {
+ if(doANSI)
+ printf(" static const _dpsQ1 _dpsF1 = {\n");
+ else
+ printf(" static _dpsQ1 _dpsF1 = {\n");
+ }
+
+ outlineno++;
+}
+
+static void FirstStatic(int nTopObjects, Adr *sz)
+{
+ char *numFormat = "DPS_DEF_TOKENTYPE";
+
+ outlineno++;
+ if(large) {
+ fprintf(datafil, " %s, 0, %d, ", numFormat, nTopObjects);
+ fprintf(datafil, "%ld,\n", sz->cnst + dpsHeaderSize);
+ } else {
+ fprintf(datafil, " %s, %d, ", numFormat, nTopObjects);
+ fprintf(datafil, "%ld,\n", sz->cnst + dpsHeaderSize);
+ }
+}
+
+static void EndStatic(boolean first)
+{
+ /* end static template defn */
+ if (first)
+ printf(" }; /* _dpsQ */\n");
+ else
+ printf(" }; /* _dpsQ1 */\n");
+ outlineno++;
+}
+
+/* char that separates object attributes */
+#define ATT_SEP '|'
+
+static void EmitFieldConstructor(Token t)
+{
+ char *comment = NULL, *commentName = NULL;
+ fprintf(datafil, " {");
+
+ switch (t->type) {
+ case T_BOOLEAN:
+ fprintf(datafil, "DPS_LITERAL%cDPS_BOOL, 0, 0, %d", ATT_SEP, (int)(long)t->val);
+ break;
+ case T_INT:
+ fprintf(datafil, "DPS_LITERAL%cDPS_INT, 0, 0, %d", ATT_SEP, (int)(long)t->val);
+ break;
+ case T_FLOAT:
+ fprintf(datafil, "DPS_LITERAL%cDPS_REAL, 0, 0, %s", ATT_SEP, (char *)t->val);
+ break;
+
+ case T_ARRAY:
+ fprintf(datafil, "DPS_LITERAL%cDPS_ARRAY, 0, %d, %ld", ATT_SEP,
+ NumTokens((Body) (t->val)), t->body.cnst);
+ break;
+ case T_PROC:
+ fprintf(datafil, "DPS_EXEC%cDPS_ARRAY, 0, %d, %ld", ATT_SEP,
+ NumTokens((Body) (t->val)), t->body.cnst);
+ break;
+
+ case T_STRING:
+ case T_HEXSTRING:
+ if (t->namedFormal == NULL) {
+ int ln;
+ if (t->type == T_STRING)
+ ln = PSWStringLength((char *)t->val);
+ else ln = PSWHexStringLength((char *)t->val);
+ fprintf(datafil, "DPS_LITERAL%cDPS_STRING, 0, %d, %ld", ATT_SEP,
+ ln, t->body.cnst);
+ } else {
+ Item item = t->namedFormal;
+ if (item->subscripted && item->subscript->constant) {
+ fprintf(datafil, "DPS_LITERAL%cDPS_STRING, 0, %d, %ld",
+ ATT_SEP,item->subscript->val, t->body.cnst);
+ comment = "param[const]: ";
+ } else {
+ fprintf(datafil, "DPS_LITERAL%cDPS_STRING, 0, 0, %ld",
+ ATT_SEP,t->body.cnst);
+ comment = "param ";
+ }
+ commentName = (char *)t->val;
+ }
+ break;
+
+ case T_LITNAME:
+ commentName = (char *)t->val;
+ if (t->wellKnownName) {
+ fprintf(datafil, "DPS_LITERAL%cDPS_NAME, 0, DPSSYSNAME, %ld", ATT_SEP, t->body.cnst);
+ }
+ else if (t->namedFormal == NULL) {
+ int ln;
+ if (noUserNames) {
+ ln = PSWStringLength((char *)t->val);
+ fprintf(datafil, "DPS_LITERAL%cDPS_NAME, 0, %d, %ld", ATT_SEP, ln, t->body.cnst);
+ } else
+ fprintf(datafil, "DPS_LITERAL%cDPS_NAME, 0, 0, 0", ATT_SEP);
+ }
+ else {
+ fprintf(datafil, "DPS_LITERAL%cDPS_NAME, 0, 0, %ld", ATT_SEP, t->body.cnst);
+ comment = "param ";
+ }
+ break;
+
+ case T_NAME:
+ commentName = (char *)t->val;
+ if (t->wellKnownName) {
+ fprintf(datafil, "DPS_EXEC%cDPS_NAME, 0, DPSSYSNAME, %ld", ATT_SEP, t->body.cnst);
+ }
+ else if (t->namedFormal == NULL) {
+ int ln;
+ if (noUserNames) {
+ ln = PSWStringLength((char *)t->val);
+ fprintf(datafil, "DPS_EXEC%cDPS_NAME, 0, %d, %ld", ATT_SEP,
+ ln, t->body.cnst);
+ } else
+ fprintf(datafil, "DPS_EXEC%cDPS_NAME, 0, 0, 0", ATT_SEP);
+ }
+ else {
+ Item item = t->namedFormal;
+ if (IsCharType(item->type)) {
+ if (item->subscripted && t->namedFormal->subscript->constant) {
+ fprintf(datafil, "DPS_EXEC%cDPS_NAME, 0, %d, %ld", ATT_SEP,
+ t->namedFormal->subscript->val, t->body.cnst);
+ comment = "param[const]: ";
+ }
+ else {
+ fprintf(datafil, "DPS_EXEC%cDPS_NAME, 0, 0, %ld", ATT_SEP, t->body.cnst);
+ comment = "param ";
+ }
+ }
+ else {
+ if (item->subscripted) {
+ if (t->namedFormal->subscript->constant) {
+ if(IsNumStrType(item->type))
+ fprintf(datafil, "DPS_LITERAL%cDPS_STRING, 0, %d, %ld",
+ ATT_SEP, t->namedFormal->subscript->val
+ + NUMSTR_HEADER_SIZE, t->body.cnst);
+ else
+ fprintf(datafil, "DPS_LITERAL%cDPS_ARRAY, 0, %d, %ld",
+ ATT_SEP, t->namedFormal->subscript->val,
+ t->body.cnst);
+ comment = "param[const]: ";
+ } else {
+ if(IsNumStrType(item->type))
+ fprintf(datafil, "DPS_LITERAL%cDPS_STRING, 0, 0, %ld",
+ ATT_SEP, t->body.cnst);
+ else
+ fprintf(datafil, "DPS_LITERAL%cDPS_ARRAY, 0, 0, %ld", ATT_SEP,
+ t->body.cnst);
+ comment = "param[var]: ";
+ }
+ }
+ else {
+ char *dt = CTypeToDPSType(item->type);
+ fprintf(datafil, "DPS_LITERAL%c%s, 0, 0, 0", ATT_SEP, dt);
+ comment = "param: ";
+ }
+ }
+ }
+ break;
+ case T_SUBSCRIPTED: {
+ Item item = t->namedFormal;
+ char *dt = CTypeToDPSType(item->type);
+
+ /* Assert(t->namedFormal) */
+ fprintf(datafil, "DPS_LITERAL%c%s, 0, 0, 0", ATT_SEP, dt);
+ comment = "indexed param: ";
+ commentName = (char *)t->val;
+ }
+ break;
+
+ default:
+ CantHappen();
+ } /* switch */
+
+ if (comment == NULL) {
+ if (commentName == NULL) fprintf(datafil, "},\n");
+ else fprintf(datafil, "}, /* %s */\n", commentName);
+ }
+ else {
+ if (commentName == NULL) fprintf(datafil, "}, /* %s */\n", comment);
+ else fprintf(datafil, "}, /* %s%s */\n", comment, commentName);
+ }
+ outlineno++;
+} /* EmitFieldConstructor */
+
+static void ConstructStatics(Body body, Adr *sz, int nObjs)
+{
+ int objN = 0;
+ register TokenList strings = NULL, bodies = NULL;
+ register TokenList tl;
+ boolean isNamedInputArrays = false;
+ PSWDict wrapDict;
+ int strCount = 0;
+
+ wrapDict = CreatePSWDict(MAXSTRINGS); /* dictionary of strings in the wrap */
+
+ bodies = ConsToken(body, (TokenList) NULL); /* the work list */
+
+ /* emit boilerplate for the binobjseq static */
+ StartStatic(true);
+ FirstStatic(NumTokens(body), sz);
+
+ while (bodies) {
+ register Token t;
+ TokenList c = bodies;
+ bodies = c->next;
+
+ for (t = c->token; t; t = t->next) {
+ /* foreach token in this body */
+
+ /* emit the next record field constructor */
+ EmitFieldConstructor(t);
+ objN++;
+
+ switch (t->type) {
+ case T_STRING: /* token is a string literal */
+ if ((t->namedFormal == NULL) && PSWStringLength(t->val))
+ strings = ConsToken(t, strings);
+ break;
+
+ case T_HEXSTRING: /* token is a hexstring literal */
+ if ((t->namedFormal == NULL) && PSWHexStringLength(t->val))
+ strings = ConsToken(t, strings);
+ break;
+
+ case T_NAME:
+ if (t->namedFormal == NULL) {
+ if (noUserNames) {
+ if (!t->wellKnownName)
+ strings = ConsToken(t, strings);
+ }
+ } else
+ if ((t->namedFormal->subscripted)
+ && (!IsCharType(t->namedFormal->type))
+ && (!IsNumStrType(t->namedFormal->type))
+ )
+ isNamedInputArrays = true;
+ break;
+
+ case T_LITNAME:
+ if (noUserNames) {
+ if (!t->namedFormal && !t->wellKnownName)
+ strings = ConsToken(t, strings);
+ break;
+ }
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ case T_SUBSCRIPTED:
+ break;
+
+ case T_ARRAY:
+ case T_PROC:
+ bodies = ConsToken((Body)t->val, bodies);
+ break;
+ default:
+ CantHappen();
+ } /* switch */
+ } /* for */
+ free(c);
+ } /* while */
+
+ if (strings && isNamedInputArrays) {
+ EndStatic(true);
+ StartStatic(false);
+ }
+
+ for (tl = strings; tl; tl = tl->next) {
+ Token t = tl->token;
+ if (PSWDictLookup(wrapDict, (char *)t->val) == -1) {
+ if (strCount <= MAXSTRINGS) {
+ PSWDictEnter(wrapDict, (char *)t->val, 0);
+ strCount++;
+ }
+ printf(" {");
+ if (t->type == T_STRING || t->type == T_NAME || t->type == T_LITNAME)
+ PSWOutputStringChars((char *)t->val);
+ else
+ PSWOutputHexStringChars((char *)t->val);
+ printf("},\n"); outlineno++;
+ objN++;
+ }
+ }
+
+ FreeTokenList(strings); strings = NULL;
+
+ EndStatic(! twoStatics); /* end the last static record */
+
+ Assert(objN == nObjs);
+
+ DestroyPSWDict(wrapDict);
+} /* ConstructStatics */
+
+
+/* Procedures for managing the result table */
+
+static void EmitResultTagTableDecls(Args outArgs)
+{
+ register Arg arg;
+ register Item item;
+ int count = 0;
+
+ if(reentrant) {
+ for (arg = outArgs; arg; arg = arg->next)
+ for (item = arg->items; item; item = item->next)
+ count++;
+ printf(" DPSResultsRec _dpsR[%d];\n", count); outlineno++;
+ count = 0;
+ if(doANSI)
+ printf(" static const DPSResultsRec _dpsRstat[] = {\n");
+ else
+ printf(" static DPSResultsRec _dpsRstat[] = {\n");
+ outlineno++;
+ } else {
+ printf(" static DPSResultsRec _dpsR[] = {\n"); outlineno++;
+ }
+ for (arg = outArgs; arg; arg = arg->next) {
+ for (item = arg->items; item; item = item->next) {
+ if (item->subscripted) {
+ printf(" { %s },\n",CTypeToResultType(item->type));
+ }
+ else { /* not subscripted */
+ printf(" { %s, -1 },\n",CTypeToResultType(item->type));
+ }
+ outlineno++;
+ }
+ }
+ printf(" };\n"); outlineno++;
+ for (arg = outArgs; arg; arg = arg->next) {
+ for (item = arg->items; item; item = item->next) {
+ if(reentrant) {
+ printf(" _dpsR[%d] = _dpsRstat[%d];\n", count, count);
+ outlineno++;
+ }
+ if (item->subscripted) {
+ Subscript s = item->subscript;
+ if (!(s->constant)) {
+ printf(" _dpsR[%d].count = %s;\n",count, s->name);
+ } else {
+ printf(" _dpsR[%d].count = %d;\n",count, s->val);
+ }
+ outlineno++;
+ } else { /* not subscripted */
+ if (IsCharType(item->type)) {
+ printf(" _dpsR[%d].count = -1;\n",count);
+ outlineno++;
+ }
+ }
+ printf(" _dpsR[%d].value = (char *)%s;\n",count++,item->name);
+ outlineno++;
+ }
+ }
+ printf("\n"); outlineno++;
+}
+
+static void EmitResultTagTableAssignments(Args outArgs)
+{
+ printf(" DPSSetResultTable(%s, _dpsR, %ld);\n", ctxName, NumArgs(outArgs));
+ outlineno++;
+}
+
+/* Procedure for acquiring name tags */
+
+static void EmitNameTagAcquisition(void)
+{
+ register TokenList n;
+ int i;
+ char *last_str;
+
+ last_str = (char *) psw_malloc((unsigned) (maxstring+1));
+
+ printf(" {\n");
+ if(!doANSI) {
+ printf(" static int _dpsT = 1;\n\n");
+ printf(" if (_dpsT) {\n");
+ outlineno += 4;
+ } else {
+ printf("if (_dpsCodes[0] < 0) {\n");
+ outlineno += 2;
+ }
+ if(doANSI)
+ printf(" static const char * const _dps_names[] = {\n");
+ else
+ printf(" static char *_dps_names[] = {\n");
+ outlineno ++;
+
+ for (n = nameTokens; n!= NULL; n = n->next) {
+ if (strcmp(last_str,(char *)n->token->val)) {
+ strcpy(last_str,(char *)n->token->val);
+ printf("\t\"%s\"", (char *)n->token->val);
+ } else {
+ printf("\t(char *) 0 ");
+ }
+ if (n->next) {printf(",\n"); outlineno++;}
+ }
+ printf("};\n"); outlineno++;
+ printf(" int *_dps_nameVals[%d];\n",nNames);outlineno++;
+ if (!doANSI) {
+ if (!writable) {
+ printf(" register DPSBinObjRec *_dpsP = (DPSBinObjRec *) &_dpsF.obj0;\n");
+ outlineno++;
+ } else {
+ if (reentrant) {
+ printf(" _dpsP = (DPSBinObjRec *) &_dpsStat.obj0;\n");
+ outlineno++;
+ }
+ }
+ }
+ i = 0;
+ if (doANSI) {
+ for(i=0; i<nNames; i++) {
+ printf(" _dps_nameVals[%d] = &_dpsCodes[%d];\n",i,i);
+ outlineno ++;
+ }
+ } else {
+ for (n = nameTokens; n!= NULL; n = n->next) {
+ printf(" _dps_nameVals[%d] = (int *)&_dpsP[%d].val.nameVal;\n",
+ i++, n->token->tokenIndex);
+ outlineno++;
+ }
+ }
+ printf("\n DPSMapNames(%s, %d, (char **) _dps_names, _dps_nameVals);\n",
+ ctxName, nNames);
+ outlineno += 2;
+ if (reentrant && writable && !doANSI) {
+ printf(" _dpsP = (DPSBinObjRec *) &_dpsF.obj0;\n");
+ outlineno++;
+ }
+ if (!doANSI) {
+ printf(" _dpsT = 0;\n");
+ outlineno ++;
+ }
+ printf(" }\n }\n\n");
+ outlineno += 3;
+} /* EmitNameTagAcquisition */
+
+
+/* Miscellaneous procedures */
+
+static void EmitLocals(unsigned sz)
+{
+ if(reentrant && writable) {
+ printf(" _dpsQ _dpsF; /* local copy */\n");
+ outlineno++;
+ }
+ if (ctxName == NULL) {
+ printf(" register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();\n");
+ ctxName = "_dpsCurCtxt";
+ outlineno++;
+ }
+ if(pad) {
+ printf(" char pad[3];\n");
+ outlineno++;
+ }
+ if (writable) {
+ printf(" register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;\n");
+ if(doANSI && nNames) {
+ printf(" static int _dpsCodes[%d] = {-1};\n",nNames);
+ outlineno++;
+ }
+ outlineno++;
+ if (namedInputArrays || namedInputStrings) {
+ printf(" register int _dps_offset = %d;\n",
+ twoStatics ? sz : sz + stringBytes);
+ outlineno++;
+ }
+ }
+}
+
+static boolean AllLiterals(Body body)
+{
+ Token t;
+
+ for (t = body; t; t = t->next) {
+ switch (t->type) {
+
+ case T_NAME:
+ if (t->namedFormal == NULL) return false;
+ break;
+
+ case T_ARRAY:
+ if (!AllLiterals((Body)t->val)) return false;
+ break;
+
+ case T_PROC:
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ case T_LITNAME:
+ case T_HEXSTRING:
+ case T_STRING:
+ case T_SUBSCRIPTED:
+ break;
+
+ default:
+ CantHappen();
+ } /* switch */
+ } /* for */
+ return true;
+} /* AllLiterals */
+
+static void FlattenSomeArrays(Body body, boolean inSquiggles)
+{
+ Token t;
+ for (t = body; t; t = t->next) {
+ switch (t->type) {
+
+ case T_ARRAY:
+ if (!AllLiterals((Body)t->val)) {
+ Token t1, b, tlsq, trsq;
+ char *s;
+ t1 = t->next;
+ b = (Body)t->val;
+ SafeStrCpy(s, "[");
+ tlsq = PSWToken(T_NAME, s);
+ SafeStrCpy(s, "]");
+ trsq = PSWToken(T_NAME, s);
+ tlsq->sourceLine = t->sourceLine;
+ trsq->sourceLine = t->sourceLine;
+ *t = *tlsq;
+ t->next = b;
+ trsq->next = t1;
+ if (b == NULL) t->next = trsq;
+ else {
+ Token last;
+ for (last = b; last->next; last = last->next) ;
+ last->next = trsq;
+ }
+ }
+ else FlattenSomeArrays((Body)t->val, inSquiggles);
+ break;
+
+ case T_PROC:
+ FlattenSomeArrays((Body)t->val, true);
+ /* flatten all arrays below here */
+ break;
+
+ case T_NAME:
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ case T_LITNAME:
+ case T_HEXSTRING:
+ case T_STRING:
+ case T_SUBSCRIPTED:
+ case T_NUMSTR:
+ case T_FLOATNUMSTR:
+ case T_LONGNUMSTR:
+ case T_SHORTNUMSTR:
+ break;
+
+ default:
+ CantHappen();
+ } /* switch */
+ } /* for */
+} /* FlattenSomeArrays */
+
+
+static void FixupOffsets(void)
+{
+ register TokenList tl; Token t;
+ register Item item;
+ int stringOffset = 0;
+ PSWDict wrapDict;
+ int strCount = 0;
+
+ wrapDict = CreatePSWDict(MAXSTRINGS); /* dictionary of wrap strings */
+
+ for (tl = namedInputArrays; tl; tl = tl->next) {
+ t = tl->token; item = t->namedFormal;
+ printf(" _dpsP[%d].val.arrayVal = _dps_offset;\n",t->tokenIndex);
+ printf(" _dps_offset += ");
+ if (item->subscript->constant)
+ printf("%d * sizeof(DPSBinObjGeneric);\n",item->subscript->val);
+ else
+ printf("%s * sizeof(DPSBinObjGeneric);\n",item->subscript->name);
+ outlineno += 2;
+ } /* named input arrays */
+
+ for (tl = namedInputStrings; tl; tl = tl->next) {
+ t = tl->token; item = t->namedFormal;
+ printf(" _dpsP[%d].val.stringVal = _dps_offset;\n",t->tokenIndex);
+ printf(" _dps_offset += ");
+ if (item->subscripted) {
+ if (item->subscript->constant) {
+ if(IsNumStrType(t->namedFormal->type)) {
+ if(pad & IsPadNumStrType(t->namedFormal->type))
+ printf("((%d * sizeof(%s)) + %d) & ~%d;\n",
+ item->subscript->val,TypeToText(t->namedFormal->type),
+ NUMSTR_HEADER_SIZE+WORD_ALIGN, WORD_ALIGN);
+ else
+ printf("(%d * sizeof(%s)) + %d;\n",
+ item->subscript->val,TypeToText(t->namedFormal->type),
+ NUMSTR_HEADER_SIZE);
+ } else
+ if(pad) {
+ int val = item->subscript->val;
+ val += WORD_ALIGN;
+ val &= ~WORD_ALIGN;
+ printf("%d;\n", val);
+ } else
+ printf("%d;\n",item->subscript->val);
+ } else {
+ if(IsNumStrType(t->namedFormal->type)) {
+ if(pad & IsPadNumStrType(t->namedFormal->type))
+ printf("((%s * sizeof(%s)) + %d) & ~%d;\n",
+ item->subscript->name,TypeToText(t->namedFormal->type),
+ NUMSTR_HEADER_SIZE+WORD_ALIGN, WORD_ALIGN);
+ else
+ printf("(%s * sizeof(%s)) + %d;\n",
+ item->subscript->name,TypeToText(t->namedFormal->type),
+ NUMSTR_HEADER_SIZE);
+ } else
+ if(pad)
+ printf("(%s + %d) & ~%d;\n",
+ item->subscript->name, WORD_ALIGN, WORD_ALIGN);
+ else
+ printf("%s;\n",item->subscript->name);
+ }
+ } else
+ if(pad)
+ printf("(_dpsP[%d].length + %d) & ~%d;\n",
+ t->tokenIndex, WORD_ALIGN, WORD_ALIGN);
+ else
+ printf("_dpsP[%d].length;\n",t->tokenIndex);
+ outlineno += 2;
+ } /* named input strings */
+
+ if (namedInputArrays) {
+ PSWDictValue strOffset;
+ for (tl = literalStrings; tl; tl = tl->next) {
+ t = tl->token;
+ strOffset = PSWDictLookup(wrapDict, (char *)t->val);
+ if (strOffset == -1) {
+ if (strCount <= MAXSTRINGS) {
+ PSWDictEnter(wrapDict, (char *)t->val, stringOffset);
+ strCount++;
+ }
+ if (stringOffset == 0)
+ printf(" _dpsP[%d].val.stringVal = _dps_offset;\n",
+ t->tokenIndex);
+ else
+ printf(" _dpsP[%d].val.stringVal = _dps_offset + %d;\n",
+ t->tokenIndex,stringOffset);
+ outlineno++;
+ stringOffset +=
+ (t->type == T_STRING || t->type == T_NAME || t->type == T_LITNAME)
+ ? PSWStringLength((char *)t->val)
+ : PSWHexStringLength((char *)t->val);
+ } else {
+ if (strOffset == 0)
+ printf(" _dpsP[%d].val.stringVal = _dps_offset;\n",
+ t->tokenIndex);
+ else
+ printf(" _dpsP[%d].val.stringVal = _dps_offset + %d;\n",
+ t->tokenIndex, (int) strOffset);
+ outlineno++;
+ }
+ } /* literalStrings */
+ if (stringOffset) {
+ printf(" _dps_offset += %d;\n",stringOffset);
+ outlineno++;
+ }
+ }
+ DestroyPSWDict(wrapDict);
+} /* FixupOffsets */
+
+
+static int EmitValueAssignments(Body body, Item item)
+{
+ register Token t;
+ int gotit = 0;
+
+ for (t = body; t; t = t->next) {
+ switch (t->type) {
+ case T_STRING:
+ case T_HEXSTRING:
+ case T_LITNAME:
+ if (t->namedFormal && t->namedFormal == item) {
+ printf("\n _dpsP[%d].length =",t->tokenIndex);
+ outlineno++;
+ gotit++;
+ }
+ break;
+ case T_NAME:
+ if (t->namedFormal && t->namedFormal == item) {
+ if ((item->subscripted && !item->subscript->constant) ||
+ (item->starred && IsCharType(item->type)) ||
+ IsNumStrType(item->type)) {
+ printf("\n _dpsP[%d].length =",t->tokenIndex);
+ outlineno++;
+ gotit++;
+ }
+ switch (item->type) {
+ case T_BOOLEAN:
+ if (!item->subscripted) {
+ printf("\n _dpsP[%d].val.booleanVal =",
+ t->tokenIndex);
+ gotit++; outlineno++;
+ }
+ break;
+ case T_INT:
+ case T_LONGINT:
+ case T_SHORTINT:
+ case T_UINT:
+ case T_ULONGINT:
+ case T_USHORTINT:
+ case T_USEROBJECT:
+ if (!item->subscripted) {
+ printf("\n _dpsP[%d].val.integerVal =",
+ t->tokenIndex);
+ gotit++; outlineno++;
+ }
+ break;
+ case T_FLOAT:
+ case T_DOUBLE:
+ if (!item->subscripted) {
+ printf("\n _dpsP[%d].val.realVal =",
+ t->tokenIndex);
+ gotit++; outlineno++;
+ }
+ break;
+ case T_CHAR:
+ case T_UCHAR: /* the executable name is an arg */
+ case T_NUMSTR:
+ case T_FLOATNUMSTR:
+ case T_LONGNUMSTR:
+ case T_SHORTNUMSTR:
+ break;
+ default: CantHappen();
+ }
+ }
+ break;
+
+ case T_SUBSCRIPTED:
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ break;
+
+ case T_ARRAY:
+ case T_PROC:
+ /* recurse */
+ gotit += EmitValueAssignments((Body) (t->val),item);
+ break;
+ default:
+ CantHappen();
+ } /* switch */
+ } /* token */
+ return (gotit);
+} /* EmitValueAssignments */
+
+
+static void EmitElementValueAssignments(Body body, Item item)
+{
+ register Token t;
+
+ for (t = body; t; t = t->next) {
+ if (t->type != T_SUBSCRIPTED) continue;
+ if (t->namedFormal == item) {
+ switch (item->type) {
+ case T_BOOLEAN:
+ printf("\n _dpsP[%d].val.booleanVal = (int)(0 != %s[%s]);",
+ t->tokenIndex, item->name, t->body.var);
+ outlineno++;
+ break;
+ case T_INT:
+ case T_LONGINT:
+ case T_SHORTINT:
+ case T_UINT:
+ case T_ULONGINT:
+ case T_USHORTINT:
+ printf("\n _dpsP[%d].val.integerVal = %s[%s];",
+ t->tokenIndex, item->name, t->body.var);
+ outlineno++;
+ break;
+ case T_FLOAT:
+ case T_DOUBLE:
+ printf("\n _dpsP[%d].val.realVal = %s[%s];",
+ t->tokenIndex, item->name, t->body.var);
+ outlineno++;
+ break;
+ case T_CHAR:
+ case T_UCHAR:
+ CantHappen();
+ break;
+ default: CantHappen();
+ }
+ }
+ } /* token */
+} /* EmitElementValueAssignments */
+
+
+static void ScanParamsAndEmitValues(Body body, Args args)
+{
+ register Arg arg; /* a list of parameters */
+ register Item item; /* a parameter */
+ int gotit; /* flag that we found some token with this length */
+
+ /* for each arg */
+ for (arg = args; arg; arg = arg->next) {
+ /* for each arg item */
+ for (item = arg->items; item; item = item->next) {
+ if (item->type == T_CONTEXT) continue;
+ gotit = EmitValueAssignments(body,item);
+ if (gotit != 0) {
+ if (item->subscripted) {
+ if (item->subscript->constant) {
+ if(IsNumStrType(item->type))
+ printf(" (%d * sizeof(%s)) + %d;",item->subscript->val,
+ TypeToText(item->type), NUMSTR_HEADER_SIZE);
+ else
+ printf(" %d;",item->subscript->val);
+ } else {
+ if(IsNumStrType(item->type))
+ printf(" (%s * sizeof(%s)) + %d;",item->subscript->name,
+ TypeToText(item->type), NUMSTR_HEADER_SIZE);
+ else
+ printf(" %s;",item->subscript->name);
+ }
+ } else switch(item->type) {
+ case T_CHAR:
+ case T_UCHAR:
+ printf(" strlen(%s);",item->name);
+ break;
+ case T_INT:
+ case T_LONGINT:
+ case T_SHORTINT:
+ case T_UINT:
+ case T_ULONGINT:
+ case T_USHORTINT:
+ case T_FLOAT:
+ case T_DOUBLE:
+ case T_USEROBJECT:
+ printf(" %s;",item->name);
+ break;
+ case T_BOOLEAN:
+ printf(" (int) (0 != %s);",item->name);
+ break;
+ default: CantHappen();
+ } /* switch */
+ } /* gotit */
+ if (item->subscripted) {
+ EmitElementValueAssignments(body,item);
+ }
+ } /* item */
+ } /* arg */
+ printf("\n"); outlineno++;
+}
+
+static void EmitMappedNames(void)
+{
+register TokenList n;
+int i=0;
+ for (n = nameTokens; n!= NULL; n = n->next) {
+ printf(" _dpsP[%d].val.nameVal = _dpsCodes[%d];\n",
+ n->token->tokenIndex, i++);
+ outlineno++;
+ }
+}
+
+static void WriteObjSeq(unsigned sz)
+{
+ register TokenList tl;
+
+ printf(" DPSBinObjSeqWrite(%s,(char *) &_dpsF,%d);\n",
+ ctxName, (twoStatics ? sz : sz + stringBytes) + dpsHeaderSize);
+ outlineno++;
+
+ for (tl = namedInputArrays; tl; tl = tl->next) {
+ Token t = tl->token;
+ printf(" DPSWriteTypedObjectArray(%s, %s, (char *)%s, ",
+ ctxName,
+ CTypeToResultType(t->namedFormal->type),
+ t->namedFormal->name);
+ if (t->namedFormal->subscript->constant)
+ printf("%d);\n", t->namedFormal->subscript->val);
+ else
+ printf("%s);\n", t->namedFormal->subscript->name);
+ outlineno++;
+ }
+
+ for (tl = namedInputStrings; tl; tl = tl->next) {
+ Token t = tl->token;
+ if(IsNumStrType(t->namedFormal->type)) {
+ printf(" DPSWriteNumString(%s, %s, (char *) %s, ", ctxName,
+ CTypeToResultType(t->namedFormal->type), t->namedFormal->name);
+ if (t->namedFormal->subscript->constant)
+ printf("%d, ", t->namedFormal->subscript->val);
+ else
+ printf("%s, ", t->namedFormal->subscript->name);
+ if (t->namedFormal->scaled) {
+ if (t->namedFormal->scale->constant)
+ printf("%d);\n", t->namedFormal->scale->val);
+ else
+ printf("%s);\n", t->namedFormal->scale->name);
+ } else printf("0);\n");
+ outlineno ++;
+ } else {
+ printf(" DPSWriteStringChars(%s, (char *)%s, ",
+ ctxName, t->namedFormal->name);
+ if (!t->namedFormal->subscripted) {
+ printf("_dpsP[%d].length);\n", t->tokenIndex);
+ if(pad) {
+ printf(" DPSWriteStringChars(%s, (char *)pad, ~(_dpsP[%d].length + %d) & %d);\n",
+ ctxName,t->tokenIndex,WORD_ALIGN,WORD_ALIGN);
+ outlineno ++;
+ }
+ } else
+ if (t->namedFormal->subscript->constant) {
+ int val = t->namedFormal->subscript->val;
+ printf("%d);\n", val);
+ if(pad){
+ val = ~(val + WORD_ALIGN) & WORD_ALIGN;
+ if(val) {
+ printf(" DPSWriteStringChars(%s, (char *)pad, %d);\n",
+ ctxName,val);
+ outlineno ++;
+ }
+ }
+ } else {
+ printf("%s);\n", t->namedFormal->subscript->name);
+ if(pad) {
+ printf(" DPSWriteStringChars(%s, (char *)pad, ~(%s + %d) & %d);\n",
+ ctxName,t->namedFormal->subscript->name,
+ WORD_ALIGN,WORD_ALIGN);
+ outlineno ++;
+ }
+ }
+ outlineno ++;
+ }
+ }
+
+ if (twoStatics) {
+ printf(" DPSWriteStringChars(%s,(char *) &_dpsF1,%d);\n",
+ ctxName,stringBytes);
+ outlineno++;
+ }
+} /* WriteObjSeq */
+
+
+/*************************************************************/
+/* Public procedures, called by the semantic action routines */
+
+void EmitPrototype(Header hdr)
+{
+ /* emit procedure prototype to the output .h file, if any */
+
+ fprintf(header, "\n");
+ fprintf(header, "extern void %s(", hdr->name);
+ if (doANSI) EmitANSIPrototypes(header, hdr);
+ else if (hdr->inArgs || hdr->outArgs) {
+ fprintf(header, " /* ");
+ EmitArgPrototypes(header, hdr);
+ fprintf(header, "*/ ");
+ }
+ fprintf(header, ");\n");
+}
+
+void EmitBodyHeader(Header hdr)
+{
+ /* emit procedure header */
+ register Arg arg;
+ register Item item;
+
+ nameTokens = NULL;
+ nNames = 0;
+ ctxName = NULL;
+
+ if (hdr->isStatic) printf("static ");
+ printf("void %s(", hdr->name);
+
+ if (doANSI) {
+ EmitANSIPrototypes(stdout,hdr);
+ printf(")\n");
+ outlineno++;
+ }
+ else { /* not ANSI */
+ for (arg = hdr->inArgs; arg; arg = arg->next) {
+ for (item = arg->items; item; item = item->next) {
+ if (arg->type == T_CONTEXT) ctxName = item->name;
+ printf(item->name);
+ if (item->next) printf(", ");
+ }
+ if (arg->next || hdr->outArgs) printf(", ");
+ } /* inArgs */
+ for (arg = hdr->outArgs; arg; arg = arg->next) {
+ for (item = arg->items; item; item = item->next) {
+ printf(item->name);
+ if (item->next) printf(", ");
+ }
+ if (arg->next) printf(", ");
+ } /* outArgs */
+ printf(")\n"); outlineno++;
+ if (hdr->inArgs || hdr->outArgs) {
+ EmitArgPrototypes(stdout, hdr);
+ printf("\n");
+ outlineno++;
+ }
+ }
+} /* EmitBodyHeader */
+
+void EmitBody(Tokens body, Header hdr)
+{
+ Args arg, outArgs = hdr->outArgs;
+ Item item;
+ long int nObjs;
+ unsigned structSize;
+ /* total number of objects plus string bodies in objrecs.
+ Not including array arg expansions */
+ Adr sizeAdr;
+
+ if(NumTokens(body) == 0)
+ return; /* empty wrap */
+
+ if (outArgs) body = AppendResultFlush(body, NumArgs(outArgs));
+
+ FlattenSomeArrays(body, false);
+
+ if ((large = (((NumTokens(body) > 0xff)) || CheckSize(body))) != 0)
+ dpsHeaderSize = DPS_LONG_HEADER_SIZE;
+ else
+ dpsHeaderSize = DPS_HEADER_SIZE;
+
+ /* check for char * input args */
+ for (arg = hdr->inArgs; arg && !large; arg = arg->next) {
+ for (item = arg->items; item; item = item->next) {
+ if ((arg->type == T_CHAR) && item->starred) {
+ /* if arg is char * then need to use large format since
+ size of arg is unknown */
+ large = true;
+ dpsHeaderSize = DPS_LONG_HEADER_SIZE;
+ }
+ }
+ }
+
+ BuildTypesAndAssignAddresses(body, &sizeAdr, &nObjs, &structSize);
+ /* also constructs namedInputArrays, namedInputStrings and literalStrings */
+
+ ConstructStatics(body, &sizeAdr, nObjs);
+
+ EmitLocals(structSize);
+
+ if (outArgs) EmitResultTagTableDecls(outArgs);
+
+ if (nameTokens) {
+ EmitNameTagAcquisition();
+ }
+
+ if(reentrant && writable) {
+ printf(" _dpsF = _dpsStat; /* assign automatic variable */\n");
+ outlineno++;
+ }
+ if(writable) {
+ ScanParamsAndEmitValues(body,hdr->inArgs);
+ }
+
+ if(doANSI && nameTokens) {
+ EmitMappedNames();
+ FreeTokenList(nameTokens);
+ nameTokens = NULL;
+ }
+
+ /* Fixup offsets and the total size */
+
+ if (writable && (namedInputArrays || namedInputStrings)) {
+ FixupOffsets();
+ printf("\n _dpsF.nBytes = _dps_offset+%d;\n", dpsHeaderSize);
+ outlineno += 2;
+ }
+
+ if (outArgs) EmitResultTagTableAssignments(outArgs);
+
+ WriteObjSeq(structSize);
+
+ FreeTokenList(namedInputArrays); namedInputArrays = NULL;
+ FreeTokenList(namedInputStrings); namedInputStrings = NULL;
+ FreeTokenList(literalStrings); literalStrings = NULL;
+
+ if (outArgs)
+ printf(" DPSAwaitReturnValues(%s);\n", ctxName);
+ else
+ printf(" DPSSYNCHOOK(%s)\n", ctxName);
+ outlineno++;
+
+#ifdef NeXT
+ if (pad) {
+ printf(" if (0) *pad = 0; /* quiets compiler warnings */\n"); /* gets rid of "unused variable" warnings */
+ outlineno++;
+ }
+#endif
+} /* EmitBody */
+
+static void AllocFailure(void)
+{
+ ErrIntro(yylineno);
+ fprintf(stderr, "pswrap is out of storage; ");
+ if (bigFile)
+ fprintf(stderr, "try splitting the input file\n");
+ else
+ fprintf(stderr, "try -b switch\n");
+ exit(1);
+}
+
+char *psw_malloc(s) int s; {
+ char *temp;
+ if ((temp = malloc((unsigned) s)) == NULL)
+ AllocFailure();
+ return(temp);
+}
+
+char *psw_calloc(n,s) int n,s; {
+ char *temp;
+ if ((temp = calloc((unsigned) n, (unsigned) s)) == NULL)
+ AllocFailure();
+ return(temp);
+}
+
+void
+FreeBody(body) Body body; {
+ register Token t, nexttoken;
+
+ for (t = body; t; t = nexttoken) {
+ nexttoken = t->next;
+ if (t->adr.var) free(t->adr.var);
+ switch (t->type) {
+ case T_STRING:
+ case T_NAME:
+ case T_LITNAME:
+ case T_HEXSTRING:
+ free (t->val);
+ break;
+ case T_FLOAT:
+ case T_INT:
+ case T_BOOLEAN:
+ break;
+ case T_SUBSCRIPTED:
+ free (t->val); free(t->body.var);
+ break;
+ case T_ARRAY:
+ case T_PROC:
+ FreeBody((Body) (t->val));
+ break;
+ default:
+ CantHappen();
+ }
+ free (t);
+ }
+}
diff --git a/nx-X11/config/pswrap/psw.h b/nx-X11/config/pswrap/psw.h
new file mode 100644
index 000000000..612fb5db4
--- /dev/null
+++ b/nx-X11/config/pswrap/psw.h
@@ -0,0 +1,92 @@
+/*
+ * psw.h
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+#ifndef PSW_H
+#define PSW_H
+
+/* C types */
+
+#define T_BOOLEAN 101
+#define T_FLOAT 102
+#define T_DOUBLE 103
+#define T_CHAR 104
+#define T_UCHAR 105
+#define T_INT 106
+#define T_UINT 107
+#define T_LONGINT 108
+#define T_SHORTINT 109
+#define T_ULONGINT 110
+#define T_USHORTINT 111
+#define T_USEROBJECT 112
+#define T_NUMSTR 113
+#define T_FLOATNUMSTR 114
+#define T_LONGNUMSTR 115
+#define T_SHORTNUMSTR 116
+
+
+/* PostScript types */
+
+#define T_STRING 91
+#define T_HEXSTRING 92
+#define T_NAME 93
+#define T_LITNAME 94
+#define T_ARRAY 95
+#define T_PROC 96
+#define T_CONTEXT 97
+#define T_SUBSCRIPTED 98
+
+/* Other PostScript types:
+
+ T_FLOAT is used for real
+ T_INT is used for integer
+ T_BOOLEAN is used for boolean
+ T_USEROBJECT is used for userobjects
+
+*/
+
+/* psw.c */
+extern char *psw_malloc(int);
+extern char *psw_calloc(int, int);
+
+/* pswstring.c */
+extern int PSWStringLength(char *);
+extern int PSWHexStringLength(char *);
+extern void PSWOutputStringChars(char *);
+extern void PSWOutputHexStringChars(char *);
+
+#endif /* PSW_H */
diff --git a/nx-X11/config/pswrap/pswdict.c b/nx-X11/config/pswrap/pswdict.c
new file mode 100644
index 000000000..3c72fbeea
--- /dev/null
+++ b/nx-X11/config/pswrap/pswdict.c
@@ -0,0 +1,180 @@
+/*
+ * pswdict.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+/***********/
+/* Imports */
+/***********/
+
+#include <stdlib.h>
+
+#include "pswtypes.h"
+#include "pswdict.h"
+#include "psw.h"
+
+#ifdef XENVIRONMENT
+#include <X11/Xos.h>
+#else
+#include <string.h>
+#endif
+
+/********************/
+/* Types */
+/********************/
+
+typedef struct _t_EntryRec {
+ struct _t_EntryRec *next;
+ char *name;
+ PSWDictValue value;
+} EntryRec, *Entry;
+
+ /* The concrete definition for a dictionary */
+typedef struct _t_PSWDictRec {
+ int nEntries;
+ Entry *entries;
+} PSWDictRec;
+
+PSWDict atoms;
+
+/**************************/
+/* Procedure Declarations */
+/**************************/
+
+/* Creates and returns a new dictionary. nEntries is a hint. */
+PSWDict CreatePSWDict(int nEntries)
+{
+ PSWDict d = (PSWDict)psw_calloc(sizeof(PSWDictRec), 1);
+ d->nEntries = nEntries;
+ d->entries = (Entry *)psw_calloc(sizeof(EntryRec), d->nEntries);
+ return d;
+}
+
+/* Destroys a dictionary */
+void DestroyPSWDict(PSWDict dict)
+{
+ free(dict->entries);
+ free(dict);
+}
+
+static int Hash(char *name, int nEntries)
+{
+ register int val = 0;
+ while (*name) val += *name++;
+ if (val < 0) val = -val;
+ return (val % nEntries);
+}
+
+static Entry Probe(PSWDict d, int x, char *name)
+{
+ register Entry e;
+ for (e = (d->entries)[x]; e; e = e->next) {
+ if (strcmp(name, e->name) == 0) break;
+ }
+ return e;
+}
+
+static Entry PrevProbe(Entry *prev, PSWDict d, int x, char *name)
+{
+ register Entry e;
+ *prev = NULL;
+ for (e = (d->entries)[x]; e; e = e->next) {
+ if (strcmp(name, e->name) == 0) break;
+ *prev = e;
+ }
+ return e;
+}
+
+/* -1 => not found */
+PSWDictValue PSWDictLookup(PSWDict dict, char *name)
+{
+ Entry e;
+ e = Probe(dict, Hash(name, dict->nEntries), name);
+ if (e == NULL) return -1;
+ return e->value;
+}
+
+/* 0 => normal return (not found)
+ -1 => found. If found, value is replaced. */
+PSWDictValue PSWDictEnter(PSWDict dict, char *name, PSWDictValue value)
+{
+ Entry e;
+ int x = Hash(name, dict->nEntries);
+ e = Probe(dict, x, name);
+ if (e) {
+ e->value = value;
+ return -1;
+ }
+ e = (Entry)psw_calloc(sizeof(EntryRec), 1);
+ e->next = (dict->entries)[x]; (dict->entries)[x] = e;
+ e->value = value;
+ e->name = MakeAtom(name);
+ return 0;
+}
+
+/* -1 => not found. If found, value is returned. */
+PSWDictValue PSWDictRemove(PSWDict dict, char *name)
+{
+ Entry e, prev;
+ PSWDictValue value;
+ int x = Hash(name, dict->nEntries);
+
+ e = PrevProbe(&prev, dict, x, name);
+ if (e == NULL) return -1;
+ value = e->value;
+ if (prev == NULL) (dict->entries)[x] = e->next; else prev->next = e->next;
+ free(e);
+ return value;
+}
+
+PSWAtom MakeAtom(char *name)
+{
+ Entry e;
+ int x = Hash(name, 511);
+ char *newname;
+
+ if (atoms == NULL) atoms = CreatePSWDict(511);
+ e = Probe(atoms, x, name);
+ if (e == NULL) {
+ e = (Entry)psw_calloc(sizeof(EntryRec), 1);
+ e->next = (atoms->entries)[x]; (atoms->entries)[x] = e;
+ e->value = 0;
+ newname = psw_malloc(strlen(name)+1);
+ strcpy(newname, name);
+ e->name = newname;
+ }
+ return e->name;
+}
diff --git a/nx-X11/config/pswrap/pswdict.h b/nx-X11/config/pswrap/pswdict.h
new file mode 100644
index 000000000..dcbfbb13b
--- /dev/null
+++ b/nx-X11/config/pswrap/pswdict.h
@@ -0,0 +1,76 @@
+/*
+ * pswdict.h
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+#ifndef PSWDICT_H
+#define PSWDICT_H
+
+typedef struct _t_PSWDictRec *PSWDict;
+/* Opaque designator for a dictionary */
+
+typedef long int PSWDictValue; /* non-negative */
+typedef char *PSWAtom;
+
+/* PROCEDURES */
+
+/* NOTES
+ The name parameters defined below are NULL-terminated C strings.
+ None of the name parameters are handed off, i.e. the caller is
+ responsible for managing their storage. */
+
+extern PSWDict CreatePSWDict(int /* nEntries */);
+/* nEntries is a hint. Creates and returns a new dictionary */
+
+extern void DestroyPSWDict(PSWDict /* dict */);
+/* Destroys a dictionary */
+
+extern PSWDictValue PSWDictLookup(PSWDict /* dict */, char * /* name */);
+/* -1 => not found. */
+
+extern PSWDictValue PSWDictEnter
+ (PSWDict /* dict */, char * /* name */, PSWDictValue /* value */);
+/* 0 => normal return (not found)
+ -1 => found. If found, the old value gets replaced with the new one. */
+
+extern PSWDictValue PSWDictRemove(PSWDict /* dict */, char * /* name */);
+/* -1 => not found. If found, value is returned. */
+
+extern PSWAtom MakeAtom(char * /* name */);
+
+extern PSWDict wellKnownPSNames;
+
+#endif /* PSWDICT_H */
diff --git a/nx-X11/config/pswrap/pswfile.c b/nx-X11/config/pswrap/pswfile.c
new file mode 100644
index 000000000..e4f24a641
--- /dev/null
+++ b/nx-X11/config/pswrap/pswfile.c
@@ -0,0 +1,87 @@
+/*
+ * pswfile.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86: xc/config/pswrap/pswfile.c,v 1.5tsi Exp $ */
+
+#include <stdio.h>
+#include "pswversion.h"
+#include "pswpriv.h"
+
+#ifdef __MACH__
+extern char *shlibInclude;
+#endif /* __MACH__ */
+
+static int EmitVersion(FILE *f, char *infname, char *outfname)
+{
+ fprintf(f,"/* %s generated from %s\n",outfname,infname);
+ fprintf(f," by %s %s %s\n */\n\n",PSW_OS,prog,PSW_VERSION);
+ return 4; /* number of output lines */
+}
+
+void InitHFile(void)
+{
+ (void) EmitVersion(header, ifile, hfile);
+ fprintf(header,"#ifndef %s\n#define %s\n",headid,headid);
+}
+
+void FinishHFile(void)
+{
+ fprintf(header,"\n#endif /* %s */\n",headid);
+ fclose(header);
+}
+
+void InitOFile(void)
+{
+ outlineno += EmitVersion(stdout, ifile, ofile);
+#ifdef __MACH__
+ if( shlibInclude ) {
+ printf("#ifdef SHLIB\n");
+ printf("#include \"%s\"\n", shlibInclude );
+ printf("#endif\n");
+ outlineno += 3;
+ }
+#endif /* __MACH__ */
+ printf("#include %s\n", FRIENDSFILE);
+ printf("#include <string.h>\n");
+ outlineno += 3; /* UPDATE this if you add more prolog */
+ if (special_h) {
+ printf("#include \"%s\"\n\n", special_h);
+ outlineno ++;
+ }
+ printf("#line 1 \"%s\"\n",ifile);
+ outlineno++;
+}
diff --git a/nx-X11/config/pswrap/pswparser.y b/nx-X11/config/pswrap/pswparser.y
new file mode 100644
index 000000000..795113947
--- /dev/null
+++ b/nx-X11/config/pswrap/pswparser.y
@@ -0,0 +1,278 @@
+/*
+ * pswparser.y
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86: xc/config/pswrap/pswparser.y,v 1.4 2000/05/18 23:46:08 dawes Exp $ */
+
+/*
+ * Not all yaccs understand this.
+ *
+%expect 1
+ */
+
+%{
+
+#include "pswpriv.h"
+#include "pswsemantics.h"
+
+%}
+
+/* yylval type (from lexer and on stack) */
+
+%union {
+ char *object;
+ long intobj;
+ Token token;
+ Item item;
+ Header header;
+ int flag;
+ Arg arg;
+ Subscript subscript;
+}
+
+
+%token <object> DEFINEPS ENDPS STATIC
+%token <object> PSCONTEXT
+%token <object> BOOLEAN FLOAT DOUBLE UNSIGNED SHORT LONG INT CHAR USEROBJECT
+%token <object> NUMSTRING
+%token <object> CNAME
+%token <intobj> CINTEGER
+
+%token <object> PSNAME PSLITNAME PSREAL PSBOOLEAN PSSTRING PSHEXSTRING
+%token <intobj> PSINTEGER
+%token <object> PSSUBNAME PSINDEX
+
+%token <object> '(' ')' '|' ';' ',' '*' '[' ']' '{' '}' ':'
+
+%type <token> Token Tokens Body
+%type <item> Items Item
+%type <header> Header
+%type <flag> Def Type
+%type <arg> InArgs Args ContextArg SubArgs Arg
+%type <subscript> Subscript
+
+%start Module
+
+%%
+
+Module:
+ /* empty */
+ | Module Definition
+ ;
+
+Definition:
+ Header Body ENDPS
+ { FinalizePSWrapDef($1, $2); yyerrok; }
+ | error ENDPS
+ { yyerrok; }
+ ;
+
+Body:
+ /* nothing */
+ { $$ = 0; }
+ | Tokens
+ /* { $$ = $1; }*/
+ ;
+
+Tokens:
+ Token
+ { $$ = AppendPSWToken($1, 0L); }
+ | Tokens Token
+ { $$ = AppendPSWToken($2, $1); yyerrok; }
+ /* | error
+ { $$ = 0; } */
+ ;
+
+Header:
+ Def ')'
+ { $$ = PSWHeader($1, 0, 0); yyerrok; }
+ | Def InArgs ')'
+ { $$ = PSWHeader($1, $2, 0); yyerrok; }
+ | Def InArgs '|' Args ')'
+ { $$ = PSWHeader($1, $2, $4); yyerrok; }
+ | Def '|' Args ')'
+ { $$ = PSWHeader($1, 0, $3); yyerrok; }
+ ;
+
+Def:
+ DEFINEPS CNAME '('
+ { PSWName($2); $$ = 0; yyerrok; }
+ | DEFINEPS STATIC CNAME '('
+ { PSWName($3); $$ = 1; yyerrok; }
+ | DEFINEPS error '('
+ { PSWName("error"); $$ = 0; yyerrok; }
+ ;
+
+Semi:
+ /* nothing */
+ | ';' { yyerrok; }
+ ;
+
+InArgs:
+ ContextArg Semi
+ /* { $$ = $1; } */
+ | Args
+ /* { $$ = $1; } */
+ | ContextArg ';' Args
+ { $$ = ConsPSWArgs($1, $3); }
+ ;
+
+ContextArg:
+ PSCONTEXT CNAME
+ { $$ = PSWArg(T_CONTEXT, PSWItem($2)); }
+ ;
+
+Args:
+ SubArgs Semi
+ /* { $$ = $1; }*/
+ ;
+
+SubArgs:
+ Arg
+ /* { $$ = $1; }*/
+ | SubArgs ';' Arg
+ { yyerrok; $$ = AppendPSWArgs($3, $1); }
+ | SubArgs error
+ | SubArgs error Arg
+ { yyerrok; $$ = AppendPSWArgs($3, $1); }
+ | SubArgs ';' error
+ ;
+
+Arg: Type Items
+ { $$ = PSWArg($1, $2); yyerrok; }
+ ;
+
+Items:
+ Item
+ /* { $$ = $1; } */
+ | Items ',' Item
+ { yyerrok; $$ = AppendPSWItems($3, $1); }
+ | error { $$ = 0; }
+ | Items error
+ | Items error Item
+ { yyerrok; $$ = AppendPSWItems($3, $1); }
+ | Items ',' error
+ ;
+
+Item:
+ '*' CNAME
+ { $$ = PSWStarItem($2); }
+ | CNAME '[' Subscript ']'
+ { $$ = PSWSubscriptItem($1, $3); }
+ | CNAME '[' Subscript ']' ':' CNAME
+ { $$ = PSWScaleItem($1, $3, $6, 0); }
+ | CNAME '[' Subscript ']' ':' CINTEGER
+ { $$ = PSWScaleItem($1, $3, NULL, $6); }
+ | CNAME
+ { $$ = PSWItem($1); }
+ ;
+
+Subscript:
+ CNAME
+ { $$ = PSWNameSubscript($1); }
+ | CINTEGER
+ { $$ = PSWIntegerSubscript($1); }
+ ;
+
+Type:
+ BOOLEAN
+ { $$ = T_BOOLEAN; }
+ | FLOAT
+ { $$ = T_FLOAT; }
+ | DOUBLE
+ { $$ = T_DOUBLE; }
+ | CHAR
+ { $$ = T_CHAR; }
+ | UNSIGNED CHAR
+ { $$ = T_UCHAR; }
+ | INT
+ { $$ = T_INT; }
+ | LONG INT
+ { $$ = T_LONGINT; }
+ | LONG
+ { $$ = T_LONGINT; }
+ | SHORT INT
+ { $$ = T_SHORTINT; }
+ | SHORT
+ { $$ = T_SHORTINT; }
+ | UNSIGNED
+ { $$ = T_UINT; }
+ | UNSIGNED LONG
+ { $$ = T_ULONGINT; }
+ | UNSIGNED INT
+ { $$ = T_UINT; }
+ | UNSIGNED LONG INT
+ { $$ = T_ULONGINT; }
+ | UNSIGNED SHORT
+ { $$ = T_USHORTINT; }
+ | UNSIGNED SHORT INT
+ { $$ = T_USHORTINT; }
+ | USEROBJECT
+ { $$ = T_USEROBJECT; }
+ | NUMSTRING
+ { $$ = T_NUMSTR; }
+ | INT NUMSTRING
+ { $$ = T_NUMSTR; }
+ | FLOAT NUMSTRING
+ { $$ = T_FLOATNUMSTR; }
+ | LONG NUMSTRING
+ { $$ = T_LONGNUMSTR; }
+ | SHORT NUMSTRING
+ { $$ = T_SHORTNUMSTR; }
+ ;
+
+Token:
+ PSINTEGER
+ { $$ = PSWToken(T_INT, (char *)$1); }
+ | PSREAL
+ { $$ = PSWToken(T_FLOAT, $1); }
+ | PSBOOLEAN
+ { $$ = PSWToken(T_BOOLEAN, $1); }
+ | PSSTRING
+ { $$ = PSWToken(T_STRING, $1); }
+ | PSHEXSTRING
+ { $$ = PSWToken(T_HEXSTRING, $1); }
+ | PSNAME
+ { $$ = PSWToken(T_NAME, $1); }
+ | PSLITNAME
+ { $$ = PSWToken(T_LITNAME, $1); }
+ | PSSUBNAME PSINDEX
+ { $$ = PSWToken2(T_SUBSCRIPTED, $1, $2); }
+ | '[' Body ']'
+ { $$ = PSWToken(T_ARRAY, (char *)$2); }
+ | '{' Body '}'
+ { $$ = PSWToken(T_PROC, (char *)$2); }
+ ;
diff --git a/nx-X11/config/pswrap/pswpriv.h b/nx-X11/config/pswrap/pswpriv.h
new file mode 100644
index 000000000..18f1cb97b
--- /dev/null
+++ b/nx-X11/config/pswrap/pswpriv.h
@@ -0,0 +1,177 @@
+/*
+ * pswpriv.h
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86: xc/config/pswrap/pswpriv.h,v 1.6 2000/06/07 21:58:25 tsi Exp $ */
+
+#ifndef PSWPRIV_H
+#define PSWPRIV_H
+
+#include <stdio.h>
+
+#include "pswtypes.h"
+#include "psw.h"
+
+/********************/
+/* Types */
+/********************/
+
+typedef struct _t_ItemRec *Item;
+/* Forward type designator */
+
+typedef struct {
+ boolean constant;
+ int val; /* valid if constant */
+ char *name; /* valid if not constant */
+ } SubscriptRec, *Subscript, ScaleRec, *Scale;
+
+typedef int Type;
+
+typedef struct _t_ItemRec { /* see above */
+ struct _t_ItemRec *next;
+ char *name;
+ boolean starred, subscripted, scaled;
+ Subscript subscript; /* valid if subscripted */
+ Scale scale;
+
+ /* the fields below are filled in by PSWHeader */
+ boolean isoutput; /* true if this is an output parameter */
+ long int tag; /* valid if output is true; the index of
+ this output parameter. starting from 0. */
+ Type type; /* copied from parent Arg */
+ int sourceLine;
+ } ItemRec;
+
+typedef Item Items;
+
+typedef struct _t_ArgRec {
+ struct _t_ArgRec *next;
+ Type type;
+ Items items;
+ } ArgRec, *Arg;
+
+typedef Arg Args;
+
+typedef struct {
+ boolean isStatic;
+ char *name;
+ Args inArgs, outArgs;
+ } HeaderRec, *Header;
+
+typedef struct {
+ long cnst;
+ char *var;
+ } Adr, *PAdr;
+
+typedef struct _t_TokenRec {
+ struct _t_TokenRec *next;
+ Type type;
+ Adr adr; /* of this token in the binary object sequence. */
+ char *val; /* loopholed */
+ int tokenIndex;
+ boolean wellKnownName; /* valid if type is T_NAME or T_LITNAME */
+ int sourceLine;
+ Item namedFormal;
+ /* non-NIL if this token is a reference to a formal.
+ (T_STRING, T_HEXSTRING, T_NAME, and T_LITNAME) */
+ Adr body;
+ /* Meaning depends on the token type, as follows:
+ simple => unused
+ array or proc => adr of body in binobjseq
+ string or hexstring => adr of body in binobjseq
+ name or litname => adr of namestring or array in binobjseq (named arg)
+ or cnst = the nametag (well-known name)
+ or cnst = 0 (name index filled in at runtime)
+ subscripted => index for element
+ */
+} TokenRec, *Token;
+
+typedef Token Tokens;
+
+typedef Tokens Body;
+
+typedef struct _t_TokenListRec {
+ struct _t_TokenListRec *next;
+ Token token;
+ } TokenListRec, *TokenList;
+
+extern FILE *header;
+extern boolean noUserNames; /* -n flag */
+extern char *currentPSWName;
+extern char *hfile;
+extern char *ifile; /* input file name for error messages */
+extern char *ofile;
+extern char *prog;
+extern char *special_h; /* -f option */
+extern char *string_temp; /* buffer of that size for scanning strings */
+extern char headid[];
+extern int bigFile;
+extern int doANSI; /* -a flag */
+extern int maxstring; /* max PS string length to scan (-s) */
+extern int lexdebug; /* debug flag for lexer */
+extern int errorCount; /* non-fatal errs */
+extern int outlineno; /* line number in output file */
+extern int pad; /* -p flag */
+extern int reentrant;
+extern int reportedPSWName;
+extern int yylineno; /* current line number in pswrap source file */
+
+/* lexer.l */
+extern int yylex(void);
+extern void stringerr(int); /* report string overflow */
+
+/* psw.c */
+extern void EmitPrototype(Header);
+extern void EmitBodyHeader(Header);
+extern void EmitBody(Tokens, Header);
+extern void FreeBody(Body);
+
+/* pswfile.c */
+extern void FinishHFile(void);
+extern void InitHFile(void);
+extern void InitOFile(void);
+
+/* pswparser.y */
+extern int yyparse (void);
+
+/* systemnames.c */
+extern void InitWellKnownPSNames(void);
+
+/* yyerror.c */
+extern void ErrIntro(int);
+extern void yyerror(char *);
+
+#endif /* PSWPRIV_H */
diff --git a/nx-X11/config/pswrap/pswrap.man b/nx-X11/config/pswrap/pswrap.man
new file mode 100644
index 000000000..17d7f05f7
--- /dev/null
+++ b/nx-X11/config/pswrap/pswrap.man
@@ -0,0 +1,141 @@
+.\" Id: pswrap.man,v 6.1 1994/05/18 23:21:11 asente Exp $
+.na
+.nh
+.TH PSWRAP 1 "4 Apr 1994" "Adobe Systems"
+.SH NAME
+pswrap \- creates C procedures from segments of PostScript language code
+
+.SH SYNOPSIS
+.B pswrap
+[
+.B \-apr
+] [
+.B \-o
+.I outputCfile
+] [
+.B \-h
+.I outputHfile
+] [
+.B \-s
+.I maxstring
+]
+.I inputfile
+
+.SH DESCRIPTION
+.LP
+.B pswrap
+reads input from
+.I inputfile
+and creates C-callable procedures, known as wraps, that send PostScript
+language code to the PostScript interpreter.
+.I inputfile
+contains segments of PostScript language code wrapped with a C-like
+procedure syntax.
+.LP
+Wraps are the most efficient way for an application to communicate with the
+PostScript interpreter. For complete documentation of
+.B pswrap
+and the language it accepts, see "pswrap Reference Manual"
+in \fIProgramming the Display PostScript System with X.\fR
+.LP
+
+.SH OPTIONS
+.LP
+.TP
+.I inputfile
+A file that contains one or more wrap definitions.
+.B pswrap
+transforms the definitions in
+.I inputfile
+into C procedures. If no input file is specified, the standard
+input (which can be redirected from a file or pipe) is used. The input file
+can include text other than wrap definitions.
+.B pswrap
+converts wrap definitions to C procedures and passes the other text
+through unchanged. Therefore, it is possible to intersperse C-language
+source code with wrap definitions in the input file.
+.RS
+.LP
+.I Note:
+Although C code is allowed in a pswrap input file, it is not allowed
+within a wrap body. In particular, no CPP macros (for example, #define) are
+allowed inside a wrap.
+.RE
+.TP
+.B \-a
+Generates ANSI C procedure prototypes for procedure definitions in
+.I outputCfile
+and, optionally,
+.I outputHfile.
+The
+.B \-a
+option allows compilers that recognize the
+ANSI C standard to do more complete type checking of parameters. The
+.B \-a
+option also causes
+.B pswrap
+to generate const declarations.
+.RS
+.LP
+.I Note:
+ANSI C procedure prototype syntax is not recognized by most non-ANSI C
+compilers, including many compilers based on the Portable C Compiler. Use the
+.B \-a
+option only in conjunction with a compiler that conforms to the ANSI C Standard.
+.RE
+.TP
+.BI \-h " outputHFile"
+Generates a header file that contains extern declarations for non-static
+wraps. This file can be used in #include statements in modules that use
+wraps. If the
+.B \-a
+option is specified, the declarations in the header file
+are ANSI C procedure prototypes. If the
+.B \-h
+option is omitted, a header file is not produced.
+.TP
+.BI \-o " outputCFile"
+Specifies the file to which the generated wraps and passed-through text are
+written. If omitted, the standard output is used. If the
+.B \-a
+option is also specified, the procedure definitions generated by
+.B pswrap
+are in ANSI C procedure prototype syntax.
+.TP
+.B \-p
+Specifies that strings passed by wraps are padded so that each data object
+begins on a long-word (4-byte) boundary. This option allows wraps to run on
+architectures that restrict data alignment to 4-byte boundaries and
+improves performance on some other architectures.
+.TP
+.B \-r
+Generates reentrant code for wraps shared by more than one process (as in
+shared libraries). Reentrant code can be called recursively or by more than
+one thread. The
+.B \-r
+option causes
+.B pswrap
+to generate extra code, so use it only when necessary.
+.TP
+.BI \-s " maxstring"
+Sets the maximum allowable length of a PostScript string object or
+hexadecimal string object in the wrap body input. A syntax error is reported if a
+string is not terminated with ) or > within
+.I maxstring
+characters.
+.I maxstring
+cannot be set lower than 80; the default is 200.
+
+.SH SEE ALSO
+\fIProgramming the Display PostScript System with X\fR
+(Addison-Wesley Publishing Company, Inc., 1993).
+
+.SH AUTHOR
+Adobe Systems Incorporated
+
+.SH NOTES
+PostScript and Display PostScript are trademarks
+of Adobe Systems Incorporated which may be registered
+in certain jurisdictions.
+.PP
+Copyright (c) 1988-1994 Adobe Systems Incorporated. All rights reserved.
diff --git a/nx-X11/config/pswrap/pswsemantics.c b/nx-X11/config/pswrap/pswsemantics.c
new file mode 100644
index 000000000..caaff800e
--- /dev/null
+++ b/nx-X11/config/pswrap/pswsemantics.c
@@ -0,0 +1,551 @@
+/*
+ * pswsemantics.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+/***********/
+/* Imports */
+/***********/
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef XENVIRONMENT
+#include <X11/Xos.h>
+#else
+#include <string.h>
+#endif
+
+#include "pswdict.h"
+#include "pswpriv.h"
+#include "pswsemantics.h"
+
+/***********************/
+/* Module-wide globals */
+/***********************/
+
+char *currentPSWName = NULL;
+int reportedPSWName = 0;
+
+static PSWDict currentDict = NULL;
+
+
+/*************************************************/
+/* Procedures called by the parser's annotations */
+/*************************************************/
+
+static boolean IsCharType(Type t)
+{
+ return (t == T_CHAR || t == T_UCHAR);
+}
+
+static boolean IsNumStrType(Type t)
+{
+ return (t == T_NUMSTR
+ || t == T_FLOATNUMSTR
+ || t == T_LONGNUMSTR
+ || t == T_SHORTNUMSTR);
+}
+
+void PSWName(char *s)
+{
+ currentPSWName = psw_malloc(strlen(s)+1);
+ strcpy(currentPSWName, s);
+ reportedPSWName = 0;
+}
+
+ /* Generate the code for this wrap now */
+void FinalizePSWrapDef(Header hdr, Body body)
+{
+ if (header && ! hdr->isStatic) EmitPrototype(hdr);
+
+ printf("#line %d \"%s\"\n", ++outlineno, ofile);
+ EmitBodyHeader(hdr);
+
+ printf("{\n"); outlineno++;
+ EmitBody(body, hdr);
+ printf("}\n"); outlineno++;
+ printf("#line %d \"%s\"\n", yylineno, ifile); outlineno++;
+
+ /* release storage for this wrap */
+ /* Omit if you have lots of memory and want pswrap lean and mean */
+ if (bigFile) {
+ register Arg arg, nextarg; register Item item, nextitem;
+ for(arg = hdr->inArgs; arg; arg = nextarg) {
+ nextarg = arg->next;
+ for(item = arg->items; item; item = nextitem) {
+ nextitem = item->next;
+ if (item->subscripted) {
+ if (!item->subscript->constant) free(item->subscript->name);
+ free(item->subscript);
+ if(item->scaled) {
+ if (!item->scale->constant) free(item->scale->name);
+ free(item->scale);
+ }
+ }
+ free(item->name); free(item);
+ }
+ free(arg);
+ }
+ for(arg = hdr->outArgs; arg; arg = nextarg) {
+ nextarg = arg->next;
+ for(item = arg->items; item; item = nextitem) {
+ nextitem = item->next;
+ if (item->subscripted) {
+ if (!item->subscript->constant) free(item->subscript->name);
+ free(item->subscript);
+ }
+ free(item->name); free(item);
+ }
+ free(arg);
+ }
+ free(hdr->name); free(hdr);
+ FreeBody(body);
+ }
+
+ DestroyPSWDict(currentDict);
+ currentDict = NULL;
+ currentPSWName = NULL;
+ reportedPSWName = 0;
+}
+
+ /* Complete construction of the Header tree and make some semantic checks */
+Header PSWHeader(boolean isStatic, Args inArgs, Args outArgs)
+{
+ char *name = currentPSWName;
+ register Arg arg, prevArg;
+ register Item item, prevItem;
+ int nextTag = 0;
+
+ Header hdr = (Header)psw_calloc(sizeof(HeaderRec), 1);
+ hdr->isStatic = isStatic;
+ hdr->name = name;
+
+ currentDict = CreatePSWDict(511);
+
+ prevArg = NULL;
+ for (arg = inArgs; arg; arg = arg->next) { /* foreach input arg */
+ prevItem = NULL;
+ for (item = arg->items; item; item = item->next) {
+ if (IsCharType(arg->type)
+ && !(item->starred || item->subscripted)) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,
+ "char input parameter %s must be starred or subscripted\n",
+ item->name);
+ /* remove item from list */
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free(item); XXX? */
+ continue;
+ }
+ if(item->scaled && !IsNumStrType(arg->type)) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,"only numstring parameters may be scaled\n");
+ }
+ if (IsNumStrType(arg->type)
+ && (item->starred || !item->subscripted)) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,
+ "numstring parameter %s may only be subscripted\n",
+ item->name);
+ /* remove item from list */
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free(item); XXX? */
+ continue;
+ }
+ if (arg->type != T_CONTEXT) {
+ if (PSWDictLookup(currentDict, item->name) != -1) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,"parameter %s reused\n", item->name);
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free this ? */
+ continue;
+ }
+ PSWDictEnter(currentDict, item->name, (PSWDictValue) item);
+ item->isoutput = false;
+ item->type = arg->type;
+ prevItem = item;
+ }
+ }
+ if (arg->items == NULL) {
+ if (prevArg) { prevArg->next = arg->next;}
+ else if (arg == inArgs) {inArgs = arg->next;}
+ continue;
+ }
+ prevArg = arg;
+ }
+
+ prevArg = NULL;
+ for (arg = outArgs; arg; arg = arg->next) { /* foreach output arg */
+ prevItem = NULL;
+ for (item = arg->items; item; item = item->next) {
+ if (arg->type == T_USEROBJECT) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,"output parameter %s can not be of type userobject\n",
+ item->name);
+ /* remove item from list */
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free(item); XXX */
+ continue;
+ }
+ if (arg->type == T_NUMSTR || arg->type == T_FLOATNUMSTR
+ || arg->type == T_LONGNUMSTR || arg->type == T_SHORTNUMSTR) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,"output parameter %s can not be of type numstring\n",
+ item->name);
+ /* remove item from list */
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free(item); XXX */
+ continue;
+ }
+ if (!(item->starred || item->subscripted)) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,"output parameter %s must be starred or subscripted\n",
+ item->name);
+ /* remove item from list */
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free(item); XXX */
+ continue;
+ }
+ if (PSWDictLookup(currentDict, item->name) != -1) {
+ ErrIntro(item->sourceLine);
+ fprintf(stderr,"parameter %s reused\n", item->name);
+ /* remove item from list */
+ if (prevItem) {prevItem->next = item->next;}
+ else if (item == arg->items) {arg->items = item->next;};
+ /* free the storage? XXX */
+ continue;
+ }
+ PSWDictEnter(currentDict, item->name, (PSWDictValue) item);
+ item->isoutput = true;
+ item->type = arg->type;
+ item->tag = nextTag++;
+ prevItem = item;
+ } /* inside for loop */
+ if (arg->items == NULL) {
+ if (prevArg) {
+ prevArg->next = arg->next;
+ } else if (arg == outArgs) {
+ outArgs = arg->next;
+ }
+ continue;
+ }
+ prevArg = arg;
+ } /* outside for loop */
+
+ /* now go looking for subscripts that name an input arg */
+ for (arg = inArgs; arg; arg = arg->next) { /* foreach input arg */
+ for (item = arg->items; item; item = item->next) {
+ if (item->subscripted && !item->subscript->constant) {
+ PSWDictValue v = PSWDictLookup(currentDict, item->subscript->name);
+ if (v != -1) {
+ Item subItem = (Item)v;
+ if (subItem->isoutput) {
+ ErrIntro(subItem->sourceLine);
+ fprintf(stderr,"output parameter %s used as a subscript\n",
+ subItem->name);
+ continue;
+ }
+ if (subItem->type != T_INT) {
+ ErrIntro(subItem->sourceLine);
+ fprintf(stderr,
+ "input parameter %s used as a subscript is not an int\n",
+ subItem->name);
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ for (arg = outArgs; arg; arg = arg->next) { /* foreach output arg */
+ for (item = arg->items; item; item = item->next) {
+ if (item->subscripted && !item->subscript->constant) {
+ PSWDictValue v = PSWDictLookup(currentDict, item->subscript->name);
+ if (v != -1) {
+ Item subItem = (Item)v;
+ if (subItem->isoutput) {
+ ErrIntro(subItem->sourceLine);
+ fprintf(stderr,"output parameter %s used as a subscript\n",
+ subItem->name);
+ continue;
+ }
+ if (subItem->type != T_INT) {
+ ErrIntro(subItem->sourceLine);
+ fprintf(stderr,
+ "input parameter %s used as a subscript is not an int\n",
+ subItem->name);
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ hdr->inArgs = inArgs;
+ hdr->outArgs = outArgs;
+
+ return hdr;
+}
+
+Token PSWToken(Type type, char *val)
+{
+ register Token token = (Token)psw_calloc(sizeof(TokenRec), 1);
+
+ token->next = NULL;
+ token->type = type;
+ token->val = val;
+ token->sourceLine = yylineno;
+
+ switch (type) {
+ case T_STRING:
+ case T_NAME:
+ case T_LITNAME: {
+ Item dictVal = (Item) PSWDictLookup(currentDict, (char *)val);
+ if ((PSWDictValue) dictVal != -1) {
+ if ((type != T_NAME) && (dictVal->isoutput)) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"output parameter %s used as %s\n",
+ dictVal->name,
+ (type == T_STRING) ? "string": "literal name");
+ } else
+ if ((type != T_NAME) && !IsCharType(dictVal->type)) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"non-char input parameter %s used as %s\n",
+ dictVal->name,
+ (type == T_STRING) ? "string": "literal name");
+ } else
+ token->namedFormal = dictVal; /* ok, so assign a value */
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ return token;
+}
+
+Token PSWToken2(Type type, char *val, char *ind)
+{
+ register Token token = (Token)psw_calloc(sizeof(TokenRec), 1);
+ Item dictVal = (Item) PSWDictLookup(currentDict, val);
+ Item dvi;
+
+ token->next = NULL;
+ token->type = type;
+ token->val = val;
+ token->sourceLine = yylineno;
+
+ /* Assert(type == T_SUBSCRIPTED); */
+ if (((PSWDictValue) dictVal == -1) || (dictVal->isoutput)) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"%s not an input parameter\n", val);
+ }
+ else if (!dictVal->subscripted) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"%s not an array\n", val);
+ }
+ else if (dictVal->type >= T_NUMSTR) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"cannot subscript numstring %s\n", val);
+ }
+ else if (IsCharType(dictVal->type)) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"%s not a scalar type\n", val);
+ }
+ else {
+ dvi = (Item) PSWDictLookup(currentDict, (char *)ind);
+ if (((PSWDictValue) dvi != -1)
+ && ((dvi->isoutput) || IsCharType(dvi->type))) {
+ ErrIntro(yylineno);
+ fprintf(stderr,"%s wrong type\n",(char *) ind);
+ }
+ else {
+ token->body.var = (char *) ind;
+ token->namedFormal = dictVal; /* ok, so assign a value */
+ return token;
+ }
+ }
+
+ /* ERRORS fall through */
+ free(token);
+ return (PSWToken(T_NAME,val));
+}
+
+Arg PSWArg(Type type, Items items)
+{
+ register Arg arg = (Arg)psw_calloc(sizeof(ArgRec), 1);
+ arg->next = NULL;
+ arg->type = type;
+ arg->items = items;
+ return arg;
+}
+
+Item PSWItem(char *name)
+{
+ register Item item = (Item)psw_calloc(sizeof(ItemRec), 1);
+ item->next = NULL;
+ item->name = name;
+ item->sourceLine = yylineno;
+ return item;
+}
+
+Item PSWStarItem(char *name)
+{
+ register Item item = (Item)psw_calloc(sizeof(ItemRec), 1);
+ item->next = NULL;
+ item->name = name;
+ item->starred = true;
+ item->sourceLine = yylineno;
+ return item;
+}
+
+Item PSWSubscriptItem(char *name, Subscript subscript)
+{
+ register Item item = (Item)psw_calloc(sizeof(ItemRec), 1);
+ item->next = NULL;
+ item->name = name;
+ item->subscript = subscript;
+ item->subscripted = true;
+ item->sourceLine = yylineno;
+ return item;
+}
+
+Item PSWScaleItem(char *name, Subscript subscript, char *nameval, int val)
+{
+ Item item;
+ Scale scale = (Scale)psw_calloc(sizeof(ScaleRec), 1);
+ item = PSWSubscriptItem(name, subscript);
+ item->scaled = true;
+ if(nameval)
+ scale->name = nameval;
+ else {
+ scale->constant = true;
+ scale->val = val;
+ }
+ item->scale = scale;
+ return(item);
+}
+
+Subscript PSWNameSubscript(char *name)
+{
+ Subscript subscript = (Subscript)psw_calloc(sizeof(SubscriptRec), 1);
+ subscript->name = name;
+ return subscript;
+}
+
+Subscript PSWIntegerSubscript(int val)
+{
+ Subscript subscript = (Subscript)psw_calloc(sizeof(SubscriptRec), 1);
+ subscript->constant = true;
+ subscript->val = val;
+ return subscript;
+}
+
+Args ConsPSWArgs(Arg arg, Args args)
+{
+ arg->next = args;
+ return arg;
+}
+
+Tokens AppendPSWToken(Token token, Tokens tokens)
+{
+ register Token t;
+ static Token firstToken, lastToken; /* cache ptr to last */
+
+ if ((token->type == T_NAME) && (token->namedFormal)) {
+ if( token->namedFormal->isoutput) {
+ Token oldtoken;
+ char *pos = "printobject";
+ char *ss = psw_malloc(strlen(pos) + 1);
+ strcpy(ss, pos);
+ free(token->val);
+ oldtoken = token;
+ token = PSWToken(T_INT, (char *) token->namedFormal->tag);
+ free((char *)oldtoken);
+ token->next = PSWToken(T_NAME, ss);
+ } else
+ if (token->namedFormal->type == T_USEROBJECT) {
+ char *pos = "execuserobject";
+ char *ss = psw_malloc(strlen(pos) + 1);
+ strcpy(ss, pos);
+ token->next = PSWToken(T_NAME, ss);
+ }
+ }
+
+ if (tokens == NULL) {
+ firstToken = lastToken = token;
+ return token;
+ }
+
+ if (tokens != firstToken)
+ firstToken = lastToken = tokens;
+ for (t = lastToken; t->next; t = t->next);
+ lastToken = t->next = token;
+
+ return tokens;
+}
+
+Args AppendPSWArgs(Arg arg, Args args)
+{
+ register Arg a;
+ arg->next = NULL;
+ if (args == NULL) return arg;
+
+ for (a = args; a->next; a = a->next);
+
+ a->next = arg;
+ return args;
+}
+
+Items AppendPSWItems(Item item, Items items)
+{
+ register Item t;
+ item->next = NULL;
+ if (items == NULL) return item;
+
+ for (t = items; t->next; t = t->next);
+
+ t->next = item;
+ return items;
+}
diff --git a/nx-X11/config/pswrap/pswsemantics.h b/nx-X11/config/pswrap/pswsemantics.h
new file mode 100644
index 000000000..b2e0a1a41
--- /dev/null
+++ b/nx-X11/config/pswrap/pswsemantics.h
@@ -0,0 +1,63 @@
+/*
+ * pswsemantics.h
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+#ifndef PSWSEMANTICS_H
+#define PSWSEMANTICS_H
+
+#include "pswpriv.h"
+
+/* PROCEDURES */
+
+extern Arg PSWArg(Type, Items);
+extern Args AppendPSWArgs(Arg, Args);
+extern Args ConsPSWArgs(Arg, Args);
+extern Header PSWHeader(boolean, Args, Args);
+extern Item PSWItem(char *);
+extern Item PSWScaleItem(char *, Subscript, char *, int);
+extern Item PSWStarItem(char *);
+extern Item PSWSubscriptItem(char *, Subscript);
+extern Items AppendPSWItems(Item, Items);
+extern Subscript PSWIntegerSubscript(int);
+extern Subscript PSWNameSubscript(char *);
+extern Token PSWToken(Type, char *);
+extern Token PSWToken2(Type, char *, char *);
+extern Tokens AppendPSWToken(Token, Tokens);
+extern void FinalizePSWrapDef(Header, Body);
+extern void PSWName(char *);
+
+#endif /* PSWSEMANTICS_H */
diff --git a/nx-X11/config/pswrap/pswstring.c b/nx-X11/config/pswrap/pswstring.c
new file mode 100644
index 000000000..3a4d5084a
--- /dev/null
+++ b/nx-X11/config/pswrap/pswstring.c
@@ -0,0 +1,140 @@
+/*
+ * pswstring.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86$ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "pswpriv.h"
+#include "psw.h"
+
+#define outfil stdout
+#define MAX_PER_LINE 16
+
+int PSWStringLength(char *s)
+{
+ register char *c = s;
+ register int len = 0;
+
+ while (*c != '\0') { /* skip \\ and \ooo */
+ if (*c++ == '\\') {
+ if (*c++ != '\\') c += 2;
+ }
+ len++;
+ }
+ return (len);
+}
+
+void PSWOutputStringChars(char *s)
+{
+ register char *c = s;
+ register char b;
+ register int perline = 0;
+
+ while (*c != '\0') {
+ putc('\'',outfil);
+ switch (b = *c++) {
+ case '\\':
+ putc('\\',outfil);
+ fputc(b = *c++,outfil);
+ if (b != '\\') {putc(*c++,outfil);putc(*c++,outfil);}
+ break;
+ case '\'':
+ fprintf(outfil,"\\'");
+ break;
+ case '\"':
+ fprintf(outfil,"\\\"");
+ break;
+ case '\b':
+ fprintf(outfil,"\\b");
+ break;
+ case '\f':
+ fprintf(outfil,"\\f");
+ break;
+/* avoid funny interpretations of \n, \r by MPW */
+ case '\012':
+ fprintf(outfil,"\\012"); perline++;
+ break;
+ case '\015':
+ fprintf(outfil,"\\015"); perline++;
+ break;
+ case '\t':
+ fprintf(outfil,"\\t");
+ break;
+ default:
+ putc(b,outfil); perline--;
+ break;
+ }
+ putc('\'',outfil);
+ if (*c != '\0') {
+ if (++perline >= MAX_PER_LINE) {
+ fprintf(outfil,",\n ");
+ outlineno++;
+ }
+ else {putc(',',outfil);}
+ perline %= MAX_PER_LINE;
+ }
+ }
+}
+
+
+int PSWHexStringLength(char *s)
+{
+ return ((int) (strlen(s)+1)/2);
+}
+
+void PSWOutputHexStringChars(register char *s)
+{
+ register int perline = 0;
+ char tmp[3];
+
+ tmp[2] ='\0';
+ while ((tmp[0] = *s++)!= '\0') {
+ tmp[1] = *s ? *s++ : '\0';
+ fprintf(outfil,"0x%s",tmp);
+ if (*s != '\0') {
+ if (++perline >= MAX_PER_LINE) {
+ fprintf(outfil,",\n ");
+ outlineno++;
+ }
+ else {putc(',',outfil);}
+ perline %= MAX_PER_LINE;
+ }
+ } /* while */
+}
diff --git a/nx-X11/config/pswrap/pswtypes.h b/nx-X11/config/pswrap/pswtypes.h
new file mode 100644
index 000000000..cfa64f083
--- /dev/null
+++ b/nx-X11/config/pswrap/pswtypes.h
@@ -0,0 +1,49 @@
+/*
+ * pswtypes.h
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86$ */
+
+#ifndef PSWTYPES_H
+#define PSWTYPES_H
+
+#include <stddef.h>
+
+#define false 0
+#define true 1
+typedef short boolean;
+
+#endif /* PSWTYPES_H */
diff --git a/nx-X11/config/pswrap/pswversion.h b/nx-X11/config/pswrap/pswversion.h
new file mode 100644
index 000000000..c28c3f174
--- /dev/null
+++ b/nx-X11/config/pswrap/pswversion.h
@@ -0,0 +1,42 @@
+/*
+ * pswversion.h
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+/* $XFree86$ */
+
+#define PSW_VERSION "V1.009 X11"
+
+#define PSW_OS "unix"
diff --git a/nx-X11/config/pswrap/sysname_gen.c b/nx-X11/config/pswrap/sysname_gen.c
new file mode 100644
index 000000000..10624aafc
--- /dev/null
+++ b/nx-X11/config/pswrap/sysname_gen.c
@@ -0,0 +1,429 @@
+/*
+ * sysnames_gen.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+ wellKnownPSNames = CreatePSWDict(431);
+
+ PSWDictEnter(wellKnownPSNames,"abs", 0);
+ PSWDictEnter(wellKnownPSNames,"add", 1);
+ PSWDictEnter(wellKnownPSNames,"aload", 2);
+ PSWDictEnter(wellKnownPSNames,"anchorsearch", 3);
+ PSWDictEnter(wellKnownPSNames,"and", 4);
+ PSWDictEnter(wellKnownPSNames,"arc", 5);
+ PSWDictEnter(wellKnownPSNames,"arcn", 6);
+ PSWDictEnter(wellKnownPSNames,"arct", 7);
+ PSWDictEnter(wellKnownPSNames,"arcto", 8);
+ PSWDictEnter(wellKnownPSNames,"array", 9);
+ PSWDictEnter(wellKnownPSNames,"ashow", 10);
+ PSWDictEnter(wellKnownPSNames,"astore", 11);
+ PSWDictEnter(wellKnownPSNames,"awidthshow", 12);
+ PSWDictEnter(wellKnownPSNames,"begin", 13);
+ PSWDictEnter(wellKnownPSNames,"bind", 14);
+ PSWDictEnter(wellKnownPSNames,"bitshift", 15);
+ PSWDictEnter(wellKnownPSNames,"ceiling", 16);
+ PSWDictEnter(wellKnownPSNames,"charpath", 17);
+ PSWDictEnter(wellKnownPSNames,"clear", 18);
+ PSWDictEnter(wellKnownPSNames,"cleartomark", 19);
+ PSWDictEnter(wellKnownPSNames,"clip", 20);
+ PSWDictEnter(wellKnownPSNames,"clippath", 21);
+ PSWDictEnter(wellKnownPSNames,"closepath", 22);
+ PSWDictEnter(wellKnownPSNames,"concat", 23);
+ PSWDictEnter(wellKnownPSNames,"concatmatrix", 24);
+ PSWDictEnter(wellKnownPSNames,"copy", 25);
+ PSWDictEnter(wellKnownPSNames,"count", 26);
+ PSWDictEnter(wellKnownPSNames,"counttomark", 27);
+ PSWDictEnter(wellKnownPSNames,"currentcmykcolor", 28);
+ PSWDictEnter(wellKnownPSNames,"currentdash", 29);
+ PSWDictEnter(wellKnownPSNames,"currentdict", 30);
+ PSWDictEnter(wellKnownPSNames,"currentfile", 31);
+ PSWDictEnter(wellKnownPSNames,"currentfont", 32);
+ PSWDictEnter(wellKnownPSNames,"currentgray", 33);
+ PSWDictEnter(wellKnownPSNames,"currentgstate", 34);
+ PSWDictEnter(wellKnownPSNames,"currenthsbcolor", 35);
+ PSWDictEnter(wellKnownPSNames,"currentlinecap", 36);
+ PSWDictEnter(wellKnownPSNames,"currentlinejoin", 37);
+ PSWDictEnter(wellKnownPSNames,"currentlinewidth", 38);
+ PSWDictEnter(wellKnownPSNames,"currentmatrix", 39);
+ PSWDictEnter(wellKnownPSNames,"currentpoint", 40);
+ PSWDictEnter(wellKnownPSNames,"currentrgbcolor", 41);
+ PSWDictEnter(wellKnownPSNames,"currentshared", 42);
+ PSWDictEnter(wellKnownPSNames,"curveto", 43);
+ PSWDictEnter(wellKnownPSNames,"cvi", 44);
+ PSWDictEnter(wellKnownPSNames,"cvlit", 45);
+ PSWDictEnter(wellKnownPSNames,"cvn", 46);
+ PSWDictEnter(wellKnownPSNames,"cvr", 47);
+ PSWDictEnter(wellKnownPSNames,"cvrs", 48);
+ PSWDictEnter(wellKnownPSNames,"cvs", 49);
+ PSWDictEnter(wellKnownPSNames,"cvx", 50);
+ PSWDictEnter(wellKnownPSNames,"def", 51);
+ PSWDictEnter(wellKnownPSNames,"defineusername", 52);
+ PSWDictEnter(wellKnownPSNames,"dict", 53);
+ PSWDictEnter(wellKnownPSNames,"div", 54);
+ PSWDictEnter(wellKnownPSNames,"dtransform", 55);
+ PSWDictEnter(wellKnownPSNames,"dup", 56);
+ PSWDictEnter(wellKnownPSNames,"end", 57);
+ PSWDictEnter(wellKnownPSNames,"eoclip", 58);
+ PSWDictEnter(wellKnownPSNames,"eofill", 59);
+ PSWDictEnter(wellKnownPSNames,"eoviewclip", 60);
+ PSWDictEnter(wellKnownPSNames,"eq", 61);
+ PSWDictEnter(wellKnownPSNames,"exch", 62);
+ PSWDictEnter(wellKnownPSNames,"exec", 63);
+ PSWDictEnter(wellKnownPSNames,"exit", 64);
+ PSWDictEnter(wellKnownPSNames,"file", 65);
+ PSWDictEnter(wellKnownPSNames,"fill", 66);
+ PSWDictEnter(wellKnownPSNames,"findfont", 67);
+ PSWDictEnter(wellKnownPSNames,"flattenpath", 68);
+ PSWDictEnter(wellKnownPSNames,"floor", 69);
+ PSWDictEnter(wellKnownPSNames,"flush", 70);
+ PSWDictEnter(wellKnownPSNames,"flushfile", 71);
+ PSWDictEnter(wellKnownPSNames,"for", 72);
+ PSWDictEnter(wellKnownPSNames,"forall", 73);
+ PSWDictEnter(wellKnownPSNames,"ge", 74);
+ PSWDictEnter(wellKnownPSNames,"get", 75);
+ PSWDictEnter(wellKnownPSNames,"getinterval", 76);
+ PSWDictEnter(wellKnownPSNames,"grestore", 77);
+ PSWDictEnter(wellKnownPSNames,"gsave", 78);
+ PSWDictEnter(wellKnownPSNames,"gstate", 79);
+ PSWDictEnter(wellKnownPSNames,"gt", 80);
+ PSWDictEnter(wellKnownPSNames,"identmatrix", 81);
+ PSWDictEnter(wellKnownPSNames,"idiv", 82);
+ PSWDictEnter(wellKnownPSNames,"idtransform", 83);
+ PSWDictEnter(wellKnownPSNames,"if", 84);
+ PSWDictEnter(wellKnownPSNames,"ifelse", 85);
+ PSWDictEnter(wellKnownPSNames,"image", 86);
+ PSWDictEnter(wellKnownPSNames,"imagemask", 87);
+ PSWDictEnter(wellKnownPSNames,"index", 88);
+ PSWDictEnter(wellKnownPSNames,"ineofill", 89);
+ PSWDictEnter(wellKnownPSNames,"infill", 90);
+ PSWDictEnter(wellKnownPSNames,"initviewclip", 91);
+ PSWDictEnter(wellKnownPSNames,"inueofill", 92);
+ PSWDictEnter(wellKnownPSNames,"inufill", 93);
+ PSWDictEnter(wellKnownPSNames,"invertmatrix", 94);
+ PSWDictEnter(wellKnownPSNames,"itransform", 95);
+ PSWDictEnter(wellKnownPSNames,"known", 96);
+ PSWDictEnter(wellKnownPSNames,"le", 97);
+ PSWDictEnter(wellKnownPSNames,"length", 98);
+ PSWDictEnter(wellKnownPSNames,"lineto", 99);
+ PSWDictEnter(wellKnownPSNames,"load", 100);
+ PSWDictEnter(wellKnownPSNames,"loop", 101);
+ PSWDictEnter(wellKnownPSNames,"lt", 102);
+ PSWDictEnter(wellKnownPSNames,"makefont", 103);
+ PSWDictEnter(wellKnownPSNames,"matrix", 104);
+ PSWDictEnter(wellKnownPSNames,"maxlength", 105);
+ PSWDictEnter(wellKnownPSNames,"mod", 106);
+ PSWDictEnter(wellKnownPSNames,"moveto", 107);
+ PSWDictEnter(wellKnownPSNames,"mul", 108);
+ PSWDictEnter(wellKnownPSNames,"ne", 109);
+ PSWDictEnter(wellKnownPSNames,"neg", 110);
+ PSWDictEnter(wellKnownPSNames,"newpath", 111);
+ PSWDictEnter(wellKnownPSNames,"not", 112);
+ PSWDictEnter(wellKnownPSNames,"null", 113);
+ PSWDictEnter(wellKnownPSNames,"or", 114);
+ PSWDictEnter(wellKnownPSNames,"pathbbox", 115);
+ PSWDictEnter(wellKnownPSNames,"pathforall", 116);
+ PSWDictEnter(wellKnownPSNames,"pop", 117);
+ PSWDictEnter(wellKnownPSNames,"print", 118);
+ PSWDictEnter(wellKnownPSNames,"printobject", 119);
+ PSWDictEnter(wellKnownPSNames,"put", 120);
+ PSWDictEnter(wellKnownPSNames,"putinterval", 121);
+ PSWDictEnter(wellKnownPSNames,"rcurveto", 122);
+ PSWDictEnter(wellKnownPSNames,"read", 123);
+ PSWDictEnter(wellKnownPSNames,"readhexstring", 124);
+ PSWDictEnter(wellKnownPSNames,"readline", 125);
+ PSWDictEnter(wellKnownPSNames,"readstring", 126);
+ PSWDictEnter(wellKnownPSNames,"rectclip", 127);
+ PSWDictEnter(wellKnownPSNames,"rectfill", 128);
+ PSWDictEnter(wellKnownPSNames,"rectstroke", 129);
+ PSWDictEnter(wellKnownPSNames,"rectviewclip", 130);
+ PSWDictEnter(wellKnownPSNames,"repeat", 131);
+ PSWDictEnter(wellKnownPSNames,"restore", 132);
+ PSWDictEnter(wellKnownPSNames,"rlineto", 133);
+ PSWDictEnter(wellKnownPSNames,"rmoveto", 134);
+ PSWDictEnter(wellKnownPSNames,"roll", 135);
+ PSWDictEnter(wellKnownPSNames,"rotate", 136);
+ PSWDictEnter(wellKnownPSNames,"round", 137);
+ PSWDictEnter(wellKnownPSNames,"save", 138);
+ PSWDictEnter(wellKnownPSNames,"scale", 139);
+ PSWDictEnter(wellKnownPSNames,"scalefont", 140);
+ PSWDictEnter(wellKnownPSNames,"search", 141);
+ PSWDictEnter(wellKnownPSNames,"selectfont", 142);
+ PSWDictEnter(wellKnownPSNames,"setbbox", 143);
+ PSWDictEnter(wellKnownPSNames,"setcachedevice", 144);
+ PSWDictEnter(wellKnownPSNames,"setcachedevice2", 145);
+ PSWDictEnter(wellKnownPSNames,"setcharwidth", 146);
+ PSWDictEnter(wellKnownPSNames,"setcmykcolor", 147);
+ PSWDictEnter(wellKnownPSNames,"setdash", 148);
+ PSWDictEnter(wellKnownPSNames,"setfont", 149);
+ PSWDictEnter(wellKnownPSNames,"setgray", 150);
+ PSWDictEnter(wellKnownPSNames,"setgstate", 151);
+ PSWDictEnter(wellKnownPSNames,"sethsbcolor", 152);
+ PSWDictEnter(wellKnownPSNames,"setlinecap", 153);
+ PSWDictEnter(wellKnownPSNames,"setlinejoin", 154);
+ PSWDictEnter(wellKnownPSNames,"setlinewidth", 155);
+ PSWDictEnter(wellKnownPSNames,"setmatrix", 156);
+ PSWDictEnter(wellKnownPSNames,"setrgbcolor", 157);
+ PSWDictEnter(wellKnownPSNames,"setshared", 158);
+ PSWDictEnter(wellKnownPSNames,"shareddict", 159);
+ PSWDictEnter(wellKnownPSNames,"show", 160);
+ PSWDictEnter(wellKnownPSNames,"showpage", 161);
+ PSWDictEnter(wellKnownPSNames,"stop", 162);
+ PSWDictEnter(wellKnownPSNames,"stopped", 163);
+ PSWDictEnter(wellKnownPSNames,"store", 164);
+ PSWDictEnter(wellKnownPSNames,"string", 165);
+ PSWDictEnter(wellKnownPSNames,"stringwidth", 166);
+ PSWDictEnter(wellKnownPSNames,"stroke", 167);
+ PSWDictEnter(wellKnownPSNames,"strokepath", 168);
+ PSWDictEnter(wellKnownPSNames,"sub", 169);
+ PSWDictEnter(wellKnownPSNames,"systemdict", 170);
+ PSWDictEnter(wellKnownPSNames,"token", 171);
+ PSWDictEnter(wellKnownPSNames,"transform", 172);
+ PSWDictEnter(wellKnownPSNames,"translate", 173);
+ PSWDictEnter(wellKnownPSNames,"truncate", 174);
+ PSWDictEnter(wellKnownPSNames,"type", 175);
+ PSWDictEnter(wellKnownPSNames,"uappend", 176);
+ PSWDictEnter(wellKnownPSNames,"ucache", 177);
+ PSWDictEnter(wellKnownPSNames,"ueofill", 178);
+ PSWDictEnter(wellKnownPSNames,"ufill", 179);
+ PSWDictEnter(wellKnownPSNames,"undef", 180);
+ PSWDictEnter(wellKnownPSNames,"upath", 181);
+ PSWDictEnter(wellKnownPSNames,"userdict", 182);
+ PSWDictEnter(wellKnownPSNames,"ustroke", 183);
+ PSWDictEnter(wellKnownPSNames,"viewclip", 184);
+ PSWDictEnter(wellKnownPSNames,"viewclippath", 185);
+ PSWDictEnter(wellKnownPSNames,"where", 186);
+ PSWDictEnter(wellKnownPSNames,"widthshow", 187);
+ PSWDictEnter(wellKnownPSNames,"write", 188);
+ PSWDictEnter(wellKnownPSNames,"writehexstring", 189);
+ PSWDictEnter(wellKnownPSNames,"writeobject", 190);
+ PSWDictEnter(wellKnownPSNames,"writestring", 191);
+ PSWDictEnter(wellKnownPSNames,"wtranslation", 192);
+ PSWDictEnter(wellKnownPSNames,"xor", 193);
+ PSWDictEnter(wellKnownPSNames,"xshow", 194);
+ PSWDictEnter(wellKnownPSNames,"xyshow", 195);
+ PSWDictEnter(wellKnownPSNames,"yshow", 196);
+ PSWDictEnter(wellKnownPSNames,"FontDirectory", 197);
+ PSWDictEnter(wellKnownPSNames,"SharedFontDirectory", 198);
+ PSWDictEnter(wellKnownPSNames,"Courier", 199);
+ PSWDictEnter(wellKnownPSNames,"Courier-Bold", 200);
+ PSWDictEnter(wellKnownPSNames,"Courier-BoldOblique", 201);
+ PSWDictEnter(wellKnownPSNames,"Courier-Oblique", 202);
+ PSWDictEnter(wellKnownPSNames,"Helvetica", 203);
+ PSWDictEnter(wellKnownPSNames,"Helvetica-Bold", 204);
+ PSWDictEnter(wellKnownPSNames,"Helvetica-BoldOblique", 205);
+ PSWDictEnter(wellKnownPSNames,"Helvetica-Oblique", 206);
+ PSWDictEnter(wellKnownPSNames,"Symbol", 207);
+ PSWDictEnter(wellKnownPSNames,"Times-Bold", 208);
+ PSWDictEnter(wellKnownPSNames,"Times-BoldItalic", 209);
+ PSWDictEnter(wellKnownPSNames,"Times-Italic", 210);
+ PSWDictEnter(wellKnownPSNames,"Times-Roman", 211);
+ PSWDictEnter(wellKnownPSNames,"execuserobject", 212);
+ PSWDictEnter(wellKnownPSNames,"=", 256);
+ PSWDictEnter(wellKnownPSNames,"==", 257);
+ PSWDictEnter(wellKnownPSNames,"ISOLatin1Encoding", 258);
+ PSWDictEnter(wellKnownPSNames,"StandardEncoding", 259);
+ PSWDictEnter(wellKnownPSNames,"[", 260);
+ PSWDictEnter(wellKnownPSNames,"]", 261);
+ PSWDictEnter(wellKnownPSNames,"atan", 262);
+ PSWDictEnter(wellKnownPSNames,"banddevice", 263);
+ PSWDictEnter(wellKnownPSNames,"bytesavailable", 264);
+ PSWDictEnter(wellKnownPSNames,"cachestatus", 265);
+ PSWDictEnter(wellKnownPSNames,"closefile", 266);
+ PSWDictEnter(wellKnownPSNames,"colorimage", 267);
+ PSWDictEnter(wellKnownPSNames,"condition", 268);
+ PSWDictEnter(wellKnownPSNames,"copypage", 269);
+ PSWDictEnter(wellKnownPSNames,"cos", 270);
+ PSWDictEnter(wellKnownPSNames,"countdictstack", 271);
+ PSWDictEnter(wellKnownPSNames,"countexecstack", 272);
+ PSWDictEnter(wellKnownPSNames,"cshow", 273);
+ PSWDictEnter(wellKnownPSNames,"currentblackgeneration", 274);
+ PSWDictEnter(wellKnownPSNames,"currentcacheparams", 275);
+ PSWDictEnter(wellKnownPSNames,"currentcolorscreen", 276);
+ PSWDictEnter(wellKnownPSNames,"currentcolortransfer", 277);
+ PSWDictEnter(wellKnownPSNames,"currentcontext", 278);
+ PSWDictEnter(wellKnownPSNames,"currentflat", 279);
+ PSWDictEnter(wellKnownPSNames,"currenthalftone", 280);
+ PSWDictEnter(wellKnownPSNames,"currenthalftonephase", 281);
+ PSWDictEnter(wellKnownPSNames,"currentmiterlimit", 282);
+ PSWDictEnter(wellKnownPSNames,"currentobjectformat", 283);
+ PSWDictEnter(wellKnownPSNames,"currentpacking", 284);
+ PSWDictEnter(wellKnownPSNames,"currentscreen", 285);
+ PSWDictEnter(wellKnownPSNames,"currentstrokeadjust", 286);
+ PSWDictEnter(wellKnownPSNames,"currenttransfer", 287);
+ PSWDictEnter(wellKnownPSNames,"currentundercolorremoval", 288);
+ PSWDictEnter(wellKnownPSNames,"defaultmatrix", 289);
+ PSWDictEnter(wellKnownPSNames,"definefont", 290);
+ PSWDictEnter(wellKnownPSNames,"deletefile", 291);
+ PSWDictEnter(wellKnownPSNames,"detach", 292);
+ PSWDictEnter(wellKnownPSNames,"deviceinfo", 293);
+ PSWDictEnter(wellKnownPSNames,"dictstack", 294);
+ PSWDictEnter(wellKnownPSNames,"echo", 295);
+ PSWDictEnter(wellKnownPSNames,"erasepage", 296);
+ PSWDictEnter(wellKnownPSNames,"errordict", 297);
+ PSWDictEnter(wellKnownPSNames,"execstack", 298);
+ PSWDictEnter(wellKnownPSNames,"executeonly", 299);
+ PSWDictEnter(wellKnownPSNames,"exp", 300);
+ PSWDictEnter(wellKnownPSNames,"false", 301);
+ PSWDictEnter(wellKnownPSNames,"filenameforall", 302);
+ PSWDictEnter(wellKnownPSNames,"fileposition", 303);
+ PSWDictEnter(wellKnownPSNames,"fork", 304);
+ PSWDictEnter(wellKnownPSNames,"framedevice", 305);
+ PSWDictEnter(wellKnownPSNames,"grestoreall", 306);
+ PSWDictEnter(wellKnownPSNames,"handleerror", 307);
+ PSWDictEnter(wellKnownPSNames,"initclip", 308);
+ PSWDictEnter(wellKnownPSNames,"initgraphics", 309);
+ PSWDictEnter(wellKnownPSNames,"initmatrix", 310);
+ PSWDictEnter(wellKnownPSNames,"instroke", 311);
+ PSWDictEnter(wellKnownPSNames,"inustroke", 312);
+ PSWDictEnter(wellKnownPSNames,"join", 313);
+ PSWDictEnter(wellKnownPSNames,"kshow", 314);
+ PSWDictEnter(wellKnownPSNames,"ln", 315);
+ PSWDictEnter(wellKnownPSNames,"lock", 316);
+ PSWDictEnter(wellKnownPSNames,"log", 317);
+ PSWDictEnter(wellKnownPSNames,"mark", 318);
+ PSWDictEnter(wellKnownPSNames,"monitor", 319);
+ PSWDictEnter(wellKnownPSNames,"noaccess", 320);
+ PSWDictEnter(wellKnownPSNames,"notify", 321);
+ PSWDictEnter(wellKnownPSNames,"nulldevice", 322);
+ PSWDictEnter(wellKnownPSNames,"packedarray", 323);
+ PSWDictEnter(wellKnownPSNames,"quit", 324);
+ PSWDictEnter(wellKnownPSNames,"rand", 325);
+ PSWDictEnter(wellKnownPSNames,"rcheck", 326);
+ PSWDictEnter(wellKnownPSNames,"readonly", 327);
+ PSWDictEnter(wellKnownPSNames,"realtime", 328);
+ PSWDictEnter(wellKnownPSNames,"renamefile", 329);
+ PSWDictEnter(wellKnownPSNames,"renderbands", 330);
+ PSWDictEnter(wellKnownPSNames,"resetfile", 331);
+ PSWDictEnter(wellKnownPSNames,"reversepath", 332);
+ PSWDictEnter(wellKnownPSNames,"rootfont", 333);
+ PSWDictEnter(wellKnownPSNames,"rrand", 334);
+ PSWDictEnter(wellKnownPSNames,"run", 335);
+ PSWDictEnter(wellKnownPSNames,"scheck", 336);
+ PSWDictEnter(wellKnownPSNames,"setblackgeneration", 337);
+ PSWDictEnter(wellKnownPSNames,"setcachelimit", 338);
+ PSWDictEnter(wellKnownPSNames,"setcacheparams", 339);
+ PSWDictEnter(wellKnownPSNames,"setcolorscreen", 340);
+ PSWDictEnter(wellKnownPSNames,"setcolortransfer", 341);
+ PSWDictEnter(wellKnownPSNames,"setfileposition", 342);
+ PSWDictEnter(wellKnownPSNames,"setflat", 343);
+ PSWDictEnter(wellKnownPSNames,"sethalftone", 344);
+ PSWDictEnter(wellKnownPSNames,"sethalftonephase", 345);
+ PSWDictEnter(wellKnownPSNames,"setmiterlimit", 346);
+ PSWDictEnter(wellKnownPSNames,"setobjectformat", 347);
+ PSWDictEnter(wellKnownPSNames,"setpacking", 348);
+ PSWDictEnter(wellKnownPSNames,"setscreen", 349);
+ PSWDictEnter(wellKnownPSNames,"setstrokeadjust", 350);
+ PSWDictEnter(wellKnownPSNames,"settransfer", 351);
+ PSWDictEnter(wellKnownPSNames,"setucacheparams", 352);
+ PSWDictEnter(wellKnownPSNames,"setundercolorremoval", 353);
+ PSWDictEnter(wellKnownPSNames,"sin", 354);
+ PSWDictEnter(wellKnownPSNames,"sqrt", 355);
+ PSWDictEnter(wellKnownPSNames,"srand", 356);
+ PSWDictEnter(wellKnownPSNames,"stack", 357);
+ PSWDictEnter(wellKnownPSNames,"status", 358);
+ PSWDictEnter(wellKnownPSNames,"statusdict", 359);
+ PSWDictEnter(wellKnownPSNames,"true", 360);
+ PSWDictEnter(wellKnownPSNames,"ucachestatus", 361);
+ PSWDictEnter(wellKnownPSNames,"undefinefont", 362);
+ PSWDictEnter(wellKnownPSNames,"usertime", 363);
+ PSWDictEnter(wellKnownPSNames,"ustrokepath", 364);
+ PSWDictEnter(wellKnownPSNames,"version", 365);
+ PSWDictEnter(wellKnownPSNames,"vmreclaim", 366);
+ PSWDictEnter(wellKnownPSNames,"vmstatus", 367);
+ PSWDictEnter(wellKnownPSNames,"wait", 368);
+ PSWDictEnter(wellKnownPSNames,"wcheck", 369);
+ PSWDictEnter(wellKnownPSNames,"xcheck", 370);
+ PSWDictEnter(wellKnownPSNames,"yield", 371);
+ PSWDictEnter(wellKnownPSNames,"defineuserobject", 372);
+ PSWDictEnter(wellKnownPSNames,"undefineuserobject", 373);
+ PSWDictEnter(wellKnownPSNames,"UserObjects", 374);
+ PSWDictEnter(wellKnownPSNames,"cleardictstack", 375);
+ PSWDictEnter(wellKnownPSNames,"A", 376);
+ PSWDictEnter(wellKnownPSNames,"B", 377);
+ PSWDictEnter(wellKnownPSNames,"C", 378);
+ PSWDictEnter(wellKnownPSNames,"D", 379);
+ PSWDictEnter(wellKnownPSNames,"E", 380);
+ PSWDictEnter(wellKnownPSNames,"F", 381);
+ PSWDictEnter(wellKnownPSNames,"G", 382);
+ PSWDictEnter(wellKnownPSNames,"H", 383);
+ PSWDictEnter(wellKnownPSNames,"I", 384);
+ PSWDictEnter(wellKnownPSNames,"J", 385);
+ PSWDictEnter(wellKnownPSNames,"K", 386);
+ PSWDictEnter(wellKnownPSNames,"L", 387);
+ PSWDictEnter(wellKnownPSNames,"M", 388);
+ PSWDictEnter(wellKnownPSNames,"N", 389);
+ PSWDictEnter(wellKnownPSNames,"O", 390);
+ PSWDictEnter(wellKnownPSNames,"P", 391);
+ PSWDictEnter(wellKnownPSNames,"Q", 392);
+ PSWDictEnter(wellKnownPSNames,"R", 393);
+ PSWDictEnter(wellKnownPSNames,"S", 394);
+ PSWDictEnter(wellKnownPSNames,"T", 395);
+ PSWDictEnter(wellKnownPSNames,"U", 396);
+ PSWDictEnter(wellKnownPSNames,"V", 397);
+ PSWDictEnter(wellKnownPSNames,"W", 398);
+ PSWDictEnter(wellKnownPSNames,"X", 399);
+ PSWDictEnter(wellKnownPSNames,"Y", 400);
+ PSWDictEnter(wellKnownPSNames,"Z", 401);
+ PSWDictEnter(wellKnownPSNames,"a", 402);
+ PSWDictEnter(wellKnownPSNames,"b", 403);
+ PSWDictEnter(wellKnownPSNames,"c", 404);
+ PSWDictEnter(wellKnownPSNames,"d", 405);
+ PSWDictEnter(wellKnownPSNames,"e", 406);
+ PSWDictEnter(wellKnownPSNames,"f", 407);
+ PSWDictEnter(wellKnownPSNames,"g", 408);
+ PSWDictEnter(wellKnownPSNames,"h", 409);
+ PSWDictEnter(wellKnownPSNames,"i", 410);
+ PSWDictEnter(wellKnownPSNames,"j", 411);
+ PSWDictEnter(wellKnownPSNames,"k", 412);
+ PSWDictEnter(wellKnownPSNames,"l", 413);
+ PSWDictEnter(wellKnownPSNames,"m", 414);
+ PSWDictEnter(wellKnownPSNames,"n", 415);
+ PSWDictEnter(wellKnownPSNames,"o", 416);
+ PSWDictEnter(wellKnownPSNames,"p", 417);
+ PSWDictEnter(wellKnownPSNames,"q", 418);
+ PSWDictEnter(wellKnownPSNames,"r", 419);
+ PSWDictEnter(wellKnownPSNames,"s", 420);
+ PSWDictEnter(wellKnownPSNames,"t", 421);
+ PSWDictEnter(wellKnownPSNames,"u", 422);
+ PSWDictEnter(wellKnownPSNames,"v", 423);
+ PSWDictEnter(wellKnownPSNames,"w", 424);
+ PSWDictEnter(wellKnownPSNames,"x", 425);
+ PSWDictEnter(wellKnownPSNames,"y", 426);
+ PSWDictEnter(wellKnownPSNames,"z", 427);
+ PSWDictEnter(wellKnownPSNames,"setvmthreshold", 428);
+ PSWDictEnter(wellKnownPSNames,"<<", 429);
+ PSWDictEnter(wellKnownPSNames,">>", 430);
+
diff --git a/nx-X11/config/pswrap/systemnames.c b/nx-X11/config/pswrap/systemnames.c
new file mode 100644
index 000000000..af1dbb83a
--- /dev/null
+++ b/nx-X11/config/pswrap/systemnames.c
@@ -0,0 +1,47 @@
+/*
+ * systemnames.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+#include "pswpriv.h"
+#include "pswdict.h"
+
+PSWDict wellKnownPSNames;
+
+void InitWellKnownPSNames(void)
+{
+#include "sysname_gen.c"
+}
diff --git a/nx-X11/config/pswrap/yyerror.c b/nx-X11/config/pswrap/yyerror.c
new file mode 100644
index 000000000..56044b4b4
--- /dev/null
+++ b/nx-X11/config/pswrap/yyerror.c
@@ -0,0 +1,77 @@
+/*
+ * yyerror.c
+ *
+ * (c) Copyright 1988-1994 Adobe Systems Incorporated.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sublicense this software
+ * and its documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notices appear in all copies and that
+ * both those copyright notices and this permission notice appear in
+ * supporting documentation and that the name of Adobe Systems Incorporated
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. No trademark license
+ * to use the Adobe trademarks is hereby granted. If the Adobe trademark
+ * "Display PostScript"(tm) is used to describe this software, its
+ * functionality or for any other purpose, such use shall be limited to a
+ * statement that this software works in conjunction with the Display
+ * PostScript system. Proper trademark attribution to reflect Adobe's
+ * ownership of the trademark shall be given whenever any such reference to
+ * the Display PostScript system is made.
+ *
+ * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
+ * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
+ * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
+ * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
+ * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
+ *
+ * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
+ * Incorporated which may be registered in certain jurisdictions
+ *
+ * Author: Adobe Systems Incorporated
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+
+#include "pswpriv.h"
+
+/* ErrIntro prints a standard intro for error messages;
+ * change it if your system uses something else. We have many options:
+ *
+ * to match Macintosh: #define FMT "File \"%s\"; Line %d # "
+ * to match BSD cc: #define FMT "\"%s\", line %d: "
+ * to match gcc: #define FMT "%s:%d: "
+ * to match Mips cc: #define FMT "pswrap: Error: %s, line %d: "
+ */
+
+
+#define INTRO "# In function %s -\n"
+
+#ifdef macintosh
+#define FMT "File \"%s\"; Line %d # "
+#else /* macintosh */
+#define FMT "\"%s\", line %d: "
+#endif /* macintosh */
+
+void ErrIntro(int line)
+{
+ if (! reportedPSWName && currentPSWName) {
+ reportedPSWName = 1;
+ fprintf(stderr,INTRO,currentPSWName);
+ }
+ fprintf(stderr,FMT,ifile,line);
+ errorCount++;
+}
+
+
+void yyerror(char *errmsg)
+{
+ ErrIntro(yylineno);
+ fprintf(stderr,"%s near text \"%s\"\n",errmsg,yytext);
+}