scheme48.info-2 321 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930
  1. This is scheme48.info, produced by makeinfo version 6.7 from
  2. scheme48.texi.
  3. This manual is for Scheme48 version 1.3.
  4. Copyright (C) 2004, 2005, 2006 Taylor Campbell. All rights reserved.
  5. This manual includes material derived from works bearing the
  6. following notice:
  7. Copyright (C) 1993-2005 Richard Kelsey, Jonathan Rees, and Mike
  8. Sperber. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions
  11. are met:
  12. * Redistributions of source code must retain the above copyright
  13. notice, this list of conditions and the following disclaimer.
  14. * Redistributions in binary form must reproduce the above
  15. copyright notice, this list of conditions and the following
  16. disclaimer in the documentation and/or other materials
  17. provided with the distribution.
  18. * The name of the authors may not be used to endorse or promote
  19. products derived from this software without specific prior
  20. written permission.
  21. THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR
  22. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  23. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  24. DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
  25. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  26. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  29. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  30. ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  31. POSSIBILITY OF SUCH DAMAGE.
  32. INFO-DIR-SECTION The Algorithmic Language Scheme
  33. START-INFO-DIR-ENTRY
  34. * Scheme48: (scheme48). Nearly complete reference manual for version 1.3
  35. END-INFO-DIR-ENTRY
  36. 
  37. File: scheme48.info, Node: Common-Lisp-style formatting, Next: Library utilities, Prev: TCP & UDP sockets, Up: Libraries
  38. 6.7 Common-Lisp-style formatting
  39. ================================
  40. Scheme48 provides a simple Common-Lisp-style 'format' facility in the
  41. 'formats' structure. It does not provide nearly as much functionality
  42. as Common Lisp, however: the considerable complexity of Common Lisp's
  43. 'format' was deliberately avoided because it was deemed inconsistent
  44. with Scheme48's design goals. Scheme48's 'format' is suitable for most
  45. simple purposes, anyhow.
  46. -- procedure: format port control-string argument ... --> unspecified
  47. or string
  48. Prints CONTROL-STRING to PORT. If, anywhere in CONTROL-STRING, the
  49. character '~' (tilde) occurs, the following character determines
  50. what to print in the place of the tilde and following character.
  51. Some formatting directives consume arguments from ARGUMENT ....
  52. Formatting directive characters are case-insensitive. If PORT is
  53. '#t', the output is printed to to the value of
  54. '(current-output-port)'; if PORT is false, the output is collected
  55. in a string and returned.
  56. The complete list of formatting directives:
  57. '~~'
  58. Prints a single '~' (tilde), and does not consume an argument.
  59. '~A'
  60. Consumes and prints the first remaining argument with
  61. 'display'. ('A'ny)
  62. '~D'
  63. Consumes and prints the first remaining argument as a decimal
  64. number using 'number->string'. ('D'ecimal)
  65. '~S'
  66. Consumes and prints the first remaining argument with 'write'.
  67. ('S'-expression)
  68. '~%'
  69. Prints a newline with 'newline'.
  70. '~&'
  71. Prints a newline with 'newline', unless it can be determined
  72. that a newline was immediately previously printed to PORT
  73. (*note I/O extensions::).
  74. '~?'
  75. Recursively formats. The first remaining argument is consumed
  76. and must be another control string; the argument directly
  77. thereafter is also consumed, and it must be a list of
  78. arguments corresponding with that control string. The control
  79. string is formatted with those arguments using 'format'.
  80. 'Format' examples:
  81. (format #t "Hello, ~A!~%" "world")
  82. -| Hello, world!
  83. -|
  84. (format #t "Hello~?~S~%" "~A world" '(#\,) '!)
  85. -| Hello, world!
  86. -|
  87. (format #f "~A~A ~A." "cH" "uMBLE" "spuZz")
  88. => "cHuMBLE spuZz."
  89. (let ((x 10) (y .1))
  90. (format #t "x: ~D~%~&y: ~D~%~&" x y))
  91. -| x: 10
  92. -| y: .1
  93. 
  94. File: scheme48.info, Node: Library utilities, Prev: Common-Lisp-style formatting, Up: Libraries
  95. 6.8 Library utilities
  96. =====================
  97. Scheme48 provides various miscellaneous library utilities for common
  98. general-purpose tasks.
  99. 6.8.1 Destructuring
  100. -------------------
  101. The 'destructuring' structure exports a form for destructuring
  102. S-expressions.
  103. -- syntax: destructure ((pattern value) ...) body
  104. For each '(PATTERN VALUE)' pair, binds every name in PATTERN to the
  105. corresponding location in the S-expression VALUE. For example,
  106. (destructure (((x . y) (cons 5 3))
  107. ((#(a b) c) '(#((1 2) 3) (4 5))))
  108. BODY)
  109. binds X to '5', Y to '3', A to '(1 2)', B to '3', and C to '(4 5)',
  110. in BODY.
  111. 6.8.2 Pretty-printing
  112. ---------------------
  113. The 'pp' structure exports a simple pretty-printer.
  114. -- procedure: p object [port] --> unspecified
  115. -- procedure: pretty-print object port position --> unspecified
  116. 'P' is a convenient alias for 'pretty-print'; it passes 0 for
  117. POSITION and the value of '(current-output-port)' if PORT is not
  118. passed. 'Pretty-print' pretty-prints OBJECT to PORT, using a left
  119. margin of POSITION. For example:
  120. (p '(define (fact n)
  121. (let loop ((p 1) (c 1))
  122. (if (> c n) p (loop (* p c) (+ c 1))))))
  123. -| (define (fact n)
  124. -| (let loop ((p 1) (c 1))
  125. -| (if (> c n)
  126. -| p
  127. -| (loop (* p c) (+ c 1)))))
  128. The pretty-printer is somewhat extensible as well:
  129. -- procedure: define-indentation name count --> unspecified
  130. Sets the number of subforms to be indented past NAME in
  131. pretty-printed output to be COUNT. For example:
  132. (define-indentation 'frobozz 3)
  133. (p '(frobozz (foo bar baz quux zot) (zot quux baz bar foo)
  134. (mumble frotz gargle eek) (froomble zargle hrumph)))
  135. -| (frobozz (foo bar baz quux zot)
  136. -| (zot quux baz bar foo)
  137. -| (mumble frotz gargle eek)
  138. -| (froomble zargle hrumph))
  139. 6.8.3 Strongly connected graph components
  140. -----------------------------------------
  141. The 'strong' structure exports a routine for finding a list of the
  142. strongly connected components in a graph.
  143. -- procedure: strongly-connected-components vertices to slot set-slot!
  144. --> sorted-strong-vertices
  145. Returns the components of a graph containing vertices from the list
  146. VERTICES that are strongly connected, in a reversed topologically
  147. sorted list. TO should be a procedure of one argument, a vertex,
  148. that returns a list of all vertices that have an edge to its
  149. argument. SLOT & SET-SLOT! should be procedures of one & two
  150. arguments, respectively, that access & modify arbitrary slots used
  151. by the algorithm. The slot for every vertex should initially be
  152. '#f' before calling 'strongly-connected-components', and the slots
  153. are reverted to '#f' before 'strongly-connected-components'
  154. returns.
  155. 6.8.4 Nondeterminism
  156. --------------------
  157. The 'nondeterminism' structure provides a simple nondeterministic
  158. ambivalence operator, like McCarthy's 'AMB', and a couple utilities atop
  159. it, built with Scheme's 'call-with-current-continuation'.
  160. -- procedure: with-nondeterminism thunk --> values
  161. Initializes the nondeterminism system and calls THUNK; this returns
  162. the values THUNK returns after then tearing down what was set up.
  163. -- syntax: either option ... --> value
  164. -- syntax: one-value exp --> value
  165. -- syntax: all-values exp --> list
  166. 'Either' evaluates to the value of any one of the options. It is
  167. equivalent to McCarthy's 'AMB'. It may return any number of times.
  168. 'One-value' returns the only value that EXP could produce; it will
  169. return only once, although it may actually return any number of
  170. values (if EXP contains a call to 'values'). 'All-values' returns
  171. a list of all of the single values, not multiple values, that EXP
  172. could nondeterministically evaluate to.
  173. -- procedure: fail --> does not return
  174. Signals a nondeterministic failure. This is invalid outside of a
  175. 'with-nondeterminism'-protected dynamic extent.
  176. 6.8.5 Miscellaneous utilities
  177. -----------------------------
  178. The 'big-util' structure exports a variety of miscellaneous utilities.
  179. -- procedure: concatenate-symbol elt ... --> symbol
  180. Returns a symbol containing the contents of the sequence ELT ....
  181. Each ELT may be another symbol, a string, or a number. Numbers are
  182. converted to strings in base ten.
  183. -- procedure: error format-string argument ... --> values (may not
  184. return)
  185. -- procedure: breakpoint format-string argument ... --> values (may not
  186. return)
  187. 'Error' signals an error whose message is formatted by 'format'
  188. (*note Common-Lisp-style formatting::) with the given formatting
  189. template string and arguments. 'Breakpoint' signals a breakpoint
  190. with a message similarly constructed and causes the command
  191. processor to push a new command level (*note Command levels::).
  192. -- procedure: atom? x --> boolean
  193. Returns true if X is not a pair or false if it is.
  194. -- procedure: neq? x y --> boolean
  195. -- procedure: n= x y --> boolean
  196. Negations of the 'eq?' and '=' predicates.
  197. -- procedure: identity value --> value
  198. -- procedure: no-op value --> value
  199. These simply return their arguments. The difference between them
  200. is that 'no-op' is guaranteed not to be integrated by the compiler,
  201. whereas 'identity' may be.
  202. -- procedure: null-list? object --> boolean
  203. Returns '#t' if OBJECT is the null list, returns '#f' if OBJECT is
  204. a pair, or signals an error if OBJECT is neither the null list nor
  205. a pair.
  206. -- procedure: reverse! list --> reversed-list
  207. Returns a list containing the reverse elements of LIST. Note that
  208. the original LIST is _not_ reversed; it becomes garbage.
  209. 'Reverse!' simply re-uses its structure.
  210. -- procedure: memq? object list --> boolean
  211. Returns '#t' if OBJECT is a member of LIST, as determined by 'eq?';
  212. or '#f' if not.
  213. -- procedure: first predicate list --> elt or '#f'
  214. -- procedure: any predicate list --> elt or '#f'
  215. 'First' returns the first element of LIST that satisfies PREDICATE,
  216. or '#f' if no element does. 'Any' returns an element of LIST that
  217. satisfies PREDICATE. Note that 'any' may choose any element of the
  218. list, whereas 'first' explicitly returns the _first_ element that
  219. satisfies PREDICATE.
  220. -- procedure: any? predicate list --> boolean
  221. -- procedure: every? predicate list --> boolean
  222. 'Any?' returns '#t' if any element of LIST satisfies PREDICATE, or
  223. '#f' if none do. 'Every?' returns '#t' if every element of LIST
  224. satisfies PREDICATE, or '#f' if there exists an element that does
  225. not.
  226. -- procedure: filter predicate list --> filtered-list
  227. -- procedure: filter! predicate list --> filtered-list
  228. These return a list of all elements in LIST that satisfy PREDICATE.
  229. 'Filter' is not allowed to modify LIST's structure; 'filter!' may,
  230. however.
  231. -- procedure: filter-map proc list --> list
  232. This is a combination of 'filter' and 'map'. For each element E in
  233. LIST: if '(PROC E)' returns a true value, that true value is
  234. collected in the output list. 'Filter-map' does not modify LIST's
  235. structure.
  236. -- procedure: remove-duplicates list --> uniquified-list
  237. Returns a unique list of all elements in LIST; that is, if there
  238. were any duplicates of any element E in LIST, only a single E will
  239. occur in the returned list. 'Remove-duplicates' does not modify
  240. LIST's structure.
  241. -- procedure: partition-list predicate list --> [satisfied unsatisfied]
  242. -- procedure: partition-list! predicate list --> [satisfied
  243. unsatisfied]
  244. These return two values: a list of all elements in LIST that do
  245. satisfy PREDICATE and a list of all elements that do not.
  246. 'Partition-list' is not allowed to modify LIST's structure;
  247. 'partition-list!' is.
  248. -- procedure: delq object list --> list
  249. -- procedure: delq! object list --> list
  250. These return a list containing all elements of LIST except for
  251. OBJECT. 'Delq' is not allowed to modify LIST's structure; 'delq!'
  252. is.
  253. -- procedure: delete predicate list --> list
  254. Returns a list of all elements in LIST that do not satisfy
  255. PREDICATE. Note that, despite the lack of exclamation mark in the
  256. name, this _may_ modify LIST's structure.
  257. -- procedure: string->immutable-string string --> immutable-string
  258. Returns an immutable string with STRING's contents. If STRING is
  259. already immutable, it is returned; otherwise, an immutable copy is
  260. returned.
  261. 6.8.6 Multiple value binding
  262. ----------------------------
  263. The 'receiving' structure exports the 'receive' macro, a convenient
  264. syntax atop R5RS's 'call-with-values'.
  265. -- syntax: receive formals producer body
  266. Binds the variables in the lambda parameter list FORMALS to the
  267. return values of PRODUCER in BODY.
  268. (receive FORMALS
  269. PRODUCER
  270. BODY)
  271. ==
  272. (call-with-values
  273. (lambda () PRODUCER)
  274. (lambda FORMALS BODY))
  275. For sequences of multiple value bindings, the 'mvlet' structure
  276. exports two convenient macros.
  277. -- syntax: mvlet*
  278. -- syntax: mvlet
  279. 'Mvlet*' is a multiple-value version of 'let' or a linearly nested
  280. version of 'receive':
  281. (mvlet* ((FORMALS_{0} PRODUCER_{0})
  282. (FORMALS_{1} PRODUCER_{1})
  283. ...)
  284. BODY)
  285. ==
  286. (call-with-values
  287. (lambda () PRODUCER_{0})
  288. (lambda FORMALS_{0}
  289. (call-with-values
  290. (lambda () PRODUCER_{1})
  291. (lambda FORMALS_{1}
  292. ...BODY...))))
  293. 'Mvlet' is similar, but each PRODUCER is evaluated in an
  294. environment where none of the variables in any of the FORMALS is
  295. bound, and the order in which each producer expression is evaluated
  296. is unspecified.
  297. 6.8.7 Object dumper
  298. -------------------
  299. Scheme48 has a rudimentary object dumper and retriever in the structure
  300. 'dump/restore'. It is not a 'real' object dumper in the sense that it
  301. will not handle cycles in object graphs correctly; it simply performs a
  302. recursive descent and will diverge if it reaches a cycle or stop after a
  303. recursive depth parameter.
  304. The types of objects that the dumper supports are: several
  305. miscellaneous constants ('()', '#t', '#f', & the unspecific token),
  306. pairs, vectors, symbols, numbers, strings, characters, and byte vectors.
  307. -- procedure: dump object char-writer depth --> unspecified
  308. Dumps OBJECT by repeatedly calling CHAR-WRITER, which must be a
  309. procedure that accepts exactly one character argument, on the
  310. characters of the serialized representation. If the dumper
  311. descends into the object graph whose root is OBJECT for more than
  312. DEPTH recursions, an ellipsis token is dumped in the place of the
  313. vertex at DEPTH.
  314. -- procedure: restore char-reader --> object
  315. Restores the object whose serialized components are retrieved by
  316. repeatedly calling CHAR-READER, which must be a procedure that
  317. accepts zero arguments and returns a character.
  318. 6.8.8 Simple time access
  319. ------------------------
  320. The 'time' structure exports a simple facility for accessing time
  321. offsets in two different flavours.
  322. -- procedure: real-time --> milliseconds
  323. Returns the real time in milliseconds that has passed since some
  324. unspecified moment in time.(1) Though not suitable for
  325. measurements relative to entities outside the Scheme48 image, the
  326. real time is useful for measuring time differences within the
  327. Scheme image with reasonable precision; for example, thread sleep
  328. timing is implemented with this real time primitive.
  329. -- procedure: run-time --> ticks
  330. Returns the run time as an integer representing processor clock
  331. ticks since the start of the Scheme48 process. This is much less
  332. precise than the real time, but it is useful for measuring time
  333. actually spent in the Scheme48 process, as opposed to time in
  334. general.
  335. ---------- Footnotes ----------
  336. (1) In the current implementation on Unix, this moment happens to be
  337. the first call to 'real-time'; on Win32, this is the start of the Scheme
  338. process.
  339. 
  340. File: scheme48.info, Node: C interface, Next: POSIX interface, Prev: Libraries, Up: Top
  341. 7 C interface
  342. *************
  343. (This chapter was derived from work copyrighted (C) 1993-2005 by Richard
  344. Kelsey, Jonathan Rees, and Mike Sperber.)
  345. This chapter describes an interface for calling C functions from Scheme,
  346. calling Scheme procedures from C, and working with the Scheme heap in C.
  347. Scheme48 manages stub functions in C that negotiate between the calling
  348. conventions of Scheme & C and the memory allocation policies of both
  349. worlds. No stub generator is available yet, but writing stubs is a
  350. straightforward task.
  351. * Menu:
  352. * Shared bindings between Scheme and C::
  353. * Calling C functions from Scheme::
  354. * Dynamic loading of C modules::
  355. * Accessing Scheme data from C::
  356. * Calling Scheme procedures from C::
  357. * Interacting with the Scheme heap in C::
  358. * Using Scheme records in C::
  359. * Raising exceptions from C::
  360. * Unsafe C macros::
  361. 7.1 Overview of the C interface
  362. ===============================
  363. The following facilities are available for interfacing between Scheme48
  364. & C:
  365. * Scheme code can call C functions.
  366. * The external interface provides full introspection for all Scheme
  367. objects. External code may inspect, modify, and allocate Scheme
  368. objects arbitrarily.
  369. * External code may raise exceptions back to Scheme48 to signal
  370. errors.
  371. * External code may call back into Scheme. Scheme48 correctly
  372. unrolls the process stack on non-local exits.
  373. * External modules may register bindings of names to values with a
  374. central registry accessible from Scheme. Conversely, Scheme code
  375. can register shared bindings for access by C code.
  376. 7.1.1 Scheme structures
  377. -----------------------
  378. On the Scheme side of the C interface, there are three pertinent
  379. structures: 'shared-bindings' (*note Shared bindings between Scheme and
  380. C::), which provides the Scheme side of the facility for sharing data
  381. between Scheme and C; 'external-calls' (*note Calling C functions from
  382. Scheme::), which exports several ways to call C functions from Scheme,
  383. along with some useful facilities, such as object finalizers, which are
  384. also available from elsewhere; and 'load-dynamic-externals' (*note
  385. Dynamic loading of C modules::), which provides a dynamic external
  386. object loading facility. Also, the old dynamic loading facility is
  387. still available from the 'dynamic-externals' structure, but its use is
  388. deprecated, and it will most likely vanish in a later release.
  389. 7.1.2 C naming conventions
  390. --------------------------
  391. Scheme48's C bindings all have strict naming conventions. Variables &
  392. procedures have 's48_' prefixed to them; macros, 'S48_'. Whenever a C
  393. name is derived from a Scheme identifier, hyphens are replaced with
  394. underscores. Also, procedures or variables are converted to lowercase,
  395. while macros are converted to uppercase. The '?' suffix, generally
  396. appended to predicates, is converted to '_p' (or '_P' in macro names).
  397. Trailing '!' is dropped. For example, the C macro that corresponds with
  398. Scheme's 'pair?' predicate is named 'S48_PAIR_P', and the C macro to
  399. assign the car of a pair is named 'S48_SET_CAR'. Procedures and macros
  400. that do not verify the types of their arguments have 'unsafe' in their
  401. names.
  402. All of the C functions and macros described have prototypes or
  403. definitions in the file 'c/scheme48.h' of Scheme48's standard
  404. distribution. The C type for Scheme values is defined there to be
  405. 's48_value'.
  406. 7.1.3 Garbage collection
  407. ------------------------
  408. Scheme48 uses a copying garbage collector. The collector must be able
  409. to locate all references to objects allocated in the Scheme48 heap in
  410. order to ensure that storage is not reclaimed prematurely and to update
  411. references to objects moved by the collector. The garbage collector may
  412. run whenever an object is allocated in the heap. C variables whose
  413. values are Scheme48 objects and which are live across heap allocation
  414. calls need to be registered with the garbage collector. For more
  415. information, *note Interacting with the Scheme heap in C::.
  416. 
  417. File: scheme48.info, Node: Shared bindings between Scheme and C, Next: Calling C functions from Scheme, Up: C interface
  418. 7.2 Shared bindings between Scheme and C
  419. ========================================
  420. Shared bindings are the means by which named values are shared between
  421. Scheme & C code. There are two separate tables of shared bindings, one
  422. for values defined in Scheme and accessed from C and the other for the
  423. opposite direction. Shared bindings actually bind names to cells, to
  424. allow a name to be resolved before it has been assigned. This is
  425. necessary because C initialization code may run before or after the
  426. corresponding Scheme code, depending on whether the Scheme code is in
  427. the resumed image or run in the current session. The Scheme bindings
  428. described here are available from the 'shared-bindings' structure.
  429. 7.2.1 Scheme shared binding interface
  430. -------------------------------------
  431. -- Scheme procedure: shared-binding? object --> boolean
  432. -- Scheme procedure: shared-binding-is-import? shared-binding -->
  433. boolean
  434. 'Shared-binding?' is the disjoint type predicate for all shared
  435. bindings, imported or exported; 'shared-binding-is-import?' returns
  436. true if SHARED-BINDING was imported into Scheme from C, and false
  437. if it has the converse direction.
  438. -- Scheme procedure: shared-binding-ref shared-binding --> value
  439. -- Scheme procedure: shared-binding-set! shared-binding value -->
  440. unspecified
  441. 'Shared-binding-ref' returns the value of SHARED-BINDING;
  442. 'shared-binding-set!' sets the value of SHARED-BINDING to be VALUE.
  443. -- Scheme procedure: lookup-imported-binding name --> shared-binding
  444. -- Scheme procedure: define-imported-binding name value --> unspecified
  445. -- Scheme procedure: undefine-imported-binding name --> unspecified
  446. 'Lookup-imported-binding' returns the binding imported from C to
  447. Scheme with the given name; a binding is created if none exists.
  448. 'Define-imported-binding' creates a new such binding, anomalously
  449. from within Scheme; such bindings are usually created instead from
  450. within C using the C 's48_define_exported_binding' function.
  451. 'Undefine-imported-binding' removes the shared binding whose name
  452. is NAME from the table of imported bindings.
  453. -- Scheme procedure: lookup-exported-binding name --> shared-binding
  454. -- Scheme procedure: define-exported-binding name value --> unspecified
  455. -- Scheme procedure: undefine-exported-binding name --> unspecified
  456. Equivalents of the above three procedures, but for bindings
  457. exported from Scheme to C. 'Define-imported-binding', unlike
  458. 'define-exported-binding', is customary to use in Scheme, as its
  459. intended use is to make a Scheme value available to C code from
  460. within Scheme.
  461. -- Scheme procedure: find-undefined-imported-bindings --> vector
  462. Returns a vector of all bindings imported into Scheme from C with
  463. undefined values, i.e. those created implicitly by lookups that
  464. have not yet been assigned rather than those created explicitly by
  465. the shared binding definers ('define-exported-binding', &c.).
  466. 7.2.2 C shared binding interface
  467. --------------------------------
  468. -- C macro: s48_value S48_SHARED_BINDING_P (s48_value OBJ)
  469. -- C macro: s48_value S48_SHARED_BINDING_NAME (s48_value
  470. SHARED_BINDING)
  471. -- C macro: s48_value S48_SHARED_BINDING_IS_IMPORTP (s48_value
  472. SHARED-BINDING)
  473. -- C macro: s48_value S48_SHARED_BINDING_REF (s48_value SHARED_BINDING)
  474. -- C macro: void S48_SHARED_BINDING_SET (s48_value SHARED_BINDING,
  475. s48_value VALUE)
  476. These macros are C counterparts to Scheme's 'shared-binding?',
  477. 'shared-binding-name', 'shared-binding-is-import?',
  478. 'shared-binding-ref', and 'shared-binding-set!', respectively.
  479. -- C macro: statement S48_SHARED_BINDING_CHECK (s48_value BINDING)
  480. Signals an exception if and only if BINDING's value is Scheme48's
  481. 'unspecific' value.
  482. *Huh?:* Undefined shared bindings are not initialized with the
  483. 'unspecific' value, but rather with an entirely different special
  484. token referred to internally as 'undefined,' used in circumstances
  485. such as this -- yet 'S48_SHARED_BINDING_CHECK', as defined in
  486. 'scheme48.h', definitely checks whether BINDING's value is the
  487. 'unspecific' value.
  488. -- C function: s48_value s48_get_imported_binding (char *NAME)
  489. Returns the shared binding defined in Scheme for NAME, creating it
  490. if necessary.
  491. -- C function: void s48_define_exported_binding (char *NAME, s48_value
  492. VALUE)
  493. Defines a shared binding named NAME with the value VALUE that can
  494. be accessed from Scheme.
  495. -- C macro: void S48_EXPORT_FUNCTION (FN)
  496. This is a convenience for the common case of exporting a C function
  497. to Scheme. This expands into
  498. s48_define_exported_binding("FN",
  499. s48_enter_pointer(FN))
  500. which boxes the function into a Scheme48 byte vector and then
  501. exports it as a shared binding. Note that 's48_enter_pointer'
  502. allocates space in the Scheme heap and may trigger a garbage
  503. collection; *note Interacting with the Scheme heap in C::.
  504. 
  505. File: scheme48.info, Node: Calling C functions from Scheme, Next: Dynamic loading of C modules, Prev: Shared bindings between Scheme and C, Up: C interface
  506. 7.3 Calling C functions from Scheme
  507. ===================================
  508. The 'external-calls' structure exports several ways to call C functions
  509. from Scheme, along with several other related utilities, many of which
  510. are also available from other structures. There are two different ways
  511. to call C functions from Scheme, depending on how the C function was
  512. obtained:
  513. -- Scheme procedure: call-imported-binding binding argument ... -->
  514. value
  515. -- Scheme procedure: call-external-value byte-vector name argument ...
  516. --> value
  517. Each of these applies its first argument, a C function, to the rest
  518. of the arguments. For 'call-imported-binding', the function
  519. argument must be an imported binding. For 'call-external-value',
  520. the function argument must be a byte vector that contains a pointer
  521. to a C function, and NAME should be a string that names the
  522. function. The NAME argument is used only for printing error
  523. messages.
  524. For both of these, the C function is passed the argument values,
  525. and the value returned is that returned by the C function. No
  526. automatic representation conversion occurs for either arguments or
  527. return values. Up to twelve arguments may be passed. There is no
  528. method supplied for returning multiple values to Scheme from C or
  529. vice versa (mainly because C does not have multiple return values).
  530. Keyboard interrupts that occur during a call to a C function are
  531. ignored until the function returns to Scheme.(1)
  532. -- Scheme syntax: import-definition name [c-string]
  533. -- Scheme syntax: import-lambda-definition name formals [c-string]
  534. These macros simplify importing bindings from C into Scheme and
  535. wrapping such bindings in Scheme procedures. 'Import-definition'
  536. defines NAME to be the shared binding named by C-STRING, whose
  537. value, if it is not supplied, is by default a string of NAME,
  538. downcased and with all hyphens translated to underscores.
  539. (define NAME (lookup-imported-binding C-STRING))
  540. For example,
  541. (import-definition my-foo)
  542. ==> (define my-foo (lookup-imported-binding "my_foo"))
  543. 'Import-lambda-definition' imports the named C binding, using
  544. either the provided C binding name or by translating the Scheme
  545. name as with 'import-definition', and defines NAME to be a
  546. procedure with the given formal parameter list that calls the
  547. imported C binding with its arguments:
  548. (define BINDING (lookup-imported-binding C-STRING))
  549. (define (NAME FORMAL ...)
  550. (call-imported-binding BINDING FORMAL ...))
  551. Examples:
  552. (import-lambda-definition integer->process-id (int)
  553. "posix_getpid")
  554. ==>
  555. (define BINDING_{0}
  556. (lookup-imported-binding "posix_getpid"))
  557. (define (integer->process-id int)
  558. (call-imported-binding BINDING_{0} int))
  559. (import-lambda-definition s48-system (string))
  560. ==>
  561. (define BINDING_{1}
  562. (lookup-imported-binding "s48_system"))
  563. (define (s48-system string)
  564. (call-imported-binding BINDING_{1} string))
  565. where BINDING_{0} and BINDING_{1} are fresh, unused variable names.
  566. *Warning:* 'Import-lambda-definition', as presently implemented,
  567. requires a fixed parameter list; it does not allow 'rest list'
  568. arguments.
  569. -- Scheme procedure: lookup-imported-binding name --> shared-binding
  570. -- Scheme procedure: define-exported-binding shared-binding -->
  571. unspecified
  572. -- Scheme procedure: shared-binding-ref shared-binding --> value
  573. These are identical to the procedures accessible with the same
  574. names from the 'shared-bindings' structure (*note Shared bindings
  575. between Scheme and C::).
  576. -- Scheme procedure: add-finalizer! object procedure --> unspecified
  577. Registers PROCEDURE as the finalizer for OBJECT. When OBJECT is
  578. later about to be reclaimed by the garbage collector, PROCEDURE is
  579. applied to one argument, OBJECT. All finalizers are applied in a
  580. child of the root scheduler thread that is spawned after every
  581. garbage collection. If an error occurs in any finalizer, it will
  582. be printed to the standard error output port, and all other
  583. finalizers will be aborted before they are given a chance to run.
  584. Because of this, and the fact that finalizers are collected and run
  585. after every garbage collection, they should perform as little
  586. computation as possible. PROCEDURE may also create new references
  587. to OBJECT elsewhere in the heap, in which case the object will not
  588. be reclaimed, but its associated finalizer will be forgotten.
  589. *Warning:* Finalizers are expensive. Use sparingly.
  590. -- Scheme procedure: define-record-resumer record-type resumer -->
  591. unspecified
  592. Identical to the procedure accessible with the same name from the
  593. 'record-types' structure (*note Records::). Record resumers are
  594. often useful in working with foreign C data, which is in many cases
  595. specific to the program image within the operating system, and
  596. which cannot straightforwardly be relocated to a different address
  597. space.
  598. ---------- Footnotes ----------
  599. (1) This is clearly a problem; we are working on a solution.
  600. 
  601. File: scheme48.info, Node: Dynamic loading of C modules, Next: Accessing Scheme data from C, Prev: Calling C functions from Scheme, Up: C interface
  602. 7.4 Dynamic loading of C modules
  603. ================================
  604. External code can be loaded into a running Scheme48 on most Unices and
  605. on Windows. Such external code must be stored in shared objects; see
  606. below on details of the C side. The relevant Scheme procedures are
  607. available in the 'load-dynamic-externals' structure:
  608. -- procedure: load-dynamic-externals filename add-file-type?
  609. reload-on-repeat? reload-on-resume? --> dynamic-externals
  610. -- procedure: import-dynamic-externals filename --> dynamic-externals
  611. -- procedure: unload-dynamic-externals dynamic-externals -->
  612. unspecified
  613. 'Load-dynamic-external' loads a shared object from FILENAME, with
  614. an appropriate file type appended if ADD-FILE-TYPE? is true ('.so'
  615. on Unix and '.dll' on Windows), and returns a "dynamic externals"
  616. object representing the loaded shared object. If the shared object
  617. was already loaded, then if RELOAD-ON-REPEAT? is true, it is
  618. reloaded; otherwise, the 'load-dynamic-externals' call has no
  619. effect. If the dynamic externals descriptor is stored in a dumped
  620. heap image, when that heap image is resumed, if 'reload-on-resume?'
  621. is true, the shared object corresponding with that dynamic external
  622. descriptor is reloaded. 'Unload-dynamic-externals' unloads the
  623. given dynamic externals object.
  624. 'Import-dynamic-externals' is a convenient wrapper for the common
  625. case of 'load-dynamic-externals'; it is equivalent to
  626. '(load-dynamic-externals #t #f #t)', i.e. it will append a file
  627. type, it will not reload the shared object if it was already
  628. loaded, and the shared object will be loaded if part of a resumed
  629. heap image.
  630. -- procedure: reload-dynamic-externals filename --> unspecified
  631. Reloads the shared object named by FILENAME. This is intended as
  632. an interactive utility, which is why it accepts the filename of the
  633. shared object and not a dynamic externals descriptor.
  634. Shared objects intended to be loaded into Scheme48 must define two
  635. functions:
  636. -- C function: void s48_on_load (void)
  637. -- C function: void s48_on_reload (void)
  638. 's48_on_load' is called when the shared object is initially loaded
  639. by Scheme48. It typically consists of a number of invocations of
  640. 'S48_EXPORT_FUNCTION' to make C functions available to Scheme48
  641. code. 's48_on_reload' is called when the shared object is reloaded
  642. after it has been initially loaded once; it typically just calls
  643. 's48_on_load', but it may perform other reinitializations.
  644. On Linux, the following commands compile the C source file 'foo.c'
  645. into a shared object 'foo.so' that can be loaded dynamically by
  646. Scheme48:
  647. % gcc -c -o foo.o foo.c
  648. % ld -shared -o foo.so foo.o
  649. 7.4.1 Old dynamic loading interface
  650. -----------------------------------
  651. The old 'dynamic-externals' structures, which exported 'dynamic-load',
  652. 'get-external', 'lookup-external', 'lookup-all-externals', 'external?',
  653. 'external-name', 'external-value', and 'call-external', is still
  654. supported, but it will not work on Windows, its use is deprecated, and
  655. it is likely to vanish in a future release. The old documentation is
  656. preserved to aid updating of old code:
  657. On architectures that support it, external code can be loaded into a
  658. running Scheme48 process, and C object file bindings can be accessed at
  659. runtime & their values called. These Scheme procedures are exported by
  660. the structure 'dynamic-externals'.
  661. In some Unices, retrieving a value from the current process may
  662. require a non-trivial amount of computation. We recommend that a
  663. dynamically loaded file contain a single initialization function that
  664. creates shared bindings for the values exported by the file.
  665. -- Scheme procedure: dynamic-load string --> unspecified
  666. Loads the filename named by STRING into the current process. An
  667. exception is raised if the file cannot be found or if dynamic
  668. loading is not supported by the host operating system. The file
  669. must have been compiled & linked appropriately. For Linux, for
  670. example, the following commands compile 'foo.c' into a file
  671. 'foo.so' that can be loaded dynamically:
  672. % gcc -c -o foo.o foo.c
  673. % ld -shared -o foo.so foo.o
  674. -- Scheme procedure: get-external string --> external
  675. -- Scheme procedure: external? object --> boolean
  676. -- Scheme procedure: external-name external --> string
  677. -- Scheme procedure: external-value external --> byte-vector
  678. These procedures access external values bound in the current
  679. process. 'Get-external' returns a "external" object that contains
  680. the value of the C binding with the name STRING. It signals a
  681. warning if there is no such binding in the current process.
  682. 'External?' is the disjoint type predicate for externals, and
  683. 'external-name' & 'external-value' return the name & value of an
  684. external. The value is represented as a byte vector (*note Bitwise
  685. manipulation::) of length four on 32-bit architectures. The value
  686. is that of the C binding from when 'get-external' (or
  687. 'lookup-external', as described below) was called.
  688. -- Scheme procedure: lookup-external external --> boolean
  689. -- Scheme procedure: lookup-all-externals --> boolean
  690. 'Lookup-external' updates the value of EXTERNAL by looking up its
  691. binding in the current process. It returns '#t' if the external is
  692. bound and '#f' if not. 'Lookup-all-externals' calls
  693. 'lookup-external' on all externals in the current Scheme48 image.
  694. It returns '#t' if all were bound and '#f' if there was at least
  695. one unbound external.
  696. -- Scheme procedure: call-external external argument ... --> value
  697. Calls the C function pointed to by EXTERNAL with the given
  698. arguments, and returns the value that the C function returned.
  699. This is like 'call-imported-binding' and 'call-external-value'
  700. except that the function argument is represented as an external,
  701. not as an imported binding or byte vector containing a pointer.
  702. For more details, *note Calling C functions from Scheme::.
  703. 
  704. File: scheme48.info, Node: Accessing Scheme data from C, Next: Calling Scheme procedures from C, Prev: Dynamic loading of C modules, Up: C interface
  705. 7.5 Accessing Scheme data from C
  706. ================================
  707. The C header file 'scheme48.h' provides access to Scheme48 data
  708. structures. The type 's48_value' is used for Scheme values. When the
  709. type of a value is known, such as the integer returned by the Scheme
  710. procedure 'vector-length' or the boolean returned by 'pair', the
  711. corresponding C function returns a C value of the appropriate type, not
  712. an 's48_value'. Predicates return '1' for true and '0' for false.
  713. -- C macro: s48_value S48_FALSE
  714. -- C macro: s48_value S48_TRUE
  715. -- C macro: s48_value S48_NULL
  716. -- C macro: s48_value S48_UNSPECIFIC
  717. -- C macro: s48_value S48_EOF
  718. -- C macro: long S48_MAX_FIXNUM_VALUE
  719. -- C macro: long S48_MIN_FIXNUM_VALUE
  720. These C macros denote various Scheme constants. 'S48_FALSE' is the
  721. boolean false value, written in Scheme as '#f'. 'S48_TRUE' is the
  722. boolean true value, or '#t'. 'S48_NULL' is the empty list '()'.
  723. 'S48_UNSPECIFIC' is a miscellaneous value returned by procedures
  724. that have no meaningful return value (accessed in Scheme48 by the
  725. nullary procedure 'unspecific' in the 'util' structure). 'S48_EOF'
  726. is the end-of-file object (which the Scheme procedure 'eof-object?'
  727. answers true for). 'S48_MAX_FIXNUM_VALUE' is the maximum integer
  728. as a 'long' that can be represented in a Scheme48 fixnum.
  729. 'S48_MIN_FIXNUM_VALUE' is similar, but the minimum integer.
  730. -- C macro: int S48_EXTRACT_BOOLEAN (s48_value BOOLEAN)
  731. -- C function: unsigned char s48_extract_char (s48_value CHAR)
  732. -- C function: char * s48_extract_string (s48_value STRING)
  733. -- C function: char * s48_extract_byte_vector (s48_value BYTEV)
  734. -- C function: long s48_extract_integer (s48_value INTEGER)
  735. -- C function: double s48_extract_double (s48_value DOUBLE)
  736. -- C macro: s48_value S48_ENTER_BOOLEAN (int BOOLEAN)
  737. -- C function: s48_value s48_enter_char (unsigned char CHAR)
  738. -- C function: s48_value s48_enter_string (char *STRING)
  739. -- C function: s48_value s48_enter_byte_vector (char *BYTEV, long
  740. LENGTH)
  741. -- C function: s48_value s48_enter_integer (long INTEGER)
  742. -- C function: s48_value s48_enter_double (double DOUBLE)
  743. These functions & macros convert values between their respective
  744. Scheme & C representations.
  745. 'S48_EXTRACT_BOOLEAN' returns '0' if BOOLEAN is '#f' and '1'
  746. otherwise. 'S48_ENTER_BOOLEAN' returns the Scheme value '#f' if
  747. its argument is zero and '#t' otherwise.
  748. 's48_extract_char' & 's48_enter_char' convert between Scheme
  749. characters and C 'char's.
  750. 's48_extract_string' & 's48_extract_byte_vector' return pointers to
  751. the actual storage used by STRING or BYTEV. These pointers are
  752. valid only until the next garbage collection, however; *note
  753. Interacting with the Scheme heap in C::. 's48_enter_string' &
  754. 's48_enter_byte_vector' allocate space on the Scheme48 heap for the
  755. given strings or byte vectors. 's48_enter_string' copies the data
  756. starting from the pointer it is given up to the first ASCII 'NUL'
  757. character, whereas 's48_enter_byte_vector' is given the number of
  758. bytes to copy into the Scheme heap.
  759. 's48_extract_integer' returns a C 'long' that represents the Scheme
  760. integer as input. If the Scheme integer is too large to be
  761. represented in a long, an exception is signalled. (The Scheme
  762. integer may be a fixnum or a bignum.) 's48_enter_integer' converts
  763. back to Scheme integers, and it will never signal an exception.
  764. 's48_extract_double' & 's48_enter_double' convert between Scheme &
  765. C double-precision floating point representations.
  766. Of these, 's48_enter_string', 's48_enter_byte_vector',
  767. 's48_enter_integer', & 's48_enter_double' may cause the garbage
  768. collector to be invoked: the former two copy the string or byte
  769. vector onto the Scheme heap first, 's48_enter_integer' may need to
  770. allocate a bignum (since C 'long's are wider than Scheme48
  771. fixnums), and floats are heap-allocated in Scheme48.
  772. -- C macro: int S48_TRUE_P (s48_value OBJECT)
  773. -- C macro: int S48_FALSE_P (s48_value OBJECT)
  774. 'S48_TRUE_P' returns true if OBJECT is the true constant 'S48_TRUE'
  775. and false if otherwise. 'S48_FALSE_P' returns true if its argument
  776. is the false constant 'S48_FALSE' and false if otherwise.
  777. -- C macro: int S48_FIXNUM_P (s48_value OBJECT)
  778. -- C function: long s48_extract_fixnum (s48_value FIXNUM)
  779. -- C function: s48_value s48_enter_fixnum (long INTEGER)
  780. 'S48_FIXNUM_P' is the C predicate for Scheme48 fixnums, delimited
  781. in range by 'S48_MIN_FIXNUM_VALUE' & 'S48_MAX_FIXNUM_VALUE'.
  782. 's48_extract_fixnum' returns the C 'long' representation of the
  783. Scheme fixnum, and 's48_enter_fixnum' returns the Scheme fixnum
  784. representation of the C 'long'. These are identical to
  785. 's48_extract_integer' & 's48_enter_integer', except that
  786. 's48_extract_fixnum' will never raise a range exception, but
  787. 's48_enter_fixnum' may, and 's48_enter_fixnum' will never return a
  788. bignum; this is due to the fact that C 'long's have a wider range
  789. than Scheme48 fixnums.
  790. -- C macro: int S48_EQ_P (s48_value A, s48_value B)
  791. -- C macro: int S48_CHAR_P (s48_value OBJECT)
  792. -- C macro: int S48_PAIR_P (s48_value OBJECT)
  793. -- C macro: int S48_VECTOR_P (s48_value OBJECT)
  794. -- C macro: int S48_STRING_P (s48_value OBJECT)
  795. -- C macro: int S48_SYMBOL_P (s48_value OBJECT)
  796. -- C macro: int S48_BYTE_VECTOR_P (s48_value OBJECT)
  797. -- C macro: s48_value S48_CAR (s48_value PAIR)
  798. -- C macro: s48_value S48_CDR (s48_value PAIR)
  799. -- C macro: void S48_SET_CAR (s48_value PAIR, s48_value OBJECT)
  800. -- C macro: void S48_SET_CDR (s48_value PAIR, s48_value OBJECT)
  801. -- C function (may GC): s48_value s48_cons (s48_value CAR, s48_value
  802. CDR)
  803. -- C function: s48_value s48_length (s48_value LIST)
  804. -- C macro: long S48_VECTOR_LENGTH (s48_value VECTOR)
  805. -- C macro: s48_value S48_VECTOR_REF (s48_value VECTOR, long INDEX)
  806. -- C macro: void S48_VECTOR_SET (s48_value VECTOR, long INDEX,
  807. s48_value OBJECT)
  808. -- C function (may GC): s48_value s48_make_vector (long LENGTH,
  809. s48_value FILL)
  810. -- C macro: long S48_STRING_LENGTH (s48_value STRING)
  811. -- C macro: char S48_STRING_REF (s48_value STRING, long INDEX)
  812. -- C macro: void S48_STRING_SET (s48_value STRING, long INDEX, char
  813. CHAR)
  814. -- C function (may GC): s48_value s48_make_string (long LENGTH, char
  815. FILL)
  816. -- C macro: s48_value S48_SYMBOL_TO_STRING (s48_value SYMBOL)
  817. -- C macro: long S48_BYTE_VECTOR_LENGTH (s48_value BYTEV)
  818. -- C macro: char S48_BYTE_VECTOR_REF (s48_value BYTEV, long INDEX)
  819. -- C macro: void S48_BYTE_VECTOR_SET (s48_value BYTEV, long INDEX, char
  820. BYTE)
  821. -- C function (may GC): s48_value s48_make_byte_vector (long LENGTH)
  822. C versions of miscellaneous Scheme procedures. The names were
  823. derived from their Scheme counterparts by replacing hyphens with
  824. underscores, '?' suffixes with '_P', and dropping '!' suffixes.
  825. 
  826. File: scheme48.info, Node: Calling Scheme procedures from C, Next: Interacting with the Scheme heap in C, Prev: Accessing Scheme data from C, Up: C interface
  827. 7.6 Calling Scheme procedures from C
  828. ====================================
  829. -- C function: s48_value s48_call_scheme (s48_value PROC, long NARGS,
  830. ...)
  831. Calls the Scheme procedure PROC on NARGS arguments, which are
  832. passed as additional arguments to 's48_call_scheme'. There may be
  833. at most twelve arguments. The value returned by the Scheme
  834. procedure is returned to the C procedure. Calling any Scheme
  835. procedure may potentially cause a garbage collection.
  836. There are some complications that arise when mixing calls from C to
  837. Scheme with continuations & threads. C supports only downward
  838. continuations (via 'longjmp()'). Scheme continuations that capture a
  839. portion of the C stack have to follow the same restriction. For
  840. example, suppose Scheme procedure 's0' captures continuation 'a' and
  841. then calls C function 'c0', which in turn calls Scheme procedure 's1'.
  842. 'S1' can safely call the continuation 'a', because that is a downward
  843. use. When 'a' is called, Scheme48 will remove the portion of the C
  844. stack used by the call to 'c0'. On the other hand, if 's1' captures a
  845. continuation, that continuation cannot be used from 's0', because, by
  846. the time control returns to 's0', the C stack used by 's0' will no
  847. longer be valid. An attempt to invoke an upward continuation that is
  848. closed over a portion of the C stack will raise an exception.
  849. In Scheme48, threads are implemented using continuations, so the
  850. downward restriction applies to them as well. An attempt to return from
  851. Scheme to C at a time when the appropriate C frame is not on the top of
  852. the C stack will cause the current thread to block until the frame is
  853. available. For example, suppose thread 't0' calls a C function that
  854. calls back to Scheme, at which point control switches to thread 't1',
  855. which also calls C & then back to Scheme. At this point, both 't0' &
  856. 't1' have active calls to C on the C stack, with 't1''s C frame above
  857. 't0''s. If 't0' attempts to return from Scheme to C, it will block,
  858. because the frame is not yet accessible. Once 't1' has returned to C
  859. and from there back to Scheme, 't0' will be able to resume. The return
  860. to Scheme is required because context switches can occur only while
  861. Scheme code is running. 'T0' will also be able to resume if 't1' uses a
  862. continuation to throw past its call out to C.
  863. 
  864. File: scheme48.info, Node: Interacting with the Scheme heap in C, Next: Using Scheme records in C, Prev: Calling Scheme procedures from C, Up: C interface
  865. 7.7 Interacting with the Scheme heap in C
  866. =========================================
  867. Scheme48 uses a precise copying garbage collector. Any code that
  868. allocates objects within the Scheme48 heap may trigger a garbage
  869. collection. Variables bound to values in the Scheme48 heap need to be
  870. registered with the garbage collector so that the value will be safely
  871. held and so that the variables will be updated if the garbage collector
  872. moves the object. The garbage collector has no facility for updating
  873. pointers to the interiors of objects, so such pointers, for example the
  874. ones returned by 'S48_EXTRACT_STRING', will likely become invalid when a
  875. garbage collection occurs.
  876. -- C macro: S48_DECLARE_GC_PROTECT (N)
  877. -- C macro: void S48_GC_PROTECT_N (s48_value VAR_{1}, ..., s48_value
  878. VAR_{N})
  879. -- C macro: void S48_GC_UNPROTECT ()
  880. 'S48_DECLARE_GC_PROTECT', where 1 <= N <= 9, allocates storage for
  881. registering N variables. At most one use of
  882. 'S48_DECLARE_GC_PROTECT' may occur in a block. After declaring a
  883. GC protection, 'S48_GC_PROTECT_N' registers the N variables with
  884. the garbage collector. It must be within the scope that the
  885. 'S48_DECLARE_GC_PROTECT' occurred in and before any code that can
  886. cause a garbage collection. 'S48_GC_UNPROTECT' removes the current
  887. block's protected variables from the garbage collector's list. It
  888. must be called at the end of the block after any code that may
  889. cause a garbage collection. Omitting any of the three may cause
  890. serious and hard-to-debug problems, because the garbage collector
  891. may relocate an object and invalidate unprotected 's48_value'
  892. pointers. If not 'S48_DECLARE_GC_PROTECT' is matched with a
  893. 'S48_GC_UNPROTECT' or vice versa, a 'gc-protection-mismatch'
  894. exception is raised when a C procedure returns to Scheme.
  895. -- C macro: void * S48_GC_PROTECT_GLOBAL (GLOBAL)
  896. -- C macro: void S48_GC_UNPROTECT_GLOBAL (void *HANDLE)
  897. 'S48_GC_PROTECT_GLOBAL' permanently registers the l-value GLOBAL
  898. with the system as a garbage collection root. It returns a pointer
  899. which may then be supplied to 'S48_GC_UNPROTECT_GLOBAL' to
  900. unregister the l-value as a root.
  901. 7.7.1 Keeping C data structures in the Scheme heap
  902. --------------------------------------------------
  903. C data structures can be stored within the Scheme heap by embedding them
  904. inside byte vectors (*note Bitwise manipulation::). The following
  905. macros can be used to create and access embedded C objects.
  906. -- C macro: s48_value S48_MAKE_VALUE (TYPE)
  907. -- C macro: TYPE S48_EXTRACT_VALUE (s48_value BYTEV, TYPE)
  908. -- C macro: TYPE * S48_EXTRACT_VALUE_POINTER (s48_value BYTEV, TYPE)
  909. -- C macro: void S48_SET_VALUE (s48_value BYTEV, TYPE, TYPE VALUE)
  910. 'S48_MAKE_VALUE' allocates a byte vector large enough to hold a C
  911. value whose type is TYPE. 'S48_EXTRACT_VALUE' returns the contents
  912. of the byte vector BYTEV cast to TYPE, and
  913. 'S48_EXTRACT_VALUE_POINTER' returns a pointer to the contents of
  914. the byte vector, which is valid only until the next garbage
  915. collection. 'S48_SET_VALUE' stores a value into the byte vector.
  916. 7.7.2 C code and heap images
  917. ----------------------------
  918. Scheme48 uses dumped heap images to restore a previous system state.
  919. The Scheme48 heap is written into a file in a machine-independent and
  920. operating-system-independent format. The procedures described above,
  921. however, may be used to create objects in the Scheme heap that contain
  922. information specific to the current machine, operating system, or
  923. process. A heap image containing such objects may not work correctly
  924. when resumed.
  925. To address this problem, a record type may be given a "resumer"
  926. procedure. On startup, the resumer procedure for a record type is
  927. applied to each record of that type in the image being restarted. This
  928. procedure can update the record in a manner appropriate to the machine,
  929. operating system, or process used to resume the image. Note, though,
  930. that there is no reliable order in which record resumer procedures are
  931. applied. To specify the resumer for a record type, use the
  932. 'define-record-resumer' procedure from the 'record-types' structure
  933. (*note Records::).
  934. 
  935. File: scheme48.info, Node: Using Scheme records in C, Next: Raising exceptions from C, Prev: Interacting with the Scheme heap in C, Up: C interface
  936. 7.8 Using Scheme records in C
  937. =============================
  938. External C code can create records and access record slots positionally
  939. using these functions & macros. Note, however, that named access to
  940. record fields is not supported, only indexed access, so C code must be
  941. synchronized carefully with the corresponding Scheme that defines record
  942. types.
  943. -- C function (may GC): s48_value s48_make_record (s48_value
  944. RECORD-TYPE)
  945. -- C macro: int S48_RECORD_P (s48_value OBJECT)
  946. -- C macro: s48_value S48_RECORD_TYPE (s48_value RECORD)
  947. -- C macro: s48_value S48_RECORD_REF (s48_value RECORD, long INDEX)
  948. -- C macro: void S48_RECORD_SET (s48_value RECORD, long INDEX,
  949. s48_value VALUE)
  950. -- C function: void s48_check_record_type (s48_value RECORD, s48_value
  951. TYPE-BINDING)
  952. 's48_make_record' allocates a record on Scheme's heap with the
  953. given record type; its arguments must be a shared binding whose
  954. value is a record type descriptor (*note Records::).
  955. 'S48_RECORD_P' is the type predicate for records.
  956. 'S48_RECORD_TYPE' returns the record type descriptor of RECORD.
  957. 'S48_RECORD_REF' & 'S48_RECORD_SET' operate on records similarly to
  958. how 'S48_VECTOR_REF' & 'S48_VECTOR_SET' work on vectors.
  959. 's48_check_record_type' checks whether RECORD is a record whose
  960. type is the value of the shared binding TYPE_BINDING. If this is
  961. not the case, it signals an exception. (It also signals an
  962. exception if TYPE_BINDING's value is not a record.) Otherwise, it
  963. returns normally.
  964. For example, with this record type definition:
  965. (define-record-type thing :thing
  966. (make-thing a b)
  967. thing?
  968. (a thing-a)
  969. (b thing-b))
  970. the identifier ':thing' is bound to the record type and can be exported
  971. to C thus:
  972. (define-exported-binding "thing-record-type" :thing)
  973. and 'thing' records can be made in C:
  974. static s48_value thing_record_type = S48_FALSE;
  975. void initialize_things(void)
  976. {
  977. S48_GC_PROTECT_GLOBAL(thing_record_type);
  978. thing_record_type = s48_get_imported_binding("thing-record-type");
  979. }
  980. s48_value make_thing(s48_value a, s48_value b)
  981. {
  982. s48_value thing;
  983. S48_DECLARE_GC_PROTECT(2);
  984. S48_GC_PROTECT_2(a, b);
  985. thing = s48_make_record(thing_record_type);
  986. S48_RECORD_SET(thing, 0, a);
  987. S48_RECORD_SET(thing, 1, b);
  988. S48_GC_UNPROTECT();
  989. return thing;
  990. }
  991. Note that the variables 'a' & 'b' must be protected against the
  992. possibility of a garbage collection occurring during the call to
  993. 's48_make_record'.
  994. 
  995. File: scheme48.info, Node: Raising exceptions from C, Next: Unsafe C macros, Prev: Using Scheme records in C, Up: C interface
  996. 7.9 Raising exceptions from C
  997. =============================
  998. The following macros raise certain errors, immediately returning to
  999. Scheme48. Raising an exception performs all necessary clean-up actions
  1000. to properly return to Scheme48, including adjusting the stack of
  1001. protected variables.
  1002. -- C function: s48_raise_scheme_exception (int TYPE, int NARGS, ...)
  1003. The base procedure for raising exceptions. TYPE is the type of
  1004. exception; it should be one of the 'S48_EXCEPTION_...' constants
  1005. defined in 'scheme48.h'. NARGS is the number of additional values
  1006. to be included in the exception; these follow the NARGS argument
  1007. and should all have the type 's48_value'. NARGS may not be greater
  1008. than ten. 's48_raise_scheme_exception' never returns.
  1009. -- C function: s48_raise_argument_type_error (s48_value ARG)
  1010. -- C function: s48_raise_argument_number_error (s48_value NARGS,
  1011. s48_value MIN, s48_value MAX)
  1012. -- C function: s48_raise_range_error (s48_value VALUE, s48_value MIN,
  1013. s48_value MAX)
  1014. -- C function: s48_raise_closed_channel_error ()
  1015. -- C function: s48_raise_os_error (int ERRNO)
  1016. -- C function: s48_raise_out_of_memory_error ()
  1017. Conveniences for raising certain kinds of exceptions. Argument
  1018. type errors are due to procedures receiving arguments of the
  1019. incorrect type. Argument number errors are due to the number of
  1020. arguments being passed to a procedure, NARGS, not being between MIN
  1021. or MAX, inclusive. Range errors are similar, but they are intended
  1022. for larger ranges, not argument numbers. Closed channel errors
  1023. occur when a channel (*note Channels::) was operated upon with the
  1024. expectation that it would not be closed. OS errors originate from
  1025. the OS, and they are denoted with Unix 'errno' values.
  1026. -- C macro: void S48_CHECK_BOOLEAN (s48_value OBJECT)
  1027. -- C macro: void S48_CHECK_SYMBOL (s48_value OBJECT)
  1028. -- C macro: void S48_CHECK_PAIR (s48_value OBJECT)
  1029. -- C macro: void S48_CHECK_STRING (s48_value OBJECT)
  1030. -- C macro: void S48_CHECK_INTEGER (s48_value OBJECT)
  1031. -- C macro: void S48_CHECK_CHANNEL (s48_value OBJECT)
  1032. -- C macro: void S48_CHECK_BYTE_VECTOR (s48_value OBJECT)
  1033. -- C macro: void S48_CHECK_RECORD (s48_value OBJECT)
  1034. -- C macro: void S48_CHECK_SHARED_BINDING (s48_value OBJECT)
  1035. Conveniences for checking argument types. These signal argument
  1036. type errors with 's48_raise_argument_type_error' if their argument
  1037. is not of the type being tested.
  1038. 
  1039. File: scheme48.info, Node: Unsafe C macros, Prev: Raising exceptions from C, Up: C interface
  1040. 7.10 Unsafe C macros
  1041. ====================
  1042. All of the C functions & macros described previously verify that their
  1043. arguments have the appropriate types and lie in the appropriate ranges.
  1044. The following macros are identical to their safe counterparts, except
  1045. that the unsafe variants, by contrast, do _not_ verify coherency of
  1046. their arguments. They are provided for the purpose of writing more
  1047. efficient code; their general use is not recommended.
  1048. -- C macro: char S48_UNSAFE_EXTRACT_CHAR (s48_value CHAR)
  1049. -- C macro: char * S48_UNSAFE_EXTRACT_STRING (s48_value STRING)
  1050. -- C macro: long S48_UNSAFE_EXTRACT_INTEGER (s48_value INTEGER)
  1051. -- C macro: double S48_UNSAFE_EXTRACT_DOUBLE (s48_value DOUBLE)
  1052. -- C macro: long S48_UNSAFE_EXTRACT_FIXNUM (s48_value FIXNUM)
  1053. -- C macro: s48_value S48_UNSAFE_ENTER_FIXNUM (long INTEGER)
  1054. -- C macro: s48_value S48_UNSAFE_CAR (s48_value PAIR)
  1055. -- C macro: s48_value S48_UNSAFE_CDR (s48_value PAIR)
  1056. -- C macro: void S48_UNSAFE_SET_CAR (s48_value PAIR, s48_value VALUE)
  1057. -- C macro: void S48_UNSAFE_SET_CDR (s48_value PAIR, s48_value VALUE)
  1058. -- C macro: long S48_UNSAFE_VECTOR_LENGTH (s48_value VECTOR)
  1059. -- C macro: s48_value S48_UNSAFE_VECTOR_REF (s48_value VECTOR, long
  1060. INDEX)
  1061. -- C macro: void S48_UNSAFE_VECTOR_SET (s48_value VECTOR, long INDEX,
  1062. s48_value VALUE)
  1063. -- C macro: long S48_UNSAFE_STRING_LENGTH (s48_value STRING)
  1064. -- C macro: char S48_UNSAFE_STRING_REF (s48_value STRING, long INDEX)
  1065. -- C macro: void S48_UNSAFE_STRING_SET (s48_value STRING, long INDEX,
  1066. char CHAR)
  1067. -- C macro: void S48_UNSAFE_SYMBOL_TO_STRING (s48_value SYMBOL)
  1068. -- C macro: long S48_UNSAFE_BYTE_VECTOR_LENGTH (s48_value BYTEV)
  1069. -- C macro: char S48_UNSAFE_BYTE_VECTOR_REF (s48_value BYTEV, long
  1070. INDEX)
  1071. -- C macro: void S48_UNSAFE_BYTE_VECTOR_SET (s48_value BYTEV, long
  1072. INDEX, char BYTE)
  1073. -- C macro: s48_value S48_UNSAFE_SHARED_BINDING_REF (s48_value
  1074. SHARED_BINDING)
  1075. -- C macro: int S48_UNSAFE_SHARED_BINDING_IS_IMPORTP (s48_value
  1076. SHARED_BINDING)
  1077. -- C macro: s48_value S48_UNSAFE_SHARED_BINDING_NAME (s48_value
  1078. SHARED_BINDING)
  1079. -- C macro: void S48_UNSAFE_SHARED_BINDING_SET (s48_value
  1080. SHARED_BINDING, s48_value VALUE)
  1081. -- C macro: TYPE S48_UNSAFE_EXTRACT_VALUE (s48_value BYTEV, TYPE)
  1082. -- C macro: TYPE * S48_UNSAFE_EXTRACT_VALUE_POINTER (s48_value BYTEV,
  1083. TYPE)
  1084. -- C macro: void S48_UNSAFE_SET_VALUE (s48_value BYTEV, TYPE, TYPE
  1085. VALUE)
  1086. 
  1087. File: scheme48.info, Node: POSIX interface, Next: Pre-Scheme, Prev: C interface, Up: Top
  1088. 8 POSIX interface
  1089. *****************
  1090. (This chapter was derived from work copyrighted (C) 1993-2005 by Richard
  1091. Kelsey, Jonathan Rees, and Mike Sperber.)
  1092. This chapter describes Scheme48's interface to POSIX C calls. Scheme
  1093. versions of most of the C functions in POSIX are provided. Both the
  1094. interface and implementation are new and likely to change significantly
  1095. in future releases. The implementation may also contain many bugs.
  1096. The POSIX bindings are available in several structures:
  1097. 'posix-processes'
  1098. 'fork', 'exec', and other process manipulation procedures
  1099. 'posix-process-data'
  1100. procedures for accessing information about processes
  1101. 'posix-files'
  1102. POSIX file system access procedures
  1103. 'posix-i/o'
  1104. pipes and various POSIX I/O controls
  1105. 'posix-time'
  1106. POSIX time operations
  1107. 'posix-users'
  1108. user and group manipulation procedures
  1109. 'posix-regexps'
  1110. POSIX regular expression construction and matching
  1111. 'posix'
  1112. all of the above
  1113. Scheme48's POSIX interface differs from scsh [Shivers 94; Shivers 96;
  1114. Shivers et al. 04] in several ways. The interface here lacks scsh's
  1115. high-level constructs and utilities such as the process notation, 'awk'
  1116. facility, and parsing utilities. Scheme48 uses disjoint types for some
  1117. values that scsh leaves as symbols or simple integers; these include
  1118. file types, file modes, and user & group ids. Many of the names and
  1119. other interface details are different as well.
  1120. * Menu:
  1121. * POSIX processes::
  1122. * POSIX signals::
  1123. * POSIX process environment::
  1124. * POSIX users and groups::
  1125. * POSIX host OS and machine identification::
  1126. * POSIX file system access::
  1127. * POSIX time::
  1128. * POSIX I/O utilities::
  1129. * POSIX regular expressions::
  1130. * POSIX C to Scheme correspondence::
  1131. 
  1132. File: scheme48.info, Node: POSIX processes, Next: POSIX signals, Up: POSIX interface
  1133. 8.1 Processes
  1134. =============
  1135. The procedures described in this section control the creation of
  1136. subprocesses and the execution of programs. They exported by both the
  1137. 'posix-processes' and 'posix' structures.
  1138. -- procedure: fork --> process id or '#f'
  1139. -- procedure: fork-and-forget thunk --> unspecified
  1140. 'Fork' creates a new child process. In the parent process, it
  1141. returns the child's process id; in the child process, it returns
  1142. '#f'. 'Fork-and-forget' calls THUNK in a new process; no process
  1143. id is returned. 'Fork-and-forget' uses an intermediate process to
  1144. avoid creating a zombie.
  1145. -- procedure: process-id? object --> boolean
  1146. -- procedure: process-id=? pid--_{a} pid--_{b} --> boolean
  1147. -- procedure: process-id->integer pid --> integer
  1148. -- procedure: integer->process-id integer --> pid
  1149. 'Process-id?' is the disjoint type predicate for process ids.
  1150. 'Process-id=?' tests whether two process ids are the same.
  1151. 'Process-id->integer' & 'integer->process-id' convert between
  1152. Scheme48's opaque process id type and POSIX process id integers.
  1153. -- procedure: process-id-exit-status pid --> integer or '#f'
  1154. -- procedure: process-id-terminating-signal pid --> signal or '#f'
  1155. -- procedure: wait-for-child-process pid --> unspecified
  1156. If the process identified by PID exited normally or is running,
  1157. 'process-id-exit-status' and 'process-id-terminating-signal' will
  1158. both return '#f'. If, however, it terminated abnormally,
  1159. 'process-id-exit-status' returns its exit status, and if it exited
  1160. due to a signal then 'process-id-terminating-signal' returns the
  1161. signal due to which it exited. 'Wait-for-child-process' blocks the
  1162. current process until the process identified by PID has terminated.
  1163. Scheme48 may reap child processes before the user requests their
  1164. exit status, but it does not always do so.
  1165. -- procedure: exit status --> does not return
  1166. Terminates the current process with the integer STATUS as its exit
  1167. status.
  1168. -- procedure: exec program argument ... --> does not return
  1169. -- procedure: exec-with-environment program env argument ... --> does
  1170. not return
  1171. -- procedure: exec-file filename argument ... --> does not return
  1172. -- procedure: exec-file-with-environment filename env argument ... -->
  1173. does not return
  1174. These all replace the current program with a new one. They differ
  1175. in how the program is found and what process environment the
  1176. program should receive. 'Exec' & 'exec-with-environment' look up
  1177. the program in the search path (the 'PATH' environment variable),
  1178. while 'exec-file' & 'exec-file-with-environment' execute a
  1179. particular file. The environment is either inherited from the
  1180. current process, in the cases of 'exec' & 'exec-file', or
  1181. explicitly specified, in the cases of 'exec-with-environment' &
  1182. 'exec-file-with-environment'. PROGRAM, FILENAME, & all ARGUMENTs
  1183. should be strings. ENV should be a list of strings of the form
  1184. '"NAME=VALUE"'. When the new program is invoked, its arguments
  1185. consist of the program name prepended to the remaining specified
  1186. arguments.
  1187. -- procedure: exec-with-alias name lookup? maybe-env arguments --> does
  1188. not return
  1189. General omnibus procedure that subsumes the other 'exec' variants.
  1190. NAME is looked up in the search path if LOOKUP? is true or used as
  1191. an ordinary filename if it is false. MAYBE-ENV is either '#f', in
  1192. which case the new program's environment should be inherited from
  1193. the current process, or a list of strings of the above form for
  1194. environments, which specifies the new program's environment.
  1195. ARGUMENTS is a list of _all_ of the program's arguments;
  1196. 'exec-with-alias' does _not_ prepend NAME to that list (hence
  1197. '-with-alias').
  1198. 
  1199. File: scheme48.info, Node: POSIX signals, Next: POSIX process environment, Prev: POSIX processes, Up: POSIX interface
  1200. 8.2 Signals
  1201. ===========
  1202. There are two varieties of signals available, named & anonymous. A
  1203. "named" signal is one for which there is provided a symbolic name, such
  1204. as 'kill' or 'pipe'. Anonymous signals are those that the operating
  1205. system provided but for which POSIX does not define a symbolic name,
  1206. only a number, and which may not have meaning on other operating
  1207. systems. Named signals preserve their meaning through heap image dumps;
  1208. anonymous signals may not be dumped in heap images. (If they are, a
  1209. warning is signalled, and they are replaced with a special token that
  1210. denotes a non-portable signal.) Not all named signals are available
  1211. from all operating systems, and there may be multiple names for a single
  1212. operating system signal number.
  1213. -- syntax: signal name --> signal
  1214. -- procedure: name->signal symbol --> signal or '#f'
  1215. -- procedure: integer->signal integer --> signal
  1216. -- procedure: signal? object --> boolean
  1217. -- procedure: signal-name signal --> symbol or '#f'
  1218. -- procedure: signal-os-number signal --> integer
  1219. -- procedure: signal=? signal--_{a} signal--_{b} --> boolean
  1220. 'Signal' evaluates to the signal object with the known symbolic
  1221. name NAME. It is an error if NAME is not recognized as any
  1222. signal's name. 'Name->signal' returns the signal corresponding
  1223. with the given NAME or '#f' if no such signal is known.
  1224. 'Integer->signal' returns a signal, named or anonymous, with the
  1225. given OS number. 'Signal?' is the disjoint type predicate for
  1226. signal objects. 'Signal-name' returns the symbolic name of SIGNAL
  1227. if it is a named signal or '#f' if it is an anonymous signal.
  1228. 'Signal-OS-number' returns the operating system's integer value of
  1229. SIGNAL. 'Signal=?' tests whether two signals are the same, i.e.
  1230. whether their OS numbers are equal equal.
  1231. These are all of the symbols that POSIX defines.
  1232. 'abrt'
  1233. abnormal termination (as by 'abort(3)')
  1234. 'alrm'
  1235. timeout signal (as by 'alarm(2)')
  1236. 'fpe'
  1237. floating point exception
  1238. 'hup'
  1239. hangup on controlling terminal or death of controlling process
  1240. 'ill'
  1241. illegal instruction
  1242. 'int'
  1243. interrupt -- interaction attention
  1244. 'kill'
  1245. termination signal, cannot be caught or ignored
  1246. 'pipe'
  1247. write was attempted on a pipe with no readers
  1248. 'quit'
  1249. interaction termination
  1250. 'segv'
  1251. segmentation violation -- invalid memory reference
  1252. 'term'
  1253. termination signal
  1254. 'usr1'
  1255. 'usr2'
  1256. for use by applications
  1257. 'chld'
  1258. child process stopped or terminated
  1259. 'cont'
  1260. continue if stopped
  1261. 'stop'
  1262. stop immediately, cannot be caught or ignored
  1263. 'tstp'
  1264. interactive stop
  1265. 'ttin'
  1266. read from control terminal attempted by a background process
  1267. 'ttou'
  1268. write to control terminal attempted by a background process
  1269. 'bus'
  1270. bus error -- access to undefined portion of memory
  1271. There are also several other signals whose names are allowed to be
  1272. passed to 'signal' that are not defined by POSIX, but that are
  1273. recognized by many operating systems.
  1274. 'trap'
  1275. trace or breakpoint trap
  1276. 'iot'
  1277. synonym for 'abrt'
  1278. 'emt'
  1279. 'sys'
  1280. bad argument to routine (SVID)
  1281. 'stkflt'
  1282. stack fault on coprocessor
  1283. 'urg'
  1284. urgent condition on socket (4.2 BSD)
  1285. 'io'
  1286. I/O now possible (4.2 BSD)
  1287. 'poll'
  1288. synonym for 'io' (System V)
  1289. 'cld'
  1290. synonym for 'chld'
  1291. 'xcpu'
  1292. CPU time limit exceeded (4.2 BSD)
  1293. 'xfsz'
  1294. file size limit exceeded (4.2 BSD)
  1295. 'vtalrm'
  1296. virtual alarm clock (4.2 BSD)
  1297. 'prof'
  1298. profile alarm clock
  1299. 'pwr'
  1300. power failure (System V)
  1301. 'info'
  1302. synonym for 'pwr'
  1303. 'lock'
  1304. file lock lost
  1305. 'winch'
  1306. Window resize signal (4.3 BSD, Sun)
  1307. 'unused'
  1308. 8.2.1 Sending & receiving signals
  1309. ---------------------------------
  1310. -- procedure: signal-process pid signal --> unspecified
  1311. Sends a signal represented by SIGNAL to the process identified by
  1312. PID.
  1313. Signals received by the Scheme process can be obtained via one or
  1314. more "signal queues". Each signal queue has a list of monitored signals
  1315. and a queue of received signals that have yet to be consumed from the
  1316. queue. When the Scheme process receives a signal, that signal is added
  1317. to the signal queues that are currently monitoring the signal received.
  1318. -- procedure: make-signal-queue signal-list --> signal-queue
  1319. -- procedure: signal-queue? object --> boolean
  1320. -- procedure: signal-queue-monitored-signals signal-queue -->
  1321. signal-list
  1322. -- procedure: dequeue-signal! signal-queue --> signal (may block)
  1323. -- procedure: maybe-dequeue-signal! signal-queue --> signal or '#f'
  1324. 'Make-signal-queue' returns a new signal queue that will monitor
  1325. all of the signals in the given list. 'Signal-queue?' is the
  1326. disjoint type predicate for signal queues.
  1327. 'Signal-queue-monitored-signals' returns a freshly-allocated list
  1328. of the signals currently monitored by SIGNAL-QUEUE.
  1329. 'Dequeue-signal!' & 'maybe-dequeue-signal!' both access the next
  1330. signal ready to be read from SIGNAL-QUEUE. If the signal queue is
  1331. empty, 'dequeue-signal!' will block until a signal is received,
  1332. while 'maybe-dequeue-signal!' will immediately return '#f'.
  1333. *Note:* There is a bug in the current system that causes an erroneous
  1334. deadlock to occur if threads are blocked waiting for signals and no
  1335. other threads are available to run. A workaround is to create a thread
  1336. that sleeps for a long time, which prevents any deadlock errors
  1337. (including real ones):
  1338. > ,open threads
  1339. > (spawn (lambda ()
  1340. ;; Sleep for a year.
  1341. (sleep (* 1000 60 60 24 365))))
  1342. -- procedure: add-signal-queue-signal! signal-queue signal -->
  1343. unspecified
  1344. -- procedure: remove-signal-queue-signal! signal-queue signal -->
  1345. unspecified
  1346. These add & remove signals from signal queues' list of signals to
  1347. monitor. Note that 'remove-signal-queue-signal!' also removes any
  1348. pending signals from the queue, so 'dequeue-signal!' &
  1349. 'maybe-dequeue-signal!' will only ever return signals that are on
  1350. the queue's list of monitored signals when they are called.
  1351. 
  1352. File: scheme48.info, Node: POSIX process environment, Next: POSIX users and groups, Prev: POSIX signals, Up: POSIX interface
  1353. 8.3 Process environment
  1354. =======================
  1355. These procedures are exported by the structures 'posix' &
  1356. 'posix-process-data'.
  1357. -- procedure: get-process-id --> process-id
  1358. -- procedure: get-parent-process-id --> process-id
  1359. These return the process id (*note POSIX processes::) of the
  1360. current process or the current process's parent, respectively.
  1361. -- procedure: get-user-id --> user-id
  1362. -- procedure: get-effective-user-id --> user-id
  1363. -- procedure: set-user-id! user-id --> unspecified
  1364. -- procedure: get-group-id --> group-id
  1365. -- procedure: get-effective-group-id --> group-id
  1366. -- procedure: set-group-id! group-id --> unspecified
  1367. These access the original and effective user & group ids (*note
  1368. POSIX users and groups::) of the current process. The effective
  1369. ids may be set, but not the original ones.
  1370. -- procedure: get-groups --> group-id list
  1371. -- procedure: get-login-name --> string
  1372. 'Get-groups' returns a list of the supplementary groups of the
  1373. current process. 'Get-login-name' returns a user name for the
  1374. current process.
  1375. -- procedure: lookup-environment-variable string --> string or '#f'
  1376. -- procedure: environment-alist --> alist
  1377. 'Lookup-environment-variable' looks up its argument in the
  1378. environment list of the current process and returns the
  1379. corresponding string, or '#f' if there is none.
  1380. 'Environment-alist' returns the entire environment as a list of
  1381. '(NAME-STRING . VALUE-STRING)' pairs.
  1382. 
  1383. File: scheme48.info, Node: POSIX users and groups, Next: POSIX host OS and machine identification, Prev: POSIX process environment, Up: POSIX interface
  1384. 8.4 Users and groups
  1385. ====================
  1386. "User ids" & "group ids" are boxed integers that represent Unix users &
  1387. groups. Also, every user & group has a corresponding "user info" or
  1388. "group info" record, which contains miscellaneous information about the
  1389. user or group. The procedures in this section are exported by the
  1390. structures 'posix-users' & 'posix'.
  1391. -- procedure: user-id? object --> boolean
  1392. -- procedure: user-id=? uid--_{a} uid--_{b} --> boolean
  1393. -- procedure: user-id->integer uid --> integer
  1394. -- procedure: integer->user-id integer --> uid
  1395. -- procedure: group-id? object --> boolean
  1396. -- procedure: group-id=? gid--_{a} gid--_{b} --> boolean
  1397. -- procedure: group-id->integer gid --> integer
  1398. -- procedure: integer->group-id integer --> gid
  1399. 'User-id?' & 'group-id?' are the disjoint type predicates for user
  1400. & group ids. 'User-id=?' & 'group-id=?' test whether two user or
  1401. group ids, respectively, are the same, i.e. whether their numbers
  1402. are equal. 'User-id->integer', 'group-id->integer',
  1403. 'integer->user-id', & 'integer->group-id' convert between user or
  1404. group ids and integers.
  1405. -- procedure: user-id->user-info uid --> user-info
  1406. -- procedure: name->user-info string --> user-info
  1407. -- procedure: group-id->group-info gid --> group-info
  1408. -- procedure: name->group-info string --> group-info
  1409. These provide access for the user or group info records that
  1410. correspond with the given user or group ids or names.
  1411. -- procedure: user-info? object --> boolean
  1412. -- procedure: user-info-name user-info --> string
  1413. -- procedure: user-info-id user-info --> user-id
  1414. -- procedure: user-info-group user-info --> group-id
  1415. -- procedure: user-info-home-directory user-info --> string
  1416. -- procedure: user-info-shell user-info --> string
  1417. -- procedure: group-info? object --> boolean
  1418. -- procedure: group-info-name group-info --> string
  1419. -- procedure: group-info-id group-info --> group-id
  1420. -- procedure: group-info-members group-info --> user-id-list
  1421. 'User-info?' & 'group-info?' are the disjoint type predicates for
  1422. user info & group info records. The others are accessors for the
  1423. various data available in those records.
  1424. 
  1425. File: scheme48.info, Node: POSIX host OS and machine identification, Next: POSIX file system access, Prev: POSIX users and groups, Up: POSIX interface
  1426. 8.5 Host OS and machine identification
  1427. ======================================
  1428. -- procedure: host-name --> string
  1429. -- procedure: os-node-name --> string
  1430. -- procedure: os-release-name --> string
  1431. -- procedure: os-version-name --> string
  1432. -- procedure: machine-name --> string
  1433. These procedures return strings that are intended to identify
  1434. various aspects of the current operating system and physical
  1435. machine. POSIX does not specify the format of the strings. These
  1436. procedures are provided by both the structure
  1437. 'posix-platform-names' and the structure 'posix'.
  1438. 
  1439. File: scheme48.info, Node: POSIX file system access, Next: POSIX time, Prev: POSIX host OS and machine identification, Up: POSIX interface
  1440. 8.6 File system access
  1441. ======================
  1442. These procedures operate on the file system via the facilities defined
  1443. by POSIX and offer more than standard & portable R5RS operations. All
  1444. of these names are exported by the structures 'posix-files' and 'posix'.
  1445. -- procedure: open-directory-stream filename --> dir-stream
  1446. -- procedure: directory-stream? object --> boolean
  1447. -- procedure: read-directory-stream dir-stream --> filename or '#f'
  1448. -- procedure: close-directory-stream dir-stream --> unspecified
  1449. Directory streams are the low-level interface provided by POSIX to
  1450. enumerate the contents of a directory. 'Open-directory-stream'
  1451. opens a new directory stream that will enumerate all of the files
  1452. within the directory named by FILENAME. 'Directory-stream?' is the
  1453. disjoint type predicate for directory streams.
  1454. 'Read-directory-stream' consumes the next filename from DIR-STREAM
  1455. and returns it, or returns '#f' if the stream has finished. Note
  1456. that 'read-directory-stream' will return only simple filenames, not
  1457. full pathnames. 'Close-directory-stream' closes DIR-STREAM,
  1458. removing any storage it required in the operating system. Closing
  1459. an already closed directory stream has no effect.
  1460. -- procedure: list-directory filename --> string list
  1461. Returns the list of filenames in the directory named by FILENAME.
  1462. This is equivalent to opening a directory stream, repeatedly
  1463. reading from it & accumulating the list of filenames, and closing
  1464. the stream.
  1465. -- procedure: working-directory --> string
  1466. -- procedure: set-working-directory! string --> unspecified
  1467. These access the working directory's filename of the current
  1468. process.
  1469. -- procedure: open-file pathname file-options [file-mode] --> port
  1470. Opens a port to the file named by the string PATHNAME.
  1471. FILE-OPTIONS specifies various aspects of the port. The optional
  1472. FILE-MODE argument is used only if the file to be opened does not
  1473. already exist; it specifies the permissions to be assigned to the
  1474. file if it is created. The returned port is an input port if the
  1475. given options include 'read-only'; otherwise 'open-file' returns an
  1476. output port. Because Scheme48 does not support combined
  1477. input/output ports, 'dup-switching-mode' can be used to open an
  1478. input port for output ports opened with the 'read-write' option.
  1479. File options are stored in a boxed mask representation. File option
  1480. sets are created with 'file-options' and tested with 'file-options-on?'.
  1481. -- syntax: file-options name ... --> file-options
  1482. -- procedure: file-options-on? options--_{a} options--_{b} --> boolean
  1483. 'File-options' evaluates to a file option set, suitable for passing
  1484. to 'open-file', that includes all of the given named options.
  1485. 'File-options-on?' returns true if OPTIONS-_{A} includes all of the
  1486. options in OPTIONS-_{B}, or false if otherwise.
  1487. The following file option names are supported as arguments to the
  1488. 'file-options' syntax:
  1489. 'create'
  1490. create file if it does not already exist; a FILE-MODE argument
  1491. is required to be passed to 'open-file' if the 'create' option
  1492. is specified
  1493. 'exclusive'
  1494. an error will be signalled if this option & 'create' are both
  1495. set and the file already exists
  1496. 'no-controlling-tty'
  1497. if the pathname being opened is a terminal device, the
  1498. terminal will not become the controlling terminal of the
  1499. process
  1500. 'truncate'
  1501. file is truncated
  1502. 'append'
  1503. written data to the newly opened file will be appended to the
  1504. existing contents
  1505. 'nonblocking'
  1506. read & write operations will not block
  1507. 'read-only'
  1508. file may not be written to, only read from
  1509. 'read-write'
  1510. file may be both read from & written to
  1511. 'write-only'
  1512. file may not be read from, only written to
  1513. The last three are all mutually exclusive.
  1514. Examples:
  1515. (open-file "some-file.txt"
  1516. (file-options create write-only)
  1517. (file-mode read owner-write))
  1518. returns an output port that writes to a newly-created file that can be
  1519. read from by anyone but written to only by the owner. Once the file
  1520. 'some-file.txt' exists,
  1521. (open-file "some-file.txt"
  1522. (file-options append write-only))
  1523. will open an output port that appends to the file.
  1524. 'I/o-flags' & 'set-i/o-flags!' (*note POSIX I/O utilities::) can be
  1525. used to access the 'append', 'nonblocking', and read/write file options
  1526. of ports, as well as modify the 'append' & 'nonblocking' options.
  1527. To keep port operations from blocking in the Scheme48 process, output
  1528. ports are set to be nonblocking at the time of creation. (Input ports
  1529. are managed using 'select(2)'.) 'Set-i/o-flags!' can be used to make an
  1530. output port blocking, for example directly before forking, but care
  1531. should be exercised, because the Scheme48 run-time system may be
  1532. confused if an I/O operation blocks.
  1533. -- procedure: set-file-creation-mask! file-mode --> file-mode
  1534. Sets the file creation mask to be FILE-MODE. Bits set in FILE-MODE
  1535. are cleared in the modes of any files or directories subsequently
  1536. created by the current process.
  1537. -- procedure: link existing-pathname new-pathname --> unspecified
  1538. -- procedure: make-directory pathname file-mode --> unspecified
  1539. -- procedure: make-fifo pathname file-mode --> unspecified
  1540. 'Link' creates a hard link for the file at EXISTING-PATHNAME at
  1541. NEW-PATHNAME. 'Make-directory' creates a new directory at the
  1542. locations specified by PATHNAME with the the file mode FILE-MODE.
  1543. 'Make-fifo' does similarly, but it creates a FIFO (first-in
  1544. first-out) file instead of a directory.
  1545. -- procedure: unlink pathname --> unspecified
  1546. -- procedure: remove-directory pathname --> unspecified
  1547. -- procedure: rename old-pathname new-pathname --> unspecified
  1548. 'Unlink' removes a link at the location PATHNAME.
  1549. 'Remove-directory' removes a directory at the location specified by
  1550. PATHNAME. The directory must be empty; an exception is signalled
  1551. if it is not. 'Rename' moves the file at the location OLD-PATHNAME
  1552. to the new location NEW-PATHNAME.
  1553. -- procedure: accessible? pathname access-mode more-modes ... -->
  1554. boolean
  1555. -- syntax: access-mode name --> access mode
  1556. 'Accessible?' returns true if PATHNAME is accessible by all of the
  1557. given access modes. (There must be at least one access mode
  1558. argument.) 'Access-mode' evaluates to an access mode, suitable for
  1559. passing to 'accessible?', from the given name. The allowed names
  1560. are 'read', 'write', 'execute', & 'exists'.
  1561. Information about files can be queried using the "file info"
  1562. abstraction. Every file has a corresponding file info record, which
  1563. contains various data about the file including its name, its type, its
  1564. device & inode numbers, the number of links to it, its size in bytes,
  1565. its owner, its group, its file mode, and its access times.
  1566. -- procedure: get-file-info pathname --> file-info
  1567. -- procedure: get-file/link-info pathname --> file-info
  1568. -- procedure: get-port-info fd-port --> file-info
  1569. 'Get-file-info' & 'get-file/link-info' return a file info record
  1570. for the files named by PATHNAME. 'Get-file-info' follows symbolic
  1571. links, however, while 'get-file/link' info does not.
  1572. 'Get-port-info' returns a file info record for the file that
  1573. FD-PORT is a port atop a file descriptor for. If FD-PORT does not
  1574. read from or write to a file descriptor, an error is signalled.
  1575. -- procedure: file-info? object --> boolean
  1576. -- procedure: file-info-name file-info --> string
  1577. -- procedure: file-info-device file-info --> integer
  1578. -- procedure: file-info-inode file-info --> integer
  1579. -- procedure: file-info-link-count file-info --> integer
  1580. -- procedure: file-info-size file-info --> integer
  1581. -- procedure: file-info-owner file-info --> user-id
  1582. -- procedure: file-info-group file-info --> group-id
  1583. -- procedure: file-info-mode file-info --> file-mode
  1584. -- procedure: file-info-last-access file-info --> time
  1585. -- procedure: file-info-last-modification file-info --> time
  1586. -- procedure: file-info-last-change file-info --> time
  1587. Accessors for various file info record fields. The name is the
  1588. string passed to 'get-file-info' or 'get-file/link-info', if the
  1589. file info record was created with either of those two, or the name
  1590. of the file that the file descriptor of the port queried was
  1591. created on, if the file info record was obtained with
  1592. 'get-port-info'.
  1593. -- procedure: file-info-type file-info --> file-type
  1594. -- syntax: file-type name --> file-type
  1595. -- procedure: file-type? object --> boolean
  1596. -- procedure: file-type-name file-type --> symbol
  1597. 'File-info-type' returns the type of the file as a "file type"
  1598. object. File types may be compared using 'eq?'. 'File-type'
  1599. evaluates to a file type of the given name. The disjoint type
  1600. predicate for file types is 'file-type?'. 'File-type-name' returns
  1601. the symbolic name that represents FILE-TYPE.
  1602. The valid file type names are:
  1603. 'regular'
  1604. 'directory'
  1605. 'character-device'
  1606. 'block-device'
  1607. 'fifo'
  1608. 'symbolic-link' (not required by POSIX)
  1609. 'socket' (not required by POSIX)
  1610. 'other'
  1611. "File modes" are boxed integers that represent POSIX file protection
  1612. masks.
  1613. -- syntax: file-mode permission-name ... --> file-mode
  1614. -- procedure: file-mode? object --> boolean
  1615. 'File-mode' evaluates to a file mode object that contains all of
  1616. the specified permissions. 'File-mode?' is the disjoint type
  1617. predicate for file mode descriptor objects. These are all of the
  1618. names, with their corresponding octal bit masks and meanings,
  1619. allowed to be passed to 'file-mode':
  1620. Permission name Octal mask Description
  1621. 'set-uid' '#o4000' set user id when executing
  1622. 'set-gid' '#o2000' set group id when executing
  1623. 'owner-read' '#o0400' read by owner
  1624. 'owner-write' '#o0200' write by owner
  1625. 'owner-exec' '#o0100' execute (or search) by owner
  1626. 'group-read' '#o0040' read by group
  1627. 'group-write' '#o0020' write by group
  1628. 'group-exec' '#o0010' execute (or search) by group
  1629. 'other-read' '#o0004' read by others
  1630. 'other-write' '#o0002' write by others
  1631. 'other-exec' '#o0001' execute (or search) by others
  1632. Also, several compound masks are supported for convenience:
  1633. Permission set name Octal mask Description
  1634. 'owner' '#o0700' read, write, & execute by owner
  1635. 'group' '#o0070' read, write, & execute by group
  1636. 'other' '#o0007' read, write, & execute by others
  1637. 'read' '#o0444' read by anyone
  1638. 'write' '#o0111' write by anyone
  1639. 'exec' '#o0777' read, write, & execute by anyone
  1640. -- procedure: file-mode+ file-mode ... --> file-mode
  1641. -- procedure: file-mode- file-mode--_{a} file-mode--_{b} --> file-mode
  1642. -- procedure: file-mode=? file-mode--_{a} file-mode--_{b} --> boolean
  1643. -- procedure: file-mode<=? file-mode--_{a} file-mode--_{b} --> boolean
  1644. -- procedure: file-mode>=? file-mode--_{a} file-mode--_{b} --> boolean
  1645. 'File-mode+' returns a file mode that contains all of the
  1646. permissions specified in any of its arguments. 'File-mode-'
  1647. returns a file mode that contains all of FILE-MODE-_{A}'s
  1648. permissions not in FILE-MODE-_{B}. 'File-mode=?' tests whether two
  1649. file modes are the same. 'File-mode<=?' returns true if each
  1650. successive file mode argument has the same or more permissions as
  1651. the previous one. 'File-mode>=?' returns true if each successive
  1652. file mode argument has the same or fewer permissions as the
  1653. previous one.
  1654. -- procedure: file-mode->integer file-mode --> integer
  1655. -- procedure: integer->file-mode integer --> file-mode
  1656. These convert between file mode objects and Unix file mode masks as
  1657. integers. The integer representations may or may not be the masks
  1658. used by the underlying operating system.
  1659. 
  1660. File: scheme48.info, Node: POSIX time, Next: POSIX I/O utilities, Prev: POSIX file system access, Up: POSIX interface
  1661. 8.7 Time
  1662. ========
  1663. A "time" record contains an integer that represents a time as the number
  1664. of seconds since the Unix epoch (00:00:00 GMT, January 1, 1970). These
  1665. procedures for operating on time records are in the structures
  1666. 'posix-time' & 'posix'.
  1667. -- procedure: make-time seconds --> time
  1668. -- procedure: current-time --> time
  1669. -- procedure: time? object --> boolean
  1670. -- procedure: time-seconds time --> integer
  1671. 'Make-time' & 'current-time' construct time records; 'make-time'
  1672. uses the number of seconds that is its argument, and 'current-time'
  1673. uses the current number of seconds since the epoch. 'Time?' is the
  1674. disjoint type predicate for time objects. 'Time-seconds' returns
  1675. the number of seconds recorded by TIME.
  1676. -- procedure: time=? time--_{a} time--_{b} --> boolean
  1677. -- procedure: time<? time--_{a} time--_{b} --> boolean
  1678. -- procedure: time<=? time--_{a} time--_{b} --> boolean
  1679. -- procedure: time>? time--_{a} time--_{b} --> boolean
  1680. -- procedure: time>=? time--_{a} time--_{b} --> boolean
  1681. Various time comparators. 'Time=?' returns true if its two
  1682. arguments represent the same number of seconds since the epoch.
  1683. 'Time<?', 'time<=?', 'time>?', & 'time>=' return true if their
  1684. arguments are monotonically increasing, monotonically
  1685. non-decreasing, monotonically decreasing, or monotonically
  1686. non-increasing, respectively.
  1687. -- procedure: time->string time --> string
  1688. Returns a string representation of TIME in the format of '"DDD MMM
  1689. HH:MM:SS YYYY"'. For example,
  1690. (time->string (make-time 1234567890))
  1691. => "Fri Feb 13 18:31:30 2009"
  1692. *Note:* The string has a newline suffix.
  1693. 
  1694. File: scheme48.info, Node: POSIX I/O utilities, Next: POSIX regular expressions, Prev: POSIX time, Up: POSIX interface
  1695. 8.8 I/O utilities
  1696. =================
  1697. These procedures for manipulating pipes and ports built on file
  1698. descriptors are provided by the structures 'posix-i/o' & 'posix'.
  1699. -- procedure: open-pipe --> [input-port output-port]
  1700. Creates a pipe and returns the two ends of the pipe as an input
  1701. port & an output port.
  1702. A "file descriptor port" (or "fd-port") is a port or a channel (*note
  1703. Channels::) that reads from or writes to an OS file descriptor. File
  1704. descriptor ports are returned by the standard Scheme procedures
  1705. 'open-input-file' & 'open-output-file' as well as the procedures
  1706. 'open-file' & 'open-pipe' from this POSIX interface.
  1707. -- procedure: fd-port? port --> boolean
  1708. -- procedure: port->fd port --> integer or '#f'
  1709. 'Fd-port?' returns true if PORT is a port that reads from or writes
  1710. to a file descriptor, or false if not. 'Port->fd' returns the file
  1711. descriptor that PORT reads from or writes to, if it is a file
  1712. descriptor port, or '#f' if it is not. It is an error to pass a
  1713. value that is not a port to either of these procedures.
  1714. *Note:* Channels may _not_ be passed to these procedures. To
  1715. access a channel's file descriptor, use 'channel-os-index'; *note
  1716. Channels:: for more details.
  1717. -- procedure: remap-file-descriptors! fd-spec ... --> unspecified
  1718. Reassigns file descriptors to ports. Each FD-SPEC specifies what
  1719. port is to be mapped to what file descriptor: the first port gets
  1720. file descriptor '0'; the second, '1'; and so on. An FD-SPEC is
  1721. either a port that reads from or writes to a file descriptor or
  1722. '#f'; in the latter case, the corresponding file descriptor is not
  1723. used. Any open ports not listed are marked _close-on-exec_. The
  1724. same port may be moved to multiple new file descriptors.
  1725. For example,
  1726. (remap-file-descriptors! (current-output-port)
  1727. #f
  1728. (current-input-port))
  1729. moves the current output port to file descriptor '0' (i.e. 'stdin')
  1730. and the current input port to file descriptor '2' (i.e. 'stderr').
  1731. File descriptor '1' ('stdout') is not mapped to anything, and all
  1732. other open ports (including anything that had the file descriptor
  1733. '1') are marked _close-on-exec_.
  1734. -- procedure: dup fd-port --> fd-port
  1735. -- procedure: dup-switching-mode fd-port --> fd-port
  1736. -- procedure: dup2 fd-port fdes --> fd-port
  1737. These change FD-PORT's file descriptor and return new ports that
  1738. have the ports' old file descriptors. 'Dup' uses the lowest unused
  1739. file descriptor; 'dup2' uses the one provided.
  1740. 'Dup-switching-mode' is the same as 'dup' except that the returned
  1741. port is an input port if the argument was an output port and vice
  1742. versa. If any existing port uses the file descriptor passed to
  1743. 'dup2', that port is closed.
  1744. -- procedure: close-all-port port-or-channel ... --> unspecified
  1745. Closes all ports or channels not listed as arguments.
  1746. -- procedure: close-on-exec? channel --> boolean
  1747. -- procedure: set-close-on-exec?! channel boolean --> unspecified
  1748. These access the boolean flag that specifies whether CHANNEL will
  1749. be closed when a new program is 'exec''d.
  1750. -- procedure: i/o-flags fd-port --> file-options
  1751. -- procedure: set-i/o-flags! fd-port file-options --> unspecified
  1752. These access various file options (*note POSIX file system
  1753. access::) for FD-PORT. The options that may be read are 'append',
  1754. 'nonblocking', 'read-only', 'read-write', and 'write-only'; only
  1755. the 'append' and 'nonblocking' options can be written.
  1756. -- procedure: port-is-a-terminal? port --> boolean
  1757. -- procedure: port-terminal-name port --> string or '#f'
  1758. 'Port-is-a-terminal?' returns true of PORT is a port that has an
  1759. underlying file descriptor associated with a terminal. For such
  1760. ports, 'port-terminal-name' returns the name of the terminal; for
  1761. all others, it returns '#f'.
  1762. *Note:* These procedures accept only ports, not channels.
  1763. 
  1764. File: scheme48.info, Node: POSIX regular expressions, Next: POSIX C to Scheme correspondence, Prev: POSIX I/O utilities, Up: POSIX interface
  1765. 8.9 Regular expressions
  1766. =======================
  1767. The procedures in this section provide access to POSIX regular
  1768. expression matching. The regular expression syntax and semantics are
  1769. far too complex to be described here.
  1770. *Note:* Because the C interface uses ASCII 'NUL' bytes to mark the
  1771. ends of strings, patterns & strings that contain 'NUL' characters will
  1772. not work correctly.
  1773. 8.9.1 Direct POSIX regular expression interface
  1774. -----------------------------------------------
  1775. The first interface to regular expressions is a thin layer over the
  1776. interface that POSIX provides. It is exported by the structures
  1777. 'posix-regexps' & 'posix'.
  1778. -- procedure: make-regexp string option ... --> regexp
  1779. -- procedure: regexp? object --> boolean
  1780. 'Make-regexp' creates a regular expression with the given string
  1781. pattern. The arguments after STRING specify various options for
  1782. the regular expression; see 'regexp-option' below. The regular
  1783. expression is not compiled until it is matched against a string, so
  1784. any errors in the pattern string will not be reported until that
  1785. point. 'Regexp?' is the disjoint type predicate for regular
  1786. expression objects.
  1787. -- syntax: regexp-option name --> regexp-option
  1788. Evaluates to a regular expression option, suitable to be passed to
  1789. 'make-regexp', with the given name. The possible option names are:
  1790. 'extended'
  1791. use the extended patterns
  1792. 'ignore-case'
  1793. ignore case differences when matching
  1794. 'submatches'
  1795. report submatches
  1796. 'newline'
  1797. treat newlines specially
  1798. -- procedure: regexp-match regexp string start submatches? starts-line?
  1799. ends-line? --> boolean or list of matches
  1800. 'Regexp-match' matches REGEXP against the characters in STRING,
  1801. starting at position START. If the string does not match the
  1802. regular expression, 'regexp-match' returns '#f'. If the string
  1803. does match, then a list of match records is returned if SUBMATCHES?
  1804. is true or '#t' if SUBMATCHES? is false. The first match record
  1805. gives the location of the substring that matched REGEXP. If the
  1806. pattern in REGEXP contained submatches, then the submatches are
  1807. returned in order, with match records in the positions where
  1808. submatches succeeded and '#f' in the positions where submatches
  1809. failed.
  1810. STARTS-LINE? should be true if STRING starts at the beginning of a
  1811. line, and ENDS-LINE? should be true if it ends one.
  1812. -- procedure: match? object --> boolean
  1813. -- procedure: match-start match --> integer
  1814. -- procedure: match-end match --> integer
  1815. -- procedure: match-submatches match --> alist
  1816. 'Match?' is the disjoint type predicate for match records. Match
  1817. records contain three values: the beginning & end of the substring
  1818. that matched the pattern and an association list of submatch keys
  1819. and corresponding match records for any named submatches that also
  1820. matched. 'Match-start' returns the index of the first character in
  1821. the matching substring, and 'match-end' gives the index of the
  1822. first character after the matching substring. 'Match-submatches'
  1823. returns the alist of submatches.
  1824. 8.9.2 High-level regular expression construction
  1825. ------------------------------------------------
  1826. This section describes a functional interface for building regular
  1827. expressions and matching them against strings, higher-level than the
  1828. direct POSIX interface. The matching is done using the POSIX regular
  1829. expression package. Regular expressions constructed by procedures
  1830. listed here are compatible with those in the previous section; that is,
  1831. they satisfy the predicate 'regexp?' from the 'posix-regexps' structure.
  1832. These names are exported by the structure 'regexps'.
  1833. 8.9.2.1 Character sets
  1834. ......................
  1835. Character sets may be defined using a list of characters and strings,
  1836. using a range or ranges of characters, or by using set operations on
  1837. existing character sets.
  1838. -- procedure: set char-or-string ... --> char-set-regexp
  1839. -- procedure: range low-char high-char --> char-set-regexp
  1840. -- procedure: ranges low-char high-char ... --> char-set-regexp
  1841. -- procedure: ascii-range low-char high-char --> char-set-regexp
  1842. -- procedure: ascii-ranges low-char high-char ... --> char-set-regexp
  1843. 'Set' returns a character set that contains all of the character
  1844. arguments and all of the characters in all of the string arguments.
  1845. 'Range' returns a character set that contains all characters
  1846. between LOW-CHAR and HIGH-CHAR, inclusive. 'Ranges' returns a set
  1847. that contains all of the characters in the given set of ranges.
  1848. 'Range' & 'ranges' use the ordering imposed by 'char->integer'.
  1849. 'Ascii-range' & 'ascii-ranges' are like 'range' & 'ranges', but
  1850. they use the ASCII ordering. 'Ranges' & 'ascii-ranges' must be
  1851. given an even number of arguments. It is an error for a HIGH-CHAR
  1852. to be less than the preceding LOW-CHAR in the appropriate ordering.
  1853. -- procedure: negate char-set --> char-set-regexp
  1854. -- procedure: union char-set--_{a} char-set--_{b} --> char-set-regexp
  1855. -- procedure: intersection char-set--_{a} char-set--_{b} -->
  1856. char-set-regexp
  1857. -- procedure: subtract char-set--_{a} char-set--_{b} -->
  1858. char-set-regexp
  1859. Set operations on character sets. 'Negate' returns a character set
  1860. of all characters that are not in CHAR-SET. 'Union' returns a
  1861. character set that contains all of the characters in CHAR-SET-_{A}
  1862. and all of the characters in CHAR-SET-_{B}. 'Intersection' returns
  1863. a character set of all of the characters that are in both
  1864. CHAR-SET-_{A} and CHAR-SET-_{B}. 'Subtract' returns a character
  1865. set of all the characters in CHAR-SET-_{A} that are not also in
  1866. CHAR-SET-_{B}.
  1867. -- character set: lower-case = '(set "abcdefghijklmnopqrstuvwxyz")'
  1868. -- character set: lower-case = '(set "abcdefghijklmnopqrstuvwxyz")'
  1869. -- character set: upper-case = '(set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")'
  1870. -- character set: alphabetic = '(union lower-case upper-case)'
  1871. -- character set: numeric = '(set "0123456789")'
  1872. -- character set: alphanumeric = '(union alphabetic numeric)'
  1873. -- character set: punctuation = '(set
  1874. "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")'
  1875. -- character set: graphic = '(union alphanumeric punctuation)'
  1876. -- character set: printing = '(union graphic (set #\space))'
  1877. -- character set: control = '(negate printing)'
  1878. -- character set: blank = '(set #\space (ascii->char 9)) ; ASCII 9 =
  1879. TAB'
  1880. -- character set: whitespace = '(union (set #\space) (ascii-range 9
  1881. 13))'
  1882. -- character set: hexdigit = '(set "0123456789ABCDEF")'
  1883. Predefined character sets.
  1884. 8.9.2.2 Anchoring
  1885. .................
  1886. -- procedure: string-start --> regexp
  1887. -- procedure: string-end --> regexp
  1888. 'String-start' returns a regular expression that matches the
  1889. beginning of the string being matched against; 'string-end' returns
  1890. one that matches the end.
  1891. 8.9.2.3 Composite expressions
  1892. .............................
  1893. -- procedure: sequence regexp ... --> regexp
  1894. -- procedure: one-of regexp ... --> regexp
  1895. 'Sequence' returns a regular expression that matches concatenation
  1896. of all of its arguments; 'one-of' returns a regular expression that
  1897. matches any one of its arguments.
  1898. -- procedure: text string --> regexp
  1899. Returns a regular expression that matches exactly the characters in
  1900. STRING, in order.
  1901. -- procedure: repeat regexp --> regexp
  1902. -- procedure: repeat count regexp --> regexp
  1903. -- procedure: repeat min max regexp --> regexp
  1904. 'Repeat' returns a regular expression that matches zero or more
  1905. occurrences of its REGEXP argument. With only one argument, the
  1906. result will match REGEXP any number of times. With two arguments,
  1907. i.e. one COUNT argument, the returned regular expression will match
  1908. REGEXP exactly that number of times. The final case will match
  1909. from MIN to MAX repetitions, inclusive. MAX may be '#f', in which
  1910. case there is no maximum number of matches. COUNT & MIN must be
  1911. exact, non-negative integers; MAX should be either '#f' or an
  1912. exact, non-negative integer.
  1913. 8.9.2.4 Case sensitivity
  1914. ........................
  1915. Regular expressions are normally case-sensitive, but case sensitivity
  1916. can be manipulated simply.
  1917. -- procedure: ignore-case regexp --> regexp
  1918. -- procedure: use-case regexp --> regexp
  1919. The regular expression returned by 'ignore-case' is identical to
  1920. its argument except that the case will be ignored when matching.
  1921. The value returned by 'use-case' is protected from future
  1922. applications of 'ignore-case'. The expressions returned by
  1923. 'use-case' and 'ignore-case' are unaffected by any enclosing uses
  1924. of these procedures.
  1925. By way of example, the following matches '"ab"', but not '"aB"',
  1926. '"Ab"', or '"AB"':
  1927. (text "ab")
  1928. while
  1929. (ignore-case (text "ab"))
  1930. matches all of those, and
  1931. (ignore-case (sequence (text "a")
  1932. (use-case (text "b"))))
  1933. matches '"ab"' or '"Ab"', but not '"aB"' or '"AB"'.
  1934. 8.9.2.5 Submatches and matching
  1935. ...............................
  1936. A subexpression within a larger expression can be marked as a submatch.
  1937. When an expression is matched against a string, the success or failure
  1938. of each submatch within that expression is reported, as well as the
  1939. location of the substring matched by each successful submatch.
  1940. -- procedure: submatch key regexp --> regexp
  1941. -- procedure: no-submatches regexp --> regexp
  1942. 'Submatch' returns a regular expression that is equivalent to
  1943. REGEXP in every way except that the regular expression returned by
  1944. 'submatch' will produce a submatch record in the output for the
  1945. part of the string matched by REGEXP. 'No-submatches' returns a
  1946. regular expression that is equivalent to REGEXP in every respect
  1947. except that all submatches generated by REGEXP will be ignored &
  1948. removed from the output.
  1949. -- procedure: any-match? regexp string --> boolean
  1950. -- procedure: exact-match? regexp string --> boolean
  1951. -- procedure: match regexp string --> match or '#f'
  1952. 'Any-match?' returns '#t' if STRING matches REGEXP or contains a
  1953. substring that does, or '#f' if otherwise. 'Exact-match?' returns
  1954. '#t' if STRING matches REGEXP exactly, or '#f' if it does not.
  1955. 'Match' returns '#f' if STRING does not match REGEXP, or a match
  1956. record if it does, as described in the previous section. Matching
  1957. occurs according to POSIX. The match returned is the one with the
  1958. lowest starting index in STRING. If there is more than one such
  1959. match, the longest is returned. Within that match, the longest
  1960. possible submatches are returned.
  1961. All three matching procedures cache a compiled version of REGEXP.
  1962. Subsequent calls with the same input regular expression will be
  1963. more efficient.
  1964. Here are some examples of the high-level regular expression
  1965. interface:
  1966. (define pattern (text "abc"))
  1967. (any-match? pattern "abc") => #t
  1968. (any-match? pattern "abx") => #f
  1969. (any-match? pattern "xxabcxx") => #t
  1970. (exact-match? pattern "abc") => #t
  1971. (exact-match? pattern "abx") => #f
  1972. (exact-match? pattern "xxabcxx") => #f
  1973. (let ((m (match (sequence (text "ab")
  1974. (submatch 'foo (text "cd"))
  1975. (text "ef")))
  1976. "xxabcdefxx"))
  1977. (list m (match-submatches m)))
  1978. => (#{Match 3 9} ((foo . #{Match 5 7})))
  1979. (match-submatches
  1980. (match (sequence (set "a")
  1981. (one-of (submatch 'foo (text "bc"))
  1982. (submatch 'bar (text "BC"))))
  1983. "xxxaBCd"))
  1984. => ((bar . #{Match 4 6}))
  1985. 
  1986. File: scheme48.info, Node: POSIX C to Scheme correspondence, Prev: POSIX regular expressions, Up: POSIX interface
  1987. 8.10 C to Scheme correspondence
  1988. ===============================
  1989. 'access'
  1990. 'accessible?'
  1991. 'chdir'
  1992. 'set-working-directory!'
  1993. 'close'
  1994. 'close-input-port, close-output-port, close-channel, close-socket'
  1995. 'closedir'
  1996. 'close-directory-stream'
  1997. 'creat'
  1998. 'open-file'
  1999. 'ctime'
  2000. 'time->string'
  2001. 'dup'
  2002. 'dup, dup-switching-mode'
  2003. 'dup2'
  2004. 'dup2'
  2005. 'exec[l|v][e|p|eps]'
  2006. 'exec, exec-with-environment, exec-file,
  2007. exec-file-with-environment, exec-with-alias'
  2008. '_exit'
  2009. 'exit'
  2010. 'fcntl'
  2011. 'i/o-flags, set-i/o-flags!, close-on-exec?, set-close-on-exec?!'
  2012. 'fork'
  2013. 'fork, fork-and-forget'
  2014. 'fstat'
  2015. 'get-port-info'
  2016. 'getcwd'
  2017. 'working-directory'
  2018. 'getegid'
  2019. 'get-effective-group-id'
  2020. 'getenv'
  2021. 'lookup-environment-variable, environment-alist'
  2022. 'geteuid'
  2023. 'get-effective-user-id'
  2024. 'getgid'
  2025. 'get-group-id'
  2026. 'getgroups'
  2027. 'get-login-name'
  2028. 'getpid'
  2029. 'get-process-id'
  2030. 'getppid'
  2031. 'get-parent-process-id'
  2032. 'getuid'
  2033. 'get-user-id'
  2034. 'isatty'
  2035. 'port-is-a-terminal?'
  2036. 'link'
  2037. 'link'
  2038. 'lstat'
  2039. 'get-file/link-info'
  2040. 'mkdir'
  2041. 'make-directory'
  2042. 'mkfifo'
  2043. 'make-fifo'
  2044. 'open'
  2045. 'open-file'
  2046. 'opendir'
  2047. 'open-directory-stream'
  2048. 'pipe'
  2049. 'open-pipe'
  2050. 'read'
  2051. 'read-char, read-block'
  2052. 'readdir'
  2053. 'read-directory-stream'
  2054. 'rename'
  2055. 'rename'
  2056. 'rmdir'
  2057. 'remove-directory'
  2058. 'setgid'
  2059. 'set-group-id!'
  2060. 'setuid'
  2061. 'set-user-id!'
  2062. 'stat'
  2063. 'get-file-info'
  2064. 'time'
  2065. 'current-time'
  2066. 'ttyname'
  2067. 'port-terminal-name'
  2068. 'umask'
  2069. 'set-file-creation-mask!'
  2070. 'uname'
  2071. 'os-name, os-node-name, os-release-name, os-version-name,
  2072. machine-name'
  2073. 'unlink'
  2074. 'unlink'
  2075. 'waitpid'
  2076. 'wait-for-child-process'
  2077. 'write'
  2078. 'write-char, write-block'
  2079. 
  2080. File: scheme48.info, Node: Pre-Scheme, Next: References, Prev: POSIX interface, Up: Top
  2081. 9 Pre-Scheme: A low-level dialect of Scheme
  2082. *******************************************
  2083. Pre-Scheme [Kelsey 97] is a low-level dialect of Scheme, designed for
  2084. systems programming with higher-level abstractions. For example, the
  2085. Scheme48 virtual machine is written in Pre-Scheme. Pre-Scheme is a
  2086. particularly interesting alternative to C for many systems programming
  2087. tasks, because not only does it operate at about the same level as C,
  2088. but it also may be run in a regular high-level Scheme development with
  2089. no changes to the source, without resorting to low-level stack munging
  2090. with tools such as gdb. Pre-Scheme also supports two _extremely_
  2091. important high-level abstractions of Scheme: macros and higher-order,
  2092. anonymous functions. Richard Kelsey's Pre-Scheme compiler, based on his
  2093. PhD research on transformational compilation [Kelsey 89], compiles
  2094. Pre-Scheme to efficient C, applying numerous intermediate source
  2095. transformations in the process.
  2096. This chapter describes details of the differences between Scheme and
  2097. Pre-Scheme, listings of the default environment and other packages
  2098. available to Pre-Scheme, the operation of Richard Kelsey's Pre-Scheme
  2099. compiler, and how to run Pre-Scheme code as if it were Scheme in a
  2100. regular Scheme environment.
  2101. * Menu:
  2102. * Differences between Pre-Scheme & Scheme::
  2103. * Pre-Scheme type specifiers::
  2104. * Standard Pre-Scheme environment::
  2105. * More Pre-Scheme packages::
  2106. * Invoking the Pre-Scheme compiler::
  2107. * Example Pre-Scheme compiler usage::
  2108. * Running Pre-Scheme as Scheme::
  2109. 
  2110. File: scheme48.info, Node: Differences between Pre-Scheme & Scheme, Next: Pre-Scheme type specifiers, Up: Pre-Scheme
  2111. 9.1 Differences between Pre-Scheme & Scheme
  2112. ===========================================
  2113. Pre-Scheme is often considered either a dialect of Scheme or a subset of
  2114. Scheme. However, there are several very important fundamental
  2115. differences between the semantics of Pre-Scheme & Scheme to detail.
  2116. *There is no garbage collector in Pre-Scheme.*
  2117. All memory management is manual, as in C, although there are two
  2118. levels to memory management, for higher- and lower-level purposes:
  2119. pointers & addresses. Pointers represent higher-level data that
  2120. are statically checked for type coherency, such as vectors of a
  2121. certain element type, or strings. Addresses represent direct,
  2122. low-level memory indices.
  2123. *Pre-Scheme has no closures.*
  2124. 'Lambda' expressions that would require full closures at run-time
  2125. -- e.g., those whose values are stored in the heap -- are not
  2126. permitted in Pre-Scheme. However, the Pre-Scheme compiler can
  2127. hoist many 'lambda' expressions to the top level, removing the need
  2128. of closures for them. (Closures would be much less useful in the
  2129. absence of garbage collection, in any case.) If the Pre-Scheme
  2130. compiler is unable to move a 'lambda' to a place where it requires
  2131. no closure, it signals an error to the user.
  2132. *Tail call optimization is not universal.*
  2133. The Pre-Scheme compiler optimizes tail calls where it is possible
  2134. -- typically, just in local loops and top-level procedures that are
  2135. not exported from the package, but there are other heuristics --,
  2136. but it is not universal. Programmers may force tail call
  2137. optimization with Pre-Scheme's 'goto' special form (*note Tail call
  2138. optimization in Pre-Scheme::), but, in situations where the
  2139. compiler would not have optimized the tail call, this can make the
  2140. generated code have to jump through many hoops to be a tail call --
  2141. often necessitating code bloat, because the code of the tail-called
  2142. procedure is integrated into the caller's driver loop --; and,
  2143. where the compiler would have otherwise optimized the tail call,
  2144. 'goto' has no effect anyway.
  2145. *Types are strictly verified with Hindley-Milner type inference.*
  2146. The types of Pre-Scheme programs are statically verified based on
  2147. Hindley-Milner type inference, with some modifications specific to
  2148. Pre-Scheme. Type information is _not_ retained at run-time; any
  2149. tagging must be performed explicitly.
  2150. *Pre-Scheme does not support first-class continuations.*
  2151. There is no 'call-with-current-continuation' or other continuation
  2152. manipulation interface. It has been suggested that downward-only
  2153. continuations, based on C's 'setjmp' & 'longjmp', might be
  2154. implemented in the future, but this is not yet the case.(1)
  2155. *The full numeric tower of R5RS is not supported by Pre-Scheme.*
  2156. Pre-Scheme's only numeric types are fixnums and flonums, with
  2157. precision determined by the architecture on which the Pre-Scheme
  2158. code runs. Fixnums are translated to C as the 'long' type; flonums
  2159. are translated as the 'float' type.
  2160. *Top-level Pre-Scheme code is evaluated at compile-time.*
  2161. Closures actually _are_ available, as long as they may be
  2162. eliminated before run-time. Code evaluated at compile-time also
  2163. does not require satisfaction of strict static typing. Moreover,
  2164. certain procedures, such as 'vector-length', are available only at
  2165. compile-time.
  2166. ---------- Footnotes ----------
  2167. (1) It may be possible to use Pre-Scheme's C FFI to manually use
  2168. 'setjmp' & 'longjmp', but the author of this manual cannot attest to
  2169. this working.
  2170. 
  2171. File: scheme48.info, Node: Pre-Scheme type specifiers, Next: Standard Pre-Scheme environment, Prev: Differences between Pre-Scheme & Scheme, Up: Pre-Scheme
  2172. 9.2 Type specifiers
  2173. ===================
  2174. Although Pre-Scheme's static type system is based mostly on
  2175. Hindley-Milner type inference, with as little explicit type information
  2176. as possible, there are still places where it is necessary to specify
  2177. types explicitly; for example, *note Pre-Scheme access to C functions
  2178. and macros::. There are several different kinds of types with different
  2179. syntax:
  2180. 'TYPE-NAME'
  2181. Symbols denote either record type or base types. Record types are
  2182. defined with the 'define-record-type' special form described later;
  2183. the following base types are defined:
  2184. 'integer'
  2185. Fixed-size integers (fixnums). This type is translated into C
  2186. as 'long'. The actual size depends on the size of C's 'long',
  2187. which on most architectures is 32 bits.
  2188. 'float'
  2189. Floating-point data. This type translates to C as 'double'.
  2190. 'null'
  2191. Type which has no value. The 'null' type translates to the C
  2192. 'void' type.
  2193. 'unit'
  2194. Type which has one value. Actually, this, too, translates to
  2195. C's 'void', so that it has one value is not strictly true.
  2196. 'boolean'
  2197. Booleans translate to the C 'char' type. '#t' is emitted as
  2198. 'TRUE', and '#f', as 'FALSE'; these are usually the same as
  2199. '1' & '0', respectively.
  2200. 'input-port'
  2201. 'output-port'
  2202. I/O ports. On Unix, since Pre-Scheme uses 'stdio', these are
  2203. translated to 'FILE *'s, 'stdio' file streams.
  2204. 'char'
  2205. Characters. The size of characters is dependent on the
  2206. underlying C compiler's implementation of the 'char' type.
  2207. 'address'
  2208. Simple addresses for use in Pre-Scheme's low-level memory
  2209. manipulation primitives (*note Low-level Pre-Scheme memory
  2210. manipulation::); see that section for more details.
  2211. '(=> (ARGUMENT-TYPE ...) RETURN-TYPE ...)'
  2212. The types of procedures, known as 'arrow' types.
  2213. '(^ TYPE)'
  2214. The type of pointers that point to TYPE. Note that these are
  2215. distinct from the address type. Pointer types are statically
  2216. verified to be coherent data, with no defined operations except for
  2217. accessing offsets in memory from the pointer -- i.e. operations
  2218. such as 'vector-ref' --; addresses simply index bytes, on which
  2219. only direct dereferencing, but also arbitrary address arithmetic,
  2220. is available. Pointers and addresses are _not_ interchangeable,
  2221. and and there is no way to convert between them, as that would
  2222. break the type safety of Pre-Scheme pointers.
  2223. '(tuple TYPE ...)'
  2224. Multiple value types, internally used for argument & return types.
  2225. 
  2226. File: scheme48.info, Node: Standard Pre-Scheme environment, Next: More Pre-Scheme packages, Prev: Pre-Scheme type specifiers, Up: Pre-Scheme
  2227. 9.3 Standard environment
  2228. ========================
  2229. Pre-Scheme programs usually open the 'prescheme' structure. There are
  2230. several other structures built-in to Pre-Scheme as well, described in
  2231. the next section. This section describes the 'prescheme' structure.
  2232. * Menu:
  2233. * Scheme bindings in Pre-Scheme:: Bindings from R5RS
  2234. * Tail call optimization in Pre-Scheme::
  2235. * Pre-Scheme bitwise manipulation::
  2236. * Compound Pre-Scheme data manipulation::
  2237. * Pre-Scheme error handling::
  2238. * Input & output in Pre-Scheme::
  2239. * Pre-Scheme access to C functions and macros::
  2240. 
  2241. File: scheme48.info, Node: Scheme bindings in Pre-Scheme, Next: Tail call optimization in Pre-Scheme, Up: Standard Pre-Scheme environment
  2242. 9.3.1 Scheme bindings
  2243. ---------------------
  2244. Bindings for all the names specified here from R5RS Scheme are available
  2245. in Pre-Scheme. The remainder of the sections after this one detail
  2246. Pre-Scheme specifics that are not a part of Scheme.
  2247. -- syntax: define name value
  2248. -- syntax: define (name . argument-list) value
  2249. -- syntax: if condition consequent [alternate]
  2250. -- syntax: let ((name expression) ...) body
  2251. -- syntax: let* ((name expression) ...) body
  2252. -- syntax: and conjunct ...
  2253. -- syntax: or disjunct ...
  2254. -- syntax: cond cond-clause ...
  2255. -- syntax: do ((name init-exp [step-exp]) ...) (test-exp [return-exp])
  2256. body
  2257. These special forms & macros are all unchanged from their R5RS
  2258. specifications.
  2259. -- syntax: define-syntax name transformer-expression [aux-names]
  2260. -- syntax: let-syntax ((name transformer-expression) ...) body
  2261. -- syntax: letrec-syntax ((name transformer-expression) ...) body
  2262. Pre-Scheme's macro facility is exactly the same as Scheme48's.
  2263. TRANSFORMER-EXPRESSION may be either a 'syntax-rules' or an
  2264. explicit renaming transformer, just as in Scheme48; in the latter
  2265. case, it is evaluated either in a standard Scheme environment or
  2266. however the 'for-syntax' clause specified of the package in whose
  2267. code the transformer appeared. For details on the extra AUX-NAMES
  2268. operand to 'define-syntax', *note Explicit renaming macros::.
  2269. -- procedure: not boolean --> boolean
  2270. -- procedure: eq? value--_{a} value--_{b} --> boolean
  2271. -- procedure: char=? char--_{a} char--_{b} --> boolean
  2272. -- procedure: char<? char--_{a} char--_{b} --> boolean
  2273. -- procedure: values value ... --> values
  2274. -- procedure: call-with-values producer consumer --> values
  2275. -- procedure: current-input-port --> input-port
  2276. -- procedure: current-output-port --> output-port
  2277. These procedures are all unchanged from their R5RS specifications.
  2278. -- procedure: + addend ... --> integer
  2279. -- procedure: - integer --> integer
  2280. -- procedure: - minuend subtrahend --> integer
  2281. -- procedure: * multiplicand ... --> integer
  2282. -- procedure: = integer--_{a} integer--_{b} --> boolean
  2283. -- procedure: < integer--_{a} integer--_{b} --> boolean
  2284. -- procedure: > integer--_{a} integer--_{b} --> boolean
  2285. -- procedure: <= integer--_{a} integer--_{b} --> boolean
  2286. -- procedure: >= integer--_{a} integer--_{b} --> boolean
  2287. -- procedure: min integer_{1} integer_{2} ... --> integer
  2288. -- procedure: max integer_{1} integer_{2} ... --> integer
  2289. -- procedure: abs integer --> integer
  2290. -- procedure: quotient divisor dividend --> integer
  2291. -- procedure: remainder divisor dividend --> integer
  2292. -- procedure: expt base exponent --> integer
  2293. These numerical operations are all unchanged from their R5RS
  2294. counterparts, except that they are applicable only to fixnums, not
  2295. to flonums, and they always return fixnums.
  2296. 
  2297. File: scheme48.info, Node: Tail call optimization in Pre-Scheme, Next: Pre-Scheme bitwise manipulation, Prev: Scheme bindings in Pre-Scheme, Up: Standard Pre-Scheme environment
  2298. 9.3.2 Tail call optimization
  2299. ----------------------------
  2300. -- syntax: goto procedure argument ...
  2301. The Pre-Scheme compiler can be forced to optimize tail calls, even
  2302. those it would not have otherwise optimized, by use of the 'goto'
  2303. special form, rather than simple procedure calls. In every respect
  2304. other than tail call optimization, this is equivalent to calling
  2305. PROCEDURE with the given arguments. Note, however, that uses of
  2306. 'goto' may cause code to blow up if the Pre-Scheme compiler had
  2307. reason not to optimize the tail call were it not for the 'goto': it
  2308. may need to merge the tail-called procedure into the caller's code.
  2309. 
  2310. File: scheme48.info, Node: Pre-Scheme bitwise manipulation, Next: Compound Pre-Scheme data manipulation, Prev: Tail call optimization in Pre-Scheme, Up: Standard Pre-Scheme environment
  2311. 9.3.3 Bitwise manipulation
  2312. --------------------------
  2313. Pre-Scheme provides basic bitwise manipulation operators.
  2314. -- procedure: bitwise-and integer--_{a} integer--_{b} --> integer
  2315. -- procedure: bitwise-ior integer--_{a} integer--_{b} --> integer
  2316. -- procedure: bitwise-xor integer--_{a} integer--_{b} --> integer
  2317. -- procedure: bitwise-not integer --> integer
  2318. Bitwise boolean logical operations.
  2319. -- procedure: shift-left integer count --> integer
  2320. -- procedure: arithmetic-shift-right integer count --> integer
  2321. -- procedure: logical-shift-right integer count --> integer
  2322. Three ways to shift bit strings: 'shift-left' shifts INTEGER left
  2323. by COUNT, 'arithmetic-shift-right' shifts INTEGER right by COUNT
  2324. arithmetically, and 'logical-shift-right' shifts INTEGER right by
  2325. COUNT logically.
  2326. 
  2327. File: scheme48.info, Node: Compound Pre-Scheme data manipulation, Next: Pre-Scheme error handling, Prev: Pre-Scheme bitwise manipulation, Up: Standard Pre-Scheme environment
  2328. 9.3.4 Compound data manipulation
  2329. --------------------------------
  2330. Pre-Scheme has somewhat lower-level vector & string facilities than
  2331. Scheme, with more orientation towards static typing. It also provides a
  2332. statically typed record facility, which translates to C structs, though
  2333. not described here, as it is not in the 'prescheme' structure; *note
  2334. Pre-Scheme record types::.
  2335. -- procedure: make-vector length init --> vector
  2336. -- procedure: vector-length vector --> integer
  2337. -- procedure: vector-ref vector index --> value
  2338. -- procedure: vector-set! vector index value --> unit
  2339. Vectors in Pre-Scheme are almost the same as vectors in regular
  2340. Scheme, but with a few differences. 'Make-vector' initializes what
  2341. it returns with null pointers (see below); it uses the _required_
  2342. (unlike Scheme) INIT argument only to determine the type of the
  2343. vector: vectors are statically typed; they can contain only values
  2344. that have the same static type as INIT. 'Vector-length' is
  2345. available only at the top level, where calls to it can be evaluated
  2346. at compile-time; vectors do not at run-time store their lengths.
  2347. Vectors must also be explicitly deallocated.
  2348. *Warning:* As in C, there is _no_ vector bounds checking at
  2349. run-time.
  2350. -- procedure: make-string length --> string
  2351. -- procedure: string-length string --> integer
  2352. -- procedure: string-ref string index --> char
  2353. -- procedure: string-set! string index char --> unit
  2354. Strings in Pre-Scheme are the nearly same as strings in R5RS
  2355. Scheme. The only three differences here are that 'make-string'
  2356. accepts exactly one argument, strings must be explicitly
  2357. deallocated, and strings are 'nul'-terminated: 'string-length'
  2358. operates by scanning for the first ASCII 'nul' character in a
  2359. string.
  2360. *Warning:* As in C, there is _no_ string bounds checking at
  2361. run-time.
  2362. -- procedure: deallocate pointer --> unit
  2363. Deallocates the memory pointed to by 'pointer'. This is necessary
  2364. at the end of a string, vector, or record's life, as Pre-Scheme
  2365. data are not automatically garbage-collected.
  2366. -- procedure: null-pointer --> null-pointer
  2367. -- procedure: null-pointer? pointer --> boolean
  2368. 'Null-pointer' returns the distinguished null pointer object. It
  2369. corresponds with '0' in a pointer context or 'NULL' in C.
  2370. 'Null-pointer?' returns true if POINTER is a null pointer, or false
  2371. if not.
  2372. 
  2373. File: scheme48.info, Node: Pre-Scheme error handling, Next: Input & output in Pre-Scheme, Prev: Compound Pre-Scheme data manipulation, Up: Standard Pre-Scheme environment
  2374. 9.3.5 Error handling
  2375. --------------------
  2376. Pre-Scheme's method of error handling is similar to the most common one
  2377. in C: error codes. There is an enumeration 'errors' of some error codes
  2378. commonly and portably encountered in Pre-Scheme.
  2379. -- enumeration: errors
  2380. (define-enumeration errors
  2381. (no-errors
  2382. parse-error
  2383. file-not-found
  2384. out-of-memory
  2385. invalid-port))
  2386. Each enumerand has the following meaning:
  2387. '(enum errors no-errors)'
  2388. Absence of error: success.
  2389. '(enum errors parse-error)'
  2390. Any kind of parsing error. The Scheme48 VM uses this when
  2391. someone attempts to resume a malformed suspended heap image.
  2392. '(enum errors file-not-found)'
  2393. Used when an operation that operates on a file given a string
  2394. filename found that the file for that filename was absent.
  2395. '(enum errors out-of-memory)'
  2396. When there is no more memory to allocate.
  2397. '(enum errors invalid-port)'
  2398. Unused.
  2399. -- procedure: error-string error-status --> string
  2400. Returns a string describing the meaning of the 'errors' enumerand
  2401. ERROR-STATUS.
  2402. -- procedure: error message irritant ...
  2403. Signals a fatal error with the given message & related irritants
  2404. and halts the program. On Unix, the program's exit code is -1.
  2405. 
  2406. File: scheme48.info, Node: Input & output in Pre-Scheme, Next: Pre-Scheme access to C functions and macros, Prev: Pre-Scheme error handling, Up: Standard Pre-Scheme environment
  2407. 9.3.6 Input & output
  2408. --------------------
  2409. Pre-Scheme's I/O facilities are somewhat different from Scheme's, given
  2410. the low level and the static type strictness. There is no exception
  2411. mechanism in Pre-Scheme; everything is maintained by returning a status
  2412. token, as in C. Pre-Scheme's built-in I/O facilities are buffered. (1)
  2413. (*note Low-level Pre-Scheme memory manipulation::, for two other I/O
  2414. primitives, 'read-block' & 'write-block', for reading & writing blocks
  2415. of direct memory.)
  2416. -- procedure: open-input-file filename --> [port status]
  2417. -- procedure: open-output-file filename --> [port status]
  2418. -- procedure: close-input-port input-port --> status
  2419. -- procedure: close-output-port output-port --> status
  2420. 'Open-input-file' & 'open-output-file' open ports for the given
  2421. filenames. They each return two values: the newly open port and an
  2422. 'errors' enumerand status. Users of these procedures should always
  2423. check the error status before proceeding to operate with the port.
  2424. 'Close-input-port' & 'close-output-port' close their port arguments
  2425. and return the 'errors' enumerand status of the closing.
  2426. -- procedure: read-char input-port --> [char eof? status]
  2427. -- procedure: peek-char input-port --> [char eof? status]
  2428. -- procedure: read-integer input-port --> [integer eof? status]
  2429. 'Read-char' reads & consumes a single character from its INPUT-PORT
  2430. argument. 'Peek-char' reads, but does not consume, a single
  2431. character from INPUT-PORT. 'Read-integer' parses an integer
  2432. literal, including sign. All of these also return two other
  2433. values: whether or not the file is at the end and any 'errors'
  2434. enumerand status. If any error occurred, the first two values
  2435. returned should be ignored. If STATUS is '(enum errors
  2436. no-errors)', users of these three procedures should then check
  2437. EOF?; it is true if INPUT-PORT was at the end of the file with
  2438. nothing more left to read and false otherwise. Finally, if both
  2439. STATUS is '(enum errors no-errors)' and EOF? is false, the first
  2440. value returned may be safely used.
  2441. -- procedure: write-char char output-port --> status
  2442. -- procedure: newline output-port --> status
  2443. -- procedure: write-string string output-port --> status
  2444. -- procedure: write-integer integer output-port --> status
  2445. These all write particular elements to their OUTPUT-PORT arguments.
  2446. 'Write-char' writes individual characters. 'Newline' writes
  2447. newlines (line-feed, or ASCII codepoint 10, on Unix).
  2448. 'Write-string' writes the contents of STRING. 'Write-integer'
  2449. writes an ASCII representation of INTEGER to port, suitable to be
  2450. read by 'read-integer'. These all return an 'errors' enumerand
  2451. status. If it is 'no-errors', the write succeeded.
  2452. -- procedure: force-output output-port --> status
  2453. Forces all buffered output in OUTPUT-PORT. STATUS tells whether or
  2454. not the operation was successful.
  2455. ---------- Footnotes ----------
  2456. (1) Scheme48's VM does not use Pre-Scheme's built-in I/O facilities
  2457. to implement channels (*note Channels::) -- it builds its own
  2458. lower-level facilities that are still OS-independent, but, because
  2459. they're written individually for different OSs, they integrate better as
  2460. low-level I/O channels with the OS. On Unix, the Scheme48 VM uses file
  2461. descriptors; Pre-Scheme's built-in I/O uses 'stdio'. Scheme48's VM uses
  2462. Pre-Scheme's built-in I/O only to read heap images.
  2463. 
  2464. File: scheme48.info, Node: Pre-Scheme access to C functions and macros, Prev: Input & output in Pre-Scheme, Up: Standard Pre-Scheme environment
  2465. 9.3.7 Access to C functions and macros
  2466. --------------------------------------
  2467. -- syntax: external c-name ps-type --> procedure
  2468. Special form for accessing C functions & macros. Calls in
  2469. Pre-Scheme to the resulting procedure are compiled to calls in C to
  2470. the function or macro named by C-NAME, which should be a string.
  2471. PS-TYPE is the Pre-Scheme type (*note Pre-Scheme type specifiers::)
  2472. that the procedure should have, which is necessary for type
  2473. inference.
  2474. 
  2475. File: scheme48.info, Node: More Pre-Scheme packages, Next: Invoking the Pre-Scheme compiler, Prev: Standard Pre-Scheme environment, Up: Pre-Scheme
  2476. 9.4 More Pre-Scheme packages
  2477. ============================
  2478. Along with the 'prescheme' structure, there are several other structures
  2479. built-in to Pre-Scheme.
  2480. * Menu:
  2481. * Pre-Scheme floating point operation::
  2482. * Pre-Scheme record types::
  2483. * Multiple return values in Pre-Scheme::
  2484. * Low-level Pre-Scheme memory manipulation::
  2485. 
  2486. File: scheme48.info, Node: Pre-Scheme floating point operation, Next: Pre-Scheme record types, Up: More Pre-Scheme packages
  2487. 9.4.1 Floating point operation
  2488. ------------------------------
  2489. Since Pre-Scheme's strict static type system would not permit
  2490. overloading of the arithmetic operators for integers & floats, it
  2491. provides a different set of operators for floats. These names are all
  2492. exported by the 'ps-flonums' structure.
  2493. -- procedure: fl+ augend addend ... --> float
  2494. -- procedure: fl- float --> float
  2495. -- procedure: fl- minuend subtrahend --> float
  2496. -- procedure: fl* multiplier multiplicand ... --> float
  2497. -- procedure: fl/ divisor dividend --> float
  2498. -- procedure: fl= float--_{a} float--_{b} --> boolean
  2499. -- procedure: fl< float--_{a} float--_{b} --> boolean
  2500. -- procedure: fl> float--_{a} float--_{b} --> boolean
  2501. -- procedure: fl<= float--_{a} float--_{b} --> boolean
  2502. -- procedure: fl>= float--_{a} float--_{b} --> boolean
  2503. All of these operations 'flOP' correspond as floating point
  2504. variations of their OP integer equivalents.
  2505. 
  2506. File: scheme48.info, Node: Pre-Scheme record types, Next: Multiple return values in Pre-Scheme, Prev: Pre-Scheme floating point operation, Up: More Pre-Scheme packages
  2507. 9.4.2 Record types
  2508. ------------------
  2509. The 'ps-record-types' structure defines the following special form for
  2510. introducing record types. Pre-Scheme record types are translated to C
  2511. as structs.
  2512. -- syntax: define-record-type
  2513. (define-record-type TYPE TYPE-DESCRIPTOR
  2514. (CONSTRUCTOR ARGUMENT-FIELD-TAG ...)
  2515. (FIELD-TAG_{1} FIELD-TYPE-SPEC_{1}
  2516. FIELD-ACCESSOR_{1} [FIELD-MODIFIER_{1}])
  2517. (FIELD-TAG_{2} FIELD-TYPE-SPEC_{2}
  2518. FIELD-ACCESSOR_{2} [FIELD-MODIFIER_{2}])
  2519. ...
  2520. (FIELD-TAG_{N} FIELD-TYPE-SPEC_{N}
  2521. FIELD-ACCESSOR_{N} [FIELD-MODIFIER_{N}])
  2522. Defines a record type. TYPE is mangled to the C struct type name
  2523. (TYPE-DESCRIPTOR-NAME is unused unless running Pre-Scheme as
  2524. Scheme). CONSTRUCTOR is defined to construct a record of the new
  2525. type and initialize the fields ARGUMENT-TYPE-FIELD ... with its
  2526. arguments, respectively. If it cannot allocate a sufficient
  2527. quantity of memory, CONSTRUCTOR returns a null pointer. The
  2528. initial values of fields that are not passed to the constructor are
  2529. undefined. For each field FIELD-_{I} specified,
  2530. * FIELD-_{I} is specified to have the type FIELD-TYPE-SPEC-_{I};
  2531. * FIELD-ACCESSOR-_{I} is defined to be a procedure of one
  2532. argument, a record of type TYPE-NAME, that returns the value
  2533. of the field FIELD-_{I} of that record -- its type is defined
  2534. to be '(=> (TYPE-NAME) FIELD-TYPE-SPEC--_{I})'; and
  2535. * if present, FIELD-MODIFIER-_{I} is defined to be a procedure
  2536. of two arguments, a record of type TYPE-NAME and a value of
  2537. type FIELD-TYPE-SPEC, that assigns the value of the field
  2538. FIELD-_{I} in its first argument to be the value of its second
  2539. argument; its type is '(=> (TYPE-NAME FIELD-TYPE-SPEC) unit)'.
  2540. Records must be deallocated explicitly when their lifetime has
  2541. expired with 'deallocate'.
  2542. 
  2543. File: scheme48.info, Node: Multiple return values in Pre-Scheme, Next: Low-level Pre-Scheme memory manipulation, Prev: Pre-Scheme record types, Up: More Pre-Scheme packages
  2544. 9.4.3 Multiple return values
  2545. ----------------------------
  2546. Pre-Scheme support multiple return values, like in Scheme. The only
  2547. difference is that one cannot operate on multiple return values as
  2548. lists, since Pre-Scheme does not have lists. Multiple return values are
  2549. implemented in C as returning in C the first value and passing pointers
  2550. to the remaining values, which the function returning multiple values
  2551. assigns. The 'prescheme' structure exports the two multiple return
  2552. value primitives, 'call-with-values' and 'values', but the 'ps-receive'
  2553. structure exports this macro for more conveniently binding multiple
  2554. return values.
  2555. -- syntax: receive formals producer body
  2556. Binds the 'lambda' parameter list FORMALS to the multiple values
  2557. that PRODUCER returns, and evaluates BODY with the new variables
  2558. bound.
  2559. (receive FORMALS
  2560. PRODUCER
  2561. BODY)
  2562. ==
  2563. (call-with-values
  2564. (lambda () PRODUCER)
  2565. (lambda FORMALS
  2566. BODY))
  2567. 
  2568. File: scheme48.info, Node: Low-level Pre-Scheme memory manipulation, Prev: Multiple return values in Pre-Scheme, Up: More Pre-Scheme packages
  2569. 9.4.4 Low-level memory manipulation
  2570. -----------------------------------
  2571. Pre-Scheme is a low-level language. It provides very low-level, direct
  2572. memory manipulation. 'Addresses' index a flat store of sequences of
  2573. bytes. While Pre-Scheme 'pointers' are statically checked for data
  2574. coherency, allow no arbitrary arithmetic, and in general are high-level
  2575. abstract data to some extent, addresses are much lower-level, have no
  2576. statically checked coherency -- the values an address represents are
  2577. selected by what operation used to read or write from it --, permit
  2578. arbitrary address arithmetic, and are a much more concrete interface
  2579. into direct memory. The 'ps-memory' structure exports these direct
  2580. memory manipulation primitives.
  2581. -- procedure: allocate-memory size --> address
  2582. -- procedure: deallocate-memory address --> unit
  2583. 'Allocate-memory' reserves a sequence of SIZE bytes in the store
  2584. and returns an address to the first byte in the sequence.
  2585. 'Deallocate-memory' releases the memory at ADDRESS, which should
  2586. have been the initial address of a contiguous byte sequence, as
  2587. 'allocate-memory' would return, not an offset address from such an
  2588. initial address.
  2589. -- procedure: unsigned-byte-ref address --> unsigned-byte
  2590. -- procedure: unsigned-byte-set! address unsigned-byte --> unit
  2591. -- procedure: word-ref address --> word
  2592. -- procedure: word-set! address word --> unit
  2593. -- procedure: flonum-ref address --> float
  2594. -- procedure: flonum-set! address float --> unit
  2595. Procedures for reading from & storing to memory.
  2596. 'Unsigned-byte-ref' & 'unsigned-byte-set!' access & store the first
  2597. unsigned byte at ADDRESS. 'Word-ref' & 'word-set!' access & store
  2598. the first word -- Pre-Scheme integer -- beginning at ADDRESS.
  2599. 'Flonum-ref' & 'flonum-set!' access & store 64-bit floats beginning
  2600. at ADDRESS..
  2601. *Bug:* 'Flonum-ref' & 'flonum-set!' are unimplemented in the
  2602. Pre-Scheme-as-Scheme layer (*note Running Pre-Scheme as Scheme::).
  2603. -- procedure: address? value --> boolean
  2604. Disjoint type predicate for addresses.
  2605. *Note:* 'Address?' is available _only_ at the top level, where code
  2606. is evaluated at compile-time. Do not use this in any place where
  2607. it may be called at run-time.
  2608. -- constant: null-address --> address
  2609. The null address. This is somewhat similar to the null pointer,
  2610. except that it is an address.
  2611. *Note:* One acquires the null _pointer_ by calling the _procedure_
  2612. 'null-pointer', whereas the constant value of the _binding_ named
  2613. 'null-address' is the null _address_.
  2614. -- procedure: null-address? address --> boolean
  2615. 'Null-address?' returns true if ADDRESS is the null address and
  2616. false if not.
  2617. -- procedure: address+ address increment --> address
  2618. -- procedure: address- address decrement --> address
  2619. -- procedure: address-difference address--_{a} address--_{b} -->
  2620. integer
  2621. Address arithmetic operators. 'Address+' adds INCREMENT to
  2622. ADDRESS; 'address-' subtracts DECREMENT from ADDRESS; and
  2623. 'address-difference' returns the integer difference between
  2624. ADDRESS-_{A} and ADDRESS-_{B}. For any ADDRESS-_{P} &
  2625. ADDRESS-_{Q}, '(address+ ADDRESS--_{P} (address-difference
  2626. ADDRESS--_{P} ADDRESS--_{Q}))' is equal to ADDRESS-_{Q}.
  2627. -- procedure: address= address--_{a} address--_{b} --> boolean
  2628. -- procedure: address< address--_{a} address--_{b} --> boolean
  2629. -- procedure: address> address--_{a} address--_{b} --> boolean
  2630. -- procedure: address<= address--_{a} address--_{b} --> boolean
  2631. -- procedure: address>= address--_{a} address--_{b} --> boolean
  2632. Address comparators.
  2633. -- procedure: integer->address integer --> address
  2634. -- procedure: address->integer address --> integer
  2635. Integers and addresses, although not the same type, may be
  2636. converted to and from each other; 'integer->address' &
  2637. 'address->integer' perform this conversion. Note that Pre-Scheme
  2638. _pointers_ may not be converted to addresses or integers, and the
  2639. converse is also true.
  2640. -- procedure: copy-memory! source-address target-address count --> unit
  2641. Copies COUNT bytes starting at SOURCE-ADDRESS to TARGET-ADDRESS.
  2642. This is similar to C's 'memcpy'.
  2643. -- procedure: memory-equal? address--_{a} address--_{b} count -->
  2644. boolean
  2645. Compares the two sequences of COUNT bytes starting at addresses
  2646. ADDRESS-_{A} & ADDRESS-_{B}. It returns true if every byte is
  2647. equal and false if not.
  2648. -- procedure: char-pointer->string address size --> string
  2649. -- procedure: char-pointer->nul-terminated-string address --> string
  2650. 'Char-pointer->string' returns a string with SIZE bytes from the
  2651. contiguous sequence of bytes starting at ADDRESS.
  2652. 'Char-pointer->nul-terminated-string' does similarly, but it
  2653. returns a string whose contents include every byte starting at
  2654. ADDRESS until, but not including, the first 0 byte, i.e. ASCII nul
  2655. character, following ADDRESS.
  2656. -- procedure: read-block port address count --> [count-read eof?
  2657. status]
  2658. -- procedure: write-block port address count --> status
  2659. 'Read-block' attempts to read COUNT bytes from PORT into memory
  2660. starting at ADDRESS. 'Write-block' attempts to write COUNT bytes
  2661. to PORT from the contiguous sequence in memory starting at ADDRESS.
  2662. 'Read-block' returns three values: the number of bytes read,
  2663. whether or not the read went to the end of the file, and the error
  2664. status (*note Pre-Scheme error handling::). 'Write-block' returns
  2665. the error status.
  2666. 
  2667. File: scheme48.info, Node: Invoking the Pre-Scheme compiler, Next: Example Pre-Scheme compiler usage, Prev: More Pre-Scheme packages, Up: Pre-Scheme
  2668. 9.5 Invoking the Pre-Scheme compiler
  2669. ====================================
  2670. Richard Kelsey's Pre-Scheme compiler is a whole-program compiler based
  2671. on techniques from his research in transformational compilation [Kelsey
  2672. 89]. It compiles the restricted dialect of Scheme to efficient C, and
  2673. provides facilities for programmer direction in several optimizations.
  2674. 9.5.1 Loading the compiler
  2675. --------------------------
  2676. There is a script, a Scheme48 command program (*note Command
  2677. programs::), that comes with Scheme48 to load the Pre-Scheme compiler,
  2678. which is in the file 'ps-compiler/load-ps-compiler.scm'. It must be
  2679. loaded from the 'ps-compiler/' directory, from Scheme48's main
  2680. distribution, into the 'exec' package, after having loaded
  2681. '../scheme/prescheme/interface.scm' &
  2682. '../scheme/prescheme/package-defs.scm' into the 'config' package. The
  2683. Pre-Scheme compiler takes some time to load, so it may be easier to load
  2684. it once and dump a heap image of the suspended command processor after
  2685. having loaded everything; *note Image-building commands::.
  2686. To load the Pre-Scheme compiler and dump an image to the file
  2687. 'ps-compiler.image' that contains 'prescheme-compiler' in the user
  2688. package, send this sequence of commands to the command processor while
  2689. in the 'ps-compiler/' directory of Scheme48's distribution:
  2690. ,config ,load ../scheme/prescheme/interface.scm
  2691. ,config ,load ../scheme/prescheme/package-defs.scm
  2692. ,exec ,load load-ps-compiler.scm
  2693. ,in prescheme-compiler prescheme-compiler
  2694. ,user (define prescheme-compiler ##)
  2695. ,dump ps-compiler.image "(Pre-Scheme)"
  2696. 9.5.2 Calling the compiler
  2697. --------------------------
  2698. After having loaded the Pre-Scheme compiler, the 'prescheme-compiler'
  2699. structure is the front end to the compiler that exports the
  2700. 'prescheme-compiler' procedure.
  2701. -- procedure: prescheme-compiler structure-spec config-filenames
  2702. init-name c-filename command ...
  2703. Invokes the Pre-Scheme compiler. CONFIG-FILENAMES contain module
  2704. descriptions (*note Module system::) for the components of the
  2705. program. STRUCTURE-SPEC may be a symbol or a list of symbols,
  2706. naming the important structure or structures. All structures that
  2707. it relies/they rely on are traced in the packages' 'open' clauses.
  2708. Modules that are not traced in the dependency graph with root
  2709. vertices of the given structure[s] are omitted from the output.
  2710. C-FILENAME is a string naming the file to which the C code
  2711. generated by the Pre-Scheme compiler should be emitted. INIT-NAME
  2712. is the name for an initialization routine, generated automatically
  2713. by the Pre-Scheme compiler to initialize some top-level variables.
  2714. The COMMAND arguments are used to control certain aspects of the
  2715. compilation. The following commands are defined:
  2716. '(copy (STRUCTURE COPYABLE-PROCEDURE) ...)'
  2717. Specifies that each the body of each COPYABLE-PROCEDURE from
  2718. the respective STRUCTURE (from one of CONFIG-FILENAMES) may be
  2719. integrated & duplicated.
  2720. '(no-copy (STRUCTURE UNCOPYABLE-PROCEDURE) ...)'
  2721. Specifies that the given procedures may not be integrated.
  2722. '(shadow ((PROC-STRUCTURE PROCEDURE) (VAR-STRUCTURE VARIABLE-TO-SHADOW) ...) ...)'
  2723. Specifies that, in PROCEDURE from PROC-STRUCTURE, the global
  2724. variables VARIABLE-TO-SHADOW from their respective
  2725. VAR-STRUCTUREs should be shadowed with local variables, which
  2726. are more likely to be kept in registers for faster operation
  2727. on them.
  2728. '(integrate (CLIENT-PROCEDURE INTEGRABLE-PROCEDURE) ...)'
  2729. Forces INTEGRABLE-PROCEDURE to be integrated in
  2730. CLIENT-PROCEDURE.
  2731. *Note:* The 'integrate' command operates on the global
  2732. program, not on one particular module; each CLIENT-PROCEDURE
  2733. and INTEGRABLE-PROCEDURE is chosen from all variables defined
  2734. in the entirety of the program, across all modules. It is
  2735. advised that there be only one of each.
  2736. '(header HEADER-LINE ...)'
  2737. Each HEADER-LINE is added to the top of the generated C file,
  2738. after a cpp inclusion of '<stdio.h>' and '"prescheme.h"'.
  2739. The command arguments to 'prescheme-compiler' are optional; they
  2740. are used only to optimize the compiled program at the programmer's
  2741. request.
  2742. 
  2743. File: scheme48.info, Node: Example Pre-Scheme compiler usage, Next: Running Pre-Scheme as Scheme, Prev: Invoking the Pre-Scheme compiler, Up: Pre-Scheme
  2744. 9.6 Example Pre-Scheme compiler usage
  2745. =====================================
  2746. The 'ps-compiler/compile-vm.scm', 'ps-compiler/compile-gc.scm', and
  2747. 'ps-compiler/compile-vm-no-gc.scm' files give examples of running the
  2748. Pre-Scheme compiler. They are Scheme48 command programs (*note Command
  2749. programs::), to be loaded into the 'exec' package after having already
  2750. loaded the Pre-Scheme compiler. 'compile-vm.scm' &
  2751. 'compile-vm-no-gc.scm' generate a new 'scheme48vm.c' in the 'scheme/vm/'
  2752. directory -- 'compile-vm.scm' includes the garbage collector, while
  2753. 'compile-vm-no-gc.scm' does not (1) --, and 'compile-gc.scm' generates a
  2754. new 'scheme48heap.c', 'scheme48read-image.c', & 'scheme48write-image.c'
  2755. in the 'scheme/vm/' directory.
  2756. Here is a somewhat simpler example. It assumes a pre-built image
  2757. with the Pre-Scheme compiler loaded is in the 'ps-compiler.image' file
  2758. in the current directory (*note Invoking the Pre-Scheme compiler::,
  2759. where there is a description of how to dump an image with the Pre-Scheme
  2760. compiler loaded).
  2761. % ls
  2762. hello.scm packages.scm ps-compiler.image
  2763. % cat hello.scm
  2764. (define (main argc argv)
  2765. (if (= argc 2)
  2766. (let ((out (current-output-port)))
  2767. (write-string "Hello, world, " out)
  2768. (write-string (vector-ref argv 1) out)
  2769. (write-char #\! out)
  2770. (newline out)
  2771. 0)
  2772. (let ((out (current-error-port)))
  2773. (write-string "Usage: " out)
  2774. (write-string (vector-ref argv 0) out)
  2775. (write-string " <user>" out)
  2776. (newline out)
  2777. (write-string " Greets the world & <user>." out)
  2778. (newline out)
  2779. -1)))
  2780. % cat packages.scm
  2781. (define-structure hello (export main)
  2782. (open prescheme)
  2783. (files hello))
  2784. % scheme48 -i ps-compiler.image
  2785. heap size 3000000 is too small, using 4770088
  2786. Welcome to Scheme 48 1.3 (Pre-Scheme)
  2787. Copyright (c) 1993-2005 by Richard Kelsey and Jonathan Rees.
  2788. Please report bugs to scheme-48-bugs@s48.org.
  2789. Get more information at http://www.s48.org/.
  2790. Type ,? (comma question-mark) for help.
  2791. > (prescheme-compiler 'hello '("packages.scm") 'hello-init "hello.c")
  2792. packages.scm
  2793. hello.scmChecking types
  2794. main : ((integer **char) -> integer)
  2795. In-lining single-use procedures
  2796. Call Graph:
  2797. <procedure name>
  2798. <called non-tail-recursively>
  2799. <called tail-recursively>
  2800. main (exported)
  2801. Merging forms
  2802. Translating
  2803. main
  2804. #{Unspecific}
  2805. > ,exit
  2806. % cat hello.c
  2807. #include <stdio.h>
  2808. #include "prescheme.h"
  2809. long main(long, char**);
  2810. long main(long argc_0X, char **argv_1X)
  2811. {
  2812. FILE * out_3X;
  2813. FILE * out_2X;
  2814. { if ((1 == argc_0X)) {
  2815. out_2X = stdout;
  2816. ps_write_string("Hello, world, ", out_2X);
  2817. ps_write_string((*(argv_1X + 1)), out_2X);
  2818. { long ignoreXX;
  2819. PS_WRITE_CHAR(33, out_2X, ignoreXX) }
  2820. { long ignoreXX;
  2821. PS_WRITE_CHAR(10, out_2X, ignoreXX) }
  2822. return 0;}
  2823. else {
  2824. out_3X = stderr;
  2825. ps_write_string("Usage: ", out_3X);
  2826. ps_write_string((*(argv_1X + 0)), out_3X);
  2827. ps_write_string(" <user>", out_3X);
  2828. { long ignoreXX;
  2829. PS_WRITE_CHAR(10, out_3X, ignoreXX) }
  2830. ps_write_string(" Greets the world & <user>.", out_3X);
  2831. { long ignoreXX;
  2832. PS_WRITE_CHAR(10, out_3X, ignoreXX) }
  2833. return -1;}}
  2834. }
  2835. %
  2836. ---------- Footnotes ----------
  2837. (1) The actual distribution of Scheme48 separates the garbage
  2838. collector and the main virtual machine.
  2839. 
  2840. File: scheme48.info, Node: Running Pre-Scheme as Scheme, Prev: Example Pre-Scheme compiler usage, Up: Pre-Scheme
  2841. 9.7 Running Pre-Scheme as Scheme
  2842. ================================
  2843. To facilitate the operation of Pre-Scheme systems within a high-level
  2844. Scheme development environment, Scheme48 simply defines the 'prescheme',
  2845. 'ps-memory', 'ps-record-types', 'ps-flonums', and 'ps-receive'
  2846. structures in terms of Scheme; Pre-Scheme structures can be loaded as
  2847. regular Scheme structures because of this. Those structures and the
  2848. interfaces they implement are defined in the files
  2849. 'scheme/prescheme/interface.scm' and 'scheme/prescheme/package-defs.scm'
  2850. from the main Scheme48 distribution; simply load these files into the
  2851. config package (*note Module commands::) before loading any Pre-Scheme
  2852. configuration files.
  2853. The Pre-Scheme emulation layer in Scheme has some shortcomings:
  2854. * No more than sixteen megabytes can be allocated at once.
  2855. * More than thirty-two or sixty-four or so allocations result in
  2856. addresses overflowing bignums, which deallocations does not affect.
  2857. * Flonum memory access is unimplemented. (Flonum arithmetic works,
  2858. though.)
  2859. * The layer is very slow.
  2860. 
  2861. File: scheme48.info, Node: References, Next: Concept index, Prev: Pre-Scheme, Up: Top
  2862. References
  2863. **********
  2864. [Cejtin et al. 95]
  2865. Henry Cejtin, Suresh Jagannathan, and Richard Kelsey. Higher-Order
  2866. Distributed Objects. In 'ACM Transactions on Programming Languages
  2867. and Systems', vol. 17, pp. 704-739, ACM Press, September 1995.
  2868. [Clinger 91]
  2869. William D. Clinger. Hygienic Macros through Explicit Renaming. In
  2870. 'Lisp Pointers', IV(4): 25-28, December 1991.
  2871. [Donald 92]
  2872. Bruce Donald and Jonathan A. Rees. Program Mobile Robots in
  2873. Scheme! In 'Proceedings of the 1992 IEEE International Conference
  2874. on Robotics and Automation', 2681-2688.
  2875. [Friedman 00]
  2876. Daniel Friedman and Erik Hilsdale. 'Writing Macros in
  2877. Continuation-Passing Style'. Worksop on Scheme and Functional
  2878. Programming, September 2000.
  2879. [Kelsey 89]
  2880. Richard Kelsey. 'Compilation by Program Transformation'. PhD
  2881. thesis, Yale University, 1989.
  2882. [Kelsey 97]
  2883. Richard Kelsey. 'Pre-Scheme: A Scheme Dialect for Systems
  2884. Programming'. June 1997.
  2885. [Museme]
  2886. Franklyn Turbak and Dan Winship. 'Museme: a multi-user simulation
  2887. environment for Scheme'.
  2888. <http://www.bloodandcoffee.net/campbell/code/museme.tar.gz>
  2889. [Rees 96]
  2890. Jonathan A. Rees. 'A Security Kernel based on the
  2891. Lambda-Calculus'. PhD thesis, AI Memo 1564, Massachusetts
  2892. Institute of Technology, Artificial Intelligence Laboratory, 1996.
  2893. [Reppy 99]
  2894. John Reppy. 'Concurrent Programming in ML'. Cambridge University
  2895. Press, 1999.
  2896. [Shivers 94]
  2897. Olin Shivers. 'A Scheme Shell'. Tech Report 635, Massachusetts
  2898. Institute of Technology, Laboratory for Computer Science, 1994.
  2899. [Shivers 96]
  2900. Olin Shivers. 'A Universal Scripting Framework, or Lambda: the
  2901. Ultimate "Little Language"'. 'Concurrency and Parallelism,
  2902. Programming, Networking, and Security', pp. 254-265, 1996, Joxan
  2903. Jaffar and Roland H. C. Yap (eds).
  2904. [Shivers et al. 04]
  2905. Olin Shivers, Brian D. Carlstrom, Martin Gasbichler, and Michael
  2906. Sperber. 'Scsh Reference Manual', for scsh release 0.6.6
  2907. <http://www.scsh.net/docu/docu.html>
  2908. [SRFI 1]
  2909. Olin Shivers. 'SRFI 1: List Library' Scheme Requests for
  2910. Implementation, 1999.
  2911. <http://srfi.schemers.org/srfi-1/>
  2912. [SRFI 7]
  2913. Richard Kelsey. 'SRFI 7: Feature-Based Program Configuration
  2914. Language' Scheme Requests for Implementation, 1999.
  2915. <http://srfi.schemers.org/srfi-7/>
  2916. [SRFI 9]
  2917. Richard Kelsey. 'SRFI 9: Defining Record Types' Scheme Requests
  2918. for Implementation, 1999.
  2919. <http://srfi.schemers.org/srfi-9/>
  2920. [SRFI 22]
  2921. Martin Gasbichler and Michael Sperber 'SRFI 22: Running Scheme
  2922. Scripts on Unix' Scheme Requests for Implementation, 2002.
  2923. <http://srfi.schemers.org/srfi-22/>
  2924. [SRFI 34]
  2925. Richard Kelsey and Michael Sperber. 'SRFI 34: Exception Handling
  2926. for Programs'. Scheme Requests for Implementation, 2002.
  2927. <http://srfi.schemers.org/srfi-34/>
  2928. [SRFI 35]
  2929. Richard Kelsey and Michael Sperber. 'SRFI 35: Conditions'. Scheme
  2930. Requests for Implementation, 2002.
  2931. <http://srfi.schemers.org/srfi-35/>
  2932. 
  2933. File: scheme48.info, Node: Concept index, Next: Binding index, Prev: References, Up: Top
  2934. Concept index
  2935. *************
  2936. [index]
  2937. * Menu:
  2938. * =scheme48/: Filenames. (line 114)
  2939. * abstract data types: Records. (line 6)
  2940. * accessing file ports' channels: Channel ports. (line 43)
  2941. * accessing structures: Module configuration language.
  2942. (line 23)
  2943. * amb operator: Library utilities. (line 83)
  2944. * anonymous structures: Module configuration language.
  2945. (line 131)
  2946. * arrays: Library data structures.
  2947. (line 11)
  2948. * asynchronous channels: Rendezvous communication channels.
  2949. (line 46)
  2950. * asynchronous thread communication channels: Higher-level synchronization.
  2951. (line 85)
  2952. * atomic regions: Optimistic concurrency.
  2953. (line 40)
  2954. * auto-integrate optimizer: Module configuration language.
  2955. (line 67)
  2956. * backtrace: Debugging commands. (line 60)
  2957. * backtracking: Library utilities. (line 83)
  2958. * batch mode: Running Scheme48. (line 56)
  2959. * batch mode <1>: Command processor switches.
  2960. (line 26)
  2961. * binary data operation: Bitwise manipulation.
  2962. (line 6)
  2963. * binary search trees: Library data structures.
  2964. (line 54)
  2965. * binding multiple values: Library utilities. (line 213)
  2966. * bitwise integer operations: Bitwise manipulation.
  2967. (line 6)
  2968. * block input and output: Ports. (line 39)
  2969. * blocking I/O: POSIX file system access.
  2970. (line 115)
  2971. * buffered input and output: Buffered ports & handlers.
  2972. (line 6)
  2973. * buffered output forcing: Miscellaneous features.
  2974. (line 36)
  2975. * buffered output forcing <1>: Ports. (line 63)
  2976. * byte manipulation: Bitwise manipulation.
  2977. (line 6)
  2978. * C access to Scheme byte vectors: Accessing Scheme data from C.
  2979. (line 127)
  2980. * C access to Scheme fixnums: Accessing Scheme data from C.
  2981. (line 86)
  2982. * C access to Scheme pairs: Accessing Scheme data from C.
  2983. (line 107)
  2984. * C access to Scheme strings: Accessing Scheme data from C.
  2985. (line 120)
  2986. * C access to Scheme vectors: Accessing Scheme data from C.
  2987. (line 114)
  2988. * C and Scheme data conversion: Accessing Scheme data from C.
  2989. (line 31)
  2990. * C dynamic loading: Dynamic loading of C modules.
  2991. (line 6)
  2992. * C macros for Scheme constants: Accessing Scheme data from C.
  2993. (line 13)
  2994. * C macros on Scheme booleans: Accessing Scheme data from C.
  2995. (line 80)
  2996. * C naming conventions: C interface. (line 64)
  2997. * C predicates for Scheme data: Accessing Scheme data from C.
  2998. (line 100)
  2999. * C shared objects: Dynamic loading of C modules.
  3000. (line 6)
  3001. * callbacks from C and continuations: Calling Scheme procedures from C.
  3002. (line 14)
  3003. * callbacks from C and threads: Calling Scheme procedures from C.
  3004. (line 14)
  3005. * channel utilities, higher-level: Channels. (line 108)
  3006. * channels: Channels. (line 6)
  3007. * channels <1>: Rendezvous communication channels.
  3008. (line 9)
  3009. * channels <2>: Rendezvous communication channels.
  3010. (line 46)
  3011. * character sink output ports: I/O extensions. (line 25)
  3012. * character source input ports: I/O extensions. (line 25)
  3013. * closing channels: Channels. (line 42)
  3014. * closure flattening: Module configuration language.
  3015. (line 67)
  3016. * closures in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3017. (line 18)
  3018. * code reloading: Using the module system.
  3019. (line 66)
  3020. * code reloading <1>: Module commands. (line 29)
  3021. * command levels: Command processor switches.
  3022. (line 41)
  3023. * command levels <1>: Command levels. (line 6)
  3024. * command processor help: Basic commands. (line 9)
  3025. * command processor settings: Command processor switches.
  3026. (line 6)
  3027. * committing proposals: Optimistic concurrency.
  3028. (line 278)
  3029. * compile-time evaluation in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3030. (line 60)
  3031. * compiler optimization: Module configuration language.
  3032. (line 51)
  3033. * compound interfaces: Module system architecture.
  3034. (line 61)
  3035. * compound interfaces <1>: Module configuration language.
  3036. (line 127)
  3037. * condition handlers: Condition system. (line 39)
  3038. * condition messages: Condition system. (line 91)
  3039. * condition restarting: Debugging commands. (line 69)
  3040. * condition types: Condition system. (line 39)
  3041. * condition types <1>: Condition system. (line 166)
  3042. * conditions: Condition system. (line 39)
  3043. * conditions <1>: Condition system. (line 166)
  3044. * config package: Module commands. (line 36)
  3045. * configuration language: Module system architecture.
  3046. (line 6)
  3047. * configuration language <1>: Module configuration language.
  3048. (line 6)
  3049. * configuration language macros: Module configuration language.
  3050. (line 205)
  3051. * configuring the command processor: Command processor switches.
  3052. (line 6)
  3053. * continuation previews: Debugging commands. (line 60)
  3054. * continuations and callbacks from C: Calling Scheme procedures from C.
  3055. (line 14)
  3056. * continuations in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3057. (line 48)
  3058. * creating directories: POSIX file system access.
  3059. (line 127)
  3060. * creating POSIX FIFOs: POSIX file system access.
  3061. (line 127)
  3062. * creating POSIX links: POSIX file system access.
  3063. (line 127)
  3064. * customized writer: Writer. (line 26)
  3065. * customized writer <1>: Writer. (line 58)
  3066. * debug data storage control: Resource statistics and control.
  3067. (line 21)
  3068. * defining record types: Records. (line 10)
  3069. * deleting directories: POSIX file system access.
  3070. (line 136)
  3071. * deleting files: POSIX file system access.
  3072. (line 136)
  3073. * destructuring S-expressions: Library utilities. (line 12)
  3074. * directory creation: POSIX file system access.
  3075. (line 127)
  3076. * directory deletion: POSIX file system access.
  3077. (line 136)
  3078. * directory listing: POSIX file system access.
  3079. (line 26)
  3080. * directory streams: POSIX file system access.
  3081. (line 10)
  3082. * disabling command levels: Command processor switches.
  3083. (line 41)
  3084. * disabling command levels <1>: Command levels. (line 17)
  3085. * disassembly: Debugging commands. (line 21)
  3086. * displaying conditions: Condition system. (line 215)
  3087. * displaying heap usage: Resource statistics and control.
  3088. (line 60)
  3089. * dumping heap images: Image-building commands.
  3090. (line 6)
  3091. * dumping heap images <1>: Suspending and resuming heap images.
  3092. (line 6)
  3093. * dumping Scheme heap images with C data: Interacting with the Scheme heap in C.
  3094. (line 64)
  3095. * dynamic bindings: Fluid/dynamic bindings.
  3096. (line 6)
  3097. * environment flattening: Module configuration language.
  3098. (line 67)
  3099. * environment variables: POSIX process environment.
  3100. (line 30)
  3101. * error messages: Condition system. (line 91)
  3102. * errors: Condition system. (line 39)
  3103. * evaluation of top-level code in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3104. (line 60)
  3105. * event: Concurrent ML. (line 6)
  3106. * exceptions: Condition system. (line 39)
  3107. * exec language: Command programs. (line 6)
  3108. * exec package: Command programs. (line 6)
  3109. * executing processes: POSIX processes. (line 44)
  3110. * execution timing: Resource statistics and control.
  3111. (line 14)
  3112. * exiting processes: POSIX processes. (line 40)
  3113. * exiting Scheme: Basic commands. (line 18)
  3114. * expanding macros: Debugging commands. (line 21)
  3115. * exporting bindings from C to Scheme: Shared bindings between Scheme and C.
  3116. (line 89)
  3117. * exporting bindings from Scheme to C: Shared bindings between Scheme and C.
  3118. (line 44)
  3119. * exporting C functions to Scheme: Shared bindings between Scheme and C.
  3120. (line 94)
  3121. * fcntl: POSIX I/O utilities. (line 71)
  3122. * fd-port dup'ing: POSIX I/O utilities. (line 52)
  3123. * fd-port I/O flags: POSIX I/O utilities. (line 71)
  3124. * fd-ports: POSIX I/O utilities. (line 13)
  3125. * FIFOs: Queues. (line 6)
  3126. * file access probing: POSIX file system access.
  3127. (line 145)
  3128. * file channels: Channels. (line 34)
  3129. * file deletion: POSIX file system access.
  3130. (line 136)
  3131. * file descriptor ports: POSIX I/O utilities. (line 13)
  3132. * file descriptor reassignment: POSIX I/O utilities. (line 31)
  3133. * file info: POSIX file system access.
  3134. (line 154)
  3135. * file permissions: POSIX file system access.
  3136. (line 210)
  3137. * filename translations: Filenames. (line 83)
  3138. * flat closures: Module configuration language.
  3139. (line 67)
  3140. * flat environments: Module configuration language.
  3141. (line 67)
  3142. * flat-environments optimizer: Module configuration language.
  3143. (line 67)
  3144. * fluid bindings: Fluid/dynamic bindings.
  3145. (line 6)
  3146. * flushing output buffers: Miscellaneous features.
  3147. (line 36)
  3148. * flushing output buffers <1>: Ports. (line 63)
  3149. * for-syntax: Macros in concert with modules.
  3150. (line 56)
  3151. * for-syntax <1>: Macros in concert with modules.
  3152. (line 77)
  3153. * forcing buffered output: Miscellaneous features.
  3154. (line 36)
  3155. * forcing buffered output <1>: Ports. (line 63)
  3156. * forcing garbage collection: Resource statistics and control.
  3157. (line 10)
  3158. * forking: POSIX processes. (line 10)
  3159. * functors: Module system architecture.
  3160. (line 71)
  3161. * garbage collection in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3162. (line 10)
  3163. * garbage collection, forcing: Resource statistics and control.
  3164. (line 10)
  3165. * GC protection in C: Interacting with the Scheme heap in C.
  3166. (line 6)
  3167. * generic functions: Generic dispatch system.
  3168. (line 6)
  3169. * generic modules: Module system architecture.
  3170. (line 71)
  3171. * generic predicate dispatch: Generic dispatch system.
  3172. (line 6)
  3173. * graph algorithms: Library utilities. (line 64)
  3174. * group ids: POSIX process environment.
  3175. (line 14)
  3176. * group ids <1>: POSIX users and groups.
  3177. (line 6)
  3178. * growing vectors: Library data structures.
  3179. (line 103)
  3180. * heap image dumping: Image-building commands.
  3181. (line 6)
  3182. * heap image dumping <1>: Suspending and resuming heap images.
  3183. (line 6)
  3184. * heap image resumption: Running Scheme48. (line 6)
  3185. * heap image resumption <1>: Suspending and resuming heap images.
  3186. (line 41)
  3187. * heap image writing: Image-building commands.
  3188. (line 6)
  3189. * heap image writing <1>: Suspending and resuming heap images.
  3190. (line 6)
  3191. * heap size: Running Scheme48. (line 19)
  3192. * heap space analysis: Resource statistics and control.
  3193. (line 60)
  3194. * heap traversal: Resource statistics and control.
  3195. (line 83)
  3196. * help: Basic commands. (line 9)
  3197. * higher-level channel utilities: Channels. (line 108)
  3198. * higher-order modules: Module system architecture.
  3199. (line 71)
  3200. * hygiene of macros in modules: Macros in concert with modules.
  3201. (line 14)
  3202. * I/O flags: POSIX I/O utilities. (line 71)
  3203. * image dumping: Image-building commands.
  3204. (line 6)
  3205. * image dumping <1>: Suspending and resuming heap images.
  3206. (line 6)
  3207. * image writing: Image-building commands.
  3208. (line 6)
  3209. * image writing <1>: Suspending and resuming heap images.
  3210. (line 6)
  3211. * immutability: Miscellaneous features.
  3212. (line 9)
  3213. * importing bindings into C from Scheme: Shared bindings between Scheme and C.
  3214. (line 85)
  3215. * importing bindings into Scheme from C: Shared bindings between Scheme and C.
  3216. (line 33)
  3217. * importing C functions to Scheme: Calling C functions from Scheme.
  3218. (line 6)
  3219. * importing C functions to Scheme <1>: Calling C functions from Scheme.
  3220. (line 34)
  3221. * in-line procedures: Module configuration language.
  3222. (line 67)
  3223. * input and output of blocks: Ports. (line 39)
  3224. * input ports from strings: I/O extensions. (line 38)
  3225. * installing condition handlers: Condition system. (line 125)
  3226. * installing proposals: Optimistic concurrency.
  3227. (line 288)
  3228. * integrated procedures: Module configuration language.
  3229. (line 67)
  3230. * interaction between continuations and C: Calling Scheme procedures from C.
  3231. (line 14)
  3232. * interface abstraction: Module system architecture.
  3233. (line 61)
  3234. * interface definition forms: Module configuration language.
  3235. (line 98)
  3236. * interface reüse: Module system architecture.
  3237. (line 61)
  3238. * interfaces: Using the module system.
  3239. (line 126)
  3240. * interfaces <1>: Module system architecture.
  3241. (line 14)
  3242. * join types: Static type system. (line 87)
  3243. * limiting output: I/O extensions. (line 53)
  3244. * line- & column-tracking ports: I/O extensions. (line 8)
  3245. * listing directories: POSIX file system access.
  3246. (line 26)
  3247. * locks for mutual exclusion: Pessimistic concurrency.
  3248. (line 6)
  3249. * logging operations: Port data type. (line 83)
  3250. * logging operations <1>: Optimistic concurrency.
  3251. (line 100)
  3252. * logs: Optimistic concurrency.
  3253. (line 25)
  3254. * loopholes in the type system: Type annotations. (line 6)
  3255. * low-level access to records: Records. (line 216)
  3256. * low-level macros: Explicit renaming macros.
  3257. (line 6)
  3258. * macro expansion: Debugging commands. (line 21)
  3259. * macro hygiene in modules: Macros in concert with modules.
  3260. (line 14)
  3261. * macro referential transparency in modules: Macros in concert with modules.
  3262. (line 14)
  3263. * macros in the module configuration language: Module configuration language.
  3264. (line 205)
  3265. * macros, low-level: Explicit renaming macros.
  3266. (line 6)
  3267. * macros, unhygienic: Explicit renaming macros.
  3268. (line 6)
  3269. * making directories: POSIX file system access.
  3270. (line 127)
  3271. * marshalling: Library utilities. (line 257)
  3272. * meet types: Static type system. (line 87)
  3273. * memory management in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3274. (line 10)
  3275. * memory management in Pre-Scheme <1>: Compound Pre-Scheme data manipulation.
  3276. (line 6)
  3277. * memory management in Pre-Scheme <2>: Low-level Pre-Scheme memory manipulation.
  3278. (line 6)
  3279. * memory size: Running Scheme48. (line 19)
  3280. * message-passing: Rendezvous communication channels.
  3281. (line 9)
  3282. * message-passing <1>: Rendezvous communication channels.
  3283. (line 46)
  3284. * modified interfaces: Module configuration language.
  3285. (line 142)
  3286. * modified structures: Module configuration language.
  3287. (line 142)
  3288. * module language: Module system architecture.
  3289. (line 6)
  3290. * module language <1>: Module configuration language.
  3291. (line 6)
  3292. * module language macros: Module configuration language.
  3293. (line 205)
  3294. * modules: Module system architecture.
  3295. (line 14)
  3296. * multimethod dispatch: Generic dispatch system.
  3297. (line 6)
  3298. * multiple value binding: Library utilities. (line 213)
  3299. * mutability: Miscellaneous features.
  3300. (line 9)
  3301. * mutex locks: Pessimistic concurrency.
  3302. (line 6)
  3303. * mutual exclusion: Pessimistic concurrency.
  3304. (line 6)
  3305. * namelists: Filenames. (line 36)
  3306. * networking: TCP & UDP sockets. (line 6)
  3307. * noise output: Miscellaneous features.
  3308. (line 42)
  3309. * noise output <1>: Ports. (line 96)
  3310. * nonblocking I/O: POSIX file system access.
  3311. (line 115)
  3312. * nondeterminism: Library utilities. (line 83)
  3313. * numbers in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3314. (line 54)
  3315. * object dumping: Library utilities. (line 257)
  3316. * object reference analysis: Resource statistics and control.
  3317. (line 83)
  3318. * opaque data types: Records. (line 6)
  3319. * opening structures: Module commands. (line 17)
  3320. * opening structures <1>: Module system architecture.
  3321. (line 31)
  3322. * opening structures <2>: Module configuration language.
  3323. (line 23)
  3324. * optimistic concurrency logging operations: Port data type. (line 83)
  3325. * optimistic concurrency logging operations <1>: Optimistic concurrency.
  3326. (line 100)
  3327. * optimistic concurrency logs: Optimistic concurrency.
  3328. (line 25)
  3329. * optimistic concurrency proposals: Optimistic concurrency.
  3330. (line 25)
  3331. * optimistically concurrent record types: Optimistic concurrency.
  3332. (line 129)
  3333. * optimizer: Module configuration language.
  3334. (line 51)
  3335. * output port buffer forcing: Miscellaneous features.
  3336. (line 36)
  3337. * output port buffer forcing <1>: Ports. (line 63)
  3338. * output ports to strings: I/O extensions. (line 38)
  3339. * package clauses: Module configuration language.
  3340. (line 18)
  3341. * packages: Module system architecture.
  3342. (line 14)
  3343. * parameterized modules: Module system architecture.
  3344. (line 71)
  3345. * parametric polymorphism: Static type system. (line 84)
  3346. * phase separation: Macros in concert with modules.
  3347. (line 19)
  3348. * pipe I/O: POSIX I/O utilities. (line 9)
  3349. * port to channel conversion: Channel ports. (line 43)
  3350. * ports that track line & column numbers: I/O extensions. (line 8)
  3351. * ports with line & column numbers: I/O extensions. (line 8)
  3352. * POSIX directory access: POSIX file system access.
  3353. (line 10)
  3354. * POSIX environment variables: POSIX process environment.
  3355. (line 30)
  3356. * POSIX exec: POSIX processes. (line 44)
  3357. * POSIX fcntl: POSIX I/O utilities. (line 71)
  3358. * POSIX FIFOs: POSIX file system access.
  3359. (line 127)
  3360. * POSIX file creation masks: POSIX file system access.
  3361. (line 122)
  3362. * POSIX file opening: POSIX file system access.
  3363. (line 37)
  3364. * POSIX file permissions: POSIX file system access.
  3365. (line 210)
  3366. * POSIX fork: POSIX processes. (line 10)
  3367. * POSIX group ids: POSIX process environment.
  3368. (line 14)
  3369. * POSIX group info: POSIX users and groups.
  3370. (line 27)
  3371. * POSIX links: POSIX file system access.
  3372. (line 127)
  3373. * POSIX pipe I/O: POSIX I/O utilities. (line 9)
  3374. * POSIX process exiting: POSIX processes. (line 40)
  3375. * POSIX process ids: POSIX processes. (line 18)
  3376. * POSIX process ids <1>: POSIX process environment.
  3377. (line 9)
  3378. * POSIX process termination: POSIX processes. (line 27)
  3379. * POSIX terminal ports: POSIX I/O utilities. (line 78)
  3380. * POSIX user ids: POSIX process environment.
  3381. (line 14)
  3382. * POSIX user info: POSIX users and groups.
  3383. (line 27)
  3384. * POSIX working directory: POSIX file system access.
  3385. (line 32)
  3386. * Pre-Scheme closures: Differences between Pre-Scheme & Scheme.
  3387. (line 18)
  3388. * Pre-Scheme garbage collection: Differences between Pre-Scheme & Scheme.
  3389. (line 10)
  3390. * Pre-Scheme memory management: Differences between Pre-Scheme & Scheme.
  3391. (line 10)
  3392. * Pre-Scheme memory management <1>: Compound Pre-Scheme data manipulation.
  3393. (line 6)
  3394. * Pre-Scheme memory management <2>: Low-level Pre-Scheme memory manipulation.
  3395. (line 6)
  3396. * Pre-Scheme numbers: Differences between Pre-Scheme & Scheme.
  3397. (line 54)
  3398. * Pre-Scheme strings: Compound Pre-Scheme data manipulation.
  3399. (line 6)
  3400. * Pre-Scheme tail call optimization: Differences between Pre-Scheme & Scheme.
  3401. (line 28)
  3402. * Pre-Scheme tail call optimization <1>: Tail call optimization in Pre-Scheme.
  3403. (line 6)
  3404. * Pre-Scheme top-level evaluation: Differences between Pre-Scheme & Scheme.
  3405. (line 60)
  3406. * Pre-Scheme type inference: Differences between Pre-Scheme & Scheme.
  3407. (line 42)
  3408. * Pre-Scheme type inference <1>: Pre-Scheme type specifiers.
  3409. (line 6)
  3410. * Pre-Scheme vectors: Compound Pre-Scheme data manipulation.
  3411. (line 6)
  3412. * pretty-printing: Library utilities. (line 29)
  3413. * previewing continuations: Debugging commands. (line 60)
  3414. * printing: Library utilities. (line 29)
  3415. * printing conditions: Condition system. (line 215)
  3416. * procedure integration: Module configuration language.
  3417. (line 67)
  3418. * procedures, tracing: Debugging commands. (line 47)
  3419. * proceeding from errors: Debugging commands. (line 69)
  3420. * process forking: POSIX processes. (line 10)
  3421. * process ids: POSIX processes. (line 18)
  3422. * process ids <1>: POSIX process environment.
  3423. (line 9)
  3424. * process termination: POSIX processes. (line 27)
  3425. * programmatic record types: Records. (line 134)
  3426. * proposals: Optimistic concurrency.
  3427. (line 25)
  3428. * proposals <1>: Optimistic concurrency.
  3429. (line 268)
  3430. * proposals, committing: Optimistic concurrency.
  3431. (line 278)
  3432. * proposals, installing: Optimistic concurrency.
  3433. (line 288)
  3434. * quitting Scheme: Basic commands. (line 18)
  3435. * real time: Library utilities. (line 283)
  3436. * record resumers: Interacting with the Scheme heap in C.
  3437. (line 64)
  3438. * record types, defining: Records. (line 10)
  3439. * record types, programmatic: Records. (line 134)
  3440. * records, low-level access to: Records. (line 216)
  3441. * referential transparency of macros in modules: Macros in concert with modules.
  3442. (line 14)
  3443. * reflective tower: Macros in concert with modules.
  3444. (line 56)
  3445. * reloading code: Using the module system.
  3446. (line 66)
  3447. * reloading code <1>: Module commands. (line 29)
  3448. * removing directories: POSIX file system access.
  3449. (line 136)
  3450. * removing files: POSIX file system access.
  3451. (line 136)
  3452. * renaming files: POSIX file system access.
  3453. (line 136)
  3454. * rendezvous: Concurrent ML. (line 6)
  3455. * resizable vectors: Library data structures.
  3456. (line 103)
  3457. * restoring C data after resuming images: Interacting with the Scheme heap in C.
  3458. (line 64)
  3459. * resuming heap images: Running Scheme48. (line 6)
  3460. * resuming heap images <1>: Suspending and resuming heap images.
  3461. (line 41)
  3462. * resuming suspended threads: Custom thread synchronization.
  3463. (line 6)
  3464. * returning from errors: Debugging commands. (line 69)
  3465. * run time: Library utilities. (line 283)
  3466. * S-expression destructuring: Library utilities. (line 12)
  3467. * Scheme and C data conversion: Accessing Scheme data from C.
  3468. (line 31)
  3469. * Scheme boolean testing in C: Accessing Scheme data from C.
  3470. (line 80)
  3471. * Scheme byte vector operations in C: Accessing Scheme data from C.
  3472. (line 127)
  3473. * Scheme callbacks in C: Calling Scheme procedures from C.
  3474. (line 6)
  3475. * Scheme constants in C: Accessing Scheme data from C.
  3476. (line 13)
  3477. * Scheme data predicates in C: Accessing Scheme data from C.
  3478. (line 100)
  3479. * Scheme fixnums from C: Accessing Scheme data from C.
  3480. (line 86)
  3481. * Scheme pair operations in C: Accessing Scheme data from C.
  3482. (line 107)
  3483. * Scheme string operations in C: Accessing Scheme data from C.
  3484. (line 120)
  3485. * Scheme vector operations in C: Accessing Scheme data from C.
  3486. (line 114)
  3487. * scheme48.h: Accessing Scheme data from C.
  3488. (line 6)
  3489. * separate compilation: Macros in concert with modules.
  3490. (line 10)
  3491. * serialization: Library utilities. (line 257)
  3492. * sharing data between Scheme and C: Shared bindings between Scheme and C.
  3493. (line 6)
  3494. * signal queues: POSIX signals. (line 125)
  3495. * signalling conditions: Condition system. (line 39)
  3496. * simple character sink output ports: I/O extensions. (line 25)
  3497. * simple character source input ports: I/O extensions. (line 25)
  3498. * simple interfaces: Module configuration language.
  3499. (line 104)
  3500. * sleeping threads: Basic thread operations.
  3501. (line 16)
  3502. * space usage analysis: Resource statistics and control.
  3503. (line 60)
  3504. * spawning threads: Basic thread operations.
  3505. (line 8)
  3506. * stack size: Running Scheme48. (line 28)
  3507. * static type analysis: Static type system. (line 6)
  3508. * static types in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3509. (line 42)
  3510. * static types in Pre-Scheme <1>: Pre-Scheme type specifiers.
  3511. (line 6)
  3512. * storage control of debug data: Resource statistics and control.
  3513. (line 21)
  3514. * storage leak analysis: Resource statistics and control.
  3515. (line 83)
  3516. * storing C data in the Scheme heap: Interacting with the Scheme heap in C.
  3517. (line 46)
  3518. * string input ports: I/O extensions. (line 38)
  3519. * string matching: POSIX regular expressions.
  3520. (line 6)
  3521. * string output ports: I/O extensions. (line 38)
  3522. * string ports: I/O extensions. (line 38)
  3523. * strings in Pre-Scheme: Compound Pre-Scheme data manipulation.
  3524. (line 6)
  3525. * strongly-connected graph components: Library utilities. (line 64)
  3526. * structure definition forms: Module configuration language.
  3527. (line 79)
  3528. * structures: Module system architecture.
  3529. (line 14)
  3530. * structures, accessing: Module configuration language.
  3531. (line 23)
  3532. * structures, opening: Module commands. (line 17)
  3533. * structures, opening <1>: Module system architecture.
  3534. (line 31)
  3535. * structures, opening <2>: Module configuration language.
  3536. (line 23)
  3537. * suspending threads: Custom thread synchronization.
  3538. (line 6)
  3539. * synchronous channels: Rendezvous communication channels.
  3540. (line 9)
  3541. * syntactic tower: Macros in concert with modules.
  3542. (line 56)
  3543. * syntax expansion: Debugging commands. (line 21)
  3544. * tail call optimization in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3545. (line 28)
  3546. * tail call optimization in Pre-Scheme <1>: Tail call optimization in Pre-Scheme.
  3547. (line 6)
  3548. * tail recursion in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3549. (line 28)
  3550. * tail recursion in Pre-Scheme <1>: Tail call optimization in Pre-Scheme.
  3551. (line 6)
  3552. * terminal ports: POSIX I/O utilities. (line 78)
  3553. * terminating threads: Basic thread operations.
  3554. (line 23)
  3555. * thread cells: Custom thread synchronization.
  3556. (line 11)
  3557. * thread communication channels, asynchronous: Higher-level synchronization.
  3558. (line 85)
  3559. * thread descriptors: Basic thread operations.
  3560. (line 27)
  3561. * thread queues: Custom thread synchronization.
  3562. (line 11)
  3563. * thread sleeping: Basic thread operations.
  3564. (line 16)
  3565. * thread termination: Basic thread operations.
  3566. (line 23)
  3567. * thread yielding: Basic thread operations.
  3568. (line 16)
  3569. * threads and callbacks from C: Calling Scheme procedures from C.
  3570. (line 14)
  3571. * threads, spawning: Basic thread operations.
  3572. (line 8)
  3573. * time: Rendezvous base combinators.
  3574. (line 59)
  3575. * time <1>: Library utilities. (line 283)
  3576. * timing execution: Resource statistics and control.
  3577. (line 14)
  3578. * top-level evaluation in Pre-Scheme: Differences between Pre-Scheme & Scheme.
  3579. (line 60)
  3580. * towers of evaluation phases: Macros in concert with modules.
  3581. (line 19)
  3582. * tracing: Debugging commands. (line 47)
  3583. * transaction logs: Optimistic concurrency.
  3584. (line 25)
  3585. * type dispatch: Generic dispatch system.
  3586. (line 6)
  3587. * type inference: Static type system. (line 6)
  3588. * type lattice: Static type system. (line 54)
  3589. * type system loopholes: Type annotations. (line 6)
  3590. * undefined imported bindings: Running Scheme48. (line 53)
  3591. * unhygienic macros: Explicit renaming macros.
  3592. (line 6)
  3593. * unspecific: Various utilities. (line 12)
  3594. * unspecified: Various utilities. (line 12)
  3595. * user ids: POSIX process environment.
  3596. (line 14)
  3597. * user ids <1>: POSIX users and groups.
  3598. (line 6)
  3599. * user package: Module commands. (line 36)
  3600. * usual resumer: Suspending and resuming heap images.
  3601. (line 41)
  3602. * vectors in Pre-Scheme: Compound Pre-Scheme data manipulation.
  3603. (line 6)
  3604. * waiting for POSIX processes: POSIX processes. (line 27)
  3605. * warnings: Condition system. (line 39)
  3606. * working directory: POSIX file system access.
  3607. (line 32)
  3608. * writer, customized: Writer. (line 26)
  3609. * writer, customized <1>: Writer. (line 58)
  3610. * writing heap images: Image-building commands.
  3611. (line 6)
  3612. * writing heap images <1>: Suspending and resuming heap images.
  3613. (line 6)
  3614. * yielding threads: Basic thread operations.
  3615. (line 16)
  3616. 
  3617. File: scheme48.info, Node: Binding index, Next: Structure index, Prev: Concept index, Up: Top
  3618. Binding index
  3619. *************
  3620. [index]
  3621. * Menu:
  3622. * &disclose-condition: Condition system. (line 229)
  3623. * *: Scheme bindings in Pre-Scheme.
  3624. (line 47)
  3625. * *load-file-type*: Filenames. (line 10)
  3626. * *scheme-file-type*: Filenames. (line 9)
  3627. * +: Scheme bindings in Pre-Scheme.
  3628. (line 44)
  3629. * ,?: Basic commands. (line 11)
  3630. * ,? <1>: Basic commands. (line 12)
  3631. * ,bound?: Debugging commands. (line 9)
  3632. * ,build: Image-building commands.
  3633. (line 11)
  3634. * ,collect: Resource statistics and control.
  3635. (line 10)
  3636. * ,condition: Command levels. (line 40)
  3637. * ,condition <1>: Debugging commands. (line 41)
  3638. * ,config: Module commands. (line 38)
  3639. * ,config <1>: Module commands. (line 39)
  3640. * ,config-package-is: Module commands. (line 70)
  3641. * ,debug: Debugging commands. (line 65)
  3642. * ,dis: Debugging commands. (line 23)
  3643. * ,dis <1>: Debugging commands. (line 24)
  3644. * ,dump: Image-building commands.
  3645. (line 12)
  3646. * ,dump <1>: Image-building commands.
  3647. (line 13)
  3648. * ,end: Emacs integration commands.
  3649. (line 11)
  3650. * ,exec: Command programs. (line 12)
  3651. * ,exec <1>: Command programs. (line 13)
  3652. * ,exit: Basic commands. (line 18)
  3653. * ,exit <1>: Basic commands. (line 19)
  3654. * ,exit-when-done: Basic commands. (line 20)
  3655. * ,exit-when-done <1>: Basic commands. (line 21)
  3656. * ,expand: Debugging commands. (line 21)
  3657. * ,expand <1>: Debugging commands. (line 22)
  3658. * ,flush: Resource statistics and control.
  3659. (line 23)
  3660. * ,flush <1>: Resource statistics and control.
  3661. (line 24)
  3662. * ,for-syntax: Module commands. (line 40)
  3663. * ,for-syntax <1>: Module commands. (line 41)
  3664. * ,forget: Emacs integration commands.
  3665. (line 22)
  3666. * ,from-file: Emacs integration commands.
  3667. (line 10)
  3668. * ,go: Basic commands. (line 28)
  3669. * ,help: Basic commands. (line 9)
  3670. * ,help <1>: Basic commands. (line 10)
  3671. * ,in: Module commands. (line 43)
  3672. * ,in <1>: Module commands. (line 44)
  3673. * ,inspect: Inspector. (line 25)
  3674. * ,inspect <1>: Inspector. (line 26)
  3675. * ,keep: Resource statistics and control.
  3676. (line 21)
  3677. * ,keep <1>: Resource statistics and control.
  3678. (line 22)
  3679. * ,load: Basic commands. (line 49)
  3680. * ,load-package: Module commands. (line 28)
  3681. * ,load-srfi-7-program: SRFI 7. (line 9)
  3682. * ,load-srfi-7-script: SRFI 7. (line 10)
  3683. * ,new-package: Module commands. (line 42)
  3684. * ,open: Module commands. (line 17)
  3685. * ,pop: Command levels. (line 24)
  3686. * ,preview: Debugging commands. (line 60)
  3687. * ,proceed: Debugging commands. (line 69)
  3688. * ,proceed <1>: Debugging commands. (line 70)
  3689. * ,push: Command levels. (line 23)
  3690. * ,reload-package: Module commands. (line 29)
  3691. * ,reset: Command levels. (line 27)
  3692. * ,reset <1>: Command levels. (line 28)
  3693. * ,resume: Command levels. (line 25)
  3694. * ,resume <1>: Command levels. (line 26)
  3695. * ,run: Basic commands. (line 40)
  3696. * ,set: Command processor switches.
  3697. (line 9)
  3698. * ,set <1>: Command processor switches.
  3699. (line 10)
  3700. * ,set <2>: Command processor switches.
  3701. (line 12)
  3702. * ,structure: Module commands. (line 75)
  3703. * ,threads: Command levels. (line 41)
  3704. * ,threads <1>: Debugging commands. (line 42)
  3705. * ,time: Resource statistics and control.
  3706. (line 14)
  3707. * ,trace: Debugging commands. (line 47)
  3708. * ,trace <1>: Debugging commands. (line 48)
  3709. * ,translate: Basic commands. (line 61)
  3710. * ,undefine: Basic commands. (line 46)
  3711. * ,unset: Command processor switches.
  3712. (line 11)
  3713. * ,untrace: Debugging commands. (line 49)
  3714. * ,untrace <1>: Debugging commands. (line 50)
  3715. * ,user: Module commands. (line 36)
  3716. * ,user <1>: Module commands. (line 37)
  3717. * ,user-package-is: Module commands. (line 69)
  3718. * ,where: Debugging commands. (line 10)
  3719. * ,where <1>: Debugging commands. (line 11)
  3720. * -: Scheme bindings in Pre-Scheme.
  3721. (line 45)
  3722. * - <1>: Scheme bindings in Pre-Scheme.
  3723. (line 46)
  3724. * :record-type: Records. (line 188)
  3725. * <: Scheme bindings in Pre-Scheme.
  3726. (line 49)
  3727. * <=: Scheme bindings in Pre-Scheme.
  3728. (line 51)
  3729. * =: Scheme bindings in Pre-Scheme.
  3730. (line 48)
  3731. * >: Scheme bindings in Pre-Scheme.
  3732. (line 50)
  3733. * >=: Scheme bindings in Pre-Scheme.
  3734. (line 52)
  3735. * abs: Scheme bindings in Pre-Scheme.
  3736. (line 55)
  3737. * access: Module configuration language.
  3738. (line 24)
  3739. * access-mode: POSIX file system access.
  3740. (line 147)
  3741. * accessible?: POSIX file system access.
  3742. (line 145)
  3743. * add-finalizer!: Calling C functions from Scheme.
  3744. (line 90)
  3745. * add-signal-queue-signal!: POSIX signals. (line 158)
  3746. * add-to-population!: Weak references. (line 28)
  3747. * address+: Low-level Pre-Scheme memory manipulation.
  3748. (line 61)
  3749. * address-: Low-level Pre-Scheme memory manipulation.
  3750. (line 62)
  3751. * address->integer: Low-level Pre-Scheme memory manipulation.
  3752. (line 80)
  3753. * address-difference: Low-level Pre-Scheme memory manipulation.
  3754. (line 63)
  3755. * address<: Low-level Pre-Scheme memory manipulation.
  3756. (line 73)
  3757. * address<=: Low-level Pre-Scheme memory manipulation.
  3758. (line 75)
  3759. * address=: Low-level Pre-Scheme memory manipulation.
  3760. (line 72)
  3761. * address>: Low-level Pre-Scheme memory manipulation.
  3762. (line 74)
  3763. * address>=: Low-level Pre-Scheme memory manipulation.
  3764. (line 76)
  3765. * address?: Low-level Pre-Scheme memory manipulation.
  3766. (line 42)
  3767. * after-time-rv: Rendezvous base combinators.
  3768. (line 63)
  3769. * alias: Module configuration language.
  3770. (line 158)
  3771. * all-values: Library utilities. (line 93)
  3772. * allocate-memory: Low-level Pre-Scheme memory manipulation.
  3773. (line 17)
  3774. * alphabetic: POSIX regular expressions.
  3775. (line 125)
  3776. * alphanumeric: POSIX regular expressions.
  3777. (line 127)
  3778. * always-rv: Rendezvous base combinators.
  3779. (line 12)
  3780. * and: Scheme bindings in Pre-Scheme.
  3781. (line 15)
  3782. * any: Various utilities. (line 103)
  3783. * any <1>: Library utilities. (line 154)
  3784. * any-match?: POSIX regular expressions.
  3785. (line 224)
  3786. * any?: Library utilities. (line 161)
  3787. * arithmetic-shift: Bitwise manipulation.
  3788. (line 21)
  3789. * arithmetic-shift-right: Pre-Scheme bitwise manipulation.
  3790. (line 15)
  3791. * array: Library data structures.
  3792. (line 15)
  3793. * array->vector: Library data structures.
  3794. (line 38)
  3795. * array-ref: Library data structures.
  3796. (line 32)
  3797. * array-set!: Library data structures.
  3798. (line 33)
  3799. * array-shape: Library data structures.
  3800. (line 29)
  3801. * array?: Library data structures.
  3802. (line 26)
  3803. * ascii->char: ASCII character encoding.
  3804. (line 9)
  3805. * ascii-limit: ASCII character encoding.
  3806. (line 20)
  3807. * ascii-range: POSIX regular expressions.
  3808. (line 94)
  3809. * ascii-ranges: POSIX regular expressions.
  3810. (line 95)
  3811. * ascii-whitespaces: ASCII character encoding.
  3812. (line 21)
  3813. * async-channel?: Rendezvous communication channels.
  3814. (line 62)
  3815. * at-real-time-rv: Rendezvous base combinators.
  3816. (line 62)
  3817. * atom?: Library utilities. (line 126)
  3818. * atomically: Optimistic concurrency.
  3819. (line 65)
  3820. * atomically!: Optimistic concurrency.
  3821. (line 66)
  3822. * attempt-copy-bytes!: Optimistic concurrency.
  3823. (line 115)
  3824. * begin: Module configuration language.
  3825. (line 46)
  3826. * begin <1>: Module configuration language.
  3827. (line 195)
  3828. * bit-count: Bitwise manipulation.
  3829. (line 26)
  3830. * bitwise-and: Bitwise manipulation.
  3831. (line 15)
  3832. * bitwise-and <1>: Pre-Scheme bitwise manipulation.
  3833. (line 8)
  3834. * bitwise-ior: Bitwise manipulation.
  3835. (line 16)
  3836. * bitwise-ior <1>: Pre-Scheme bitwise manipulation.
  3837. (line 9)
  3838. * bitwise-not: Bitwise manipulation.
  3839. (line 18)
  3840. * bitwise-not <1>: Pre-Scheme bitwise manipulation.
  3841. (line 11)
  3842. * bitwise-xor: Bitwise manipulation.
  3843. (line 17)
  3844. * bitwise-xor <1>: Pre-Scheme bitwise manipulation.
  3845. (line 10)
  3846. * blank: POSIX regular expressions.
  3847. (line 133)
  3848. * breakpoint: Library utilities. (line 118)
  3849. * byte-vector: Bitwise manipulation.
  3850. (line 40)
  3851. * byte-vector-length: Bitwise manipulation.
  3852. (line 42)
  3853. * byte-vector-ref: Bitwise manipulation.
  3854. (line 43)
  3855. * byte-vector-set!: Bitwise manipulation.
  3856. (line 44)
  3857. * byte-vector?: Bitwise manipulation.
  3858. (line 41)
  3859. * call-atomically: Optimistic concurrency.
  3860. (line 56)
  3861. * call-atomically!: Optimistic concurrency.
  3862. (line 57)
  3863. * call-ensuring-atomicity: Optimistic concurrency.
  3864. (line 43)
  3865. * call-ensuring-atomicity!: Optimistic concurrency.
  3866. (line 44)
  3867. * call-error: Condition system. (line 82)
  3868. * call-error?: Condition system. (line 197)
  3869. * call-external: Dynamic loading of C modules.
  3870. (line 114)
  3871. * call-external-value: Calling C functions from Scheme.
  3872. (line 14)
  3873. * call-imported-binding: Calling C functions from Scheme.
  3874. (line 12)
  3875. * call-with-current-input-port: Ports. (line 111)
  3876. * call-with-current-noise-port: Ports. (line 113)
  3877. * call-with-current-output-port: Ports. (line 112)
  3878. * call-with-input-file: Channel ports. (line 10)
  3879. * call-with-output-file: Channel ports. (line 11)
  3880. * call-with-string-output-port: I/O extensions. (line 46)
  3881. * call-with-values: Scheme bindings in Pre-Scheme.
  3882. (line 39)
  3883. * cell-ref: Cells. (line 13)
  3884. * cell-set!: Cells. (line 14)
  3885. * cell?: Cells. (line 12)
  3886. * channel-abort: Channels. (line 59)
  3887. * channel-id: Channels. (line 21)
  3888. * channel-maybe-commit-and-close: Channels. (line 139)
  3889. * channel-maybe-commit-and-read: Channels. (line 118)
  3890. * channel-maybe-commit-and-write: Channels. (line 120)
  3891. * channel-maybe-read: Channels. (line 53)
  3892. * channel-maybe-write: Channels. (line 56)
  3893. * channel-os-index: Channels. (line 23)
  3894. * channel-ready?: Channels. (line 46)
  3895. * channel-status: Channels. (line 22)
  3896. * channel-status-option: Channels. (line 86)
  3897. * channel-write: Channels. (line 149)
  3898. * channel?: Channels. (line 18)
  3899. * channel? <1>: Rendezvous communication channels.
  3900. (line 16)
  3901. * char->ascii: ASCII character encoding.
  3902. (line 8)
  3903. * char-pointer->nul-terminated-string: Low-level Pre-Scheme memory manipulation.
  3904. (line 98)
  3905. * char-pointer->string: Low-level Pre-Scheme memory manipulation.
  3906. (line 97)
  3907. * char-ready?: Ports. (line 31)
  3908. * char-sink->output-port: I/O extensions. (line 30)
  3909. * char-source->input-port: I/O extensions. (line 28)
  3910. * char<?: Scheme bindings in Pre-Scheme.
  3911. (line 37)
  3912. * char=?: Scheme bindings in Pre-Scheme.
  3913. (line 36)
  3914. * check-buffer-timestamp!: Buffered ports & handlers.
  3915. (line 102)
  3916. * choose: Rendezvous base combinators.
  3917. (line 30)
  3918. * close-all-port: POSIX I/O utilities. (line 63)
  3919. * close-channel: Channels. (line 42)
  3920. * close-directory-stream: POSIX file system access.
  3921. (line 13)
  3922. * close-input-port: Ports. (line 26)
  3923. * close-input-port <1>: Input & output in Pre-Scheme.
  3924. (line 16)
  3925. * close-on-exec?: POSIX I/O utilities. (line 66)
  3926. * close-output-port: Ports. (line 27)
  3927. * close-output-port <1>: Input & output in Pre-Scheme.
  3928. (line 17)
  3929. * close-socket: TCP & UDP sockets. (line 10)
  3930. * code-quote: Miscellaneous features.
  3931. (line 93)
  3932. * components: Integer enumerations.
  3933. (line 22)
  3934. * compound-interface: Module configuration language.
  3935. (line 127)
  3936. * concatenate-symbol: Library utilities. (line 111)
  3937. * cond: Scheme bindings in Pre-Scheme.
  3938. (line 17)
  3939. * condition-predicate: Condition system. (line 184)
  3940. * condition-stuff: Condition system. (line 190)
  3941. * condition-type: Condition system. (line 189)
  3942. * condvar-has-value?: Higher-level synchronization.
  3943. (line 44)
  3944. * condvar-value: Higher-level synchronization.
  3945. (line 45)
  3946. * condvar?: Higher-level synchronization.
  3947. (line 24)
  3948. * control: POSIX regular expressions.
  3949. (line 132)
  3950. * copy-array: Library data structures.
  3951. (line 16)
  3952. * copy-memory!: Low-level Pre-Scheme memory manipulation.
  3953. (line 87)
  3954. * count%: Synchronous sequences.
  3955. (line 23)
  3956. * count*: Sequence types. (line 9)
  3957. * current-column: I/O extensions. (line 16)
  3958. * current-error-port: Ports. (line 81)
  3959. * current-input-port: Ports. (line 78)
  3960. * current-input-port <1>: Scheme bindings in Pre-Scheme.
  3961. (line 40)
  3962. * current-noise-port: Miscellaneous features.
  3963. (line 42)
  3964. * current-noise-port <1>: Ports. (line 80)
  3965. * current-output-port: Ports. (line 79)
  3966. * current-output-port <1>: Scheme bindings in Pre-Scheme.
  3967. (line 41)
  3968. * current-proposal: Optimistic concurrency.
  3969. (line 269)
  3970. * current-row: I/O extensions. (line 15)
  3971. * current-thread: Basic thread operations.
  3972. (line 30)
  3973. * current-time: POSIX time. (line 12)
  3974. * d: Inspector. (line 67)
  3975. * deallocate: Compound Pre-Scheme data manipulation.
  3976. (line 43)
  3977. * deallocate-memory: Low-level Pre-Scheme memory manipulation.
  3978. (line 18)
  3979. * debug-message: Miscellaneous features.
  3980. (line 60)
  3981. * def: Module configuration language.
  3982. (line 94)
  3983. * default-buffer-size: Buffered ports & handlers.
  3984. (line 97)
  3985. * default-hash-function: Hash tables. (line 51)
  3986. * define: Scheme bindings in Pre-Scheme.
  3987. (line 10)
  3988. * define <1>: Scheme bindings in Pre-Scheme.
  3989. (line 11)
  3990. * define-condition-type: Condition system. (line 179)
  3991. * define-enum-set-type: Enumerated/finite types and sets.
  3992. (line 95)
  3993. * define-enumerated-type: Enumerated/finite types and sets.
  3994. (line 21)
  3995. * define-enumeration: Integer enumerations.
  3996. (line 14)
  3997. * define-exported-binding: Shared bindings between Scheme and C.
  3998. (line 45)
  3999. * define-exported-binding <1>: Calling C functions from Scheme.
  4000. (line 83)
  4001. * define-finite-type: Enumerated/finite types and sets.
  4002. (line 53)
  4003. * define-generic: Generic dispatch system.
  4004. (line 33)
  4005. * define-imported-binding: Shared bindings between Scheme and C.
  4006. (line 34)
  4007. * define-indentation: Library utilities. (line 49)
  4008. * define-interface: Module configuration language.
  4009. (line 98)
  4010. * define-method: Generic dispatch system.
  4011. (line 43)
  4012. * define-module: Module configuration language.
  4013. (line 92)
  4014. * define-record-discloser: Records. (line 167)
  4015. * define-record-resumer: Records. (line 173)
  4016. * define-record-resumer <1>: Calling C functions from Scheme.
  4017. (line 106)
  4018. * define-record-type: Records. (line 28)
  4019. * define-record-type <1>: Records. (line 85)
  4020. * define-record-type <2>: Pre-Scheme record types.
  4021. (line 10)
  4022. * define-sharp-macro: Reader. (line 18)
  4023. * define-simple-type: Generic dispatch system.
  4024. (line 26)
  4025. * define-structure: Module configuration language.
  4026. (line 82)
  4027. * define-structures: Module configuration language.
  4028. (line 84)
  4029. * define-synchronized-record-type: Optimistic concurrency.
  4030. (line 129)
  4031. * define-syntax: Module configuration language.
  4032. (line 208)
  4033. * define-syntax <1>: Explicit renaming macros.
  4034. (line 24)
  4035. * define-syntax <2>: Scheme bindings in Pre-Scheme.
  4036. (line 23)
  4037. * delete: Library utilities. (line 200)
  4038. * delete-from-queue!: Queues. (line 36)
  4039. * delq: Library utilities. (line 194)
  4040. * delq!: Library utilities. (line 195)
  4041. * dequeue!: Queues. (line 21)
  4042. * dequeue-signal!: POSIX signals. (line 135)
  4043. * destructure: Library utilities. (line 15)
  4044. * directory-stream?: POSIX file system access.
  4045. (line 11)
  4046. * disclose-port: Ports. (line 60)
  4047. * disclose-record: Records. (line 191)
  4048. * display: Writer. (line 20)
  4049. * display-condition: Condition system. (line 217)
  4050. * display-type-name: Writer. (line 35)
  4051. * do: Scheme bindings in Pre-Scheme.
  4052. (line 18)
  4053. * dump: Library utilities. (line 267)
  4054. * dup: POSIX I/O utilities. (line 52)
  4055. * dup-switching-mode: POSIX I/O utilities. (line 53)
  4056. * dup2: POSIX I/O utilities. (line 54)
  4057. * dynamic-load: Dynamic loading of C modules.
  4058. (line 79)
  4059. * either: Library utilities. (line 91)
  4060. * empty-pipe!: Higher-level synchronization.
  4061. (line 96)
  4062. * empty-pipe?: Higher-level synchronization.
  4063. (line 95)
  4064. * empty-queue!: Queues. (line 15)
  4065. * enqueue!: Queues. (line 20)
  4066. * ensure-atomicity: Optimistic concurrency.
  4067. (line 63)
  4068. * ensure-atomicity!: Optimistic concurrency.
  4069. (line 64)
  4070. * enum: Integer enumerations.
  4071. (line 21)
  4072. * enum-case: Integer enumerations.
  4073. (line 46)
  4074. * enum-set->list: Enumerated/finite types and sets.
  4075. (line 117)
  4076. * enum-set-intersection: Enumerated/finite types and sets.
  4077. (line 121)
  4078. * enum-set-member?: Enumerated/finite types and sets.
  4079. (line 118)
  4080. * enum-set-negation: Enumerated/finite types and sets.
  4081. (line 123)
  4082. * enum-set-union: Enumerated/finite types and sets.
  4083. (line 120)
  4084. * enum-set=?: Enumerated/finite types and sets.
  4085. (line 119)
  4086. * enumerand->name: Integer enumerations.
  4087. (line 32)
  4088. * environment-alist: POSIX process environment.
  4089. (line 31)
  4090. * eof-object: Miscellaneous I/O internals.
  4091. (line 34)
  4092. * eq?: Scheme bindings in Pre-Scheme.
  4093. (line 35)
  4094. * error: Condition system. (line 78)
  4095. * error <1>: Library utilities. (line 116)
  4096. * error <2>: Pre-Scheme error handling.
  4097. (line 40)
  4098. * error-string: Pre-Scheme error handling.
  4099. (line 36)
  4100. * error?: Condition system. (line 193)
  4101. * errors: Pre-Scheme error handling.
  4102. (line 10)
  4103. * every: Various utilities. (line 104)
  4104. * every?: Library utilities. (line 162)
  4105. * exact-match?: POSIX regular expressions.
  4106. (line 225)
  4107. * exception-arguments: Condition system. (line 206)
  4108. * exception-opcode: Condition system. (line 204)
  4109. * exception-reason: Condition system. (line 205)
  4110. * exception?: Condition system. (line 203)
  4111. * exec: POSIX processes. (line 44)
  4112. * exec-file: POSIX processes. (line 47)
  4113. * exec-file-with-environment: POSIX processes. (line 48)
  4114. * exec-with-alias: POSIX processes. (line 64)
  4115. * exec-with-environment: POSIX processes. (line 45)
  4116. * exit: POSIX processes. (line 40)
  4117. * export: Module configuration language.
  4118. (line 104)
  4119. * expose: Module configuration language.
  4120. (line 156)
  4121. * expt: Scheme bindings in Pre-Scheme.
  4122. (line 58)
  4123. * external: Pre-Scheme access to C functions and macros.
  4124. (line 6)
  4125. * external-name: Dynamic loading of C modules.
  4126. (line 92)
  4127. * external-value: Dynamic loading of C modules.
  4128. (line 93)
  4129. * external?: Dynamic loading of C modules.
  4130. (line 91)
  4131. * fail: Library utilities. (line 102)
  4132. * fd-port?: POSIX I/O utilities. (line 19)
  4133. * file-info-device: POSIX file system access.
  4134. (line 172)
  4135. * file-info-group: POSIX file system access.
  4136. (line 177)
  4137. * file-info-inode: POSIX file system access.
  4138. (line 173)
  4139. * file-info-last-access: POSIX file system access.
  4140. (line 179)
  4141. * file-info-last-change: POSIX file system access.
  4142. (line 181)
  4143. * file-info-last-modification: POSIX file system access.
  4144. (line 180)
  4145. * file-info-link-count: POSIX file system access.
  4146. (line 174)
  4147. * file-info-mode: POSIX file system access.
  4148. (line 178)
  4149. * file-info-name: POSIX file system access.
  4150. (line 171)
  4151. * file-info-owner: POSIX file system access.
  4152. (line 176)
  4153. * file-info-size: POSIX file system access.
  4154. (line 175)
  4155. * file-info-type: POSIX file system access.
  4156. (line 189)
  4157. * file-info?: POSIX file system access.
  4158. (line 170)
  4159. * file-mode: POSIX file system access.
  4160. (line 213)
  4161. * file-mode+: POSIX file system access.
  4162. (line 244)
  4163. * file-mode-: POSIX file system access.
  4164. (line 245)
  4165. * file-mode->integer: POSIX file system access.
  4166. (line 259)
  4167. * file-mode<=?: POSIX file system access.
  4168. (line 247)
  4169. * file-mode=?: POSIX file system access.
  4170. (line 246)
  4171. * file-mode>=?: POSIX file system access.
  4172. (line 248)
  4173. * file-mode?: POSIX file system access.
  4174. (line 214)
  4175. * file-name-directory: Filenames. (line 19)
  4176. * file-name-nondirectory: Filenames. (line 20)
  4177. * file-options: POSIX file system access.
  4178. (line 51)
  4179. * file-options-on?: POSIX file system access.
  4180. (line 52)
  4181. * file-type: POSIX file system access.
  4182. (line 190)
  4183. * file-type-name: POSIX file system access.
  4184. (line 192)
  4185. * file-type?: POSIX file system access.
  4186. (line 191)
  4187. * files: Module configuration language.
  4188. (line 45)
  4189. * filter: Various utilities. (line 83)
  4190. * filter <1>: Library utilities. (line 168)
  4191. * filter!: Library utilities. (line 169)
  4192. * filter-map: Library utilities. (line 174)
  4193. * find-undefined-imported-bindings: Shared bindings between Scheme and C.
  4194. (line 53)
  4195. * first: Library utilities. (line 153)
  4196. * fl*: Pre-Scheme floating point operation.
  4197. (line 14)
  4198. * fl+: Pre-Scheme floating point operation.
  4199. (line 11)
  4200. * fl-: Pre-Scheme floating point operation.
  4201. (line 12)
  4202. * fl- <1>: Pre-Scheme floating point operation.
  4203. (line 13)
  4204. * fl/: Pre-Scheme floating point operation.
  4205. (line 15)
  4206. * fl<: Pre-Scheme floating point operation.
  4207. (line 17)
  4208. * fl<=: Pre-Scheme floating point operation.
  4209. (line 19)
  4210. * fl=: Pre-Scheme floating point operation.
  4211. (line 16)
  4212. * fl>: Pre-Scheme floating point operation.
  4213. (line 18)
  4214. * fl>=: Pre-Scheme floating point operation.
  4215. (line 20)
  4216. * flonum-ref: Low-level Pre-Scheme memory manipulation.
  4217. (line 30)
  4218. * flonum-set!: Low-level Pre-Scheme memory manipulation.
  4219. (line 31)
  4220. * fluid: Fluid/dynamic bindings.
  4221. (line 27)
  4222. * fluid-cell-ref: Fluid/dynamic bindings.
  4223. (line 29)
  4224. * fluid-cell-set!: Fluid/dynamic bindings.
  4225. (line 30)
  4226. * fold: Various utilities. (line 44)
  4227. * fold->2: Various utilities. (line 66)
  4228. * fold->3: Various utilities. (line 68)
  4229. * for-syntax: Module configuration language.
  4230. (line 41)
  4231. * force-channel-output-ports!: Channel ports. (line 48)
  4232. * force-output: Miscellaneous features.
  4233. (line 36)
  4234. * force-output <1>: Ports. (line 63)
  4235. * force-output <2>: Input & output in Pre-Scheme.
  4236. (line 53)
  4237. * force-output-if-open: Miscellaneous I/O internals.
  4238. (line 38)
  4239. * fork: POSIX processes. (line 10)
  4240. * fork-and-forget: POSIX processes. (line 11)
  4241. * format: Common-Lisp-style formatting.
  4242. (line 13)
  4243. * fresh-line: I/O extensions. (line 20)
  4244. * get-effective-group-id: POSIX process environment.
  4245. (line 18)
  4246. * get-effective-user-id: POSIX process environment.
  4247. (line 15)
  4248. * get-external: Dynamic loading of C modules.
  4249. (line 90)
  4250. * get-file-info: POSIX file system access.
  4251. (line 160)
  4252. * get-file/link-info: POSIX file system access.
  4253. (line 161)
  4254. * get-group-id: POSIX process environment.
  4255. (line 17)
  4256. * get-groups: POSIX process environment.
  4257. (line 24)
  4258. * get-host-name: TCP & UDP sockets. (line 12)
  4259. * get-login-name: POSIX process environment.
  4260. (line 25)
  4261. * get-parent-process-id: POSIX process environment.
  4262. (line 10)
  4263. * get-port-info: POSIX file system access.
  4264. (line 162)
  4265. * get-process-id: POSIX process environment.
  4266. (line 9)
  4267. * get-user-id: POSIX process environment.
  4268. (line 14)
  4269. * gobble-line: Reader. (line 31)
  4270. * goto: Tail call optimization in Pre-Scheme.
  4271. (line 6)
  4272. * graphic: POSIX regular expressions.
  4273. (line 130)
  4274. * group-id->group-info: POSIX users and groups.
  4275. (line 29)
  4276. * group-id->integer: POSIX users and groups.
  4277. (line 18)
  4278. * group-id=?: POSIX users and groups.
  4279. (line 17)
  4280. * group-id?: POSIX users and groups.
  4281. (line 16)
  4282. * group-info-id: POSIX users and groups.
  4283. (line 42)
  4284. * group-info-members: POSIX users and groups.
  4285. (line 43)
  4286. * group-info-name: POSIX users and groups.
  4287. (line 41)
  4288. * group-info?: POSIX users and groups.
  4289. (line 40)
  4290. * guard: Rendezvous base combinators.
  4291. (line 16)
  4292. * hexdigit: POSIX regular expressions.
  4293. (line 137)
  4294. * hide: Module configuration language.
  4295. (line 157)
  4296. * host-name: POSIX host OS and machine identification.
  4297. (line 6)
  4298. * i/o-flags: POSIX I/O utilities. (line 71)
  4299. * identity: Library utilities. (line 133)
  4300. * if: Scheme bindings in Pre-Scheme.
  4301. (line 12)
  4302. * ignore-case: POSIX regular expressions.
  4303. (line 181)
  4304. * ignore-errors: Condition system. (line 153)
  4305. * immutable?: Miscellaneous features.
  4306. (line 9)
  4307. * import-definition: Calling C functions from Scheme.
  4308. (line 34)
  4309. * import-dynamic-externals: Dynamic loading of C modules.
  4310. (line 13)
  4311. * import-lambda-definition: Calling C functions from Scheme.
  4312. (line 35)
  4313. * input%: Synchronous sequences.
  4314. (line 24)
  4315. * input*: Sequence types. (line 10)
  4316. * input-channel+closer->port: Channel ports. (line 35)
  4317. * input-channel->port: Channel ports. (line 30)
  4318. * input-port-option: Ports. (line 86)
  4319. * input-port?: Ports. (line 20)
  4320. * insert: Various utilities. (line 129)
  4321. * integer->address: Low-level Pre-Scheme memory manipulation.
  4322. (line 79)
  4323. * integer->file-mode: POSIX file system access.
  4324. (line 260)
  4325. * integer->group-id: POSIX users and groups.
  4326. (line 19)
  4327. * integer->mask: Boxed bitwise-integer masks.
  4328. (line 42)
  4329. * integer->process-id: POSIX processes. (line 21)
  4330. * integer->signal: POSIX signals. (line 20)
  4331. * integer->user-id: POSIX users and groups.
  4332. (line 15)
  4333. * integrate: Module configuration language.
  4334. (line 52)
  4335. * interrupt?: Condition system. (line 199)
  4336. * intersection: POSIX regular expressions.
  4337. (line 109)
  4338. * invalidate-current-proposal!: Optimistic concurrency.
  4339. (line 279)
  4340. * iterate: Main looping macros. (line 6)
  4341. * jar-put!: Rendezvous-synchronized cells.
  4342. (line 62)
  4343. * jar-take: Rendezvous-synchronized cells.
  4344. (line 53)
  4345. * jar-take-rv: Rendezvous-synchronized cells.
  4346. (line 52)
  4347. * jar?: Rendezvous-synchronized cells.
  4348. (line 46)
  4349. * join: Static type system. (line 87)
  4350. * last: Various utilities. (line 123)
  4351. * let: Module configuration language.
  4352. (line 196)
  4353. * let <1>: Scheme bindings in Pre-Scheme.
  4354. (line 13)
  4355. * let*: Scheme bindings in Pre-Scheme.
  4356. (line 14)
  4357. * let-fluid: Fluid/dynamic bindings.
  4358. (line 44)
  4359. * let-fluids: Fluid/dynamic bindings.
  4360. (line 45)
  4361. * let-syntax: Scheme bindings in Pre-Scheme.
  4362. (line 24)
  4363. * letrec-syntax: Scheme bindings in Pre-Scheme.
  4364. (line 25)
  4365. * limit-output: I/O extensions. (line 56)
  4366. * limited-write: Condition system. (line 234)
  4367. * link: POSIX file system access.
  4368. (line 127)
  4369. * list%: Synchronous sequences.
  4370. (line 20)
  4371. * list*: Sequence types. (line 6)
  4372. * list->mask: Boxed bitwise-integer masks.
  4373. (line 43)
  4374. * list->queue: Queues. (line 42)
  4375. * list-directory: POSIX file system access.
  4376. (line 26)
  4377. * list-interface: Using the module system.
  4378. (line 131)
  4379. * load-dynamic-externals: Dynamic loading of C modules.
  4380. (line 11)
  4381. * lock?: Pessimistic concurrency.
  4382. (line 20)
  4383. * logical-shift-right: Pre-Scheme bitwise manipulation.
  4384. (line 16)
  4385. * lookup-all-externals: Dynamic loading of C modules.
  4386. (line 106)
  4387. * lookup-environment-variable: POSIX process environment.
  4388. (line 30)
  4389. * lookup-exported-binding: Shared bindings between Scheme and C.
  4390. (line 44)
  4391. * lookup-external: Dynamic loading of C modules.
  4392. (line 105)
  4393. * lookup-imported-binding: Shared bindings between Scheme and C.
  4394. (line 33)
  4395. * lookup-imported-binding <1>: Calling C functions from Scheme.
  4396. (line 82)
  4397. * lookup-udp-address: TCP & UDP sockets. (line 64)
  4398. * loophole: Type annotations. (line 9)
  4399. * lower-case: POSIX regular expressions.
  4400. (line 122)
  4401. * lower-case <1>: POSIX regular expressions.
  4402. (line 123)
  4403. * m: Inspector. (line 46)
  4404. * machine-name: POSIX host OS and machine identification.
  4405. (line 10)
  4406. * make-array: Library data structures.
  4407. (line 14)
  4408. * make-async-channel: Rendezvous communication channels.
  4409. (line 61)
  4410. * make-buffered-input-port: Buffered ports & handlers.
  4411. (line 16)
  4412. * make-buffered-input-port-handler: Buffered ports & handlers.
  4413. (line 35)
  4414. * make-buffered-output-port: Buffered ports & handlers.
  4415. (line 18)
  4416. * make-buffered-output-port-handler: Buffered ports & handlers.
  4417. (line 73)
  4418. * make-byte-vector: Bitwise manipulation.
  4419. (line 39)
  4420. * make-cell: Cells. (line 11)
  4421. * make-channel: Rendezvous communication channels.
  4422. (line 15)
  4423. * make-condition: Condition system. (line 67)
  4424. * make-condvar: Higher-level synchronization.
  4425. (line 23)
  4426. * make-directory: POSIX file system access.
  4427. (line 128)
  4428. * make-exception: Condition system. (line 202)
  4429. * make-fifo: POSIX file system access.
  4430. (line 129)
  4431. * make-fluid: Fluid/dynamic bindings.
  4432. (line 24)
  4433. * make-immutable!: Miscellaneous features.
  4434. (line 10)
  4435. * make-input-port-closed!: Miscellaneous I/O internals.
  4436. (line 29)
  4437. * make-integer-table: Hash tables. (line 12)
  4438. * make-jar: Rendezvous-synchronized cells.
  4439. (line 45)
  4440. * make-lock: Pessimistic concurrency.
  4441. (line 19)
  4442. * make-mask-type: Boxed bitwise-integer masks.
  4443. (line 18)
  4444. * make-null-output-port: Ports. (line 66)
  4445. * make-output-port-closed!: Miscellaneous I/O internals.
  4446. (line 30)
  4447. * make-pipe: Higher-level synchronization.
  4448. (line 88)
  4449. * make-placeholder: Higher-level synchronization.
  4450. (line 69)
  4451. * make-placeholder <1>: Rendezvous-synchronized cells.
  4452. (line 16)
  4453. * make-population: Weak references. (line 27)
  4454. * make-port: Port data type. (line 9)
  4455. * make-port-handler: Port handlers. (line 12)
  4456. * make-proposal: Optimistic concurrency.
  4457. (line 268)
  4458. * make-queue: Queues. (line 9)
  4459. * make-record: Records. (line 225)
  4460. * make-record-type: Records. (line 139)
  4461. * make-regexp: POSIX regular expressions.
  4462. (line 21)
  4463. * make-search-tree: Library data structures.
  4464. (line 60)
  4465. * make-shared-array: Library data structures.
  4466. (line 41)
  4467. * make-signal-queue: POSIX signals. (line 131)
  4468. * make-sparse-vector: Library data structures.
  4469. (line 107)
  4470. * make-string: Compound Pre-Scheme data manipulation.
  4471. (line 29)
  4472. * make-string-input-port: I/O extensions. (line 41)
  4473. * make-string-output-port: I/O extensions. (line 44)
  4474. * make-string-table: Hash tables. (line 10)
  4475. * make-symbol-table: Hash tables. (line 11)
  4476. * make-table: Hash tables. (line 9)
  4477. * make-table-immutable!: Hash tables. (line 46)
  4478. * make-table-maker: Hash tables. (line 25)
  4479. * make-time: POSIX time. (line 11)
  4480. * make-tracking-input-port: I/O extensions. (line 10)
  4481. * make-tracking-output-port: I/O extensions. (line 11)
  4482. * make-unbuffered-input-port: Buffered ports & handlers.
  4483. (line 29)
  4484. * make-unbuffered-output-port: Buffered ports & handlers.
  4485. (line 30)
  4486. * make-vector: Compound Pre-Scheme data manipulation.
  4487. (line 12)
  4488. * make-weak-pointer: Weak references. (line 13)
  4489. * mask->integer: Boxed bitwise-integer masks.
  4490. (line 52)
  4491. * mask->list: Boxed bitwise-integer masks.
  4492. (line 53)
  4493. * mask-clear: Boxed bitwise-integer masks.
  4494. (line 60)
  4495. * mask-has-type?: Boxed bitwise-integer masks.
  4496. (line 32)
  4497. * mask-intersection: Boxed bitwise-integer masks.
  4498. (line 67)
  4499. * mask-member?: Boxed bitwise-integer masks.
  4500. (line 58)
  4501. * mask-negate: Boxed bitwise-integer masks.
  4502. (line 69)
  4503. * mask-set: Boxed bitwise-integer masks.
  4504. (line 59)
  4505. * mask-subtract: Boxed bitwise-integer masks.
  4506. (line 68)
  4507. * mask-type: Boxed bitwise-integer masks.
  4508. (line 31)
  4509. * mask-type?: Boxed bitwise-integer masks.
  4510. (line 20)
  4511. * mask-union: Boxed bitwise-integer masks.
  4512. (line 66)
  4513. * mask?: Boxed bitwise-integer masks.
  4514. (line 21)
  4515. * match: POSIX regular expressions.
  4516. (line 226)
  4517. * match-end: POSIX regular expressions.
  4518. (line 62)
  4519. * match-start: POSIX regular expressions.
  4520. (line 61)
  4521. * match-submatches: POSIX regular expressions.
  4522. (line 63)
  4523. * match?: POSIX regular expressions.
  4524. (line 60)
  4525. * max: Scheme bindings in Pre-Scheme.
  4526. (line 54)
  4527. * maybe-commit: Optimistic concurrency.
  4528. (line 278)
  4529. * maybe-commit-and-block: Custom thread synchronization.
  4530. (line 21)
  4531. * maybe-commit-and-block-on-queue: Custom thread synchronization.
  4532. (line 22)
  4533. * maybe-commit-and-make-ready: Custom thread synchronization.
  4534. (line 31)
  4535. * maybe-commit-and-set-condvar!: Higher-level synchronization.
  4536. (line 29)
  4537. * maybe-commit-and-wait-for-condvar: Higher-level synchronization.
  4538. (line 28)
  4539. * maybe-dequeue!: Queues. (line 22)
  4540. * maybe-dequeue-signal!: POSIX signals. (line 136)
  4541. * maybe-dequeue-thread!: Custom thread synchronization.
  4542. (line 39)
  4543. * maybe-obtain-lock: Pessimistic concurrency.
  4544. (line 22)
  4545. * meet: Static type system. (line 88)
  4546. * memory-equal?: Low-level Pre-Scheme memory manipulation.
  4547. (line 91)
  4548. * memq?: Library utilities. (line 149)
  4549. * menu: Inspector. (line 45)
  4550. * min: Scheme bindings in Pre-Scheme.
  4551. (line 53)
  4552. * modify: Module configuration language.
  4553. (line 144)
  4554. * mvlet: Library utilities. (line 232)
  4555. * mvlet*: Library utilities. (line 231)
  4556. * n=: Library utilities. (line 130)
  4557. * name->enumerand: Integer enumerations.
  4558. (line 34)
  4559. * name->group-info: POSIX users and groups.
  4560. (line 30)
  4561. * name->signal: POSIX signals. (line 19)
  4562. * name->user-info: POSIX users and groups.
  4563. (line 28)
  4564. * namestring: Filenames. (line 58)
  4565. * negate: POSIX regular expressions.
  4566. (line 107)
  4567. * neq?: Library utilities. (line 129)
  4568. * never-rv: Rendezvous base combinators.
  4569. (line 8)
  4570. * newline: Ports. (line 55)
  4571. * newline <1>: Input & output in Pre-Scheme.
  4572. (line 42)
  4573. * no-op: Library utilities. (line 134)
  4574. * no-submatches: POSIX regular expressions.
  4575. (line 215)
  4576. * not: Scheme bindings in Pre-Scheme.
  4577. (line 34)
  4578. * note: Condition system. (line 84)
  4579. * note-buffer-reuse!: Buffered ports & handlers.
  4580. (line 101)
  4581. * note?: Condition system. (line 195)
  4582. * null-address: Low-level Pre-Scheme memory manipulation.
  4583. (line 49)
  4584. * null-address?: Low-level Pre-Scheme memory manipulation.
  4585. (line 57)
  4586. * null-list?: Library utilities. (line 139)
  4587. * null-pointer: Compound Pre-Scheme data manipulation.
  4588. (line 48)
  4589. * null-pointer?: Compound Pre-Scheme data manipulation.
  4590. (line 49)
  4591. * numeric: POSIX regular expressions.
  4592. (line 126)
  4593. * obtain-lock: Pessimistic concurrency.
  4594. (line 21)
  4595. * on-queue?: Queues. (line 35)
  4596. * one-of: POSIX regular expressions.
  4597. (line 153)
  4598. * one-value: Library utilities. (line 92)
  4599. * open: Module configuration language.
  4600. (line 23)
  4601. * open-channel: Channels. (line 34)
  4602. * open-channels-list: Channels. (line 82)
  4603. * open-directory-stream: POSIX file system access.
  4604. (line 10)
  4605. * open-file: POSIX file system access.
  4606. (line 37)
  4607. * open-input-file: Channel ports. (line 14)
  4608. * open-input-file <1>: Input & output in Pre-Scheme.
  4609. (line 14)
  4610. * open-input-port-status: Miscellaneous I/O internals.
  4611. (line 24)
  4612. * open-input-port?: Miscellaneous I/O internals.
  4613. (line 19)
  4614. * open-output-file: Channel ports. (line 15)
  4615. * open-output-file <1>: Input & output in Pre-Scheme.
  4616. (line 15)
  4617. * open-output-port-status: Miscellaneous I/O internals.
  4618. (line 25)
  4619. * open-output-port?: Miscellaneous I/O internals.
  4620. (line 20)
  4621. * open-pipe: POSIX I/O utilities. (line 9)
  4622. * open-socket: TCP & UDP sockets. (line 29)
  4623. * open-udp-socket: TCP & UDP sockets. (line 49)
  4624. * optimize: Module configuration language.
  4625. (line 51)
  4626. * or: Scheme bindings in Pre-Scheme.
  4627. (line 16)
  4628. * os-node-name: POSIX host OS and machine identification.
  4629. (line 7)
  4630. * os-release-name: POSIX host OS and machine identification.
  4631. (line 8)
  4632. * os-version-name: POSIX host OS and machine identification.
  4633. (line 9)
  4634. * output-channel+closer->port: Channel ports. (line 37)
  4635. * output-channel->port: Channel ports. (line 31)
  4636. * output-port-option: Ports. (line 87)
  4637. * output-port-ready?: Ports. (line 32)
  4638. * output-port?: Ports. (line 21)
  4639. * p: Library utilities. (line 31)
  4640. * partition-list: Library utilities. (line 186)
  4641. * partition-list!: Library utilities. (line 187)
  4642. * peek-char: Input & output in Pre-Scheme.
  4643. (line 26)
  4644. * periodically-flushed-ports: Miscellaneous I/O internals.
  4645. (line 43)
  4646. * periodically-force-output!: Miscellaneous I/O internals.
  4647. (line 42)
  4648. * pipe-maybe-read!: Higher-level synchronization.
  4649. (line 101)
  4650. * pipe-maybe-read?!: Higher-level synchronization.
  4651. (line 102)
  4652. * pipe-maybe-write!: Higher-level synchronization.
  4653. (line 114)
  4654. * pipe-push!: Higher-level synchronization.
  4655. (line 113)
  4656. * pipe-read!: Higher-level synchronization.
  4657. (line 100)
  4658. * pipe-write!: Higher-level synchronization.
  4659. (line 112)
  4660. * pipe?: Higher-level synchronization.
  4661. (line 89)
  4662. * placeholder-set!: Higher-level synchronization.
  4663. (line 75)
  4664. * placeholder-set! <1>: Rendezvous-synchronized cells.
  4665. (line 31)
  4666. * placeholder-value: Higher-level synchronization.
  4667. (line 74)
  4668. * placeholder-value <1>: Rendezvous-synchronized cells.
  4669. (line 24)
  4670. * placeholder-value-rv: Rendezvous-synchronized cells.
  4671. (line 23)
  4672. * placeholder?: Higher-level synchronization.
  4673. (line 70)
  4674. * placeholder? <1>: Rendezvous-synchronized cells.
  4675. (line 17)
  4676. * pop-search-tree-max!: Library data structures.
  4677. (line 87)
  4678. * pop-search-tree-min!: Library data structures.
  4679. (line 88)
  4680. * population->list: Weak references. (line 29)
  4681. * port->channel: Channel ports. (line 43)
  4682. * port->fd: POSIX I/O utilities. (line 20)
  4683. * port-buffer: Port data type. (line 17)
  4684. * port-data: Port data type. (line 20)
  4685. * port-handler: Port data type. (line 16)
  4686. * port-index: Port data type. (line 21)
  4687. * port-is-a-terminal?: POSIX I/O utilities. (line 78)
  4688. * port-limit: Port data type. (line 22)
  4689. * port-lock: Port data type. (line 18)
  4690. * port-pending-eof?: Port data type. (line 23)
  4691. * port-status: Port data type. (line 19)
  4692. * port-status-options: Miscellaneous I/O internals.
  4693. (line 11)
  4694. * port-terminal-name: POSIX I/O utilities. (line 79)
  4695. * position: Various utilities. (line 91)
  4696. * posq: Various utilities. (line 89)
  4697. * posv: Various utilities. (line 90)
  4698. * prefix: Module configuration language.
  4699. (line 155)
  4700. * prescheme-compiler: Invoking the Pre-Scheme compiler.
  4701. (line 44)
  4702. * pretty-print: Library utilities. (line 32)
  4703. * printing: POSIX regular expressions.
  4704. (line 131)
  4705. * proc: Static type system. (line 143)
  4706. * proc <1>: Static type system. (line 242)
  4707. * procedure: Static type system. (line 142)
  4708. * procedure <1>: Static type system. (line 241)
  4709. * process-id->integer: POSIX processes. (line 20)
  4710. * process-id-exit-status: POSIX processes. (line 27)
  4711. * process-id-terminating-signal: POSIX processes. (line 28)
  4712. * process-id=?: POSIX processes. (line 19)
  4713. * process-id?: POSIX processes. (line 18)
  4714. * provisional-byte-vector-ref: Optimistic concurrency.
  4715. (line 112)
  4716. * provisional-byte-vector-set!: Optimistic concurrency.
  4717. (line 113)
  4718. * provisional-car: Optimistic concurrency.
  4719. (line 100)
  4720. * provisional-cdr: Optimistic concurrency.
  4721. (line 101)
  4722. * provisional-cell-ref: Optimistic concurrency.
  4723. (line 104)
  4724. * provisional-cell-set!: Optimistic concurrency.
  4725. (line 105)
  4726. * provisional-port-data: Port data type. (line 86)
  4727. * provisional-port-handler: Port data type. (line 83)
  4728. * provisional-port-index: Port data type. (line 87)
  4729. * provisional-port-limit: Port data type. (line 88)
  4730. * provisional-port-lock: Port data type. (line 84)
  4731. * provisional-port-pending-eof?: Port data type. (line 89)
  4732. * provisional-port-status: Port data type. (line 85)
  4733. * provisional-set-car!: Optimistic concurrency.
  4734. (line 102)
  4735. * provisional-set-cdr!: Optimistic concurrency.
  4736. (line 103)
  4737. * provisional-set-port-data!: Port data type. (line 92)
  4738. * provisional-set-port-index!: Port data type. (line 93)
  4739. * provisional-set-port-limit!: Port data type. (line 94)
  4740. * provisional-set-port-lock!: Port data type. (line 90)
  4741. * provisional-set-port-pending-eof?!: Port data type. (line 95)
  4742. * provisional-set-port-status!: Port data type. (line 91)
  4743. * provisional-string-ref: Optimistic concurrency.
  4744. (line 109)
  4745. * provisional-string-set!: Optimistic concurrency.
  4746. (line 110)
  4747. * provisional-vector-ref: Optimistic concurrency.
  4748. (line 106)
  4749. * provisional-vector-set!: Optimistic concurrency.
  4750. (line 107)
  4751. * punctuation: POSIX regular expressions.
  4752. (line 128)
  4753. * q: Inspector. (line 55)
  4754. * queue->list: Queues. (line 41)
  4755. * queue-empty?: Queues. (line 14)
  4756. * queue-head: Queues. (line 23)
  4757. * queue-length: Queues. (line 32)
  4758. * queue?: Queues. (line 10)
  4759. * quotient: Scheme bindings in Pre-Scheme.
  4760. (line 56)
  4761. * range: POSIX regular expressions.
  4762. (line 92)
  4763. * ranges: POSIX regular expressions.
  4764. (line 93)
  4765. * read: Reader. (line 11)
  4766. * read-block: Ports. (line 39)
  4767. * read-block <1>: Low-level Pre-Scheme memory manipulation.
  4768. (line 106)
  4769. * read-char: Input & output in Pre-Scheme.
  4770. (line 25)
  4771. * read-directory-stream: POSIX file system access.
  4772. (line 12)
  4773. * read-error?: Condition system. (line 198)
  4774. * read-integer: Input & output in Pre-Scheme.
  4775. (line 27)
  4776. * reading-error: Reader. (line 27)
  4777. * real-time: Library utilities. (line 286)
  4778. * receive: Module configuration language.
  4779. (line 197)
  4780. * receive <1>: Rendezvous communication channels.
  4781. (line 33)
  4782. * receive <2>: Library utilities. (line 216)
  4783. * receive <3>: Multiple return values in Pre-Scheme.
  4784. (line 16)
  4785. * receive-async: Rendezvous communication channels.
  4786. (line 68)
  4787. * receive-async-rv: Rendezvous communication channels.
  4788. (line 67)
  4789. * receive-rv: Rendezvous communication channels.
  4790. (line 32)
  4791. * record: Records. (line 226)
  4792. * record-accessor: Records. (line 153)
  4793. * record-constructor: Records. (line 150)
  4794. * record-length: Records. (line 228)
  4795. * record-modifier: Records. (line 155)
  4796. * record-predicate: Records. (line 152)
  4797. * record-ref: Records. (line 229)
  4798. * record-set!: Records. (line 230)
  4799. * record-space: Resource statistics and control.
  4800. (line 65)
  4801. * record-type: Records. (line 233)
  4802. * record-type-field-names: Records. (line 147)
  4803. * record-type-name: Records. (line 146)
  4804. * record-type?: Records. (line 141)
  4805. * record?: Records. (line 227)
  4806. * recurring-write: Writer. (line 26)
  4807. * reduce: Various utilities. (line 21)
  4808. * reduce <1>: Main looping macros. (line 57)
  4809. * regexp-match: POSIX regular expressions.
  4810. (line 44)
  4811. * regexp-option: POSIX regular expressions.
  4812. (line 31)
  4813. * regexp?: POSIX regular expressions.
  4814. (line 22)
  4815. * release-lock: Pessimistic concurrency.
  4816. (line 23)
  4817. * relinquish-timeslice: Basic thread operations.
  4818. (line 16)
  4819. * reload-dynamic-externals: Dynamic loading of C modules.
  4820. (line 35)
  4821. * remainder: Scheme bindings in Pre-Scheme.
  4822. (line 57)
  4823. * remap-file-descriptors!: POSIX I/O utilities. (line 31)
  4824. * remove-current-proposal!: Optimistic concurrency.
  4825. (line 271)
  4826. * remove-directory: POSIX file system access.
  4827. (line 137)
  4828. * remove-duplicates: Library utilities. (line 180)
  4829. * remove-signal-queue-signal!: POSIX signals. (line 160)
  4830. * rename: Module configuration language.
  4831. (line 159)
  4832. * rename <1>: POSIX file system access.
  4833. (line 138)
  4834. * repeat: POSIX regular expressions.
  4835. (line 162)
  4836. * repeat <1>: POSIX regular expressions.
  4837. (line 163)
  4838. * repeat <2>: POSIX regular expressions.
  4839. (line 164)
  4840. * report-errors-as-warnings: Condition system. (line 154)
  4841. * restore: Library utilities. (line 275)
  4842. * reverse!: Library utilities. (line 144)
  4843. * reverse-list->string: Miscellaneous features.
  4844. (line 50)
  4845. * run-scheme: Emacs integration. (line 62)
  4846. * run-time: Library utilities. (line 294)
  4847. * S48_BYTE_VECTOR_LENGTH: Accessing Scheme data from C.
  4848. (line 127)
  4849. * S48_BYTE_VECTOR_P: Accessing Scheme data from C.
  4850. (line 106)
  4851. * S48_BYTE_VECTOR_REF: Accessing Scheme data from C.
  4852. (line 128)
  4853. * S48_BYTE_VECTOR_SET: Accessing Scheme data from C.
  4854. (line 129)
  4855. * s48_call_scheme: Calling Scheme procedures from C.
  4856. (line 6)
  4857. * S48_CAR: Accessing Scheme data from C.
  4858. (line 107)
  4859. * S48_CDR: Accessing Scheme data from C.
  4860. (line 108)
  4861. * S48_CHAR_P: Accessing Scheme data from C.
  4862. (line 101)
  4863. * S48_CHECK_BOOLEAN: Raising exceptions from C.
  4864. (line 37)
  4865. * S48_CHECK_BYTE_VECTOR: Raising exceptions from C.
  4866. (line 43)
  4867. * S48_CHECK_CHANNEL: Raising exceptions from C.
  4868. (line 42)
  4869. * S48_CHECK_INTEGER: Raising exceptions from C.
  4870. (line 41)
  4871. * S48_CHECK_PAIR: Raising exceptions from C.
  4872. (line 39)
  4873. * S48_CHECK_RECORD: Raising exceptions from C.
  4874. (line 44)
  4875. * s48_check_record_type: Using Scheme records in C.
  4876. (line 19)
  4877. * S48_CHECK_SHARED_BINDING: Raising exceptions from C.
  4878. (line 45)
  4879. * S48_CHECK_STRING: Raising exceptions from C.
  4880. (line 40)
  4881. * S48_CHECK_SYMBOL: Raising exceptions from C.
  4882. (line 38)
  4883. * s48_cons: Accessing Scheme data from C.
  4884. (line 111)
  4885. * S48_DECLARE_GC_PROTECT: Interacting with the Scheme heap in C.
  4886. (line 16)
  4887. * s48_define_exported_binding: Shared bindings between Scheme and C.
  4888. (line 89)
  4889. * S48_ENTER_BOOLEAN: Accessing Scheme data from C.
  4890. (line 37)
  4891. * s48_enter_byte_vector: Accessing Scheme data from C.
  4892. (line 40)
  4893. * s48_enter_char: Accessing Scheme data from C.
  4894. (line 38)
  4895. * s48_enter_double: Accessing Scheme data from C.
  4896. (line 43)
  4897. * s48_enter_fixnum: Accessing Scheme data from C.
  4898. (line 88)
  4899. * s48_enter_integer: Accessing Scheme data from C.
  4900. (line 42)
  4901. * s48_enter_string: Accessing Scheme data from C.
  4902. (line 39)
  4903. * S48_EOF: Accessing Scheme data from C.
  4904. (line 17)
  4905. * S48_EQ_P: Accessing Scheme data from C.
  4906. (line 100)
  4907. * S48_EXPORT_FUNCTION: Shared bindings between Scheme and C.
  4908. (line 94)
  4909. * S48_EXTRACT_BOOLEAN: Accessing Scheme data from C.
  4910. (line 31)
  4911. * s48_extract_byte_vector: Accessing Scheme data from C.
  4912. (line 34)
  4913. * s48_extract_char: Accessing Scheme data from C.
  4914. (line 32)
  4915. * s48_extract_double: Accessing Scheme data from C.
  4916. (line 36)
  4917. * s48_extract_fixnum: Accessing Scheme data from C.
  4918. (line 87)
  4919. * s48_extract_integer: Accessing Scheme data from C.
  4920. (line 35)
  4921. * s48_extract_string: Accessing Scheme data from C.
  4922. (line 33)
  4923. * S48_EXTRACT_VALUE: Interacting with the Scheme heap in C.
  4924. (line 51)
  4925. * S48_EXTRACT_VALUE_POINTER: Interacting with the Scheme heap in C.
  4926. (line 52)
  4927. * S48_FALSE: Accessing Scheme data from C.
  4928. (line 13)
  4929. * S48_FALSE_P: Accessing Scheme data from C.
  4930. (line 81)
  4931. * S48_FIXNUM_P: Accessing Scheme data from C.
  4932. (line 86)
  4933. * S48_GC_PROTECT_GLOBAL: Interacting with the Scheme heap in C.
  4934. (line 36)
  4935. * S48_GC_PROTECT_N: Interacting with the Scheme heap in C.
  4936. (line 17)
  4937. * S48_GC_UNPROTECT: Interacting with the Scheme heap in C.
  4938. (line 19)
  4939. * S48_GC_UNPROTECT_GLOBAL: Interacting with the Scheme heap in C.
  4940. (line 37)
  4941. * s48_get_imported_binding: Shared bindings between Scheme and C.
  4942. (line 85)
  4943. * s48_length: Accessing Scheme data from C.
  4944. (line 113)
  4945. * s48_make_byte_vector: Accessing Scheme data from C.
  4946. (line 131)
  4947. * s48_make_record: Using Scheme records in C.
  4948. (line 12)
  4949. * s48_make_string: Accessing Scheme data from C.
  4950. (line 124)
  4951. * S48_MAKE_VALUE: Interacting with the Scheme heap in C.
  4952. (line 50)
  4953. * s48_make_vector: Accessing Scheme data from C.
  4954. (line 118)
  4955. * S48_MAX_FIXNUM_VALUE: Accessing Scheme data from C.
  4956. (line 18)
  4957. * S48_MIN_FIXNUM_VALUE: Accessing Scheme data from C.
  4958. (line 19)
  4959. * S48_NULL: Accessing Scheme data from C.
  4960. (line 15)
  4961. * s48_on_load: Dynamic loading of C modules.
  4962. (line 43)
  4963. * s48_on_reload: Dynamic loading of C modules.
  4964. (line 44)
  4965. * S48_PAIR_P: Accessing Scheme data from C.
  4966. (line 102)
  4967. * s48_raise_argument_number_error: Raising exceptions from C.
  4968. (line 20)
  4969. * s48_raise_argument_type_error: Raising exceptions from C.
  4970. (line 19)
  4971. * s48_raise_closed_channel_error: Raising exceptions from C.
  4972. (line 24)
  4973. * s48_raise_os_error: Raising exceptions from C.
  4974. (line 25)
  4975. * s48_raise_out_of_memory_error: Raising exceptions from C.
  4976. (line 26)
  4977. * s48_raise_range_error: Raising exceptions from C.
  4978. (line 22)
  4979. * s48_raise_scheme_exception: Raising exceptions from C.
  4980. (line 11)
  4981. * S48_RECORD_P: Using Scheme records in C.
  4982. (line 14)
  4983. * S48_RECORD_REF: Using Scheme records in C.
  4984. (line 16)
  4985. * S48_RECORD_SET: Using Scheme records in C.
  4986. (line 17)
  4987. * S48_RECORD_TYPE: Using Scheme records in C.
  4988. (line 15)
  4989. * S48_SET_CAR: Accessing Scheme data from C.
  4990. (line 109)
  4991. * S48_SET_CDR: Accessing Scheme data from C.
  4992. (line 110)
  4993. * S48_SET_VALUE: Interacting with the Scheme heap in C.
  4994. (line 53)
  4995. * S48_SHARED_BINDING_CHECK: Shared bindings between Scheme and C.
  4996. (line 74)
  4997. * S48_SHARED_BINDING_IS_IMPORTP: Shared bindings between Scheme and C.
  4998. (line 65)
  4999. * S48_SHARED_BINDING_NAME: Shared bindings between Scheme and C.
  5000. (line 63)
  5001. * S48_SHARED_BINDING_P: Shared bindings between Scheme and C.
  5002. (line 62)
  5003. * S48_SHARED_BINDING_REF: Shared bindings between Scheme and C.
  5004. (line 67)
  5005. * S48_SHARED_BINDING_SET: Shared bindings between Scheme and C.
  5006. (line 68)
  5007. * S48_STRING_LENGTH: Accessing Scheme data from C.
  5008. (line 120)
  5009. * S48_STRING_P: Accessing Scheme data from C.
  5010. (line 104)
  5011. * S48_STRING_REF: Accessing Scheme data from C.
  5012. (line 121)
  5013. * S48_STRING_SET: Accessing Scheme data from C.
  5014. (line 122)
  5015. * S48_SYMBOL_P: Accessing Scheme data from C.
  5016. (line 105)
  5017. * S48_SYMBOL_TO_STRING: Accessing Scheme data from C.
  5018. (line 126)
  5019. * S48_TRUE: Accessing Scheme data from C.
  5020. (line 14)
  5021. * S48_TRUE_P: Accessing Scheme data from C.
  5022. (line 80)
  5023. * S48_UNSAFE_BYTE_VECTOR_LENGTH: Unsafe C macros. (line 38)
  5024. * S48_UNSAFE_BYTE_VECTOR_REF: Unsafe C macros. (line 39)
  5025. * S48_UNSAFE_BYTE_VECTOR_SET: Unsafe C macros. (line 41)
  5026. * S48_UNSAFE_CAR: Unsafe C macros. (line 20)
  5027. * S48_UNSAFE_CDR: Unsafe C macros. (line 21)
  5028. * S48_UNSAFE_ENTER_FIXNUM: Unsafe C macros. (line 18)
  5029. * S48_UNSAFE_EXTRACT_CHAR: Unsafe C macros. (line 13)
  5030. * S48_UNSAFE_EXTRACT_DOUBLE: Unsafe C macros. (line 16)
  5031. * S48_UNSAFE_EXTRACT_FIXNUM: Unsafe C macros. (line 17)
  5032. * S48_UNSAFE_EXTRACT_INTEGER: Unsafe C macros. (line 15)
  5033. * S48_UNSAFE_EXTRACT_STRING: Unsafe C macros. (line 14)
  5034. * S48_UNSAFE_EXTRACT_VALUE: Unsafe C macros. (line 53)
  5035. * S48_UNSAFE_EXTRACT_VALUE_POINTER: Unsafe C macros. (line 54)
  5036. * S48_UNSAFE_SET_CAR: Unsafe C macros. (line 22)
  5037. * S48_UNSAFE_SET_CDR: Unsafe C macros. (line 23)
  5038. * S48_UNSAFE_SET_VALUE: Unsafe C macros. (line 56)
  5039. * S48_UNSAFE_SHARED_BINDING_IS_IMPORTP: Unsafe C macros. (line 46)
  5040. * S48_UNSAFE_SHARED_BINDING_NAME: Unsafe C macros. (line 48)
  5041. * S48_UNSAFE_SHARED_BINDING_REF: Unsafe C macros. (line 44)
  5042. * S48_UNSAFE_SHARED_BINDING_SET: Unsafe C macros. (line 50)
  5043. * S48_UNSAFE_STRING_LENGTH: Unsafe C macros. (line 31)
  5044. * S48_UNSAFE_STRING_REF: Unsafe C macros. (line 32)
  5045. * S48_UNSAFE_STRING_SET: Unsafe C macros. (line 33)
  5046. * S48_UNSAFE_SYMBOL_TO_STRING: Unsafe C macros. (line 36)
  5047. * S48_UNSAFE_VECTOR_LENGTH: Unsafe C macros. (line 25)
  5048. * S48_UNSAFE_VECTOR_REF: Unsafe C macros. (line 26)
  5049. * S48_UNSAFE_VECTOR_SET: Unsafe C macros. (line 28)
  5050. * S48_UNSPECIFIC: Accessing Scheme data from C.
  5051. (line 16)
  5052. * s48_value: Accessing Scheme data from C.
  5053. (line 6)
  5054. * S48_VECTOR_LENGTH: Accessing Scheme data from C.
  5055. (line 114)
  5056. * S48_VECTOR_P: Accessing Scheme data from C.
  5057. (line 103)
  5058. * S48_VECTOR_REF: Accessing Scheme data from C.
  5059. (line 115)
  5060. * S48_VECTOR_SET: Accessing Scheme data from C.
  5061. (line 116)
  5062. * scheme-program-name: Emacs integration. (line 68)
  5063. * search-tree-max: Library data structures.
  5064. (line 85)
  5065. * search-tree-min: Library data structures.
  5066. (line 86)
  5067. * search-tree-modify!: Library data structures.
  5068. (line 68)
  5069. * search-tree-ref: Library data structures.
  5070. (line 66)
  5071. * search-tree-set!: Library data structures.
  5072. (line 67)
  5073. * search-tree?: Library data structures.
  5074. (line 61)
  5075. * select: Rendezvous base combinators.
  5076. (line 50)
  5077. * send: Rendezvous communication channels.
  5078. (line 21)
  5079. * send-async: Rendezvous communication channels.
  5080. (line 77)
  5081. * send-rv: Rendezvous communication channels.
  5082. (line 20)
  5083. * sequence: POSIX regular expressions.
  5084. (line 152)
  5085. * set: POSIX regular expressions.
  5086. (line 91)
  5087. * set-close-on-exec?!: POSIX I/O utilities. (line 67)
  5088. * set-condvar-has-value?!: Higher-level synchronization.
  5089. (line 50)
  5090. * set-condvar-value!: Higher-level synchronization.
  5091. (line 51)
  5092. * set-current-proposal!: Optimistic concurrency.
  5093. (line 270)
  5094. * set-file-creation-mask!: POSIX file system access.
  5095. (line 122)
  5096. * set-fluid!: Fluid/dynamic bindings.
  5097. (line 28)
  5098. * set-group-id!: POSIX process environment.
  5099. (line 19)
  5100. * set-i/o-flags!: POSIX I/O utilities. (line 72)
  5101. * set-leaf-predicate!: Resource statistics and control.
  5102. (line 108)
  5103. * set-port-data!: Port data type. (line 76)
  5104. * set-port-index!: Port data type. (line 77)
  5105. * set-port-limit!: Port data type. (line 78)
  5106. * set-port-lock!: Port data type. (line 74)
  5107. * set-port-pending-eof?!: Port data type. (line 79)
  5108. * set-port-status!: Port data type. (line 75)
  5109. * set-translation!: Filenames. (line 93)
  5110. * set-user-id!: POSIX process environment.
  5111. (line 16)
  5112. * set-working-directory!: POSIX file system access.
  5113. (line 33)
  5114. * shared-binding-is-import?: Shared bindings between Scheme and C.
  5115. (line 20)
  5116. * shared-binding-ref: Shared bindings between Scheme and C.
  5117. (line 27)
  5118. * shared-binding-ref <1>: Calling C functions from Scheme.
  5119. (line 85)
  5120. * shared-binding-set!: Shared bindings between Scheme and C.
  5121. (line 28)
  5122. * shared-binding?: Shared bindings between Scheme and C.
  5123. (line 19)
  5124. * shift-left: Pre-Scheme bitwise manipulation.
  5125. (line 14)
  5126. * signal: Condition system. (line 71)
  5127. * signal <1>: POSIX signals. (line 18)
  5128. * signal-condition: Condition system. (line 70)
  5129. * signal-name: POSIX signals. (line 22)
  5130. * signal-os-number: POSIX signals. (line 23)
  5131. * signal-process: POSIX signals. (line 121)
  5132. * signal-queue-monitored-signals: POSIX signals. (line 133)
  5133. * signal-queue?: POSIX signals. (line 132)
  5134. * signal=?: POSIX signals. (line 24)
  5135. * signal?: POSIX signals. (line 21)
  5136. * silently: Ports. (line 96)
  5137. * singleton: Generic dispatch system.
  5138. (line 30)
  5139. * sleep: Basic thread operations.
  5140. (line 17)
  5141. * socket-accept: TCP & UDP sockets. (line 30)
  5142. * socket-client: TCP & UDP sockets. (line 37)
  5143. * socket-port-number: TCP & UDP sockets. (line 11)
  5144. * some-values: Static type system. (line 120)
  5145. * space: Resource statistics and control.
  5146. (line 63)
  5147. * sparse-vector->list: Library data structures.
  5148. (line 119)
  5149. * sparse-vector-ref: Library data structures.
  5150. (line 110)
  5151. * sparse-vector-set!: Library data structures.
  5152. (line 111)
  5153. * spawn: Basic thread operations.
  5154. (line 8)
  5155. * stream%: Synchronous sequences.
  5156. (line 25)
  5157. * stream*: Sequence types. (line 11)
  5158. * string%: Synchronous sequences.
  5159. (line 22)
  5160. * string*: Sequence types. (line 8)
  5161. * string->immutable-string: Library utilities. (line 205)
  5162. * string-end: POSIX regular expressions.
  5163. (line 144)
  5164. * string-hash: Miscellaneous features.
  5165. (line 31)
  5166. * string-hash <1>: Hash tables. (line 52)
  5167. * string-length: Compound Pre-Scheme data manipulation.
  5168. (line 30)
  5169. * string-output-port-output: I/O extensions. (line 45)
  5170. * string-ref: Compound Pre-Scheme data manipulation.
  5171. (line 31)
  5172. * string-set!: Compound Pre-Scheme data manipulation.
  5173. (line 32)
  5174. * string-start: POSIX regular expressions.
  5175. (line 143)
  5176. * strongly-connected-components: Library utilities. (line 67)
  5177. * structure: Module configuration language.
  5178. (line 135)
  5179. * structure-ref: Module configuration language.
  5180. (line 23)
  5181. * structures: Module configuration language.
  5182. (line 136)
  5183. * sublist: Various utilities. (line 117)
  5184. * submatch: POSIX regular expressions.
  5185. (line 214)
  5186. * subset: Module configuration language.
  5187. (line 142)
  5188. * subtract: POSIX regular expressions.
  5189. (line 111)
  5190. * sync: Rendezvous base combinators.
  5191. (line 49)
  5192. * syntax-error: Condition system. (line 80)
  5193. * syntax-error?: Condition system. (line 196)
  5194. * table-ref: Hash tables. (line 33)
  5195. * table-set!: Hash tables. (line 34)
  5196. * table-walk: Hash tables. (line 42)
  5197. * table?: Hash tables. (line 30)
  5198. * template: Inspector. (line 58)
  5199. * terminate-current-thread: Basic thread operations.
  5200. (line 23)
  5201. * text: POSIX regular expressions.
  5202. (line 158)
  5203. * thread-name: Basic thread operations.
  5204. (line 32)
  5205. * thread-queue-empty?: Custom thread synchronization.
  5206. (line 41)
  5207. * thread-uid: Basic thread operations.
  5208. (line 33)
  5209. * thread?: Basic thread operations.
  5210. (line 31)
  5211. * time->string: POSIX time. (line 33)
  5212. * time-seconds: POSIX time. (line 14)
  5213. * time<=?: POSIX time. (line 23)
  5214. * time<?: POSIX time. (line 22)
  5215. * time=?: POSIX time. (line 21)
  5216. * time>=?: POSIX time. (line 25)
  5217. * time>?: POSIX time. (line 24)
  5218. * time?: POSIX time. (line 13)
  5219. * trail: Resource statistics and control.
  5220. (line 103)
  5221. * translate: Filenames. (line 97)
  5222. * translations: Filenames. (line 90)
  5223. * traverse-breadth-first: Resource statistics and control.
  5224. (line 86)
  5225. * traverse-depth-first: Resource statistics and control.
  5226. (line 87)
  5227. * u: Inspector. (line 51)
  5228. * udp-address-address: TCP & UDP sockets. (line 66)
  5229. * udp-address-hostname: TCP & UDP sockets. (line 68)
  5230. * udp-address-port: TCP & UDP sockets. (line 67)
  5231. * udp-address?: TCP & UDP sockets. (line 65)
  5232. * udp-receive: TCP & UDP sockets. (line 55)
  5233. * udp-send: TCP & UDP sockets. (line 54)
  5234. * undefine-exported-binding: Shared bindings between Scheme and C.
  5235. (line 46)
  5236. * undefine-imported-binding: Shared bindings between Scheme and C.
  5237. (line 35)
  5238. * union: POSIX regular expressions.
  5239. (line 108)
  5240. * unlink: POSIX file system access.
  5241. (line 136)
  5242. * unload-dynamic-externals: Dynamic loading of C modules.
  5243. (line 14)
  5244. * unsigned-byte-ref: Low-level Pre-Scheme memory manipulation.
  5245. (line 26)
  5246. * unsigned-byte-set!: Low-level Pre-Scheme memory manipulation.
  5247. (line 27)
  5248. * unspecific: Various utilities. (line 12)
  5249. * upper-case: POSIX regular expressions.
  5250. (line 124)
  5251. * use-case: POSIX regular expressions.
  5252. (line 182)
  5253. * user-id->integer: POSIX users and groups.
  5254. (line 14)
  5255. * user-id->user-info: POSIX users and groups.
  5256. (line 27)
  5257. * user-id=?: POSIX users and groups.
  5258. (line 13)
  5259. * user-id?: POSIX users and groups.
  5260. (line 12)
  5261. * user-info-group: POSIX users and groups.
  5262. (line 37)
  5263. * user-info-home-directory: POSIX users and groups.
  5264. (line 38)
  5265. * user-info-id: POSIX users and groups.
  5266. (line 36)
  5267. * user-info-name: POSIX users and groups.
  5268. (line 35)
  5269. * user-info-shell: POSIX users and groups.
  5270. (line 39)
  5271. * user-info?: POSIX users and groups.
  5272. (line 34)
  5273. * usual-leaf-predicate: Resource statistics and control.
  5274. (line 109)
  5275. * usual-resumer: Suspending and resuming heap images.
  5276. (line 53)
  5277. * values: Module configuration language.
  5278. (line 198)
  5279. * values <1>: Scheme bindings in Pre-Scheme.
  5280. (line 38)
  5281. * variable: Static type system. (line 190)
  5282. * vector%: Synchronous sequences.
  5283. (line 21)
  5284. * vector*: Sequence types. (line 7)
  5285. * vector-length: Compound Pre-Scheme data manipulation.
  5286. (line 13)
  5287. * vector-ref: Compound Pre-Scheme data manipulation.
  5288. (line 14)
  5289. * vector-set!: Compound Pre-Scheme data manipulation.
  5290. (line 15)
  5291. * vector-space: Resource statistics and control.
  5292. (line 64)
  5293. * wait-for-channel: Channels. (line 157)
  5294. * wait-for-child-process: POSIX processes. (line 29)
  5295. * walk-population: Weak references. (line 30)
  5296. * walk-search-tree: Library data structures.
  5297. (line 96)
  5298. * warn: Condition system. (line 79)
  5299. * warning?: Condition system. (line 194)
  5300. * weak-pointer-ref: Weak references. (line 15)
  5301. * weak-pointer?: Weak references. (line 14)
  5302. * whitespace: POSIX regular expressions.
  5303. (line 135)
  5304. * with-current-ports: Ports. (line 101)
  5305. * with-handler: Condition system. (line 127)
  5306. * with-input-from-file: Channel ports. (line 12)
  5307. * with-nack: Rendezvous base combinators.
  5308. (line 17)
  5309. * with-new-proposal: Optimistic concurrency.
  5310. (line 288)
  5311. * with-nondeterminism: Library utilities. (line 87)
  5312. * with-output-to-file: Channel ports. (line 13)
  5313. * with-prefix: Module configuration language.
  5314. (line 143)
  5315. * word-ref: Low-level Pre-Scheme memory manipulation.
  5316. (line 28)
  5317. * word-set!: Low-level Pre-Scheme memory manipulation.
  5318. (line 29)
  5319. * working-directory: POSIX file system access.
  5320. (line 32)
  5321. * wrap: Rendezvous base combinators.
  5322. (line 38)
  5323. * write: Writer. (line 10)
  5324. * write-block: Ports. (line 41)
  5325. * write-block <1>: Low-level Pre-Scheme memory manipulation.
  5326. (line 108)
  5327. * write-char: Input & output in Pre-Scheme.
  5328. (line 41)
  5329. * write-image: Suspending and resuming heap images.
  5330. (line 25)
  5331. * write-integer: Input & output in Pre-Scheme.
  5332. (line 44)
  5333. * write-string: Ports. (line 42)
  5334. * write-string <1>: Input & output in Pre-Scheme.
  5335. (line 43)