ó ‚®ÍQc @ssdZddlZddlZddlZdZddd„ƒYZedƒZedƒZedƒZd d d „ƒYZ d d!d „ƒYZ d d"d„ƒYZ dd„Z d„Z d„Zdd#d„ƒYZedkrodd$d„ƒYZdd%d„ƒYZeƒZeƒZedƒZedƒZedƒZeekoPeknoneekolekn s–eeks–eeks–eekrždGHnedkr²dGHndekrÆdGHneeƒeeƒkreekoõeknr)dGHq)n$eekoeknr)dGHneeƒeeƒkrXeekrldGHqlqoeekrodGHqondS(&sL cml.py -- types for communication between CML2 compiler and configurators. iÿÿÿÿNs2.3.0ttritcBseeZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( sA boolean or trit valueRcCs(t|tƒr|j}n||_dS(N(t isinstanceRtvalue(tselfR((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__init__ s cCs d|jS(Ntnmy(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__repr__scCs|jS(N(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt __nonzero__scCs|jS(N(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__hash__scCs |jdkS(Ni(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__long__scCst|tƒs^|dkrdSt|ƒt|ƒkr;dSt|ƒt|ƒkrWdSdSn.|j|j}|dkr~dS|t|ƒSdS(Niiÿÿÿÿi(RRtNonetidRtabs(Rtothertdiff((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__cmp__s  cCstt|j|jƒƒS(N(RtminR(RR ((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__and__(scCstt|j|jƒƒS(N(RtmaxR(RR ((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt__or__*scCs|S(N((R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyteval,s( t__name__t __module__t__doc__ttypeRRRRR RRRR(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRs        iiit ConfigSymbolcBsªeZdZdddddd„Zdd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d d „Z d „Zd„Zd„Zd„Zd„ZRS(s9Compiled information about a menu or configuration symbolcCså||_||_||_||_d|_d|_d|_d|_||_ g|_ g|_ g|_ d|_ d|_||_i|_g|_d|_d|_g|_d|_d|_d|_d|_d|_dS(Ni(tnametfiletlinenoRR trangetenumtdiscretethelptexttdefaultt ancestorst dependentst choicegrouptmenutdepthtpromptt propertiestwarningst visibilityt saveabilitytitemstvisitstsetcounttincludedt inspectedticed(RRRR!R'RR((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyR8s2                        icCs"|jd k röt|j|ƒ}|jdkr’t|tƒr[ttj|tkƒ}qÂt|ƒtdƒkrÂttj|dkƒ}qÂn0|jd krÂt|tƒrÂ|tk}qÂn|dkròt j j d| ||jfƒn|S|dkrt j j d| ƒnd Sd S( s9Value of symbol; passes back None if the symbol is unset.tboolitdecimalt hexadecimalis%...eval(%s)->%s (through default %s) is"...eval(%s)->None (default empty) N(sdecimals hexadecimal( R!R tevaluateRRRtyRtntsyststderrtwrite(Rtdebugtresult((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRXs$     cCsg|jr|jS|jr7|jjdkr7|j}n|jdkr`|j r`|jd}n|jS(s#Is there help for the given symbol?tchoicesi(R R%RR,(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pythelpss  cCs`|jr|j|jg}n |j}||kr8dSx!|D]}|j|ƒr?dSq?WdS(s)Test transitive completion of dependency.ii(R%R"t ancestor_of(Rtentryt searchpathtx((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyR?€s    cCs |jdkS(sIs this a derived symbol?N(R'R (R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt is_derivedscCs |jdkS(sIs this a logical symbol?R2R(sboolstrit(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt is_logical“scCs |jdkS(sIs this a numeric symbol?R3R4(sdecimals hexadecimal(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt is_numeric–scCs |jdkS(sAIs this a real symbol? (not a menu, not a choices, not a message)R2RR3R4tstring(sboolstritsdecimals hexadecimalsstring(R(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyt is_symbol™scCs|jj|ƒS(N(R(thas_key(Rtprop((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pythaspropžsicCs||j|R?RCRDRERGRJRLRMRPRRTRV(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyR6s             t RequirementcBs)eZdZd„Zd„Zd„ZRS(sDA requirement, together with a message to be shown if it's violated.cCs(||_||_||_||_dS(N(t predicatetmessageRtline(RtwffRYRRZ((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRÏs   cCst|jƒdd!S(Niiÿÿÿÿ(RRRX(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pytstrÕscCsžd}x4t|jƒD]#}|d|jt|ƒf7}qW|d }d|j|jf}|jr}||jd|dS|t|jƒd|dSdS(Nts%s=%s, iþÿÿÿs"%s", line %d: s (t)(t flatten_exprRXRR5RRZRYRR(Rtbindingstsymtleader((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRØs!  (RRRRR\R(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRWÍs  t CMLRulebasecBs)eZdZd„Zd„Zd„ZRS(s7A dictionary of ConfigSymbols and a set of constraints.cCsgt|_d|_i|_d|_d|_g|_d|_d|_d|_ d|_ g|_ dS(NR]( tversionR tstartt dictionarytprefixtbannert constraintsticonttrit_tiethelp_tiet expert_tietreduced(R((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRçs          cCs…d|jf}x2|jjƒD]!}|t|j|ƒd}q W|jrc|d|j }n|jr|d|j }n|S(NsStart menu = %s s sPrefix:sBanner:(ReRfROR\RgRh(RRStk((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRós  cCstx |jjƒD]}g|_qWxJ|jD]?}x6t|ƒD](}||jkr@|jj|ƒq@q@Wq-WdS(s/Assign constraints to their associated symbols.N(RftvaluesRiRnR_tappend(RR@t requirementtsymbol((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pytoptimize_constraint_accessüs  (RRRRRRt(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRcås cCsùd„}|dkr0tjjd| fƒnt|ƒtdƒkrF|ddkr–t|d|ƒ}|r‚t|d|ƒSt|d|ƒSqõ|ddkr¾|t|d|ƒ ƒS|dd krø|t|d|ƒpôt|d|ƒƒS|dd kr2|t|d|ƒo.t|d|ƒƒS|dd krn|t|d|ƒoit|d|ƒ ƒS|dd kr¨|t|d|ƒt|d|ƒkƒS|dd krâ|t|d|ƒt|d|ƒkƒS|ddkr|t|d|ƒt|d|ƒkƒS|ddkrV|t|d|ƒt|d|ƒkƒS|ddkr|t|d|ƒt|d|ƒkƒS|ddkrÊ|t|d|ƒt|d|ƒkƒS|ddkrüt|d|ƒt|d|ƒBS|ddkr.t|d|ƒt|d|ƒ@S|ddkrut|dƒ}t|dƒ}||krntS|Sqõ|ddkr³tt|d|ƒƒtt|d|ƒƒS|ddkrñtt|d|ƒƒtt|d|ƒƒS|ddkr/tt|d|ƒƒtt|d|ƒƒStd|df‚n¯t|t ƒs‚t|ƒtdƒtdƒtdƒfkr­|dkr©tjjd| fƒn|St|t ƒrÜ|j |ƒ}|rÕ|StSnt d|t|ƒf‚dS(s'Compute current value of an expression.cSs|r tStSdS(N(R6R7(RB((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyttritify sisevaluate(%s) begins... it?iitnottortandtimpliess==s!=s<=s>=tt|t&t$t+t-t*s"Unknown operation %s in expressionR]ls...evaluate(%s) returns itself s"unknown object %s %s in expressionN(( R8R9R:RR5R7tlongt SyntaxErrorRRRRt ValueError(texpR;RutguardtlefttrightR<((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyR5sp  **,******"" ...< cCsžt|ƒtdƒks0t|ƒtgƒkrdtt|ƒ}g}x|D]}||}qLW|St|tƒr–|jƒrŒt|jƒS|gSngSdS(s,Flatten an expression -- skips the operatorsN((RtmapR_RRRCR!(tnodetsublistst flattenedtitem((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyR_Ns0    cCsÄt|ƒtd ƒkr¥|ddkr:dt|dƒS|ddkrydt|dƒt|dƒt|dƒfSd t|dƒ|dt|dƒfSnt|tƒr»|jS| Sd S( s2Display an expression in canonicalized infix form.iRwsnot iRvs(%s ? %s : %s)iis (%s %s %s)N((RRRRRR(R†((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRR^s/,tBatoncBs2eZdZdd„Zdd„Zdd„ZRS(s#Ship progress indication to stdout.cCs—tjdƒrtj|_n'tjdƒr<tj|_n d|_|jrr|jj|dƒ|jjƒnd|_ ||_ t j ƒ|_ dS(Niis... i( tostisattyR8tstdouttstreamR9R R:tflushtcounttendmsgttime(RR'R–((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRns    cCsx|jdkrdS|r,|jj|ƒn+|jjd|jdƒ|jjdƒ|jd|_|jjƒdS(Ns-/|\isi(R“R R:R•R”(Rtch((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyttwirl}s cCsO|dkr|j}n|jrK|jjdtjƒ|j|fƒndS(Ns...(%2.2f sec) %s. (R R–R“R:R—(Rtmsg((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pytend‰s    *N(RRRR RR™R›(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRls  t__main__tAcBseZRS((RR(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyR’stBcBseZRS((RR(((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pyRž•sstrit compare faileds,a trit is less than None? Comparison faileds/None is greater than a trit? Comparison failedsa/b comparison faileds&a/t0 comparison failed (id(a) greater)sa/t0 comparison failed((((((((RR8RR—RdRR6tmR7RRWRcR5R_RRRRRRžtatbtt0tt1tt2R R (((s:/home/bertrand/FreeVMS/FreeVMS/sources/contrib/cml2/cml.pytsJ$(   —" G  $      ]