%!PS-Adobe-2.0 %%Version: 0.1 %%DocumentFonts: (atend) %%Pages: (atend) %%EndComments % % Version 3.3.2 prologue for troff files. % /#copies 1 store /aspectratio 1 def /formsperpage 1 def /landscape false def /linewidth .3 def /magnification 1 def /margin 0 def /orientation 0 def /resolution 720 def /rotation 1 def /xoffset 0 def /yoffset 0 def /roundpage true def /useclippath true def /pagebbox [0 0 612 792] def /R /Times-Roman def /I /Times-Italic def /B /Times-Bold def /BI /Times-BoldItalic def /H /Helvetica def /HI /Helvetica-Oblique def /HB /Helvetica-Bold def /HX /Helvetica-BoldOblique def /CW /Courier def /CO /Courier def /CI /Courier-Oblique def /CB /Courier-Bold def /CX /Courier-BoldOblique def /PA /Palatino-Roman def /PI /Palatino-Italic def /PB /Palatino-Bold def /PX /Palatino-BoldItalic def /Hr /Helvetica-Narrow def /Hi /Helvetica-Narrow-Oblique def /Hb /Helvetica-Narrow-Bold def /Hx /Helvetica-Narrow-BoldOblique def /KR /Bookman-Light def /KI /Bookman-LightItalic def /KB /Bookman-Demi def /KX /Bookman-DemiItalic def /AR /AvantGarde-Book def /AI /AvantGarde-BookOblique def /AB /AvantGarde-Demi def /AX /AvantGarde-DemiOblique def /NR /NewCenturySchlbk-Roman def /NI /NewCenturySchlbk-Italic def /NB /NewCenturySchlbk-Bold def /NX /NewCenturySchlbk-BoldItalic def /ZD /ZapfDingbats def /ZI /ZapfChancery-MediumItalic def /S /S def /S1 /S1 def /GR /Symbol def /inch {72 mul} bind def /min {2 copy gt {exch} if pop} bind def /setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale addmetrics 0 0 moveto } def /pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put } def /addmetrics { /Symbol /S null Sdefs cf /Times-Roman /S1 StandardEncoding dup length array copy S1defs cf } def /pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if } def /decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext} ] def /setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def /w {neg moveto show} bind def /m {neg dup /y exch def moveto} bind def /done {/lastpage where {pop lastpage} if} def /f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def } bind def /changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont } bind def /sf {f} bind def /cf { dup length 2 idiv /entries exch def /chtab exch def /newencoding exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put}{pop pop} ifelse} forall newencoding type /arraytype eq {newdict /Encoding newencoding put} if newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end } bind def % % A few arrays used to adjust reference points and character widths in some % of the printer resident fonts. If square roots are too high try changing % the lines describing /radical and /radicalex to, % % /radical [0 -75 550 0] % /radicalex [-50 -75 500 0] % % Move braceleftbt a bit - default PostScript character is off a bit. % /Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0] ] def /S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0] ] def % % Tries to round clipping path dimensions, as stored in array pagebbox, so they % match one of the known sizes in the papersizes array. Lower left coordinates % are always set to 0. % /roundpagebbox { 7 dict begin /papersizes [8.5 inch 11 inch 14 inch 17 inch] def /mappapersize { /val exch def /slop .5 inch def /diff slop def /j 0 def 0 1 papersizes length 1 sub { /i exch def papersizes i get val sub abs dup diff le {/diff exch def /j i def} {pop} ifelse } for diff slop lt {papersizes j get} {val} ifelse } def pagebbox 0 0 put pagebbox 1 0 put pagebbox dup 2 get mappapersize 2 exch put pagebbox dup 3 get mappapersize 3 exch put end } bind def %%EndProlog %%BeginSetup mark % % Encoding vector and redefinition of findfont for the ISO Latin1 standard. % The 18 characters missing from ROM based fonts on older printers are noted % below. % /ISOLatin1Encoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent /sterling /currency /yen /brokenbar % missing /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree % missing /plusminus % missing /twosuperior % missing /threesuperior % missing /acute /mu % missing /paragraph /periodcentered /cedilla /onesuperior % missing /ordmasculine /guillemotright /onequarter % missing /onehalf % missing /threequarters % missing /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth % missing /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply % missing /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute % missing /Thorn % missing /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth % missing /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide % missing /oslash /ugrave /uacute /ucircumflex /udieresis /yacute % missing /thorn % missing /ydieresis ] def /NewFontDirectory FontDirectory maxlength dict def % % Apparently no guarantee findfont is defined in systemdict so the obvious % % systemdict /findfont get exec % % can generate an error. So far the only exception is a VT600 (version 48.0). % userdict /@RealFindfont known not { userdict begin /@RealFindfont systemdict begin /findfont load end def end } if /findfont { dup NewFontDirectory exch known not { dup %dup systemdict /findfont get exec % not always in systemdict dup userdict /@RealFindfont get exec dup /Encoding get StandardEncoding eq { dup length dict begin {1 index /FID ne {def}{pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /DummyFontName exch definefont } if NewFontDirectory 3 1 roll put } if NewFontDirectory exch get } bind def setup %%EndSetup %%Page: 1 1 /saveobj save def mark 1 pagesetup 12 /Times-Bold f (Netpbm) 2323 1230 w (User) 2766 1230 w (Manual) 3035 1230 w 10 /Times-Bold f (Error Handling) 720 1920 w (Netpbm Programming Library Errors) 720 2196 w 10 /Times-Roman f (As part of Netpbm's mission to make writing graphics programs quick and easy, Netpbm recognizes that) 720 2388 w (no) 4940 2388 w (programmer) 720 2508 w (likes) 1250 2508 w (to) 1476 2508 w (deal) 1591 2508 w (with) 1793 2508 w (error) 2007 2508 w (conditions.) 2236 2508 w (Therefore,) 2739 2508 w (very) 3192 2508 w (few) 3405 2508 w (Netpbm) 3590 2508 w (programming) 3948 2508 w (library) 4528 2508 w (func\255) 4830 2508 w (tions) 720 2628 w (return) 946 2628 w (error) 1215 2628 w (information.) 1439 2628 w (There) 1992 2628 w (are) 2255 2628 w (no) 2407 2628 w (return) 2538 2628 w (codes) 2807 2628 w (to) 3065 2628 w (check.) 3174 2628 w (If) 3487 2628 w (for) 3585 2628 w (some) 3733 2628 w (reason) 3976 2628 w (a) 4268 2628 w (function) 4344 2628 w (can't) 4709 2628 w (do) 4940 2628 w (what was asked of it, it doesn't return at all.) 720 2748 w (Netpbm's response to encountering an error is called "throwing an error.") 720 2904 w (The) 720 3060 w (typical) 903 3060 w (way) 1203 3060 w (a) 1397 3060 w (Netpbm) 1469 3060 w (function) 1819 3060 w (throws) 2180 3060 w (an) 2480 3060 w (error) 2602 3060 w (\(for) 2823 3060 w (example,) 3000 3060 w (when) 3391 3060 w (you) 3635 3060 w (attempt) 3814 3060 w (to) 4143 3060 w (open) 4250 3060 w (a) 4473 3060 w (non\255existent) 4546 3060 w (file) 720 3180 w (with) 879 3180 w 10 /Times-Bold f (pm) 1083 3180 w 10 /S f (_) 1222 3180 w 10 /Times-Bold f (openr\(\)) 1272 3180 w 10 /Times-Roman f (\)) 1588 3180 w (is) 1647 3180 w (that) 1740 3180 w (the) 1916 3180 w (function writes an error message to the Standard Error file and then causes) 2064 3180 w (the) 720 3300 w (program) 871 3300 w (to) 1238 3300 w (terminate) 1345 3300 w (with) 1751 3300 w (an) 1958 3300 w (exit\(\)) 2081 3300 w (system) 2326 3300 w (call.) 2633 3300 w (The) 2856 3300 w (function) 3040 3300 w (doesn't) 3402 3300 w (do) 3726 3300 w (any) 3856 3300 w (explicit) 4030 3300 w (cleanup,) 4360 3300 w (because) 4725 3300 w (everything a library function sets up gets cleaned up by normal process termination.) 720 3420 w (In) 720 3576 w (many) 836 3576 w (cases,) 1091 3576 w (that) 1359 3576 w (simply) 1542 3576 w (isn't) 1848 3576 w (acceptable.) 2059 3576 w (If) 2562 3576 w (you're) 2661 3576 w (calling) 2954 3576 w (Netpbm) 3259 3576 w (functions) 3614 3576 w (from) 4019 3576 w (inside) 4246 3576 w (a) 4519 3576 w (server) 4597 3576 w (pro\255) 4874 3576 w (gram,) 720 3696 w (you'd) 987 3696 w (want) 1257 3696 w (the) 1488 3696 w (program) 1647 3696 w (to) 2022 3696 w (recognize) 2137 3696 w (that) 2561 3696 w (the) 2748 3696 w (immediate) 2907 3696 w (task) 3365 3696 w (failed,) 3562 3696 w (but) 3850 3696 w (keep) 4014 3696 w (running) 4238 3696 w (to) 4585 3696 w (do) 4699 3696 w (other) 4835 3696 w (work.) 720 3816 w (So) 720 3972 w (as) 852 3972 w (an) 961 3972 w (alternative,) 1081 3972 w (you) 1553 3972 w (can) 1729 3972 w (replace) 1893 3972 w (that) 2206 3972 w (program) 2383 3972 w (exit) 2748 3972 w (with) 2925 3972 w (a) 3130 3972 w (longjmp) 3201 3972 w (instead.) 3562 3972 w (A) 3922 3972 w (longjmp) 4021 3972 w (is) 4382 3972 w (a) 4476 3972 w (classic) 4547 3972 w (Unix) 4840 3972 w (exception) 720 4092 w (handling) 1134 4092 w (concept.) 1510 4092 w (See) 1896 4092 w (the) 2066 4092 w (documentation) 2214 4092 w (of the standard C library) 2834 4092 w 10 /Times-Bold f (setjmp\(\)) 3835 4092 w 10 /Times-Roman f (and) 4214 4092 w 10 /Times-Bold f (longjmp\(\)) 4383 4092 w 10 /Times-Roman f (func\255) 4830 4092 w (tions.) 720 4212 w (In) 720 4368 w (short,) 842 4368 w (you) 1106 4368 w (identify) 1295 4368 w (a) 1645 4368 w (point) 1728 4368 w (in) 1973 4368 w (your) 2090 4368 w (programs) 2312 4368 w (for) 2728 4368 w (execution) 2883 4368 w (to) 3310 4368 w (hyperjump) 3427 4368 w (to) 3899 4368 w (from) 4017 4368 w (whatever) 4251 4368 w (depths) 4656 4368 w (of) 4957 4368 w (whatever) 720 4488 w (functions) 1120 4488 w (it) 1527 4488 w (may) 1618 4488 w (be) 1825 4488 w (in) 1954 4488 w (at) 2067 4488 w (the) 2174 4488 w (time) 2331 4488 w (it) 2544 4488 w (detects) 2635 4488 w (an) 2946 4488 w (exception.) 3074 4488 w (That) 3546 4488 w (hyperjump) 3763 4488 w (is) 4230 4488 w (called) 4331 4488 w (a) 4603 4488 w (longjmp.) 4681 4488 w (The) 720 4608 w (longjmp) 901 4608 w (unwinds) 1261 4608 w (the) 1626 4608 w (stack) 1774 4608 w (and) 2005 4608 w (puts) 2175 4608 w (the) 2368 4608 w (program) 2516 4608 w (in) 2880 4608 w (the) 2984 4608 w (same) 3133 4608 w (state) 3365 4608 w (as) 3575 4608 w (if) 3685 4608 w (the) 3773 4608 w (subroutines) 3922 4608 w (had) 4410 4608 w (returned) 4581 4608 w (all) 4940 4608 w (the) 720 4728 w (way) 868 4728 w (up) 1060 4728 w (to) 1186 4728 w (the) 1290 4728 w (function) 1438 4728 w (that) 1797 4728 w (contains) 1973 4728 w (the) 2332 4728 w (jump point.) 2480 4728 w (A longjmp does not in itself undo things like mem\255) 2992 4728 w (ory allocations.) 720 4848 w (But when you have a Netpbm function do a longjmp, it also cleans up everything it started.) 1386 4848 w (To select this form of throwing an error, use the) 720 5004 w 10 /Times-Bold f (pm) 2659 5004 w 10 /S f (_) 2798 5004 w 10 /Times-Bold f (setjmpbuf\(\)) 2848 5004 w 10 /Times-Roman f (function.) 3373 5004 w (This) 3782 5004 w (alternative) 3986 5004 w (is) 4433 5004 w (not) 4526 5004 w (available) 4680 5004 w (before Netpbm 10.27 \(March 2005\).) 720 5124 w (Issuing) 720 5280 w (of) 1039 5280 w (the) 1152 5280 w (error) 1304 5280 w (message) 1527 5280 w (is) 1895 5280 w (a) 1992 5280 w (separate) 2066 5280 w (thing.) 2422 5280 w (Regardless) 2708 5280 w (of) 3177 5280 w (whether) 3291 5280 w (a) 3643 5280 w (library) 3718 5280 w (routine) 4015 5280 w (exits) 4329 5280 w (the) 4549 5280 w (program) 4702 5280 w (or executes a longjmp, it issues an error message first.) 720 5400 w (You) 720 5556 w (can) 919 5556 w (customize) 1084 5556 w (the) 1516 5556 w (error) 1665 5556 w (message) 1885 5556 w (behavior) 2251 5556 w (too.) 2628 5556 w (By) 2834 5556 w (default,) 2979 5556 w (a) 3309 5556 w (Netpbm) 3381 5556 w (function) 3731 5556 w (issues) 4092 5556 w (an) 4359 5556 w (error) 4481 5556 w (message) 4702 5556 w (by) 720 5676 w (writing) 853 5676 w (it) 1175 5676 w (to) 1264 5676 w (the) 1375 5676 w (Standard) 1530 5676 w (Error) 1918 5676 w (file,) 2161 5676 w (formatted) 2352 5676 w (into) 2773 5676 w (a) 2962 5676 w (single) 3039 5676 w (line) 3311 5676 w (with) 3494 5676 w (the) 3705 5676 w (program) 3860 5676 w (name) 4231 5676 w (prefixed.) 4480 5676 w (But) 4895 5676 w (you can register your own error message function to run instead with) 720 5796 w 10 /Times-Bold f (pm) 3498 5796 w 10 /S f (_) 3637 5796 w 10 /Times-Bold f (setErrorMsgFn\(\)) 3687 5796 w 10 /Times-Roman f (.) 4418 5796 w 10 /Times-Bold f (pm) 720 6036 w 10 /S f (_) 859 6036 w 10 /Times-Bold f (setjmpbuf\(\)) 909 6036 w 10 /Times-Roman f (pm) 720 6228 w 10 /S f (_) 848 6228 w 10 /Times-Roman f (setjmpbuf\(\)) 898 6228 w (sets) 1393 6228 w (up) 1572 6228 w (the) 1701 6228 w (process) 1852 6228 w (so) 2180 6228 w (that) 2298 6228 w (when) 2477 6228 w (future) 2722 6228 w (calls) 2989 6228 w (to) 3201 6228 w (the) 3309 6228 w (Netpbm) 3461 6228 w (programming) 3813 6228 w (library) 4387 6228 w (throw) 4683 6228 w (an) 4946 6228 w (error, they execute a longjmp instead of causing the process to exit as they would by default.) 720 6348 w (This) 720 6504 w (is) 927 6504 w (not) 1023 6504 w (analogous) 1180 6504 w (to) 1614 6504 w 10 /Times-Bold f (setjmp\(\)) 1721 6504 w 10 /Times-Roman f (.) 2075 6504 w (You) 2154 6504 w (do) 2355 6504 w (a) 2484 6504 w (setjmp\(\)) 2557 6504 w (first,) 2919 6504 w (then) 3134 6504 w (tell) 3335 6504 w (the) 3492 6504 w (Netpbm) 3643 6504 w (programming) 3994 6504 w (library) 4567 6504 w (with) 4862 6504 w 10 /Times-Bold f (pm) 720 6624 w 10 /S f (_) 859 6624 w 10 /Times-Bold f (setjmpbuf\(\)) 909 6624 w 10 /Times-Roman f (to use the result.) 1433 6624 w (Example:) 720 6780 w cleartomark showpage saveobj restore %%EndPage: 1 1 %%Page: 2 2 /saveobj save def mark 2 pagesetup 10 /Times-Roman f (\255 2 \255) 2797 480 w (#include ) 770 900 w (#include ) 770 1020 w (jmp) 770 1140 w 10 /S f (_) 926 1140 w 10 /Times-Roman f (buf jmpbuf;) 976 1140 w (int rc;) 770 1260 w (rc = setjmp\(jmpbuf\);) 770 1380 w (if \(rc == 0\) {) 770 1500 w (struct pam pam;) 820 1620 w (pm) 820 1740 w 10 /S f (_) 948 1740 w 10 /Times-Roman f (setjmpbuf\(&jmpbuf\);) 998 1740 w (pnm) 820 1980 w 10 /S f (_) 998 1980 w 10 /Times-Roman f (readpam\(stdin, &pam, PAM) 1048 1980 w 10 /S f (_) 2186 1980 w 10 /Times-Roman f (STRUCT) 2236 1980 w 10 /S f (_) 2620 1980 w 10 /Times-Roman f (SIZE\(tuple) 2670 1980 w 10 /S f (_) 3114 1980 w 10 /Times-Roman f (type\)\);) 3164 1980 w (printf\("pnm) 820 2100 w 10 /S f (_) 1294 2100 w 10 /Times-Roman f (readpam\(\) succeeded!0\);) 1344 2100 w (} else {) 770 2220 w (printf\("pnm) 820 2340 w 10 /S f (_) 1294 2340 w 10 /Times-Roman f (readpam\(\) failed.) 1344 2340 w (You should have seen ") 2080 2340 w ("messages to Standard Error telling you why.0\);) 995 2460 w (}) 770 2580 w (This) 720 2796 w (example) 948 2796 w (should) 1336 2796 w (look) 1653 2796 w (really) 1881 2796 w (strange) 2158 2796 w (to) 2496 2796 w (you) 2624 2796 w (if) 2824 2796 w (you) 2936 2796 w (haven't) 3137 2796 w (read) 3487 2796 w (the) 3709 2796 w (documentation) 3882 2796 w (of) 4527 2796 w 10 /Times-Bold f (setjmp\(\)) 4661 2796 w 10 /Times-Roman f (.) 5015 2796 w (Remember) 720 2916 w (that) 1186 2916 w (there) 1364 2916 w (is) 1591 2916 w (a) 1686 2916 w (hyperjump) 1758 2916 w (such) 2218 2916 w (that) 2428 2916 w (the) 2605 2916 w (program) 2754 2916 w (is) 3119 2916 w (executing) 3213 2916 w (the) 3628 2916 w 10 /Times-Bold f (pnm) 3777 2916 w 10 /S f (_) 3972 2916 w 10 /Times-Bold f (readpam\(\)) 4022 2916 w 10 /Times-Roman f (and) 4498 2916 w (then) 4669 2916 w (sud\255) 4868 2916 w (denly is returning a second time from the setjmp\(\)!) 720 3036 w (Even) 720 3192 w 10 /Times-Bold f (pm) 980 3192 w 10 /S f (_) 1119 3192 w 10 /Times-Bold f (error\(\)) 1169 3192 w 10 /Times-Roman f (works) 1516 3192 w (this) 1815 3192 w (way) 2015 3192 w (\255\255) 2236 3192 w (if) 2357 3192 w (you) 2473 3192 w (set) 2678 3192 w (up) 2844 3192 w (a) 3000 3192 w (longjmp) 3100 3192 w (with) 3490 3192 w 10 /Times-Bold f (pm) 3724 3192 w 10 /S f (_) 3863 3192 w 10 /Times-Bold f (setjmpbuf\(\)) 3913 3192 w 10 /Times-Roman f (and) 4468 3192 w (then) 4668 3192 w (call) 4896 3192 w 10 /Times-Bold f (pm) 720 3312 w 10 /S f (_) 859 3312 w 10 /Times-Bold f (error\(\)) 909 3312 w 10 /Times-Roman f (,) 1201 3312 w 10 /Times-Bold f (pm) 1251 3312 w 10 /S f (_) 1390 3312 w 10 /Times-Bold f (error\(\)) 1440 3312 w 10 /Times-Roman f (will, after issuing your error message, execute the longjmp.) 1757 3312 w 10 /Times-Bold f (pm) 720 3468 w 10 /S f (_) 859 3468 w 10 /Times-Bold f (setjmpbuf\(\)) 909 3468 w 10 /Times-Roman f (was) 1452 3468 w (new) 1651 3468 w (in) 1861 3468 w (Netpbm) 1983 3468 w (10.27) 2349 3468 w (\(March) 2618 3468 w (2005\).) 2955 3468 w (Before) 3282 3468 w (that,) 3598 3468 w (Netpbm) 3818 3468 w (programming) 4185 3468 w (library) 4774 3468 w (functions always throw an error by exiting the program.) 720 3588 w 10 /Times-Bold f (User Detected Errors) 720 3828 w 10 /Times-Roman f (The) 720 4020 w (Netpbm) 913 4020 w (programming) 1273 4020 w (library) 1855 4020 w (provides) 2159 4020 w (a) 2541 4020 w (function) 2623 4020 w (for) 2994 4020 w (you) 3148 4020 w (to) 3336 4020 w (throw) 3452 4020 w (an) 3724 4020 w (error) 3857 4020 w (explicitly:) 4089 4020 w 10 /Times-Bold f (pm) 4534 4020 w 10 /S f (_) 4673 4020 w 10 /Times-Bold f (error\(\)) 4723 4020 w 10 /Times-Roman f (.) 5015 4020 w 10 /Times-Bold f (pm) 720 4140 w 10 /S f (_) 859 4140 w 10 /Times-Bold f (error\(\)) 909 4140 w 10 /Times-Roman f (does) 1234 4140 w (nothing) 1450 4140 w (but) 1789 4140 w (throw) 1950 4140 w (an) 2216 4140 w (error,) 2343 4140 w (and) 2594 4140 w (does) 2771 4140 w (so) 2987 4140 w (the) 3108 4140 w (same) 3262 4140 w (way) 3499 4140 w (any) 3697 4140 w (Netpbm) 3873 4140 w (library) 4227 4140 w (function) 4525 4140 w (you) 4890 4140 w (call would.) 720 4260 w 10 /Times-Bold f (pm) 1214 4260 w 10 /S f (_) 1353 4260 w 10 /Times-Bold f (error\(\)) 1403 4260 w 10 /Times-Roman f (is more convenient than most standard C facilities for handling errors.) 1720 4260 w (If) 720 4416 w (you) 814 4416 w (don't) 992 4416 w (want) 1231 4416 w (to) 1453 4416 w (throw) 1559 4416 w (an) 1820 4416 w (error,) 1943 4416 w (but) 2190 4416 w (just) 2347 4416 w (want) 2521 4416 w (to) 2744 4416 w (issue) 2851 4416 w (an) 3080 4416 w (error) 3203 4416 w (message,) 3425 4416 w (use) 3817 4416 w 10 /Times-Bold f (pm) 3979 4416 w 10 /S f (_) 4118 4416 w 10 /Times-Bold f (errormsg\(\)) 4168 4416 w 10 /Times-Roman f (.) 4632 4416 w (It) 4711 4416 w (issues) 4801 4416 w (the) 720 4536 w (message) 871 4536 w (in) 1238 4536 w (the) 1345 4536 w (same) 1496 4536 w (way) 1730 4536 w (as) 1925 4536 w 10 /Times-Bold f (pm) 2036 4536 w 10 /S f (_) 2175 4536 w 10 /Times-Bold f (error\(\)) 2225 4536 w 10 /Times-Roman f (but) 2545 4536 w (returns) 2701 4536 w (normally) 3006 4536 w (instead) 3395 4536 w (of) 3706 4536 w (longjmping) 3817 4536 w (or) 4307 4536 w (exiting) 4418 4536 w (the) 4724 4536 w (pro\255) 4874 4536 w (gram.) 720 4656 w (Note) 720 4812 w (that) 978 4812 w 10 /Times-Bold f (libnetpbm) 1192 4812 w 10 /Times-Roman f (distinguishes) 1696 4812 w (between) 2283 4812 w (an) 2679 4812 w (error) 2837 4812 w (message) 3094 4812 w (and) 3496 4812 w (an) 3704 4812 w (informational) 3862 4812 w (message) 4471 4812 w (\(use) 4874 4812 w 10 /Times-Bold f (pm) 720 4932 w 10 /S f (_) 859 4932 w 10 /Times-Bold f (errormsg\(\)) 909 4932 w 10 /Times-Roman f (for) 1405 4932 w (the) 1553 4932 w (former;) 1707 4932 w 10 /Times-Bold f (pm) 2038 4932 w 10 /S f (_) 2177 4932 w 10 /Times-Bold f (message\(\)) 2227 4932 w 10 /Times-Roman f (for) 2674 4932 w (the) 2822 4932 w (latter\).) 2976 4932 w (The) 3296 4932 w (only) 3483 4932 w (practical) 3693 4932 w (difference) 4067 4932 w (is) 4501 4932 w (which) 4599 4932 w (user) 4874 4932 w (message) 720 5052 w (function) 1084 5052 w (it) 1443 5052 w (calls.) 1525 5052 w (So) 1784 5052 w (if) 1916 5052 w (you) 2003 5052 w (don't) 2179 5052 w (register) 2416 5052 w (any) 2741 5052 w (user) 2911 5052 w (message) 3103 5052 w (function,) 3467 5052 w (you) 3851 5052 w (won't) 4027 5052 w (see) 4287 5052 w (any) 4441 5052 w (difference,) 4612 5052 w (but a program is still more maintainable and easier to read when you use the appropriate one of these.) 720 5172 w 10 /Times-Bold f (pm) 720 5412 w 10 /S f (_) 859 5412 w 10 /Times-Bold f (error\(\)) 909 5412 w (Overview) 720 5688 w (void pm) 720 5880 w 10 /S f (_) 1068 5880 w 10 /Times-Bold f (error\( char *) 1118 5880 w 10 /Times-Italic f (fmt) 1696 5880 w 10 /Times-Bold f (,) 1824 5880 w (Example) 720 6120 w 10 /Times-Roman f (if \(argc\2551 < 3\)) 720 6336 w (pm) 820 6456 w 10 /S f (_) 948 6456 w 10 /Times-Roman f (error\("You must specify at least 3 arguments.) 998 6456 w (") 2866 6456 w ("You specified" only %d", argc\2551\);) 1045 6576 w 10 /Times-Bold f (pm) 720 6792 w 10 /S f (_) 859 6792 w 10 /Times-Bold f (error\(\)) 909 6792 w 10 /Times-Roman f (is) 1233 6792 w (a) 1332 6792 w 10 /Times-Bold f (printf\(\)) 1408 6792 w 10 /Times-Roman f (style) 1756 6792 w (routine) 1977 6792 w (that) 2292 6792 w (simply) 2474 6792 w (throws) 2779 6792 w (an) 3083 6792 w (error.) 3209 6792 w (It) 3484 6792 w (issues) 3577 6792 w (an) 3848 6792 w (error) 3974 6792 w (message) 4199 6792 w (exactly) 4569 6792 w (like) 4890 6792 w 10 /Times-Bold f (pm) 720 6912 w 10 /S f (_) 859 6912 w 10 /Times-Bold f (errormsg\(\)) 909 6912 w 10 /Times-Roman f (would in the process.) 1398 6912 w cleartomark showpage saveobj restore %%EndPage: 2 2 %%Page: 3 3 /saveobj save def mark 3 pagesetup 10 /Times-Roman f (\255 3 \255) 2797 480 w 10 /Times-Bold f (pm) 720 840 w 10 /S f (_) 859 840 w 10 /Times-Bold f (errormsg\(\)) 909 840 w (Overview) 720 1116 w (void pm) 720 1308 w 10 /S f (_) 1068 1308 w 10 /Times-Bold f (errormsg\( char *) 1118 1308 w 10 /Times-Italic f (fmt) 1868 1308 w 10 /Times-Bold f (,) 1996 1308 w (Example) 720 1548 w 10 /Times-Roman f (if \(rc = \2551\)) 720 1764 w (pm) 820 1884 w 10 /S f (_) 948 1884 w 10 /Times-Roman f (errormsg\("Could not open file.) 998 1884 w (errno=%d", errno\);) 2282 1884 w (return \2551;) 820 2004 w 10 /Times-Bold f (pm) 720 2220 w 10 /S f (_) 859 2220 w 10 /Times-Bold f (errormsg\(\)) 909 2220 w 10 /Times-Roman f (is) 1399 2220 w (a) 1492 2220 w 10 /Times-Bold f (printf\(\)) 1562 2220 w 10 /Times-Roman f (style) 1904 2220 w (routine) 2119 2220 w (that) 2428 2220 w (issues) 2604 2220 w (an) 2869 2220 w (error) 2989 2220 w (message.) 3208 2220 w (By) 3622 2220 w (default,) 3765 2220 w (it) 4094 2220 w (writes) 4177 2220 w (the) 4448 2220 w (message) 4597 2220 w (to) 4962 2220 w (Standard) 720 2340 w (Error,) 1111 2340 w (but) 1382 2340 w (you) 1546 2340 w (can) 1732 2340 w (register) 1906 2340 w (a) 2241 2340 w (user) 2321 2340 w (error) 2523 2340 w (message) 2752 2340 w (routine) 3126 2340 w (to) 3445 2340 w (be) 3559 2340 w (called) 3689 2340 w (instead,) 3963 2340 w (and) 4307 2340 w (that) 4486 2340 w (might) 4671 2340 w (do) 4940 2340 w (something such as write the message into a log file.) 720 2460 w (See) 2829 2460 w 10 /Times-Bold f (pm) 2998 2460 w 10 /S f (_) 3137 2460 w 10 /Times-Bold f (setusererrormsgfn) 3187 2460 w 10 /Times-Roman f (.) 3973 2460 w (There) 720 2616 w (is) 983 2616 w (very) 1081 2616 w (little) 1289 2616 w (advantage) 1505 2616 w (to) 1941 2616 w (using) 2051 2616 w (this) 2300 2616 w (over) 2477 2616 w (traditional) 2686 2616 w (C) 3129 2616 w (services,) 3228 2616 w (but) 3606 2616 w (it) 3766 2616 w (issues) 3854 2616 w (a) 4125 2616 w (message) 4201 2616 w (in) 4571 2616 w (the) 4681 2616 w (same) 4835 2616 w (way as) 720 2736 w 10 /Times-Bold f (libnetpbm) 1019 2736 w 10 /Times-Roman f (library functions do, so the common handling might be valuable.) 1484 2736 w (Note) 720 2892 w (that) 958 2892 w (the) 1152 2892 w (arguments) 1318 2892 w (specify) 1778 2892 w (the) 2110 2892 w (message) 2276 2892 w (text,) 2658 2892 w (not) 2877 2892 w (any) 3049 2892 w (formatting) 3237 2892 w (of) 3703 2892 w (it.) 3830 2892 w (Formatting) 3980 2892 w (is) 4469 2892 w (handled) 4580 2892 w (by) 4940 2892 w 10 /Times-Bold f (pm) 720 3012 w 10 /S f (_) 859 3012 w 10 /Times-Bold f (errormsg\(\)) 909 3012 w 10 /Times-Roman f (.) 1373 3012 w (So don't put any newlines or tabs in it.) 1448 3012 w 10 /Times-Bold f (pm) 720 3252 w 10 /S f (_) 859 3252 w 10 /Times-Bold f (setusererrormsgfn\(\)) 909 3252 w (Overview) 720 3528 w (void pm) 720 3720 w 10 /S f (_) 1068 3720 w 10 /Times-Bold f (setusererrormsgfn\(pm) 1118 3720 w 10 /S f (_) 2076 3720 w 10 /Times-Bold f (usererrormsgfn *) 2126 3720 w 10 /Times-Italic f (function) 2896 3720 w 10 /Times-Bold f (\);) 3224 3720 w (Example) 720 3960 w 10 /Times-Roman f (static pm) 820 4176 w 10 /S f (_) 1184 4176 w 10 /Times-Roman f (usererrormsgfn logfilewrite;) 1234 4176 w (static void) 820 4296 w (logfilewrite\(const char * const msg\) {) 820 4416 w (fprintf\(myerrorlog, "Netpbm error: %s", msg\);) 920 4536 w (}) 820 4656 w (pm) 820 4776 w 10 /S f (_) 948 4776 w 10 /Times-Roman f (setusererrormsgfn\(&logfilewrite\);) 998 4776 w (pm) 820 5016 w 10 /S f (_) 948 5016 w 10 /Times-Roman f (errormsg\("Message for the error log"\);) 998 5016 w 10 /Times-Bold f (pm) 720 5232 w 10 /S f (_) 859 5232 w 10 /Times-Bold f (setusererrormsg\(\)) 909 5232 w 10 /Times-Roman f (registers) 1709 5232 w (a) 2084 5232 w (handler) 2166 5232 w (for) 2503 5232 w (error) 2657 5232 w (messages,) 2888 5232 w (called) 3328 5232 w (a) 3604 5232 w (user) 3686 5232 w (error) 3890 5232 w (message) 4121 5232 w (routine.) 4497 5232 w (Any) 4868 5232 w (library) 720 5352 w (function) 1012 5352 w (that) 1371 5352 w (wants) 1547 5352 w (to) 1806 5352 w (issue) 1910 5352 w (an) 2136 5352 w (error) 2256 5352 w (message) 2475 5352 w (in) 2839 5352 w (the) 2943 5352 w (future) 3091 5352 w (will) 3355 5352 w (call) 3537 5352 w (that) 3707 5352 w (function) 3883 5352 w (with) 4242 5352 w (the) 4446 5352 w (message as) 4594 5352 w (an argument.) 720 5472 w (The) 720 5628 w (argument) 903 5628 w (the) 1308 5628 w (user) 1458 5628 w (error) 1652 5628 w (message) 1873 5628 w (routine) 2239 5628 w (gets) 2550 5628 w (is) 2740 5628 w (English) 2836 5628 w (text) 3171 5628 w (designed) 3350 5628 w (for) 3734 5628 w (human) 3879 5628 w (reading.) 4180 5628 w (It) 4558 5628 w (is) 4648 5628 w (just) 4744 5628 w (the) 4918 5628 w (text of the message; there is no attempt at formatting in it \(so you won't see any newline or tab characters\).) 720 5748 w (You can remove the user error message routine, so) 720 5904 w (that) 2771 5904 w (the) 2947 5904 w (library) 3095 5904 w (issues) 3387 5904 w (future) 3652 5904 w (error) 3916 5904 w (messages) 4135 5904 w (in) 4538 5904 w (its) 4642 5904 w (default) 4763 5904 w (way \(write to Standard Error\) by specifying a null pointer for) 720 6024 w 10 /Times-Italic f (function) 3190 6024 w 10 /Times-Roman f (.) 3518 6024 w (The) 720 6180 w (user) 910 6180 w (error) 1111 6180 w (message) 1339 6180 w (routine) 1712 6180 w (does) 2030 6180 w (not) 2248 6180 w (handle) 2412 6180 w (informational) 2714 6180 w (messages.) 3294 6180 w (It) 3757 6180 w (handles) 3854 6180 w (only) 4195 6180 w (error) 4409 6180 w (messages.) 4638 6180 w (See) 720 6300 w 10 /Times-Bold f (pm) 889 6300 w 10 /S f (_) 1028 6300 w 10 /Times-Bold f (setusermessagefn\(\)) 1078 6300 w 10 /Times-Roman f (.) 1881 6300 w 10 /Times-Bold f (Error Handling In Netpbm Programs) 720 6540 w 10 /Times-Roman f (Most) 720 6732 w (Netpbm) 958 6732 w (programs) 1312 6732 w (respond) 1721 6732 w (to) 2069 6732 w (encountering) 2179 6732 w (an) 2732 6732 w (error) 2858 6732 w (by) 3083 6732 w (issuing) 3215 6732 w (a) 3531 6732 w (message) 3607 6732 w (describing) 3977 6732 w (the) 4426 6732 w (error) 4581 6732 w (to) 4807 6732 w (the) 4918 6732 w (Standard Error file and then exiting with exit status 1.) 720 6852 w (Netpbm) 720 7008 w (programs) 1069 7008 w (generally) 1473 7008 w (do) 1871 7008 w (not) 1998 7008 w (follow) 2154 7008 w (the) 2443 7008 w (Unix) 2593 7008 w (convention) 2821 7008 w (of) 3293 7008 w (very) 3404 7008 w (terse) 3609 7008 w (error) 3825 7008 w (messages.) 4046 7008 w (Conventional) 4501 7008 w (Unix) 720 7128 w (programs) 948 7128 w (produce) 1353 7128 w (error) 1702 7128 w (messages) 1923 7128 w (as) 2328 7128 w (if) 2439 7128 w (they) 2528 7128 w (had) 2728 7128 w (to) 2900 7128 w (pay) 3006 7128 w (by) 3178 7128 w (the) 3306 7128 w (word.) 3456 7128 w (Netpbm) 3739 7128 w (programs) 4089 7128 w (tend) 4493 7128 w (to) 4692 7128 w (give) 4797 7128 w (a) 4996 7128 w (complete) 720 7248 w (description) 1113 7248 w (of) 1584 7248 w (the) 1694 7248 w (problem) 1844 7248 w (in) 2205 7248 w (human\255parseable) 2311 7248 w (English.) 3020 7248 w (These) 3404 7248 w (messages) 3670 7248 w (are) 4075 7248 w (often) 4224 7248 w (many) 4457 7248 w (terminal) 4707 7248 w cleartomark showpage saveobj restore %%EndPage: 3 3 %%Page: 4 4 /saveobj save def mark 4 pagesetup 10 /Times-Roman f (\255 4 \255) 2797 480 w (lines long.) 720 840 w cleartomark showpage saveobj restore %%EndPage: 4 4 %%Trailer done %%DocumentFonts: Times-Roman Times-Italic Times-Bold S %%Pages: 4