; TeX output 1997.01.23:0050soDtGGcmr17The7tGGcmss17somedefstosolkitpacqkage@pXQ cmr12AlanJe rey{v0.03& INff cmbx12OverviewIK`y cmr10Thisz@isanexample`programmerstoGolkit'packqage,zforusebypackqagewriters.It Iallows#packqagewriterstoprovideoptionswhichswitchde nitionsonando .a@F*orIexample,aqpackqagecaseyouhavetodeclaretheoptionsbyhand.HF*orexample,CifthecommandI\barUUneedsthecommand\foo,youcouldsay:[X\DeclareOption{bar}{\UseDefinition{bar}\UseDefinition{foo}} IF*or˛alongerexampleoftheuseofthesomedefspackqage,-loGokattherawfontsIpackqage.!čIImplementationITheUUdriverforthedoGcumentationyou'renowreading.LsٓRcmr71S cmsy9h!ow cmss9driveroiLs2S\documentclass{ltxdoc}Ls3S\begin{document}Ls4S\DocInput{somedefs.dtx}Ls5S\end{document}Ls6Sh5" cmmi9=driveroiIThisUUisaL5ffA͉TU>'ExX2 b> cmmi10"+Tpackqage.Ls7Shpack9age#g iLs8S\NeedsTeXFormat{LaTeX2e}Ls9S\ProvidesPackage{somedefs}[1994/06/01Toolkitforoptionaldefinitions]H\UseSomeDefinitions 9\UseAllDefinitions 6\UseDefinition H\ProvidesDefinition Ʋ\@providesdefinition \@provides@definition ҙ\@unprovided@definitionIThe packqageworksbyhaving\UseDefinition{hname[i H}de ne\nametobGe I\@unprovided@definition. lIfT\UseSomeDefinitionshasbGeencalled,thenI\ProvidesDefinitionloGokstoseeif\nameis\@unprovided@definition.gIfI\UseAllDefinitionsXShasbGeencalled,Ythen\ProvidesDefinitiondoesnothing.IIfQneitherhasbGeencalled,then\ProvidesDefinitionproducesanerrormessage.I10S\def\UseSomeDefinitions{%I11ap\let\ProvidesDefinition\@providesdefinitionI12S}I13S\def\UseAllDefinitions{%I14ap\let\ProvidesDefinition\@firstofoneI15S}I16S\def\UseDefinition#1{%I17ap\expandafter\let\csname#1\endcsname\@unprovided@definitionI18S}I19S\def\ProvidesDefinition#1{%I20ap\PackageError{somedefs}%I21kJ{No\noexpand\UseSomeDefinitionsor\string\UseAllDefinitions}%I22kJ{Thepackagewhichusedthe`somedefs'packagehasanerror.}%I23S}I24S\def\@providesdefinition#1{\@provides@definition#1\relaxI25ap\@provides@definition}I26S\def\@provides@definition#1#2#3\@provides@definition{%I27ap\ifx#2\@unprovided@definitionI28p2#1#2#3%I29ap\fiI30S}I31S\def\@unprovided@definition{%2 soI32ap\PackageError{somedefs}% I33kJ{Package`somedefs'error:thiscommandwasneverdefined}%I34kJ{Youhaverequestedacommandwhichdoesnotexist.}%I35S}I36S\@onlypreamble\UseSomeDefinitionsI37S\@onlypreamble\UseAllDefinitionsI38S\@onlypreamble\UseDefinitionI39S\@onlypreamble\ProvidesDefinitionI40S\@onlypreamble\@providesdefinitionI41S\@onlypreamble\@provides@definitionIThat'sUUit!I42Sh=pack9age#g i3;!ow cmss9 cmsy95" cmmi9': cmti10ߤN cmtt9 cmmi10K`y cmr10ٓRcmr7