diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2011-04-12 14:17:47 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2011-04-12 14:17:47 +0000 |
commit | 307453997ef030ec4dfa1e876feaf0b8b8125bab (patch) | |
tree | ab2054693ba95e9ac8f6e3478b4d0175d893329f /Build/source/texk/web2c/luatexdir/luascripts | |
parent | d95b11a25d3d9e17cc4afb9c8713ef4037567527 (diff) |
check in luatex 0.66.0
git-svn-id: svn://tug.org/texlive/trunk@22059 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luascripts')
3 files changed, 204 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.h b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.h new file mode 100644 index 00000000000..d835843e523 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.h @@ -0,0 +1,34 @@ +/* pdflua.h + + Copyright 2010 Taco Hoekwater <taco@luatex.org> + Copyright 2010 Hartmut Henkel <hartmut@luatex.org> + + This file is part of LuaTeX. + + LuaTeX is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at your + option) any later version. + + LuaTeX is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU General Public License along + with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ + +/* $Id: pdflua.h 3937 2010-11-01 21:58:54Z hhenkel $ */ + +#ifndef PDFLUA_H +# define PDFLUA_H + +typedef struct _zlib_struct { + uLong uncomprLen; + uLong comprLen; + const Byte *compr; +} zlib_struct; + +extern const zlib_struct *pdflua_zlib_struct_ptr; + +#endif /* PDFLUA_H */ diff --git a/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua new file mode 100644 index 00000000000..2009b162d92 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luascripts/pdflua.lua @@ -0,0 +1,25 @@ +-- $Id: pdflua.lua 3949 2010-11-07 00:09:19Z hhenkel $ +-- $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luascripts/pdflua.lua $ + +-- this is early work in progress... + +------------------------------------------------------------------------ + +beginpage = function(a) +end + +endpage = function(a) +end + +outputpagestree = function() +end + +------------------------------------------------------------------------ + +local pdflua = { + beginpage = beginpage, + endpage = endpage, + outputpagestree = outputpagestree, +} + +return pdflua diff --git a/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w b/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w new file mode 100644 index 00000000000..ccf5d56cb88 --- /dev/null +++ b/Build/source/texk/web2c/luatexdir/luascripts/txt2zlib.w @@ -0,0 +1,145 @@ +% txt2zlib.w + +% Copyright 2010 Taco Hoekwater <taco@@luatex.org> +% Copyright 2010 Hartmut Henkel <hartmut@@luatex.org> + +% This file is part of LuaTeX. + +% LuaTeX is free software; you can redistribute it and/or modify it under +% the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your +% option) any later version. + +% LuaTeX is distributed in the hope that it will be useful, but WITHOUT +% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +% FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +% License for more details. + +% You should have received a copy of the GNU General Public License along +% with LuaTeX; if not, see <http://www.gnu.org/licenses/>. + +% $Id: txt2zlib.w 3937 2010-11-01 21:58:54Z hhenkel $ +% $URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.66.0/source/texk/web2c/luatexdir/luascripts/txt2zlib.w $ + +@ +@c + +#include<stdlib.h> +#include<stdio.h> +#include<string.h> +#include<zlib.h> + +#define INBUFINITLEN 10 +#define LINELEN 16 + +char header[] = + " Copyright 2010 Taco Hoekwater <taco@@luatex.org>\n" + " Copyright 2010 Hartmut Henkel <hartmut@@luatex.org>\n" + "\n" + " This file is part of LuaTeX.\n" + "\n" + " LuaTeX is free software; you can redistribute it and/or modify it under\n" + " the terms of the GNU General Public License as published by the Free\n" + " Software Foundation; either version 2 of the License, or (at your\n" + " option) any later version.\n" + "\n" + " LuaTeX is distributed in the hope that it will be useful, but WITHOUT\n" + " ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" + " FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\n" + " License for more details.\n" + "\n" + " You should have received a copy of the GNU General Public License along\n" + " with LuaTeX; if not, see <http://www.gnu.org/licenses/>."; + +#define NAMELEN 100 + +int main(int argc, char *argv[]) +{ + int i, j, c, err; + Byte *inbuf = NULL, *outbuf; + FILE *fin, *fout; + char ptrname[NAMELEN]; + uLong inbuflen, uncomprLen = 0, outbuflen, comprLen; + + if (argc != 3) { + fprintf(stderr, + "%s: need exactly two arguments (input file name, output file name).\n", + argv[0]); + exit(EXIT_FAILURE); + } + fin = fopen(argv[1], "r"); + if (fin == NULL) { + fprintf(stderr, "%s: can't open %s for reading.\n", argv[0], argv[1]); + exit(EXIT_FAILURE); + } + fout = fopen(argv[2], "w"); + if (fout == NULL) { + fprintf(stderr, "%s: can't open %s for writing.\n", argv[0], argv[2]); + exit(EXIT_FAILURE); + } + if ((inbuf = malloc(INBUFINITLEN * sizeof(Byte))) == NULL) + exit(EXIT_FAILURE); + inbuflen = INBUFINITLEN; + while ((c = fgetc(fin)) != EOF) { + if (uncomprLen == inbuflen - 1) { + inbuflen = (uLong) ((double) inbuflen * 1.5 + 1); + if ((inbuf = realloc(inbuf, inbuflen)) == NULL) + exit(EXIT_FAILURE); + } + inbuf[uncomprLen] = (Byte) c; + uncomprLen++; + } + + outbuflen = comprLen = (uLong) ((double) uncomprLen * 1.1 + 50); + if ((outbuf = malloc(outbuflen * sizeof(Byte))) == NULL) + exit(EXIT_FAILURE); + + err = compress(outbuf, &comprLen, inbuf, uncomprLen); + + if (err != Z_OK) { + fprintf(stderr, "compress error: %d\n", err); + exit(EXIT_FAILURE); + } + + fprintf(fout, "/* %s\n\n", argv[2]); + fprintf(fout, "%s */\n\n", header); + fprintf(fout, "#include \"ptexlib.h\"\n\n"); + + fprintf(fout, "static const Byte compr[%ld] = {\n", comprLen); + for (i = 0, j = 0; (uLong) i < comprLen; i++) { + if (j == 0) + fprintf(fout, " "); + fprintf(fout, "0x%02x", outbuf[i]); + if ((uLong) i < comprLen - 1) { + fprintf(fout, ","); + if (j == LINELEN - 1) { + fprintf(fout, "\n"); + j = 0; + } else { + fprintf(fout, " "); + j++; + } + } + } + fprintf(fout, "\n};\n\n"); + + strncpy(ptrname, argv[2], NAMELEN - 20); + for (i = (int) strlen(ptrname) - 1; i > 0; i--) { + if (ptrname[i] == '.') { + ptrname[i] = '\0'; + break; + } + } + + strcat(ptrname, "_zlib_struct_ptr"); + + fprintf(fout, + "static const zlib_struct compr_struct = { %ld, %ld, compr };\n\n", + uncomprLen, comprLen); + + fprintf(fout, "const zlib_struct *%s = &compr_struct;\n", ptrname); + + fclose(fin); + fclose(fout); + return EXIT_SUCCESS; +} |