diff options
author | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 20:39:13 +0000 |
---|---|---|
committer | Jeffrey H. Kingston <jeff@it.usyd.edu.au> | 2010-09-14 20:39:13 +0000 |
commit | b2f1a4e879d3013974e41674dbf684d816f1aa95 (patch) | |
tree | 08292d39f5b0592c01946a2a754a93329ef599d3 /include | |
parent | 7d292f1247e3287fb07a9a12377217ce8942cf09 (diff) | |
download | lout-b2f1a4e879d3013974e41674dbf684d816f1aa95.tar.gz |
Lout 3.30.
git-svn-id: http://svn.savannah.nongnu.org/svn/lout/trunk@29 9365b830-b601-4143-9ba8-b4a8e2c3339c
Diffstat (limited to 'include')
-rw-r--r-- | include/book | 26 | ||||
-rw-r--r-- | include/bookf | 154 | ||||
-rw-r--r-- | include/bsf | 28 | ||||
-rw-r--r-- | include/doc | 3 | ||||
-rw-r--r-- | include/dsf | 17 | ||||
-rw-r--r-- | include/graphf | 3 | ||||
-rw-r--r-- | include/graphf.lpg | 25 | ||||
-rw-r--r-- | include/picture | 3 | ||||
-rw-r--r-- | include/pythonf | 3 | ||||
-rw-r--r-- | include/report | 3 | ||||
-rw-r--r-- | include/save_graphf | 891 | ||||
-rw-r--r-- | include/save_graphf.lpg | 899 | ||||
-rw-r--r-- | include/slides | 3 | ||||
-rw-r--r-- | include/xind | 1 | ||||
-rw-r--r-- | include/xinda | 1 | ||||
-rw-r--r-- | include/xindb | 1 |
16 files changed, 2056 insertions, 5 deletions
diff --git a/include/book b/include/book index 09c8fa4..ea0b494 100644 --- a/include/book +++ b/include/book @@ -168,6 +168,7 @@ # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexTypeMain { @B @PageNum } # Main pagenum format # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format # @IndexColumnNumber { 2 } # index columns (1 to 10) # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap # @IndexCtd { Yes } # include (ctd.) lines @@ -187,6 +188,7 @@ # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexATypeMain { @B @PageNum } # Main pagenum format # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format # @IndexAColumnNumber { 2 } # index A columns (1 to 10) # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap # @IndexACtd { Yes } # include (ctd.) lines @@ -333,6 +335,10 @@ # @IndexAWord { index } # word for "Index" (A) # @IndexBWord { index } # word for "Index" (B) # @ColophonWord { colophon } # word for "Colophon" + # @SubPrefaceNumbers { None } # kind of sub-preface numbers + # @FirstSubPrefaceNumber { 1 } # first sub-preface number (Arabic) + # @SubIntroductionNumbers { None } # kind of sub-introduction numbers + # @FirstSubIntroductionNumber { 1 } # first sub-introduction number # @ChapterNumbers { Arabic } # kind of chapter numbers # @FirstChapterNumber { 1 } # first chapter number (Arabic) # @SectionNumbers { Arabic } # kind of section numbers @@ -353,6 +359,12 @@ # @ChapterHeadingFont { Bold 2.00f } # chapter head font # @ChapterHeadingBreak { ragged 1.2fx nohyphen } # chapter head break # @ChapterHeadingFormat { number @DotSep title } # format of chap. head + # @SubPrefaceHeadingFont { Bold } # sub-preface head font + # @SubPrefaceHeadingBreak { ragged 1.2fx nohyphen } # sub-preface head break + # @SubPrefaceHeadingFormat { number @DotSep title } # format of s.-p. head + # @SubIntroductionHeadingFont { Bold } # sub-intro head font + # @SubIntroductionHeadingBreak { ragged 1.2fx nohyphen} # sub-intro head break + # @SubIntroductionHeadingFormat { number @DotSep title} # format of sub-intro. hd # @SectionHeadingFont { Bold } # section head font # @SectionHeadingBreak { ragged 1.2fx nohyphen } # section head break # @SectionHeadingFormat { number @DotSep title } # section head fmt @@ -373,14 +385,18 @@ # @SubSubAppendixHeadingFormat{ number @DotSep title } # sub-suba. head fmt # @AbovePartGap { 4.00f } # gap above part title # @AboveChapterGap { 3.00f } # above major titles + # @SubPrefaceGap { 2.0v @OrIfPlain 3f } # between sub-prefaces + # @SubIntroductionGap { 2.0v @OrIfPlain 3f } # between sub-intros # @SectionGap { 2.0v @OrIfPlain 3f } # between sections # @SubSectionGap { 1.5v @OrIfPlain 2f } # between subsects # @SubSubSectionGap { 1.5v @OrIfPlain 2f } # between sub-subs. # @SubAppendixGap { 2.0v @OrIfPlain 3f } # between subappendices # @SubSubAppendixGap { 1.5v @OrIfPlain 2f } # between sub-subapps # @PrefaceInContents { Yes } # add preface to contents + # @SubPrefaceInContents { No } # add sub-preface to contents # @AbbreviationsInContents { Yes } # add abbreviations to contents # @IntroductionInContents { Yes } # add introduction to contents + # @SubIntroductionInContents { No } # add sub-intro to contents # @PartInContents { Yes } # add parts to contents # @ChapterInContents { Yes } # add chapters to contents # @SectionInContents { Yes } # add sections to contents @@ -396,6 +412,8 @@ # @IndexBInContents { Yes } # add index B to contents # @ColophonInContents { Yes } # add colophon to contents # @PartContentsIndent { 0.5rt } # indent of part contents entry + # @SubPrefaceNumInTheorems { No } # theorem num has sub-preface num + # @SubIntroductionNumInTheorems { No } # theorem num has sub-intro num # @ChapterNumInTheorems { Yes } # theorem num has chapter num # @SectionNumInTheorems { No } # theorem num has section num # @SubSectionNumInTheorems { No } # theorem num has subsect num @@ -403,6 +421,8 @@ # @AppendixNumInTheorems { Yes } # theorem num has appendix num # @SubAppendixNumInTheorems { No } # theorem num has sub-app num # @SubSubAppendixNumInTheorems{ No } # theorem num has sub-sa. num + # @SubPrefaceNumInDisplays { No } # display num has sub-preface num + # @SubIntroductionNumInDisplays { No } # display num has sub-intro num # @ChapterNumInDisplays { Yes } # display num has chapter num # @SectionNumInDisplays { Yes } # display num has section num # @SubSectionNumInDisplays { No } # display num has subsect num @@ -410,6 +430,8 @@ # @AppendixNumInDisplays { Yes } # display num has appendix num # @SubAppendixNumInDisplays { Yes } # display num has sub-app num # @SubSubAppendixNumInDisplays{ No } # display num has sub-sa. num + # @SubPrefaceNumInFigures { No } # figure num has sub-preface num + # @SubIntroductionumInFigures { No } # figure num has sub-intro num # @ChapterNumInFigures { Yes } # figure num has chapter num # @SectionNumInFigures { No } # figure num has section num # @SubSectionNumInFigures { No } # figure num has subsect num @@ -417,6 +439,8 @@ # @AppendixNumInFigures { Yes } # figure num has appendix num # @SubAppendixNumInFigures { No } # figure num has sub-app num # @SubSubAppendixNumInFigures { No } # figure num has sub-sa. num + # @SubPrefaceNumInTables { No } # table num has sub-preface num + # @SubIntroductionumInTables { No } # table num has sub-intro num # @ChapterNumInTables { Yes } # table num has chapter num # @SectionNumInTables { No } # table num has section num # @SubSectionNumInTables { No } # table num has subsect num @@ -424,6 +448,8 @@ # @AppendixNumInTables { Yes } # table num has appendix num # @SubAppendixNumInTables { No } # table num has sub-app num # @SubSubAppendixNumInTables { No } # table num has sub-sa. num + # @SubPrefaceNumInRunners { No } # runners have sub-preface num + # @SubIntroductionNumInRunners { No } # runners have sub-intro num # @SectionNumInRunners { Yes } # runners have section num # @SubSectionNumInRunners { No } # runners have subsect num # @SubSubSectionNumInRunners { No } # runners have sub-ss. num diff --git a/include/bookf b/include/bookf index 6aff163..9dd1a96 100644 --- a/include/bookf +++ b/include/bookf @@ -33,6 +33,10 @@ def @BookSetup named @IndexBWord { index } named @ColophonWord { colophon } + named @SubPrefaceNumbers { None } + named @FirstSubPrefaceNumber { 1 } + named @SubIntroductionNumbers { None } + named @FirstSubIntroductionNumber { 1 } named @ChapterNumbers { Arabic } named @FirstChapterNumber { 1 } named @SectionNumbers { Arabic } @@ -58,6 +62,16 @@ def @BookSetup named @ChapterHeadingFormat left number right title { number @DotSep title } + named @SubPrefaceHeadingFont { Bold } + named @SubPrefaceHeadingBreak { ragged 1.2fx nohyphen } + named @SubPrefaceHeadingFormat + left number right title { number @DotSep title } + + named @SubIntroductionHeadingFont { Bold } + named @SubIntroductionHeadingBreak { ragged 1.2fx nohyphen } + named @SubIntroductionHeadingFormat + left number right title { number @DotSep title } + named @SectionHeadingFont { Bold } named @SectionHeadingBreak { ragged 1.2fx nohyphen } named @SectionHeadingFormat @@ -90,6 +104,8 @@ def @BookSetup named @AbovePartGap { 4.00f } named @AboveChapterGap { 3.00f } + named @SubPrefaceGap { 2.0v @OrIfPlain 3f } + named @SubIntroductionGap { 2.0v @OrIfPlain 3f } named @SectionGap { 2.0v @OrIfPlain 3f } named @SubSectionGap { 1.5v @OrIfPlain 2f } named @SubSubSectionGap { 1.5v @OrIfPlain 2f } @@ -97,8 +113,10 @@ def @BookSetup named @SubSubAppendixGap { 1.5v @OrIfPlain 2f } named @PrefaceInContents { Yes } + named @SubPrefaceInContents { No } named @AbbreviationsInContents { Yes } named @IntroductionInContents { Yes } + named @SubIntroductionInContents { No } named @PartInContents { Yes } named @ChapterInContents { Yes } named @SectionInContents { Yes } @@ -115,6 +133,8 @@ def @BookSetup named @ColophonInContents { Yes } named @PartContentsIndent { 0.5rt } + named @SubPrefaceNumInTheorems { No } + named @SubIntroductionNumInTheorems { No } named @ChapterNumInTheorems { Yes } named @SectionNumInTheorems { No } named @SubSectionNumInTheorems { No } @@ -123,6 +143,8 @@ def @BookSetup named @SubAppendixNumInTheorems { No } named @SubSubAppendixNumInTheorems { No } + named @SubPrefaceNumInDisplays { No } + named @SubIntroductionNumInDisplays { No } named @ChapterNumInDisplays { Yes } named @SectionNumInDisplays { Yes } named @SubSectionNumInDisplays { No } @@ -131,6 +153,8 @@ def @BookSetup named @SubAppendixNumInDisplays { Yes } named @SubSubAppendixNumInDisplays { No } + named @SubPrefaceNumInFigures { No } + named @SubIntroductionNumInFigures { No } named @ChapterNumInFigures { Yes } named @SectionNumInFigures { No } named @SubSectionNumInFigures { No } @@ -139,6 +163,8 @@ def @BookSetup named @SubAppendixNumInFigures { No } named @SubSubAppendixNumInFigures { No } + named @SubPrefaceNumInTables { No } + named @SubIntroductionNumInTables { No } named @ChapterNumInTables { Yes } named @SectionNumInTables { No } named @SubSectionNumInTables { No } @@ -147,6 +173,8 @@ def @BookSetup named @SubAppendixNumInTables { No } named @SubSubAppendixNumInTables { No } + named @SubPrefaceNumInRunners { No } + named @SubIntroductionNumInRunners { No } named @SectionNumInRunners { Yes } named @SubSectionNumInRunners { No } named @SubSubSectionNumInRunners { No } @@ -184,6 +212,20 @@ def @BookSetup } export num + def @SubPrefaceList named @Tag {} right num + { + @Galley + //@SubPrefaceGap @SubPrefaceList @Next num + } + + export num + def @SubIntroductionList named @Tag {} right num + { + @Galley + //@SubIntroductionGap @SubIntroductionList @Next num + } + + export num def @SectionList named @Tag {} right num { @Galley @@ -797,6 +839,7 @@ def @BookSetup # # ####################################################################### + export @BeginSubPrefaces @EndSubPrefaces @SubPreface def @Preface force into { @PrefacePlace&&preceding } named @Tag {} named @Title { preface @WordVal @PrefaceWord } @@ -804,6 +847,60 @@ def @BookSetup named @InitialLanguage {} body @Body { + def @EndSubPrefacesPlace { @Galley } + + def @EndSubPrefaces force into { @EndSubPrefacesPlace&&preceding } + {} + + macro @BeginSubPrefaces + { //@SubPrefaceGap @SubPrefaceList @FirstSubPrefaceNumber + // @EndSubPrefacesPlace // + } + + def @SubPreface force into { @SubPrefaceList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + body @Body + { + + def @SubPrefaceShortNum + { + @SubPrefaceNumbers @Then { + @BypassNumber @Dft { + @SubPrefaceNumbers @Num + { @SectionList&&@Tag @Open { num } } + } + } + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubPrefaceHeadingFont } + headingbreak { @SubPrefaceHeadingBreak } + headingformat { @Num @SubPrefaceHeadingFormat @Body } + incontents { @SubPrefaceInContents } + contentsindent { 3f } + numbers { @SubPrefaceNumbers } + attachnum { @SubPrefaceList&&preceding @Tagged @Tag } + retrievenum { @SubPrefaceList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @Null } + majornum { @Null } + majortitle { @Null } + intheorems { @SubPrefaceNumInTheorems } + indisplays { @SubPrefaceNumInDisplays } + infigures { @SubPrefaceNumInFigures } + intables { @SubPrefaceNumInTables } + inrunners { @SubPrefaceNumInRunners } + @Body + } @LargeScaleStructure tag { @Tag } @@ -865,6 +962,7 @@ def @BookSetup # # ####################################################################### + export @BeginSubIntroductions @EndSubIntroductions @SubIntroduction def @Introduction force into { @IntroductionPlace&&preceding } named @Tag {} named @Title { introduction @WordVal @IntroductionWord } @@ -873,6 +971,61 @@ def @BookSetup body @Body { + def @EndSubIntroductionsPlace { @Galley } + + def @EndSubIntroductions force into { @EndSubIntroductionsPlace&&preceding } + {} + + macro @BeginSubIntroductions + { //@SubIntroductionGap @SubIntroductionList @FirstSubIntroductionNumber + // @EndSubIntroductionsPlace // + } + + def @SubIntroduction force into { @SubIntroductionList&&preceding } + named @Tag {} + named @Title {} + named @RunningTitle { dft } + named @InitialLanguage { @InitialLanguage } + named @BypassNumber { dft } + body @Body + { + + def @SubIntroductionShortNum + { + @SubIntroductionNumbers @Then { + @BypassNumber @Dft { + @SubIntroductionNumbers @Num + { @SectionList&&@Tag @Open { num } } + } + } + } + + @LargeScaleStructure + tag { @Tag } + type { Minor } + initiallanguage { @InitialLanguage } + title { @Title } + runningtitle { @RunningTitle } + headingfont { @SubIntroductionHeadingFont } + headingbreak { @SubIntroductionHeadingBreak } + headingformat { @Num @SubIntroductionHeadingFormat @Body } + incontents { @SubIntroductionInContents } + contentsindent { 3f } + numbers { @SubIntroductionNumbers } + attachnum { @SubIntroductionList&&preceding @Tagged @Tag } + retrievenum { @SubIntroductionList&&@Tag @Open { num } } + bypassnumber { @BypassNumber } + prefix { @Null } + majornum { @Null } + majortitle { @Null } + intheorems { @SubIntroductionNumInTheorems } + indisplays { @SubIntroductionNumInDisplays } + infigures { @SubIntroductionNumInFigures } + intables { @SubIntroductionNumInTables } + inrunners { @SubIntroductionNumInRunners } + @Body + } + @LargeScaleStructure tag { @Tag } type { Major } @@ -889,7 +1042,6 @@ def @BookSetup innergap { @SectionGap } inrunners { Yes } @Body - } diff --git a/include/bsf b/include/bsf index dbf7eeb..76b0f1a 100644 --- a/include/bsf +++ b/include/bsf @@ -183,6 +183,7 @@ export @RawRightAlignedNumberedDisplay @ListItem + @ParagraphItem @ListInterruptItem @ListNewPage @DropListItem @@ -1427,6 +1428,7 @@ def @BasicSetup def @ItemPlace { @Galley } + def @ParagraphItemPlace { @Galley } def @InterruptItemPlace { @Galley } def @NewPageItemPlace { @Galley } def @TagPlace { @Galley } @@ -1455,6 +1457,13 @@ def @BasicSetup //gap @MakeList @NotRevealed @Next num } + def @ParagraphItem + { + @NumberMarker @Value {num} {style type num} &0io + |indent @ParagraphItemPlace |rightindent + //gap @MakeList @NotRevealed @Next num + } + def @InterruptItem { @InterruptItemPlace @@ -1470,6 +1479,7 @@ def @BasicSetup @OneOf { @NormalItem + @ParagraphItem @InterruptItem @NewPageItem } @@ -1496,6 +1506,23 @@ def @BasicSetup // @PageMark @Tag # weird placement, but @PageMark is definite now } + def paragraphitem + named @Tag {} + named style right tag { @ParaIndent @Wide & tag. &2s } + right x + { + + def sendparagraphitem into { @ParagraphItemPlace&&preceding } + named tag { @Tag } + { + @NumberMarker&&preceding @Tagged @Tag + // { style @NumberMarker&&@Tag @Open { @Value } } @Insert x + // @PageMark @Tag + } + + sendparagraphitem + } + def droplistitem into { @ItemPlace&&preceding } named @Tag {} right x @@ -1535,6 +1562,7 @@ def @BasicSetup macro @LI @ListItem { // listitem } + macro @PI @ParagraphItem { // paragraphitem } macro @LII @ListInterruptItem { // listinterruptitem } macro @LNP @ListNewPage { // listnewpage } macro @DLI @DropListItem { // droplistitem } diff --git a/include/doc b/include/doc index 6138687..d5df7e3 100644 --- a/include/doc +++ b/include/doc @@ -167,6 +167,7 @@ # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexTypeMain { @B @PageNum } # Main pagenum format # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format # @IndexColumnNumber { 2 } # index columns (1 to 10) # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap # @IndexCtd { Yes } # include (ctd.) lines @@ -186,6 +187,7 @@ # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexATypeMain { @B @PageNum } # Main pagenum format # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format # @IndexAColumnNumber { 2 } # index A columns (1 to 10) # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap # @IndexACtd { Yes } # include (ctd.) lines @@ -205,6 +207,7 @@ # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexBTypeMain { @B @PageNum } # Main pagenum format # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format # @IndexBColumnNumber { 2 } # index B columns (1 to 10) # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap # @IndexBCtd { Yes } # include (ctd.) lines diff --git a/include/dsf b/include/dsf index 2d3fa2b..e992795 100644 --- a/include/dsf +++ b/include/dsf @@ -273,6 +273,9 @@ def @DocumentSetup right @PageNum { @B @PageNum } # main page numbers named @IndexTypeSpecial right @PageNum { @I @PageNum } # special page numbers + named @IndexRangeFormat + left @From + right @To { @From--@To } named @IndexColumnNumber { 2 } # index columns (1 to 10) named @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap named @IndexCtd { Yes } # include (ctd.) lines @@ -302,6 +305,9 @@ def @DocumentSetup right @PageNum { @B @PageNum } # main page numbers named @IndexATypeSpecial right @PageNum { @I @PageNum } # special page numbers + named @IndexARangeFormat + left @From + right @To { @From--@To } named @IndexAColumnNumber { 2 } # index A columns (1 to 10) named @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap named @IndexACtd { Yes } # include (ctd.) lines @@ -331,6 +337,9 @@ def @DocumentSetup right @PageNum { @B @PageNum } # main page numbers named @IndexBTypeSpecial right @PageNum { @I @PageNum } # special page numbers + named @IndexBRangeFormat + left @From + right @To { @From--@To } named @IndexBColumnNumber { 2 } # index B columns (1 to 10) named @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap named @IndexBCtd { Yes } # include (ctd.) lines @@ -725,6 +734,7 @@ def @DocumentSetup Legal @Yield 612p Statement @Yield 396p Executive @Yield 540p + A2 @Yield 1190p A3 @Yield 842p A4 @Yield 595p A5 @Yield 420p @@ -746,6 +756,7 @@ def @DocumentSetup Legal @Yield 1008p Statement @Yield 612p Executive @Yield 720p + A2 @Yield 1684p A3 @Yield 1190p A4 @Yield 842p A5 @Yield 595p @@ -4274,7 +4285,7 @@ def @DocumentSetup { @PageOf @Tag } @Case { { @PageOf to } @Yield { @PgMk @Tag } - else @Yield { {@PgMk @Tag}--{@PgMk to} } + else @Yield { {@PgMk @Tag} @IndexRangeFormat {@PgMk to} } } } } @@ -4483,7 +4494,7 @@ def @DocumentSetup { @PageOf @Tag } @Case { { @PageOf to } @Yield { @PgMk @Tag } - else @Yield { {@PgMk @Tag}--{@PgMk to} } + else @Yield { {@PgMk @Tag} @IndexARangeFormat {@PgMk to} } } } } @@ -4692,7 +4703,7 @@ def @DocumentSetup { @PageOf @Tag } @Case { { @PageOf to } @Yield { @PgMk @Tag } - else @Yield { {@PgMk @Tag}--{@PgMk to} } + else @Yield { {@PgMk @Tag} @IndexBRangeFormat {@PgMk to} } } } } diff --git a/include/graphf b/include/graphf index 8bb9d05..d2d3175 100644 --- a/include/graphf +++ b/include/graphf @@ -809,6 +809,7 @@ def @Graph { style @Case { frame @Yield { "framestyle" } + grid @Yield { "gridstyle" } none @Yield { "nonestyle" } axes @Yield { "axesstyle" } } @@ -820,6 +821,7 @@ def @Graph "none" @Yield { style @Case { frame @Yield { "0.5 cm" } + grid @Yield { "0" } none @Yield { "0" } axes @Yield { "0" } } @@ -834,6 +836,7 @@ def @Graph "none" @Yield { style @Case { frame @Yield { "0.5 cm" } + grid @Yield { "0" } none @Yield { "0" } axes @Yield { "0" } } diff --git a/include/graphf.lpg b/include/graphf.lpg index 5546586..f85dc77 100644 --- a/include/graphf.lpg +++ b/include/graphf.lpg @@ -534,6 +534,14 @@ lgraphdict begin 0 xticklength neg rlineto [] 0 setdash stroke } def +% printxgrid: print one x grid line +% xpos printxgrid - +/printxgrid +{ dup newpath + yleft trpoint moveto 0 yextra neg rmoveto + yright trpoint lineto 0 yextra rlineto [] 0 setdash stroke +} def + % printxlabel: print one x label % (xlabel) xpos printxlabel - /printxlabel @@ -551,6 +559,14 @@ lgraphdict begin yticklength neg 0 rlineto [] 0 setdash stroke } def +% printygrid: print one y grid line +% ypos printygrid - +/printygrid +{ dup newpath + xleft exch trpoint moveto xextra neg 0 rmoveto + xright exch trpoint lineto xextra 0 rlineto [] 0 setdash stroke +} def + % printylabel: print one y label % (ylabel) ypos printylabel - /printylabel @@ -825,6 +841,15 @@ lgraphdict begin /printrtick /printrlabel rticks ymin printticks } def +% gridstyle: print a frame around the graph, plus a grid +/gridstyle +{ 0 0 moveto xsize 0 lineto xsize ysize lineto + 0 ysize lineto closepath stroke + /printxgrid /printxlabel xticks xleft printticks + /printygrid /printylabel yticks ymin printticks + /printrtick /printrlabel rticks ymin printticks +} def + % nonestyle: print nothing around the graph /nonestyle { diff --git a/include/picture b/include/picture index dea061a..ec8efc9 100644 --- a/include/picture +++ b/include/picture @@ -167,6 +167,7 @@ # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexTypeMain { @B @PageNum } # Main pagenum format # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format # @IndexColumnNumber { 2 } # index columns (1 to 10) # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap # @IndexCtd { Yes } # include (ctd.) lines @@ -186,6 +187,7 @@ # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexATypeMain { @B @PageNum } # Main pagenum format # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format # @IndexAColumnNumber { 2 } # index A columns (1 to 10) # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap # @IndexACtd { Yes } # include (ctd.) lines @@ -205,6 +207,7 @@ # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexBTypeMain { @B @PageNum } # Main pagenum format # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format # @IndexBColumnNumber { 2 } # index B columns (1 to 10) # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap # @IndexBCtd { Yes } # include (ctd.) lines diff --git a/include/pythonf b/include/pythonf index 5f2c2ff..f70111f 100644 --- a/include/pythonf +++ b/include/pythonf @@ -97,7 +97,7 @@ def @PythonSetup export @PI @PK @PO @PN @PS @PC @PL @PA @PM @PD - @A "$>" + @A "$>" "''" def @Python named style { style } # style @@ -384,6 +384,7 @@ def @PythonSetup macro "$>" { {} & } + def "''" { "''" } { @InitFontFamily Base @InitSize } @Font { @InitLine lines nohyphen } @Break @Body diff --git a/include/report b/include/report index 12312e5..4cf0a5a 100644 --- a/include/report +++ b/include/report @@ -172,6 +172,7 @@ # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexTypeMain { @B @PageNum } # Main pagenum format # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format # @IndexColumnNumber { 2 } # index columns (1 to 10) # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap # @IndexCtd { Yes } # include (ctd.) lines @@ -191,6 +192,7 @@ # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexATypeMain { @B @PageNum } # Main pagenum format # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format # @IndexAColumnNumber { 2 } # index A columns (1 to 10) # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap # @IndexACtd { Yes } # include (ctd.) lines @@ -210,6 +212,7 @@ # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexBTypeMain { @B @PageNum } # Main pagenum format # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format # @IndexBColumnNumber { 2 } # index B columns (1 to 10) # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap # @IndexBCtd { Yes } # include (ctd.) lines diff --git a/include/save_graphf b/include/save_graphf new file mode 100644 index 0000000..8bb9d05 --- /dev/null +++ b/include/save_graphf @@ -0,0 +1,891 @@ + +############################################################################### +# # +# Lout @Graph package for drawing graphs (Version 1.0) # +# # +# Version 1.0 by Jeffrey H. Kingston, December 1993. # +# # +# This package draws graphs, the statistical kind not the graph-theoretical # +# kind. See the User's Guide (Advanced Graphics) for user info. # +# # +############################################################################### + +@SysInclude { graphf.etc } # @GraphMath +@SysInclude { lengths } # @LoutLengths +@SysInclude { coltex } # @ColourCommand and @TextureCommand +@SysPrependGraphic { graphf.lpg } + + +def @GraphObj + left p + named margin { 0c } + named adj { 0 0 } + right x +{ + @BackEnd @Case { + PostScript @Yield { + @Null & # kills previous white space + @HContract @VContract { + //0io ||0io @HContract @VContract + { p "trpoint translate" adj "translate gsave" // "grestore" } + @Graphic { //margin ||margin x ||margin //margin } + ||0io //0io + } + } +# VT: PDF does nothing + PDF @Yield { + @Null & # kills previous white space + @HContract @VContract { + //0io ||0io @HContract @VContract + { "% @GraphObj UNIMPLEMENTED" } + @Graphic { //margin ||margin x ||margin //margin } + ||0io //0io + } + } + } +} + +def @GraphCross + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 0 moveto xsize ysize lineto 0 ysize moveto" + "xsize 0 lineto [] 0 setdash stroke" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + { "n [] 0 d 0 0 m __xsize __ysize l 0 __ysize m __xsize 0 l S"} + # uses S because PostScript version does NOT use closepath + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphPlus + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath xmark 0 moveto xmark ysize lineto 0 ymark moveto" + "xsize ymark lineto [] 0 setdash stroke" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + { "n [] 0 d __xmark 0 m __xmark __ysize l 0 __ymark m __xsize __ymark l S"} + # uses S because PostScript version does NOT use closepath + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphSquare + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath [] 0 setdash stroke" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 __xsize __ysize re s"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledSquare + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 0 moveto xsize 0 lineto xsize ysize lineto" + "0 ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 __xsize __ysize re b"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphDiamond + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + "xmark ysize lineto closepath [] 0 setdash stroke" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l s"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledDiamond + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 ymark moveto xmark 0 lineto xsize ymark lineto" + "xmark ysize lineto closepath gsave [] 0 setdash stroke grestore fill" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 __ymark m __xmark 0 l __xsize __ymark l __xmark __ysize l b" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphCircle + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath xmark ymark xmark 0 360 arc" + "[] 0 setdash stroke" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract +# +# draw a circle whose centre is at (xmark, ymark) and whose radius is xmark units; +# +# for curveto to work, we need to calculate the control points of the Bezier curve +# as well as move the pen to the correct initial point. The circle is drawn as two +# arcs of 180 degrees +# +# pt0 = (xmark + xmark, ymark) +# pt1 = (xmark + xmark, ymark + 4/3 * xmark) +# pt2 = (0, ymark + 4/3 * xmark) +# pt3 = (0, ymark) +# +# pt0 = (0, ymark) +# pt1 = (0, ymark - 4/3 * xmark) +# pt2 = (xmark + xmark, ymark - 4/3 * xmark) +# pt3 = (xmark + xmark, ymark) +# + {"n [] 0 d" + "__mul(2, __xmark) __ymark m" + "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "0 __ymark c" # pt3 + + "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "__mul(2, __xmark) __ymark c S" # pt3 + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledCircle + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "newpath xmark ymark xmark 0 360 arc" + "gsave [] 0 setdash stroke grestore fill" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract +# +# draw a filled circle whose centre is at (xmark, ymark) and whose radius is xmark units; +# +# for curveto to work, we need to calculate the control points of the Bezier curve +# as well as move the pen to the correct initial point. The circle is drawn as two +# arcs of 180 degrees +# +# pt0 = (xmark + xmark, ymark) +# pt1 = (xmark + xmark, ymark + 4/3 * xmark) +# pt2 = (0, ymark + 4/3 * xmark) +# pt3 = (0, ymark) +# +# pt0 = (0, ymark) +# pt1 = (0, ymark - 4/3 * xmark) +# pt2 = (xmark + xmark, ymark - 4/3 * xmark) +# pt3 = (xmark + xmark, ymark) +# +# Note: this is not a strict translation because there is a setdash bracketed by +# gsave/grestore in the above PostScript but there is no closepath before it; +# but in PDF, it is not possible to execute a setdash within a path definition. +# + {"n [] 0 d" + "__mul(2, __xmark) __ymark m" + "__mul(2, __xmark) __add(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "0 __add(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "0 __ymark c" # pt3 + + "0 __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt1 + "__mul(2, __xmark) __sub(__ymark, __div(__mul(4, __xmark), 3))" # pt2 + "__mul(2, __xmark) __ymark c b" # pt3 + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphTriangle + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + "closepath [] 0 setdash stroke" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l s"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphFilledTriangle + import @LoutLengths named symbolsize { 0.15f } +{ + @BackEnd @Case { + + PostScript @Yield { + @HContract @VContract + { "newpath 0 0 moveto xsize 0 lineto xmark ysize 1.25 mul lineto" + "closepath gsave [] 0 setdash stroke grestore fill" + } + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + PDF @Yield { + @HContract @VContract + {"n [] 0 d 0 0 m __xsize 0 l __xmark __mul(__ysize, 1.25) l h b"} + @Graphic + {symbolsize @High symbolsize @Wide ^| symbolsize @Wide ^/ symbolsize @High} + } + + } +} + +def @GraphNoLine + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + length @Wide {} +} + +def @GraphSolid + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "solid end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphSolid UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotted + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotted end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotted UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotDotDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdotdashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + +def @GraphDotDotDotDashed + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @LoutLengths named length { 1.0f } +{ + @BackEnd @Case { + PostScript @Yield { + @HContract @VContract + { "xsize 0 lgraphdict begin newpath 0 0 moveto lineto" + "/linewidth" linewidth "def xsize" dashlength "dotdotdotdashed end" + } @Graphic { length @Wide } + } +# VT: PDF does nothing + PDF @Yield { + @HContract @VContract + { "% @GraphDotDotDotDashed UNIMPLEMENTED" } @Graphic { length @Wide } + } + } +} + + +export @Data +def @Graph + named save { no } + named style { frame } + import @LoutLengths named width { 6.0c } + import @LoutLengths named height { 4.0c } + import @PSLengths named xextra { "none" } + import @PSLengths named yextra { "none" } + named xdecreasing { no } + named ydecreasing { no } + named leftcaption { } + named rightcaption { } + named abovecaption { } + named belowcaption { } + import @LoutLengths named leftgap { 1.5c } + import @LoutLengths named rightgap { 0.5c } + import @LoutLengths named abovegap { 0.5c } + import @LoutLengths named belowgap { 0.5c } + named hidecaptions { yes } + named objects + named @NW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg ysize" } margin { margin } x } + named @SW + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 0" } margin { margin } x } + named @SE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "0 0" } margin { margin } x } + named @NE + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "0 ysize" } margin { margin } x } + named @W + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg ysize 2 div" } margin { margin } x } + named @S + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 2 div 0" } margin { margin } x } + named @E + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "0 ysize 2 div" } margin { margin } x } + named @N + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 2 div ysize" } margin { margin } x } + named @CTR + import @GraphMath named at { 0 0 } + import @LoutLengths named margin { 0.3f } + right x + { at @GraphObj adj { "xsize neg 2 div ysize 2 div" } margin {margin} x } + {} + named xorigin named none { "false" } { none } + named yorigin named none { "false" } { none } + named xlog named none { "0" } { none } + named ylog named none { "0" } { none } + named points named none { "none" } { none } + named pairs named none { "none" } { none } + named colour color named none { "none" } { none } + named paint named none { "none" } { none } + import @TextureImport named texture { solid } + named xmin named none { "false" } { none } + named xmax named none { "false" } { none } + named ymin named none { "false" } { none } + named ymax named none { "false" } { none } + named xticksep named none { "0" } { none } + named yticksep named none { "0" } { none } + named rticksep named none { "0" } { none } + import @GraphMath named xticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { false } + import @GraphMath named yticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { false } + import @GraphMath named rticks + named none { "false" } + named auto { "false" } + named "@" { " lgen" } + named "^" { "^" } + { } + import @PSLengths named xticklength { 0.5f } + import @PSLengths named yticklength { 0.5f } + import @PSLengths named rticklength { 0.5f } + named dataformat { xandy } + import @PSLengths named dashlength { 0.2f } + import @PSLengths named linewidth { "currentlinewidth" } + import @PSLengths named symbolsize { 0.15f } + body @Body +@Begin + + def @Above + { + abovecaption @Case { + "" @Yield {} + else @Yield @OneCol { ||0.5rt clines @Break abovecaption || //abovegap } + } + } + + def @Below + { + belowcaption @Case { + "" @Yield {} + else @Yield @OneCol { //belowgap ||0.5rt clines @Break belowcaption || } + } + } + + def @Left + { + leftcaption @Case { + "" @Yield {} + else @Yield @OneCol @OneRow { + { //0.5rt @OneRow clines @Break leftcaption // } ^||leftgap } + } + } + + def @Right + { + rightcaption @Case { + "" @Yield {} + else @Yield @OneCol @OneRow { + ||rightgap { //0.5rt @OneRow lines @Break rightcaption // } } + } + } + + def @ZeroWidth + right x + { + hidecaptions @Case { + { No no } @Yield x + { Yes yes } @Yield @OneCol { ||0io x ||0io } + } + } + + def @AddCaptions right x + { + def belowextra + { + xticks @Case { + "" @Yield { 0i } + else @Yield { 1.7f } + } + } + + @HContract @VContract + { + | @Above | + / @ZeroWidth @Left | &0.5rt x | @ZeroWidth @Right + /belowextra | @Below | + } + } + + export pi e sqrt abs ceiling floor truncate round cos sin atan exp log rand + "*" "/" idiv mod "-" "-0" "-1" "-2" "-3" "-4" "-5" "-6" "-7" "-8" + "-9" "-." "+" "=" "!=" "<" "<=" ">" ">=" not and xor or + if xloop yloop zloop + + def @Data + named points named none { "none" } { points } + named pairs named none { "none" } { pairs } + named colour color named none { "none" } { colour } + named paint named none { "none" } { paint } + import @TextureImport named texture { texture } + import @PSLengths named dashlength { dashlength } + import @PSLengths named linewidth { linewidth } + import @PSLengths named symbolsize { symbolsize } + named dataformat { dataformat } + body data + { + def pi { "3.14159" } + def e { "2.71828" } + def sqrt precedence 40 right y { y "sqrt" } + def abs precedence 40 right y { y "abs" } + def ceiling precedence 40 right y { y "ceiling" } + def floor precedence 40 right y { y "floor" } + def truncate precedence 40 right y { y "truncate" } + def round precedence 40 right y { y "round" } + def cos precedence 40 right y { y "cos" } + def sin precedence 40 right y { y "sin" } + def atan precedence 39 left x right y { x y "atan" } + def exp precedence 38 left x right y { x y "exp" } + def log precedence 37 left x right y { x y "dolog" } + def rand precedence 36 left x right y { x y "dorand" } + def "*" precedence 35 left x right y { x y "mul" } + def "/" precedence 34 left x right y { x y "div" } + def idiv precedence 34 left x right y { x y "idiv" } + def mod precedence 34 left x right y { x y "mod" } + def "-" precedence 33 left x right y + { x @Case { "" @Yield {y "neg"} else @Yield { x y "sub" } } } + def "-0" { "-0" } + def "-1" { "-1" } + def "-2" { "-2" } + def "-3" { "-3" } + def "-4" { "-4" } + def "-5" { "-5" } + def "-6" { "-6" } + def "-7" { "-7" } + def "-8" { "-8" } + def "-9" { "-9" } + def "-." { "-." } + def "+" precedence 32 left x right y + { x @Case { "" @Yield { y } else @Yield { x y "add" } } } + def "=" precedence 30 left x right y { x y "eq" } + def "!=" precedence 30 left x right y { x y "ne" } + def "<" precedence 30 left x right y { x y "lt" } + def "<=" precedence 30 left x right y { x y "le" } + def ">" precedence 30 left x right y { x y "gt" } + def ">=" precedence 30 left x right y { x y "ge" } + def not precedence 25 right y { y "not" } + def and precedence 24 left x right y { x y "and" } + def xor precedence 23 left x right y { x y "xor" } + def or precedence 22 left x right y { x y "or" } + def if + named cond { true } + named then {} + named else {} + { cond "{" then "} {" else "} ifelse" } + def xloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named x { "xval" } {} + { from by to "{ /xval exch def" do "} for" } + def yloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named y { "yval" } {} + { from by to "{ /yval exch def" do "} for" } + def zloop + named from { 0 } + named to { 0 } + named by { 1 } + named do named z { "zval" } {} + { from by to "{ /zval exch def" do "} for" } + + def @IfPt + left no + right yes + { + points @Case { + none @Yield no + else @Yield yes + } + } + + def @Points + { + points @Case { + none @Yield "" + plus @Yield "plus" + cross @Yield "cross" + square @Yield "square" + filledsquare @Yield "filledsquare" + diamond @Yield "diamond" + filleddiamond @Yield "filleddiamond" + circle @Yield "circle" + filledcircle @Yield "filledcircle" + triangle @Yield "triangle" + filledtriangle @Yield "filledtriangle" + } + } + + def @Pairs + { + pairs @Case { + none @Yield {} + solid @Yield { "linesetup solid" @IfPt "ilinesetup solid" } + dashed @Yield { "linesetup cdashed" @IfPt "ilinesetup dashed" } + dotted @Yield { "linesetup dotted" @IfPt "ilinesetup dotted" } + dotdashed @Yield { "linesetup dotcdashed" @IfPt + "ilinesetup dotdashed" } + dotdotdashed @Yield { "linesetup dotdotcdashed" @IfPt + "ilinesetup dotdotdashed" } + dotdotdotdashed @Yield { "linesetup dotdotdotcdashed" @IfPt + "ilinesetup dotdotdotdashed" } + surfacexhisto @Yield { "surfacexhisto" } + surfaceyhisto @Yield { "surfaceyhisto" } + xhisto @Yield { "xhisto" } + yhisto @Yield { "yhisto" } + filledxhisto @Yield { "filledxhisto" } + filledyhisto @Yield { "filledyhisto" } + } + } + + def @DataFormat + { + dataformat @Case { + xandy @Yield xandy + swapxandy @Yield swapxandy + yonly @Yield yonly + xonly @Yield xonly + } + } + + def @Paint + { + paint @Case { + { none no No } @Yield "false" + { yes Yes } @Yield "true" + } + } + + "[ [" data "]" dataformat + "{" @Points "}" + "{" @Pairs "}" + "{ /dashlength" dashlength "def" + " /linewidth" linewidth "def" @ColourCommand colour + " /symbolsize" symbolsize "def }" + "{" @Paint "}" + "{" texture "}" + "]" + } + + def @Style + { + style @Case { + frame @Yield { "framestyle" } + none @Yield { "nonestyle" } + axes @Yield { "axesstyle" } + } + } + + def @XExtra + { + xextra @Case { + "none" @Yield { + style @Case { + frame @Yield { "0.5 cm" } + none @Yield { "0" } + axes @Yield { "0" } + } + } + else @Yield xextra + } + } + + def @YExtra + { + yextra @Case { + "none" @Yield { + style @Case { + frame @Yield { "0.5 cm" } + none @Yield { "0" } + axes @Yield { "0" } + } + } + else @Yield yextra + } + } + + def @XDecreasing + { + xdecreasing @Case { + { No no } @Yield "false" + { Yes yes } @Yield "true" + } + } + + def @YDecreasing + { + ydecreasing @Case { + { No no } @Yield "false" + { Yes yes } @Yield "true" + } + } + + @AddCaptions width @Wide height @High + @BackEnd @Case { + PostScript @Yield { + { + "grestore" + save @Case { { Yes yes } @Yield "save" else @Yield {} } + "gsave xsize ysize lgraphdict begin /ysize exch def /xsize exch def" + "/alldata [" @Body "] def" + xticksep "[" xticks "] 0 alldata" xmin xmax xlog + @XExtra @XDecreasing xorigin xticklength "xset" + yticksep "[" yticks "] 1 alldata" ymin ymax ylog + @YExtra @YDecreasing yorigin yticklength "yset" + + rticks @Case { + + "" @Yield "norset" + + else @Yield { + rticksep "[" rticks "] 1 alldata" ymin ymax ylog + @YExtra @YDecreasing yorigin rticklength "rset" + } + } + + "rundata" @Style // "end" + save @Case { { Yes yes } @Yield "restore" else @Yield {} } + } @Graphic { //1rt objects } + } + PDF @Yield { {"% @Graph UNIMPLEMENTED"} @Graphic { //1rt objects } } + } + +@End @Graph diff --git a/include/save_graphf.lpg b/include/save_graphf.lpg new file mode 100644 index 0000000..5546586 --- /dev/null +++ b/include/save_graphf.lpg @@ -0,0 +1,899 @@ +%%BeginResource: procset LoutGraphPrependGraphic +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% PostScript @SysPrependGraphic file for @Graph (Version 1.0) % +% % +% Version 1.0 by Jeffrey H. Kingston, December 1993. % +% swapxandy added September 2001 by JHK. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +errordict begin + /handleerror + { + { /Times-Roman findfont 8 pt scalefont setfont + 0 setgray 4 pt 4 pt moveto + $error /errorname get + dup lgraphdict exch known + { lgraphdict exch get } + { 30 string cvs } ifelse + show + ( Command: ) show + $error /command get 30 string cvs show + } stopped {} if + showpage stop + } def +end + +/lgraphdict 200 dict def +lgraphdict begin + +% error messages +/dictfull (dictfull error) def +/dictstackoverflow (dictstackoverflow error) def +/execstackoverflow (execstackoverflow error: expression too complex?) def +/limitcheck (limitcheck error: graph too complex or too large?) def +/syntaxerror (syntaxerror error: syntax error in text of graph?) def +/typecheck (typecheck error: syntax error in text of graph?) def +/undefined (undefined error: unknown or misspelt symbol?) def +/rangecheck (rangecheck error: undefined expression (e.g. divide by zero)?) def +/VMError (VMError error: run out of memory?) def + +% random number between x and y inclusive: x y dorand num +/dorand { 1 index sub 1 add rand exch mod add } def + +% log to given base: base num dolog num +/dolog { ln exch ln div } def + +% maximum of two numbers: <num> <num> max <num> +/max { 2 copy gt { pop } { exch pop } ifelse } def + +% add two points: <point> <point> padd <point> +/padd { exch 3 1 roll add 3 1 roll add exch } def + +% subtract first point from second: <point> <point> psub <point> +/psub { 3 2 roll sub 3 1 roll exch sub exch } def + +% distance between two points: <point> <point> distance <length> +/distance { psub dup mul exch dup mul add sqrt } def + +% point at angle and distance: <point> <length> <angle> atangle <point> +/atangle { 2 copy cos mul 3 1 roll sin mul padd } def + +% angle from one point to another: <point> <point> angle <angle> +/angle { psub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def + + +% set up for line +% - linesetup <length> <dashlength> +/linesetup +{ newpath + xcurr ycurr trpoint xprev yprev trpoint + 4 copy moveto lineto distance dashlength +} def + +% set up for icon-avoiding line +% - ilinesetup <length> <dashlength> +/ilinesetup +{ newpath + xprev yprev trpoint xcurr ycurr trpoint 4 copy + 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle + 6 2 roll 4 2 roll + 4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle + 4 copy moveto lineto distance dashlength +} def + + +% stroke a solid line: <length> <dashlength> solid - +/solid +{ pop pop [] 0 setdash linewidth setlinewidth stroke +} def + +% stroke a dashed line: <length> <dashlength> dashed - +/dashed +{ 2 copy 2 mul le 1 index 0 le or + { exch pop 1 pt max [ exch dup ] 0 setdash } + { dup [ exch 4 2 roll 2 copy div + 1 sub 2 div ceiling dup 4 1 roll + 1 add mul sub exch div ] 0 setdash + } ifelse linewidth setlinewidth stroke +} def + +% stroke a cdashed line: <length> <dashlength> cdashed - +/cdashed +{ 2 copy le 1 index 0 le or + { exch pop 1 pt max [ exch dup ] dup 0 get 2 div setdash } + { dup [ 4 2 roll exch 2 copy exch div + 2 div ceiling div 1 index sub + ] exch 2 div setdash + } ifelse linewidth setlinewidth stroke +} def + +% stroke a dotted line: <length> <dashlength> dotted - +/dotted +{ 2 copy le 1 index 0 le or + { exch pop 1 pt max [ exch 0 exch ] 0 setdash } + { 1 index exch div ceiling div 0.99999 mul + [ 0 3 2 roll ] 0 setdash + } ifelse gsave 1 setlinecap linewidth setlinewidth stroke grestore newpath +} def + +% stroke a noline line: <length> <dashlength> noline - +/noline +{ pop pop +} def + +% scale array elements by factor: <array> <factor> scalearray <array> +/scalearray +{ + [ exch 3 2 roll + { exch dup 3 1 roll mul exch } forall + pop ] +} def + +% sum array elements: <array> sumarray <number> +/sumarray +{ + 0 exch { add } forall +} def + +% begin a more complex line: <length> <dashlength> linebegin - +/linebegin +{ + % (Entering linebegin) 2 debugprint + 20 dict begin + /dashlen exch 1 pt max def + /len exch def + /gap dashlen def + /halfgap dashlen 2 div def + /dash dashlen def + /halfdash dashlen 2 div def + /dot 0 def + % (Leaving linebegin) 0 debugprint +} def +% end a more complex line: <linecap> <cycle> <startpos> <stoppos> lineend - +/lineend +{ + % (Entering lineend) 3 debugprint + /stoppos exch def + /startpos exch def + /cycle exch def + /linecap exch def + /stopposlen stoppos sumarray def + /startposlen startpos sumarray def + /cyclelen cycle sumarray def + /effectivelen len startposlen add stopposlen sub def + effectivelen 0 gt cyclelen 0 gt and + { + /repeats effectivelen cyclelen div ceiling def + /factor len repeats cyclelen mul startposlen sub stopposlen add div def + cycle factor scalearray startposlen factor mul setdash + linecap setlinecap stroke + } if + end + % (Leaving lineend) 0 debugprint +} def + +% stroke a dotdashed line: <length> <dashlength> dotdashed - +/dotdashed +{ + linebegin + 1 [dash gap dot gap] [] [dash] + lineend +} def + +% stroke a dotcdashed line: <length> <dashlength> dotcdashed - +/dotcdashed +{ + linebegin + 1 [dash gap dot gap] [halfdash] [halfdash] + lineend +} def + +% stroke a dotdotdashed line: <length> <dashlength> dotdotdashed - +/dotdotdashed +{ + linebegin + 1 [dash gap dot gap dot gap] [] [dash] + lineend +} def + +% stroke a dotdotcdashed line: <length> <dashlength> dotdotcdashed - +/dotdotcdashed +{ + linebegin + 1 [dash gap dot gap dot gap] [halfdash] [halfdash] + lineend +} def + +% stroke a dotdotdotdashed line: <length> <dashlength> dotdotdotdashed - +/dotdotdotdashed +{ + linebegin + 1 [dash gap dot gap dot gap dot gap] [] [dash] + lineend +} def + +% stroke a dotdotdotcdashed line: <length> <dashlength> dotdotdotcdashed - +/dotdotdotcdashed +{ + linebegin + 1 [dash gap dot gap dot gap dot gap] [halfdash] [halfdash] + lineend +} def + + +% stroke a y histogram: - yhisto - +/yhisto +{ xprev yleft trpoint yextra sub moveto + xprev yprev trpoint lineto + xcurr yprev trpoint lineto + xcurr yleft trpoint yextra sub lineto + linewidth setlinewidth stroke +} def + +% stroke an x histogram: - xhisto - +/xhisto +{ xleft yprev trpoint exch xextra sub exch moveto + xcurr yprev trpoint lineto + xcurr ycurr trpoint lineto + xleft ycurr trpoint exch xextra sub exch lineto + linewidth setlinewidth stroke +} def + +% stroke a surface y histogram: - surfaceyhisto - +/surfaceyhisto +{ firstpair + { xprev yleft trpoint yextra sub moveto + xprev yprev trpoint lineto + } + { xprev yprev trpoint moveto + } ifelse + xcurr yprev trpoint lineto + lastpair + { xcurr yleft trpoint yextra sub lineto + } + { xcurr ycurr trpoint lineto + } ifelse + linewidth setlinewidth stroke +} def + +% stroke a surface x histogram: - surfacexhisto - +/surfacexhisto +{ firstpair + { xleft yprev trpoint exch xextra sub exch moveto + } + { xprev yprev trpoint moveto + } ifelse + xcurr yprev trpoint lineto + xcurr ycurr trpoint lineto + lastpair + { xleft ycurr trpoint exch xextra sub exch lineto + } if + linewidth setlinewidth stroke +} def + +% % pre-texture versions +% % stroke a filled y histogram: - filledyhisto - +% /filledyhisto +% { +% linewidth setlinewidth +% xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto +% xprev yprev trpoint exch currentlinewidth 2 div add exch lineto +% xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto +% xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto +% closepath fill +% } def + +% % stroke a filled x histogram: - filledxhisto - +% /filledxhisto +% { +% linewidth setlinewidth +% xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto +% xcurr yprev trpoint currentlinewidth 2 div add lineto +% xcurr ycurr trpoint currentlinewidth 2 div sub lineto +% xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto +% closepath fill +% } def + +% stroke a filled y histogram: - filledyhisto - +/filledyhisto +{ + linewidth setlinewidth + xprev yleft trpoint exch currentlinewidth 1.3 mul add exch yextra sub moveto + xprev yprev trpoint exch currentlinewidth 1.3 mul add exch lineto + xcurr yprev trpoint exch currentlinewidth 1.3 mul sub exch lineto + xcurr yleft trpoint exch currentlinewidth 1.3 mul sub exch yextra sub lineto + gsave texture fill grestore stroke +} def + +% stroke a filled x histogram: - filledxhisto - +/filledxhisto +{ + linewidth setlinewidth + xleft yprev trpoint currentlinewidth 1.3 mul add exch xextra sub exch moveto + xcurr yprev trpoint currentlinewidth 1.3 mul add lineto + xcurr ycurr trpoint currentlinewidth 1.3 mul sub lineto + xleft ycurr trpoint currentlinewidth 1.3 mul sub exch xextra sub exch lineto + gsave texture fill grestore stroke +} def + + +% cross: show a small cross +/cross +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg symbolsize neg rmoveto + symbolsize 2 mul symbolsize 2 mul rlineto + 0 symbolsize -2 mul rmoveto + symbolsize -2 mul symbolsize 2 mul rlineto + [] 0 setdash stroke +} def + +% plus: show a small plus +/plus +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg 0 rmoveto + symbolsize 2 mul 0 rlineto + symbolsize neg symbolsize neg rmoveto + 0 symbolsize 2 mul rlineto + [] 0 setdash stroke +} def + +% square: show a small square +/square +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg symbolsize neg rmoveto + symbolsize 2 mul 0 rlineto + 0 symbolsize 2 mul rlineto + symbolsize -2 mul 0 rlineto + closepath [] 0 setdash stroke +} def + +% filledsquare: show a small filled square +/filledsquare +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg symbolsize neg rmoveto + symbolsize 2 mul 0 rlineto + 0 symbolsize 2 mul rlineto + symbolsize -2 mul 0 rlineto + closepath gsave [] 0 setdash stroke grestore fill +} def + +% diamond: show a small diamond +/diamond +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg 0 rmoveto + symbolsize symbolsize neg rlineto + symbolsize symbolsize rlineto + symbolsize neg symbolsize rlineto + closepath [] 0 setdash stroke +} def + +% filleddiamond: show a small filled diamond +/filleddiamond +{ newpath + xcurr ycurr trpoint moveto + symbolsize neg 0 rmoveto + symbolsize symbolsize neg rlineto + symbolsize symbolsize rlineto + symbolsize neg symbolsize rlineto + closepath gsave [] 0 setdash stroke grestore fill +} def + +% circle: show a small circle +/circle +{ newpath + xcurr ycurr trpoint symbolsize 0 360 arc [] 0 setdash stroke +} def + +% filledcircle: show a small filled circle +/filledcircle +{ newpath + xcurr ycurr trpoint symbolsize 0 360 arc gsave [] 0 setdash stroke grestore fill +} def + +% triangle: show a small triangle +/triangle +{ newpath + xcurr ycurr trpoint moveto + 0 symbolsize 1.5 mul rmoveto + symbolsize neg symbolsize -2.5 mul rlineto + symbolsize 2 mul 0 rlineto + closepath [] 0 setdash stroke +} def + +% filledtriangle: show a small filled triangle +/filledtriangle +{ newpath + xcurr ycurr trpoint moveto + 0 symbolsize 1.5 mul rmoveto + symbolsize neg symbolsize -2.5 mul rlineto + symbolsize 2 mul 0 rlineto + closepath gsave [] 0 setdash stroke grestore fill +} def + + +%plog: like log only with a base, and protected from failing if <= 0 +% base x plog res +/plog { dup 0 le { pop pop 0 } { ln exch ln div } ifelse } def + +% xtr: transform one x value logarithmically if xlog > 1 +% <num> xtr <num> +/xtr +{ xlog 1 gt + { xlog exch plog + } if +} def + +% ytr: transform one y value logarithmically if ylog > 1 +% <num> ytr <num> +/ytr +{ ylog 1 gt + { ylog exch plog + } if +} def + + +% trpoint: transform (x, y) in graph space into (x', y') in print space +% x y trpoint x' y' +/trpoint +{ exch xtr xdecr { trxmax exch sub } { trxmin sub } ifelse + trxmax trxmin sub div xwidth mul xextra add + + exch ytr ydecr { trymax exch sub } { trymin sub } ifelse + trymax trymin sub div ywidth mul yextra add +} def + + +% yonly: interpolate x values 1, 2, ... into data +% [ data ] yonly [ newdata ] +/yonly +{ dup /tmp exch def + length [ exch 1 exch 1 exch + { dup tmp exch 1 sub get + } for + ] +} def + +% xonly: interpolate y values 1, 2, ... into data +% [ data ] yonly [ newdata ] +/xonly +{ dup /tmp exch def + length [ exch 1 exch 1 exch + { dup tmp exch 1 sub get exch + } for + ] +} def + +% xandy: no interpolation of x or y values +% [ data ] xandy [ data ] +/xandy {} def + +% swapxandy: swap x and y values +% [ data ] swapxandy [ data ] +/swapxandy +{ dup /tmp exch def + length [ exch 2 exch 2 exch + { dup tmp exch 1 sub get exch 2 sub tmp exch get + } for + ] +} def + + +% expstringwidth: calculate width of string containing optional exponent +% <string> expstringwidth <width> +/expstringwidth +{ (^) search + { exch pop stringwidth pop exch stringwidth pop 0.7 mul add } + { stringwidth pop } + ifelse +} def + +% expstringshow: show string containing optional exponent +% <string> expstringshow - +/expstringshow +{ (^) search + { exch pop show 0 0.5 ft rmoveto + gsave currentfont 0.7 scalefont setfont show grestore + } + { show + } + ifelse +} def + +% concatenate two strings: <string> <string> strconcat <string> +/strconcat +{ 2 copy length exch length add string + dup 0 4 index putinterval + dup 3 index length 3 index putinterval + 3 1 roll pop pop +} def + +% lgen: generate one label automatically +% num lgen num string +/lgen { dup 20 string cvs } def + +% loglgen: generate one logarithmic label (with exponent) +% <base> <exponent> loglgen <string> +/loglgen +{ 20 string cvs exch 20 string cvs + (^) strconcat exch strconcat +} def + + +% printxtick: print one x tick +% xpos printxtick - +/printxtick +{ newpath + yleft trpoint moveto 0 yextra neg rmoveto + 0 xticklength neg rlineto [] 0 setdash stroke +} def + +% printxlabel: print one x label +% (xlabel) xpos printxlabel - +/printxlabel +{ yleft trpoint moveto 0 yextra neg rmoveto + 0 xticklength neg rmoveto 0 0.9 ft neg rmoveto + xlog 1 gt { 0 0.3 ft neg rmoveto } if + dup expstringwidth -2 div 0 rmoveto expstringshow +} def + +% printytick: print one y tick +% ypos printytick - +/printytick +{ newpath + xleft exch trpoint moveto xextra neg 0 rmoveto + yticklength neg 0 rlineto [] 0 setdash stroke +} def + +% printylabel: print one y label +% (ylabel) ypos printylabel - +/printylabel +{ xleft exch trpoint moveto xextra neg 0 rmoveto + yticklength neg 0 rmoveto -0.3 ft -0.3 ft rmoveto + dup expstringwidth neg 0 rmoveto expstringshow +} def + +% printrtick: print one r tick +% ypos printrtick - +/printrtick +{ newpath + xright exch trpoint moveto xextra 0 rmoveto + rticklength 0 rlineto [] 0 setdash stroke +} def + +% printrlabel: print one r label +% (rlabel) ypos printrlabel - +/printrlabel +{ xright exch trpoint moveto xextra 0 rmoveto + rticklength 0 rmoveto 0.3 ft -0.3 ft rmoveto + expstringshow +} def + +% printticks: print ticks and labels +% /tickproc /labelproc [ tickandlabeldata ] min printticks - +/printticks +{ /prev exch def + { dup type dup dup /integertype eq exch /realtype eq or + { pop dup /prev exch def 2 index cvx exec + } + { /stringtype eq + { prev 2 index cvx exec + } + { pop + } ifelse + } ifelse + } forall + pop pop +} def + + +% printxaxistick: print one x axis tick +% xpos printxaxistick - +/printxaxistick +{ newpath + yaxis trpoint moveto 0 xticklength -2 div rmoveto + 0 xticklength rlineto [] 0 setdash stroke +} def + +% printxaxislabel: print one x axis label +% (xlabel) xpos printxaxislabel - +/printxaxislabel +{ yaxis trpoint moveto + 0 xticklength -2 div rmoveto 0 0.9 ft neg rmoveto + xlog 1 gt { 0 0.3 ft neg rmoveto } if + dup expstringwidth -2 div 0 rmoveto expstringshow +} def + +% printyaxistick: print one y axis tick +% ypos printyaxistick - +/printyaxistick +{ newpath + xaxis exch trpoint moveto + yticklength -2 div 0 rmoveto + yticklength 0 rlineto [] 0 setdash stroke +} def + +% printyaxislabel: print one y axis label +% (ylabel) ypos printyaxislabel - +/printyaxislabel +{ xaxis exch trpoint moveto + yticklength -2 div 0 rmoveto -0.3 ft -0.3 ft rmoveto + dup expstringwidth neg 0 rmoveto expstringshow +} def + + +% <val> minmax - +% perform minv := min(minv, val); maxv := max(maxv, val) +% allowing for the possibility of minv, maxv, val being false (undefined) +/minmax +{ dup false eq + { pop } + { minv false eq + { dup /minv exch def /maxv exch def } + { dup minv lt + { /minv exch def } + { dup maxv gt + { /maxv exch def } + { pop } + ifelse + } ifelse + } ifelse + } ifelse +} def + +% <ticks> ticksundef <ticks> <bool> +% returns true iff the ticks array is undefined (one false entry) +/ticksundef +{ dup length 1 eq + { dup 0 get false eq + } + { false } + ifelse +} def + +% <number> integral <boolean> +% true if the number has an integral value +/integral { dup round eq } def + +% ticksep ticks xory alldata minval maxval axis base ticksandlimits ticks min max base +% ticksandlimits: sort out value of x or y ticks and limits and log base +/ticksandlimits +{ /base exch def + /minv false def + /maxv false def + + % min and max of user-supplied minval, maxval, and axis + minmax minmax minmax + + % min and max of data points + { 0 get dup dup length 1 sub 3 index exch 2 exch + { get minmax dup + } for pop pop + } forall + pop dup + + % min and max of tick values + { dup type /stringtype eq + { pop } { minmax } ifelse + } forall + + % fix minv and maxv if undefined (false) or equal + minv false eq + { /minv -1 def /maxv 1 def } + { minv maxv eq + { minv 0 lt + { /minv 2 minv mul def /maxv 0 def + } + { minv 0 eq + { /minv -1 def /maxv 1 def + } + { /minv 0 def /maxv 2 maxv mul def + } ifelse + } ifelse + } if + } ifelse + + % invent ticks if undefined + ticksundef + { pop /ticksep exch def + + % if base is reasonable and minv is positive, logarithmic ticks + base 1 gt minv 0 gt and + { + % get integral log of minv and maxv + /logminv base minv plog floor cvi def + /logmaxv base maxv plog ceiling cvi def + + % if minv close to base, make it 1; reset minv and maxv + logminv 1 eq logmaxv 4 ge and { /logminv 0 def } if + /minv base logminv exp def + /maxv base logmaxv exp def + + % ticks := [ base**logminv, ... , base**logmaxv ] + [ logminv 1 logmaxv + { dup base exch exp + exch base exch loglgen + } for + ] + } + { % non-logarithmic ticks + { + % fix tick separation if undefined (0) or too small + /base 0 def + /delta maxv minv sub def + ticksep delta 30 div le + { /ticksep 10 delta log 1 sub ceiling exp def + ticksep delta 2 div ge + { /ticksep ticksep 2 div def } + { ticksep delta 5 div lt + { /ticksep 2 ticksep mul def + } if + } ifelse + } if + + % adjust minv and maxv to be multiples of ticksep + /minv minv ticksep div floor ticksep mul def + /maxv maxv ticksep div ceiling ticksep mul def + /delta maxv minv sub def + + % if minv or maxv near zero, move to zero and redo + minv ticksep eq + { /minv 0 def } + { maxv ticksep neg eq { /maxv 0 def } { exit } ifelse + } ifelse + } loop + + % if minv, maxv, and ticksep are all integral, set "makeint" to true + /makeint minv integral maxv integral ticksep integral and and def + + % ticks := [ minv, minv+ticksep, ... , maxv ] + [ 0 1 delta ticksep div round + { ticksep mul minv add makeint { cvi } if lgen } + for + ] + } ifelse + } + { exch pop + } ifelse + minv maxv base +} def + +% xset: set up all data for x axis, including limits and ticks +% xticksep xticks 0 alldata xmin xmax xlog xextra xdecr xaxis xticklength xset - +/xset +{ /xticklength exch def + /xaxis exch def + /xdecr exch def + /xextra exch def + xaxis exch ticksandlimits + /xlog exch def /xmax exch def /xmin exch def /xticks exch def + /xleft xdecr { xmax } { xmin } ifelse def + /xright xdecr { xmin } { xmax } ifelse def + /xwidth xsize xextra 2 mul sub def + /trxmin xmin xtr def /trxmax xmax xtr def +} def + +% yset: set up all data for y axis, including limits and yticks +% yticksep yticks 0 alldata ymin ymax ylog yextra ydecr yaxis yticklength yset - +/yset +{ /yticklength exch def + /yaxis exch def + /ydecr exch def + /yextra exch def + yaxis exch ticksandlimits + /ylog exch def /ymax exch def /ymin exch def /yticks exch def + /yleft ydecr { ymax } { ymin } ifelse def + /yright ydecr { ymin } { ymax } ifelse def + /ywidth ysize yextra 2 mul sub def + /trymin ymin ytr def /trymax ymax ytr def +} def + +% rset: set up all data for y axis (again), but including limits and rticks +% rticksep rticks 0 alldata ymin ymax ylog yextra ydecr yaxis rticklength rset - +/rset +{ /rticklength exch def + /yaxis exch def + /ydecr exch def + /yextra exch def + yaxis exch ticksandlimits + /ylog exch def /ymax exch def /ymin exch def /rticks exch def + /yleft ydecr { ymax } { ymin } ifelse def + /yright ydecr { ymin } { ymax } ifelse def + /ywidth ysize yextra 2 mul sub def + /trymin ymin ytr def /trymax ymax ytr def +} def + +% norset: set up data for no rticks +% - norset - +/norset +{ /rticklength 0 def + /rticks [] def +} def + +% framestyle: print a frame around the graph +/framestyle +{ 0 0 moveto xsize 0 lineto xsize ysize lineto + 0 ysize lineto closepath stroke + /printxtick /printxlabel xticks xleft printticks + /printytick /printylabel yticks ymin printticks + /printrtick /printrlabel rticks ymin printticks +} def + +% nonestyle: print nothing around the graph +/nonestyle +{ +} def + +% axesstyle: print axes for the graph (unless axis values missing) +/axesstyle +{ + xaxis false eq yaxis false eq or + { framestyle } + { xaxis yaxis trpoint dup 0 exch moveto xsize exch lineto + dup 0 moveto ysize lineto stroke + /printxaxistick /printxaxislabel xticks xleft printticks + /printyaxistick /printyaxislabel yticks ymin printticks + } ifelse +} def + +% rundata: run all data sets +/rundata +{ alldata + { gsave + dup dup dup dup dup + 5 get /texture exch def + 4 get /dopaint exch def + 3 get /initrun exch def + 2 get /pairs exch def + 1 get /points exch def + 0 get /data exch def + dopaint + { data length 4 ge + { + gsave + initrun + newpath + data 0 get ymin trpoint yextra sub moveto + 0 2 data length 2 sub + { dup 1 add + data exch get /ycurr exch def + data exch get /xcurr exch def + xcurr ycurr trpoint lineto + } for + data dup length 2 sub get ymin trpoint yextra sub lineto + closepath texture fill + grestore + } if + } if + initrun + data length 2 ge + { + /xcurr data 0 get def + /ycurr data 1 get def + points + data length 4 ge + { 2 2 data length 2 sub + { /xprev xcurr def + /yprev ycurr def + dup dup 2 eq /firstpair exch def + data length 2 sub eq /lastpair exch def + dup 1 add + data exch get /ycurr exch def + data exch get /xcurr exch def + pairs + points + } for + } if + } if + grestore + } forall +} def + +end +%%EndResource diff --git a/include/slides b/include/slides index 3d89c4e..86218ca 100644 --- a/include/slides +++ b/include/slides @@ -170,6 +170,7 @@ # @IndexTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexTypeMain { @B @PageNum } # Main pagenum format # @IndexTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexRangeFormat { @From--@To } # index page range format # @IndexColumnNumber { 2 } # index columns (1 to 10) # @IndexColumnGap { 1.00c @OrIfPlain 6s } # index column gap # @IndexCtd { Yes } # include (ctd.) lines @@ -189,6 +190,7 @@ # @IndexATypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexATypeMain { @B @PageNum } # Main pagenum format # @IndexATypeSpecial { @I @PageNum } # Special pagenum format + # @IndexARangeFormat { @From--@To } # index page range format # @IndexAColumnNumber { 2 } # index A columns (1 to 10) # @IndexAColumnGap { 1.00c @OrIfPlain 6s } # index A column gap # @IndexACtd { Yes } # include (ctd.) lines @@ -208,6 +210,7 @@ # @IndexBTypeOrdinary { @PageNum } # Ordinary pagenum format # @IndexBTypeMain { @B @PageNum } # Main pagenum format # @IndexBTypeSpecial { @I @PageNum } # Special pagenum format + # @IndexBRangeFormat { @From--@To } # index page range format # @IndexBColumnNumber { 2 } # index B columns (1 to 10) # @IndexBColumnGap { 1.00c @OrIfPlain 6s } # index B column gap # @IndexBCtd { Yes } # include (ctd.) lines diff --git a/include/xind b/include/xind new file mode 100644 index 0000000..aeade1e --- /dev/null +++ b/include/xind @@ -0,0 +1 @@ + # @IndexRangeFormat { @From--@To } # index page range format diff --git a/include/xinda b/include/xinda new file mode 100644 index 0000000..c27301b --- /dev/null +++ b/include/xinda @@ -0,0 +1 @@ + # @IndexARangeFormat { @From--@To } # index page range format diff --git a/include/xindb b/include/xindb new file mode 100644 index 0000000..32583e8 --- /dev/null +++ b/include/xindb @@ -0,0 +1 @@ + # @IndexBRangeFormat { @From--@To } # index page range format |