ccomp.lsp 135 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161
  1. (global '(!*fastvector !*unsafecar))
  2. (flag '(fastvector unsafecar) 'switch)
  3. (fluid '(c_file l_file o_file l_contents file_name))
  4. (dm c!:printf (u) (list 'c!:printf1 (cadr u) (cons 'list (cddr u))))
  5. (de c!:printf1 (fmt args)
  6. (prog (a c)
  7. (setq fmt (explode2 fmt))
  8. (prog nil
  9. !G50 (cond ((not fmt) (return nil)))
  10. (progn
  11. (setq c (car fmt))
  12. (setq fmt (cdr fmt))
  13. (cond
  14. ((and
  15. (equal c '!\)
  16. (or (equal (car fmt) 'n) (equal (car fmt) '!N)))
  17. (progn (terpri) (setq fmt (cdr fmt))))
  18. ((and
  19. (equal c '!\)
  20. (or (equal (car fmt) 'q) (equal (car fmt) '!Q)))
  21. (progn (princ '!") (setq fmt (cdr fmt))))
  22. ((equal c '!%)
  23. (progn
  24. (setq c (car fmt))
  25. (cond
  26. ((null args) (setq a 'missing_arg))
  27. (t (setq a (car args))))
  28. (cond
  29. ((or (equal c 'v) (equal c '!V))
  30. (cond
  31. ((flagp a 'c!:live_across_call)
  32. (progn
  33. (princ "stack[")
  34. (princ (minus (get a 'c!:location)))
  35. (princ "]")))
  36. (t (princ a))))
  37. ((or (equal c 'a) (equal c '!A)) (prin a))
  38. ((or (equal c 't) (equal c '!T)) (ttab a))
  39. (t (princ a)))
  40. (cond (args (setq args (cdr args))))
  41. (setq fmt (cdr fmt))))
  42. (t (princ c))))
  43. (go !G50))))
  44. (de c!:cspecform (x env) (error 0 (list "special form" x)))
  45. (progn
  46. (put 'and 'c!:code (function c!:cspecform))
  47. (put 'catch 'c!:code (function c!:cspecform))
  48. (put 'compiler!-let 'c!:code (function c!:cspecform))
  49. (put 'cond 'c!:code (function c!:cspecform))
  50. (put 'declare 'c!:code (function c!:cspecform))
  51. (put 'de 'c!:code (function c!:cspecform))
  52. (put 'eval!-when 'c!:code (function c!:cspecform))
  53. (put 'flet 'c!:code (function c!:cspecform))
  54. (put 'function 'c!:code (function c!:cspecform))
  55. (put 'go 'c!:code (function c!:cspecform))
  56. (put 'if 'c!:code (function c!:cspecform))
  57. (put 'labels 'c!:code (function c!:cspecform))
  58. (put '!~let 'c!:code (function c!:cspecform))
  59. (put 'let!* 'c!:code (function c!:cspecform))
  60. (put 'list 'c!:code (function c!:cspecform))
  61. (put 'list!* 'c!:code (function c!:cspecform))
  62. (put 'macrolet 'c!:code (function c!:cspecform))
  63. (put 'multiple!-value!-call 'c!:code (function c!:cspecform))
  64. (put 'multiple!-value!-prog1 'c!:code (function c!:cspecform))
  65. (put 'or 'c!:code (function c!:cspecform))
  66. (put 'prog 'c!:code (function c!:cspecform))
  67. (put 'prog!* 'c!:code (function c!:cspecform))
  68. (put 'prog1 'c!:code (function c!:cspecform))
  69. (put 'prog2 'c!:code (function c!:cspecform))
  70. (put 'progn 'c!:code (function c!:cspecform))
  71. (put 'progv 'c!:code (function c!:cspecform))
  72. (put 'quote 'c!:code (function c!:cspecform))
  73. (put 'return 'c!:code (function c!:cspecform))
  74. (put 'return!-from 'c!:code (function c!:cspecform))
  75. (put 'setq 'c!:code (function c!:cspecform))
  76. (put 'tagbody 'c!:code (function c!:cspecform))
  77. (put 'the 'c!:code (function c!:cspecform))
  78. (put 'throw 'c!:code (function c!:cspecform))
  79. (put 'unless 'c!:code (function c!:cspecform))
  80. (put 'unwind!-protect 'c!:code (function c!:cspecform))
  81. (put 'when 'c!:code (function c!:cspecform)))
  82. (fluid
  83. '(current_procedure current_args current_block current_contents all_blocks
  84. registers stacklocs))
  85. (fluid '(available used))
  86. (setq available (setq used nil))
  87. (de c!:reset_gensyms nil
  88. (progn
  89. (remflag used 'c!:live_across_call)
  90. (remflag used 'c!:visited)
  91. (prog nil
  92. !G51 (cond ((not used) (return nil)))
  93. (progn
  94. (remprop (car used) 'c!:contents)
  95. (remprop (car used) 'c!:why)
  96. (remprop (car used) 'c!:where_to)
  97. (remprop (car used) 'c!:count)
  98. (remprop (car used) 'c!:live)
  99. (remprop (car used) 'c!:clash)
  100. (remprop (car used) 'c!:chosen)
  101. (remprop (car used) 'c!:location)
  102. (cond
  103. ((plist (car used))
  104. (prog (o)
  105. (setq o (wrs nil))
  106. (princ "+++++ ")
  107. (prin (car used))
  108. (princ " ")
  109. (prin (plist (car used)))
  110. (terpri)
  111. (wrs o))))
  112. (setq available (cons (car used) available))
  113. (setq used (cdr used)))
  114. (go !G51))))
  115. (de c!:my_gensym nil
  116. (prog (w)
  117. (cond
  118. (available
  119. (progn (setq w (car available)) (setq available (cdr available))))
  120. (t (setq w (gensym1 "v"))))
  121. (setq used (cons w used))
  122. (cond
  123. ((plist w)
  124. (progn (princ "????? ") (prin w) (princ " => ") (prin (plist w))
  125. (terpri))))
  126. (return w)))
  127. (de c!:newreg nil
  128. (prog (r)
  129. (setq r (c!:my_gensym))
  130. (setq registers (cons r registers))
  131. (return r)))
  132. (de c!:startblock (s)
  133. (progn (setq current_block s) (setq current_contents nil)))
  134. (de c!:outop (a b c d)
  135. (cond
  136. (current_block
  137. (setq current_contents (cons (list a b c d) current_contents)))) )
  138. (de c!:endblock (why where_to)
  139. (cond
  140. (current_block
  141. (progn
  142. (put current_block 'c!:contents current_contents)
  143. (put current_block 'c!:why why)
  144. (put current_block 'c!:where_to where_to)
  145. (setq all_blocks (cons current_block all_blocks))
  146. (setq current_contents nil)
  147. (setq current_block nil)))) )
  148. (de c!:cval_inner (x env)
  149. (prog (helper)
  150. (setq x (s!:improve x))
  151. (cond
  152. ((atom x) (return (c!:catom x env)))
  153. ((eqcar (car x) 'lambda)
  154. (return
  155. (c!:clambda (cadar x) (cons 'progn (cddar x)) (cdr x) env)))
  156. ((setq helper (get (car x) 'c!:code))
  157. (return (funcall helper x env)))
  158. ((and
  159. (setq helper (get (car x) 'c!:compile_macro))
  160. (setq helper (funcall helper x)))
  161. (return (c!:cval helper env)))
  162. ((and (idp (car x)) (setq helper (macro!-function (car x))))
  163. (return (c!:cval (funcall helper x) env)))
  164. (t (return (c!:ccall (car x) (cdr x) env)))) ))
  165. (de c!:cval (x env)
  166. (prog (r)
  167. (setq r (c!:cval_inner x env))
  168. (cond
  169. ((and r (not (member!*!* r registers)))
  170. (error 0 (list r "not a register" x))))
  171. (return r)))
  172. (de c!:clambda (bvl body args env)
  173. (prog (w fluids env1)
  174. (setq env1 (car env))
  175. (setq w
  176. (prog (a !G52 endptr)
  177. (setq a args)
  178. (cond ((null a) (return nil)))
  179. (setq !G52
  180. (setq endptr
  181. (cons ((lambda (a) (c!:cval a env)) (car a)) nil)))
  182. looplabel
  183. (setq a (cdr a))
  184. (cond ((null a) (return !G52)))
  185. (rplacd endptr (cons ((lambda (a) (c!:cval a env)) (car a)) nil))
  186. (setq endptr (cdr endptr))
  187. (go looplabel)))
  188. (prog (v)
  189. (setq v bvl)
  190. lab (cond ((null v) (return nil)))
  191. ((lambda (v)
  192. (progn
  193. (cond
  194. ((globalp v)
  195. (prog (oo)
  196. (setq oo (wrs nil))
  197. (princ "+++++ ")
  198. (prin v)
  199. (princ " converted from GLOBAL to FLUID")
  200. (terpri)
  201. (wrs oo)
  202. (unglobal (list v))
  203. (fluid (list v)))) )
  204. (cond
  205. ((fluidp v)
  206. (progn
  207. (setq fluids (cons (cons v (c!:newreg)) fluids))
  208. (flag (list (cdar fluids)) 'c!:live_across_call)
  209. (setq env1
  210. (cons (cons 'c!:dummy!:name (cdar fluids)) env1))
  211. (c!:outop
  212. 'ldrglob
  213. (cdar fluids)
  214. v
  215. (c!:find_literal v))
  216. (c!:outop 'strglob (car w) v (c!:find_literal v))))
  217. (t (progn
  218. (setq env1 (cons (cons v (c!:newreg)) env1))
  219. (c!:outop 'movr (cdar env1) nil (car w)))) )
  220. (setq w (cdr w))))
  221. (car v))
  222. (setq v (cdr v))
  223. (go lab))
  224. (cond (fluids (c!:outop 'fluidbind nil nil fluids)))
  225. (setq env (cons env1 (append fluids (cdr env))))
  226. (setq w (c!:cval body env))
  227. (prog (v)
  228. (setq v fluids)
  229. lab (cond ((null v) (return nil)))
  230. ((lambda (v)
  231. (c!:outop 'strglob (cdr v) (car v) (c!:find_literal (car v))))
  232. (car v))
  233. (setq v (cdr v))
  234. (go lab))
  235. (return w)))
  236. (de c!:locally_bound (x env) (atsoc x (car env)))
  237. (flag '(nil t) 'c!:constant)
  238. (fluid '(literal_vector))
  239. (de c!:find_literal (x)
  240. (prog (n w)
  241. (setq w literal_vector)
  242. (setq n 0)
  243. (prog nil
  244. !G53 (cond ((not (and w (not (equal (car w) x)))) (return nil)))
  245. (progn (setq n (plus n 1)) (setq w (cdr w)))
  246. (go !G53))
  247. (cond
  248. ((null w) (setq literal_vector (append literal_vector (list x)))) )
  249. (return n)))
  250. (de c!:catom (x env)
  251. (prog (v w)
  252. (setq v (c!:newreg))
  253. (cond
  254. ((and (idp x) (setq w (c!:locally_bound x env)))
  255. (c!:outop 'movr v nil (cdr w)))
  256. ((or (null x) (equal x 't) (c!:small_number x))
  257. (c!:outop 'movk1 v nil x))
  258. ((or (not (idp x)) (flagp x 'c!:constant))
  259. (c!:outop 'movk v x (c!:find_literal x)))
  260. (t (c!:outop 'ldrglob v x (c!:find_literal x))))
  261. (return v)))
  262. (de c!:cjumpif (x env d1 d2)
  263. (prog (helper r)
  264. (setq x (s!:improve x))
  265. (cond
  266. ((and
  267. (atom x)
  268. (or
  269. (not (idp x))
  270. (and (flagp x 'c!:constant) (not (c!:locally_bound x env)))) )
  271. (c!:endblock 'goto (list (cond (x d1) (t d2)))) )
  272. ((and (not (atom x)) (setq helper (get (car x) 'c!:ctest)))
  273. (return (funcall helper x env d1 d2)))
  274. (t (progn
  275. (setq r (c!:cval x env))
  276. (c!:endblock (list 'ifnull r) (list d2 d1)))) )))
  277. (fluid '(current))
  278. (de c!:ccall (fn args env) (c!:ccall1 fn args env))
  279. (fluid '(visited))
  280. (de c!:has_calls (a b)
  281. (prog (visited)
  282. (return (c!:has_calls_1 a b))))
  283. (de c!:has_calls_1 (a b)
  284. (cond
  285. ((or (equal a b) (not (atom a)) (memq a visited)) nil)
  286. (t (prog (has_call)
  287. (setq visited (cons a visited))
  288. (prog (z)
  289. (setq z (get a 'c!:contents))
  290. lab (cond ((null z) (return nil)))
  291. ((lambda (z) (cond ((eqcar z 'call) (setq has_call t))))
  292. (car z))
  293. (setq z (cdr z))
  294. (go lab))
  295. (cond
  296. (has_call
  297. (return
  298. (prog (visited)
  299. (return (c!:can_reach a b)))) ))
  300. (prog (d)
  301. (setq d (get a 'c!:where_to))
  302. lab (cond ((null d) (return nil)))
  303. ((lambda (d) (cond ((c!:has_calls_1 d b) (setq has_call t))))
  304. (car d))
  305. (setq d (cdr d))
  306. (go lab))
  307. (return has_call)))) )
  308. (de c!:can_reach (a b)
  309. (cond
  310. ((equal a b) t)
  311. ((or (not (atom a)) (memq a visited)) nil)
  312. (t (progn
  313. (setq visited (cons a visited))
  314. (c!:any_can_reach (get a 'c!:where_to) b)))) )
  315. (de c!:any_can_reach (l b)
  316. (cond
  317. ((null l) nil)
  318. ((c!:can_reach (car l) b) t)
  319. (t (c!:any_can_reach (cdr l) b))))
  320. (de c!:pareval (args env)
  321. (prog (tasks tasks1 merge split r)
  322. (setq tasks
  323. (prog (a !G54 endptr)
  324. (setq a args)
  325. (cond ((null a) (return nil)))
  326. (setq !G54
  327. (setq endptr
  328. (cons
  329. ((lambda (a) (cons (c!:my_gensym) (c!:my_gensym)))
  330. (car a))
  331. nil)))
  332. looplabel
  333. (setq a (cdr a))
  334. (cond ((null a) (return !G54)))
  335. (rplacd
  336. endptr
  337. (cons
  338. ((lambda (a) (cons (c!:my_gensym) (c!:my_gensym))) (car a))
  339. nil))
  340. (setq endptr (cdr endptr))
  341. (go looplabel)))
  342. (setq split (c!:my_gensym))
  343. (c!:endblock 'goto (list split))
  344. (prog (a)
  345. (setq a args)
  346. lab (cond ((null a) (return nil)))
  347. ((lambda (a)
  348. (prog (s)
  349. (setq s (car tasks))
  350. (setq tasks (cdr tasks))
  351. (c!:startblock (car s))
  352. (setq r (cons (c!:cval a env) r))
  353. (c!:endblock 'goto (list (cdr s)))
  354. (cond
  355. ((c!:has_calls (car s) (cdr s))
  356. (setq tasks1 (cons s tasks1)))
  357. (t (setq merge (cons s merge)))) ))
  358. (car a))
  359. (setq a (cdr a))
  360. (go lab))
  361. (prog (z)
  362. (setq z tasks1)
  363. lab (cond ((null z) (return nil)))
  364. ((lambda (z) (setq merge (cons z merge))) (car z))
  365. (setq z (cdr z))
  366. (go lab))
  367. (prog (v)
  368. (setq v merge)
  369. lab (cond ((null v) (return nil)))
  370. ((lambda (v)
  371. (progn
  372. (c!:startblock split)
  373. (c!:endblock 'goto (list (car v)))
  374. (setq split (cdr v))))
  375. (car v))
  376. (setq v (cdr v))
  377. (go lab))
  378. (c!:startblock split)
  379. (return (reversip r))))
  380. (de c!:ccall1 (fn args env)
  381. (prog (tasks merge r val)
  382. (setq fn (list fn (cdr env)))
  383. (setq val (c!:newreg))
  384. (cond
  385. ((null args) (c!:outop 'call val nil fn))
  386. ((null (cdr args))
  387. (c!:outop 'call val (list (c!:cval (car args) env)) fn))
  388. (t (progn (setq r (c!:pareval args env)) (c!:outop 'call val r fn))))
  389. (c!:outop 'reloadenv 'env nil nil)
  390. (return val)))
  391. (fluid '(restart_label reloadenv does_call current_c_name))
  392. (fluid '(proglabs blockstack))
  393. (de c!:cfndef (current_procedure current_c_name argsbody)
  394. (prog (env n w current_args current_block restart_label current_contents
  395. all_blocks entrypoint exitpoint args1 registers stacklocs
  396. literal_vector reloadenv does_call blockstack proglabs checksum args
  397. body)
  398. (setq checksum (md60 argsbody))
  399. (setq args (car argsbody))
  400. (setq body (cdr argsbody))
  401. (cond
  402. ((atom body) (setq body nil))
  403. ((atom (cdr body)) (setq body (car body)))
  404. (t (setq body (cons 'progn body))))
  405. (c!:reset_gensyms)
  406. (wrs c_file)
  407. (linelength 200)
  408. (c!:printf1 "\n\n/* Code for %a */\n\n" (list current_procedure))
  409. (c!:find_literal current_procedure)
  410. (setq current_args args)
  411. (prog (v)
  412. (setq v args)
  413. lab (cond ((null v) (return nil)))
  414. ((lambda (v)
  415. (cond
  416. ((or (equal v '!&optional) (equal v '!&rest))
  417. (error
  418. 0
  419. "&optional and &rest not supported by this compiler (yet)"))
  420. ((globalp v)
  421. (prog (oo)
  422. (setq oo (wrs nil))
  423. (princ "+++++ ")
  424. (prin v)
  425. (princ " converted from GLOBAL to FLUID")
  426. (terpri)
  427. (wrs oo)
  428. (unglobal (list v))
  429. (fluid (list v))
  430. (setq n (cons (cons v (c!:my_gensym)) n))))
  431. ((fluidp v) (setq n (cons (cons v (c!:my_gensym)) n)))) )
  432. (car v))
  433. (setq v (cdr v))
  434. (go lab))
  435. (setq restart_label (c!:my_gensym))
  436. (setq body (list 'c!:private_tagbody restart_label body))
  437. (cond
  438. (n
  439. (progn
  440. (setq body (list (list 'return body)))
  441. (setq args (subla n args))
  442. (prog (v)
  443. (setq v n)
  444. lab (cond ((null v) (return nil)))
  445. ((lambda (v)
  446. (setq body (cons (list 'setq (car v) (cdr v)) body)))
  447. (car v))
  448. (setq v (cdr v))
  449. (go lab))
  450. (setq body
  451. (cons
  452. 'prog
  453. (cons
  454. (prog (v !G55 endptr)
  455. (setq v (reverse n))
  456. (cond ((null v) (return nil)))
  457. (setq !G55
  458. (setq endptr
  459. (cons ((lambda (v) (car v)) (car v)) nil)))
  460. looplabel
  461. (setq v (cdr v))
  462. (cond ((null v) (return !G55)))
  463. (rplacd
  464. endptr
  465. (cons ((lambda (v) (car v)) (car v)) nil))
  466. (setq endptr (cdr endptr))
  467. (go looplabel))
  468. body)))) ))
  469. (c!:printf1 "static Lisp_Object " (list))
  470. (cond
  471. ((or (null args) (geq (length args) 3))
  472. (c!:printf1 "MS_CDECL " (list))))
  473. (c!:printf1 "%s(Lisp_Object env" (list current_c_name))
  474. (cond
  475. ((or (null args) (geq (length args) 3))
  476. (c!:printf1 ", int nargs" (list))))
  477. (setq n t)
  478. (setq env nil)
  479. (prog (x)
  480. (setq x args)
  481. lab (cond ((null x) (return nil)))
  482. ((lambda (x)
  483. (prog (aa)
  484. (c!:printf1 "," (list))
  485. (cond
  486. (n
  487. (progn
  488. (c!:printf1 "\n " (list))
  489. (setq n nil)))
  490. (t (setq n t)))
  491. (setq aa (c!:my_gensym))
  492. (setq env (cons (cons x aa) env))
  493. (setq registers (cons aa registers))
  494. (setq args1 (cons aa args1))
  495. (c!:printf1 " Lisp_Object %s" (list aa))))
  496. (car x))
  497. (setq x (cdr x))
  498. (go lab))
  499. (cond
  500. ((or (null args) (geq (length args) 3)) (c!:printf1 ", ..." (list))))
  501. (c!:printf1 ")\n{\n" (list))
  502. (c!:startblock (setq entrypoint (c!:my_gensym)))
  503. (setq exitpoint current_block)
  504. (c!:endblock 'goto (list (list (c!:cval body (cons env nil)))) )
  505. (c!:optimise_flowgraph
  506. entrypoint
  507. all_blocks
  508. env
  509. (cons (length args) current_procedure)
  510. args1)
  511. (c!:printf1 "}\n\n" (list))
  512. (wrs o_file)
  513. (setq l_contents
  514. (cons
  515. (cons current_procedure (cons literal_vector checksum))
  516. l_contents))
  517. (return nil)))
  518. (flag
  519. '(rds deflist flag fluid global remprop remflag unfluid unglobal dm
  520. carcheck c!-end)
  521. 'eval)
  522. (flag '(rds) 'ignore)
  523. (fluid '(!*backtrace))
  524. (de c!:ccompilesupervisor nil
  525. (prog (u w)
  526. top (setq u (errorset '(read) t !*backtrace))
  527. (cond ((atom u) (return nil)))
  528. (setq u (car u))
  529. (cond ((equal u !$eof!$) (return nil)))
  530. (cond
  531. ((atom u) (go top))
  532. ((eqcar u 'c!-end) (return (apply 'c!-end nil)))
  533. ((eqcar u 'rdf)
  534. (progn
  535. (setq w (open (setq u (eval (cadr u))) 'input))
  536. (cond
  537. (w
  538. (progn
  539. (terpri)
  540. (princ "Reading file ")
  541. (print u)
  542. (setq w (rds w))
  543. (c!:ccompilesupervisor)
  544. (princ "End of file ")
  545. (print u)
  546. (close (rds w))))
  547. (t (progn (princ "Failed to open file ") (print u)))) ))
  548. (t (c!:ccmpout1 u)))
  549. (go top)))
  550. (global '(c!:char_mappings))
  551. (setq c!:char_mappings
  552. '((! . !A) (!! . !B) (!# . !C) (!$ . !D) (!% . !E) (!^ . !F) (!& . !G)
  553. (!* . !H) (!( . !I) (!) . !J) (!- . !K) (!+ . !L) (!= . !M) (!\ . !N)
  554. (!| . !O) (!, . !P) (!. . !Q) (!< . !R) (!> . !S) (!: . !T) (!; . !U)
  555. (!/ . !V) (!? . !W) (!~ . !X) (!` . !Y)))
  556. (de c!:inv_name (n)
  557. (prog (r w)
  558. (setq r '(!_ !C !C !"))
  559. (prog (c)
  560. (setq c (explode2 n))
  561. lab (cond ((null c) (return nil)))
  562. ((lambda (c)
  563. (progn
  564. (cond
  565. ((equal c '!_) (setq r (cons '!_ r)))
  566. ((or (liter c) (digit c)) (setq r (cons c r)))
  567. ((setq w (atsoc c c!:char_mappings))
  568. (setq r (cons (cdr w) r)))
  569. (t (setq r (cons '!Z r)))) ))
  570. (car c))
  571. (setq c (cdr c))
  572. (go lab))
  573. (setq r (cons '!" r))
  574. (return (compress (reverse r)))) )
  575. (fluid '(defnames pending_functions))
  576. (de c!:ccmpout1 (u)
  577. (prog (pending_functions)
  578. (setq pending_functions (list u))
  579. (prog nil
  580. !G56 (cond ((not pending_functions) (return nil)))
  581. (progn
  582. (setq u (car pending_functions))
  583. (setq pending_functions (cdr pending_functions))
  584. (c!:ccmpout1a u))
  585. (go !G56))))
  586. (de c!:ccmpout1a (u)
  587. (prog (w)
  588. (cond
  589. ((atom u) (return nil))
  590. ((eqcar u 'progn)
  591. (progn
  592. (prog (v)
  593. (setq v (cdr u))
  594. lab (cond ((null v) (return nil)))
  595. ((lambda (v) (c!:ccmpout1a v)) (car v))
  596. (setq v (cdr v))
  597. (go lab))
  598. (return nil)))
  599. ((eqcar u 'c!-end) nil)
  600. ((or
  601. (flagp (car u) 'eval)
  602. (and
  603. (equal (car u) 'setq)
  604. (not (atom (caddr u)))
  605. (flagp (caaddr u) 'eval)))
  606. (errorset u t !*backtrace)))
  607. (cond
  608. ((eqcar u 'rdf)
  609. (prog nil
  610. (setq w (open (setq u (eval (cadr u))) 'input))
  611. (cond
  612. (w
  613. (progn
  614. (princ "Reading file ")
  615. (print u)
  616. (setq w (rds w))
  617. (c!:ccompilesupervisor)
  618. (princ "End of file ")
  619. (print u)
  620. (close (rds w))))
  621. (t (progn (princ "Failed to open file ") (print u)))) ))
  622. ((eqcar u 'de)
  623. (progn
  624. (setq u (cdr u))
  625. (setq defnames
  626. (cons
  627. (list (car u) (c!:inv_name (car u)) (length (cadr u)))
  628. defnames))
  629. (cond ((neq (posn) 0) (terpri)))
  630. (princ "Compiling ")
  631. (prin (caar defnames))
  632. (princ " ... ")
  633. (c!:cfndef (caar defnames) (cadar defnames) (cdr u))
  634. (terpri)))) ))
  635. (fluid '(!*defn dfprint!* dfprintsave))
  636. (de c!:concat (a b)
  637. (compress (cons '!" (append (explode2 a) (append (explode2 b) '(!")))) ))
  638. (de c!:ccompilestart (name !&optional dir)
  639. (prog (o d w)
  640. (setq file_name name)
  641. (cond (dir (setq name (c!:concat dir (c!:concat "/" name)))) )
  642. (setq c_file (open (c!:concat name ".c") 'output))
  643. (setq l_file (c!:concat name ".lsp"))
  644. (setq l_contents nil)
  645. (setq o (reverse (explode (date))))
  646. (prog (i)
  647. (setq i 1)
  648. lab (cond ((minusp (difference 5 i)) (return nil)))
  649. (progn (setq d (cons (car o) d)) (setq o (cdr o)))
  650. (setq i (plus2 i 1))
  651. (go lab))
  652. (setq d (cons '!- d))
  653. (setq o (cdddr (cdddr (cddddr o))))
  654. (setq w o)
  655. (setq o (cdddr o))
  656. (setq d (cons (caddr o) (cons (cadr o) (cons (car o) d))))
  657. (setq d
  658. (compress (cons '!" (cons (cadr w) (cons (car w) (cons '!- d)))) ))
  659. (setq o_file (wrs c_file))
  660. (setq defnames nil)
  661. (c!:printf1 "\n/* %s.c%tMachine generated C code */\n\n" (list name 25))
  662. (c!:printf1 "/* Signature: 00000000 %s */\n\n" (list d))
  663. (c!:printf1 "#include <stdarg.h>\n" (list))
  664. (c!:printf1 "#include <string.h>\n" (list))
  665. (c!:printf1 "#include <ctype.h>\n\n" (list))
  666. (c!:printf1 "#include \qmachine.h\q\n" (list))
  667. (c!:printf1 "#include \qtags.h\q\n" (list))
  668. (c!:printf1 "#include \qcslerror.h\q\n" (list))
  669. (c!:printf1 "#include \qexterns.h\q\n" (list))
  670. (c!:printf1 "#include \qarith.h\q\n" (list))
  671. (c!:printf1 "#include \qentries.h\q\n\n\n" (list))
  672. (wrs o_file)
  673. (return nil)))
  674. (de c!-end nil
  675. (prog (checksum c1 c2 c3)
  676. (wrs c_file)
  677. (c!:printf1 "\n\nsetup_type const %s_setup[] =\n{\n" (list file_name))
  678. (setq defnames (reverse defnames))
  679. (prog nil
  680. !G57 (cond ((not defnames) (return nil)))
  681. (prog (name nargs f1 f2 cast fn)
  682. (setq name (caar defnames))
  683. (setq f1 (cadar defnames))
  684. (setq nargs (caddar defnames))
  685. (setq cast "(n_args *)")
  686. (cond
  687. ((equal nargs 1)
  688. (progn
  689. (setq f2 'too_many_1)
  690. (setq cast "")
  691. (setq fn 'wrong_no_1)))
  692. ((equal nargs 2)
  693. (progn
  694. (setq f2 f1)
  695. (setq f1 'too_few_2)
  696. (setq cast "")
  697. (setq fn 'wrong_no_2)))
  698. (t (progn
  699. (setq fn f1)
  700. (setq f1 'wrong_no_na)
  701. (setq f2 'wrong_no_nb))))
  702. (c!:printf1
  703. " {\q%s\q,%t%s,%t%s,%t%s%s},\n"
  704. (list name 32 f1 48 f2 63 cast fn))
  705. (setq defnames (cdr defnames)))
  706. (go !G57))
  707. (setq c3 (setq checksum (md60 l_contents)))
  708. (setq c1 (remainder c3 10000000))
  709. (setq c3 (quotient c3 10000000))
  710. (setq c2 (remainder c3 10000000))
  711. (setq c3 (quotient c3 10000000))
  712. (setq checksum
  713. (list!-to!-string
  714. (append
  715. (explodec c3)
  716. (cons '! (append (explodec c2) (cons '! (explodec c1)))) )))
  717. (c!:printf1
  718. " {NULL, (one_args *)%a, (two_args *)%a, 0}\n};\n\n"
  719. (list (list!-to!-string (explodec file_name)) checksum))
  720. (c!:printf1 "/* end of generated code */\n" (list))
  721. (close c_file)
  722. (setq l_file (open l_file 'output))
  723. (wrs l_file)
  724. (linelength 72)
  725. (terpri)
  726. (princ "% ")
  727. (princ file_name)
  728. (princ ".lsp")
  729. (ttab 20)
  730. (princ "Machine generated Lisp")
  731. (terpri)
  732. (terpri)
  733. (princ "(c!:install ")
  734. (princ '!")
  735. (princ file_name)
  736. (princ '!")
  737. (princ " ")
  738. (princ checksum)
  739. (printc ")")
  740. (terpri)
  741. (prog (x)
  742. (setq x (reverse l_contents))
  743. lab (cond ((null x) (return nil)))
  744. ((lambda (x)
  745. (progn
  746. (princ "(c!:install '")
  747. (prin (car x))
  748. (princ " '")
  749. (prin (cadr x))
  750. (princ " ")
  751. (prin (cddr x))
  752. (princ ")")
  753. (terpri)
  754. (terpri)))
  755. (car x))
  756. (setq x (cdr x))
  757. (go lab))
  758. (terpri)
  759. (princ "% End of generated Lisp code")
  760. (terpri)
  761. (terpri)
  762. (setq l_contents nil)
  763. (wrs o_file)
  764. (close l_file)
  765. (setq !*defn nil)
  766. (setq dfprint!* dfprintsave)))
  767. (put 'c!-end 'stat 'endstat)
  768. (de c!-compile (u)
  769. (prog nil
  770. (terpri)
  771. (princ "C!-COMPILE ")
  772. (prin u)
  773. (princ ": IN files; or type in expressions")
  774. (terpri)
  775. (princ "When all done, execute C!-END;")
  776. (terpri)
  777. (verbos nil)
  778. (c!:ccompilestart (car u))
  779. (setq dfprintsave dfprint!*)
  780. (setq dfprint!* 'c!:ccmpout1)
  781. (setq !*defn t)
  782. (cond ((getd 'begin) (return nil)))
  783. (c!:ccompilesupervisor)))
  784. (put 'c!-compile 'stat 'rlis)
  785. (de c!:print_opcode (s depth)
  786. (prog (op r1 r2 r3 helper)
  787. (setq op (car s))
  788. (setq r1 (cadr s))
  789. (setq r2 (caddr s))
  790. (setq r3 (cadddr s))
  791. (setq helper (get op 'c!:opcode_printer))
  792. (cond
  793. (helper (funcall helper op r1 r2 r3 depth))
  794. (t (progn (prin s) (terpri)))) ))
  795. (de c!:print_exit_condition (why where_to depth)
  796. (prog (helper lab1 drop1 lab2 drop2 negate)
  797. (cond
  798. ((equal why 'goto)
  799. (progn
  800. (setq where_to (car where_to))
  801. (cond
  802. ((atom where_to)
  803. (progn
  804. (c!:printf1 " goto %s;\n" (list where_to))
  805. (c!:display_flowgraph where_to depth t)))
  806. (t (progn
  807. (c!:printf1 " " (list))
  808. (c!:pgoto where_to depth))))
  809. (return nil)))
  810. ((eqcar (car why) 'call)
  811. (return
  812. (prog (args locs g w)
  813. (cond
  814. ((setq w (get (cadar why) 'c!:direct_entrypoint))
  815. (progn
  816. (prog (a)
  817. (setq a (cdr why))
  818. lab (cond ((null a) (return nil)))
  819. ((lambda (a)
  820. (cond
  821. ((flagp a 'c!:live_across_call)
  822. (progn
  823. (cond
  824. ((null g)
  825. (c!:printf1
  826. " {\n"
  827. (list))))
  828. (setq g (c!:my_gensym))
  829. (c!:printf1
  830. " Lisp_Object %s = %v;\n"
  831. (list g a))
  832. (setq args (cons g args))))
  833. (t (setq args (cons a args)))) )
  834. (car a))
  835. (setq a (cdr a))
  836. (go lab))
  837. (cond
  838. ((neq depth 0)
  839. (progn
  840. (cond (g (c!:printf1 " " (list))))
  841. (c!:printf1
  842. " popv(%s);\n"
  843. (list depth)))) )
  844. (cond (g (c!:printf1 " " (list))))
  845. (c!:printf1 " return %s(" (list (cdr w)))
  846. (setq args (reversip args))
  847. (cond
  848. (args
  849. (progn
  850. (c!:printf1 "%v" (list (car args)))
  851. (prog (a)
  852. (setq a (cdr args))
  853. lab (cond ((null a) (return nil)))
  854. ((lambda (a)
  855. (c!:printf1 ", %v" (list a)))
  856. (car a))
  857. (setq a (cdr a))
  858. (go lab)))) )
  859. (c!:printf1 ");\n" (list))
  860. (cond (g (c!:printf1 " }\n" (list)))) ))
  861. ((setq w (get (cadar why) 'c!:c_entrypoint))
  862. (progn
  863. (prog (a)
  864. (setq a (cdr why))
  865. lab (cond ((null a) (return nil)))
  866. ((lambda (a)
  867. (cond
  868. ((flagp a 'c!:live_across_call)
  869. (progn
  870. (cond
  871. ((null g)
  872. (c!:printf1
  873. " {\n"
  874. (list))))
  875. (setq g (c!:my_gensym))
  876. (c!:printf1
  877. " Lisp_Object %s = %v;\n"
  878. (list g a))
  879. (setq args (cons g args))))
  880. (t (setq args (cons a args)))) )
  881. (car a))
  882. (setq a (cdr a))
  883. (go lab))
  884. (cond
  885. ((neq depth 0)
  886. (c!:printf1
  887. " popv(%s);\n"
  888. (list depth))))
  889. (c!:printf1 " return %s(nil" (list w))
  890. (cond
  891. ((or (null args) (geq (length args) 3))
  892. (c!:printf1 ", %s" (list (length args)))) )
  893. (prog (a)
  894. (setq a (reversip args))
  895. lab (cond ((null a) (return nil)))
  896. ((lambda (a) (c!:printf1 ", %v" (list a)))
  897. (car a))
  898. (setq a (cdr a))
  899. (go lab))
  900. (c!:printf1 ");\n" (list))
  901. (cond (g (c!:printf1 " }\n" (list)))) ))
  902. (t (prog (nargs)
  903. (setq nargs (length (cdr why)))
  904. (c!:printf1 " {\n" (list))
  905. (prog (a)
  906. (setq a (cdr why))
  907. lab (cond ((null a) (return nil)))
  908. ((lambda (a)
  909. (cond
  910. ((flagp a 'c!:live_across_call)
  911. (progn
  912. (setq g (c!:my_gensym))
  913. (c!:printf1
  914. " Lisp_Object %s = %v;\n"
  915. (list g a))
  916. (setq args (cons g args))))
  917. (t (setq args (cons a args)))) )
  918. (car a))
  919. (setq a (cdr a))
  920. (go lab))
  921. (cond
  922. ((neq depth 0)
  923. (c!:printf1
  924. " popv(%s);\n"
  925. (list depth))))
  926. (c!:printf1
  927. " fn = elt(env, %s); /* %a */\n"
  928. (list
  929. (c!:find_literal (cadar why))
  930. (cadar why)))
  931. (cond
  932. ((equal nargs 1)
  933. (c!:printf1
  934. " return (*qfn1(fn))(qenv(fn)"
  935. (list)))
  936. ((equal nargs 2)
  937. (c!:printf1
  938. " return (*qfn2(fn))(qenv(fn)"
  939. (list)))
  940. (t (c!:printf1
  941. " return (*qfnn(fn))(qenv(fn), %s"
  942. (list nargs))))
  943. (prog (a)
  944. (setq a (reversip args))
  945. lab (cond ((null a) (return nil)))
  946. ((lambda (a) (c!:printf1 ", %s" (list a)))
  947. (car a))
  948. (setq a (cdr a))
  949. (go lab))
  950. (c!:printf1 ");\n }\n" (list)))) )
  951. (return nil)))) )
  952. (setq lab1 (car where_to))
  953. (setq drop1 (and (atom lab1) (not (flagp lab1 'c!:visited))))
  954. (setq lab2 (cadr where_to))
  955. (setq drop2 (and (atom lab2) (not (flagp drop2 'c!:visited))))
  956. (cond
  957. ((and drop2 (equal (get lab2 'c!:count) 1))
  958. (progn (setq where_to (list lab2 lab1)) (setq drop1 t)))
  959. (drop1 (setq negate t)))
  960. (setq helper (get (car why) 'c!:exit_helper))
  961. (cond ((null helper) (error 0 (list "Bad exit condition" why))))
  962. (c!:printf1 " if (" (list))
  963. (cond
  964. (negate
  965. (progn
  966. (c!:printf1 "!(" (list))
  967. (funcall helper (cdr why) depth)
  968. (c!:printf1 ")" (list))))
  969. (t (funcall helper (cdr why) depth)))
  970. (c!:printf1 ") " (list))
  971. (cond
  972. ((not drop1)
  973. (progn
  974. (c!:pgoto (car where_to) depth)
  975. (c!:printf1 " else " (list)))) )
  976. (c!:pgoto (cadr where_to) depth)
  977. (cond
  978. ((atom (car where_to))
  979. (c!:display_flowgraph (car where_to) depth drop1)))
  980. (cond
  981. ((atom (cadr where_to))
  982. (c!:display_flowgraph (cadr where_to) depth nil)))) )
  983. (de c!:pmovr (op r1 r2 r3 depth) (c!:printf1 " %v = %v;\n" (list r1 r3)))
  984. (put 'movr 'c!:opcode_printer (function c!:pmovr))
  985. (de c!:pmovk (op r1 r2 r3 depth)
  986. (c!:printf1 " %v = elt(env, %s); /* %a */\n" (list r1 r3 r2)))
  987. (put 'movk 'c!:opcode_printer (function c!:pmovk))
  988. (de c!:pmovk1 (op r1 r2 r3 depth)
  989. (cond
  990. ((null r3) (c!:printf1 " %v = nil;\n" (list r1)))
  991. ((equal r3 't) (c!:printf1 " %v = lisp_true;\n" (list r1)))
  992. (t (c!:printf1
  993. " %v = (Lisp_Object)%s; /* %a */\n"
  994. (list r1 (plus (times 16 r3) 1) r3)))) )
  995. (put 'movk1 'c!:opcode_printer (function c!:pmovk1))
  996. (de c!:preloadenv (op r1 r2 r3 depth)
  997. (c!:printf1 " env = stack[%s];\n" (list (minus reloadenv))))
  998. (put 'reloadenv 'c!:opcode_printer (function c!:preloadenv))
  999. (de c!:pldrglob (op r1 r2 r3 depth)
  1000. (c!:printf1 " %v = qvalue(elt(env, %s)); /* %a */\n" (list r1 r3 r2)))
  1001. (put 'ldrglob 'c!:opcode_printer (function c!:pldrglob))
  1002. (de c!:pstrglob (op r1 r2 r3 depth)
  1003. (c!:printf1 " qvalue(elt(env, %s)) = %v; /* %a */\n" (list r3 r1 r2)))
  1004. (put 'strglob 'c!:opcode_printer (function c!:pstrglob))
  1005. (de c!:pnilglob (op r1 r2 r3 depth)
  1006. (c!:printf1 " qvalue(elt(env, %s)) = nil; /* %a */\n" (list r3 r2)))
  1007. (put 'nilglob 'c!:opcode_printer (function c!:pnilglob))
  1008. (de c!:pnull (op r1 r2 r3 depth)
  1009. (c!:printf1 " %v = (%v == nil ? lisp_true : nil);\n" (list r1 r3)))
  1010. (put 'null 'c!:opcode_printer (function c!:pnull))
  1011. (put 'not 'c!:opcode_printer (function c!:pnull))
  1012. (flag '(null not) 'c!:uses_nil)
  1013. (de c!:pfastget (op r1 r2 r3 depth)
  1014. (progn
  1015. (c!:printf1 " if (!symbolp(%v)) %v = nil;\n" (list r2 r1))
  1016. (c!:printf1 " else { %v = qfastgets(%v);\n" (list r1 r2))
  1017. (c!:printf1
  1018. " if (%v != nil) { %v = elt(%v, %s); /* %s */\n"
  1019. (list r1 r1 r1 (car r3) (cdr r3)))
  1020. (c!:printf1 "#ifdef RECORD_GET\n" (list))
  1021. (c!:printf1 " if (%v != SPID_NOPROP)\n" (list r1))
  1022. (c!:printf1
  1023. " record_get(elt(fastget_names, %s), 1);\n"
  1024. (list (car r3)))
  1025. (c!:printf1
  1026. " else record_get(elt(fastget_names, %s), 0),\n"
  1027. (list (car r3)))
  1028. (c!:printf1 " %v = nil; }\n" (list r1))
  1029. (c!:printf1
  1030. " else record_get(elt(fastget_names, %s), 0); }\n"
  1031. (list (car r3)))
  1032. (c!:printf1 "#else\n" (list))
  1033. (c!:printf1
  1034. " if (%v == SPID_NOPROP) %v = nil; }}\n"
  1035. (list r1 r1))
  1036. (c!:printf1 "#endif\n" (list))
  1037. nil))
  1038. (put 'fastget 'c!:opcode_printer (function c!:pfastget))
  1039. (flag '(fastget) 'c!:uses_nil)
  1040. (de c!:pfastflag (op r1 r2 r3 depth)
  1041. (progn
  1042. (c!:printf1 " if (!symbolp(%v)) %v = nil;\n" (list r2 r1))
  1043. (c!:printf1 " else { %v = qfastgets(%v);\n" (list r1 r2))
  1044. (c!:printf1
  1045. " if (%v != nil) { %v = elt(%v, %s); /* %s */\n"
  1046. (list r1 r1 r1 (car r3) (cdr r3)))
  1047. (c!:printf1 "#ifdef RECORD_GET\n" (list))
  1048. (c!:printf1 " if (%v == SPID_NOPROP)\n" (list r1))
  1049. (c!:printf1
  1050. " record_get(elt(fastget_names, %s), 0),\n"
  1051. (list (car r3)))
  1052. (c!:printf1 " %v = nil;\n" (list r1))
  1053. (c!:printf1
  1054. " else record_get(elt(fastget_names, %s), 1),\n"
  1055. (list (car r3)))
  1056. (c!:printf1 " %v = lisp_true; }\n" (list r1))
  1057. (c!:printf1
  1058. " else record_get(elt(fastget_names, %s), 0); }\n"
  1059. (list (car r3)))
  1060. (c!:printf1 "#else\n" (list))
  1061. (c!:printf1
  1062. " if (%v == SPID_NOPROP) %v = nil; else %v = lisp_true; }}\n"
  1063. (list r1 r1 r1))
  1064. (c!:printf1 "#endif\n" (list))
  1065. nil))
  1066. (put 'fastflag 'c!:opcode_printer (function c!:pfastflag))
  1067. (flag '(fastflag) 'c!:uses_nil)
  1068. (de c!:pcar (op r1 r2 r3 depth)
  1069. (prog nil
  1070. (cond
  1071. ((not !*unsafecar)
  1072. (progn
  1073. (c!:printf1 " if (!car_legal(%v)) " (list r3))
  1074. (c!:pgoto
  1075. (c!:find_error_label (list 'car r3) r2 depth)
  1076. depth))))
  1077. (c!:printf1 " %v = qcar(%v);\n" (list r1 r3))))
  1078. (put 'car 'c!:opcode_printer (function c!:pcar))
  1079. (de c!:pcdr (op r1 r2 r3 depth)
  1080. (prog nil
  1081. (cond
  1082. ((not !*unsafecar)
  1083. (progn
  1084. (c!:printf1 " if (!car_legal(%v)) " (list r3))
  1085. (c!:pgoto
  1086. (c!:find_error_label (list 'cdr r3) r2 depth)
  1087. depth))))
  1088. (c!:printf1 " %v = qcdr(%v);\n" (list r1 r3))))
  1089. (put 'cdr 'c!:opcode_printer (function c!:pcdr))
  1090. (de c!:pqcar (op r1 r2 r3 depth)
  1091. (c!:printf1 " %v = qcar(%v);\n" (list r1 r3)))
  1092. (put 'qcar 'c!:opcode_printer (function c!:pqcar))
  1093. (de c!:pqcdr (op r1 r2 r3 depth)
  1094. (c!:printf1 " %v = qcdr(%v);\n" (list r1 r3)))
  1095. (put 'qcdr 'c!:opcode_printer (function c!:pqcdr))
  1096. (de c!:patom (op r1 r2 r3 depth)
  1097. (c!:printf1 " %v = (!consp(%v) ? lisp_true : nil);\n" (list r1 r3)))
  1098. (put 'atom 'c!:opcode_printer (function c!:patom))
  1099. (de c!:pnumberp (op r1 r2 r3 depth)
  1100. (c!:printf1 " %v = (is_number(%v) ? lisp_true : nil);\n" (list r1 r3)))
  1101. (put 'numberp 'c!:opcode_printer (function c!:pnumberp))
  1102. (de c!:pfixp (op r1 r2 r3 depth)
  1103. (c!:printf1 " %v = integerp(%v);\n" (list r1 r3)))
  1104. (put 'fixp 'c!:opcode_printer (function c!:pfixp))
  1105. (de c!:piminusp (op r1 r2 r3 depth)
  1106. (c!:printf1
  1107. " %v = ((int32)(%v) < 0 ? lisp_true : nil);\n"
  1108. (list r1 r3)))
  1109. (put 'iminusp 'c!:opcode_printer (function c!:piminusp))
  1110. (de c!:pilessp (op r1 r2 r3 depth)
  1111. (c!:printf1
  1112. " %v = ((int32)%v < (int32)%v) ? lisp_true : nil;\n"
  1113. (list r1 r2 r3)))
  1114. (put 'ilessp 'c!:opcode_printer (function c!:pilessp))
  1115. (de c!:pigreaterp (op r1 r2 r3 depth)
  1116. (c!:printf1
  1117. " %v = ((int32)%v > (int32)%v) ? lisp_true : nil;\n"
  1118. (list r1 r2 r3)))
  1119. (put 'igreaterp 'c!:opcode_printer (function c!:pigreaterp))
  1120. (de c!:piminus (op r1 r2 r3 depth)
  1121. (c!:printf1 " %v = (Lisp_Object)(2-((int32)(%v)));\n" (list r1 r3)))
  1122. (put 'iminus 'c!:opcode_printer (function c!:piminus))
  1123. (de c!:piadd1 (op r1 r2 r3 depth)
  1124. (c!:printf1 " %v = (Lisp_Object)((int32)(%v) + 0x10);\n" (list r1 r3)))
  1125. (put 'iadd1 'c!:opcode_printer (function c!:piadd1))
  1126. (de c!:pisub1 (op r1 r2 r3 depth)
  1127. (c!:printf1 " %v = (Lisp_Object)((int32)(%v) - 0x10);\n" (list r1 r3)))
  1128. (put 'isub1 'c!:opcode_printer (function c!:pisub1))
  1129. (de c!:piplus2 (op r1 r2 r3 depth)
  1130. (c!:printf1
  1131. " %v = (Lisp_Object)((int32)%v + (int32)%v - TAG_FIXNUM);\n"
  1132. (list r1 r2 r3)))
  1133. (put 'iplus2 'c!:opcode_printer (function c!:piplus2))
  1134. (de c!:pidifference (op r1 r2 r3 depth)
  1135. (c!:printf1
  1136. " %v = (Lisp_Object)((int32)%v - (int32)%v + TAG_FIXNUM);\n"
  1137. (list r1 r2 r3)))
  1138. (put 'idifference 'c!:opcode_printer (function c!:pidifference))
  1139. (de c!:pitimes2 (op r1 r2 r3 depth)
  1140. (c!:printf1
  1141. " %v = fixnum_of_int(int_of_fixnum(%v) * int_of_fixnum(%v));\n"
  1142. (list r1 r2 r3)))
  1143. (put 'itimes2 'c!:opcode_printer (function c!:pitimes2))
  1144. (de c!:pmodular_plus (op r1 r2 r3 depth)
  1145. (progn
  1146. (c!:printf1
  1147. " { int32 w = int_of_fixnum(%v) + int_of_fixnum(%v);\n"
  1148. (list r2 r3))
  1149. (c!:printf1
  1150. " if (w >= current_modulus) w -= current_modulus;\n"
  1151. (list))
  1152. (c!:printf1 " %v = fixnum_of_int(w);\n" (list r1))
  1153. (c!:printf1 " }\n" (list))))
  1154. (put 'modular!-plus 'c!:opcode_printer (function c!:pmodular_plus))
  1155. (de c!:pmodular_difference (op r1 r2 r3 depth)
  1156. (progn
  1157. (c!:printf1
  1158. " { int32 w = int_of_fixnum(%v) - int_of_fixnum(%v);\n"
  1159. (list r2 r3))
  1160. (c!:printf1 " if (w < 0) w += current_modulus;\n" (list))
  1161. (c!:printf1 " %v = fixnum_of_int(w);\n" (list r1))
  1162. (c!:printf1 " }\n" (list))))
  1163. (put
  1164. 'modular!-difference
  1165. 'c!:opcode_printer
  1166. (function c!:pmodular_difference))
  1167. (de c!:pmodular_minus (op r1 r2 r3 depth)
  1168. (progn
  1169. (c!:printf1 " { int32 w = int_of_fixnum(%v);\n" (list r3))
  1170. (c!:printf1 " if (w != 0) w = current_modulus - w;\n" (list))
  1171. (c!:printf1 " %v = fixnum_of_int(w);\n" (list r1))
  1172. (c!:printf1 " }\n" (list))))
  1173. (put 'modular!-minus 'c!:opcode_printer (function c!:pmodular_minus))
  1174. (de c!:passoc (op r1 r2 r3 depth)
  1175. (c!:printf1 " %v = Lassoc(nil, %v, %v);\n" (list r1 r2 r3)))
  1176. (put 'assoc 'c!:opcode_printer (function c!:passoc))
  1177. (flag '(assoc) 'c!:uses_nil)
  1178. (de c!:patsoc (op r1 r2 r3 depth)
  1179. (c!:printf1 " %v = Latsoc(nil, %v, %v);\n" (list r1 r2 r3)))
  1180. (put 'atsoc 'c!:opcode_printer (function c!:patsoc))
  1181. (flag '(atsoc) 'c!:uses_nil)
  1182. (de c!:pmember (op r1 r2 r3 depth)
  1183. (c!:printf1 " %v = Lmember(nil, %v, %v);\n" (list r1 r2 r3)))
  1184. (put 'member 'c!:opcode_printer (function c!:pmember))
  1185. (flag '(member) 'c!:uses_nil)
  1186. (de c!:pmemq (op r1 r2 r3 depth)
  1187. (c!:printf1 " %v = Lmemq(nil, %v, %v);\n" (list r1 r2 r3)))
  1188. (put 'memq 'c!:opcode_printer (function c!:pmemq))
  1189. (flag '(memq) 'c!:uses_nil)
  1190. (de c!:pget (op r1 r2 r3 depth)
  1191. (c!:printf1 " %v = get(%v, %v);\n" (list r1 r2 r3)))
  1192. (put 'get 'c!:opcode_printer (function c!:pget))
  1193. (de c!:pqgetv (op r1 r2 r3 depth)
  1194. (progn
  1195. (c!:printf1
  1196. " %v = *(Lisp_Object *)((char *)%v + (4L-TAG_VECTOR) +"
  1197. (list r1 r2))
  1198. (c!:printf1 " ((int32)%v>>2));\n" (list r3))))
  1199. (put 'qgetv 'c!:opcode_printer (function c!:pqgetv))
  1200. (de c!:pqputv (op r1 r2 r3 depth)
  1201. (progn
  1202. (c!:printf1
  1203. " *(Lisp_Object *)((char *)%v + (4L-TAG_VECTOR) +"
  1204. (list r2))
  1205. (c!:printf1 " ((int32)%v>>2)) = %v;\n" (list r3 r1))))
  1206. (put 'qputv 'c!:opcode_printer (function c!:pqputv))
  1207. (de c!:peq (op r1 r2 r3 depth)
  1208. (c!:printf1 " %v = (%v == %v ? lisp_true : nil);\n" (list r1 r2 r3)))
  1209. (put 'eq 'c!:opcode_printer (function c!:peq))
  1210. (flag '(eq) 'c!:uses_nil)
  1211. (de c!:pequal (op r1 r2 r3 depth)
  1212. (c!:printf1
  1213. " %v = (equal(%v, %v) ? lisp_true : nil);\n"
  1214. (list r1 r2 r3 r2 r3)))
  1215. (put 'equal 'c!:opcode_printer (function c!:pequal))
  1216. (flag '(equal) 'c!:uses_nil)
  1217. (de c!:pfluidbind (op r1 r2 r3 depth) nil)
  1218. (put 'fluidbind 'c!:opcode_printer (function c!:pfluidbind))
  1219. (de c!:pcall (op r1 r2 r3 depth)
  1220. (prog (w boolfn)
  1221. (cond
  1222. ((setq w (get (car r3) 'c!:direct_entrypoint))
  1223. (progn
  1224. (c!:printf1 " %v = %s(" (list r1 (cdr w)))
  1225. (cond
  1226. (r2
  1227. (progn
  1228. (c!:printf1 "%v" (list (car r2)))
  1229. (prog (a)
  1230. (setq a (cdr r2))
  1231. lab (cond ((null a) (return nil)))
  1232. ((lambda (a) (c!:printf1 ", %v" (list a))) (car a))
  1233. (setq a (cdr a))
  1234. (go lab)))) )
  1235. (c!:printf1 ");\n" (list))))
  1236. ((setq w (get (car r3) 'c!:direct_predicate))
  1237. (progn
  1238. (setq boolfn t)
  1239. (c!:printf1 " %v = (Lisp_Object)%s(" (list r1 (cdr w)))
  1240. (cond
  1241. (r2
  1242. (progn
  1243. (c!:printf1 "%v" (list (car r2)))
  1244. (prog (a)
  1245. (setq a (cdr r2))
  1246. lab (cond ((null a) (return nil)))
  1247. ((lambda (a) (c!:printf1 ", %v" (list a))) (car a))
  1248. (setq a (cdr a))
  1249. (go lab)))) )
  1250. (c!:printf1 ");\n" (list))))
  1251. ((equal (car r3) current_procedure)
  1252. (progn
  1253. (c!:printf1 " %v = %s(env" (list r1 current_c_name))
  1254. (cond
  1255. ((or (null r2) (geq (length r2) 3))
  1256. (c!:printf1 ", %s" (list (length r2)))) )
  1257. (prog (a)
  1258. (setq a r2)
  1259. lab (cond ((null a) (return nil)))
  1260. ((lambda (a) (c!:printf1 ", %v" (list a))) (car a))
  1261. (setq a (cdr a))
  1262. (go lab))
  1263. (c!:printf1 ");\n" (list))))
  1264. ((setq w (get (car r3) 'c!:c_entrypoint))
  1265. (progn
  1266. (c!:printf1 " %v = %s(nil" (list r1 w))
  1267. (cond
  1268. ((or (null r2) (geq (length r2) 3))
  1269. (c!:printf1 ", %s" (list (length r2)))) )
  1270. (prog (a)
  1271. (setq a r2)
  1272. lab (cond ((null a) (return nil)))
  1273. ((lambda (a) (c!:printf1 ", %v" (list a))) (car a))
  1274. (setq a (cdr a))
  1275. (go lab))
  1276. (c!:printf1 ");\n" (list))))
  1277. (t (prog (nargs)
  1278. (setq nargs (length r2))
  1279. (c!:printf1
  1280. " fn = elt(env, %s); /* %a */\n"
  1281. (list (c!:find_literal (car r3)) (car r3)))
  1282. (cond
  1283. ((equal nargs 1)
  1284. (c!:printf1 " %v = (*qfn1(fn))(qenv(fn)" (list r1)))
  1285. ((equal nargs 2)
  1286. (c!:printf1 " %v = (*qfn2(fn))(qenv(fn)" (list r1)))
  1287. (t (c!:printf1
  1288. " %v = (*qfnn(fn))(qenv(fn), %s"
  1289. (list r1 nargs))))
  1290. (prog (a)
  1291. (setq a r2)
  1292. lab (cond ((null a) (return nil)))
  1293. ((lambda (a) (c!:printf1 ", %v" (list a))) (car a))
  1294. (setq a (cdr a))
  1295. (go lab))
  1296. (c!:printf1 ");\n" (list)))) )
  1297. (cond
  1298. ((not (flagp (car r3) 'c!:no_errors))
  1299. (progn
  1300. (cond
  1301. ((and (null (cadr r3)) (equal depth 0))
  1302. (c!:printf1 " errexit();\n" (list)))
  1303. (t (progn
  1304. (c!:printf1 " nil = C_nil;\n" (list))
  1305. (c!:printf1 " if (exception_pending()) " (list))
  1306. (c!:pgoto
  1307. (c!:find_error_label nil (cadr r3) depth)
  1308. depth)))) )))
  1309. (cond
  1310. (boolfn
  1311. (c!:printf1 " %v = %v ? lisp_true : nil;\n" (list r1 r1)))) ))
  1312. (put 'call 'c!:opcode_printer (function c!:pcall))
  1313. (de c!:pgoto (lab depth)
  1314. (prog nil
  1315. (cond ((atom lab) (return (c!:printf1 "goto %s;\n" (list lab)))) )
  1316. (setq lab (get (car lab) 'c!:chosen))
  1317. (cond
  1318. ((zerop depth) (c!:printf1 "return onevalue(%v);\n" (list lab)))
  1319. ((flagp lab 'c!:live_across_call)
  1320. (c!:printf1
  1321. "{ Lisp_Object res = %v; popv(%s); return onevalue(res); }\n"
  1322. (list lab depth)))
  1323. (t (c!:printf1
  1324. "{ popv(%s); return onevalue(%v); }\n"
  1325. (list depth lab)))) ))
  1326. (de c!:pifnull (s depth) (c!:printf1 "%v == nil" (list (car s))))
  1327. (put 'ifnull 'c!:exit_helper (function c!:pifnull))
  1328. (de c!:pifatom (s depth) (c!:printf1 "!consp(%v)" (list (car s))))
  1329. (put 'ifatom 'c!:exit_helper (function c!:pifatom))
  1330. (de c!:pifsymbol (s depth) (c!:printf1 "symbolp(%v)" (list (car s))))
  1331. (put 'ifsymbol 'c!:exit_helper (function c!:pifsymbol))
  1332. (de c!:pifnumber (s depth) (c!:printf1 "is_number(%v)" (list (car s))))
  1333. (put 'ifnumber 'c!:exit_helper (function c!:pifnumber))
  1334. (de c!:pifizerop (s depth) (c!:printf1 "(%v) == 1" (list (car s))))
  1335. (put 'ifizerop 'c!:exit_helper (function c!:pifizerop))
  1336. (de c!:pifeq (s depth) (c!:printf1 "%v == %v" (list (car s) (cadr s))))
  1337. (put 'ifeq 'c!:exit_helper (function c!:pifeq))
  1338. (de c!:pifequal (s depth)
  1339. (c!:printf1 "equal(%v, %v)" (list (car s) (cadr s) (car s) (cadr s))))
  1340. (put 'ifequal 'c!:exit_helper (function c!:pifequal))
  1341. (de c!:pifilessp (s depth)
  1342. (c!:printf1 "((int32)(%v)) < ((int32)(%v))" (list (car s) (cadr s))))
  1343. (put 'ifilessp 'c!:exit_helper (function c!:pifilessp))
  1344. (de c!:pifigreaterp (s depth)
  1345. (c!:printf1 "((int32)(%v)) > ((int32)(%v))" (list (car s) (cadr s))))
  1346. (put 'ifigreaterp 'c!:exit_helper (function c!:pifigreaterp))
  1347. (de c!:display_flowgraph (s depth dropping_through)
  1348. (cond
  1349. ((not (atom s)) (progn (c!:printf1 " " (list)) (c!:pgoto s depth)))
  1350. ((not (flagp s 'c!:visited))
  1351. (prog (why where_to)
  1352. (flag (list s) 'c!:visited)
  1353. (cond
  1354. ((or (not dropping_through) (not (equal (get s 'c!:count) 1)))
  1355. (c!:printf1 "\n%s:\n" (list s))))
  1356. (prog (k)
  1357. (setq k (reverse (get s 'c!:contents)))
  1358. lab (cond ((null k) (return nil)))
  1359. ((lambda (k) (c!:print_opcode k depth)) (car k))
  1360. (setq k (cdr k))
  1361. (go lab))
  1362. (setq why (get s 'c!:why))
  1363. (setq where_to (get s 'c!:where_to))
  1364. (cond
  1365. ((and
  1366. (equal why 'goto)
  1367. (or
  1368. (not (atom (car where_to)))
  1369. (and
  1370. (not (flagp (car where_to) 'c!:visited))
  1371. (equal (get (car where_to) 'c!:count) 1))))
  1372. (c!:display_flowgraph (car where_to) depth t))
  1373. (t (c!:print_exit_condition why where_to depth)))) )))
  1374. (fluid '(startpoint))
  1375. (de c!:branch_chain (s count)
  1376. (prog (contents why where_to n)
  1377. (cond
  1378. ((not (atom s)) (return s))
  1379. ((flagp s 'c!:visited)
  1380. (progn
  1381. (setq n (get s 'c!:count))
  1382. (cond ((null n) (setq n 1)) (t (setq n (plus n 1))))
  1383. (put s 'c!:count n)
  1384. (return s))))
  1385. (flag (list s) 'c!:visited)
  1386. (setq contents (get s 'c!:contents))
  1387. (setq why (get s 'c!:why))
  1388. (setq where_to
  1389. (prog (z !G58 endptr)
  1390. (setq z (get s 'c!:where_to))
  1391. (cond ((null z) (return nil)))
  1392. (setq !G58
  1393. (setq endptr
  1394. (cons
  1395. ((lambda (z) (c!:branch_chain z count)) (car z))
  1396. nil)))
  1397. looplabel
  1398. (setq z (cdr z))
  1399. (cond ((null z) (return !G58)))
  1400. (rplacd
  1401. endptr
  1402. (cons ((lambda (z) (c!:branch_chain z count)) (car z)) nil))
  1403. (setq endptr (cdr endptr))
  1404. (go looplabel)))
  1405. (prog nil
  1406. !G59 (cond
  1407. ((not
  1408. (and
  1409. contents
  1410. (eqcar (car contents) 'movr)
  1411. (equal why 'goto)
  1412. (not (atom (car where_to)))
  1413. (equal (caar where_to) (cadr (car contents)))) )
  1414. (return nil)))
  1415. (progn
  1416. (setq where_to (list (list (cadddr (car contents)))) )
  1417. (setq contents (cdr contents)))
  1418. (go !G59))
  1419. (put s 'c!:contents contents)
  1420. (put s 'c!:where_to where_to)
  1421. (cond
  1422. ((and (null contents) (equal why 'goto))
  1423. (progn (remflag (list s) 'c!:visited) (return (car where_to)))) )
  1424. (cond
  1425. (count
  1426. (progn
  1427. (setq n (get s 'c!:count))
  1428. (cond ((null n) (setq n 1)) (t (setq n (plus n 1))))
  1429. (put s 'c!:count n))))
  1430. (return s)))
  1431. (de c!:one_operand (op)
  1432. (progn
  1433. (flag (list op) 'c!:set_r1)
  1434. (flag (list op) 'c!:read_r3)
  1435. (put op 'c!:code (function c!:builtin_one))))
  1436. (de c!:two_operands (op)
  1437. (progn
  1438. (flag (list op) 'c!:set_r1)
  1439. (flag (list op) 'c!:read_r2)
  1440. (flag (list op) 'c!:read_r3)
  1441. (put op 'c!:code (function c!:builtin_two))))
  1442. (prog (n)
  1443. (setq n
  1444. '(car cdr qcar qcdr null not atom numberp fixp iminusp iminus iadd1
  1445. isub1 modular!-minus))
  1446. lab(cond ((null n) (return nil)))
  1447. ((lambda (n) (c!:one_operand n)) (car n))
  1448. (setq n (cdr n))
  1449. (go lab))
  1450. (prog (n)
  1451. (setq n
  1452. '(eq equal atsoc memq iplus2 idifference assoc member itimes2 ilessp
  1453. igreaterp qgetv get modular!-plus modular!-difference))
  1454. lab(cond ((null n) (return nil)))
  1455. ((lambda (n) (c!:two_operands n)) (car n))
  1456. (setq n (cdr n))
  1457. (go lab))
  1458. (flag '(movr movk movk1 ldrglob call reloadenv fastget fastflag) 'c!:set_r1)
  1459. (flag '(strglob qputv) 'c!:read_r1)
  1460. (flag '(qputv fastget fastflag) 'c!:read_r2)
  1461. (flag '(movr qputv) 'c!:read_r3)
  1462. (flag '(ldrglob strglob nilglob movk call) 'c!:read_env)
  1463. (fluid '(fn_used nil_used nilbase_used))
  1464. (de c!:live_variable_analysis (all_blocks)
  1465. (prog (changed z)
  1466. (prog nil
  1467. !G60 (progn
  1468. (setq changed nil)
  1469. (prog (b)
  1470. (setq b all_blocks)
  1471. lab (cond ((null b) (return nil)))
  1472. ((lambda (b)
  1473. (prog (w live)
  1474. (prog (x)
  1475. (setq x (get b 'c!:where_to))
  1476. lab (cond ((null x) (return nil)))
  1477. ((lambda (x)
  1478. (cond
  1479. ((atom x)
  1480. (setq live (union live (get x 'c!:live))))
  1481. (t (setq live (union live x)))) )
  1482. (car x))
  1483. (setq x (cdr x))
  1484. (go lab))
  1485. (setq w (get b 'c!:why))
  1486. (cond
  1487. ((not (atom w))
  1488. (progn
  1489. (cond
  1490. ((or (eqcar w 'ifnull) (eqcar w 'ifequal))
  1491. (setq nil_used t)))
  1492. (setq live (union live (cdr w)))
  1493. (cond
  1494. ((and
  1495. (eqcar (car w) 'call)
  1496. (or
  1497. (flagp
  1498. (cadar w)
  1499. 'c!:direct_predicate)
  1500. (and
  1501. (flagp (cadar w) 'c!:c_entrypoint)
  1502. (not
  1503. (flagp
  1504. (cadar w)
  1505. 'c!:direct_entrypoint)))) )
  1506. (setq nil_used t)))
  1507. (cond
  1508. ((and
  1509. (eqcar (car w) 'call)
  1510. (not
  1511. (equal (cadar w) current_procedure))
  1512. (not
  1513. (get
  1514. (cadar w)
  1515. 'c!:direct_entrypoint))
  1516. (not (get (cadar w) 'c!:c_entrypoint)))
  1517. (progn
  1518. (setq fn_used t)
  1519. (setq live
  1520. (union '(env) live)))) ))) )
  1521. (prog (s)
  1522. (setq s (get b 'c!:contents))
  1523. lab (cond ((null s) (return nil)))
  1524. ((lambda (s)
  1525. (prog (op r1 r2 r3)
  1526. (setq op (car s))
  1527. (setq r1 (cadr s))
  1528. (setq r2 (caddr s))
  1529. (setq r3 (cadddr s))
  1530. (cond
  1531. ((equal op 'movk1)
  1532. (progn
  1533. (cond
  1534. ((equal r3 nil) (setq nil_used t))
  1535. ((equal r3 't)
  1536. (setq nilbase_used t)))) )
  1537. ((and (atom op) (flagp op 'c!:uses_nil))
  1538. (setq nil_used t)))
  1539. (cond
  1540. ((flagp op 'c!:set_r1)
  1541. (cond
  1542. ((memq r1 live)
  1543. (setq live (delete r1 live)))
  1544. ((equal op 'call) nil)
  1545. (t (setq op 'nop)))) )
  1546. (cond
  1547. ((flagp op 'c!:read_r1)
  1548. (setq live (union live (list r1)))) )
  1549. (cond
  1550. ((flagp op 'c!:read_r2)
  1551. (setq live (union live (list r2)))) )
  1552. (cond
  1553. ((flagp op 'c!:read_r3)
  1554. (setq live (union live (list r3)))) )
  1555. (cond
  1556. ((equal op 'call)
  1557. (progn
  1558. (cond
  1559. ((or
  1560. (not
  1561. (flagp
  1562. (car r3)
  1563. 'c!:no_errors))
  1564. (flagp
  1565. (car r3)
  1566. 'c!:c_entrypoint)
  1567. (get
  1568. (car r3)
  1569. 'c!:direct_predicate))
  1570. (setq nil_used t)))
  1571. (setq does_call t)
  1572. (cond
  1573. ((and
  1574. (not
  1575. (eqcar
  1576. r3
  1577. current_procedure))
  1578. (not
  1579. (get
  1580. (car r3)
  1581. 'c!:direct_entrypoint))
  1582. (not
  1583. (get
  1584. (car r3)
  1585. 'c!:c_entrypoint)))
  1586. (setq fn_used t)))
  1587. (cond
  1588. ((not
  1589. (flagp
  1590. (car r3)
  1591. 'c!:no_errors))
  1592. (flag
  1593. live
  1594. 'c!:live_across_call)))
  1595. (setq live (union live r2)))) )
  1596. (cond
  1597. ((flagp op 'c!:read_env)
  1598. (setq live (union live '(env)))) )))
  1599. (car s))
  1600. (setq s (cdr s))
  1601. (go lab))
  1602. (setq live (sort live (function orderp)))
  1603. (cond
  1604. ((not (equal live (get b 'c!:live)))
  1605. (progn
  1606. (put b 'c!:live live)
  1607. (setq changed t)))) ))
  1608. (car b))
  1609. (setq b (cdr b))
  1610. (go lab)))
  1611. (cond ((not (not changed)) (go !G60))))
  1612. (setq z registers)
  1613. (setq registers (setq stacklocs nil))
  1614. (prog (r)
  1615. (setq r z)
  1616. lab (cond ((null r) (return nil)))
  1617. ((lambda (r)
  1618. (cond
  1619. ((flagp r 'c!:live_across_call)
  1620. (setq stacklocs (cons r stacklocs)))
  1621. (t (setq registers (cons r registers)))) )
  1622. (car r))
  1623. (setq r (cdr r))
  1624. (go lab))))
  1625. (de c!:insert1 (a b) (cond ((memq a b) b) (t (cons a b))))
  1626. (de c!:clash (a b)
  1627. (cond
  1628. ((equal (flagp a 'c!:live_across_call) (flagp b 'c!:live_across_call))
  1629. (progn
  1630. (put a 'c!:clash (c!:insert1 b (get a 'c!:clash)))
  1631. (put b 'c!:clash (c!:insert1 a (get b 'c!:clash)))) )))
  1632. (de c!:build_clash_matrix (all_blocks)
  1633. (prog nil
  1634. (prog (b)
  1635. (setq b all_blocks)
  1636. lab (cond ((null b) (return nil)))
  1637. ((lambda (b)
  1638. (prog (live w)
  1639. (prog (x)
  1640. (setq x (get b 'c!:where_to))
  1641. lab (cond ((null x) (return nil)))
  1642. ((lambda (x)
  1643. (cond
  1644. ((atom x) (setq live (union live (get x 'c!:live))))
  1645. (t (setq live (union live x)))) )
  1646. (car x))
  1647. (setq x (cdr x))
  1648. (go lab))
  1649. (setq w (get b 'c!:why))
  1650. (cond
  1651. ((not (atom w))
  1652. (progn
  1653. (setq live (union live (cdr w)))
  1654. (cond
  1655. ((and
  1656. (eqcar (car w) 'call)
  1657. (not (get (cadar w) 'c!:direct_entrypoint))
  1658. (not (get (cadar w) 'c!:c_entrypoint)))
  1659. (setq live (union '(env) live)))) )))
  1660. (prog (s)
  1661. (setq s (get b 'c!:contents))
  1662. lab (cond ((null s) (return nil)))
  1663. ((lambda (s)
  1664. (prog (op r1 r2 r3)
  1665. (setq op (car s))
  1666. (setq r1 (cadr s))
  1667. (setq r2 (caddr s))
  1668. (setq r3 (cadddr s))
  1669. (cond
  1670. ((flagp op 'c!:set_r1)
  1671. (cond
  1672. ((memq r1 live)
  1673. (progn
  1674. (setq live (delete r1 live))
  1675. (cond
  1676. ((equal op 'reloadenv)
  1677. (setq reloadenv t)))
  1678. (prog (v)
  1679. (setq v live)
  1680. lab (cond ((null v) (return nil)))
  1681. ((lambda (v) (c!:clash r1 v))
  1682. (car v))
  1683. (setq v (cdr v))
  1684. (go lab))))
  1685. ((equal op 'call) nil)
  1686. (t (progn
  1687. (setq op 'nop)
  1688. (rplacd s (cons (car s) (cdr s)))
  1689. (rplaca s op)))) ))
  1690. (cond
  1691. ((flagp op 'c!:read_r1)
  1692. (setq live (union live (list r1)))) )
  1693. (cond
  1694. ((flagp op 'c!:read_r2)
  1695. (setq live (union live (list r2)))) )
  1696. (cond
  1697. ((flagp op 'c!:read_r3)
  1698. (setq live (union live (list r3)))) )
  1699. (cond
  1700. ((equal op 'call) (setq live (union live r2))))
  1701. (cond
  1702. ((flagp op 'c!:read_env)
  1703. (setq live (union live '(env)))) )))
  1704. (car s))
  1705. (setq s (cdr s))
  1706. (go lab))))
  1707. (car b))
  1708. (setq b (cdr b))
  1709. (go lab))
  1710. (return nil)))
  1711. (de c!:allocate_registers (rl)
  1712. (prog (schedule neighbours allocation)
  1713. (setq neighbours 0)
  1714. (prog nil
  1715. !G61 (cond ((not rl) (return nil)))
  1716. (prog (w x)
  1717. (setq w rl)
  1718. (prog nil
  1719. !G62 (cond
  1720. ((not
  1721. (and
  1722. w
  1723. (greaterp
  1724. (length (setq x (get (car w) 'c!:clash)))
  1725. neighbours)))
  1726. (return nil)))
  1727. (setq w (cdr w))
  1728. (go !G62))
  1729. (cond
  1730. (w
  1731. (progn
  1732. (setq schedule (cons (car w) schedule))
  1733. (setq rl (deleq (car w) rl))
  1734. (prog (r)
  1735. (setq r x)
  1736. lab (cond ((null r) (return nil)))
  1737. ((lambda (r)
  1738. (put
  1739. r
  1740. 'c!:clash
  1741. (deleq (car w) (get r 'c!:clash))))
  1742. (car r))
  1743. (setq r (cdr r))
  1744. (go lab))))
  1745. (t (setq neighbours (plus neighbours 1)))) )
  1746. (go !G61))
  1747. (prog (r)
  1748. (setq r schedule)
  1749. lab (cond ((null r) (return nil)))
  1750. ((lambda (r)
  1751. (prog (poss)
  1752. (setq poss allocation)
  1753. (prog (x)
  1754. (setq x (get r 'c!:clash))
  1755. lab (cond ((null x) (return nil)))
  1756. ((lambda (x) (setq poss (deleq (get x 'c!:chosen) poss)))
  1757. (car x))
  1758. (setq x (cdr x))
  1759. (go lab))
  1760. (cond
  1761. ((null poss)
  1762. (progn
  1763. (setq poss (c!:my_gensym))
  1764. (setq allocation (append allocation (list poss)))) )
  1765. (t (setq poss (car poss))))
  1766. (put r 'c!:chosen poss)))
  1767. (car r))
  1768. (setq r (cdr r))
  1769. (go lab))
  1770. (return allocation)))
  1771. (de c!:remove_nops (all_blocks)
  1772. (prog (b)
  1773. (setq b all_blocks)
  1774. lab (cond ((null b) (return nil)))
  1775. ((lambda (b)
  1776. (prog (r)
  1777. (prog (s)
  1778. (setq s (get b 'c!:contents))
  1779. lab (cond ((null s) (return nil)))
  1780. ((lambda (s)
  1781. (cond
  1782. ((not (eqcar s 'nop))
  1783. (prog (op r1 r2 r3)
  1784. (setq op (car s))
  1785. (setq r1 (cadr s))
  1786. (setq r2 (caddr s))
  1787. (setq r3 (cadddr s))
  1788. (cond
  1789. ((or
  1790. (flagp op 'c!:set_r1)
  1791. (flagp op 'c!:read_r1))
  1792. (setq r1 (get r1 'c!:chosen))))
  1793. (cond
  1794. ((flagp op 'c!:read_r2)
  1795. (setq r2 (get r2 'c!:chosen))))
  1796. (cond
  1797. ((flagp op 'c!:read_r3)
  1798. (setq r3 (get r3 'c!:chosen))))
  1799. (cond
  1800. ((equal op 'call)
  1801. (setq r2
  1802. (prog (v !G63 endptr)
  1803. (setq v r2)
  1804. (cond ((null v) (return nil)))
  1805. (setq !G63
  1806. (setq endptr
  1807. (cons
  1808. ((lambda (v)
  1809. (get v 'c!:chosen))
  1810. (car v))
  1811. nil)))
  1812. looplabel
  1813. (setq v (cdr v))
  1814. (cond ((null v) (return !G63)))
  1815. (rplacd
  1816. endptr
  1817. (cons
  1818. ((lambda (v)
  1819. (get v 'c!:chosen))
  1820. (car v))
  1821. nil))
  1822. (setq endptr (cdr endptr))
  1823. (go looplabel)))) )
  1824. (cond
  1825. ((not (and (equal op 'movr) (equal r1 r3)))
  1826. (setq r
  1827. (cons (list op r1 r2 r3) r)))) ))) )
  1828. (car s))
  1829. (setq s (cdr s))
  1830. (go lab))
  1831. (put b 'c!:contents (reversip r))
  1832. (setq r (get b 'c!:why))
  1833. (cond
  1834. ((not (atom r))
  1835. (put
  1836. b
  1837. 'c!:why
  1838. (cons
  1839. (car r)
  1840. (prog (v !G64 endptr)
  1841. (setq v (cdr r))
  1842. (cond ((null v) (return nil)))
  1843. (setq !G64
  1844. (setq endptr
  1845. (cons
  1846. ((lambda (v) (get v 'c!:chosen)) (car v))
  1847. nil)))
  1848. looplabel
  1849. (setq v (cdr v))
  1850. (cond ((null v) (return !G64)))
  1851. (rplacd
  1852. endptr
  1853. (cons
  1854. ((lambda (v) (get v 'c!:chosen)) (car v))
  1855. nil))
  1856. (setq endptr (cdr endptr))
  1857. (go looplabel)))) ))) )
  1858. (car b))
  1859. (setq b (cdr b))
  1860. (go lab)))
  1861. (fluid '(error_labels))
  1862. (de c!:find_error_label (why env depth)
  1863. (prog (w z)
  1864. (setq z (list why env depth))
  1865. (setq w (assoc!*!* z error_labels))
  1866. (cond
  1867. ((null w)
  1868. (progn
  1869. (setq w (cons z (c!:my_gensym)))
  1870. (setq error_labels (cons w error_labels)))) )
  1871. (return (cdr w))))
  1872. (de c!:assign (u v c)
  1873. (cond
  1874. ((flagp u 'fluid) (cons (list 'strglob v u (c!:find_literal u)) c))
  1875. (t (cons (list 'movr u nil v) c))))
  1876. (de c!:insert_tailcall (b)
  1877. (prog (why dest contents fcall res w)
  1878. (setq why (get b 'c!:why))
  1879. (setq dest (get b 'c!:where_to))
  1880. (setq contents (get b 'c!:contents))
  1881. (prog nil
  1882. !G65 (cond
  1883. ((not (and contents (not (eqcar (car contents) 'call))))
  1884. (return nil)))
  1885. (progn
  1886. (setq w (cons (car contents) w))
  1887. (setq contents (cdr contents)))
  1888. (go !G65))
  1889. (cond ((null contents) (return nil)))
  1890. (setq fcall (car contents))
  1891. (setq contents (cdr contents))
  1892. (setq res (cadr fcall))
  1893. (prog nil
  1894. !G66 (cond ((not w) (return nil)))
  1895. (progn
  1896. (cond
  1897. ((eqcar (car w) 'reloadenv) (setq w (cdr w)))
  1898. ((and (eqcar (car w) 'movr) (equal (cadddr (car w)) res))
  1899. (progn (setq res (cadr (car w))) (setq w (cdr w))))
  1900. (t (setq res (setq w nil)))) )
  1901. (go !G66))
  1902. (cond ((null res) (return nil)))
  1903. (cond
  1904. ((c!:does_return res why dest)
  1905. (cond
  1906. ((equal (car (cadddr fcall)) current_procedure)
  1907. (progn
  1908. (prog (p)
  1909. (setq p (pair current_args (caddr fcall)))
  1910. lab (cond ((null p) (return nil)))
  1911. ((lambda (p)
  1912. (setq contents
  1913. (c!:assign (car p) (cdr p) contents)))
  1914. (car p))
  1915. (setq p (cdr p))
  1916. (go lab))
  1917. (put b 'c!:contents contents)
  1918. (put b 'c!:why 'goto)
  1919. (put b 'c!:where_to (list restart_label))))
  1920. (t (progn
  1921. (setq nil_used t)
  1922. (put b 'c!:contents contents)
  1923. (put
  1924. b
  1925. 'c!:why
  1926. (cons
  1927. (list 'call (car (cadddr fcall)))
  1928. (caddr fcall)))
  1929. (put b 'c!:where_to nil)))) ))) )
  1930. (de c!:does_return (res why where_to)
  1931. (cond
  1932. ((not (equal why 'goto)) nil)
  1933. ((not (atom (car where_to))) (equal res (caar where_to)))
  1934. (t (prog (contents)
  1935. (setq where_to (car where_to))
  1936. (setq contents (reverse (get where_to 'c!:contents)))
  1937. (setq why (get where_to 'c!:why))
  1938. (setq where_to (get where_to 'c!:where_to))
  1939. (prog nil
  1940. !G67 (cond ((not contents) (return nil)))
  1941. (cond
  1942. ((eqcar (car contents) 'reloadenv)
  1943. (setq contents (cdr contents)))
  1944. ((and
  1945. (eqcar (car contents) 'movr)
  1946. (equal (cadddr (car contents)) res))
  1947. (progn
  1948. (setq res (cadr (car contents)))
  1949. (setq contents (cdr contents))))
  1950. (t (setq res (setq contents nil))))
  1951. (go !G67))
  1952. (cond
  1953. ((null res) (return nil))
  1954. (t (return (c!:does_return res why where_to)))) ))) )
  1955. (de c!:pushpop (op v)
  1956. (prog (n w)
  1957. (cond ((null v) (return nil)))
  1958. (setq n (length v))
  1959. (cond
  1960. ((equal n 1)
  1961. (return (c!:printf1 " %s(%s);\n" (list op (car v)))) ))
  1962. (prog nil
  1963. !G68 (cond ((not (greaterp n 0)) (return nil)))
  1964. (progn
  1965. (setq w n)
  1966. (cond ((greaterp w 6) (setq w 6)))
  1967. (setq n (difference n w))
  1968. (c!:printf1 " %s%d(%s" (list op w (car v)))
  1969. (setq v (cdr v))
  1970. (prog (i)
  1971. (setq i 2)
  1972. lab (cond ((minusp (difference w i)) (return nil)))
  1973. (progn (c!:printf1 ",%s" (list (car v))) (setq v (cdr v)))
  1974. (setq i (plus2 i 1))
  1975. (go lab))
  1976. (c!:printf1 ");\n" (list)))
  1977. (go !G68))))
  1978. (de c!:optimise_flowgraph (startpoint all_blocks env argch args)
  1979. (prog (w n locs stacks error_labels fn_used nil_used nilbase_used)
  1980. (prog (b)
  1981. (setq b all_blocks)
  1982. lab (cond ((null b) (return nil)))
  1983. ((lambda (b) (c!:insert_tailcall b)) (car b))
  1984. (setq b (cdr b))
  1985. (go lab))
  1986. (setq startpoint (c!:branch_chain startpoint nil))
  1987. (remflag all_blocks 'c!:visited)
  1988. (c!:live_variable_analysis all_blocks)
  1989. (c!:build_clash_matrix all_blocks)
  1990. (cond ((and error_labels env) (setq reloadenv t)))
  1991. (prog (u)
  1992. (setq u env)
  1993. lab (cond ((null u) (return nil)))
  1994. ((lambda (u)
  1995. (prog (v)
  1996. (setq v env)
  1997. lab (cond ((null v) (return nil)))
  1998. ((lambda (v) (c!:clash (cdr u) (cdr v))) (car v))
  1999. (setq v (cdr v))
  2000. (go lab)))
  2001. (car u))
  2002. (setq u (cdr u))
  2003. (go lab))
  2004. (setq locs (c!:allocate_registers registers))
  2005. (setq stacks (c!:allocate_registers stacklocs))
  2006. (flag stacks 'c!:live_across_call)
  2007. (c!:remove_nops all_blocks)
  2008. (setq startpoint (c!:branch_chain startpoint nil))
  2009. (remflag all_blocks 'c!:visited)
  2010. (setq startpoint (c!:branch_chain startpoint t))
  2011. (remflag all_blocks 'c!:visited)
  2012. (cond (does_call (setq nil_used t)))
  2013. (cond
  2014. (nil_used (c!:printf1 " Lisp_Object nil = C_nil;\n" (list)))
  2015. (nilbase_used (c!:printf1 " nil_as_base\n" (list))))
  2016. (cond
  2017. (locs
  2018. (progn
  2019. (c!:printf1 " Lisp_Object %s" (list (car locs)))
  2020. (prog (v)
  2021. (setq v (cdr locs))
  2022. lab (cond ((null v) (return nil)))
  2023. ((lambda (v) (c!:printf1 ", %s" (list v))) (car v))
  2024. (setq v (cdr v))
  2025. (go lab))
  2026. (c!:printf1 ";\n" (list)))) )
  2027. (cond (fn_used (c!:printf1 " Lisp_Object fn;\n" (list))))
  2028. (cond
  2029. ((or (equal (car argch) 0) (geq (car argch) 3))
  2030. (c!:printf1
  2031. " argcheck(nargs, %s, \q%s\q);\n"
  2032. (list (car argch) (cdr argch)))) )
  2033. (cond
  2034. (does_call
  2035. (progn
  2036. (c!:printf1 " if (stack >= stacklimit)\n" (list))
  2037. (c!:printf1 " {\n" (list))
  2038. (c!:pushpop 'push args)
  2039. (c!:printf1
  2040. " env = reclaim(env, \qstack\q, GC_STACK, 0);\n"
  2041. (list))
  2042. (c!:pushpop 'pop (reverse args))
  2043. (c!:printf1 " nil = C_nil;\n" (list))
  2044. (c!:printf1
  2045. " if (exception_pending()) return nil;\n"
  2046. (list))
  2047. (c!:printf1 " }\n" (list)))) )
  2048. (cond
  2049. (reloadenv (c!:printf1 " push(env);\n" (list)))
  2050. (t (c!:printf1 " CSL_IGNORE(env);\n" (list))))
  2051. (setq n 0)
  2052. (cond
  2053. (stacks
  2054. (progn
  2055. (c!:printf1
  2056. "/* space for vars preserved across procedure calls */\n"
  2057. (list))
  2058. (prog (v)
  2059. (setq v stacks)
  2060. lab (cond ((null v) (return nil)))
  2061. ((lambda (v)
  2062. (progn (put v 'c!:location n) (setq n (plus n 1))))
  2063. (car v))
  2064. (setq v (cdr v))
  2065. (go lab))
  2066. (setq w n)
  2067. (prog nil
  2068. !G69 (cond ((not (geq w 5)) (return nil)))
  2069. (progn
  2070. (c!:printf1
  2071. " push5(nil, nil, nil, nil, nil);\n"
  2072. (list))
  2073. (setq w (difference w 5)))
  2074. (go !G69))
  2075. (cond
  2076. ((neq w 0)
  2077. (progn
  2078. (cond
  2079. ((equal w 1)
  2080. (c!:printf1 " push(nil);\n" (list)))
  2081. (t (progn
  2082. (c!:printf1 " push%s(nil" (list w))
  2083. (prog (i)
  2084. (setq i 2)
  2085. lab (cond
  2086. ((minusp (difference w i))
  2087. (return nil)))
  2088. (c!:printf1 ", nil" (list))
  2089. (setq i (plus2 i 1))
  2090. (go lab))
  2091. (c!:printf1 ");\n" (list)))) ))) ))) )
  2092. (cond (reloadenv (progn (setq reloadenv n) (setq n (plus n 1)))) )
  2093. (cond
  2094. (env
  2095. (c!:printf1
  2096. "/* copy arguments values to proper place */\n"
  2097. (list))))
  2098. (prog (v)
  2099. (setq v env)
  2100. lab (cond ((null v) (return nil)))
  2101. ((lambda (v)
  2102. (cond
  2103. ((flagp (cdr v) 'c!:live_across_call)
  2104. (c!:printf1
  2105. " stack[%s] = %s;\n"
  2106. (list
  2107. (minus (get (get (cdr v) 'c!:chosen) 'c!:location))
  2108. (cdr v))))
  2109. (t (c!:printf1
  2110. " %s = %s;\n"
  2111. (list (get (cdr v) 'c!:chosen) (cdr v)))) ))
  2112. (car v))
  2113. (setq v (cdr v))
  2114. (go lab))
  2115. (c!:printf1 "/* end of prologue */\n" (list))
  2116. (c!:display_flowgraph startpoint n t)
  2117. (cond
  2118. (error_labels
  2119. (progn
  2120. (c!:printf1 "/* error exit handlers */\n" (list))
  2121. (prog (x)
  2122. (setq x error_labels)
  2123. lab (cond ((null x) (return nil)))
  2124. ((lambda (x)
  2125. (progn
  2126. (c!:printf1 "%s:\n" (list (cdr x)))
  2127. (c!:print_error_return
  2128. (caar x)
  2129. (cadar x)
  2130. (caddar x))))
  2131. (car x))
  2132. (setq x (cdr x))
  2133. (go lab)))) )
  2134. (remflag all_blocks 'c!:visited)))
  2135. (de c!:print_error_return (why env depth)
  2136. (prog nil
  2137. (cond
  2138. ((and reloadenv env)
  2139. (c!:printf1 " env = stack[%s];\n" (list (minus reloadenv)))) )
  2140. (cond
  2141. ((null why)
  2142. (progn
  2143. (prog (v)
  2144. (setq v env)
  2145. lab (cond ((null v) (return nil)))
  2146. ((lambda (v)
  2147. (c!:printf1
  2148. " qvalue(elt(env, %s)) = %v; /* %a */\n"
  2149. (list
  2150. (c!:find_literal (car v))
  2151. (get (cdr v) 'c!:chosen)
  2152. (car v))))
  2153. (car v))
  2154. (setq v (cdr v))
  2155. (go lab))
  2156. (cond
  2157. ((neq depth 0) (c!:printf1 " popv(%s);\n" (list depth))))
  2158. (c!:printf1 " return nil;\n" (list))))
  2159. ((flagp (cadr why) 'c!:live_across_call)
  2160. (progn
  2161. (c!:printf1
  2162. " { Lisp_Object res = %v;\n"
  2163. (list (cadr why)))
  2164. (prog (v)
  2165. (setq v env)
  2166. lab (cond ((null v) (return nil)))
  2167. ((lambda (v)
  2168. (c!:printf1
  2169. " qvalue(elt(env, %s)) = %v;\n"
  2170. (list
  2171. (c!:find_literal (car v))
  2172. (get (cdr v) 'c!:chosen))))
  2173. (car v))
  2174. (setq v (cdr v))
  2175. (go lab))
  2176. (cond
  2177. ((neq depth 0)
  2178. (c!:printf1 " popv(%s);\n" (list depth))))
  2179. (c!:printf1
  2180. " return error(1, %s, res); }\n"
  2181. (list
  2182. (cond
  2183. ((eqcar why 'car) "err_bad_car")
  2184. ((eqcar why 'cdr) "err_bad_cdr")
  2185. (t (error 0 (list why "unknown_error")))) ))) )
  2186. (t (progn
  2187. (prog (v)
  2188. (setq v env)
  2189. lab (cond ((null v) (return nil)))
  2190. ((lambda (v)
  2191. (c!:printf1
  2192. " qvalue(elt(env, %s)) = %v;\n"
  2193. (list
  2194. (c!:find_literal (car v))
  2195. (get (cdr v) 'c!:chosen))))
  2196. (car v))
  2197. (setq v (cdr v))
  2198. (go lab))
  2199. (cond
  2200. ((neq depth 0) (c!:printf1 " popv(%s);\n" (list depth))))
  2201. (c!:printf1
  2202. " return error(1, %s, %v);\n"
  2203. (list
  2204. (cond
  2205. ((eqcar why 'car) "err_bad_car")
  2206. ((eqcar why 'cdr) "err_bad_cdr")
  2207. (t (error 0 (list why "unknown_error"))))
  2208. (cadr why)))) ))) )
  2209. (de c!:cand (u env)
  2210. (prog (w r)
  2211. (setq w (reverse (cdr u)))
  2212. (cond ((null w) (return (c!:cval nil env))))
  2213. (setq r (list (list 't (car w))))
  2214. (setq w (cdr w))
  2215. (prog (z)
  2216. (setq z w)
  2217. lab (cond ((null z) (return nil)))
  2218. ((lambda (z) (setq r (cons (list (list 'null z) nil) r))) (car z))
  2219. (setq z (cdr z))
  2220. (go lab))
  2221. (setq r (cons 'cond r))
  2222. (return (c!:cval r env))))
  2223. (put 'and 'c!:code (function c!:cand))
  2224. (de c!:ccatch (u env) (error 0 "catch"))
  2225. (put 'catch 'c!:code (function c!:ccatch))
  2226. (de c!:ccompile_let (u env) (error 0 "compiler-let"))
  2227. (put 'compiler!-let 'c!:code (function c!:ccompiler_let))
  2228. (de c!:ccond (u env)
  2229. (prog (v conc)
  2230. (setq v (c!:newreg))
  2231. (setq conc (c!:my_gensym))
  2232. (prog (c)
  2233. (setq c (cdr u))
  2234. lab (cond ((null c) (return nil)))
  2235. ((lambda (c)
  2236. (prog (l1 l2)
  2237. (setq l1 (c!:my_gensym))
  2238. (setq l2 (c!:my_gensym))
  2239. (cond
  2240. ((atom (cdr c))
  2241. (progn
  2242. (c!:outop 'movr v nil (c!:cval (car c) env))
  2243. (c!:endblock (list 'ifnull v) (list l2 conc))))
  2244. (t (progn
  2245. (c!:cjumpif (car c) env l1 l2)
  2246. (c!:startblock l1)
  2247. (c!:outop
  2248. 'movr
  2249. v
  2250. nil
  2251. (c!:cval (cons 'progn (cdr c)) env))
  2252. (c!:endblock 'goto (list conc)))) )
  2253. (c!:startblock l2)))
  2254. (car c))
  2255. (setq c (cdr c))
  2256. (go lab))
  2257. (c!:outop 'movk1 v nil nil)
  2258. (c!:endblock 'goto (list conc))
  2259. (c!:startblock conc)
  2260. (return v)))
  2261. (put 'cond 'c!:code (function c!:ccond))
  2262. (de c!:cdeclare (u env) (error 0 "declare"))
  2263. (put 'declare 'c!:code (function c!:cdeclare))
  2264. (de c!:cde (u env) (error 0 "de"))
  2265. (put 'de 'c!:code (function c!:cde))
  2266. (de c!:cdefun (u env) (error 0 "defun"))
  2267. (put '!~defun 'c!:code (function c!:cdefun))
  2268. (de c!:ceval_when (u env) (error 0 "eval-when"))
  2269. (put 'eval!-when 'c!:code (function c!:ceval_when))
  2270. (de c!:cflet (u env) (error 0 "flet"))
  2271. (put 'flet 'c!:code (function c!:cflet))
  2272. (de c!:cfunction (u env)
  2273. (prog (v)
  2274. (setq u (cadr u))
  2275. (cond
  2276. ((not (atom u))
  2277. (progn
  2278. (cond
  2279. ((not (eqcar u 'lambda))
  2280. (error 0 (list "lambda expression needed" u))))
  2281. (setq v (dated!-name 'lambda))
  2282. (setq pending_functions
  2283. (cons (cons 'de (cons v (cdr u))) pending_functions))
  2284. (setq u v))))
  2285. (setq v (c!:newreg))
  2286. (c!:outop 'movk v u (c!:find_literal u))
  2287. (return v)))
  2288. (put 'function 'c!:code (function c!:cfunction))
  2289. (de c!:cgo (u env)
  2290. (prog (w w1)
  2291. (setq w1 proglabs)
  2292. (prog nil
  2293. !G70 (cond ((not (and (null w) w1)) (return nil)))
  2294. (progn (setq w (assoc!*!* (cadr u) (car w1))) (setq w1 (cdr w1)))
  2295. (go !G70))
  2296. (cond ((null w) (error 0 (list u "label not set"))))
  2297. (c!:endblock 'goto (list (cadr w)))
  2298. (return nil)))
  2299. (put 'go 'c!:code (function c!:cgo))
  2300. (de c!:cif (u env)
  2301. (prog (v conc l1 l2)
  2302. (setq v (c!:newreg))
  2303. (setq conc (c!:my_gensym))
  2304. (setq l1 (c!:my_gensym))
  2305. (setq l2 (c!:my_gensym))
  2306. (c!:cjumpif (cadr u) env l1 l2)
  2307. (c!:startblock l1)
  2308. (c!:outop 'movr v nil (c!:cval (car (setq u (cddr u))) env))
  2309. (c!:endblock 'goto (list conc))
  2310. (c!:startblock l2)
  2311. (c!:outop 'movr v nil (c!:cval (cadr u) env))
  2312. (c!:endblock 'goto (list conc))
  2313. (c!:startblock conc)
  2314. (return v)))
  2315. (put 'if 'c!:code (function c!:cif))
  2316. (de c!:clabels (u env) (error 0 "labels"))
  2317. (put 'labels 'c!:code (function c!:clabels))
  2318. (de c!:expand!-let (vl b)
  2319. (cond
  2320. ((null vl) (cons 'progn b))
  2321. ((null (cdr vl)) (c!:expand!-let!* vl b))
  2322. (t (prog (vars vals)
  2323. (prog (v)
  2324. (setq v vl)
  2325. lab (cond ((null v) (return nil)))
  2326. ((lambda (v)
  2327. (cond
  2328. ((atom v)
  2329. (progn
  2330. (setq vars (cons v vars))
  2331. (setq vals (cons nil vals))))
  2332. ((atom (cdr v))
  2333. (progn
  2334. (setq vars (cons (car v) vars))
  2335. (setq vals (cons nil vals))))
  2336. (t (progn
  2337. (setq vars (cons (car v) vars))
  2338. (setq vals (cons (cadr v) vals)))) ))
  2339. (car v))
  2340. (setq v (cdr v))
  2341. (go lab))
  2342. (return (cons (cons 'lambda (cons vars b)) vals)))) ))
  2343. (de c!:clet (x env) (c!:cval (c!:expand!-let (cadr x) (cddr x)) env))
  2344. (put '!~let 'c!:code (function c!:clet))
  2345. (de c!:expand!-let!* (vl b)
  2346. (cond
  2347. ((null vl) (cons 'progn b))
  2348. (t (prog (var val)
  2349. (setq var (car vl))
  2350. (cond
  2351. ((not (atom var))
  2352. (progn
  2353. (setq val (cdr var))
  2354. (setq var (car var))
  2355. (cond ((not (atom val)) (setq val (car val)))) )))
  2356. (setq b (list (list 'return (c!:expand!-let!* (cdr vl) b))))
  2357. (cond (val (setq b (cons (list 'setq var val) b))))
  2358. (return (cons 'prog (cons (list var) b)))) )))
  2359. (de c!:clet!* (x env) (c!:cval (c!:expand!-let!* (cadr x) (cddr x)) env))
  2360. (put 'let!* 'c!:code (function c!:clet!*))
  2361. (de c!:clist (u env)
  2362. (cond
  2363. ((null (cdr u)) (c!:cval nil env))
  2364. ((null (cddr u)) (c!:cval (cons 'ncons (cdr u)) env))
  2365. ((eqcar (cadr u) 'cons)
  2366. (c!:cval
  2367. (list
  2368. 'acons
  2369. (cadr (cadr u))
  2370. (caddr (cadr u))
  2371. (cons 'list (cddr u)))
  2372. env))
  2373. ((null (cdddr u)) (c!:cval (cons 'list2 (cdr u)) env))
  2374. (t (c!:cval
  2375. (list 'list2!* (cadr u) (caddr u) (cons 'list (cdddr u)))
  2376. env))))
  2377. (put 'list 'c!:code (function c!:clist))
  2378. (de c!:clist!* (u env)
  2379. (prog (v)
  2380. (setq u (reverse (cdr u)))
  2381. (setq v (car u))
  2382. (prog (a)
  2383. (setq a (cdr u))
  2384. lab (cond ((null a) (return nil)))
  2385. ((lambda (a) (setq v (list 'cons a v))) (car a))
  2386. (setq a (cdr a))
  2387. (go lab))
  2388. (return (c!:cval v env))))
  2389. (put 'list!* 'c!:code (function c!:clist!*))
  2390. (de c!:ccons (u env)
  2391. (prog (a1 a2)
  2392. (setq a1 (s!:improve (cadr u)))
  2393. (setq a2 (s!:improve (caddr u)))
  2394. (cond
  2395. ((or (equal a2 nil) (equal a2 ''nil) (equal a2 '(list)))
  2396. (return (c!:cval (list 'ncons a1) env))))
  2397. (cond
  2398. ((eqcar a1 'cons)
  2399. (return (c!:cval (list 'acons (cadr a1) (caddr a1) a2) env))))
  2400. (cond
  2401. ((eqcar a2 'cons)
  2402. (return (c!:cval (list 'list2!* a1 (cadr a2) (caddr a2)) env))))
  2403. (cond
  2404. ((eqcar a2 'list)
  2405. (return
  2406. (c!:cval
  2407. (list
  2408. 'cons
  2409. a1
  2410. (list 'cons (cadr a2) (cons 'list (cddr a2))))
  2411. env))))
  2412. (return (c!:ccall (car u) (cdr u) env))))
  2413. (put 'cons 'c!:code (function c!:ccons))
  2414. (de c!:cget (u env)
  2415. (prog (a1 a2 w r r1)
  2416. (setq a1 (s!:improve (cadr u)))
  2417. (setq a2 (s!:improve (caddr u)))
  2418. (cond
  2419. ((and
  2420. (eqcar a2 'quote)
  2421. (idp (setq w (cadr a2)))
  2422. (setq w (symbol!-make!-fastget w nil)))
  2423. (progn
  2424. (setq r (c!:newreg))
  2425. (c!:outop 'fastget r (c!:cval a1 env) (cons w (cadr a2)))
  2426. (return r)))
  2427. (t (return (c!:ccall (car u) (cdr u) env)))) ))
  2428. (put 'get 'c!:code (function c!:cget))
  2429. (de c!:cflag (u env)
  2430. (prog (a1 a2 w r r1)
  2431. (setq a1 (s!:improve (cadr u)))
  2432. (setq a2 (s!:improve (caddr u)))
  2433. (cond
  2434. ((and
  2435. (eqcar a2 'quote)
  2436. (idp (setq w (cadr a2)))
  2437. (setq w (symbol!-make!-fastget w nil)))
  2438. (progn
  2439. (setq r (c!:newreg))
  2440. (c!:outop 'fastflag r (c!:cval a1 env) (cons w (cadr a2)))
  2441. (return r)))
  2442. (t (return (c!:ccall (car u) (cdr u) env)))) ))
  2443. (put 'flagp 'c!:code (function c!:cflag))
  2444. (de c!:cgetv (u env)
  2445. (cond
  2446. ((not !*fastvector) (c!:ccall (car u) (cdr u) env))
  2447. (t (c!:cval (cons 'qgetv (cdr u)) env))))
  2448. (put 'getv 'c!:code (function c!:cgetv))
  2449. (de c!:cputv (u env)
  2450. (cond
  2451. ((not !*fastvector) (c!:ccall (car u) (cdr u) env))
  2452. (t (c!:cval (cons 'qputv (cdr u)) env))))
  2453. (put 'putv 'c!:code (function c!:cputv))
  2454. (de c!:cqputv (x env)
  2455. (prog (rr)
  2456. (setq rr (c!:pareval (cdr x) env))
  2457. (c!:outop 'qputv (caddr rr) (car rr) (cadr rr))
  2458. (return (caddr rr))))
  2459. (put 'qputv 'c!:code (function c!:cqputv))
  2460. (de c!:cmacrolet (u env) (error 0 "macrolet"))
  2461. (put 'macrolet 'c!:code (function c!:cmacrolet))
  2462. (de c!:cmultiple_value_call (u env) (error 0 "multiple_value_call"))
  2463. (put 'multiple!-value!-call 'c!:code (function c!:cmultiple_value_call))
  2464. (de c!:cmultiple_value_prog1 (u env) (error 0 "multiple_value_prog1"))
  2465. (put 'multiple!-value!-prog1 'c!:code (function c!:cmultiple_value_prog1))
  2466. (de c!:cor (u env)
  2467. (prog (next done v r)
  2468. (setq v (c!:newreg))
  2469. (setq done (c!:my_gensym))
  2470. (setq u (cdr u))
  2471. (prog nil
  2472. !G71 (cond ((not (cdr u)) (return nil)))
  2473. (progn
  2474. (setq next (c!:my_gensym))
  2475. (c!:outop 'movr v nil (c!:cval (car u) env))
  2476. (setq u (cdr u))
  2477. (c!:endblock (list 'ifnull v) (list next done))
  2478. (c!:startblock next))
  2479. (go !G71))
  2480. (c!:outop 'movr v nil (c!:cval (car u) env))
  2481. (c!:endblock 'goto (list done))
  2482. (c!:startblock done)
  2483. (return v)))
  2484. (put 'or 'c!:code (function c!:cor))
  2485. (de c!:cprog (u env)
  2486. (prog (w w1 bvl local_proglabs progret progexit fluids env1)
  2487. (setq env1 (car env))
  2488. (setq bvl (cadr u))
  2489. (prog (v)
  2490. (setq v bvl)
  2491. lab (cond ((null v) (return nil)))
  2492. ((lambda (v)
  2493. (cond
  2494. ((globalp v) (error 0 (list v "attempt to bind a global")))
  2495. ((fluidp v)
  2496. (progn
  2497. (setq fluids (cons (cons v (c!:newreg)) fluids))
  2498. (flag (list (cdar fluids)) 'c!:live_across_call)
  2499. (setq env1
  2500. (cons (cons 'c!:dummy!:name (cdar fluids)) env1))
  2501. (c!:outop 'ldrglob (cdar fluids) v (c!:find_literal v))
  2502. (c!:outop 'nilglob nil v (c!:find_literal v))))
  2503. (t (progn
  2504. (setq env1 (cons (cons v (c!:newreg)) env1))
  2505. (c!:outop 'movk1 (cdar env1) nil nil)))) )
  2506. (car v))
  2507. (setq v (cdr v))
  2508. (go lab))
  2509. (cond (fluids (c!:outop 'fluidbind nil nil fluids)))
  2510. (setq env (cons env1 (append fluids (cdr env))))
  2511. (setq u (cddr u))
  2512. (setq progret (c!:newreg))
  2513. (setq progexit (c!:my_gensym))
  2514. (setq blockstack (cons (cons nil (cons progret progexit)) blockstack))
  2515. (prog (a)
  2516. (setq a u)
  2517. lab (cond ((null a) (return nil)))
  2518. ((lambda (a)
  2519. (cond
  2520. ((atom a)
  2521. (cond
  2522. ((atsoc a local_proglabs)
  2523. (progn
  2524. (cond
  2525. ((not (null a))
  2526. (progn
  2527. (setq w (wrs nil))
  2528. (princ "+++++ multiply defined label: ")
  2529. (prin a)
  2530. (terpri)
  2531. (wrs w)))) ))
  2532. (t (setq local_proglabs
  2533. (cons
  2534. (list a (c!:my_gensym))
  2535. local_proglabs)))) )))
  2536. (car a))
  2537. (setq a (cdr a))
  2538. (go lab))
  2539. (setq proglabs (cons local_proglabs proglabs))
  2540. (prog (a)
  2541. (setq a u)
  2542. lab (cond ((null a) (return nil)))
  2543. ((lambda (a)
  2544. (cond
  2545. ((atom a)
  2546. (progn
  2547. (setq w (cdr (assoc!*!* a local_proglabs)))
  2548. (cond
  2549. ((null (cdr w))
  2550. (progn
  2551. (rplacd w t)
  2552. (c!:endblock 'goto (list (car w)))
  2553. (c!:startblock (car w)))) )))
  2554. (t (c!:cval a env))))
  2555. (car a))
  2556. (setq a (cdr a))
  2557. (go lab))
  2558. (c!:outop 'movk1 progret nil nil)
  2559. (c!:endblock 'goto (list progexit))
  2560. (c!:startblock progexit)
  2561. (prog (v)
  2562. (setq v fluids)
  2563. lab (cond ((null v) (return nil)))
  2564. ((lambda (v)
  2565. (c!:outop 'strglob (cdr v) (car v) (c!:find_literal (car v))))
  2566. (car v))
  2567. (setq v (cdr v))
  2568. (go lab))
  2569. (setq blockstack (cdr blockstack))
  2570. (setq proglabs (cdr proglabs))
  2571. (return progret)))
  2572. (put 'prog 'c!:code (function c!:cprog))
  2573. (de c!:cprog!* (u env) (error 0 "prog*"))
  2574. (put 'prog!* 'c!:code (function c!:cprog!*))
  2575. (de c!:cprog1 (u env)
  2576. (prog (g)
  2577. (setq g (c!:my_gensym))
  2578. (setq g
  2579. (list 'prog (list g) (list 'setq g (cadr u)) (cons 'progn (cddr u))
  2580. (list 'return g)))
  2581. (return (c!:cval g env))))
  2582. (put 'prog1 'c!:code (function c!:cprog1))
  2583. (de c!:cprog2 (u env)
  2584. (prog (g)
  2585. (setq u (cdr u))
  2586. (setq g (c!:my_gensym))
  2587. (setq g
  2588. (list 'prog (list g) (list 'setq g (cadr u)) (cons 'progn (cddr u))
  2589. (list 'return g)))
  2590. (setq g (list 'progn (car u) g))
  2591. (return (c!:cval g env))))
  2592. (put 'prog2 'c!:code (function c!:cprog2))
  2593. (de c!:cprogn (u env)
  2594. (prog (r)
  2595. (setq u (cdr u))
  2596. (cond ((equal u nil) (setq u '(nil))))
  2597. (prog (s)
  2598. (setq s u)
  2599. lab (cond ((null s) (return nil)))
  2600. ((lambda (s) (setq r (c!:cval s env))) (car s))
  2601. (setq s (cdr s))
  2602. (go lab))
  2603. (return r)))
  2604. (put 'progn 'c!:code (function c!:cprogn))
  2605. (de c!:cprogv (u env) (error 0 "progv"))
  2606. (put 'progv 'c!:code (function c!:cprogv))
  2607. (de c!:cquote (u env)
  2608. (prog (v)
  2609. (setq u (cadr u))
  2610. (setq v (c!:newreg))
  2611. (cond
  2612. ((or (null u) (equal u 't) (c!:small_number u))
  2613. (c!:outop 'movk1 v nil u))
  2614. (t (c!:outop 'movk v u (c!:find_literal u))))
  2615. (return v)))
  2616. (put 'quote 'c!:code (function c!:cquote))
  2617. (de c!:creturn (u env)
  2618. (prog (w)
  2619. (setq w (assoc!*!* nil blockstack))
  2620. (cond ((null w) (error "RETURN out of context")))
  2621. (c!:outop 'movr (cadr w) nil (c!:cval (cadr u) env))
  2622. (c!:endblock 'goto (list (cddr w)))
  2623. (return nil)))
  2624. (put 'return 'c!:code (function c!:creturn))
  2625. (put 'return!-from 'c!:code (function c!:creturn_from))
  2626. (de c!:csetq (u env)
  2627. (prog (v w)
  2628. (setq v (c!:cval (caddr u) env))
  2629. (setq u (cadr u))
  2630. (cond
  2631. ((not (idp u)) (error 0 (list u "bad variable in setq")))
  2632. ((setq w (c!:locally_bound u env)) (c!:outop 'movr (cdr w) nil v))
  2633. ((flagp u 'c!:constant)
  2634. (error 0 (list u "attempt to use setq on a constant")))
  2635. (t (c!:outop 'strglob v u (c!:find_literal u))))
  2636. (return v)))
  2637. (put 'setq 'c!:code (function c!:csetq))
  2638. (put 'noisy!-setq 'c!:code (function c!:csetq))
  2639. (de c!:cprivate_tagbody (u env)
  2640. (prog nil
  2641. (setq u (cdr u))
  2642. (c!:endblock 'goto (list (car u)))
  2643. (c!:startblock (car u))
  2644. (setq current_args
  2645. (prog (v !G72 endptr)
  2646. (setq v current_args)
  2647. (cond ((null v) (return nil)))
  2648. (setq !G72
  2649. (setq endptr
  2650. (cons
  2651. ((lambda (v)
  2652. (prog (z)
  2653. (setq z (assoc!*!* v (car env)))
  2654. (return (cond (z (cdr z)) (t v)))) )
  2655. (car v))
  2656. nil)))
  2657. looplabel
  2658. (setq v (cdr v))
  2659. (cond ((null v) (return !G72)))
  2660. (rplacd
  2661. endptr
  2662. (cons
  2663. ((lambda (v)
  2664. (prog (z)
  2665. (setq z (assoc!*!* v (car env)))
  2666. (return (cond (z (cdr z)) (t v)))) )
  2667. (car v))
  2668. nil))
  2669. (setq endptr (cdr endptr))
  2670. (go looplabel)))
  2671. (return (c!:cval (cadr u) env))))
  2672. (put 'c!:private_tagbody 'c!:code (function c!:cprivate_tagbody))
  2673. (de c!:cthe (u env) (c!:cval (caddr u) env))
  2674. (put 'the 'c!:code (function c!:cthe))
  2675. (de c!:cthrow (u env) (error 0 "throw"))
  2676. (put 'throw 'c!:code (function c!:cthrow))
  2677. (de c!:cunless (u env)
  2678. (prog (v conc l1 l2)
  2679. (setq v (c!:newreg))
  2680. (setq conc (c!:my_gensym))
  2681. (setq l1 (c!:my_gensym))
  2682. (setq l2 (c!:my_gensym))
  2683. (c!:cjumpif (cadr u) env l2 l1)
  2684. (c!:startblock l1)
  2685. (c!:outop 'movr v nil (c!:cval (cons 'progn (cddr u)) env))
  2686. (c!:endblock 'goto (list conc))
  2687. (c!:startblock l2)
  2688. (c!:outop 'movk1 v nil nil)
  2689. (c!:endblock 'goto (list conc))
  2690. (c!:startblock conc)
  2691. (return v)))
  2692. (put 'unless 'c!:code (function c!:cunless))
  2693. (de c!:cunwind_protect (u env) (error 0 "unwind_protect"))
  2694. (put 'unwind!-protect 'c!:code (function c!:cunwind_protect))
  2695. (de c!:cwhen (u env)
  2696. (prog (v conc l1 l2)
  2697. (setq v (c!:newreg))
  2698. (setq conc (c!:my_gensym))
  2699. (setq l1 (c!:my_gensym))
  2700. (setq l2 (c!:my_gensym))
  2701. (c!:cjumpif (cadr u) env l1 l2)
  2702. (c!:startblock l1)
  2703. (c!:outop 'movr v nil (c!:cval (cons 'progn (cddr u)) env))
  2704. (c!:endblock 'goto (list conc))
  2705. (c!:startblock l2)
  2706. (c!:outop 'movk1 v nil nil)
  2707. (c!:endblock 'goto (list conc))
  2708. (c!:startblock conc)
  2709. (return v)))
  2710. (put 'when 'c!:code (function c!:cwhen))
  2711. (de c!:expand_map (fnargs)
  2712. (prog (carp fn fn1 args var avar moveon l1 r s closed)
  2713. (setq fn (car fnargs))
  2714. (cond
  2715. ((or (equal fn 'mapc) (equal fn 'mapcar) (equal fn 'mapcan))
  2716. (setq carp t)))
  2717. (setq fnargs (cdr fnargs))
  2718. (cond ((atom fnargs) (error 0 "bad arguments to map function")))
  2719. (setq fn1 (cadr fnargs))
  2720. (prog nil
  2721. !G73 (cond
  2722. ((not
  2723. (or
  2724. (eqcar fn1 'function)
  2725. (and (eqcar fn1 'quote) (eqcar (cadr fn1) 'lambda))))
  2726. (return nil)))
  2727. (progn (setq fn1 (cadr fn1)) (setq closed t))
  2728. (go !G73))
  2729. (setq args (car fnargs))
  2730. (setq l1 (c!:my_gensym))
  2731. (setq r (c!:my_gensym))
  2732. (setq s (c!:my_gensym))
  2733. (setq var (c!:my_gensym))
  2734. (setq avar var)
  2735. (cond (carp (setq avar (list 'car avar))))
  2736. (cond
  2737. (closed (setq fn1 (list fn1 avar)))
  2738. (t (setq fn1 (list 'apply1 fn1 avar))))
  2739. (setq moveon (list 'setq var (list 'cdr var)))
  2740. (cond
  2741. ((or (equal fn 'map) (equal fn 'mapc))
  2742. (setq fn
  2743. (sublis
  2744. (list
  2745. (cons 'l1 l1)
  2746. (cons 'var var)
  2747. (cons 'fn fn1)
  2748. (cons 'args args)
  2749. (cons 'moveon moveon))
  2750. '(prog (var)
  2751. (setq var args)
  2752. l1 (cond ((not var) (return nil)))
  2753. fn
  2754. moveon(go l1)))) )
  2755. ((or (equal fn 'maplist) (equal fn 'mapcar))
  2756. (setq fn
  2757. (sublis
  2758. (list
  2759. (cons 'l1 l1)
  2760. (cons 'var var)
  2761. (cons 'fn fn1)
  2762. (cons 'args args)
  2763. (cons 'moveon moveon)
  2764. (cons 'r r))
  2765. '(prog (var r)
  2766. (setq var args)
  2767. l1 (cond ((not var) (return (reversip r))))
  2768. (setq r (cons fn r))
  2769. moveon(go l1)))) )
  2770. (t (setq fn
  2771. (sublis
  2772. (list
  2773. (cons 'l1 l1)
  2774. (cons 'l2 (c!:my_gensym))
  2775. (cons 'var var)
  2776. (cons 'fn fn1)
  2777. (cons 'args args)
  2778. (cons 'moveon moveon)
  2779. (cons 'r (c!:my_gensym))
  2780. (cons 's (c!:my_gensym)))
  2781. '(prog (var r s)
  2782. (setq var args)
  2783. (setq r (setq s (list nil)))
  2784. l1 (cond ((not var) (return (cdr r))))
  2785. (rplacd s fn)
  2786. l2 (cond ((not (atom (cdr s))) (setq s (cdr s)) (go l2)))
  2787. moveon(go l1)))) ))
  2788. (return fn)))
  2789. (put 'map 'c!:compile_macro (function c!:expand_map))
  2790. (put 'maplist 'c!:compile_macro (function c!:expand_map))
  2791. (put 'mapc 'c!:compile_macro (function c!:expand_map))
  2792. (put 'mapcar 'c!:compile_macro (function c!:expand_map))
  2793. (put 'mapcon 'c!:compile_macro (function c!:expand_map))
  2794. (put 'mapcan 'c!:compile_macro (function c!:expand_map))
  2795. (de c!:expand_carcdr (x)
  2796. (prog (name)
  2797. (setq name (cdr (reverse (cdr (explode2 (car x)))) ))
  2798. (setq x (cadr x))
  2799. (prog (v)
  2800. (setq v name)
  2801. lab (cond ((null v) (return nil)))
  2802. ((lambda (v) (setq x (list (cond ((equal v 'a) 'car) (t 'cdr)) x)))
  2803. (car v))
  2804. (setq v (cdr v))
  2805. (go lab))
  2806. (return x)))
  2807. (progn
  2808. (put 'caar 'c!:compile_macro (function c!:expand_carcdr))
  2809. (put 'cadr 'c!:compile_macro (function c!:expand_carcdr))
  2810. (put 'cdar 'c!:compile_macro (function c!:expand_carcdr))
  2811. (put 'cddr 'c!:compile_macro (function c!:expand_carcdr))
  2812. (put 'caaar 'c!:compile_macro (function c!:expand_carcdr))
  2813. (put 'caadr 'c!:compile_macro (function c!:expand_carcdr))
  2814. (put 'cadar 'c!:compile_macro (function c!:expand_carcdr))
  2815. (put 'caddr 'c!:compile_macro (function c!:expand_carcdr))
  2816. (put 'cdaar 'c!:compile_macro (function c!:expand_carcdr))
  2817. (put 'cdadr 'c!:compile_macro (function c!:expand_carcdr))
  2818. (put 'cddar 'c!:compile_macro (function c!:expand_carcdr))
  2819. (put 'cdddr 'c!:compile_macro (function c!:expand_carcdr))
  2820. (put 'caaaar 'c!:compile_macro (function c!:expand_carcdr))
  2821. (put 'caaadr 'c!:compile_macro (function c!:expand_carcdr))
  2822. (put 'caadar 'c!:compile_macro (function c!:expand_carcdr))
  2823. (put 'caaddr 'c!:compile_macro (function c!:expand_carcdr))
  2824. (put 'cadaar 'c!:compile_macro (function c!:expand_carcdr))
  2825. (put 'cadadr 'c!:compile_macro (function c!:expand_carcdr))
  2826. (put 'caddar 'c!:compile_macro (function c!:expand_carcdr))
  2827. (put 'cadddr 'c!:compile_macro (function c!:expand_carcdr))
  2828. (put 'cdaaar 'c!:compile_macro (function c!:expand_carcdr))
  2829. (put 'cdaadr 'c!:compile_macro (function c!:expand_carcdr))
  2830. (put 'cdadar 'c!:compile_macro (function c!:expand_carcdr))
  2831. (put 'cdaddr 'c!:compile_macro (function c!:expand_carcdr))
  2832. (put 'cddaar 'c!:compile_macro (function c!:expand_carcdr))
  2833. (put 'cddadr 'c!:compile_macro (function c!:expand_carcdr))
  2834. (put 'cdddar 'c!:compile_macro (function c!:expand_carcdr))
  2835. (put 'cddddr 'c!:compile_macro (function c!:expand_carcdr)))
  2836. (de c!:builtin_one (x env)
  2837. (prog (r1 r2)
  2838. (setq r1 (c!:cval (cadr x) env))
  2839. (c!:outop (car x) (setq r2 (c!:newreg)) (cdr env) r1)
  2840. (return r2)))
  2841. (de c!:builtin_two (x env)
  2842. (prog (a1 a2 r rr)
  2843. (setq a1 (cadr x))
  2844. (setq a2 (caddr x))
  2845. (setq rr (c!:pareval (list a1 a2) env))
  2846. (c!:outop (car x) (setq r (c!:newreg)) (car rr) (cadr rr))
  2847. (return r)))
  2848. (de c!:narg (x env)
  2849. (c!:cval (expand (cdr x) (get (car x) 'c!:binary_version)) env))
  2850. (prog (n)
  2851. (setq n '((plus plus2) (times times2) (iplus iplus2) (itimes itimes2)))
  2852. lab(cond ((null n) (return nil)))
  2853. ((lambda (n)
  2854. (progn
  2855. (put (car n) 'c!:binary_version (cadr n))
  2856. (put (car n) 'c!:code (function c!:narg))))
  2857. (car n))
  2858. (setq n (cdr n))
  2859. (go lab))
  2860. (de c!:cplus2 (u env)
  2861. (prog (a b)
  2862. (setq a (s!:improve (cadr u)))
  2863. (setq b (s!:improve (caddr u)))
  2864. (return
  2865. (cond
  2866. ((and (numberp a) (numberp b)) (c!:cval (plus a b) env))
  2867. ((equal a 0) (c!:cval b env))
  2868. ((equal a 1) (c!:cval (list 'add1 b) env))
  2869. ((equal b 0) (c!:cval a env))
  2870. ((equal b 1) (c!:cval (list 'add1 a) env))
  2871. ((equal b (minus 1)) (c!:cval (list 'sub1 a) env))
  2872. (t (c!:ccall (car u) (cdr u) env)))) ))
  2873. (put 'plus2 'c!:code (function c!:cplus2))
  2874. (de c!:ciplus2 (u env)
  2875. (prog (a b)
  2876. (setq a (s!:improve (cadr u)))
  2877. (setq b (s!:improve (caddr u)))
  2878. (return
  2879. (cond
  2880. ((and (numberp a) (numberp b)) (c!:cval (plus a b) env))
  2881. ((equal a 0) (c!:cval b env))
  2882. ((equal a 1) (c!:cval (list 'iadd1 b) env))
  2883. ((equal b 0) (c!:cval a env))
  2884. ((equal b 1) (c!:cval (list 'iadd1 a) env))
  2885. ((equal b (minus 1)) (c!:cval (list 'isub1 a) env))
  2886. (t (c!:builtin_two u env)))) ))
  2887. (put 'iplus2 'c!:code (function c!:ciplus2))
  2888. (de c!:cdifference (u env)
  2889. (prog (a b)
  2890. (setq a (s!:improve (cadr u)))
  2891. (setq b (s!:improve (caddr u)))
  2892. (return
  2893. (cond
  2894. ((and (numberp a) (numberp b)) (c!:cval (difference a b) env))
  2895. ((equal a 0) (c!:cval (list 'minus b) env))
  2896. ((equal b 0) (c!:cval a env))
  2897. ((equal b 1) (c!:cval (list 'sub1 a) env))
  2898. ((equal b (minus 1)) (c!:cval (list 'add1 a) env))
  2899. (t (c!:ccall (car u) (cdr u) env)))) ))
  2900. (put 'difference 'c!:code (function c!:cdifference))
  2901. (de c!:cidifference (u env)
  2902. (prog (a b)
  2903. (setq a (s!:improve (cadr u)))
  2904. (setq b (s!:improve (caddr u)))
  2905. (return
  2906. (cond
  2907. ((and (numberp a) (numberp b)) (c!:cval (difference a b) env))
  2908. ((equal a 0) (c!:cval (list 'iminus b) env))
  2909. ((equal b 0) (c!:cval a env))
  2910. ((equal b 1) (c!:cval (list 'isub1 a) env))
  2911. ((equal b (minus 1)) (c!:cval (list 'iadd1 a) env))
  2912. (t (c!:builtin_two u env)))) ))
  2913. (put 'idifference 'c!:code (function c!:cidifference))
  2914. (de c!:ctimes2 (u env)
  2915. (prog (a b)
  2916. (setq a (s!:improve (cadr u)))
  2917. (setq b (s!:improve (caddr u)))
  2918. (return
  2919. (cond
  2920. ((and (numberp a) (numberp b)) (c!:cval (times a b) env))
  2921. ((or (equal a 0) (equal b 0)) (c!:cval 0 env))
  2922. ((equal a 1) (c!:cval b env))
  2923. ((equal b 1) (c!:cval a env))
  2924. ((equal a (minus 1)) (c!:cval (list 'minus b) env))
  2925. ((equal b (minus 1)) (c!:cval (list 'minus a) env))
  2926. (t (c!:ccall (car u) (cdr u) env)))) ))
  2927. (put 'times2 'c!:code (function c!:ctimes2))
  2928. (de c!:citimes2 (u env)
  2929. (prog (a b)
  2930. (setq a (s!:improve (cadr u)))
  2931. (setq b (s!:improve (caddr u)))
  2932. (return
  2933. (cond
  2934. ((and (numberp a) (numberp b)) (c!:cval (times a b) env))
  2935. ((or (equal a 0) (equal b 0)) (c!:cval 0 env))
  2936. ((equal a 1) (c!:cval b env))
  2937. ((equal b 1) (c!:cval a env))
  2938. ((equal a (minus 1)) (c!:cval (list 'iminus b) env))
  2939. ((equal b (minus 1)) (c!:cval (list 'iminus a) env))
  2940. (t (c!:builtin_two u env)))) ))
  2941. (put 'itimes2 'c!:code (function c!:citimes2))
  2942. (de c!:cminus (u env)
  2943. (prog (a b)
  2944. (setq a (s!:improve (cadr u)))
  2945. (return
  2946. (cond
  2947. ((numberp a) (c!:cval (minus a) env))
  2948. ((eqcar a 'minus) (c!:cval (cadr a) env))
  2949. (t (c!:ccall (car u) (cdr u) env)))) ))
  2950. (put 'minus 'c!:code (function c!:cminus))
  2951. (de c!:ceq (x env)
  2952. (prog (a1 a2 r rr)
  2953. (setq a1 (s!:improve (cadr x)))
  2954. (setq a2 (s!:improve (caddr x)))
  2955. (cond
  2956. ((equal a1 nil) (return (c!:cval (list 'null a2) env)))
  2957. ((equal a2 nil) (return (c!:cval (list 'null a1) env))))
  2958. (setq rr (c!:pareval (list a1 a2) env))
  2959. (c!:outop 'eq (setq r (c!:newreg)) (car rr) (cadr rr))
  2960. (return r)))
  2961. (put 'eq 'c!:code (function c!:ceq))
  2962. (de c!:cequal (x env)
  2963. (prog (a1 a2 r rr)
  2964. (setq a1 (s!:improve (cadr x)))
  2965. (setq a2 (s!:improve (caddr x)))
  2966. (cond
  2967. ((equal a1 nil) (return (c!:cval (list 'null a2) env)))
  2968. ((equal a2 nil) (return (c!:cval (list 'null a1) env))))
  2969. (setq rr (c!:pareval (list a1 a2) env))
  2970. (c!:outop
  2971. (cond ((or (c!:eqvalid a1) (c!:eqvalid a2)) 'eq) (t 'equal))
  2972. (setq r (c!:newreg))
  2973. (car rr)
  2974. (cadr rr))
  2975. (return r)))
  2976. (put 'equal 'c!:code (function c!:cequal))
  2977. (de c!:is_fixnum (x)
  2978. (and (fixp x) (geq x (minus 134217728)) (leq x 134217727)))
  2979. (de c!:certainlyatom (x)
  2980. (or
  2981. (null x)
  2982. (equal x t)
  2983. (c!:is_fixnum x)
  2984. (and
  2985. (eqcar x 'quote)
  2986. (or (symbolp (cadr x)) (c!:is_fixnum (cadr x)))) ))
  2987. (de c!:atomlist1 (u)
  2988. (or
  2989. (atom u)
  2990. (and
  2991. (or (symbolp (car u)) (c!:is_fixnum (car u)))
  2992. (c!:atomlist1 (cdr u)))) )
  2993. (de c!:atomlist (x)
  2994. (or
  2995. (null x)
  2996. (and (eqcar x 'quote) (c!:atomlist1 (cadr x)))
  2997. (and
  2998. (eqcar x 'list)
  2999. (or
  3000. (null (cdr x))
  3001. (and
  3002. (c!:certainlyatom (cadr x))
  3003. (c!:atomlist (cons 'list (cddr x)))) ))
  3004. (and
  3005. (eqcar x 'cons)
  3006. (c!:certainlyatom (cadr x))
  3007. (c!:atomlist (caddr x)))) )
  3008. (de c!:atomcar (x)
  3009. (and
  3010. (or (eqcar x 'cons) (eqcar x 'list))
  3011. (not (null (cdr x)))
  3012. (c!:certainlyatom (cadr x))))
  3013. (de c!:atomkeys1 (u)
  3014. (or
  3015. (atom u)
  3016. (and
  3017. (not (atom (car u)))
  3018. (or (symbolp (caar u)) (c!:is_fixnum (caar u)))
  3019. (c!:atomlist1 (cdr u)))) )
  3020. (de c!:atomkeys (x)
  3021. (or
  3022. (null x)
  3023. (and (eqcar x 'quote) (c!:atomkeys1 (cadr x)))
  3024. (and
  3025. (eqcar x 'list)
  3026. (or
  3027. (null (cdr x))
  3028. (and (c!:atomcar (cadr x)) (c!:atomkeys (cons 'list (cddr x)))) ))
  3029. (and (eqcar x 'cons) (c!:atomcar (cadr x)) (c!:atomkeys (caddr x)))) )
  3030. (de c!:comsublis (x)
  3031. (cond ((c!:atomkeys (cadr x)) (cons 'subla (cdr x))) (t nil)))
  3032. (put 'sublis 'c!:compile_macro (function c!:comsublis))
  3033. (de c!:comassoc (x)
  3034. (cond
  3035. ((or (c!:certainlyatom (cadr x)) (c!:atomkeys (caddr x)))
  3036. (cons 'atsoc (cdr x)))
  3037. (t nil)))
  3038. (put 'assoc 'c!:compile_macro (function c!:comassoc))
  3039. (put 'assoc!*!* 'c!:compile_macro (function c!:comassoc))
  3040. (de c!:commember (x)
  3041. (cond
  3042. ((or (c!:certainlyatom (cadr x)) (c!:atomlist (caddr x)))
  3043. (cons 'memq (cdr x)))
  3044. (t nil)))
  3045. (put 'member 'c!:compile_macro (function c!:commember))
  3046. (de c!:comdelete (x)
  3047. (cond
  3048. ((or (c!:certainlyatom (cadr x)) (c!:atomlist (caddr x)))
  3049. (cons 'deleq (cdr x)))
  3050. (t nil)))
  3051. (put 'delete 'c!:compile_macro (function c!:comdelete))
  3052. (de c!:ctestif (x env d1 d2)
  3053. (prog (l1 l2)
  3054. (setq l1 (c!:my_gensym))
  3055. (setq l2 (c!:my_gensym))
  3056. (c!:jumpif (cadr x) l1 l2)
  3057. (setq x (cddr x))
  3058. (c!:startblock l1)
  3059. (c!:jumpif (car x) d1 d2)
  3060. (c!:startblock l2)
  3061. (c!:jumpif (cadr x) d1 d2)))
  3062. (put 'if 'c!:ctest (function c!:ctestif))
  3063. (de c!:ctestnull (x env d1 d2) (c!:cjumpif (cadr x) env d2 d1))
  3064. (put 'null 'c!:ctest (function c!:ctestnull))
  3065. (put 'not 'c!:ctest (function c!:ctestnull))
  3066. (de c!:ctestatom (x env d1 d2)
  3067. (prog nil
  3068. (setq x (c!:cval (cadr x) env))
  3069. (c!:endblock (list 'ifatom x) (list d1 d2))))
  3070. (put 'atom 'c!:ctest (function c!:ctestatom))
  3071. (de c!:ctestconsp (x env d1 d2)
  3072. (prog nil
  3073. (setq x (c!:cval (cadr x) env))
  3074. (c!:endblock (list 'ifatom x) (list d2 d1))))
  3075. (put 'consp 'c!:ctest (function c!:ctestconsp))
  3076. (de c!:ctestsymbol (x env d1 d2)
  3077. (prog nil
  3078. (setq x (c!:cval (cadr x) env))
  3079. (c!:endblock (list 'ifsymbol x) (list d1 d2))))
  3080. (put 'idp 'c!:ctest (function c!:ctestsymbol))
  3081. (de c!:ctestnumberp (x env d1 d2)
  3082. (prog nil
  3083. (setq x (c!:cval (cadr x) env))
  3084. (c!:endblock (list 'ifnumber x) (list d1 d2))))
  3085. (put 'numberp 'c!:ctest (function c!:ctestnumberp))
  3086. (de c!:ctestizerop (x env d1 d2)
  3087. (prog nil
  3088. (setq x (c!:cval (cadr x) env))
  3089. (c!:endblock (list 'ifizerop x) (list d1 d2))))
  3090. (put 'izerop 'c!:ctest (function c!:ctestizerop))
  3091. (de c!:ctesteq (x env d1 d2)
  3092. (prog (a1 a2 r)
  3093. (setq a1 (cadr x))
  3094. (setq a2 (caddr x))
  3095. (cond
  3096. ((equal a1 nil) (return (c!:cjumpif a2 env d2 d1)))
  3097. ((equal a2 nil) (return (c!:cjumpif a1 env d2 d1))))
  3098. (setq r (c!:pareval (list a1 a2) env))
  3099. (c!:endblock (cons 'ifeq r) (list d1 d2))))
  3100. (put 'eq 'c!:ctest (function c!:ctesteq))
  3101. (de c!:ctesteqcar (x env d1 d2)
  3102. (prog (a1 a2 r d3)
  3103. (setq a1 (cadr x))
  3104. (setq a2 (caddr x))
  3105. (setq d3 (c!:my_gensym))
  3106. (setq r (c!:pareval (list a1 a2) env))
  3107. (c!:endblock (list 'ifatom (car r)) (list d2 d3))
  3108. (c!:startblock d3)
  3109. (c!:outop 'qcar (car r) nil (car r))
  3110. (c!:endblock (cons 'ifeq r) (list d1 d2))))
  3111. (put 'eqcar 'c!:ctest (function c!:ctesteqcar))
  3112. (global '(least_fixnum greatest_fixnum))
  3113. (setq least_fixnum (minus (expt 2 27)))
  3114. (setq greatest_fixnum (difference (expt 2 27) 1))
  3115. (de c!:small_number (x)
  3116. (and (fixp x) (geq x least_fixnum) (leq x greatest_fixnum)))
  3117. (de c!:eqvalid (x)
  3118. (cond
  3119. ((atom x) (c!:small_number x))
  3120. ((flagp (car x) 'c!:fixnum_fn) t)
  3121. (t (and
  3122. (equal (car x) 'quote)
  3123. (or (idp (cadr x)) (c!:small_number (cadr x)))) )))
  3124. (flag '(iplus iplus2 idifference iminus itimes itimes2) 'c!:fixnum_fn)
  3125. (de c!:ctestequal (x env d1 d2)
  3126. (prog (a1 a2 r)
  3127. (setq a1 (s!:improve (cadr x)))
  3128. (setq a2 (s!:improve (caddr x)))
  3129. (cond
  3130. ((equal a1 nil) (return (c!:cjumpif a2 env d2 d1)))
  3131. ((equal a2 nil) (return (c!:cjumpif a1 env d2 d1))))
  3132. (setq r (c!:pareval (list a1 a2) env))
  3133. (c!:endblock
  3134. (cons
  3135. (cond ((or (c!:eqvalid a1) (c!:eqvalid a2)) 'ifeq) (t 'ifequal))
  3136. r)
  3137. (list d1 d2))))
  3138. (put 'equal 'c!:ctest (function c!:ctestequal))
  3139. (de c!:ctestilessp (x env d1 d2)
  3140. (prog (r)
  3141. (setq r (c!:pareval (list (cadr x) (caddr x)) env))
  3142. (c!:endblock (cons 'ifilessp r) (list d1 d2))))
  3143. (put 'ilessp 'c!:ctest (function c!:ctestilessp))
  3144. (de c!:ctestigreaterp (x env d1 d2)
  3145. (prog (r)
  3146. (setq r (c!:pareval (list (cadr x) (caddr x)) env))
  3147. (c!:endblock (cons 'ifigreaterp r) (list d1 d2))))
  3148. (put 'igreaterp 'c!:ctest (function c!:ctestigreaterp))
  3149. (de c!:ctestand (x env d1 d2)
  3150. (prog (next)
  3151. (prog (a)
  3152. (setq a (cdr x))
  3153. lab (cond ((null a) (return nil)))
  3154. ((lambda (a)
  3155. (progn
  3156. (setq next (c!:my_gensym))
  3157. (c!:cjumpif a env next d2)
  3158. (c!:startblock next)))
  3159. (car a))
  3160. (setq a (cdr a))
  3161. (go lab))
  3162. (c!:endblock 'goto (list d1))))
  3163. (put 'and 'c!:ctest (function c!:ctestand))
  3164. (de c!:ctestor (x env d1 d2)
  3165. (prog (next)
  3166. (prog (a)
  3167. (setq a (cdr x))
  3168. lab (cond ((null a) (return nil)))
  3169. ((lambda (a)
  3170. (progn
  3171. (setq next (c!:my_gensym))
  3172. (c!:cjumpif a env d1 next)
  3173. (c!:startblock next)))
  3174. (car a))
  3175. (setq a (cdr a))
  3176. (go lab))
  3177. (c!:endblock 'goto (list d2))))
  3178. (put 'or 'c!:ctest (function c!:ctestor))
  3179. (progn
  3180. (put 'abs 'c!:c_entrypoint "Labsval")
  3181. (put 'append 'c!:c_entrypoint "Lappend")
  3182. (put 'apply0 'c!:c_entrypoint "Lapply0")
  3183. (put 'apply1 'c!:c_entrypoint "Lapply1")
  3184. (put 'apply2 'c!:c_entrypoint "Lapply2")
  3185. (put 'apply3 'c!:c_entrypoint "Lapply3")
  3186. (put 'ash1 'c!:c_entrypoint "Lash1")
  3187. (put 'assoc 'c!:c_entrypoint "Lassoc")
  3188. (put 'atan 'c!:c_entrypoint "Latan")
  3189. (put 'atom 'c!:c_entrypoint "Latom")
  3190. (put 'atsoc 'c!:c_entrypoint "Latsoc")
  3191. (put 'batchp 'c!:c_entrypoint "Lbatchp")
  3192. (put 'boundp 'c!:c_entrypoint "Lboundp")
  3193. (put 'bps!-putv 'c!:c_entrypoint "Lbpsputv")
  3194. (put 'caaaar 'c!:c_entrypoint "Lcaaaar")
  3195. (put 'caaadr 'c!:c_entrypoint "Lcaaadr")
  3196. (put 'caaar 'c!:c_entrypoint "Lcaaar")
  3197. (put 'caadar 'c!:c_entrypoint "Lcaadar")
  3198. (put 'caaddr 'c!:c_entrypoint "Lcaaddr")
  3199. (put 'caadr 'c!:c_entrypoint "Lcaadr")
  3200. (put 'caar 'c!:c_entrypoint "Lcaar")
  3201. (put 'cadaar 'c!:c_entrypoint "Lcadaar")
  3202. (put 'cadadr 'c!:c_entrypoint "Lcadadr")
  3203. (put 'cadar 'c!:c_entrypoint "Lcadar")
  3204. (put 'caddar 'c!:c_entrypoint "Lcaddar")
  3205. (put 'cadddr 'c!:c_entrypoint "Lcadddr")
  3206. (put 'caddr 'c!:c_entrypoint "Lcaddr")
  3207. (put 'cadr 'c!:c_entrypoint "Lcadr")
  3208. (put 'car 'c!:c_entrypoint "Lcar")
  3209. (put 'cdaaar 'c!:c_entrypoint "Lcdaaar")
  3210. (put 'cdaadr 'c!:c_entrypoint "Lcdaadr")
  3211. (put 'cdaar 'c!:c_entrypoint "Lcdaar")
  3212. (put 'cdadar 'c!:c_entrypoint "Lcdadar")
  3213. (put 'cdaddr 'c!:c_entrypoint "Lcdaddr")
  3214. (put 'cdadr 'c!:c_entrypoint "Lcdadr")
  3215. (put 'cdar 'c!:c_entrypoint "Lcdar")
  3216. (put 'cddaar 'c!:c_entrypoint "Lcddaar")
  3217. (put 'cddadr 'c!:c_entrypoint "Lcddadr")
  3218. (put 'cddar 'c!:c_entrypoint "Lcddar")
  3219. (put 'cdddar 'c!:c_entrypoint "Lcdddar")
  3220. (put 'cddddr 'c!:c_entrypoint "Lcddddr")
  3221. (put 'cdddr 'c!:c_entrypoint "Lcdddr")
  3222. (put 'cddr 'c!:c_entrypoint "Lcddr")
  3223. (put 'cdr 'c!:c_entrypoint "Lcdr")
  3224. (put 'char!-code 'c!:c_entrypoint "Lchar_code")
  3225. (put 'close 'c!:c_entrypoint "Lclose")
  3226. (put 'code!-char 'c!:c_entrypoint "Lcode_char")
  3227. (put 'codep 'c!:c_entrypoint "Lcodep")
  3228. (put 'compress 'c!:c_entrypoint "Lcompress")
  3229. (put 'constantp 'c!:c_entrypoint "Lconstantp")
  3230. (put 'date 'c!:c_entrypoint "Ldate")
  3231. (put 'deleq 'c!:c_entrypoint "Ldeleq")
  3232. (put 'delete 'c!:c_entrypoint "Ldelete")
  3233. (put 'digit 'c!:c_entrypoint "Ldigitp")
  3234. (put 'divide 'c!:c_entrypoint "Ldivide")
  3235. (put 'eject 'c!:c_entrypoint "Leject")
  3236. (put 'endp 'c!:c_entrypoint "Lendp")
  3237. (put 'eq 'c!:c_entrypoint "Leq")
  3238. (put 'eqcar 'c!:c_entrypoint "Leqcar")
  3239. (put 'eql 'c!:c_entrypoint "Leql")
  3240. (put 'eqn 'c!:c_entrypoint "Leqn")
  3241. (put 'equal 'c!:c_entrypoint "Lequal")
  3242. (put 'error 'c!:c_entrypoint "Lerror")
  3243. (put 'error1 'c!:c_entrypoint "Lerror1")
  3244. (put 'evenp 'c!:c_entrypoint "Levenp")
  3245. (put 'evlis 'c!:c_entrypoint "Levlis")
  3246. (put 'explode 'c!:c_entrypoint "Lexplode")
  3247. (put 'explode2 'c!:c_entrypoint "Lexplodec")
  3248. (put 'explodec 'c!:c_entrypoint "Lexplodec")
  3249. (put 'expt 'c!:c_entrypoint "Lexpt")
  3250. (put 'fasldef 'c!:c_entrypoint "Lfasldef")
  3251. (put 'faslstart 'c!:c_entrypoint "Lfaslstart")
  3252. (put 'faslwrite 'c!:c_entrypoint "Lfaslwrite")
  3253. (put 'fix 'c!:c_entrypoint "Ltruncate")
  3254. (put 'fixp 'c!:c_entrypoint "Lfixp")
  3255. (put 'flag 'c!:c_entrypoint "Lflag")
  3256. (put 'flagp!*!* 'c!:c_entrypoint "Lflagp")
  3257. (put 'flagp 'c!:c_entrypoint "Lflagp")
  3258. (put 'flagpcar 'c!:c_entrypoint "Lflagpcar")
  3259. (put 'float 'c!:c_entrypoint "Lfloat")
  3260. (put 'floatp 'c!:c_entrypoint "Lfloatp")
  3261. (put 'fluidp 'c!:c_entrypoint "Lsymbol_specialp")
  3262. (put 'gcdn 'c!:c_entrypoint "Lgcd")
  3263. (put 'gctime 'c!:c_entrypoint "Lgctime")
  3264. (put 'gensym 'c!:c_entrypoint "Lgensym")
  3265. (put 'gensym1 'c!:c_entrypoint "Lgensym1")
  3266. (put 'geq 'c!:c_entrypoint "Lgeq")
  3267. (put 'get!* 'c!:c_entrypoint "Lget")
  3268. (put 'getenv 'c!:c_entrypoint "Lgetenv")
  3269. (put 'getv 'c!:c_entrypoint "Lgetv")
  3270. (put 'globalp 'c!:c_entrypoint "Lsymbol_globalp")
  3271. (put 'greaterp 'c!:c_entrypoint "Lgreaterp")
  3272. (put 'iadd1 'c!:c_entrypoint "Liadd1")
  3273. (put 'idifference 'c!:c_entrypoint "Lidifference")
  3274. (put 'idp 'c!:c_entrypoint "Lsymbolp")
  3275. (put 'igreaterp 'c!:c_entrypoint "Ligreaterp")
  3276. (put 'ilessp 'c!:c_entrypoint "Lilessp")
  3277. (put 'iminus 'c!:c_entrypoint "Liminus")
  3278. (put 'iminusp 'c!:c_entrypoint "Liminusp")
  3279. (put 'indirect 'c!:c_entrypoint "Lindirect")
  3280. (put 'integerp 'c!:c_entrypoint "Lintegerp")
  3281. (put 'intern 'c!:c_entrypoint "Lintern")
  3282. (put 'iplus2 'c!:c_entrypoint "Liplus2")
  3283. (put 'iquotient 'c!:c_entrypoint "Liquotient")
  3284. (put 'iremainder 'c!:c_entrypoint "Liremainder")
  3285. (put 'irightshift 'c!:c_entrypoint "Lirightshift")
  3286. (put 'isub1 'c!:c_entrypoint "Lisub1")
  3287. (put 'itimes2 'c!:c_entrypoint "Litimes2")
  3288. (put 'length 'c!:c_entrypoint "Llength")
  3289. (put 'lengthc 'c!:c_entrypoint "Llengthc")
  3290. (put 'leq 'c!:c_entrypoint "Lleq")
  3291. (put 'lessp 'c!:c_entrypoint "Llessp")
  3292. (put 'linelength 'c!:c_entrypoint "Llinelength")
  3293. (put 'liter 'c!:c_entrypoint "Lalpha_char_p")
  3294. (put 'load!-module 'c!:c_entrypoint "Lload_module")
  3295. (put 'lposn 'c!:c_entrypoint "Llposn")
  3296. (put 'macro!-function 'c!:c_entrypoint "Lmacro_function")
  3297. (put 'macroexpand!-1 'c!:c_entrypoint "Lmacroexpand_1")
  3298. (put 'macroexpand 'c!:c_entrypoint "Lmacroexpand")
  3299. (put 'make!-bps 'c!:c_entrypoint "Lget_bps")
  3300. (put 'make!-global 'c!:c_entrypoint "Lmake_global")
  3301. (put 'make!-simple!-string 'c!:c_entrypoint "Lsmkvect")
  3302. (put 'make!-special 'c!:c_entrypoint "Lmake_special")
  3303. (put 'mapstore 'c!:c_entrypoint "Lmapstore")
  3304. (put 'max2 'c!:c_entrypoint "Lmax2")
  3305. (put 'member 'c!:c_entrypoint "Lmember")
  3306. (put 'memq 'c!:c_entrypoint "Lmemq")
  3307. (put 'min2 'c!:c_entrypoint "Lmin2")
  3308. (put 'minus 'c!:c_entrypoint "Lminus")
  3309. (put 'minusp 'c!:c_entrypoint "Lminusp")
  3310. (put 'mkquote 'c!:c_entrypoint "Lmkquote")
  3311. (put 'mkvect 'c!:c_entrypoint "Lmkvect")
  3312. (put 'mod 'c!:c_entrypoint "Lmod")
  3313. (put 'modular!-difference 'c!:c_entrypoint "Lmodular_difference")
  3314. (put 'modular!-expt 'c!:c_entrypoint "Lmodular_expt")
  3315. (put 'modular!-minus 'c!:c_entrypoint "Lmodular_minus")
  3316. (put 'modular!-number 'c!:c_entrypoint "Lmodular_number")
  3317. (put 'modular!-plus 'c!:c_entrypoint "Lmodular_plus")
  3318. (put 'modular!-quotient 'c!:c_entrypoint "Lmodular_quotient")
  3319. (put 'modular!-reciprocal 'c!:c_entrypoint "Lmodular_reciprocal")
  3320. (put 'modular!-times 'c!:c_entrypoint "Lmodular_times")
  3321. (put 'nconc 'c!:c_entrypoint "Lnconc")
  3322. (put 'neq 'c!:c_entrypoint "Lneq")
  3323. (put 'not 'c!:c_entrypoint "Lnull")
  3324. (put 'null 'c!:c_entrypoint "Lnull")
  3325. (put 'numberp 'c!:c_entrypoint "Lnumberp")
  3326. (put 'oddp 'c!:c_entrypoint "Loddp")
  3327. (put 'onep 'c!:c_entrypoint "Lonep")
  3328. (put 'orderp 'c!:c_entrypoint "Lorderp")
  3329. (put 'pagelength 'c!:c_entrypoint "Lpagelength")
  3330. (put 'pairp 'c!:c_entrypoint "Lconsp")
  3331. (put 'plist 'c!:c_entrypoint "Lplist")
  3332. (put 'plusp 'c!:c_entrypoint "Lplusp")
  3333. (put 'posn 'c!:c_entrypoint "Lposn")
  3334. (put 'prin 'c!:c_entrypoint "Lprin")
  3335. (put 'prin1 'c!:c_entrypoint "Lprin")
  3336. (put 'prin2 'c!:c_entrypoint "Lprinc")
  3337. (put 'princ 'c!:c_entrypoint "Lprinc")
  3338. (put 'print 'c!:c_entrypoint "Lprint")
  3339. (put 'printc 'c!:c_entrypoint "Lprintc")
  3340. (put 'put 'c!:c_entrypoint "Lputprop")
  3341. (put 'putv!-char 'c!:c_entrypoint "Lsputv")
  3342. (put 'putv 'c!:c_entrypoint "Lputv")
  3343. (put 'qcaar 'c!:c_entrypoint "Lcaar")
  3344. (put 'qcadr 'c!:c_entrypoint "Lcadr")
  3345. (put 'qcar 'c!:c_entrypoint "Lcar")
  3346. (put 'qcdar 'c!:c_entrypoint "Lcdar")
  3347. (put 'qcddr 'c!:c_entrypoint "Lcddr")
  3348. (put 'qcdr 'c!:c_entrypoint "Lcdr")
  3349. (put 'qgetv 'c!:c_entrypoint "Lgetv")
  3350. (put 'rdf 'c!:c_entrypoint "Lrdf")
  3351. (put 'rds 'c!:c_entrypoint "Lrds")
  3352. (put 'read 'c!:c_entrypoint "Lread")
  3353. (put 'readch 'c!:c_entrypoint "Lreadch")
  3354. (put 'reclaim 'c!:c_entrypoint "Lgc")
  3355. (put 'remd 'c!:c_entrypoint "Lremd")
  3356. (put 'remflag 'c!:c_entrypoint "Lremflag")
  3357. (put 'remob 'c!:c_entrypoint "Lunintern")
  3358. (put 'remprop 'c!:c_entrypoint "Lremprop")
  3359. (put 'representation 'c!:c_entrypoint "Lrepresentation")
  3360. (put 'reverse 'c!:c_entrypoint "Lreverse")
  3361. (put 'reversip 'c!:c_entrypoint "Lnreverse")
  3362. (put 'rplaca 'c!:c_entrypoint "Lrplaca")
  3363. (put 'rplacd 'c!:c_entrypoint "Lrplacd")
  3364. (put 'schar 'c!:c_entrypoint "Lsgetv")
  3365. (put 'seprp 'c!:c_entrypoint "Lwhitespace_char_p")
  3366. (put 'set!-small!-modulus 'c!:c_entrypoint "Lset_small_modulus")
  3367. (put 'set 'c!:c_entrypoint "Lset")
  3368. (put 'smemq 'c!:c_entrypoint "Lsmemq")
  3369. (put 'spaces 'c!:c_entrypoint "Lxtab")
  3370. (put 'special!-char 'c!:c_entrypoint "Lspecial_char")
  3371. (put 'special!-form!-p 'c!:c_entrypoint "Lspecial_form_p")
  3372. (put 'spool 'c!:c_entrypoint "Lspool")
  3373. (put 'stop 'c!:c_entrypoint "Lstop")
  3374. (put 'stringp 'c!:c_entrypoint "Lstringp")
  3375. (put 'subla 'c!:c_entrypoint "Lsubla")
  3376. (put 'sublis 'c!:c_entrypoint "Lsublis")
  3377. (put 'subst 'c!:c_entrypoint "Lsubst")
  3378. (put 'symbol!-env 'c!:c_entrypoint "Lsymbol_env")
  3379. (put 'symbol!-function 'c!:c_entrypoint "Lsymbol_function")
  3380. (put 'symbol!-name 'c!:c_entrypoint "Lsymbol_name")
  3381. (put 'symbol!-set!-definition 'c!:c_entrypoint "Lsymbol_set_definition")
  3382. (put 'symbol!-set!-env 'c!:c_entrypoint "Lsymbol_set_env")
  3383. (put 'symbol!-value 'c!:c_entrypoint "Lsymbol_value")
  3384. (put 'system 'c!:c_entrypoint "Lsystem")
  3385. (put 'terpri 'c!:c_entrypoint "Lterpri")
  3386. (put 'threevectorp 'c!:c_entrypoint "Lthreevectorp")
  3387. (put 'time 'c!:c_entrypoint "Ltime")
  3388. (put 'ttab 'c!:c_entrypoint "Lttab")
  3389. (put 'tyo 'c!:c_entrypoint "Ltyo")
  3390. (put 'unmake!-global 'c!:c_entrypoint "Lunmake_global")
  3391. (put 'unmake!-special 'c!:c_entrypoint "Lunmake_special")
  3392. (put 'upbv 'c!:c_entrypoint "Lupbv")
  3393. (put 'vectorp 'c!:c_entrypoint "Lsimple_vectorp")
  3394. (put 'verbos 'c!:c_entrypoint "Lverbos")
  3395. (put 'wrs 'c!:c_entrypoint "Lwrs")
  3396. (put 'xcons 'c!:c_entrypoint "Lxcons")
  3397. (put 'xtab 'c!:c_entrypoint "Lxtab")
  3398. (put 'zerop 'c!:c_entrypoint "Lzerop")
  3399. (put 'cons 'c!:direct_entrypoint (cons 2 "cons"))
  3400. (put 'ncons 'c!:direct_entrypoint (cons 1 "ncons"))
  3401. (put 'list2 'c!:direct_entrypoint (cons 2 "list2"))
  3402. (put 'list2!* 'c!:direct_entrypoint (cons 3 "list2star"))
  3403. (put 'acons 'c!:direct_entrypoint (cons 3 "acons"))
  3404. (put 'list3 'c!:direct_entrypoint (cons 3 "list3"))
  3405. (put 'plus2 'c!:direct_entrypoint (cons 2 "plus2"))
  3406. (put 'difference 'c!:direct_entrypoint (cons 2 "difference2"))
  3407. (put 'add1 'c!:direct_entrypoint (cons 1 "add1"))
  3408. (put 'sub1 'c!:direct_entrypoint (cons 1 "sub1"))
  3409. (put 'get 'c!:direct_entrypoint (cons 2 "get"))
  3410. (put 'lognot 'c!:direct_entrypoint (cons 1 "lognot"))
  3411. (put 'ash 'c!:direct_entrypoint (cons 2 "ash"))
  3412. (put 'quotient 'c!:direct_entrypoint (cons 2 "quot2"))
  3413. (put 'remainder 'c!:direct_entrypoint (cons 2 "Cremainder"))
  3414. (put 'times2 'c!:direct_entrypoint (cons 2 "times2"))
  3415. (put 'minus 'c!:direct_entrypoint (cons 1 "negate"))
  3416. (put 'rational 'c!:direct_entrypoint (cons 1 "rational"))
  3417. (put 'lessp 'c!:direct_predicate (cons 2 "lessp2"))
  3418. (put 'leq 'c!:direct_predicate (cons 2 "lesseq2"))
  3419. (put 'greaterp 'c!:direct_predicate (cons 2 "greaterp2"))
  3420. (put 'geq 'c!:direct_predicate (cons 2 "geq2"))
  3421. (put 'zerop 'c!:direct_predicate (cons 1 "zerop"))
  3422. "C entrypoints established")
  3423. (flag
  3424. '(atom atsoc codep constantp deleq digit endp eq eqcar evenp eql fixp flagp
  3425. flagpcar floatp get globalp iadd1 idifference idp igreaterp ilessp
  3426. iminus iminusp indirect integerp iplus2 irightshift isub1 itimes2 liter
  3427. memq minusp modular!-difference modular!-expt modular!-minus
  3428. modular!-number modular!-plus modular!-times not null numberp onep
  3429. pairp plusp qcaar qcadr qcar qcdar qcddr qcdr remflag remprop reversip
  3430. seprp special!-form!-p stringp symbol!-env symbol!-name symbol!-value
  3431. threevectorp vectorp zerop)
  3432. 'c!:no_errors)