From 142b5ec17f7b4296c53b7e77fae4ba2a9c6bf772 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 19 Feb 2013 21:46:39 +0000 Subject: More Mac fixes git-svn-id: svn://tug.org/texlive/trunk@29167 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 95 +++++---- Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 1 + Build/source/texk/web2c/xetexdir/XeTeX_mac.c | 76 ++----- Build/source/texk/web2c/xetexdir/am/xetex.am | 2 +- Build/source/texk/web2c/xetexdir/xetexwebmac.tex | 255 ----------------------- Build/source/texk/web2c/xetexdir/xewebmac.tex | 255 +++++++++++++++++++++++ 6 files changed, 330 insertions(+), 354 deletions(-) delete mode 100644 Build/source/texk/web2c/xetexdir/xetexwebmac.tex create mode 100644 Build/source/texk/web2c/xetexdir/xewebmac.tex (limited to 'Build/source/texk/web2c') diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 56b00d66fd0..8a156db6f2c 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -2483,28 +2483,30 @@ atsufontgetnamed(int what, CFDictionaryRef attributes) case XeTeX_find_variation_by_name: { CFArrayRef axes = CTFontCopyVariationAxes(font); - CFDictionaryRef variation = findDictionaryInArray(axes, kCTFontVariationAxisNameKey, - (const char*)nameoffile + 1, namelength); - if (variation) { - CFNumberRef identifier = CFDictionaryGetValue(variation, kCTFontVariationAxisIdentifierKey); - CFNumberGetValue(identifier, kCFNumberIntType, &rval); - } else - rval = -1; - CFRelease(axes); + if (axes) { + CFDictionaryRef variation = findDictionaryInArray(axes, kCTFontVariationAxisNameKey, + (const char*)nameoffile + 1, namelength); + if (variation) { + CFNumberRef identifier = CFDictionaryGetValue(variation, kCTFontVariationAxisIdentifierKey); + CFNumberGetValue(identifier, kCFNumberIntType, &rval); + } + CFRelease(axes); + } break; } case XeTeX_find_feature_by_name: { CFArrayRef features = CTFontCopyFeatures(font); - CFDictionaryRef feature = findDictionaryInArray(features, kCTFontFeatureTypeNameKey, - (const char*)nameoffile + 1, namelength); - if (feature) { - CFNumberRef identifier = CFDictionaryGetValue(feature, kCTFontFeatureTypeIdentifierKey); - CFNumberGetValue(identifier, kCFNumberIntType, &rval); - } else - rval = -1; - CFRelease(features); + if (features) { + CFDictionaryRef feature = findDictionaryInArray(features, kCTFontFeatureTypeNameKey, + (const char*)nameoffile + 1, namelength); + if (feature) { + CFNumberRef identifier = CFDictionaryGetValue(feature, kCTFontFeatureTypeIdentifierKey); + CFNumberGetValue(identifier, kCFNumberIntType, &rval); + } + CFRelease(features); + } break; } } @@ -2523,13 +2525,15 @@ atsufontgetnamed1(int what, CFDictionaryRef attributes, int param) if (what == XeTeX_find_selector_by_name) { CFArrayRef features = CTFontCopyFeatures(font); - CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, kCTFontFeatureTypeIdentifierKey, param); - if (feature) { - CFNumberRef selector = findSelectorByName(feature, (const char*)nameoffile + 1, namelength); - if (selector) - CFNumberGetValue(selector, kCFNumberIntType, &rval); + if (features) { + CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, kCTFontFeatureTypeIdentifierKey, param); + if (feature) { + CFNumberRef selector = findSelectorByName(feature, (const char*)nameoffile + 1, namelength); + if (selector) + CFNumberGetValue(selector, kCFNumberIntType, &rval); + } + CFRelease(features); } - CFRelease(features); } #endif @@ -2544,31 +2548,34 @@ atsuprintfontname(int what, CFDictionaryRef attributes, int param1, int param2) CFStringRef name = NULL; if (what == XeTeX_variation_name) { CFArrayRef axes = CTFontCopyVariationAxes(font); - CFDictionaryRef variation = findDictionaryInArrayWithIdentifier(axes, - kCTFontVariationAxisIdentifierKey, - param1); - if (variation) - name = CFDictionaryGetValue(variation, kCTFontVariationAxisNameKey); - CFRelease(axes); - } - else if (what == XeTeX_feature_name || XeTeX_selector_name) { + if (axes) { + CFDictionaryRef variation = findDictionaryInArrayWithIdentifier(axes, + kCTFontVariationAxisIdentifierKey, + param1); + if (variation) + name = CFDictionaryGetValue(variation, kCTFontVariationAxisNameKey); + CFRelease(axes); + } + } else if (what == XeTeX_feature_name || what == XeTeX_selector_name) { CFArrayRef features = CTFontCopyFeatures(font); - CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, - kCTFontFeatureTypeIdentifierKey, - param1); - if (feature) { - if (what == XeTeX_feature_name) - name = CFDictionaryGetValue(feature, kCTFontFeatureTypeNameKey); - else { - CFArrayRef selectors = CFDictionaryGetValue(feature, kCTFontFeatureTypeSelectorsKey); - CFDictionaryRef selector = findDictionaryInArrayWithIdentifier(selectors, - kCTFontFeatureSelectorIdentifierKey, - param2); - if (selector) - name = CFDictionaryGetValue(selector, kCTFontFeatureSelectorNameKey); + if (features) { + CFDictionaryRef feature = findDictionaryInArrayWithIdentifier(features, + kCTFontFeatureTypeIdentifierKey, + param1); + if (feature) { + if (what == XeTeX_feature_name) + name = CFDictionaryGetValue(feature, kCTFontFeatureTypeNameKey); + else { + CFArrayRef selectors = CFDictionaryGetValue(feature, kCTFontFeatureTypeSelectorsKey); + CFDictionaryRef selector = findDictionaryInArrayWithIdentifier(selectors, + kCTFontFeatureSelectorIdentifierKey, + param2); + if (selector) + name = CFDictionaryGetValue(selector, kCTFontFeatureSelectorNameKey); + } } + CFRelease(features); } - CFRelease(features); } if (name) { diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index 0d8047a96d1..dab8fba93a1 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -62,6 +62,7 @@ typedef struct UFILE* unicodefile; but otherwise we'll need these substitute definitions */ #ifdef XETEX_MAC +#include #include #else typedef int32_t Fixed; diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c index 4f0f186bdf4..df72c4e969c 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c @@ -36,12 +36,6 @@ authorization from the copyright holders. * additional plain C extensions for XeTeX - MacOS-specific routines */ -#ifdef __POWERPC__ -#define MAC_OS_X_VERSION_MIN_REQUIRED 1030 -#else -#define MAC_OS_X_VERSION_MIN_REQUIRED 1040 -#endif - #define EXTERN extern #include "xetexd.h" @@ -186,9 +180,8 @@ void getGlyphBBoxFromCTFont(CTFontRef font, UInt16 gid, GlyphBBox* bbox) bbox->xMin = bbox->yMin = bbox->xMax = bbox->yMax = 0; else { // convert PS to TeX points and flip y-axis - // TODO: do we need to flip for bounding rect returned by Core Text? - bbox->yMin = -PStoTeXPoints(rect.origin.y + rect.size.height); - bbox->yMax = -PStoTeXPoints(rect.origin.y); + bbox->yMin = PStoTeXPoints(rect.origin.y); + bbox->yMax = PStoTeXPoints(rect.origin.y + rect.size.height); bbox->xMin = PStoTeXPoints(rect.origin.x); bbox->xMax = PStoTeXPoints(rect.origin.x + rect.size.width); } @@ -761,52 +754,27 @@ find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page) page = nPages; CGRect r; -#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3 - if (&CGPDFDocumentGetPage == NULL) { - switch (pdfBoxType) { - case pdfbox_crop: - default: - r = CGPDFDocumentGetCropBox(document, page); - break; - case pdfbox_media: - r = CGPDFDocumentGetMediaBox(document, page); - break; - case pdfbox_bleed: - r = CGPDFDocumentGetBleedBox(document, page); - break; - case pdfbox_trim: - r = CGPDFDocumentGetTrimBox(document, page); - break; - case pdfbox_art: - r = CGPDFDocumentGetArtBox(document, page); - break; - } - } - else -#endif - { - CGPDFPageRef pageRef = CGPDFDocumentGetPage(document, page); - CGPDFBox boxType; - switch (pdfBoxType) { - case pdfbox_crop: - default: - boxType = kCGPDFCropBox; - break; - case pdfbox_media: - boxType = kCGPDFMediaBox; - break; - case pdfbox_bleed: - boxType = kCGPDFBleedBox; - break; - case pdfbox_trim: - boxType = kCGPDFTrimBox; - break; - case pdfbox_art: - boxType = kCGPDFArtBox; - break; - } - r = CGPDFPageGetBoxRect(pageRef, boxType); + CGPDFPageRef pageRef = CGPDFDocumentGetPage(document, page); + CGPDFBox boxType; + switch (pdfBoxType) { + case pdfbox_crop: + default: + boxType = kCGPDFCropBox; + break; + case pdfbox_media: + boxType = kCGPDFMediaBox; + break; + case pdfbox_bleed: + boxType = kCGPDFBleedBox; + break; + case pdfbox_trim: + boxType = kCGPDFTrimBox; + break; + case pdfbox_art: + boxType = kCGPDFArtBox; + break; } + r = CGPDFPageGetBoxRect(pageRef, boxType); bounds->x = r.origin.x * 72.27 / 72.0; bounds->y = r.origin.y * 72.27 / 72.0; diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am index eef92eb9a09..7a9c190f789 100644 --- a/Build/source/texk/web2c/xetexdir/am/xetex.am +++ b/Build/source/texk/web2c/xetexdir/am/xetex.am @@ -184,5 +184,5 @@ endif XETEX ## Not used ## -EXTRA_DIST += xetexdir/COPYING +EXTRA_DIST += xetexdir/COPYING xetexdir/xewebmac.tex diff --git a/Build/source/texk/web2c/xetexdir/xetexwebmac.tex b/Build/source/texk/web2c/xetexdir/xetexwebmac.tex deleted file mode 100644 index 771d58df240..00000000000 --- a/Build/source/texk/web2c/xetexdir/xetexwebmac.tex +++ /dev/null @@ -1,255 +0,0 @@ -% standard macros for WEB listings (in addition to PLAIN.TEX) -% -% pdfTeX adjustments mainained by Han The Thanh . -% XeTeX adjustments mainited by Khaled Hosny -% -\xdef\fmtversion{\fmtversion+WEBMAC4.1} % identifies current set of macros -\parskip 0pt % no stretch between paragraphs -\parindent 1em % for paragraphs and for the first line of Pascal text - -\font\eightrm=cmr8 \let\sc=\eightrm % NOT a caps-and-small-caps font! -\let\mainfont=\tenrm -\font\titlefont=cmr7 scaled\magstep4 % title on the contents page -\font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title -\font\tentex=cmtex10 % TeX extended character set (used in strings) -\fontdimen7\tentex=0pt % no extra space after punctuation - -\def\\#1{\hbox{\it#1\/\kern.05em}} % italic type for identifiers -\def\|#1{\hbox{$#1$}} % one-letter identifiers look a bit better this way -\def\{\hbox{\bf#1\/}} % boldface type for reserved words -\def\.#1{\hbox{\tentex % typewriter type for strings - \let\\=\BS % backslash in a string - \let\'=\RQ % right quote in a string - \let\`=\LQ % left quote in a string - \let\{=\LB % left brace in a string - \let\}=\RB % right brace in a string - \let\~=\TL % tilde in a string - \let\ =\SP % space in a string - \let\_=\UL % underline in a string - \let\&=\AM % ampersand in a string - #1}} -\def\#{\hbox{\tt\char`\#}} % parameter sign -\def\${\hbox{\tt\char`\$}} % dollar sign -\def\%{\hbox{\tt\char`\%}} % percent sign -\def\^{\ifmmode\mathchar"222 \else\char`^ \fi} % pointer or hat -% circumflex accents can be obtained from \^^D instead of \^ -\def\AT!{@} % at sign for control text - -\chardef\AM=`\& % ampersand character in a string -\chardef\BS=`\\ % backslash in a string -\chardef\LB=`\{ % left brace in a string -\def\LQ{{\tt\char'22}} % left quote in a string -\chardef\RB=`\} % right brace in a string -\def\RQ{{\tt\char'23}} % right quote in a string -\def\SP{{\tt\char`\ }} % (visible) space in a string -\chardef\TL=`\~ % tilde in a string -\chardef\UL=`\_ % underline character in a string - -\newbox\bak \setbox\bak=\hbox to -1em{} % backspace one em -\newbox\bakk\setbox\bakk=\hbox to -2em{} % backspace two ems - -\newcount\ind % current indentation in ems -\def\1{\global\advance\ind by1\hangindent\ind em} % indent one more notch -\def\2{\global\advance\ind by-1} % indent one less notch -\def\3#1{\hfil\penalty#10\hfilneg} % optional break within a statement -\def\4{\copy\bak} % backspace one notch -\def\5{\hfil\penalty-1\hfilneg\kern2.5em\copy\bakk\ignorespaces}% optional break -\def\6{\ifmmode\else\par % forced break - \hangindent\ind em\noindent\kern\ind em\copy\bakk\ignorespaces\fi} -\def\7{\Y\6} % forced break and a little extra space - -\let\yskip=\smallskip -\def\to{\mathrel{.\,.}} % double dot, used only in math mode - -% Some changes for xetex -\def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt\eightrm#1~\pdfnote#2..\par}} - -\def\linkcolor#1{\special{color push rgb 0.4 0.6 1.0}#1\special{color pop}} -\def\link#1#2{\special{pdf:bann<>>>}\linkcolor{#2}\special{pdf:eann}} - -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newcount\countA -\countA=0 -\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} -\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} -\def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS| - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makenote\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next -} -\def\n#1{\link{#1}{#1}} -\def\makenote{\addtokens{\toksB}% - {\noexpand\n{\the\toksC}}\toksC={}\global\countA=0} -\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} - -\def\lapstar{\rlap{*}} -\def\startsection{\Q{\let\*=\empty\special{pdf:dest (\modstar) [@thispage /XYZ @xpos @ypos null]}}% - \noindent{\let\*=\lapstar\bf\modstar.\quad}} -\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format' -\def\A{\note{See also section}} % crossref for doubly defined section name -\def\As{\note{See also sections}} % crossref for multiply defined section name -\def\B{\mathopen{\.{@\{}}} % begin controlled comment -\def\C#1{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % Pascal comments - \XX\hfil\penalty-1\hfilneg\quad$\{\,$#1$\,\}$\XX} -\def\D{\defin{define}} % macro definition -\def\E{\cdot10^} % exponent in floating point constant -\def\ET{ and~} % conjunction between two section numbers -\def\ETs{, and~} % conjunction between the last two of several section numbers -\def\F{\defin{format}} % format definition -\let\G=\ge % greater than or equal sign -\def\H#1{\hbox{\rm\char"7D\tt#1}} % hexadecimal constant -\let\I=\ne % unequal sign -\def\J{\.{@\&}} % TANGLE's join operation -\let\K=\gets % left arrow -\let\L=\le % less than or equal sign -\outer\def\M#1.{\MN#1.\ifon\vfil\penalty-100\vfilneg % beginning of section - \vskip12ptminus3pt\startsection\ignorespaces} -\outer\def\N#1.#2.{\MN#1.\vfil\eject % beginning of starred section - \def\rhead{\uppercase{\ignorespaces#2}} % define running headline - \message{*\modno} % progress report - \edef\next{\write\cont{\Z{#2}{\modno}{\the\pageno}}}\next % to contents file - \ifon\startsection{\bf\ignorespaces#2.\quad}\ignorespaces} -\def\MN#1.{\par % common code for \M, \N - {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}} - \ifx\modno\modstar \onmaybe \else\ontrue \fi \mark{\modno}} -\def\O#1{\hbox{\rm\char'23\kern-.2em\it#1\/\kern.05em}} % octal constant -\def\P{\rightskip=0pt plus 100pt minus 10pt % go into Pascal mode - \sfcode`;=3000 - \pretolerance 10000 - \hyphenpenalty 10000 \exhyphenpenalty 10000 - \global\ind=2 \1\ \unskip} -\def\Q{\rightskip=0pt % get out of Pascal mode - \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 } -\let\R=\lnot % logical not -\let\S=\equiv % equivalence sign -\def\T{\mathclose{\.{@\}}}} % terminate controlled comment -\def\U{\note{This code is used in section}} % crossref for use of a section -\def\Us{\note{This code is used in sections}} % crossref for uses of a section -\let\V=\lor % logical or -\let\W=\land % logical and -\def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % section name - \XX$\langle\,$#2{\eightrm\kern.5em\pdfnote#1.}$\,\rangle$\XX} -\def\Y{\par\yskip} -\let\Z=\let % now you can \send the control sequence \Z -\def\){\hbox{\.{@\$}}} % sign for string pool check sum -\def\]{\hbox{\.{@\\}}} % sign for forced line break -\def\=#1{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule - \hbox{\strut\kern2pt\.{#1}\kern2pt}} - \hrule}\vrule}\kern2pt} % verbatim string -\let\~=\ignorespaces -\let\*=* - -\def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue -\newif\ifon \newif\iftitle \newif\ifpagesaved -\def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead\hfill\title\qquad - \tensy x\mainfont\topmark} % top line on left-hand pages -\def\rheader{\tensy x\mainfont\topmark\eightrm\qquad\title\hfill\rhead - \qquad\mainfont\the\pageno} % top line on right-hand pages -\def\page{\box255 } -\def\normaloutput#1#2#3{\ifodd\pageno\hoffset=\pageshift\fi - \shipout\vbox{ - \vbox to\fullpageheight{ - \iftitle\global\titlefalse - \else\hbox to\pagewidth{\vbox to10pt{}\ifodd\pageno #3\else#2\fi}\fi - \vfill#1}} % parameter #1 is the page itself - \global\advance\pageno by1} - -\def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred sections -\def\title{} % an optional title can be set by the user -\def\topofcontents{\centerline{\titlefont\title} - \vfill} % this material will start the table of contents page -\def\botofcontents{\vfill} % this material will end the table of contents page -\def\contentspagenumber{0} % default page number for table of contents -\newdimen\pagewidth \pagewidth=6.5in % the width of each page -\newdimen\pageheight \pageheight=8.7in % the height of each page -\newdimen\fullpageheight \fullpageheight=9in % page height including headlines -\newdimen\pageshift \pageshift=0in % shift righthand pages wrt lefthand ones -\def\magnify#1{\mag=#1\pagewidth=6.5truein\pageheight=8.7truein - \fullpageheight=9truein\setpage} -\def\setpage{\hsize\pagewidth\vsize\pageheight} % use after changing page size -\def\contentsfile{CONTENTS} % file that gets table of contents info -\def\readcontents{\input CONTENTS} - -\newwrite\cont -\output{\setbox0=\page % the first page is garbage - \openout\cont=\contentsfile - \global\output{\normaloutput\page\lheader\rheader}} -\setpage -\vbox to \vsize{} % the first \topmark won't be null - -\def\ch{\note{The following sections were changed by the change file:} - \let\*=\relax} -\newbox\sbox % saved box preceding the index -\newbox\lbox % lefthand column in the index -\def\inx{\par\vskip6pt plus 1fil % we are beginning the index - \write\cont{} % ensure that the contents file isn't empty - \closeout\cont % the contents information has been fully gathered - \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi - \global\setbox\sbox=\page \global\pagesavedtrue} - \pagesavedfalse \eject % eject the page-so-far and predecessors - \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box - \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height - \hsize=.5\pagewidth \advance\hsize by -10pt - % column width for the index (20pt between cols) - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \def\lr{L} % this tells whether the left or right column is next - \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} - \else\normaloutput{\vbox to\pageheight{\box\sbox\vss - \hbox to\pagewidth{\box\lbox\hfil\page}}}\lheader\rheader - \global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi} - \message{Index:} - \parskip 0pt plus .5pt - \outer\def\:##1, {\par\hangindent2em\noindent##1:\kern1em\pdfnote} % index entry - \let\ttentry=\. \def\.##1{\ttentry{##1\kern.2em}} % give \tt a little room - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar - \hyphenpenalty 10000 \parindent0pt} -\def\fin{\par\vfill\eject % this is done when we are ending the index - \ifpagesaved\null\vfill\eject\fi % output a null index column - \if L\lr\else\null\vfill\eject\fi % finish the current page - \parfillskip 0pt plus 1fil - \def\rhead{NAMES OF THE SECTIONS} - \message{Section names:} - \output{\normaloutput\page\lheader\rheader} - \setpage - \def\note##1##2.{\hfil\penalty-1\hfilneg\quad{\eightrm##1~\pdfnote##2..}} - \linepenalty=10 % try to conserve lines - \def\U{\note{Used in section}} % crossref for use of a section - \def\Us{\note{Used in sections}} % crossref for uses of a section - \def\:{\par\hangindent 2em}\let\*=*\let\.=\ttentry} -\def\con{\par\vfill\eject % finish the section names - \rightskip 0pt \hyphenpenalty 50 \tolerance 200 - \setpage - \output{\normaloutput\page\lheader\rheader} - \titletrue % prepare to output the table of contents - \pageno=\contentspagenumber \def\rhead{TABLE OF CONTENTS} - \message{Table of contents:} - \topofcontents - \line{\hfil Section\hbox to3em{\hss Page}} - \def\Z##1##2##3{\line{\link{##2}{\ignorespaces##1 - \leaders\hbox to .5em{.\hfil}\hfil\ ##2} - \hbox to3em{\hss##3}}} - \readcontents\relax % read the contents info - \botofcontents \makeoutlines\end} % print the contents page(s) and terminate - -\newcount\countB -\def\makeoutlines{% - \def\?##1]{}\def\Z##1##2##3{\special{pdf:out 1 <>>>}} - \input CONTENTS\relax} -\endinput diff --git a/Build/source/texk/web2c/xetexdir/xewebmac.tex b/Build/source/texk/web2c/xetexdir/xewebmac.tex new file mode 100644 index 00000000000..771d58df240 --- /dev/null +++ b/Build/source/texk/web2c/xetexdir/xewebmac.tex @@ -0,0 +1,255 @@ +% standard macros for WEB listings (in addition to PLAIN.TEX) +% +% pdfTeX adjustments mainained by Han The Thanh . +% XeTeX adjustments mainited by Khaled Hosny +% +\xdef\fmtversion{\fmtversion+WEBMAC4.1} % identifies current set of macros +\parskip 0pt % no stretch between paragraphs +\parindent 1em % for paragraphs and for the first line of Pascal text + +\font\eightrm=cmr8 \let\sc=\eightrm % NOT a caps-and-small-caps font! +\let\mainfont=\tenrm +\font\titlefont=cmr7 scaled\magstep4 % title on the contents page +\font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title +\font\tentex=cmtex10 % TeX extended character set (used in strings) +\fontdimen7\tentex=0pt % no extra space after punctuation + +\def\\#1{\hbox{\it#1\/\kern.05em}} % italic type for identifiers +\def\|#1{\hbox{$#1$}} % one-letter identifiers look a bit better this way +\def\{\hbox{\bf#1\/}} % boldface type for reserved words +\def\.#1{\hbox{\tentex % typewriter type for strings + \let\\=\BS % backslash in a string + \let\'=\RQ % right quote in a string + \let\`=\LQ % left quote in a string + \let\{=\LB % left brace in a string + \let\}=\RB % right brace in a string + \let\~=\TL % tilde in a string + \let\ =\SP % space in a string + \let\_=\UL % underline in a string + \let\&=\AM % ampersand in a string + #1}} +\def\#{\hbox{\tt\char`\#}} % parameter sign +\def\${\hbox{\tt\char`\$}} % dollar sign +\def\%{\hbox{\tt\char`\%}} % percent sign +\def\^{\ifmmode\mathchar"222 \else\char`^ \fi} % pointer or hat +% circumflex accents can be obtained from \^^D instead of \^ +\def\AT!{@} % at sign for control text + +\chardef\AM=`\& % ampersand character in a string +\chardef\BS=`\\ % backslash in a string +\chardef\LB=`\{ % left brace in a string +\def\LQ{{\tt\char'22}} % left quote in a string +\chardef\RB=`\} % right brace in a string +\def\RQ{{\tt\char'23}} % right quote in a string +\def\SP{{\tt\char`\ }} % (visible) space in a string +\chardef\TL=`\~ % tilde in a string +\chardef\UL=`\_ % underline character in a string + +\newbox\bak \setbox\bak=\hbox to -1em{} % backspace one em +\newbox\bakk\setbox\bakk=\hbox to -2em{} % backspace two ems + +\newcount\ind % current indentation in ems +\def\1{\global\advance\ind by1\hangindent\ind em} % indent one more notch +\def\2{\global\advance\ind by-1} % indent one less notch +\def\3#1{\hfil\penalty#10\hfilneg} % optional break within a statement +\def\4{\copy\bak} % backspace one notch +\def\5{\hfil\penalty-1\hfilneg\kern2.5em\copy\bakk\ignorespaces}% optional break +\def\6{\ifmmode\else\par % forced break + \hangindent\ind em\noindent\kern\ind em\copy\bakk\ignorespaces\fi} +\def\7{\Y\6} % forced break and a little extra space + +\let\yskip=\smallskip +\def\to{\mathrel{.\,.}} % double dot, used only in math mode + +% Some changes for xetex +\def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt\eightrm#1~\pdfnote#2..\par}} + +\def\linkcolor#1{\special{color push rgb 0.4 0.6 1.0}#1\special{color pop}} +\def\link#1#2{\special{pdf:bann<>>>}\linkcolor{#2}\special{pdf:eann}} + +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newcount\countA +\countA=0 +\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} +\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} +\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} +\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} +\def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS| + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makenote\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next +} +\def\n#1{\link{#1}{#1}} +\def\makenote{\addtokens{\toksB}% + {\noexpand\n{\the\toksC}}\toksC={}\global\countA=0} +\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} + +\def\lapstar{\rlap{*}} +\def\startsection{\Q{\let\*=\empty\special{pdf:dest (\modstar) [@thispage /XYZ @xpos @ypos null]}}% + \noindent{\let\*=\lapstar\bf\modstar.\quad}} +\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format' +\def\A{\note{See also section}} % crossref for doubly defined section name +\def\As{\note{See also sections}} % crossref for multiply defined section name +\def\B{\mathopen{\.{@\{}}} % begin controlled comment +\def\C#1{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % Pascal comments + \XX\hfil\penalty-1\hfilneg\quad$\{\,$#1$\,\}$\XX} +\def\D{\defin{define}} % macro definition +\def\E{\cdot10^} % exponent in floating point constant +\def\ET{ and~} % conjunction between two section numbers +\def\ETs{, and~} % conjunction between the last two of several section numbers +\def\F{\defin{format}} % format definition +\let\G=\ge % greater than or equal sign +\def\H#1{\hbox{\rm\char"7D\tt#1}} % hexadecimal constant +\let\I=\ne % unequal sign +\def\J{\.{@\&}} % TANGLE's join operation +\let\K=\gets % left arrow +\let\L=\le % less than or equal sign +\outer\def\M#1.{\MN#1.\ifon\vfil\penalty-100\vfilneg % beginning of section + \vskip12ptminus3pt\startsection\ignorespaces} +\outer\def\N#1.#2.{\MN#1.\vfil\eject % beginning of starred section + \def\rhead{\uppercase{\ignorespaces#2}} % define running headline + \message{*\modno} % progress report + \edef\next{\write\cont{\Z{#2}{\modno}{\the\pageno}}}\next % to contents file + \ifon\startsection{\bf\ignorespaces#2.\quad}\ignorespaces} +\def\MN#1.{\par % common code for \M, \N + {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}} + \ifx\modno\modstar \onmaybe \else\ontrue \fi \mark{\modno}} +\def\O#1{\hbox{\rm\char'23\kern-.2em\it#1\/\kern.05em}} % octal constant +\def\P{\rightskip=0pt plus 100pt minus 10pt % go into Pascal mode + \sfcode`;=3000 + \pretolerance 10000 + \hyphenpenalty 10000 \exhyphenpenalty 10000 + \global\ind=2 \1\ \unskip} +\def\Q{\rightskip=0pt % get out of Pascal mode + \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 } +\let\R=\lnot % logical not +\let\S=\equiv % equivalence sign +\def\T{\mathclose{\.{@\}}}} % terminate controlled comment +\def\U{\note{This code is used in section}} % crossref for use of a section +\def\Us{\note{This code is used in sections}} % crossref for uses of a section +\let\V=\lor % logical or +\let\W=\land % logical and +\def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi % section name + \XX$\langle\,$#2{\eightrm\kern.5em\pdfnote#1.}$\,\rangle$\XX} +\def\Y{\par\yskip} +\let\Z=\let % now you can \send the control sequence \Z +\def\){\hbox{\.{@\$}}} % sign for string pool check sum +\def\]{\hbox{\.{@\\}}} % sign for forced line break +\def\=#1{\kern2pt\hbox{\vrule\vtop{\vbox{\hrule + \hbox{\strut\kern2pt\.{#1}\kern2pt}} + \hrule}\vrule}\kern2pt} % verbatim string +\let\~=\ignorespaces +\let\*=* + +\def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue +\newif\ifon \newif\iftitle \newif\ifpagesaved +\def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead\hfill\title\qquad + \tensy x\mainfont\topmark} % top line on left-hand pages +\def\rheader{\tensy x\mainfont\topmark\eightrm\qquad\title\hfill\rhead + \qquad\mainfont\the\pageno} % top line on right-hand pages +\def\page{\box255 } +\def\normaloutput#1#2#3{\ifodd\pageno\hoffset=\pageshift\fi + \shipout\vbox{ + \vbox to\fullpageheight{ + \iftitle\global\titlefalse + \else\hbox to\pagewidth{\vbox to10pt{}\ifodd\pageno #3\else#2\fi}\fi + \vfill#1}} % parameter #1 is the page itself + \global\advance\pageno by1} + +\def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred sections +\def\title{} % an optional title can be set by the user +\def\topofcontents{\centerline{\titlefont\title} + \vfill} % this material will start the table of contents page +\def\botofcontents{\vfill} % this material will end the table of contents page +\def\contentspagenumber{0} % default page number for table of contents +\newdimen\pagewidth \pagewidth=6.5in % the width of each page +\newdimen\pageheight \pageheight=8.7in % the height of each page +\newdimen\fullpageheight \fullpageheight=9in % page height including headlines +\newdimen\pageshift \pageshift=0in % shift righthand pages wrt lefthand ones +\def\magnify#1{\mag=#1\pagewidth=6.5truein\pageheight=8.7truein + \fullpageheight=9truein\setpage} +\def\setpage{\hsize\pagewidth\vsize\pageheight} % use after changing page size +\def\contentsfile{CONTENTS} % file that gets table of contents info +\def\readcontents{\input CONTENTS} + +\newwrite\cont +\output{\setbox0=\page % the first page is garbage + \openout\cont=\contentsfile + \global\output{\normaloutput\page\lheader\rheader}} +\setpage +\vbox to \vsize{} % the first \topmark won't be null + +\def\ch{\note{The following sections were changed by the change file:} + \let\*=\relax} +\newbox\sbox % saved box preceding the index +\newbox\lbox % lefthand column in the index +\def\inx{\par\vskip6pt plus 1fil % we are beginning the index + \write\cont{} % ensure that the contents file isn't empty + \closeout\cont % the contents information has been fully gathered + \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi + \global\setbox\sbox=\page \global\pagesavedtrue} + \pagesavedfalse \eject % eject the page-so-far and predecessors + \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box + \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height + \hsize=.5\pagewidth \advance\hsize by -10pt + % column width for the index (20pt between cols) + \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines + \def\lr{L} % this tells whether the left or right column is next + \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} + \else\normaloutput{\vbox to\pageheight{\box\sbox\vss + \hbox to\pagewidth{\box\lbox\hfil\page}}}\lheader\rheader + \global\vsize\pageheight\gdef\lr{L}\global\pagesavedfalse\fi} + \message{Index:} + \parskip 0pt plus .5pt + \outer\def\:##1, {\par\hangindent2em\noindent##1:\kern1em\pdfnote} % index entry + \let\ttentry=\. \def\.##1{\ttentry{##1\kern.2em}} % give \tt a little room + \def\[##1]{$\underline{##1}$} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \hyphenpenalty 10000 \parindent0pt} +\def\fin{\par\vfill\eject % this is done when we are ending the index + \ifpagesaved\null\vfill\eject\fi % output a null index column + \if L\lr\else\null\vfill\eject\fi % finish the current page + \parfillskip 0pt plus 1fil + \def\rhead{NAMES OF THE SECTIONS} + \message{Section names:} + \output{\normaloutput\page\lheader\rheader} + \setpage + \def\note##1##2.{\hfil\penalty-1\hfilneg\quad{\eightrm##1~\pdfnote##2..}} + \linepenalty=10 % try to conserve lines + \def\U{\note{Used in section}} % crossref for use of a section + \def\Us{\note{Used in sections}} % crossref for uses of a section + \def\:{\par\hangindent 2em}\let\*=*\let\.=\ttentry} +\def\con{\par\vfill\eject % finish the section names + \rightskip 0pt \hyphenpenalty 50 \tolerance 200 + \setpage + \output{\normaloutput\page\lheader\rheader} + \titletrue % prepare to output the table of contents + \pageno=\contentspagenumber \def\rhead{TABLE OF CONTENTS} + \message{Table of contents:} + \topofcontents + \line{\hfil Section\hbox to3em{\hss Page}} + \def\Z##1##2##3{\line{\link{##2}{\ignorespaces##1 + \leaders\hbox to .5em{.\hfil}\hfil\ ##2} + \hbox to3em{\hss##3}}} + \readcontents\relax % read the contents info + \botofcontents \makeoutlines\end} % print the contents page(s) and terminate + +\newcount\countB +\def\makeoutlines{% + \def\?##1]{}\def\Z##1##2##3{\special{pdf:out 1 <>>>}} + \input CONTENTS\relax} +\endinput -- cgit v1.2.3