12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178(* This file was automatically generated, do not edit.*)(* Edit file v1.in.ml instead. *)# 1 "v1.in.ml"moduletypeT=sigmoduleCamlinternalFormatBasics:moduletypeofstructincludeTezos_protocol_environment_sigs_internals.CamlinternalFormatBasicsendmodulePervasives:sig# 1 "v1/pervasives.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** The OCaml Standard library.
This module is automatically opened at the beginning of each
compilation. All components of this module can therefore be
referred by their short name, without prefixing them by [Stdlib].
It particular, it provides the basic operations over the built-in
types (numbers, booleans, byte sequences, strings, exceptions,
references, lists, arrays, input-output channels, ...) and the
{{!modules}standard library modules}.
*)(** {1 Exceptions} *)externalraise:exn->'a="%raise"(** Raise the given exception value *)externalraise_notrace:exn->'a="%raise_notrace"(** A faster version [raise] which does not record the backtrace.
@since 4.02.0
*)valinvalid_arg:string->'a(** Raise exception [Invalid_argument] with the given string. *)valfailwith:string->'a(** Raise exception [Failure] with the given string. *)exceptionExit(** The [Exit] exception is not raised by any library function. It is
provided for use in your programs. *)(** {1 Boolean operations} *)externalnot:bool->bool="%boolnot"(** The boolean negation. *)external(&&):bool->bool->bool="%sequand"(** The boolean 'and'. Evaluation is sequential, left-to-right:
in [e1 && e2], [e1] is evaluated first, and if it returns [false],
[e2] is not evaluated at all.
Right-associative operator, see {!Ocaml_operators} for more information.
*)external(||):bool->bool->bool="%sequor"(** The boolean 'or'. Evaluation is sequential, left-to-right:
in [e1 || e2], [e1] is evaluated first, and if it returns [true],
[e2] is not evaluated at all.
Right-associative operator, see {!Ocaml_operators} for more information.
*)(** {1 Debugging} *)external__LOC__:string="%loc_LOC"(** [__LOC__] returns the location at which this expression appears in
the file currently being parsed by the compiler, with the standard
error format of OCaml: "File %S, line %d, characters %d-%d".
@since 4.02.0
*)external__FILE__:string="%loc_FILE"(** [__FILE__] returns the name of the file currently being
parsed by the compiler.
@since 4.02.0
*)external__LINE__:int="%loc_LINE"(** [__LINE__] returns the line number at which this expression
appears in the file currently being parsed by the compiler.
@since 4.02.0
*)external__MODULE__:string="%loc_MODULE"(** [__MODULE__] returns the module name of the file being
parsed by the compiler.
@since 4.02.0
*)external__POS__:string*int*int*int="%loc_POS"(** [__POS__] returns a tuple [(file,lnum,cnum,enum)], corresponding
to the location at which this expression appears in the file
currently being parsed by the compiler. [file] is the current
filename, [lnum] the line number, [cnum] the character position in
the line and [enum] the last character position in the line.
@since 4.02.0
*)external__LOC_OF__:'a->string*'a="%loc_LOC"(** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the
location of [expr] in the file currently being parsed by the
compiler, with the standard error format of OCaml: "File %S, line
%d, characters %d-%d".
@since 4.02.0
*)external__LINE_OF__:'a->int*'a="%loc_LINE"(** [__LINE_OF__ expr] returns a pair [(line, expr)], where [line] is the
line number at which the expression [expr] appears in the file
currently being parsed by the compiler.
@since 4.02.0
*)external__POS_OF__:'a->(string*int*int*int)*'a="%loc_POS"(** [__POS_OF__ expr] returns a pair [(loc,expr)], where [loc] is a
tuple [(file,lnum,cnum,enum)] corresponding to the location at
which the expression [expr] appears in the file currently being
parsed by the compiler. [file] is the current filename, [lnum] the
line number, [cnum] the character position in the line and [enum]
the last character position in the line.
@since 4.02.0
*)(** {1 Composition operators} *)external(|>):'a->('a->'b)->'b="%revapply"(** Reverse-application operator: [x |> f |> g] is exactly equivalent
to [g (f (x))].
Left-associative operator, see {!Ocaml_operators} for more information.
@since 4.01
*)external(@@):('a->'b)->'a->'b="%apply"(** Application operator: [g @@ f @@ x] is exactly equivalent to
[g (f (x))].
Right-associative operator, see {!Ocaml_operators} for more information.
@since 4.01
*)(** {1 Integer arithmetic} *)(** Integers are [Sys.int_size] bits wide.
All operations are taken modulo 2{^[Sys.int_size]}.
They do not fail on overflow. *)external(~-):int->int="%negint"(** Unary negation. You can also write [- e] instead of [~- e].
Unary operator, see {!Ocaml_operators} for more information.
*)external(~+):int->int="%identity"(** Unary addition. You can also write [+ e] instead of [~+ e].
Unary operator, see {!Ocaml_operators} for more information.
@since 3.12.0
*)externalsucc:int->int="%succint"(** [succ x] is [x + 1]. *)externalpred:int->int="%predint"(** [pred x] is [x - 1]. *)external(+):int->int->int="%addint"(** Integer addition.
Left-associative operator, see {!Ocaml_operators} for more information.
*)external(-):int->int->int="%subint"(** Integer subtraction.
Left-associative operator, , see {!Ocaml_operators} for more information.
*)external(*):int->int->int="%mulint"(** Integer multiplication.
Left-associative operator, see {!Ocaml_operators} for more information.
*)external(/):int->int->int="%divint"(** Integer division.
Raise [Division_by_zero] if the second argument is 0.
Integer division rounds the real quotient of its arguments towards zero.
More precisely, if [x >= 0] and [y > 0], [x / y] is the greatest integer
less than or equal to the real quotient of [x] by [y]. Moreover,
[(- x) / y = x / (- y) = - (x / y)].
Left-associative operator, see {!Ocaml_operators} for more information.
*)external(mod):int->int->int="%modint"(** Integer remainder. If [y] is not zero, the result
of [x mod y] satisfies the following properties:
[x = (x / y) * y + x mod y] and
[abs(x mod y) <= abs(y) - 1].
If [y = 0], [x mod y] raises [Division_by_zero].
Note that [x mod y] is negative only if [x < 0].
Raise [Division_by_zero] if [y] is zero.
Left-associative operator, see {!Ocaml_operators} for more information.
*)valabs:int->int(** Return the absolute value of the argument. Note that this may be
negative if the argument is [min_int]. *)valmax_int:int(** The greatest representable integer. *)valmin_int:int(** The smallest representable integer. *)(** {2 Bitwise operations} *)external(land):int->int->int="%andint"(** Bitwise logical and.
Left-associative operator, see {!Ocaml_operators} for more information.
*)external(lor):int->int->int="%orint"(** Bitwise logical or.
Left-associative operator, see {!Ocaml_operators} for more information.
*)external(lxor):int->int->int="%xorint"(** Bitwise logical exclusive or.
Left-associative operator, see {!Ocaml_operators} for more information.
*)vallnot:int->int(** Bitwise logical negation. *)external(lsl):int->int->int="%lslint"(** [n lsl m] shifts [n] to the left by [m] bits.
The result is unspecified if [m < 0] or [m > Sys.int_size].
Right-associative operator, see {!Ocaml_operators} for more information.
*)external(lsr):int->int->int="%lsrint"(** [n lsr m] shifts [n] to the right by [m] bits.
This is a logical shift: zeroes are inserted regardless of
the sign of [n].
The result is unspecified if [m < 0] or [m > Sys.int_size].
Right-associative operator, see {!Ocaml_operators} for more information.
*)external(asr):int->int->int="%asrint"(** [n asr m] shifts [n] to the right by [m] bits.
This is an arithmetic shift: the sign bit of [n] is replicated.
The result is unspecified if [m < 0] or [m > Sys.int_size].
Right-associative operator, see {!Ocaml_operators} for more information.
*)(** {1 String operations}
More string operations are provided in module {!String}.
*)val(^):string->string->string(** String concatenation.
Right-associative operator, see {!Ocaml_operators} for more information.
*)(** {1 Character operations}
More character operations are provided in module {!Char}.
*)externalint_of_char:char->int="%identity"(** Return the ASCII code of the argument. *)valchar_of_int:int->char(** Return the character with the given ASCII code.
Raise [Invalid_argument "char_of_int"] if the argument is
outside the range 0--255. *)(** {1 Unit operations} *)externalignore:'a->unit="%ignore"(** Discard the value of its argument and return [()].
For instance, [ignore(f x)] discards the result of
the side-effecting function [f]. It is equivalent to
[f x; ()], except that the latter may generate a
compiler warning; writing [ignore(f x)] instead
avoids the warning. *)(** {1 String conversion functions} *)valstring_of_bool:bool->string(** Return the string representation of a boolean. As the returned values
may be shared, the user should not modify them directly.
*)valbool_of_string_opt:string->booloption(** Convert the given string to a boolean.
Return [None] if the string is not ["true"] or ["false"].
@since 4.05
*)valstring_of_int:int->string(** Return the string representation of an integer, in decimal. *)valint_of_string_opt:string->intoption(** Convert the given string to an integer.
The string is read in decimal (by default, or if the string
begins with [0u]), in hexadecimal (if it begins with [0x] or
[0X]), in octal (if it begins with [0o] or [0O]), or in binary
(if it begins with [0b] or [0B]).
The [0u] prefix reads the input as an unsigned integer in the range
[[0, 2*max_int+1]]. If the input exceeds {!max_int}
it is converted to the signed integer
[min_int + input - max_int - 1].
The [_] (underscore) character can appear anywhere in the string
and is ignored.
Return [None] if the given string is not a valid representation of an
integer, or if the integer represented exceeds the range of integers
representable in type [int].
@since 4.05
*)(** {1 Pair operations} *)externalfst:'a*'b->'a="%field0"(** Return the first component of a pair. *)externalsnd:'a*'b->'b="%field1"(** Return the second component of a pair. *)(** {1 List operations}
More list operations are provided in module {!List}.
*)val(@):'alist->'alist->'alist(** List concatenation. Not tail-recursive (length of the first argument).
Right-associative operator, see {!Ocaml_operators} for more information.
*)(** {1 References} *)type'aref={mutablecontents:'a}(** The type of references (mutable indirection cells) containing
a value of type ['a]. *)externalref:'a->'aref="%makemutable"(** Return a fresh reference containing the given value. *)external(!):'aref->'a="%field0"(** [!r] returns the current contents of reference [r].
Equivalent to [fun r -> r.contents].
Unary operator, see {!Ocaml_operators} for more information.
*)external(:=):'aref->'a->unit="%setfield0"(** [r := a] stores the value of [a] in reference [r].
Equivalent to [fun r v -> r.contents <- v].
Right-associative operator, see {!Ocaml_operators} for more information.
*)externalincr:intref->unit="%incr"(** Increment the integer contained in the given reference.
Equivalent to [fun r -> r := succ !r]. *)externaldecr:intref->unit="%decr"(** Decrement the integer contained in the given reference.
Equivalent to [fun r -> r := pred !r]. *)(** {1 Result type} *)(** @since 4.03.0 *)type('a,'b)result=Okof'a|Errorof'b(** {1 Operations on format strings} *)(** Format strings are character strings with special lexical conventions
that defines the functionality of formatted input/output functions. Format
strings are used to read data with formatted input functions from module
{!Scanf} and to print data with formatted output functions from modules
{!Printf} and {!Format}.
Format strings are made of three kinds of entities:
- {e conversions specifications}, introduced by the special character ['%']
followed by one or more characters specifying what kind of argument to
read or print,
- {e formatting indications}, introduced by the special character ['@']
followed by one or more characters specifying how to read or print the
argument,
- {e plain characters} that are regular characters with usual lexical
conventions. Plain characters specify string literals to be read in the
input or printed in the output.
There is an additional lexical rule to escape the special characters ['%']
and ['@'] in format strings: if a special character follows a ['%']
character, it is treated as a plain character. In other words, ["%%"] is
considered as a plain ['%'] and ["%@"] as a plain ['@'].
For more information about conversion specifications and formatting
indications available, read the documentation of modules {!Scanf},
{!Printf} and {!Format}.
*)(** Format strings have a general and highly polymorphic type
[('a, 'b, 'c, 'd, 'e, 'f) format6].
The two simplified types, [format] and [format4] below are
included for backward compatibility with earlier releases of
OCaml.
The meaning of format string type parameters is as follows:
- ['a] is the type of the parameters of the format for formatted output
functions ([printf]-style functions);
['a] is the type of the values read by the format for formatted input
functions ([scanf]-style functions).
- ['b] is the type of input source for formatted input functions and the
type of output target for formatted output functions.
For [printf]-style functions from module {!Printf}, ['b] is typically
[out_channel];
for [printf]-style functions from module {!Format}, ['b] is typically
{!Format.formatter};
for [scanf]-style functions from module {!Scanf}, ['b] is typically
{!Scanf.Scanning.in_channel}.
Type argument ['b] is also the type of the first argument given to
user's defined printing functions for [%a] and [%t] conversions,
and user's defined reading functions for [%r] conversion.
- ['c] is the type of the result of the [%a] and [%t] printing
functions, and also the type of the argument transmitted to the
first argument of [kprintf]-style functions or to the
[kscanf]-style functions.
- ['d] is the type of parameters for the [scanf]-style functions.
- ['e] is the type of the receiver function for the [scanf]-style functions.
- ['f] is the final result type of a formatted input/output function
invocation: for the [printf]-style functions, it is typically [unit];
for the [scanf]-style functions, it is typically the result type of the
receiver function.
*)type('a,'b,'c,'d,'e,'f)format6=('a,'b,'c,'d,'e,'f)CamlinternalFormatBasics.format6type('a,'b,'c,'d)format4=('a,'b,'c,'c,'c,'d)format6type('a,'b,'c)format=('a,'b,'c,'c)format4valstring_of_format:('a,'b,'c,'d,'e,'f)format6->string(** Converts a format string into a string. *)externalformat_of_string:('a,'b,'c,'d,'e,'f)format6->('a,'b,'c,'d,'e,'f)format6="%identity"(** [format_of_string s] returns a format string read from the string
literal [s].
Note: [format_of_string] can not convert a string argument that is not a
literal. If you need this functionality, use the more general
{!Scanf.format_from_string} function.
*)val(^^):('a,'b,'c,'d,'e,'f)format6->('f,'b,'c,'e,'g,'h)format6->('a,'b,'c,'d,'g,'h)format6(** [f1 ^^ f2] catenates format strings [f1] and [f2]. The result is a
format string that behaves as the concatenation of format strings [f1] and
[f2]: in case of formatted output, it accepts arguments from [f1], then
arguments from [f2]; in case of formatted input, it returns results from
[f1], then results from [f2].
Right-associative operator, see {!Ocaml_operators} for more information.
*)end# 6 "v1.in.ml"openPervasivesmoduleList:sig# 1 "v1/list.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** List operations.
Some functions are flagged as not tail-recursive. A tail-recursive
function uses constant stack space, while a non-tail-recursive function
uses stack space proportional to the length of its list argument, which
can be a problem with very long lists. When the function takes several
list arguments, an approximate formula giving stack usage (in some
unspecified constant unit) is shown in parentheses.
The above considerations can usually be ignored if your lists are not
longer than about 10000 elements.
*)type'at='alist=[]|(::)of'a*'alist(**)(** An alias for the type of lists. *)vallength:'alist->int(** Return the length (number of elements) of the given list. *)valcompare_lengths:'alist->'blist->int(** Compare the lengths of two lists. [compare_lengths l1 l2] is
equivalent to [compare (length l1) (length l2)], except that
the computation stops after itering on the shortest list.
@since 4.05.0
*)valcompare_length_with:'alist->int->int(** Compare the length of a list to an integer. [compare_length_with l n] is
equivalent to [compare (length l) n], except that
the computation stops after at most [n] iterations on the list.
@since 4.05.0
*)valcons:'a->'alist->'alist(** [cons x xs] is [x :: xs]
@since 4.03.0
*)valhd:'alist->'a(** Return the first element of the given list. Raise
[Failure "hd"] if the list is empty. *)valtl:'alist->'alist(** Return the given list without its first element. Raise
[Failure "tl"] if the list is empty. *)valnth_opt:'alist->int->'aoption(** Return the [n]-th element of the given list.
The first element (head of the list) is at position 0.
Return [None] if the list is too short.
Raise [Invalid_argument "List.nth"] if [n] is negative.
@since 4.05
*)valrev:'alist->'alist(** List reversal. *)valinit:int->(int->'a)->'alist(** [List.init len f] is [[f 0; f 1; ...; f (len-1)]], evaluated left to right.
@raise Invalid_argument if len < 0.
@since 4.06.0
*)valappend:'alist->'alist->'alist(** Concatenate two lists. Same as the infix operator [@].
Not tail-recursive (length of the first argument). *)valrev_append:'alist->'alist->'alist(** [List.rev_append l1 l2] reverses [l1] and concatenates it to [l2].
This is equivalent to {!List.rev}[ l1 @ l2], but [rev_append] is
tail-recursive and more efficient. *)valconcat:'alistlist->'alist(** Concatenate a list of lists. The elements of the argument are all
concatenated together (in the same order) to give the result.
Not tail-recursive
(length of the argument + length of the longest sub-list). *)valflatten:'alistlist->'alist(** An alias for [concat]. *)(** {1 Iterators} *)valiter:('a->unit)->'alist->unit(** [List.iter f [a1; ...; an]] applies function [f] in turn to
[a1; ...; an]. It is equivalent to
[begin f a1; f a2; ...; f an; () end]. *)valiteri:(int->'a->unit)->'alist->unit(** Same as {!List.iter}, but the function is applied to the index of
the element as first argument (counting from 0), and the element
itself as second argument.
@since 4.00.0
*)valmap:('a->'b)->'alist->'blist(** [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],
and builds the list [[f a1; ...; f an]]
with the results returned by [f]. Not tail-recursive. *)valmapi:(int->'a->'b)->'alist->'blist(** Same as {!List.map}, but the function is applied to the index of
the element as first argument (counting from 0), and the element
itself as second argument. Not tail-recursive.
@since 4.00.0
*)valrev_map:('a->'b)->'alist->'blist(** [List.rev_map f l] gives the same result as
{!List.rev}[ (]{!List.map}[ f l)], but is tail-recursive and
more efficient. *)valfilter_map:('a->'boption)->'alist->'blist(** [filter_map f l] applies [f] to every element of [l], filters
out the [None] elements and returns the list of the arguments of
the [Some] elements.
@since 4.08.0
*)valfold_left:('a->'b->'a)->'a->'blist->'a(** [List.fold_left f a [b1; ...; bn]] is
[f (... (f (f a b1) b2) ...) bn]. *)valfold_right:('a->'b->'b)->'alist->'b->'b(** [List.fold_right f [a1; ...; an] b] is
[f a1 (f a2 (... (f an b) ...))]. Not tail-recursive. *)(** {1 Iterators on two lists} *)valiter2:('a->'b->unit)->'alist->'blist->unit(** [List.iter2 f [a1; ...; an] [b1; ...; bn]] calls in turn
[f a1 b1; ...; f an bn].
Raise [Invalid_argument] if the two lists are determined
to have different lengths. *)valmap2:('a->'b->'c)->'alist->'blist->'clist(** [List.map2 f [a1; ...; an] [b1; ...; bn]] is
[[f a1 b1; ...; f an bn]].
Raise [Invalid_argument] if the two lists are determined
to have different lengths. Not tail-recursive. *)valrev_map2:('a->'b->'c)->'alist->'blist->'clist(** [List.rev_map2 f l1 l2] gives the same result as
{!List.rev}[ (]{!List.map2}[ f l1 l2)], but is tail-recursive and
more efficient. *)valfold_left2:('a->'b->'c->'a)->'a->'blist->'clist->'a(** [List.fold_left2 f a [b1; ...; bn] [c1; ...; cn]] is
[f (... (f (f a b1 c1) b2 c2) ...) bn cn].
Raise [Invalid_argument] if the two lists are determined
to have different lengths. *)valfold_right2:('a->'b->'c->'c)->'alist->'blist->'c->'c(** [List.fold_right2 f [a1; ...; an] [b1; ...; bn] c] is
[f a1 b1 (f a2 b2 (... (f an bn c) ...))].
Raise [Invalid_argument] if the two lists are determined
to have different lengths. Not tail-recursive. *)(** {1 List scanning} *)valfor_all:('a->bool)->'alist->bool(** [for_all p [a1; ...; an]] checks if all elements of the list
satisfy the predicate [p]. That is, it returns
[(p a1) && (p a2) && ... && (p an)]. *)valexists:('a->bool)->'alist->bool(** [exists p [a1; ...; an]] checks if at least one element of
the list satisfies the predicate [p]. That is, it returns
[(p a1) || (p a2) || ... || (p an)]. *)valfor_all2:('a->'b->bool)->'alist->'blist->bool(** Same as {!List.for_all}, but for a two-argument predicate.
Raise [Invalid_argument] if the two lists are determined
to have different lengths. *)valexists2:('a->'b->bool)->'alist->'blist->bool(** Same as {!List.exists}, but for a two-argument predicate.
Raise [Invalid_argument] if the two lists are determined
to have different lengths. *)(** {1 List searching} *)valfind_opt:('a->bool)->'alist->'aoption(** [find_opt p l] returns the first element of the list [l] that
satisfies the predicate [p], or [None] if there is no value that
satisfies [p] in the list [l].
@since 4.05 *)valfilter:('a->bool)->'alist->'alist(** [filter p l] returns all the elements of the list [l]
that satisfy the predicate [p]. The order of the elements
in the input list is preserved. *)valfind_all:('a->bool)->'alist->'alist(** [find_all] is another name for {!List.filter}. *)valpartition:('a->bool)->'alist->'alist*'alist(** [partition p l] returns a pair of lists [(l1, l2)], where
[l1] is the list of all the elements of [l] that
satisfy the predicate [p], and [l2] is the list of all the
elements of [l] that do not satisfy [p].
The order of the elements in the input list is preserved. *)(** {1 Lists of pairs} *)valsplit:('a*'b)list->'alist*'blist(** Transform a list of pairs into a pair of lists:
[split [(a1,b1); ...; (an,bn)]] is [([a1; ...; an], [b1; ...; bn])].
Not tail-recursive.
*)valcombine:'alist->'blist->('a*'b)list(** Transform a pair of lists into a list of pairs:
[combine [a1; ...; an] [b1; ...; bn]] is
[[(a1,b1); ...; (an,bn)]].
Raise [Invalid_argument] if the two lists
have different lengths. Not tail-recursive. *)(** {1 Sorting} *)valsort:('a->'a->int)->'alist->'alist(** Sort a list in increasing order according to a comparison
function. The comparison function must return 0 if its arguments
compare as equal, a positive integer if the first is greater,
and a negative integer if the first is smaller (see Array.sort for
a complete specification). For example,
{!Stdlib.compare} is a suitable comparison function.
The resulting list is sorted in increasing order.
[List.sort] is guaranteed to run in constant heap space
(in addition to the size of the result list) and logarithmic
stack space.
The current implementation uses Merge Sort. It runs in constant
heap space and logarithmic stack space.
*)valstable_sort:('a->'a->int)->'alist->'alist(** Same as {!List.sort}, but the sorting algorithm is guaranteed to
be stable (i.e. elements that compare equal are kept in their
original order) .
The current implementation uses Merge Sort. It runs in constant
heap space and logarithmic stack space.
*)valfast_sort:('a->'a->int)->'alist->'alist(** Same as {!List.sort} or {!List.stable_sort}, whichever is faster
on typical input. *)valsort_uniq:('a->'a->int)->'alist->'alist(** Same as {!List.sort}, but also remove duplicates.
@since 4.02.0 *)valmerge:('a->'a->int)->'alist->'alist->'alist(** Merge two lists:
Assuming that [l1] and [l2] are sorted according to the
comparison function [cmp], [merge cmp l1 l2] will return a
sorted list containing all the elements of [l1] and [l2].
If several elements compare equal, the elements of [l1] will be
before the elements of [l2].
Not tail-recursive (sum of the lengths of the arguments).
*)end# 10 "v1.in.ml"moduleString:sig# 1 "v1/string.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** String operations.
A string is an immutable data structure that contains a
fixed-length sequence of (single-byte) characters. Each character
can be accessed in constant time through its index.
Given a string [s] of length [l], we can access each of the [l]
characters of [s] via its index in the sequence. Indexes start at
[0], and we will call an index valid in [s] if it falls within the
range [[0...l-1]] (inclusive). A position is the point between two
characters or at the beginning or end of the string. We call a
position valid in [s] if it falls within the range [[0...l]]
(inclusive). Note that the character at index [n] is between
positions [n] and [n+1].
Two parameters [start] and [len] are said to designate a valid
substring of [s] if [len >= 0] and [start] and [start+len] are
valid positions in [s].
Note: OCaml strings used to be modifiable in place, for instance via
the {!String.set} and {!String.blit} functions described below. This
usage is only possible when the compiler is put in "unsafe-string"
mode by giving the [-unsafe-string] command-line option. This
compatibility mode makes the types [string] and [bytes] (see module
{!Bytes}) interchangeable so that functions expecting byte sequences
can also accept strings as arguments and modify them.
The distinction between [bytes] and [string] was introduced in OCaml
4.02, and the "unsafe-string" compatibility mode was the default
until OCaml 4.05. Starting with 4.06, the compatibility mode is
opt-in; we intend to remove the option in the future.
*)externallength:string->int="%string_length"(** Return the length (number of characters) of the given string. *)externalget:string->int->char="%string_safe_get"(** [String.get s n] returns the character at index [n] in string [s].
You can also write [s.[n]] instead of [String.get s n].
Raise [Invalid_argument] if [n] not a valid index in [s]. *)valmake:int->char->string(** [String.make n c] returns a fresh string of length [n],
filled with the character [c].
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *)valinit:int->(int->char)->string(** [String.init n f] returns a string of length [n], with character
[i] initialized to the result of [f i] (called in increasing
index order).
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}.
@since 4.02.0
*)valsub:string->int->int->string(** [String.sub s start len] returns a fresh string of length [len],
containing the substring of [s] that starts at position [start] and
has length [len].
Raise [Invalid_argument] if [start] and [len] do not
designate a valid substring of [s]. *)valblit:string->int->bytes->int->int->unit(** Same as {!Bytes.blit_string}. *)valconcat:string->stringlist->string(** [String.concat sep sl] concatenates the list of strings [sl],
inserting the separator string [sep] between each.
Raise [Invalid_argument] if the result is longer than
{!Sys.max_string_length} bytes. *)valiter:(char->unit)->string->unit(** [String.iter f s] applies function [f] in turn to all
the characters of [s]. It is equivalent to
[f s.[0]; f s.[1]; ...; f s.[String.length s - 1]; ()]. *)valiteri:(int->char->unit)->string->unit(** Same as {!String.iter}, but the
function is applied to the index of the element as first argument
(counting from 0), and the character itself as second argument.
@since 4.00.0 *)valmap:(char->char)->string->string(** [String.map f s] applies function [f] in turn to all the
characters of [s] (in increasing index order) and stores the
results in a new string that is returned.
@since 4.00.0 *)valmapi:(int->char->char)->string->string(** [String.mapi f s] calls [f] with each character of [s] and its
index (in increasing index order) and stores the results in a new
string that is returned.
@since 4.02.0 *)valtrim:string->string(** Return a copy of the argument, without leading and trailing
whitespace. The characters regarded as whitespace are: [' '],
['\012'], ['\n'], ['\r'], and ['\t']. If there is neither leading nor
trailing whitespace character in the argument, return the original
string itself, not a copy.
@since 4.00.0 *)valescaped:string->string(** Return a copy of the argument, with special characters
represented by escape sequences, following the lexical
conventions of OCaml.
All characters outside the ASCII printable range (32..126) are
escaped, as well as backslash and double-quote.
If there is no special character in the argument that needs
escaping, return the original string itself, not a copy.
Raise [Invalid_argument] if the result is longer than
{!Sys.max_string_length} bytes.
The function {!Scanf.unescaped} is a left inverse of [escaped],
i.e. [Scanf.unescaped (escaped s) = s] for any string [s] (unless
[escape s] fails). *)valindex_opt:string->char->intoption(** [String.index_opt s c] returns the index of the first
occurrence of character [c] in string [s], or
[None] if [c] does not occur in [s].
@since 4.05 *)valrindex_opt:string->char->intoption(** [String.rindex_opt s c] returns the index of the last occurrence
of character [c] in string [s], or [None] if [c] does not occur in
[s].
@since 4.05 *)valindex_from_opt:string->int->char->intoption(** [String.index_from_opt s i c] returns the index of the
first occurrence of character [c] in string [s] after position [i]
or [None] if [c] does not occur in [s] after position [i].
[String.index_opt s c] is equivalent to [String.index_from_opt s 0 c].
Raise [Invalid_argument] if [i] is not a valid position in [s].
@since 4.05
*)valrindex_from_opt:string->int->char->intoption(** [String.rindex_from_opt s i c] returns the index of the
last occurrence of character [c] in string [s] before position [i+1]
or [None] if [c] does not occur in [s] before position [i+1].
[String.rindex_opt s c] is equivalent to
[String.rindex_from_opt s (String.length s - 1) c].
Raise [Invalid_argument] if [i+1] is not a valid position in [s].
@since 4.05
*)valcontains:string->char->bool(** [String.contains s c] tests if character [c]
appears in the string [s]. *)valcontains_from:string->int->char->bool(** [String.contains_from s start c] tests if character [c]
appears in [s] after position [start].
[String.contains s c] is equivalent to
[String.contains_from s 0 c].
Raise [Invalid_argument] if [start] is not a valid position in [s]. *)valrcontains_from:string->int->char->bool(** [String.rcontains_from s stop c] tests if character [c]
appears in [s] before position [stop+1].
Raise [Invalid_argument] if [stop < 0] or [stop+1] is not a valid
position in [s]. *)valuppercase_ascii:string->string(** Return a copy of the argument, with all lowercase letters
translated to uppercase, using the US-ASCII character set.
@since 4.03.0 *)vallowercase_ascii:string->string(** Return a copy of the argument, with all uppercase letters
translated to lowercase, using the US-ASCII character set.
@since 4.03.0 *)valcapitalize_ascii:string->string(** Return a copy of the argument, with the first character set to uppercase,
using the US-ASCII character set.
@since 4.03.0 *)valuncapitalize_ascii:string->string(** Return a copy of the argument, with the first character set to lowercase,
using the US-ASCII character set.
@since 4.03.0 *)typet=string(** An alias for the type of strings. *)valcompare:t->t->int(** The comparison function for strings, with the same specification as
{!Stdlib.compare}. Along with the type [t], this function [compare]
allows the module [String] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)valequal:t->t->bool(** The equal function for strings.
@since 4.03.0 *)valsplit_on_char:char->string->stringlist(** [String.split_on_char sep s] returns the list of all (possibly empty)
substrings of [s] that are delimited by the [sep] character.
The function's output is specified by the following invariants:
- The list is not empty.
- Concatenating its elements using [sep] as a separator returns a
string equal to the input ([String.concat (String.make 1 sep)
(String.split_on_char sep s) = s]).
- No string in the result contains the [sep] character.
@since 4.04.0
*)end# 12 "v1.in.ml"moduleChar:sig# 1 "v1/char.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Character operations. *)externalcode:char->int="%identity"(** Return the ASCII code of the argument. *)valchr:int->char(** Return the character with the given ASCII code.
Raise [Invalid_argument "Char.chr"] if the argument is
outside the range 0--255. *)valescaped:char->string(** Return a string representing the given character,
with special characters escaped following the lexical conventions
of OCaml.
All characters outside the ASCII printable range (32..126) are
escaped, as well as backslash, double-quote, and single-quote. *)vallowercase_ascii:char->char(** Convert the given character to its equivalent lowercase character,
using the US-ASCII character set.
@since 4.03.0 *)valuppercase_ascii:char->char(** Convert the given character to its equivalent uppercase character,
using the US-ASCII character set.
@since 4.03.0 *)typet=char(** An alias for the type of characters. *)valcompare:t->t->int(** The comparison function for characters, with the same specification as
{!Stdlib.compare}. Along with the type [t], this function [compare]
allows the module [Char] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)valequal:t->t->bool(** The equal function for chars.
@since 4.03.0 *)end# 14 "v1.in.ml"moduleBytes:sig# 1 "v1/bytes.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Byte sequence operations.
A byte sequence is a mutable data structure that contains a
fixed-length sequence of bytes. Each byte can be indexed in
constant time for reading or writing.
Given a byte sequence [s] of length [l], we can access each of the
[l] bytes of [s] via its index in the sequence. Indexes start at
[0], and we will call an index valid in [s] if it falls within the
range [[0...l-1]] (inclusive). A position is the point between two
bytes or at the beginning or end of the sequence. We call a
position valid in [s] if it falls within the range [[0...l]]
(inclusive). Note that the byte at index [n] is between positions
[n] and [n+1].
Two parameters [start] and [len] are said to designate a valid
range of [s] if [len >= 0] and [start] and [start+len] are valid
positions in [s].
Byte sequences can be modified in place, for instance via the [set]
and [blit] functions described below. See also strings (module
{!String}), which are almost the same data structure, but cannot be
modified in place.
Bytes are represented by the OCaml type [char].
@since 4.02.0
*)externallength:bytes->int="%bytes_length"(** Return the length (number of bytes) of the argument. *)externalget:bytes->int->char="%bytes_safe_get"(** [get s n] returns the byte at index [n] in argument [s].
Raise [Invalid_argument] if [n] is not a valid index in [s]. *)externalset:bytes->int->char->unit="%bytes_safe_set"(** [set s n c] modifies [s] in place, replacing the byte at index [n]
with [c].
Raise [Invalid_argument] if [n] is not a valid index in [s]. *)valmake:int->char->bytes(** [make n c] returns a new byte sequence of length [n], filled with
the byte [c].
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *)valinit:int->(int->char)->bytes(** [Bytes.init n f] returns a fresh byte sequence of length [n], with
character [i] initialized to the result of [f i] (in increasing
index order).
Raise [Invalid_argument] if [n < 0] or [n > ]{!Sys.max_string_length}. *)valempty:bytes(** A byte sequence of size 0. *)valcopy:bytes->bytes(** Return a new byte sequence that contains the same bytes as the
argument. *)valof_string:string->bytes(** Return a new byte sequence that contains the same bytes as the
given string. *)valto_string:bytes->string(** Return a new string that contains the same bytes as the given byte
sequence. *)valsub:bytes->int->int->bytes(** [sub s start len] returns a new byte sequence of length [len],
containing the subsequence of [s] that starts at position [start]
and has length [len].
Raise [Invalid_argument] if [start] and [len] do not designate a
valid range of [s]. *)valsub_string:bytes->int->int->string(** Same as [sub] but return a string instead of a byte sequence. *)valextend:bytes->int->int->bytes(** [extend s left right] returns a new byte sequence that contains
the bytes of [s], with [left] uninitialized bytes prepended and
[right] uninitialized bytes appended to it. If [left] or [right]
is negative, then bytes are removed (instead of appended) from
the corresponding side of [s].
Raise [Invalid_argument] if the result length is negative or
longer than {!Sys.max_string_length} bytes. *)valfill:bytes->int->int->char->unit(** [fill s start len c] modifies [s] in place, replacing [len]
characters with [c], starting at [start].
Raise [Invalid_argument] if [start] and [len] do not designate a
valid range of [s]. *)valblit:bytes->int->bytes->int->int->unit(** [blit src srcoff dst dstoff len] copies [len] bytes from sequence
[src], starting at index [srcoff], to sequence [dst], starting at
index [dstoff]. It works correctly even if [src] and [dst] are the
same byte sequence, and the source and destination intervals
overlap.
Raise [Invalid_argument] if [srcoff] and [len] do not
designate a valid range of [src], or if [dstoff] and [len]
do not designate a valid range of [dst]. *)valblit_string:string->int->bytes->int->int->unit(** [blit src srcoff dst dstoff len] copies [len] bytes from string
[src], starting at index [srcoff], to byte sequence [dst],
starting at index [dstoff].
Raise [Invalid_argument] if [srcoff] and [len] do not
designate a valid range of [src], or if [dstoff] and [len]
do not designate a valid range of [dst]. *)valconcat:bytes->byteslist->bytes(** [concat sep sl] concatenates the list of byte sequences [sl],
inserting the separator byte sequence [sep] between each, and
returns the result as a new byte sequence.
Raise [Invalid_argument] if the result is longer than
{!Sys.max_string_length} bytes. *)valcat:bytes->bytes->bytes(** [cat s1 s2] concatenates [s1] and [s2] and returns the result
as new byte sequence.
Raise [Invalid_argument] if the result is longer than
{!Sys.max_string_length} bytes. *)valiter:(char->unit)->bytes->unit(** [iter f s] applies function [f] in turn to all the bytes of [s].
It is equivalent to [f (get s 0); f (get s 1); ...; f (get s
(length s - 1)); ()]. *)valiteri:(int->char->unit)->bytes->unit(** Same as {!Bytes.iter}, but the function is applied to the index of
the byte as first argument and the byte itself as second
argument. *)valmap:(char->char)->bytes->bytes(** [map f s] applies function [f] in turn to all the bytes of [s]
(in increasing index order) and stores the resulting bytes in
a new sequence that is returned as the result. *)valmapi:(int->char->char)->bytes->bytes(** [mapi f s] calls [f] with each character of [s] and its
index (in increasing index order) and stores the resulting bytes
in a new sequence that is returned as the result. *)valtrim:bytes->bytes(** Return a copy of the argument, without leading and trailing
whitespace. The bytes regarded as whitespace are the ASCII
characters [' '], ['\012'], ['\n'], ['\r'], and ['\t']. *)valescaped:bytes->bytes(** Return a copy of the argument, with special characters represented
by escape sequences, following the lexical conventions of OCaml.
All characters outside the ASCII printable range (32..126) are
escaped, as well as backslash and double-quote.
Raise [Invalid_argument] if the result is longer than
{!Sys.max_string_length} bytes. *)valindex_opt:bytes->char->intoption(** [index_opt s c] returns the index of the first occurrence of byte [c]
in [s] or [None] if [c] does not occur in [s].
@since 4.05 *)valrindex_opt:bytes->char->intoption(** [rindex_opt s c] returns the index of the last occurrence of byte [c]
in [s] or [None] if [c] does not occur in [s].
@since 4.05 *)valindex_from_opt:bytes->int->char->intoption(** [index_from _opts i c] returns the index of the first occurrence of
byte [c] in [s] after position [i] or [None] if [c] does not occur in [s]
after position [i].
[Bytes.index_opt s c] is equivalent to [Bytes.index_from_opt s 0 c].
Raise [Invalid_argument] if [i] is not a valid position in [s].
@since 4.05 *)valrindex_from_opt:bytes->int->char->intoption(** [rindex_from_opt s i c] returns the index of the last occurrence
of byte [c] in [s] before position [i+1] or [None] if [c] does not
occur in [s] before position [i+1]. [rindex_opt s c] is equivalent to
[rindex_from s (Bytes.length s - 1) c].
Raise [Invalid_argument] if [i+1] is not a valid position in [s].
@since 4.05 *)valcontains:bytes->char->bool(** [contains s c] tests if byte [c] appears in [s]. *)valcontains_from:bytes->int->char->bool(** [contains_from s start c] tests if byte [c] appears in [s] after
position [start]. [contains s c] is equivalent to [contains_from
s 0 c].
Raise [Invalid_argument] if [start] is not a valid position in [s]. *)valrcontains_from:bytes->int->char->bool(** [rcontains_from s stop c] tests if byte [c] appears in [s] before
position [stop+1].
Raise [Invalid_argument] if [stop < 0] or [stop+1] is not a valid
position in [s]. *)valuppercase_ascii:bytes->bytes(** Return a copy of the argument, with all lowercase letters
translated to uppercase, using the US-ASCII character set.
@since 4.03.0 *)vallowercase_ascii:bytes->bytes(** Return a copy of the argument, with all uppercase letters
translated to lowercase, using the US-ASCII character set.
@since 4.03.0 *)valcapitalize_ascii:bytes->bytes(** Return a copy of the argument, with the first character set to uppercase,
using the US-ASCII character set.
@since 4.03.0 *)valuncapitalize_ascii:bytes->bytes(** Return a copy of the argument, with the first character set to lowercase,
using the US-ASCII character set.
@since 4.03.0 *)typet=bytes(** An alias for the type of byte sequences. *)valcompare:t->t->int(** The comparison function for byte sequences, with the same
specification as {!Stdlib.compare}. Along with the type [t],
this function [compare] allows the module [Bytes] to be passed as
argument to the functors {!Set.Make} and {!Map.Make}. *)valequal:t->t->bool(** The equality function for byte sequences.
@since 4.03.0 *)end# 16 "v1.in.ml"moduleInt32:sig# 1 "v1/int32.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** 32-bit integers.
This module provides operations on the type [int32]
of signed 32-bit integers. Unlike the built-in [int] type,
the type [int32] is guaranteed to be exactly 32-bit wide on all
platforms. All arithmetic operations over [int32] are taken
modulo 2{^32}.
Performance notice: values of type [int32] occupy more memory
space than values of type [int], and arithmetic operations on
[int32] are generally slower than those on [int]. Use [int32]
only when the application requires exact 32-bit arithmetic.
Literals for 32-bit integers are suffixed by l:
{[
let zero: int32 = 0l
let one: int32 = 1l
let m_one: int32 = -1l
]}
*)valzero:int32(** The 32-bit integer 0. *)valone:int32(** The 32-bit integer 1. *)valminus_one:int32(** The 32-bit integer -1. *)externalneg:int32->int32="%int32_neg"(** Unary negation. *)externaladd:int32->int32->int32="%int32_add"(** Addition. *)externalsub:int32->int32->int32="%int32_sub"(** Subtraction. *)externalmul:int32->int32->int32="%int32_mul"(** Multiplication. *)externaldiv:int32->int32->int32="%int32_div"(** Integer division. Raise [Division_by_zero] if the second
argument is zero. This division rounds the real quotient of
its arguments towards zero, as specified for {!Stdlib.(/)}. *)externalrem:int32->int32->int32="%int32_mod"(** Integer remainder. If [y] is not zero, the result
of [Int32.rem x y] satisfies the following property:
[x = Int32.add (Int32.mul (Int32.div x y) y) (Int32.rem x y)].
If [y = 0], [Int32.rem x y] raises [Division_by_zero]. *)valsucc:int32->int32(** Successor. [Int32.succ x] is [Int32.add x Int32.one]. *)valpred:int32->int32(** Predecessor. [Int32.pred x] is [Int32.sub x Int32.one]. *)valabs:int32->int32(** Return the absolute value of its argument. *)valmax_int:int32(** The greatest representable 32-bit integer, 2{^31} - 1. *)valmin_int:int32(** The smallest representable 32-bit integer, -2{^31}. *)externallogand:int32->int32->int32="%int32_and"(** Bitwise logical and. *)externallogor:int32->int32->int32="%int32_or"(** Bitwise logical or. *)externallogxor:int32->int32->int32="%int32_xor"(** Bitwise logical exclusive or. *)vallognot:int32->int32(** Bitwise logical negation. *)externalshift_left:int32->int->int32="%int32_lsl"(** [Int32.shift_left x y] shifts [x] to the left by [y] bits.
The result is unspecified if [y < 0] or [y >= 32]. *)externalshift_right:int32->int->int32="%int32_asr"(** [Int32.shift_right x y] shifts [x] to the right by [y] bits.
This is an arithmetic shift: the sign bit of [x] is replicated
and inserted in the vacated bits.
The result is unspecified if [y < 0] or [y >= 32]. *)externalshift_right_logical:int32->int->int32="%int32_lsr"(** [Int32.shift_right_logical x y] shifts [x] to the right by [y] bits.
This is a logical shift: zeroes are inserted in the vacated bits
regardless of the sign of [x].
The result is unspecified if [y < 0] or [y >= 32]. *)externalof_int:int->int32="%int32_of_int"(** Convert the given integer (type [int]) to a 32-bit integer
(type [int32]). On 64-bit platforms, the argument is taken
modulo 2{^32}. *)externalto_int:int32->int="%int32_to_int"(** Convert the given 32-bit integer (type [int32]) to an
integer (type [int]). On 32-bit platforms, the 32-bit integer
is taken modulo 2{^31}, i.e. the high-order bit is lost
during the conversion. On 64-bit platforms, the conversion
is exact. *)valof_string_opt:string->int32option(** Same as [of_string], but return [None] instead of raising.
@since 4.05 *)valto_string:int32->string(** Return the string representation of its argument, in signed decimal. *)typet=int32(** An alias for the type of 32-bit integers. *)valcompare:t->t->int(** The comparison function for 32-bit integers, with the same specification as
{!Stdlib.compare}. Along with the type [t], this function [compare]
allows the module [Int32] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)valequal:t->t->bool(** The equal function for int32s.
@since 4.03.0 *)end# 18 "v1.in.ml"moduleInt64:sig# 1 "v1/int64.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** 64-bit integers.
This module provides operations on the type [int64] of
signed 64-bit integers. Unlike the built-in [int] type,
the type [int64] is guaranteed to be exactly 64-bit wide on all
platforms. All arithmetic operations over [int64] are taken
modulo 2{^64}
Performance notice: values of type [int64] occupy more memory
space than values of type [int], and arithmetic operations on
[int64] are generally slower than those on [int]. Use [int64]
only when the application requires exact 64-bit arithmetic.
Literals for 64-bit integers are suffixed by L:
{[
let zero: int64 = 0L
let one: int64 = 1L
let m_one: int64 = -1L
]}
*)valzero:int64(** The 64-bit integer 0. *)valone:int64(** The 64-bit integer 1. *)valminus_one:int64(** The 64-bit integer -1. *)externalneg:int64->int64="%int64_neg"(** Unary negation. *)externaladd:int64->int64->int64="%int64_add"(** Addition. *)externalsub:int64->int64->int64="%int64_sub"(** Subtraction. *)externalmul:int64->int64->int64="%int64_mul"(** Multiplication. *)externaldiv:int64->int64->int64="%int64_div"(** Integer division. Raise [Division_by_zero] if the second
argument is zero. This division rounds the real quotient of
its arguments towards zero, as specified for {!Stdlib.(/)}. *)externalrem:int64->int64->int64="%int64_mod"(** Integer remainder. If [y] is not zero, the result
of [Int64.rem x y] satisfies the following property:
[x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y)].
If [y = 0], [Int64.rem x y] raises [Division_by_zero]. *)valsucc:int64->int64(** Successor. [Int64.succ x] is [Int64.add x Int64.one]. *)valpred:int64->int64(** Predecessor. [Int64.pred x] is [Int64.sub x Int64.one]. *)valabs:int64->int64(** Return the absolute value of its argument. *)valmax_int:int64(** The greatest representable 64-bit integer, 2{^63} - 1. *)valmin_int:int64(** The smallest representable 64-bit integer, -2{^63}. *)externallogand:int64->int64->int64="%int64_and"(** Bitwise logical and. *)externallogor:int64->int64->int64="%int64_or"(** Bitwise logical or. *)externallogxor:int64->int64->int64="%int64_xor"(** Bitwise logical exclusive or. *)vallognot:int64->int64(** Bitwise logical negation. *)externalshift_left:int64->int->int64="%int64_lsl"(** [Int64.shift_left x y] shifts [x] to the left by [y] bits.
The result is unspecified if [y < 0] or [y >= 64]. *)externalshift_right:int64->int->int64="%int64_asr"(** [Int64.shift_right x y] shifts [x] to the right by [y] bits.
This is an arithmetic shift: the sign bit of [x] is replicated
and inserted in the vacated bits.
The result is unspecified if [y < 0] or [y >= 64]. *)externalshift_right_logical:int64->int->int64="%int64_lsr"(** [Int64.shift_right_logical x y] shifts [x] to the right by [y] bits.
This is a logical shift: zeroes are inserted in the vacated bits
regardless of the sign of [x].
The result is unspecified if [y < 0] or [y >= 64]. *)externalof_int:int->int64="%int64_of_int"(** Convert the given integer (type [int]) to a 64-bit integer
(type [int64]). *)externalto_int:int64->int="%int64_to_int"(** Convert the given 64-bit integer (type [int64]) to an
integer (type [int]). On 64-bit platforms, the 64-bit integer
is taken modulo 2{^63}, i.e. the high-order bit is lost
during the conversion. On 32-bit platforms, the 64-bit integer
is taken modulo 2{^31}, i.e. the top 33 bits are lost
during the conversion. *)externalof_int32:int32->int64="%int64_of_int32"(** Convert the given 32-bit integer (type [int32])
to a 64-bit integer (type [int64]). *)externalto_int32:int64->int32="%int64_to_int32"(** Convert the given 64-bit integer (type [int64]) to a
32-bit integer (type [int32]). The 64-bit integer
is taken modulo 2{^32}, i.e. the top 32 bits are lost
during the conversion. *)valof_string_opt:string->int64option(** Same as [of_string], but return [None] instead of raising.
@since 4.05 *)valto_string:int64->string(** Return the string representation of its argument, in decimal. *)typet=int64(** An alias for the type of 64-bit integers. *)valcompare:t->t->int(** The comparison function for 64-bit integers, with the same specification as
{!Stdlib.compare}. Along with the type [t], this function [compare]
allows the module [Int64] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)valequal:t->t->bool(** The equal function for int64s.
@since 4.03.0 *)end# 20 "v1.in.ml"moduleFormat:sig# 1 "v1/format.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Pierre Weis, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Pretty-printing.
This module implements a pretty-printing facility to format values
within {{!boxes}'pretty-printing boxes'} and {{!tags}'semantic tags'}
combined with a set of {{!fpp}printf-like functions}.
The pretty-printer splits lines at specified {{!breaks}break hints},
and indents lines according to the box structure.
Similarly, {{!tags}semantic tags} can be used to decouple text
presentation from its contents.
This pretty-printing facility is implemented as an overlay on top of
abstract {{!section:formatter}formatters} which provide basic output
functions.
Some formatters are predefined, notably:
- {!std_formatter} outputs to {{!Stdlib.stdout}stdout}
- {!err_formatter} outputs to {{!Stdlib.stderr}stderr}
Most functions in the {!Format} module come in two variants:
a short version that operates on {!std_formatter} and the
generic version prefixed by [pp_] that takes a formatter
as its first argument.
More formatters can be created with {!formatter_of_out_channel},
{!formatter_of_buffer}, {!formatter_of_symbolic_output_buffer}
or using {{!section:formatter}custom formatters}.
*)(** {1 Introduction}
For a gentle introduction to the basics of pretty-printing using
[Format], read
{{:http://caml.inria.fr/resources/doc/guides/format.en.html}
http://caml.inria.fr/resources/doc/guides/format.en.html}.
You may consider this module as providing an extension to the
[printf] facility to provide automatic line splitting. The addition of
pretty-printing annotations to your regular [printf] format strings gives
you fancy indentation and line breaks.
Pretty-printing annotations are described below in the documentation of
the function {!Format.fprintf}.
You may also use the explicit pretty-printing box management and printing
functions provided by this module. This style is more basic but more
verbose than the concise [fprintf] format strings.
For instance, the sequence
[open_box 0; print_string "x ="; print_space ();
print_int 1; close_box (); print_newline ()]
that prints [x = 1] within a pretty-printing box, can be
abbreviated as [printf "@[%s@ %i@]@." "x =" 1], or even shorter
[printf "@[x =@ %i@]@." 1].
Rule of thumb for casual users of this library:
- use simple pretty-printing boxes (as obtained by [open_box 0]);
- use simple break hints as obtained by [print_cut ()] that outputs a
simple break hint, or by [print_space ()] that outputs a space
indicating a break hint;
- once a pretty-printing box is open, display its material with basic
printing functions (e. g. [print_int] and [print_string]);
- when the material for a pretty-printing box has been printed, call
[close_box ()] to close the box;
- at the end of pretty-printing, flush the pretty-printer to display all
the remaining material, e.g. evaluate [print_newline ()].
The behavior of pretty-printing commands is unspecified
if there is no open pretty-printing box. Each box opened by
one of the [open_] functions below must be closed using [close_box]
for proper formatting. Otherwise, some of the material printed in the
boxes may not be output, or may be formatted incorrectly.
In case of interactive use, each phrase is executed in the initial state
of the standard pretty-printer: after each phrase execution, the
interactive system closes all open pretty-printing boxes, flushes all
pending text, and resets the standard pretty-printer.
Warning: mixing calls to pretty-printing functions of this module with
calls to {!Stdlib} low level output functions is error prone.
The pretty-printing functions output material that is delayed in the
pretty-printer queue and stacks in order to compute proper line
splitting. In contrast, basic I/O output functions write directly in
their output device. As a consequence, the output of a basic I/O function
may appear before the output of a pretty-printing function that has been
called before. For instance,
[
Stdlib.print_string "<";
Format.print_string "PRETTY";
Stdlib.print_string ">";
Format.print_string "TEXT";
]
leads to output [<>PRETTYTEXT].
*)typeformatter(** Abstract data corresponding to a pretty-printer (also called a
formatter) and all its machinery. See also {!section:formatter}. *)(** {1:boxes Pretty-printing boxes} *)(** The pretty-printing engine uses the concepts of pretty-printing box and
break hint to drive indentation and line splitting behavior of the
pretty-printer.
Each different pretty-printing box kind introduces a specific line splitting
policy:
- within an {e horizontal} box, break hints never split the line (but the
line may be split in a box nested deeper),
- within a {e vertical} box, break hints always split the line,
- within an {e horizontal/vertical} box, if the box fits on the current line
then break hints never split the line, otherwise break hint always split
the line,
- within a {e compacting} box, a break hint never splits the line,
unless there is no more room on the current line.
Note that line splitting policy is box specific: the policy of a box does
not rule the policy of inner boxes. For instance, if a vertical box is
nested in an horizontal box, all break hints within the vertical box will
split the line.
*)valpp_open_box:formatter->int->unit(** [pp_open_box ppf d] opens a new compacting pretty-printing box with
offset [d] in the formatter [ppf].
Within this box, the pretty-printer prints as much as possible material on
every line.
A break hint splits the line if there is no more room on the line to
print the remainder of the box.
Within this box, the pretty-printer emphasizes the box structure: a break
hint also splits the line if the splitting ``moves to the left''
(i.e. the new line gets an indentation smaller than the one of the current
line).
This box is the general purpose pretty-printing box.
If the pretty-printer splits the line in the box, offset [d] is added to
the current indentation.
*)valpp_close_box:formatter->unit->unit(** Closes the most recently open pretty-printing box. *)valpp_open_hbox:formatter->unit->unit(** [pp_open_hbox ppf ()] opens a new 'horizontal' pretty-printing box.
This box prints material on a single line.
Break hints in a horizontal box never split the line.
(Line splitting may still occur inside boxes nested deeper).
*)valpp_open_vbox:formatter->int->unit(** [pp_open_vbox ppf d] opens a new 'vertical' pretty-printing box
with offset [d].
This box prints material on as many lines as break hints in the box.
Every break hint in a vertical box splits the line.
If the pretty-printer splits the line in the box, [d] is added to the
current indentation.
*)valpp_open_hvbox:formatter->int->unit(** [pp_open_hvbox ppf d] opens a new 'horizontal/vertical' pretty-printing box
with offset [d].
This box behaves as an horizontal box if it fits on a single line,
otherwise it behaves as a vertical box.
If the pretty-printer splits the line in the box, [d] is added to the
current indentation.
*)valpp_open_hovbox:formatter->int->unit(** [pp_open_hovbox ppf d] opens a new 'horizontal-or-vertical'
pretty-printing box with offset [d].
This box prints material as much as possible on every line.
A break hint splits the line if there is no more room on the line to
print the remainder of the box.
If the pretty-printer splits the line in the box, [d] is added to the
current indentation.
*)(** {1 Formatting functions} *)valpp_print_string:formatter->string->unit(** [pp_print_string ppf s] prints [s] in the current pretty-printing box. *)valpp_print_as:formatter->int->string->unit(** [pp_print_as ppf len s] prints [s] in the current pretty-printing box.
The pretty-printer formats [s] as if it were of length [len].
*)valpp_print_int:formatter->int->unit(** Print an integer in the current pretty-printing box. *)valpp_print_char:formatter->char->unit(** Print a character in the current pretty-printing box. *)valpp_print_bool:formatter->bool->unit(** Print a boolean in the current pretty-printing box. *)(** {1:breaks Break hints} *)(** A 'break hint' tells the pretty-printer to output some space or split the
line whichever way is more appropriate to the current pretty-printing box
splitting rules.
Break hints are used to separate printing items and are mandatory to let
the pretty-printer correctly split lines and indent items.
Simple break hints are:
- the 'space': output a space or split the line if appropriate,
- the 'cut': split the line if appropriate.
Note: the notions of space and line splitting are abstract for the
pretty-printing engine, since those notions can be completely redefined
by the programmer.
However, in the pretty-printer default setting, ``output a space'' simply
means printing a space character (ASCII code 32) and ``split the line''
means printing a newline character (ASCII code 10).
*)valpp_print_space:formatter->unit->unit(** [pp_print_space ppf ()] emits a 'space' break hint:
the pretty-printer may split the line at this point,
otherwise it prints one space.
[pp_print_space ppf ()] is equivalent to [pp_print_break ppf 1 0].
*)valpp_print_cut:formatter->unit->unit(** [pp_print_cut ppf ()] emits a 'cut' break hint:
the pretty-printer may split the line at this point,
otherwise it prints nothing.
[pp_print_cut ppf ()] is equivalent to [pp_print_break ppf 0 0].
*)valpp_print_break:formatter->int->int->unit(** [pp_print_break ppf nspaces offset] emits a 'full' break hint:
the pretty-printer may split the line at this point,
otherwise it prints [nspaces] spaces.
If the pretty-printer splits the line, [offset] is added to
the current indentation.
*)valpp_print_custom_break:formatter->fits:(string*int*string)->breaks:(string*int*string)->unit(** [pp_print_custom_break ppf ~fits:(s1, n, s2) ~breaks:(s3, m, s4)] emits a
custom break hint: the pretty-printer may split the line at this point.
If it does not split the line, then the [s1] is emitted, then [n] spaces,
then [s2].
If it splits the line, then it emits the [s3] string, then an indent
(according to the box rules), then an offset of [m] spaces, then the [s4]
string.
While [n] and [m] are handled by [formatter_out_functions.out_indent], the
strings will be handled by [formatter_out_functions.out_string]. This allows
for a custom formatter that handles indentation distinctly, for example,
outputs [<br/>] tags or [ ] entities.
The custom break is useful if you want to change which visible
(non-whitespace) characters are printed in case of break or no break. For
example, when printing a list [ [a; b; c] ], you might want to add a
trailing semicolon when it is printed vertically:
{[
[
a;
b;
c;
]
]}
You can do this as follows:
{[
printf "@[<v 0>[@;<0 2>@[<v 0>a;@,b;@,c@]%t]@]@\n"
(pp_print_custom_break ~fits:("", 0, "") ~breaks:(";", 0, ""))
]}
@since 4.08.0
*)valpp_force_newline:formatter->unit->unit(** Force a new line in the current pretty-printing box.
The pretty-printer must split the line at this point,
Not the normal way of pretty-printing, since imperative line splitting may
interfere with current line counters and box size calculation.
Using break hints within an enclosing vertical box is a better
alternative.
*)valpp_print_if_newline:formatter->unit->unit(** Execute the next formatting command if the preceding line
has just been split. Otherwise, ignore the next formatting
command.
*)(** {1 Pretty-printing termination} *)valpp_print_flush:formatter->unit->unit(** End of pretty-printing: resets the pretty-printer to initial state.
All open pretty-printing boxes are closed, all pending text is printed.
In addition, the pretty-printer low level output device is flushed to
ensure that all pending text is really displayed.
Note: never use [print_flush] in the normal course of a pretty-printing
routine, since the pretty-printer uses a complex buffering machinery to
properly indent the output; manually flushing those buffers at random
would conflict with the pretty-printer strategy and result to poor
rendering.
Only consider using [print_flush] when displaying all pending material is
mandatory (for instance in case of interactive use when you want the user
to read some text) and when resetting the pretty-printer state will not
disturb further pretty-printing.
Warning: If the output device of the pretty-printer is an output channel,
repeated calls to [print_flush] means repeated calls to {!Stdlib.flush}
to flush the out channel; these explicit flush calls could foil the
buffering strategy of output channels and could dramatically impact
efficiency.
*)valpp_print_newline:formatter->unit->unit(** End of pretty-printing: resets the pretty-printer to initial state.
All open pretty-printing boxes are closed, all pending text is printed.
Equivalent to {!print_flush} followed by a new line.
See corresponding words of caution for {!print_flush}.
Note: this is not the normal way to output a new line;
the preferred method is using break hints within a vertical pretty-printing
box.
*)(** {1 Margin} *)valpp_set_margin:formatter->int->unit(** [pp_set_margin ppf d] sets the right margin to [d] (in characters):
the pretty-printer splits lines that overflow the right margin according to
the break hints given.
Nothing happens if [d] is smaller than 2.
If [d] is too large, the right margin is set to the maximum
admissible value (which is greater than [10 ^ 9]).
If [d] is less than the current maximum indentation limit, the
maximum indentation limit is decreased while trying to preserve
a minimal ratio [max_indent/margin>=50%] and if possible
the current difference [margin - max_indent].
See also {!pp_set_geometry}.
*)valpp_get_margin:formatter->unit->int(** Returns the position of the right margin. *)(** {1 Maximum indentation limit} *)valpp_set_max_indent:formatter->int->unit(** [pp_set_max_indent ppf d] sets the maximum indentation limit of lines
to [d] (in characters):
once this limit is reached, new pretty-printing boxes are rejected to the
left, unless the enclosing box fully fits on the current line.
As an illustration,
{[ set_margin 10; set_max_indent 5; printf "@[123456@[7@]89A@]@." ]}
yields
{[
123456
789A
]}
because the nested box ["@[7@]"] is opened after the maximum indentation
limit ([7>5]) and its parent box does not fit on the current line.
Either decreasing the length of the parent box to make it fit on a line:
{[ printf "@[123456@[7@]89@]@." ]}
or opening an intermediary box before the maximum indentation limit which
fits on the current line
{[ printf "@[123@[456@[7@]89@]A@]@." ]}
avoids the rejection to the left of the inner boxes and print respectively
["123456789"] and ["123456789A"] .
Note also that vertical boxes never fit on a line whereas horizontal boxes
always fully fit on the current line.
Nothing happens if [d] is smaller than 2.
If [d] is too large, the limit is set to the maximum
admissible value (which is greater than [10 ^ 9]).
If [d] is greater or equal than the current margin, it is ignored,
and the current maximum indentation limit is kept.
See also {!pp_set_geometry}.
*)valpp_get_max_indent:formatter->unit->int(** Return the maximum indentation limit (in characters). *)(** {1 Maximum formatting depth} *)(** The maximum formatting depth is the maximum number of pretty-printing
boxes simultaneously open.
Material inside boxes nested deeper is printed as an ellipsis (more
precisely as the text returned by {!get_ellipsis_text} [()]).
*)valpp_set_max_boxes:formatter->int->unit(** [pp_set_max_boxes ppf max] sets the maximum number of pretty-printing
boxes simultaneously open.
Material inside boxes nested deeper is printed as an ellipsis (more
precisely as the text returned by {!get_ellipsis_text} [()]).
Nothing happens if [max] is smaller than 2.
*)valpp_get_max_boxes:formatter->unit->int(** Returns the maximum number of pretty-printing boxes allowed before
ellipsis.
*)valpp_over_max_boxes:formatter->unit->bool(** Tests if the maximum number of pretty-printing boxes allowed have already
been opened.
*)(** {1 Tabulation boxes} *)(**
A {e tabulation box} prints material on lines divided into cells of fixed
length. A tabulation box provides a simple way to display vertical columns
of left adjusted text.
This box features command [set_tab] to define cell boundaries, and command
[print_tab] to move from cell to cell and split the line when there is no
more cells to print on the line.
Note: printing within tabulation box is line directed, so arbitrary line
splitting inside a tabulation box leads to poor rendering. Yet, controlled
use of tabulation boxes allows simple printing of columns within
module {!Format}.
*)valpp_open_tbox:formatter->unit->unit(** [open_tbox ()] opens a new tabulation box.
This box prints lines separated into cells of fixed width.
Inside a tabulation box, special {e tabulation markers} defines points of
interest on the line (for instance to delimit cell boundaries).
Function {!Format.set_tab} sets a tabulation marker at insertion point.
A tabulation box features specific {e tabulation breaks} to move to next
tabulation marker or split the line. Function {!Format.print_tbreak} prints
a tabulation break.
*)valpp_close_tbox:formatter->unit->unit(** Closes the most recently opened tabulation box. *)valpp_set_tab:formatter->unit->unit(** Sets a tabulation marker at current insertion point. *)valpp_print_tab:formatter->unit->unit(** [print_tab ()] emits a 'next' tabulation break hint: if not already set on
a tabulation marker, the insertion point moves to the first tabulation
marker on the right, or the pretty-printer splits the line and insertion
point moves to the leftmost tabulation marker.
It is equivalent to [print_tbreak 0 0]. *)valpp_print_tbreak:formatter->int->int->unit(** [print_tbreak nspaces offset] emits a 'full' tabulation break hint.
If not already set on a tabulation marker, the insertion point moves to the
first tabulation marker on the right and the pretty-printer prints
[nspaces] spaces.
If there is no next tabulation marker on the right, the pretty-printer
splits the line at this point, then insertion point moves to the leftmost
tabulation marker of the box.
If the pretty-printer splits the line, [offset] is added to
the current indentation.
*)(** {1 Ellipsis} *)valpp_set_ellipsis_text:formatter->string->unit(** Set the text of the ellipsis printed when too many pretty-printing boxes
are open (a single dot, [.], by default).
*)valpp_get_ellipsis_text:formatter->unit->string(** Return the text of the ellipsis. *)(** {1 Convenience formatting functions.} *)valpp_print_list:?pp_sep:(formatter->unit->unit)->(formatter->'a->unit)->(formatter->'alist->unit)(** [pp_print_list ?pp_sep pp_v ppf l] prints items of list [l],
using [pp_v] to print each item, and calling [pp_sep]
between items ([pp_sep] defaults to {!pp_print_cut}.
Does nothing on empty lists.
@since 4.02.0
*)valpp_print_text:formatter->string->unit(** [pp_print_text ppf s] prints [s] with spaces and newlines respectively
printed using {!pp_print_space} and {!pp_force_newline}.
@since 4.02.0
*)valpp_print_option:?none:(formatter->unit->unit)->(formatter->'a->unit)->(formatter->'aoption->unit)(** [pp_print_option ?none pp_v ppf o] prints [o] on [ppf]
using [pp_v] if [o] is [Some v] and [none] if it is [None]. [none]
prints nothing by default.
@since 4.08 *)valpp_print_result:ok:(formatter->'a->unit)->error:(formatter->'e->unit)->formatter->('a,'e)result->unit(** [pp_print_result ~ok ~error ppf r] prints [r] on [ppf] using
[ok] if [r] is [Ok _] and [error] if [r] is [Error _].
@since 4.08 *)(** {1:fpp Formatted pretty-printing} *)(**
Module [Format] provides a complete set of [printf] like functions for
pretty-printing using format string specifications.
Specific annotations may be added in the format strings to give
pretty-printing commands to the pretty-printing engine.
Those annotations are introduced in the format strings using the [@]
character. For instance, [@ ] means a space break, [@,] means a cut,
[@\[] opens a new box, and [@\]] closes the last open box.
*)valfprintf:formatter->('a,formatter,unit)format->'a(** [fprintf ff fmt arg1 ... argN] formats the arguments [arg1] to [argN]
according to the format string [fmt], and outputs the resulting string on
the formatter [ff].
The format string [fmt] is a character string which contains three types of
objects: plain characters and conversion specifications as specified in
the {!Printf} module, and pretty-printing indications specific to the
[Format] module.
The pretty-printing indication characters are introduced by
a [@] character, and their meanings are:
- [@\[]: open a pretty-printing box. The type and offset of the
box may be optionally specified with the following syntax:
the [<] character, followed by an optional box type indication,
then an optional integer offset, and the closing [>] character.
Pretty-printing box type is one of [h], [v], [hv], [b], or [hov].
'[h]' stands for an 'horizontal' pretty-printing box,
'[v]' stands for a 'vertical' pretty-printing box,
'[hv]' stands for an 'horizontal/vertical' pretty-printing box,
'[b]' stands for an 'horizontal-or-vertical' pretty-printing box
demonstrating indentation,
'[hov]' stands a simple 'horizontal-or-vertical' pretty-printing box.
For instance, [@\[<hov 2>] opens an 'horizontal-or-vertical'
pretty-printing box with indentation 2 as obtained with [open_hovbox 2].
For more details about pretty-printing boxes, see the various box opening
functions [open_*box].
- [@\]]: close the most recently opened pretty-printing box.
- [@,]: output a 'cut' break hint, as with [print_cut ()].
- [@ ]: output a 'space' break hint, as with [print_space ()].
- [@;]: output a 'full' break hint as with [print_break]. The
[nspaces] and [offset] parameters of the break hint may be
optionally specified with the following syntax:
the [<] character, followed by an integer [nspaces] value,
then an integer [offset], and a closing [>] character.
If no parameters are provided, the good break defaults to a
'space' break hint.
- [@.]: flush the pretty-printer and split the line, as with
[print_newline ()].
- [@<n>]: print the following item as if it were of length [n].
Hence, [printf "@<0>%s" arg] prints [arg] as a zero length string.
If [@<n>] is not followed by a conversion specification,
then the following character of the format is printed as if
it were of length [n].
- [@\{]: open a semantic tag. The name of the tag may be optionally
specified with the following syntax:
the [<] character, followed by an optional string
specification, and the closing [>] character. The string
specification is any character string that does not contain the
closing character ['>']. If omitted, the tag name defaults to the
empty string.
For more details about semantic tags, see the functions {!open_stag} and
{!close_stag}.
- [@\}]: close the most recently opened semantic tag.
- [@?]: flush the pretty-printer as with [print_flush ()].
This is equivalent to the conversion [%!].
- [@\n]: force a newline, as with [force_newline ()], not the normal way
of pretty-printing, you should prefer using break hints inside a vertical
pretty-printing box.
Note: To prevent the interpretation of a [@] character as a
pretty-printing indication, escape it with a [%] character.
Old quotation mode [@@] is deprecated since it is not compatible with
formatted input interpretation of character ['@'].
Example: [printf "@[%s@ %d@]@." "x =" 1] is equivalent to
[open_box (); print_string "x ="; print_space ();
print_int 1; close_box (); print_newline ()].
It prints [x = 1] within a pretty-printing 'horizontal-or-vertical' box.
*)valsprintf:('a,unit,string)format->'a(** Same as [printf] above, but instead of printing on a formatter,
returns a string containing the result of formatting the arguments.
Note that the pretty-printer queue is flushed at the end of {e each
call} to [sprintf].
In case of multiple and related calls to [sprintf] to output
material on a single string, you should consider using [fprintf]
with the predefined formatter [str_formatter] and call
[flush_str_formatter ()] to get the final result.
Alternatively, you can use [Format.fprintf] with a formatter writing to a
buffer of your own: flushing the formatter and the buffer at the end of
pretty-printing returns the desired string.
*)valasprintf:('a,formatter,unit,string)format4->'a(** Same as [printf] above, but instead of printing on a formatter,
returns a string containing the result of formatting the arguments.
The type of [asprintf] is general enough to interact nicely with [%a]
conversions.
@since 4.01.0
*)valdprintf:('a,formatter,unit,formatter->unit)format4->'a(** Same as {!fprintf}, except the formatter is the last argument.
[dprintf "..." a b c] is a function of type
[formatter -> unit] which can be given to a format specifier [%t].
This can be used as a replacement for {!asprintf} to delay
formatting decisions. Using the string returned by {!asprintf} in a
formatting context forces formatting decisions to be taken in
isolation, and the final string may be created
prematurely. {!dprintf} allows delay of formatting decisions until
the final formatting context is known.
For example:
{[
let t = Format.dprintf "%i@ %i@ %i" 1 2 3 in
...
Format.printf "@[<v>%t@]" t
]}
@since 4.08.0
*)valifprintf:formatter->('a,formatter,unit)format->'a(** Same as [fprintf] above, but does not print anything.
Useful to ignore some material when conditionally printing.
@since 3.10.0
*)(** Formatted Pretty-Printing with continuations. *)valkfprintf:(formatter->'a)->formatter->('b,formatter,unit,'a)format4->'b(** Same as [fprintf] above, but instead of returning immediately,
passes the formatter to its first argument at the end of printing. *)valkdprintf:((formatter->unit)->'a)->('b,formatter,unit,'a)format4->'b(** Same as {!dprintf} above, but instead of returning immediately,
passes the suspended printer to its first argument at the end of printing.
@since 4.08.0
*)valikfprintf:(formatter->'a)->formatter->('b,formatter,unit,'a)format4->'b(** Same as [kfprintf] above, but does not print anything.
Useful to ignore some material when conditionally printing.
@since 3.12.0
*)valksprintf:(string->'a)->('b,unit,string,'a)format4->'b(** Same as [sprintf] above, but instead of returning the string,
passes it to the first argument. *)valkasprintf:(string->'a)->('b,formatter,unit,'a)format4->'b(** Same as [asprintf] above, but instead of returning the string,
passes it to the first argument.
@since 4.03
*)end# 22 "v1.in.ml"moduleHex:sig# 1 "v1/hex.mli"(*
* Copyright (c) 2015 Trevor Summers Smith <trevorsummerssmith@gmail.com>
* Copyright (c) 2014 Thomas Gazagnaire <thomas@gazagnaire.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)(** Hexadecimal encoding.
[Hex] defines hexadecimal encodings for {{!char}characters},
{{!string}strings} and {{!cstruct}Cstruct.t} buffers. *)typet=[`Hexofstring](** The type var hexadecimal values. *)(** {1:char Characters} *)valof_char:char->char*char(** [of_char c] is the the hexadecimal encoding of the character
[c]. *)valto_char:char->char->char(** [to_char x y] is the character corresponding to the [xy]
hexadecimal encoding. *)(** {1:string Strings} *)valof_string:?ignore:charlist->string->t(** [of_string s] is the hexadecimal representation of the binary
string [s]. If [ignore] is set, skip the characters in the list
when converting. Eg [of_string ~ignore:[' '] "a f"]. The default
value of [ignore] is [[]]). *)valto_string:t->string(** [to_string t] is the binary string [s] such that [of_string s] is
[t]. *)(** {1:byte Bytes} *)valof_bytes:?ignore:charlist->bytes->t(** [of_bytes s] is the hexadecimal representation of the binary
string [s]. If [ignore] is set, skip the characters in the list
when converting. Eg [of_bytes ~ignore:[' '] "a f"]. The default
value of [ignore] is [[]]). *)valto_bytes:t->bytes(** [to_bytes t] is the binary string [s] such that [of_bytes s] is
[t]. *)(** {1 Debugging} *)valhexdump_s:?print_row_numbers:bool->?print_chars:bool->t->string(** Same as [hexdump] except returns a string. *)(** {1 Pretty printing} *)valpp:Format.formatter->t->unit[@@ocaml.toplevel_printer](** [pp fmt t] will output a human-readable hex representation of [t]
to the formatter [fmt]. *)valshow:t->string(** [show t] will return a human-readable hex representation of [t] as
a string. *)end# 24 "v1.in.ml"moduleZ:sig# 1 "v1/z.mli"(* This file was automatically generated by z_pp.pl from z.mlip *)(**
Integers.
This modules provides arbitrary-precision integers.
Small integers internally use a regular OCaml [int].
When numbers grow too large, we switch transparently to GMP numbers
([mpn] numbers fully allocated on the OCaml heap).
This interface is rather similar to that of [Int32] and [Int64],
with some additional functions provided natively by GMP
(GCD, square root, pop-count, etc.).
This file is part of the Zarith library
http://forge.ocamlcore.org/projects/zarith .
It is distributed under LGPL 2 licensing, with static linking exception.
See the LICENSE file included in the distribution.
Copyright (c) 2010-2011 Antoine Miné, Abstraction project.
Abstraction is part of the LIENS (Laboratoire d'Informatique de l'ENS),
a joint laboratory by:
CNRS (Centre national de la recherche scientifique, France),
ENS (École normale supérieure, Paris, France),
INRIA Rocquencourt (Institut national de recherche en informatique, France).
*)(** {1 Toplevel} *)(** For an optimal experience with the [ocaml] interactive toplevel,
the magic commands are:
{[
#load "zarith.cma";;
#install_printer Z.pp_print;;
]}
Alternatively, using the new [Zarith_top] toplevel module, simply:
{[
#require "zarith.top";;
]}
*)(** {1 Types} *)typet(** Type of integers of arbitrary length. *)exceptionOverflow(** Raised by conversion functions when the value cannot be represented in
the destination type.
*)(** {1 Construction} *)valzero:t(** The number 0. *)valone:t(** The number 1. *)valminus_one:t(** The number -1. *)externalof_int:int->t="%identity"(** Converts from a base integer. *)externalof_int32:int32->t="ml_z_of_int32"(** Converts from a 32-bit integer. *)externalof_int64:int64->t="ml_z_of_int64"(** Converts from a 64-bit integer. *)valof_string:string->t(** Converts a string to an integer.
An optional [-] prefix indicates a negative number, while a [+]
prefix is ignored.
An optional prefix [0x], [0o], or [0b] (following the optional [-]
or [+] prefix) indicates that the number is,
represented, in hexadecimal, octal, or binary, respectively.
Otherwise, base 10 is assumed.
(Unlike C, a lone [0] prefix does not denote octal.)
Raises an [Invalid_argument] exception if the string is not a
syntactically correct representation of an integer.
*)valof_substring:string->pos:int->len:int->t(** [of_substring s ~pos ~len] is the same as [of_string (String.sub s
pos len)]
*)valof_string_base:int->string->t(** Parses a number represented as a string in the specified base,
with optional [-] or [+] prefix.
The base must be between 2 and 16.
*)externalof_substring_base:int->string->pos:int->len:int->t="ml_z_of_substring_base"(** [of_substring_base base s ~pos ~len] is the same as [of_string_base
base (String.sub s pos len)]
*)(** {1 Basic arithmetic operations} *)valsucc:t->t(** Returns its argument plus one. *)valpred:t->t(** Returns its argument minus one. *)valabs:t->t(** Absolute value. *)valneg:t->t(** Unary negation. *)valadd:t->t->t(** Addition. *)valsub:t->t->t(** Subtraction. *)valmul:t->t->t(** Multiplication. *)valdiv:t->t->t(** Integer division. The result is truncated towards zero
and obeys the rule of signs.
Raises [Division_by_zero] if the divisor (second argument) is 0.
*)valrem:t->t->t(** Integer remainder. Can raise a [Division_by_zero].
The result of [rem a b] has the sign of [a], and its absolute value is
strictly smaller than the absolute value of [b].
The result satisfies the equality [a = b * div a b + rem a b].
*)externaldiv_rem:t->t->(t*t)="ml_z_div_rem"(** Computes both the integer quotient and the remainder.
[div_rem a b] is equal to [(div a b, rem a b)].
Raises [Division_by_zero] if [b = 0].
*)externalcdiv:t->t->t="ml_z_cdiv"(** Integer division with rounding towards +oo (ceiling).
Can raise a [Division_by_zero].
*)externalfdiv:t->t->t="ml_z_fdiv"(** Integer division with rounding towards -oo (floor).
Can raise a [Division_by_zero].
*)valediv_rem:t->t->(t*t)(** Euclidean division and remainder. [ediv_rem a b] returns a pair [(q, r)]
such that [a = b * q + r] and [0 <= r < |b|].
Raises [Division_by_zero] if [b = 0].
*)valediv:t->t->t(** Euclidean division. [ediv a b] is equal to [fst (ediv_rem a b)].
The result satisfies [0 <= a - b * ediv a b < |b|].
Raises [Division_by_zero] if [b = 0].
*)valerem:t->t->t(** Euclidean remainder. [erem a b] is equal to [snd (ediv_rem a b)].
The result satisfies [0 <= erem a b < |b|] and
[a = b * ediv a b + erem a b]. Raises [Division_by_zero] if [b = 0].
*)valdivexact:t->t->t(** [divexact a b] divides [a] by [b], only producing correct result when the
division is exact, i.e., when [b] evenly divides [a].
It should be faster than general division.
Can raise a [Division_by_zero].
*)externaldivisible:t->t->bool="ml_z_divisible"(** [divisible a b] returns [true] if [a] is exactly divisible by [b].
Unlike the other division functions, [b = 0] is accepted
(only 0 is considered divisible by 0).
*)externalcongruent:t->t->t->bool="ml_z_congruent"(** [congruent a b c] returns [true] if [a] is congruent to [b] modulo [c].
Unlike the other division functions, [c = 0] is accepted
(only equal numbers are considered equal congruent 0).
*)(** {1 Bit-level operations} *)(** For all bit-level operations, negative numbers are considered in 2's
complement representation, starting with a virtual infinite number of
1s.
*)vallogand:t->t->t(** Bitwise logical and. *)vallogor:t->t->t(** Bitwise logical or. *)vallogxor:t->t->t(** Bitwise logical exclusive or. *)vallognot:t->t(** Bitwise logical negation.
The identity [lognot a]=[-a-1] always hold.
*)valshift_left:t->int->t(** Shifts to the left.
Equivalent to a multiplication by a power of 2.
The second argument must be nonnegative.
*)valshift_right:t->int->t(** Shifts to the right.
This is an arithmetic shift,
equivalent to a division by a power of 2 with rounding towards -oo.
The second argument must be nonnegative.
*)valshift_right_trunc:t->int->t(** Shifts to the right, rounding towards 0.
This is equivalent to a division by a power of 2, with truncation.
The second argument must be nonnegative.
*)externalnumbits:t->int="ml_z_numbits"[@@noalloc](** Returns the number of significant bits in the given number.
If [x] is zero, [numbits x] returns 0. Otherwise,
[numbits x] returns a positive integer [n] such that
[2^{n-1} <= |x| < 2^n]. Note that [numbits] is defined
for negative arguments, and that [numbits (-x) = numbits x]. *)externaltrailing_zeros:t->int="ml_z_trailing_zeros"[@@noalloc](** Returns the number of trailing 0 bits in the given number.
If [x] is zero, [trailing_zeros x] returns [max_int].
Otherwise, [trailing_zeros x] returns a nonnegative integer [n]
which is the largest [n] such that [2^n] divides [x] evenly.
Note that [trailing_zeros] is defined for negative arguments,
and that [trailing_zeros (-x) = trailing_zeros x]. *)valtestbit:t->int->bool(** [testbit x n] return the value of bit number [n] in [x]:
[true] if the bit is 1, [false] if the bit is 0.
Bits are numbered from 0. Raise [Invalid_argument] if [n]
is negative. *)externalpopcount:t->int="ml_z_popcount"(** Counts the number of bits set.
Raises [Overflow] for negative arguments, as those have an infinite
number of bits set.
*)externalhamdist:t->t->int="ml_z_hamdist"(** Counts the number of different bits.
Raises [Overflow] if the arguments have different signs
(in which case the distance is infinite).
*)(** {1 Conversions} *)(** Note that, when converting to an integer type that cannot represent the
converted value, an [Overflow] exception is raised.
*)valto_int:t->int(** Converts to a base integer. May raise [Overflow]. *)externalto_int32:t->int32="ml_z_to_int32"(** Converts to a 32-bit integer. May raise [Overflow]. *)externalto_int64:t->int64="ml_z_to_int64"(** Converts to a 64-bit integer. May raise [Overflow]. *)valto_string:t->string(** Gives a human-readable, decimal string representation of the argument. *)externalformat:string->t->string="ml_z_format"(** Gives a string representation of the argument in the specified
printf-like format.
The general specification has the following form:
[% \[flags\] \[width\] type]
Where the type actually indicates the base:
- [i], [d], [u]: decimal
- [b]: binary
- [o]: octal
- [x]: lowercase hexadecimal
- [X]: uppercase hexadecimal
Supported flags are:
- [+]: prefix positive numbers with a [+] sign
- space: prefix positive numbers with a space
- [-]: left-justify (default is right justification)
- [0]: pad with zeroes (instead of spaces)
- [#]: alternate formatting (actually, simply output a literal-like prefix: [0x], [0b], [0o])
Unlike the classic [printf], all numbers are signed (even hexadecimal ones),
there is no precision field, and characters that are not part of the format
are simply ignored (and not copied in the output).
*)externalfits_int:t->bool="ml_z_fits_int"[@@noalloc](** Whether the argument fits in a regular [int]. *)externalfits_int32:t->bool="ml_z_fits_int32"[@@noalloc](** Whether the argument fits in an [int32]. *)externalfits_int64:t->bool="ml_z_fits_int64"[@@noalloc](** Whether the argument fits in an [int64]. *)(** {1 Printing} *)valpp_print:Format.formatter->t->unit(** Prints the argument on the specified formatter.
Can be used as [%a] format printer in [Format.printf] and as
argument to [#install_printer] in the top-level.
*)(** {1 Ordering} *)externalcompare:t->t->int="ml_z_compare"[@@noalloc](** Comparison. [compare x y] returns 0 if [x] equals [y],
-1 if [x] is smaller than [y], and 1 if [x] is greater than [y].
Note that Pervasive.compare can be used to compare reliably two integers
only on OCaml 3.12.1 and later versions.
*)externalequal:t->t->bool="ml_z_equal"[@@noalloc](** Equality test. *)valleq:t->t->bool(** Less than or equal. *)valgeq:t->t->bool(** Greater than or equal. *)vallt:t->t->bool(** Less than (and not equal). *)valgt:t->t->bool(** Greater than (and not equal). *)externalsign:t->int="ml_z_sign"[@@noalloc](** Returns -1, 0, or 1 when the argument is respectively negative, null, or
positive.
*)valmin:t->t->t(** Returns the minimum of its arguments. *)valmax:t->t->t(** Returns the maximum of its arguments. *)valis_even:t->bool(** Returns true if the argument is even (divisible by 2), false if odd. *)valis_odd:t->bool(** Returns true if the argument is odd, false if even. *)(** {1 Powers} *)externalpow:t->int->t="ml_z_pow"(** [pow base exp] raises [base] to the [exp] power.
[exp] must be nonnegative.
Note that only exponents fitting in a machine integer are supported, as
larger exponents would surely make the result's size overflow the
address space.
*)externalsqrt:t->t="ml_z_sqrt"(** Returns the square root. The result is truncated (rounded down
to an integer).
Raises an [Invalid_argument] on negative arguments.
*)externalsqrt_rem:t->(t*t)="ml_z_sqrt_rem"(** Returns the square root truncated, and the remainder.
Raises an [Invalid_argument] on negative arguments.
*)externalroot:t->int->t="ml_z_root"(** [root x n] computes the [n]-th root of [x].
[n] must be positive and, if [n] is even, then [x] must be nonnegative.
Otherwise, an [Invalid_argument] is raised.
*)externalrootrem:t->int->t*t="ml_z_rootrem"(** [rootrem x n] computes the [n]-th root of [x] and the remainder
[x-root**n].
[n] must be positive and, if [n] is even, then [x] must be nonnegative.
Otherwise, an [Invalid_argument] is raised.
*)externalperfect_power:t->bool="ml_z_perfect_power"(** True if the argument has the form [a^b], with [b>1] *)externalperfect_square:t->bool="ml_z_perfect_square"(** True if the argument has the form [a^2]. *)vallog2:t->int(** Returns the base-2 logarithm of its argument, rounded down to
an integer. If [x] is positive, [log2 x] returns the largest [n]
such that [2^n <= x]. If [x] is negative or zero, [log2 x] raise
the [Invalid_argument] exception. *)vallog2up:t->int(** Returns the base-2 logarithm of its argument, rounded up to
an integer. If [x] is positive, [log2up x] returns the smallest [n]
such that [x <= 2^n]. If [x] is negative or zero, [log2up x] raise
the [Invalid_argument] exception. *)(** {1 Representation} *)externalsize:t->int="ml_z_size"[@@noalloc](** Returns the number of machine words used to represent the number. *)externalextract:t->int->int->t="ml_z_extract"(** [extract a off len] returns a nonnegative number corresponding to bits
[off] to [off]+[len]-1 of [b].
Negative [a] are considered in infinite-length 2's complement
representation.
*)valsigned_extract:t->int->int->t(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b],
as [extract] does, then sign-extends bit [len-1] of the result
(that is, bit [off + len - 1] of [a]). The result is between
[- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded),
and equal to [extract a off len] modulo [2{^len}].
*)externalto_bits:t->string="ml_z_to_bits"(** Returns a binary representation of the argument.
The string result should be interpreted as a sequence of bytes,
corresponding to the binary representation of the absolute value of
the argument in little endian ordering.
The sign is not stored in the string.
*)externalof_bits:string->t="ml_z_of_bits"(** Constructs a number from a binary string representation.
The string is interpreted as a sequence of bytes in little endian order,
and the result is always positive.
We have the identity: [of_bits (to_bits x) = abs x].
However, we can have [to_bits (of_bits s) <> s] due to the presence of
trailing zeros in s.
*)end# 26 "v1.in.ml"moduleLwt:sig# 1 "v1/lwt.mli"(* This file is part of Lwt, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. *)(** {2 Fundamentals} *)(** {3 Promises} *)type+'at(** Promises for values of type ['a].
A {b promise} is a memory cell that is always in one of three {b states}:
- {e fulfilled}, and containing one value of type ['a],
- {e rejected}, and containing one exception, or
- {e pending}, in which case it may become fulfilled or rejected later.
A {e resolved} promise is one that is either fulfilled or rejected, i.e. not
pending. Once a promise is resolved, its content cannot change. So, promises
are {e write-once references}. The only possible state changes are (1) from
pending to fulfilled and (2) from pending to rejected.
Promises are typically “read” by attaching {b callbacks} to them. The most
basic functions for that are {!Lwt.bind}, which attaches a callback that is
called when a promise becomes fulfilled, and {!Lwt.catch}, for rejection.
Promise variables of this type, ['a Lwt.t], are actually {b read-only} in
Lwt. Separate {e resolvers} of type ['a ]{!Lwt.u} are used to write to them.
Promises and their resolvers are created together by calling {!Lwt.wait}.
There is one exception to this: most promises can be {e canceled} by calling
{!Lwt.cancel}, without going through a resolver. *)valreturn:'a->'at(** [Lwt.return v] creates a new {{: #TYPEt} promise} that is {e already
fulfilled} with value [v].
This is needed to satisfy the type system in some cases. For example, in a
[match] expression where one case evaluates to a promise, the other cases
have to evaluate to promises as well:
{[
match need_input with
| true -> Lwt_io.(read_line stdin) (* Has type string Lwt.t... *)
| false -> Lwt.return "" (* ...so wrap empty string in a promise. *)
]}
Another typical usage is in {{: #VALbind} [let%lwt]}. The expression after
the “[in]” has to evaluate to a promise. So, if you compute an ordinary
value instead, you have to wrap it:
{[
let%lwt line = Lwt_io.(read_line stdin) in
Lwt.return (line ^ ".")
]} *)(** {3 Callbacks} *)valbind:'at->('a->'bt)->'bt(** [Lwt.bind p_1 f] makes it so that [f] will run when [p_1] is {{: #TYPEt}
{e fulfilled}}.
When [p_1] is fulfilled with value [v_1], the callback [f] is called with
that same value [v_1]. Eventually, after perhaps starting some I/O or other
computation, [f] returns promise [p_2].
[Lwt.bind] itself returns immediately. It only attaches the callback [f] to
[p_1] – it does not wait for [p_2]. {e What} [Lwt.bind] returns is yet a
third promise, [p_3]. Roughly speaking, fulfillment of [p_3] represents both
[p_1] and [p_2] becoming fulfilled, one after the other.
A minimal example of this is an echo program:
{[
let () =
let p_3 =
Lwt.bind
Lwt_io.(read_line stdin)
(fun line -> Lwt_io.printl line)
in
Lwt_main.run p_3
(* ocamlfind opt -linkpkg -thread -package lwt.unix code.ml && ./a.out *)
]}
Rejection of [p_1] and [p_2], and raising an exception in [f], are all
forwarded to rejection of [p_3].
{b Precise behavior}
[Lwt.bind] returns a promise [p_3] immediately. [p_3] starts out pending,
and is resolved as follows:
- The first condition to wait for is that [p_1] becomes resolved. It does
not matter whether [p_1] is already resolved when [Lwt.bind] is called, or
becomes resolved later – the rest of the behavior is the same.
- If and when [p_1] becomes resolved, it will, by definition, be either
fulfilled or rejected.
- If [p_1] is rejected, [p_3] is rejected with the same exception.
- If [p_1] is fulfilled, with value [v], [f] is applied to [v].
- [f] may finish by returning the promise [p_2], or raising an exception.
- If [f] raises an exception, [p_3] is rejected with that exception.
- Finally, the remaining case is when [f] returns [p_2]. From that point on,
[p_3] is effectively made into a reference to [p_2]. This means they have
the same state, undergo the same state changes, and performing any
operation on one is equivalent to performing it on the other.
{b Syntactic sugar}
[Lwt.bind] is almost never written directly, because sequences of [Lwt.bind]
result in growing indentation and many parentheses:
{[
let () =
Lwt_main.run begin
Lwt.bind Lwt_io.(read_line stdin) (fun line ->
Lwt.bind (Lwt_unix.sleep 1.) (fun () ->
Lwt_io.printf "One second ago, you entered %s\n" line))
end
(* ocamlfind opt -linkpkg -thread -package lwt.unix code.ml && ./a.out *)
]}
The recommended way to write [Lwt.bind] is using the [let%lwt] syntactic
sugar:
{[
let () =
Lwt_main.run begin
let%lwt line = Lwt_io.(read_line stdin) in
let%lwt () = Lwt_unix.sleep 1. in
Lwt_io.printf "One second ago, you entered %s\n" line
end
(* ocamlfind opt -linkpkg -thread -package lwt_ppx,lwt.unix code.ml && ./a.out *)
]}
This uses the Lwt {{: Ppx_lwt.html} PPX} (preprocessor). Note that we had to
add package [lwt_ppx] to the command line for building this program. We will
do that throughout this manual.
Another way to write [Lwt.bind], that you may encounter while reading code,
is with the [>>=] operator:
{[
open Lwt.Infix
let () =
Lwt_main.run begin
Lwt_io.(read_line stdin) >>= fun line ->
Lwt_unix.sleep 1. >>= fun () ->
Lwt_io.printf "One second ago, you entered %s\n" line
end
(* ocamlfind opt -linkpkg -thread -package lwt.unix code.ml && ./a.out *)
]}
The [>>=] operator comes from the module {!Lwt.Infix}, which is why we
opened it at the beginning of the program.
See also {!Lwt.map}. *)(** {2 Convenience} *)(** {3 Callback helpers} *)valmap:('a->'b)->'at->'bt(** [Lwt.map f p_1] is similar to {!Lwt.bind}[ p_1 f], but [f] is not expected
to return a promise.
This function is more convenient that {!Lwt.bind} when [f] inherently does
not return a promise. An example is [Stdlib.int_of_string]:
{[
let read_int : unit -> int Lwt.t = fun () ->
Lwt.map
int_of_string
Lwt_io.(read_line stdin)
let () =
Lwt_main.run begin
let%lwt number = read_int () in
Lwt_io.printf "%i\n" number
end
(* ocamlfind opt -linkpkg -thread -package lwt_ppx,lwt.unix code.ml && ./a.out *)
]}
By comparison, the {!Lwt.bind} version is more awkward:
{[
let read_int : unit -> int Lwt.t = fun () ->
Lwt.bind
Lwt_io.(read_line stdin)
(fun line -> Lwt.return (int_of_string line))
]}
As with {!Lwt.bind}, sequences of calls to [Lwt.map] result in excessive
indentation and parentheses. The recommended syntactic sugar for avoiding
this is the {{: #VAL(>|=)} [>|=]} operator, which comes from module
[Lwt.Infix]:
{[
open Lwt.Infix
let read_int : unit -> int Lwt.t = fun () ->
Lwt_io.(read_line stdin) >|= int_of_string
]}
The detailed operation follows. For consistency with the promises in
{!Lwt.bind}, the {e two} promises involved are named [p_1] and [p_3]:
- [p_1] is the promise passed to [Lwt.map].
- [p_3] is the promise returned by [Lwt.map].
[Lwt.map] returns a promise [p_3]. [p_3] starts out pending. It is resolved
as follows:
- [p_1] may be, or become, resolved. In that case, by definition, it will
become fulfilled or rejected. Fulfillment is the interesting case, but the
behavior on rejection is simpler, so we focus on rejection first.
- When [p_1] becomes rejected, [p_3] is rejected with the same exception.
- When [p_1] instead becomes fulfilled, call the value it is fulfilled with
[v].
- [f v] is applied. If this finishes, it may either return another value, or
raise an exception.
- If [f v] returns another value [v'], [p_3] is fulfilled with [v'].
- If [f v] raises exception [exn], [p_3] is rejected with [exn]. *)(** {3 Pre-allocated promises} *)valreturn_unit:unitt(** [Lwt.return_unit] is defined as {!Lwt.return}[ ()], but this definition is
evaluated only once, during initialization of module [Lwt], at the beginning
of your program.
This means the promise is allocated only once. By contrast, each time
{!Lwt.return}[ ()] is evaluated, it allocates a new promise.
It is recommended to use [Lwt.return_unit] only where you know the
allocations caused by an instance of {!Lwt.return}[ ()] are a performance
bottleneck. Generally, the cost of I/O tends to dominate the cost of
{!Lwt.return}[ ()] anyway.
In future Lwt, we hope to perform this optimization, of using a single,
pre-allocated promise, automatically, wherever {!Lwt.return}[ ()] is
written. *)valreturn_none:(_option)t(** [Lwt.return_none] is like {!Lwt.return_unit}, but for
{!Lwt.return}[ None]. *)valreturn_nil:(_list)t(** [Lwt.return_nil] is like {!Lwt.return_unit}, but for {!Lwt.return}[ []]. *)valreturn_true:boolt(** [Lwt.return_true] is like {!Lwt.return_unit}, but for
{!Lwt.return}[ true]. *)valreturn_false:boolt(** [Lwt.return_false] is like {!Lwt.return_unit}, but for
{!Lwt.return}[ false]. *)end# 28 "v1.in.ml"moduleLwt_list:sig# 1 "v1/lwt_list.mli"(* This file is part of Lwt, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. *)(** List helpers *)(** Note: this module use the same naming convention as
{!Lwt_stream}. *)(** {2 List iterators} *)valiter_s:('a->unitLwt.t)->'alist->unitLwt.tvaliteri_s:(int->'a->unitLwt.t)->'alist->unitLwt.tvalmap_s:('a->'bLwt.t)->'alist->'blistLwt.tvalmapi_s:(int->'a->'bLwt.t)->'alist->'blistLwt.tvalrev_map_s:('a->'bLwt.t)->'alist->'blistLwt.tvalfold_left_s:('a->'b->'aLwt.t)->'a->'blist->'aLwt.tvalfold_right_s:('a->'b->'bLwt.t)->'alist->'b->'bLwt.t(** {2 List scanning} *)valfor_all_s:('a->boolLwt.t)->'alist->boolLwt.tvalexists_s:('a->boolLwt.t)->'alist->boolLwt.t(** {2 List searching} *)valfind_s:('a->boolLwt.t)->'alist->'aLwt.tvalfilter_s:('a->boolLwt.t)->'alist->'alistLwt.tvalfilter_map_s:('a->'boptionLwt.t)->'alist->'blistLwt.tvalpartition_s:('a->boolLwt.t)->'alist->('alist*'alist)Lwt.tend# 30 "v1.in.ml"moduleData_encoding:sig# 1 "v1/data_encoding.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** In memory JSON data *)typejson=[`Oof(string*json)list|`Boolofbool|`Floatoffloat|`Aofjsonlist|`Null|`Stringofstring]typejson_schematype'attype'aencoding='atvalclassify:'aencoding->[`Fixedofint|`Dynamic|`Variable]valsplitted:json:'aencoding->binary:'aencoding->'aencodingvalnull:unitencodingvalempty:unitencodingvalunit:unitencodingvalconstant:string->unitencodingvalint8:intencodingvaluint8:intencodingvalint16:intencodingvaluint16:intencodingvalint31:intencodingvalint32:int32encodingvalint64:int64encodingvaln:Z.tencodingvalz:Z.tencodingvalbool:boolencodingvalstring:stringencodingvalbytes:bytesencodingvaloption:'aencoding->'aoptionencodingvalstring_enum:(string*'a)list->'aencodingmoduleFixed:sigvalstring:int->stringencodingvalbytes:int->bytesencodingvaladd_padding:'aencoding->int->'aencodingendmoduleVariable:sigvalstring:stringencodingvalbytes:bytesencodingvalarray:?max_length:int->'aencoding->'aarrayencodingvallist:?max_length:int->'aencoding->'alistencodingendmoduleBounded:sigvalstring:int->stringencodingvalbytes:int->bytesencodingendvaldynamic_size:?kind:[`Uint30|`Uint16|`Uint8]->'aencoding->'aencodingvaljson:jsonencodingvaljson_schema:json_schemaencodingtype'afieldvalreq:?title:string->?description:string->string->'tencoding->'tfieldvalopt:?title:string->?description:string->string->'tencoding->'toptionfieldvalvaropt:?title:string->?description:string->string->'tencoding->'toptionfieldvaldft:?title:string->?description:string->string->'tencoding->'t->'tfieldvalobj1:'f1field->'f1encodingvalobj2:'f1field->'f2field->('f1*'f2)encodingvalobj3:'f1field->'f2field->'f3field->('f1*'f2*'f3)encodingvalobj4:'f1field->'f2field->'f3field->'f4field->('f1*'f2*'f3*'f4)encodingvalobj5:'f1field->'f2field->'f3field->'f4field->'f5field->('f1*'f2*'f3*'f4*'f5)encodingvalobj6:'f1field->'f2field->'f3field->'f4field->'f5field->'f6field->('f1*'f2*'f3*'f4*'f5*'f6)encodingvalobj7:'f1field->'f2field->'f3field->'f4field->'f5field->'f6field->'f7field->('f1*'f2*'f3*'f4*'f5*'f6*'f7)encodingvalobj8:'f1field->'f2field->'f3field->'f4field->'f5field->'f6field->'f7field->'f8field->('f1*'f2*'f3*'f4*'f5*'f6*'f7*'f8)encodingvalobj9:'f1field->'f2field->'f3field->'f4field->'f5field->'f6field->'f7field->'f8field->'f9field->('f1*'f2*'f3*'f4*'f5*'f6*'f7*'f8*'f9)encodingvalobj10:'f1field->'f2field->'f3field->'f4field->'f5field->'f6field->'f7field->'f8field->'f9field->'f10field->('f1*'f2*'f3*'f4*'f5*'f6*'f7*'f8*'f9*'f10)encodingvaltup1:'f1encoding->'f1encodingvaltup2:'f1encoding->'f2encoding->('f1*'f2)encodingvaltup3:'f1encoding->'f2encoding->'f3encoding->('f1*'f2*'f3)encodingvaltup4:'f1encoding->'f2encoding->'f3encoding->'f4encoding->('f1*'f2*'f3*'f4)encodingvaltup5:'f1encoding->'f2encoding->'f3encoding->'f4encoding->'f5encoding->('f1*'f2*'f3*'f4*'f5)encodingvaltup6:'f1encoding->'f2encoding->'f3encoding->'f4encoding->'f5encoding->'f6encoding->('f1*'f2*'f3*'f4*'f5*'f6)encodingvaltup7:'f1encoding->'f2encoding->'f3encoding->'f4encoding->'f5encoding->'f6encoding->'f7encoding->('f1*'f2*'f3*'f4*'f5*'f6*'f7)encodingvaltup8:'f1encoding->'f2encoding->'f3encoding->'f4encoding->'f5encoding->'f6encoding->'f7encoding->'f8encoding->('f1*'f2*'f3*'f4*'f5*'f6*'f7*'f8)encodingvaltup9:'f1encoding->'f2encoding->'f3encoding->'f4encoding->'f5encoding->'f6encoding->'f7encoding->'f8encoding->'f9encoding->('f1*'f2*'f3*'f4*'f5*'f6*'f7*'f8*'f9)encodingvaltup10:'f1encoding->'f2encoding->'f3encoding->'f4encoding->'f5encoding->'f6encoding->'f7encoding->'f8encoding->'f9encoding->'f10encoding->('f1*'f2*'f3*'f4*'f5*'f6*'f7*'f8*'f9*'f10)encodingvalmerge_objs:'o1encoding->'o2encoding->('o1*'o2)encodingvalmerge_tups:'a1encoding->'a2encoding->('a1*'a2)encodingvalarray:?max_length:int->'aencoding->'aarrayencodingvallist:?max_length:int->'aencoding->'alistencodingvalassoc:'aencoding->(string*'a)listencodingtypecase_tag=Tagofint|Json_onlytype'tcasevalcase:title:string->?description:string->case_tag->'aencoding->('t->'aoption)->('a->'t)->'tcasetypetag_size=[`Uint8|`Uint16]valunion:?tag_size:tag_size->'tcaselist->'tencodingvaldef:string->?title:string->?description:string->'tencoding->'tencodingvalconv:('a->'b)->('b->'a)->?schema:json_schema->'bencoding->'aencodingvalmu:string->?title:string->?description:string->('aencoding->'aencoding)->'aencodingtype'alazy_tvallazy_encoding:'aencoding->'alazy_tencodingvalforce_decode:'alazy_t->'aoptionvalforce_bytes:'alazy_t->bytesvalmake_lazy:'aencoding->'a->'alazy_tvalapply_lazy:fun_value:('a->'b)->fun_bytes:(bytes->'b)->fun_combine:('b->'b->'b)->'alazy_t->'bmoduleJson:sigvalschema:?definitions_path:string->'aencoding->json_schemavalconstruct:'tencoding->'t->jsonvaldestruct:'tencoding->json->'t(** JSON Error *)typepath=path_itemlistandpath_item=[`Fieldofstring(** A field in an object. *)|`Indexofint(** An index in an array. *)|`Star(** Any / every field or index. *)|`Next(** The next element after an array. *)](** Exception raised by destructors, with the location in the original
JSON structure and the specific error. *)exceptionCannot_destructof(path*exn)(** Unexpected kind of data encountered (w/ the expectation). *)exceptionUnexpectedofstring*string(** Some {!union} couldn't be destructed, w/ the reasons for each {!type-case}. *)exceptionNo_case_matchedofexnlist(** Array of unexpected size encountered (w/ the expectation). *)exceptionBad_array_sizeofint*int(** Missing field in an object. *)exceptionMissing_fieldofstring(** Supernumerary field in an object. *)exceptionUnexpected_fieldofstringvalprint_error:?print_unknown:(Format.formatter->exn->unit)->Format.formatter->exn->unit(** Helpers for writing encoders. *)valcannot_destruct:('a,Format.formatter,unit,'b)format4->'avalwrap_error:('a->'b)->'a->'bvalpp:Format.formatter->json->unitendmoduleBinary:sigvallength:'aencoding->'a->intvalfixed_length:'aencoding->intoptionvalread:'aencoding->bytes->int->int->(int*'a)optionvalwrite:'aencoding->'a->bytes->int->int->intoptionvalto_bytes:'aencoding->'a->bytesoptionvalto_bytes_exn:'aencoding->'a->bytesvalof_bytes:'aencoding->bytes->'aoptiontypewrite_errorexceptionWrite_errorofwrite_errorend(** [check_size size encoding] ensures that the binary encoding
of a value will not be allowed to exceed [size] bytes. The reader
and the writer fails otherwise. This function do not modify
the JSON encoding. *)valcheck_size:int->'aencoding->'aencodingend# 32 "v1.in.ml"moduleRaw_hashes:sig# 1 "v1/raw_hashes.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)valblake2b:bytes->bytesvalsha256:bytes->bytesvalsha512:bytes->bytesvalkeccak256:bytes->bytesvalsha3_256:bytes->bytesvalsha3_512:bytes->bytesend# 34 "v1.in.ml"moduleCompare:sig# 1 "v1/compare.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)moduletypeCOMPARABLE=sigtypetvalcompare:t->t->intendmoduletypeS=sigtypetval(=):t->t->boolval(<>):t->t->boolval(<):t->t->boolval(<=):t->t->boolval(>=):t->t->boolval(>):t->t->boolvalcompare:t->t->intvalequal:t->t->boolvalmax:t->t->tvalmin:t->t->tendmoduleMake(P:COMPARABLE):Swithtypet:=P.tmoduleChar:Swithtypet=charmoduleBool:Swithtypet=boolmoduleInt:Swithtypet=intmoduleInt32:Swithtypet=int32moduleUint32:Swithtypet=int32moduleInt64:Swithtypet=int64moduleUint64:Swithtypet=int64moduleString:Swithtypet=stringmoduleBytes:Swithtypet=bytesmoduleZ:Swithtypet=Z.tmoduleList(P:COMPARABLE):Swithtypet=P.tlistmoduleOption(P:COMPARABLE):Swithtypet=P.toptionend# 36 "v1.in.ml"moduleError_monad:sig# 1 "v1/error_monad.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typeerror_category=[`Branch|`Temporary|`Permanent](** CORE : errors *)typeerror=..valerror_encoding:errorData_encoding.tvalpp:Format.formatter->error->unit(** EXT : error registration/query *)valregister_error_kind:error_category->id:string->title:string->description:string->?pp:(Format.formatter->'err->unit)->'errData_encoding.t->(error->'erroption)->('err->error)->unitvalclassify_error:error->error_categoryvaljson_of_error:error->Data_encoding.jsonvalerror_of_json:Data_encoding.json->errortypeerror_info={category:error_category;id:string;title:string;description:string;schema:Data_encoding.json_schema;}valpp_info:Format.formatter->error_info->unit(** Retrieves information of registered errors *)valget_registered_errors:unit->error_infolist(** MONAD : trace, monad, etc. *)(* This is concrete for backwards compatibility purpose. However:
- it MUST NEVER be empty
- it is not intended for general use (prefer {!error}, {!fail} and such). *)type'errtrace='errlisttype'atzresult=('a,errortrace)resultvaltrace_encoding:errortraceData_encoding.tvalresult_encoding:'aData_encoding.t->'atzresultData_encoding.tvalok:'a->('a,'trace)resultvalok_unit:(unit,'trace)resultvalok_none:('aoption,'trace)resultvalok_some:'a->('aoption,'trace)resultvalok_nil:('alist,'trace)resultvalok_true:(bool,'trace)resultvalok_false:(bool,'trace)resultvalreturn:'a->('a,'trace)resultLwt.tvalreturn_unit:(unit,'trace)resultLwt.tvalreturn_none:('aoption,'trace)resultLwt.tvalreturn_some:'a->('aoption,'trace)resultLwt.tvalreturn_nil:('alist,'trace)resultLwt.tvalreturn_true:(bool,'trace)resultLwt.tvalreturn_false:(bool,'trace)resultLwt.tvalerror:'err->('a,'errtrace)resultvalfail:'err->('a,'errtrace)resultLwt.tval(>>=):'aLwt.t->('a->'bLwt.t)->'bLwt.tval(>|=):'aLwt.t->('a->'b)->'bLwt.tval(>>?):('a,'trace)result->('a->('b,'trace)result)->('b,'trace)resultval(>|?):('a,'trace)result->('a->'b)->('b,'trace)resultval(>>=?):('a,'trace)resultLwt.t->('a->('b,'trace)resultLwt.t)->('b,'trace)resultLwt.tval(>|=?):('a,'trace)resultLwt.t->('a->'b)->('b,'trace)resultLwt.tval(>>?=):('a,'trace)result->('a->('b,'trace)resultLwt.t)->('b,'trace)resultLwt.tval(>|?=):('a,'trace)result->('a->'bLwt.t)->('b,'trace)resultLwt.tvalrecord_trace:'err->('a,'errtrace)result->('a,'errtrace)resultvaltrace:'err->('b,'errtrace)resultLwt.t->('b,'errtrace)resultLwt.tvalrecord_trace_eval:(unit->('err,'errtrace)result)->('a,'errtrace)result->('a,'errtrace)resultvaltrace_eval:(unit->('err,'errtrace)resultLwt.t)->('b,'errtrace)resultLwt.t->('b,'errtrace)resultLwt.tvalerror_unless:bool->'err->(unit,'errtrace)resultvalerror_when:bool->'err->(unit,'errtrace)resultvalfail_unless:bool->'err->(unit,'errtrace)resultLwt.tvalfail_when:bool->'err->(unit,'errtrace)resultLwt.tvalunless:bool->(unit->(unit,'trace)resultLwt.t)->(unit,'trace)resultLwt.tvalwhen_:bool->(unit->(unit,'trace)resultLwt.t)->(unit,'trace)resultLwt.tvaldont_wait:(exn->unit)->('trace->unit)->(unit->(unit,'trace)resultLwt.t)->unit(* LIST TRAVERSORS *)valiter:('a->(unit,'trace)result)->'alist->(unit,'trace)resultvaliter_s:('a->(unit,'trace)resultLwt.t)->'alist->(unit,'trace)resultLwt.tvalmap:('a->('b,'trace)result)->'alist->('blist,'trace)resultvalmapi:(int->'a->('b,'trace)result)->'alist->('blist,'trace)resultvalmap_s:('a->('b,'trace)resultLwt.t)->'alist->('blist,'trace)resultLwt.tvalrev_map_s:('a->('b,'trace)resultLwt.t)->'alist->('blist,'trace)resultLwt.tvalmapi_s:(int->'a->('b,'trace)resultLwt.t)->'alist->('blist,'trace)resultLwt.tvalmap2:('a->'b->('c,'trace)result)->'alist->'blist->('clist,'trace)resultvalmapi2:(int->'a->'b->('c,'trace)result)->'alist->'blist->('clist,'trace)resultvalmap2_s:('a->'b->('c,'trace)resultLwt.t)->'alist->'blist->('clist,'trace)resultLwt.tvalmapi2_s:(int->'a->'b->('c,'trace)resultLwt.t)->'alist->'blist->('clist,'trace)resultLwt.tvalfilter_map_s:('a->('boption,'trace)resultLwt.t)->'alist->('blist,'trace)resultLwt.tvalfilter:('a->(bool,'trace)result)->'alist->('alist,'trace)resultvalfilter_s:('a->(bool,'trace)resultLwt.t)->'alist->('alist,'trace)resultLwt.tvalfold_left_s:('a->'b->('a,'trace)resultLwt.t)->'a->'blist->('a,'trace)resultLwt.tvalfold_right_s:('a->'b->('b,'trace)resultLwt.t)->'alist->'b->('b,'trace)resultLwt.t(* Synchronisation *)valjoin_e:(unit,'errtrace)resultlist->(unit,'errtrace)resultvalall_e:('a,'errtrace)resultlist->('alist,'errtrace)resultvalboth_e:('a,'errtrace)result->('b,'errtrace)result->('a*'b,'errtrace)result(**/**)(* boilerplate for interaction with the shell *)typeshell_errortype'ashell_tzresult=('a,shell_errorlist)resultend# 38 "v1.in.ml"openError_monadmoduleLogging:sig# 1 "v1/logging.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)valdebug:('a,Format.formatter,unit,unit)format4->'avallog_info:('a,Format.formatter,unit,unit)format4->'avallog_notice:('a,Format.formatter,unit,unit)format4->'avalwarn:('a,Format.formatter,unit,unit)format4->'avallog_error:('a,Format.formatter,unit,unit)format4->'avalfatal_error:('a,Format.formatter,unit,unit)format4->'avallwt_debug:('a,Format.formatter,unit,unitLwt.t)format4->'avallwt_log_info:('a,Format.formatter,unit,unitLwt.t)format4->'avallwt_log_notice:('a,Format.formatter,unit,unitLwt.t)format4->'avallwt_warn:('a,Format.formatter,unit,unitLwt.t)format4->'avallwt_log_error:('a,Format.formatter,unit,unitLwt.t)format4->'aend# 42 "v1.in.ml"moduleTime:sig# 1 "v1/time.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typetincludeCompare.Swithtypet:=tvaladd:t->int64->tvaldiff:t->t->int64valof_seconds:int64->tvalto_seconds:t->int64valof_notation:string->toptionvalof_notation_exn:string->tvalto_notation:t->stringvalencoding:tData_encoding.tvalrfc_encoding:tData_encoding.tvalpp_hum:Format.formatter->t->unitend# 44 "v1.in.ml"moduleOption:sig# 1 "v1/option.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* The OCaml programmers *)(* *)(* Copyright 2018 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Option values.
Option values explicitly indicate the presence or absence of a value.
@since 4.08 *)(** {1:options Options} *)type'at='aoption=None|Someof'a(**)(** The type for option values. Either [None] or a value [Some v]. *)valnone:'aoption(** [none] is [None]. *)valsome:'a->'aoption(** [some v] is [Some v]. *)valvalue:'aoption->default:'a->'a(** [value o ~default] is [v] if [o] is [Some v] and [default] otherwise. *)valbind:'aoption->('a->'boption)->'boption(** [bind o f] is [f v] if [o] is [Some v] and [None] if [o] is [None]. *)valjoin:'aoptionoption->'aoption(** [join oo] is [Some v] if [oo] is [Some (Some v)] and [None] otherwise. *)valmap:('a->'b)->'aoption->'boption(** [map f o] is [None] if [o] is [None] and [Some (f v)] is [o] is [Some v]. *)valfold:none:'a->some:('b->'a)->'boption->'a(** [fold ~none ~some o] is [none] if [o] is [None] and [some v] if [o] is
[Some v]. *)valiter:('a->unit)->'aoption->unit(** [iter f o] is [f v] if [o] is [Some v] and [()] otherwise. *)(** {1:preds Predicates and comparisons} *)valis_none:'aoption->bool(** [is_none o] is [true] iff [o] is [None]. *)valis_some:'aoption->bool(** [is_some o] is [true] iff [o] is [Some o]. *)valequal:('a->'a->bool)->'aoption->'aoption->bool(** [equal eq o0 o1] is [true] iff [o0] and [o1] are both [None] or if
they are [Some v0] and [Some v1] and [eq v0 v1] is [true]. *)valcompare:('a->'a->int)->'aoption->'aoption->int(** [compare cmp o0 o1] is a total order on options using [cmp] to compare
values wrapped by [Some _]. [None] is smaller than [Some _] values. *)(** {1:convert Converting} *)valto_result:none:'e->'aoption->('a,'e)result(** [to_result ~none o] is [Ok v] if [o] is [Some v] and [Error none]
otherwise. *)valto_list:'aoption->'alist(** [to_list o] is [[]] if [o] is [None] and [[v]] if [o] is [Some v]. *)(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* Copyright (c) 2019 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** [x >>= f] is an infix notation for [apply ~f x] *)val(>>=):'aoption->('a->'boption)->'boption(** [x >>| f] is an infix notation for [map ~f x] *)val(>>|):'aoption->('a->'b)->'boption(** First input of form [Some x], or [None] if both are [None] *)valfirst_some:'aoption->'aoption->'aoption(** [pp ~default pp fmt x] pretty-print value [x] using [pp]
or [default] (["None"] by default) string if there is no value. *)valpp:?default:string->(Format.formatter->'a->unit)->Format.formatter->'aoption->unitend# 46 "v1.in.ml"moduleTzEndian:sig# 1 "v1/tzEndian.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2019 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)valget_int32:bytes->int->int32valset_int32:bytes->int->int32->unitvalset_int8:bytes->int->int->unitvalget_int8:bytes->int->intvalset_int16:bytes->int->int->unitvalget_int16:bytes->int->intvalset_int64:bytes->int->int64->unitvalget_int64:bytes->int->int64valget_uint8:bytes->int->intvalget_uint16:bytes->int->intend# 48 "v1.in.ml"moduleRPC_arg:sig# 1 "v1/RPC_arg.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)type'attype'aarg='atvalmake:?descr:string->name:string->destruct:(string->('a,string)result)->construct:('a->string)->unit->'aargtypedescr={name:string;descr:stringoption}valdescr:'aarg->descrvalbool:boolargvalint:intargvalint32:int32argvalint64:int64argvalstring:stringargvallike:'aarg->?descr:string->string->'aargtype('a,'b)eq=Eq:('a,'a)eqvaleq:'aarg->'barg->('a,'b)eqoptionend# 50 "v1.in.ml"moduleRPC_path:sig# 1 "v1/RPC_path.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)type('prefix,'params)ttype('prefix,'params)path=('prefix,'params)ttype'prefixcontext=('prefix,'prefix)pathvalroot:unitcontextvalopen_root:'acontextvaladd_suffix:('prefix,'params)path->string->('prefix,'params)pathval(/):('prefix,'params)path->string->('prefix,'params)pathvaladd_arg:('prefix,'params)path->'aRPC_arg.t->('prefix,'params*'a)pathval(/:):('prefix,'params)path->'aRPC_arg.t->('prefix,'params*'a)pathvaladd_final_args:('prefix,'params)path->'aRPC_arg.t->('prefix,'params*'alist)pathval(/:*):('prefix,'params)path->'aRPC_arg.t->('prefix,'params*'alist)pathend# 52 "v1.in.ml"moduleRPC_query:sig# 1 "v1/RPC_query.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)type'attype'aquery='atvalempty:unitquerytype('a,'b)fieldvalfield:?descr:string->string->'aRPC_arg.t->'a->('b->'a)->('b,'a)fieldvalopt_field:?descr:string->string->'aRPC_arg.t->('b->'aoption)->('b,'aoption)fieldvalflag:?descr:string->string->('b->bool)->('b,bool)fieldvalmulti_field:?descr:string->string->'aRPC_arg.t->('b->'alist)->('b,'alist)fieldtype('a,'b,'c)open_queryvalquery:'b->('a,'b,'b)open_queryval(|+):('a,'b,'c->'d)open_query->('a,'c)field->('a,'b,'d)open_queryvalseal:('a,'b,'a)open_query->'attypeuntyped=(string*string)listexceptionInvalidofstringvalparse:'aquery->untyped->'aend# 54 "v1.in.ml"moduleRPC_service:sig# 1 "v1/RPC_service.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** HTTP methods. *)typemeth=[`GET|`POST|`DELETE|`PUT|`PATCH]type(+'meth,'prefix,'params,'query,'input,'output)tconstraint'meth=[<meth]type(+'meth,'prefix,'params,'query,'input,'output)service=('meth,'prefix,'params,'query,'input,'output)tvalget_service:?description:string->query:'queryRPC_query.t->output:'outputData_encoding.t->('prefix,'params)RPC_path.t->([`GET],'prefix,'params,'query,unit,'output)servicevalpost_service:?description:string->query:'queryRPC_query.t->input:'inputData_encoding.t->output:'outputData_encoding.t->('prefix,'params)RPC_path.t->([`POST],'prefix,'params,'query,'input,'output)servicevaldelete_service:?description:string->query:'queryRPC_query.t->output:'outputData_encoding.t->('prefix,'params)RPC_path.t->([`DELETE],'prefix,'params,'query,unit,'output)servicevalpatch_service:?description:string->query:'queryRPC_query.t->input:'inputData_encoding.t->output:'outputData_encoding.t->('prefix,'params)RPC_path.t->([`PATCH],'prefix,'params,'query,'input,'output)servicevalput_service:?description:string->query:'queryRPC_query.t->input:'inputData_encoding.t->output:'outputData_encoding.t->('prefix,'params)RPC_path.t->([`PUT],'prefix,'params,'query,'input,'output)serviceend# 56 "v1.in.ml"moduleRPC_answer:sig# 1 "v1/RPC_answer.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Return type for service handler *)type'ot=[`Okof'o(* 200 *)|`OkStreamof'ostream(* 200 *)|`Createdofstringoption(* 201 *)|`No_content(* 204 *)|`Unauthorizedoferrorlistoption(* 401 *)|`Forbiddenoferrorlistoption(* 403 *)|`Not_foundoferrorlistoption(* 404 *)|`Conflictoferrorlistoption(* 409 *)|`Erroroferrorlistoption(* 500 *)]and'astream={next:unit->'aoptionLwt.t;shutdown:unit->unit}valreturn:'o->'otLwt.tvalreturn_stream:'ostream->'otLwt.tvalnot_found:'otLwt.tvalfail:errorlist->'atLwt.tend# 58 "v1.in.ml"moduleRPC_directory:sig# 1 "v1/RPC_directory.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Dispatch tree *)type'prefixttype'prefixdirectory='prefixt(** Empty list of dispatch trees *)valempty:'prefixdirectoryvalmap:('a->'bLwt.t)->'bdirectory->'adirectoryvalprefix:('pr,'p)RPC_path.path->'pdirectory->'prdirectoryvalmerge:'adirectory->'adirectory->'adirectory(** Possible error while registering services. *)typestep=|Staticofstring|DynamicofRPC_arg.descr|DynamicTailofRPC_arg.descrtypeconflict=|CServiceofRPC_service.meth|CDir|CBuilder|CTail|CTypesofRPC_arg.descr*RPC_arg.descr|CTypeofRPC_arg.descr*stringlistexceptionConflictofsteplist*conflict(** Registering handler in service tree. *)valregister:'prefixdirectory->('meth,'prefix,'params,'query,'input,'output)RPC_service.t->('params->'query->'input->'outputtzresultLwt.t)->'prefixdirectoryvalopt_register:'prefixdirectory->('meth,'prefix,'params,'query,'input,'output)RPC_service.t->('params->'query->'input->'outputoptiontzresultLwt.t)->'prefixdirectoryvalgen_register:'prefixdirectory->('meth,'prefix,'params,'query,'input,'output)RPC_service.t->('params->'query->'input->[<'outputRPC_answer.t]Lwt.t)->'prefixdirectoryvallwt_register:'prefixdirectory->('meth,'prefix,'params,'query,'input,'output)RPC_service.t->('params->'query->'input->'outputLwt.t)->'prefixdirectory(** Registering handler in service tree. Curryfied variant. *)valregister0:unitdirectory->('m,unit,unit,'q,'i,'o)RPC_service.t->('q->'i->'otzresultLwt.t)->unitdirectoryvalregister1:'prefixdirectory->('m,'prefix,unit*'a,'q,'i,'o)RPC_service.t->('a->'q->'i->'otzresultLwt.t)->'prefixdirectoryvalregister2:'prefixdirectory->('m,'prefix,(unit*'a)*'b,'q,'i,'o)RPC_service.t->('a->'b->'q->'i->'otzresultLwt.t)->'prefixdirectoryvalregister3:'prefixdirectory->('m,'prefix,((unit*'a)*'b)*'c,'q,'i,'o)RPC_service.t->('a->'b->'c->'q->'i->'otzresultLwt.t)->'prefixdirectoryvalregister4:'prefixdirectory->('m,'prefix,(((unit*'a)*'b)*'c)*'d,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'q->'i->'otzresultLwt.t)->'prefixdirectoryvalregister5:'prefixdirectory->('m,'prefix,((((unit*'a)*'b)*'c)*'d)*'e,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'e->'q->'i->'otzresultLwt.t)->'prefixdirectoryvalopt_register0:unitdirectory->('m,unit,unit,'q,'i,'o)RPC_service.t->('q->'i->'ooptiontzresultLwt.t)->unitdirectoryvalopt_register1:'prefixdirectory->('m,'prefix,unit*'a,'q,'i,'o)RPC_service.t->('a->'q->'i->'ooptiontzresultLwt.t)->'prefixdirectoryvalopt_register2:'prefixdirectory->('m,'prefix,(unit*'a)*'b,'q,'i,'o)RPC_service.t->('a->'b->'q->'i->'ooptiontzresultLwt.t)->'prefixdirectoryvalopt_register3:'prefixdirectory->('m,'prefix,((unit*'a)*'b)*'c,'q,'i,'o)RPC_service.t->('a->'b->'c->'q->'i->'ooptiontzresultLwt.t)->'prefixdirectoryvalopt_register4:'prefixdirectory->('m,'prefix,(((unit*'a)*'b)*'c)*'d,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'q->'i->'ooptiontzresultLwt.t)->'prefixdirectoryvalopt_register5:'prefixdirectory->('m,'prefix,((((unit*'a)*'b)*'c)*'d)*'e,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'e->'q->'i->'ooptiontzresultLwt.t)->'prefixdirectoryvalgen_register0:unitdirectory->('m,unit,unit,'q,'i,'o)RPC_service.t->('q->'i->[<'oRPC_answer.t]Lwt.t)->unitdirectoryvalgen_register1:'prefixdirectory->('m,'prefix,unit*'a,'q,'i,'o)RPC_service.t->('a->'q->'i->[<'oRPC_answer.t]Lwt.t)->'prefixdirectoryvalgen_register2:'prefixdirectory->('m,'prefix,(unit*'a)*'b,'q,'i,'o)RPC_service.t->('a->'b->'q->'i->[<'oRPC_answer.t]Lwt.t)->'prefixdirectoryvalgen_register3:'prefixdirectory->('m,'prefix,((unit*'a)*'b)*'c,'q,'i,'o)RPC_service.t->('a->'b->'c->'q->'i->[<'oRPC_answer.t]Lwt.t)->'prefixdirectoryvalgen_register4:'prefixdirectory->('m,'prefix,(((unit*'a)*'b)*'c)*'d,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'q->'i->[<'oRPC_answer.t]Lwt.t)->'prefixdirectoryvalgen_register5:'prefixdirectory->('m,'prefix,((((unit*'a)*'b)*'c)*'d)*'e,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'e->'q->'i->[<'oRPC_answer.t]Lwt.t)->'prefixdirectoryvallwt_register0:unitdirectory->('m,unit,unit,'q,'i,'o)RPC_service.t->('q->'i->'oLwt.t)->unitdirectoryvallwt_register1:'prefixdirectory->('m,'prefix,unit*'a,'q,'i,'o)RPC_service.t->('a->'q->'i->'oLwt.t)->'prefixdirectoryvallwt_register2:'prefixdirectory->('m,'prefix,(unit*'a)*'b,'q,'i,'o)RPC_service.t->('a->'b->'q->'i->'oLwt.t)->'prefixdirectoryvallwt_register3:'prefixdirectory->('m,'prefix,((unit*'a)*'b)*'c,'q,'i,'o)RPC_service.t->('a->'b->'c->'q->'i->'oLwt.t)->'prefixdirectoryvallwt_register4:'prefixdirectory->('m,'prefix,(((unit*'a)*'b)*'c)*'d,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'q->'i->'oLwt.t)->'prefixdirectoryvallwt_register5:'prefixdirectory->('m,'prefix,((((unit*'a)*'b)*'c)*'d)*'e,'q,'i,'o)RPC_service.t->('a->'b->'c->'d->'e->'q->'i->'oLwt.t)->'prefixdirectory(** Registering dynamic subtree. *)valregister_dynamic_directory:?descr:string->'prefixdirectory->('prefix,'a)RPC_path.t->('a->'adirectoryLwt.t)->'prefixdirectoryend# 60 "v1.in.ml"moduleBase58:sig# 1 "v1/base58.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)type'aencodingvalsimple_decode:'aencoding->string->'aoptionvalsimple_encode:'aencoding->'a->stringtypedata=..valregister_encoding:prefix:string->length:int->to_raw:('a->string)->of_raw:(string->'aoption)->wrap:('a->data)->'aencodingvalcheck_encoded_prefix:'aencoding->string->int->unitvaldecode:string->dataoptionend# 62 "v1.in.ml"moduleS:sig# 1 "v1/s.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* Copyright (c) 2020 Metastate AG <hello@metastate.dev> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Generic interface for a datatype with comparison, pretty-printer
and serialization functions. *)moduletypeT=sigtypetincludeCompare.Swithtypet:=tvalpp:Format.formatter->t->unitvalencoding:tData_encoding.tvalto_bytes:t->bytesvalof_bytes:bytes->toptionend(** Generic interface for a datatype with comparison, pretty-printer,
serialization functions and a hashing function. *)moduletypeHASHABLE=sigincludeTtypehashvalhash:t->hashvalhash_raw:bytes->hashend(** {2 Hash Types} *)(** The signature of an abstract hash type, as produced by functor
{!Make_SHA256}. The {!t} type is abstracted for separating the
various kinds of hashes in the system at typing time. Each type is
equipped with functions to use it as is of as keys in the database
or in memory sets and maps. *)moduletypeMINIMAL_HASH=sigtypetvalname:stringvaltitle:stringvalpp:Format.formatter->t->unitvalpp_short:Format.formatter->t->unitincludeCompare.Swithtypet:=tvalhash_bytes:?key:bytes->byteslist->tvalhash_string:?key:string->stringlist->tvalzero:tendmoduletypeRAW_DATA=sigtypetvalsize:int(* in bytes *)valto_bytes:t->bytesvalof_bytes_opt:bytes->toptionvalof_bytes_exn:bytes->tendmoduletypeB58_DATA=sigtypetvalto_b58check:t->stringvalto_short_b58check:t->stringvalof_b58check_exn:string->tvalof_b58check_opt:string->toptiontypeBase58.data+=Dataoftvalb58check_encoding:tBase58.encodingendmoduletypeENCODER=sigtypetvalencoding:tData_encoding.tvalrpc_arg:tRPC_arg.tendmoduletypeSET=sigtypeelt(** The type of the set elements. *)typet(** The type of sets. *)valempty:t(** The empty set. *)valis_empty:t->bool(** Test whether a set is empty or not. *)valmem:elt->t->bool(** [mem x s] tests whether [x] belongs to the set [s]. *)valadd:elt->t->t(** [add x s] returns a set containing all elements of [s],
plus [x]. If [x] was already in [s], [s] is returned unchanged
(the result of the function is then physically equal to [s]).
@before 4.03 Physical equality was not ensured. *)valsingleton:elt->t(** [singleton x] returns the one-element set containing only [x]. *)valremove:elt->t->t(** [remove x s] returns a set containing all elements of [s],
except [x]. If [x] was not in [s], [s] is returned unchanged
(the result of the function is then physically equal to [s]).
@before 4.03 Physical equality was not ensured. *)valunion:t->t->t(** Set union. *)valinter:t->t->t(** Set intersection. *)valdiff:t->t->t(** Set difference: [diff s1 s2] contains the elements of [s1]
that are not in [s2]. *)valcompare:t->t->int(** Total ordering between sets. Can be used as the ordering function
for doing sets of sets. *)valequal:t->t->bool(** [equal s1 s2] tests whether the sets [s1] and [s2] are
equal, that is, contain equal elements. *)valsubset:t->t->bool(** [subset s1 s2] tests whether the set [s1] is a subset of
the set [s2]. *)valiter:(elt->unit)->t->unit(** [iter f s] applies [f] in turn to all elements of [s].
The elements of [s] are presented to [f] in increasing order
with respect to the ordering over the type of the elements. *)valmap:(elt->elt)->t->t(** [map f s] is the set whose elements are [f a0],[f a1]... [f
aN], where [a0],[a1]...[aN] are the elements of [s].
The elements are passed to [f] in increasing order
with respect to the ordering over the type of the elements.
If no element of [s] is changed by [f], [s] is returned
unchanged. (If each output of [f] is physically equal to its
input, the returned set is physically equal to [s].)
@since 4.04.0 *)valfold:(elt->'a->'a)->t->'a->'a(** [fold f s a] computes [(f xN ... (f x2 (f x1 a))...)],
where [x1 ... xN] are the elements of [s], in increasing order. *)valfor_all:(elt->bool)->t->bool(** [for_all p s] checks if all elements of the set
satisfy the predicate [p]. *)valexists:(elt->bool)->t->bool(** [exists p s] checks if at least one element of
the set satisfies the predicate [p]. *)valfilter:(elt->bool)->t->t(** [filter p s] returns the set of all elements in [s]
that satisfy predicate [p]. If [p] satisfies every element in [s],
[s] is returned unchanged (the result of the function is then
physically equal to [s]).
@before 4.03 Physical equality was not ensured.*)valpartition:(elt->bool)->t->t*t(** [partition p s] returns a pair of sets [(s1, s2)], where
[s1] is the set of all the elements of [s] that satisfy the
predicate [p], and [s2] is the set of all the elements of
[s] that do not satisfy [p]. *)valcardinal:t->int(** Return the number of elements of a set. *)valelements:t->eltlist(** Return the list of all elements of the given set.
The returned list is sorted in increasing order with respect
to the ordering [Ord.compare], where [Ord] is the argument
given to {!Set.Make}. *)valmin_elt_opt:t->eltoption(** Return the smallest element of the given set
(with respect to the [Ord.compare] ordering), or [None]
if the set is empty.
@since 4.05
*)valmax_elt_opt:t->eltoption(** Same as {!Set.S.min_elt_opt}, but returns the largest element of the
given set.
@since 4.05
*)valchoose_opt:t->eltoption(** Return one element of the given set, or [None] if
the set is empty. Which element is chosen is unspecified,
but equal elements will be chosen for equal sets.
@since 4.05
*)valsplit:elt->t->t*bool*t(** [split x s] returns a triple [(l, present, r)], where
[l] is the set of elements of [s] that are
strictly less than [x];
[r] is the set of elements of [s] that are
strictly greater than [x];
[present] is [false] if [s] contains no element equal to [x],
or [true] if [s] contains an element equal to [x]. *)valfind_opt:elt->t->eltoption(** [find_opt x s] returns the element of [s] equal to [x] (according
to [Ord.compare]), or [None] if no such element
exists.
@since 4.05 *)valfind_first_opt:(elt->bool)->t->eltoption(** [find_first_opt f s], where [f] is a monotonically increasing function,
returns an option containing the lowest element [e] of [s] such that
[f e], or [None] if no such element exists.
@since 4.05
*)valfind_last_opt:(elt->bool)->t->eltoption(** [find_last_opt f s], where [f] is a monotonically decreasing function,
returns an option containing the highest element [e] of [s] such that
[f e], or [None] if no such element exists.
@since 4.05
*)valof_list:eltlist->t(** [of_list l] creates a set from a list of elements.
This is usually more efficient than folding [add] over the list,
except perhaps for lists with many duplicated elements.
@since 4.02.0 *)end(** Output signature of the functor {!Set.Make}. *)moduletypeMAP=sigtypekey(** The type of the map keys. *)type(+'a)t(** The type of maps from type [key] to type ['a]. *)valempty:'at(** The empty map. *)valis_empty:'at->bool(** Test whether a map is empty or not. *)valmem:key->'at->bool(** [mem x m] returns [true] if [m] contains a binding for [x],
and [false] otherwise. *)valadd:key->'a->'at->'at(** [add x y m] returns a map containing the same bindings as
[m], plus a binding of [x] to [y]. If [x] was already bound
in [m] to a value that is physically equal to [y],
[m] is returned unchanged (the result of the function is
then physically equal to [m]). Otherwise, the previous binding
of [x] in [m] disappears.
@before 4.03 Physical equality was not ensured. *)valupdate:key->('aoption->'aoption)->'at->'at(** [update x f m] returns a map containing the same bindings as
[m], except for the binding of [x]. Depending on the value of
[y] where [y] is [f (find_opt x m)], the binding of [x] is
added, removed or updated. If [y] is [None], the binding is
removed if it exists; otherwise, if [y] is [Some z] then [x]
is associated to [z] in the resulting map. If [x] was already
bound in [m] to a value that is physically equal to [z], [m]
is returned unchanged (the result of the function is then
physically equal to [m]).
@since 4.06.0
*)valsingleton:key->'a->'at(** [singleton x y] returns the one-element map that contains a binding [y]
for [x].
@since 3.12.0
*)valremove:key->'at->'at(** [remove x m] returns a map containing the same bindings as
[m], except for [x] which is unbound in the returned map.
If [x] was not in [m], [m] is returned unchanged
(the result of the function is then physically equal to [m]).
@before 4.03 Physical equality was not ensured. *)valmerge:(key->'aoption->'boption->'coption)->'at->'bt->'ct(** [merge f m1 m2] computes a map whose keys is a subset of keys of [m1]
and of [m2]. The presence of each such binding, and the corresponding
value, is determined with the function [f].
In terms of the [find_opt] operation, we have
[find_opt x (merge f m1 m2) = f (find_opt x m1) (find_opt x m2)]
for any key [x], provided that [f None None = None].
@since 3.12.0
*)valunion:(key->'a->'a->'aoption)->'at->'at->'at(** [union f m1 m2] computes a map whose keys is the union of keys
of [m1] and of [m2]. When the same binding is defined in both
arguments, the function [f] is used to combine them.
This is a special case of [merge]: [union f m1 m2] is equivalent
to [merge f' m1 m2], where
- [f' _key None None = None]
- [f' _key (Some v) None = Some v]
- [f' _key None (Some v) = Some v]
- [f' key (Some v1) (Some v2) = f key v1 v2]
@since 4.03.0
*)valcompare:('a->'a->int)->'at->'at->int(** Total ordering between maps. The first argument is a total ordering
used to compare data associated with equal keys in the two maps. *)valequal:('a->'a->bool)->'at->'at->bool(** [equal cmp m1 m2] tests whether the maps [m1] and [m2] are
equal, that is, contain equal keys and associate them with
equal data. [cmp] is the equality predicate used to compare
the data associated with the keys. *)valiter:(key->'a->unit)->'at->unit(** [iter f m] applies [f] to all bindings in map [m].
[f] receives the key as first argument, and the associated value
as second argument. The bindings are passed to [f] in increasing
order with respect to the ordering over the type of the keys. *)valfold:(key->'a->'b->'b)->'at->'b->'b(** [fold f m a] computes [(f kN dN ... (f k1 d1 a)...)],
where [k1 ... kN] are the keys of all bindings in [m]
(in increasing order), and [d1 ... dN] are the associated data. *)valfor_all:(key->'a->bool)->'at->bool(** [for_all p m] checks if all the bindings of the map
satisfy the predicate [p].
@since 3.12.0
*)valexists:(key->'a->bool)->'at->bool(** [exists p m] checks if at least one binding of the map
satisfies the predicate [p].
@since 3.12.0
*)valfilter:(key->'a->bool)->'at->'at(** [filter p m] returns the map with all the bindings in [m]
that satisfy predicate [p]. If [p] satisfies every binding in [m],
[m] is returned unchanged (the result of the function is then
physically equal to [m])
@since 3.12.0
@before 4.03 Physical equality was not ensured.
*)valpartition:(key->'a->bool)->'at->'at*'at(** [partition p m] returns a pair of maps [(m1, m2)], where
[m1] contains all the bindings of [s] that satisfy the
predicate [p], and [m2] is the map with all the bindings of
[s] that do not satisfy [p].
@since 3.12.0
*)valcardinal:'at->int(** Return the number of bindings of a map.
@since 3.12.0
*)valbindings:'at->(key*'a)list(** Return the list of all bindings of the given map.
The returned list is sorted in increasing order of keys with respect
to the ordering [Ord.compare], where [Ord] is the argument
given to {!Map.Make}.
@since 3.12.0
*)valmin_binding_opt:'at->(key*'a)option(** Return the binding with the smallest key in the given map
(with respect to the [Ord.compare] ordering), or [None]
if the map is empty.
@since 4.05
*)valmax_binding_opt:'at->(key*'a)option(** Same as {!Map.S.min_binding_opt}, but returns the binding with
the largest key in the given map.
@since 4.05
*)valchoose_opt:'at->(key*'a)option(** Return one binding of the given map, or [None] if
the map is empty. Which binding is chosen is unspecified,
but equal bindings will be chosen for equal maps.
@since 4.05
*)valsplit:key->'at->'at*'aoption*'at(** [split x m] returns a triple [(l, data, r)], where
[l] is the map with all the bindings of [m] whose key
is strictly less than [x];
[r] is the map with all the bindings of [m] whose key
is strictly greater than [x];
[data] is [None] if [m] contains no binding for [x],
or [Some v] if [m] binds [v] to [x].
@since 3.12.0
*)valfind_opt:key->'at->'aoption(** [find_opt x m] returns [Some v] if the current binding of [x]
in [m] is [v], or [None] if no such binding exists.
@since 4.05
*)valfind_first_opt:(key->bool)->'at->(key*'a)option(** [find_first_opt f m], where [f] is a monotonically increasing function,
returns an option containing the binding of [m] with the lowest key [k]
such that [f k], or [None] if no such key exists.
@since 4.05
*)valfind_last_opt:(key->bool)->'at->(key*'a)option(** [find_last_opt f m], where [f] is a monotonically decreasing function,
returns an option containing the binding of [m] with the highest key [k]
such that [f k], or [None] if no such key exists.
@since 4.05
*)valmap:('a->'b)->'at->'bt(** [map f m] returns a map with same domain as [m], where the
associated value [a] of all bindings of [m] has been
replaced by the result of the application of [f] to [a].
The bindings are passed to [f] in increasing order
with respect to the ordering over the type of the keys. *)valmapi:(key->'a->'b)->'at->'bt(** Same as {!Map.S.map}, but the function receives as arguments both the
key and the associated value for each binding of the map. *)end(** Output signature of the functor {!Map.Make}. *)moduletypeINDEXES_SET=sigincludeSETvalencoding:tData_encoding.tendmoduletypeINDEXES_MAP=sigincludeMAPvalencoding:'aData_encoding.t->'atData_encoding.tendmoduletypeINDEXES=sigtypetvalto_path:t->stringlist->stringlistvalof_path:stringlist->toptionvalof_path_exn:stringlist->tvalprefix_path:string->stringlistvalpath_length:intmoduleSet:INDEXES_SETwithtypeelt=tmoduleMap:INDEXES_MAPwithtypekey=tendmoduletypeHASH=sigincludeMINIMAL_HASHincludeRAW_DATAwithtypet:=tincludeB58_DATAwithtypet:=tincludeENCODERwithtypet:=tincludeINDEXESwithtypet:=tendmoduletypeMERKLE_TREE=sigtypeeltincludeHASHvalcompute:eltlist->tvalempty:ttypepath=Leftofpath*t|Rightoft*path|Opvalcompute_path:eltlist->int->pathvalcheck_path:path->elt->t*intvalpath_encoding:pathData_encoding.tendmoduletypeSIGNATURE_PUBLIC_KEY_HASH=sigtypetvalpp:Format.formatter->t->unitvalpp_short:Format.formatter->t->unitincludeCompare.Swithtypet:=tincludeRAW_DATAwithtypet:=tincludeB58_DATAwithtypet:=tincludeENCODERwithtypet:=tincludeINDEXESwithtypet:=tvalzero:tendmoduletypeSIGNATURE_PUBLIC_KEY=sigtypetvalpp:Format.formatter->t->unitincludeCompare.Swithtypet:=tincludeB58_DATAwithtypet:=tincludeENCODERwithtypet:=ttypepublic_key_hash_tvalhash:t->public_key_hash_tvalsize:t->int(* in bytes *)endmoduletypeSIGNATURE=sigmodulePublic_key_hash:SIGNATURE_PUBLIC_KEY_HASHmodulePublic_key:SIGNATURE_PUBLIC_KEYwithtypepublic_key_hash_t:=Public_key_hash.ttypetvalpp:Format.formatter->t->unitincludeRAW_DATAwithtypet:=tincludeCompare.Swithtypet:=tincludeB58_DATAwithtypet:=tincludeENCODERwithtypet:=tvalzero:ttypewatermark(** Check a signature *)valcheck:?watermark:watermark->Public_key.t->t->bytes->boolendmoduletypeFIELD=sigtypet(** The order of the finite field *)valorder:Z.t(** minimal number of bytes required to encode a value of the field. *)valsize_in_bytes:int(** [check_bytes bs] returns [true] if [bs] is a correct byte
representation of a field element *)valcheck_bytes:Bytes.t->bool(** The neutral element for the addition *)valzero:t(** The neutral element for the multiplication *)valone:t(** [add a b] returns [a + b mod order] *)valadd:t->t->t(** [mul a b] returns [a * b mod order] *)valmul:t->t->t(** [eq a b] returns [true] if [a = b mod order], else [false] *)valeq:t->t->bool(** [negate x] returns [-x mod order]. Equivalently, [negate x] returns the
unique [y] such that [x + y mod order = 0]
*)valnegate:t->t(** [inverse_opt x] returns [x^-1] if [x] is not [0] as an option, else [None] *)valinverse_opt:t->toption(** [pow x n] returns [x^n] *)valpow:t->Z.t->t(** From a predefined bytes representation, construct a value t. It is not
required that to_bytes [(Option.get (of_bytes_opt t)) = t]. By default,
little endian encoding is used and the given element is modulo the prime
order *)valof_bytes_opt:Bytes.t->toption(** Convert the value t to a bytes representation which can be used for
hashing for instance. It is not required that [to_bytes (Option.get
(of_bytes_opt t)) = t]. By default, little endian encoding is used, and
length of the resulting bytes may vary depending on the order.
*)valto_bytes:t->Bytes.tend(** Module type for the prime fields GF(p) *)moduletypePRIME_FIELD=sigincludeFIELD(** [of_z x] builds an element t from the Zarith element [x]. [mod order] is
applied if [x >= order] or [x < 0]. *)valof_z:Z.t->t(** [to_z x] builds a Zarith element, using the decimal representation.
Arithmetic on the result can be done using the modular functions on
integers *)valto_z:t->Z.tendmoduletypeCURVE=sig(** The type of the element in the elliptic curve *)typet(** The size of a point representation, in bytes *)valsize_in_bytes:intmoduleScalar:FIELD(** Check if a point, represented as a byte array, is on the curve **)valcheck_bytes:Bytes.t->bool(** Attempt to construct a point from a byte array *)valof_bytes_opt:Bytes.t->toption(** Return a representation in bytes *)valto_bytes:t->Bytes.t(** Zero of the elliptic curve *)valzero:t(** A fixed generator of the elliptic curve *)valone:t(** Return the addition of two element *)valadd:t->t->t(** Double the element *)valdouble:t->t(** Return the opposite of the element *)valnegate:t->t(** Return [true] if the two elements are algebraically the same *)valeq:t->t->bool(** Multiply an element by a scalar *)valmul:t->Scalar.t->tendmoduletypePAIRING=sigmoduleGt:FIELDmoduleG1:CURVEmoduleG2:CURVEvalmiller_loop:(G1.t*G2.t)list->Gt.tvalfinal_exponentiation_opt:Gt.t->Gt.toptionvalpairing:G1.t->G2.t->Gt.tendend# 64 "v1.in.ml"moduleSet:sig# 1 "v1/set.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Sets over ordered types.
This module implements the set data structure, given a total ordering
function over the set elements. All operations over sets
are purely applicative (no side-effects).
The implementation uses balanced binary trees, and is therefore
reasonably efficient: insertion and membership take time
logarithmic in the size of the set, for instance.
The {!Make} functor constructs implementations for any type, given a
[compare] function.
For instance:
{[
module IntPairs =
struct
type t = int * int
let compare (x0,y0) (x1,y1) =
match Stdlib.compare x0 x1 with
0 -> Stdlib.compare y0 y1
| c -> c
end
module PairsSet = Set.Make(IntPairs)
let m = PairsSet.(empty |> add (2,3) |> add (5,7) |> add (11,13))
]}
This creates a new module [PairsSet], with a new type [PairsSet.t]
of sets of [int * int].
*)moduletypeOrderedType=sigtypet(** The type of the set elements. *)valcompare:t->t->int(** A total ordering function over the set elements.
This is a two-argument function [f] such that
[f e1 e2] is zero if the elements [e1] and [e2] are equal,
[f e1 e2] is strictly negative if [e1] is smaller than [e2],
and [f e1 e2] is strictly positive if [e1] is greater than [e2].
Example: a suitable ordering function is the generic structural
comparison function {!Stdlib.compare}. *)end(** Input signature of the functor {!Set.Make}. *)moduleMake(Ord:OrderedType):S.SETwithtypeelt=Ord.t(** Functor building an implementation of the set structure
given a totally ordered type. *)end# 66 "v1.in.ml"moduleMap:sig# 1 "v1/map.mli"(**************************************************************************)(* *)(* OCaml *)(* *)(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)(* *)(* Copyright 1996 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)(** Association tables over ordered types.
This module implements applicative association tables, also known as
finite maps or dictionaries, given a total ordering function
over the keys.
All operations over maps are purely applicative (no side-effects).
The implementation uses balanced binary trees, and therefore searching
and insertion take time logarithmic in the size of the map.
For instance:
{[
module IntPairs =
struct
type t = int * int
let compare (x0,y0) (x1,y1) =
match Stdlib.compare x0 x1 with
0 -> Stdlib.compare y0 y1
| c -> c
end
module PairsMap = Map.Make(IntPairs)
let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")
]}
This creates a new module [PairsMap], with a new type ['a PairsMap.t]
of maps from [int * int] to ['a]. In this example, [m] contains [string]
values so its type is [string PairsMap.t].
*)moduletypeOrderedType=sigtypet(** The type of the map keys. *)valcompare:t->t->int(** A total ordering function over the keys.
This is a two-argument function [f] such that
[f e1 e2] is zero if the keys [e1] and [e2] are equal,
[f e1 e2] is strictly negative if [e1] is smaller than [e2],
and [f e1 e2] is strictly positive if [e1] is greater than [e2].
Example: a suitable ordering function is the generic structural
comparison function {!Stdlib.compare}. *)end(** Input signature of the functor {!Map.Make}. *)moduleMake(Ord:OrderedType):S.MAPwithtypekey=Ord.t(** Functor building an implementation of the map structure
given a totally ordered type. *)end# 68 "v1.in.ml"moduleBlake2B:sig# 1 "v1/blake2B.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Builds a new Hash type using Blake2B. *)(** The parameters for creating a new Hash type using
{!Make_Blake2B}. Both {!name} and {!title} are only informative,
used in error messages and serializers. *)moduletypeName=sigvalname:stringvaltitle:stringvalsize:intoptionendmoduletypePrefixedName=sigincludeNamevalb58check_prefix:stringendmoduleMake_minimal(Name:Name):S.MINIMAL_HASHmoduletypeRegister=sigvalregister_encoding:prefix:string->length:int->to_raw:('a->string)->of_raw:(string->'aoption)->wrap:('a->Base58.data)->'aBase58.encodingendmoduleMake(Register:Register)(Name:PrefixedName):S.HASHend# 70 "v1.in.ml"moduleBls12_381:sig# 1 "v1/bls12_381.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2020 Metastate AG <hello@metastate.ch> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)moduleFr:S.PRIME_FIELDmoduleFq12:S.FIELDincludeS.PAIRINGwithtypeGt.t=Fq12.tandtypeG1.Scalar.t=Fr.tandtypeG2.Scalar.t=Fr.tend# 72 "v1.in.ml"moduleEd25519:sig# 1 "v1/ed25519.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Tezos - Ed25519 cryptography *)includeS.SIGNATUREwithtypewatermark:=bytesend# 74 "v1.in.ml"moduleSecp256k1:sig# 1 "v1/secp256k1.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Tezos - Secp256k1 cryptography *)includeS.SIGNATUREwithtypewatermark:=bytesend# 76 "v1.in.ml"moduleP256:sig# 1 "v1/p256.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Tezos - P256 cryptography *)includeS.SIGNATUREwithtypewatermark:=bytesend# 78 "v1.in.ml"moduleChain_id:sig# 1 "v1/chain_id.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)includeS.HASHend# 80 "v1.in.ml"moduleSignature:sig# 1 "v1/signature.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typepublic_key_hash=|Ed25519ofEd25519.Public_key_hash.t|Secp256k1ofSecp256k1.Public_key_hash.t|P256ofP256.Public_key_hash.ttypepublic_key=|Ed25519ofEd25519.Public_key.t|Secp256k1ofSecp256k1.Public_key.t|P256ofP256.Public_key.ttypewatermark=|Block_headerofChain_id.t|EndorsementofChain_id.t|Generic_operation|CustomofbytesincludeS.SIGNATUREwithtypePublic_key_hash.t=public_key_hashandtypePublic_key.t=public_keyandtypewatermark:=watermarkend# 82 "v1.in.ml"moduleBlock_hash:sig# 1 "v1/block_hash.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Blocks hashes / IDs. *)includeS.HASHend# 84 "v1.in.ml"moduleOperation_hash:sig# 1 "v1/operation_hash.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Operations hashes / IDs. *)includeS.HASHend# 86 "v1.in.ml"moduleOperation_list_hash:sig# 1 "v1/operation_list_hash.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Blocks hashes / IDs. *)includeS.MERKLE_TREEwithtypeelt=Operation_hash.tend# 88 "v1.in.ml"moduleOperation_list_list_hash:sig# 1 "v1/operation_list_list_hash.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Blocks hashes / IDs. *)includeS.MERKLE_TREEwithtypeelt=Operation_list_hash.tend# 90 "v1.in.ml"moduleProtocol_hash:sig# 1 "v1/protocol_hash.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Protocol hashes / IDs. *)includeS.HASHend# 92 "v1.in.ml"moduleContext_hash:sig# 1 "v1/context_hash.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Committed context hashes / IDs. *)includeS.HASHend# 94 "v1.in.ml"moduleSapling:sig# 1 "v1/sapling.mli"(* The MIT License (MIT)
*
* Copyright (c) 2019-2020 Nomadic Labs <contact@nomadic-labs.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. *)moduleCiphertext:sigtypetvalencoding:tData_encoding.tvalget_memo_size:t->intendmoduleCommitment:sigtypetvalencoding:tData_encoding.tvalvalid_position:int64->boolendmoduleCV:sigtypetvalencoding:tData_encoding.tendmoduleHash:sigtypetvalcompare:t->t->intvalencoding:tData_encoding.tvalto_bytes:t->Bytes.tvalof_bytes_exn:Bytes.t->tvaluncommitted:height:int->tvalmerkle_hash:height:int->t->t->tvalof_commitment:Commitment.t->tvalto_commitment:t->Commitment.tendmoduleNullifier:sigtypetvalencoding:tData_encoding.tvalcompare:t->t->intendmoduleUTXO:sigtyperktypespend_prooftypespend_sigtypeoutput_prooftypeinput={cv:CV.t;nf:Nullifier.t;rk:rk;proof_i:spend_proof;signature:spend_sig;}valinput_encoding:inputData_encoding.ttypeoutput={cm:Commitment.t;proof_o:output_proof;ciphertext:Ciphertext.t;}valoutput_encoding:outputData_encoding.ttypebinding_sigtypetransaction={inputs:inputlist;outputs:outputlist;binding_sig:binding_sig;balance:Int64.t;root:Hash.t;}valtransaction_encoding:transactionData_encoding.tvalbinding_sig_encoding:binding_sigData_encoding.tendmoduleVerification:sigtypetvalwith_verification_ctx:(t->'a)->'avalcheck_spend:t->UTXO.input->Hash.t->string->boolvalcheck_output:t->UTXO.output->boolvalfinal_check:t->UTXO.transaction->string->boolendend# 96 "v1.in.ml"moduleMicheline:sig# 1 "v1/micheline.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typeannot=stringlisttype('l,'p)node=|Intof'l*Z.t|Stringof'l*string|Bytesof'l*bytes|Primof'l*'p*('l,'p)nodelist*annot|Seqof'l*('l,'p)nodelisttype'pcanonicaltypecanonical_location=intvalroot:'pcanonical->(canonical_location,'p)nodevalcanonical_location_encoding:canonical_locationData_encoding.encodingvalcanonical_encoding:variant:string->'lData_encoding.encoding->'lcanonicalData_encoding.encodingvalcanonical_encoding_v1:variant:string->'lData_encoding.encoding->'lcanonicalData_encoding.encoding(*
val erased_encoding : variant:string -> 'l -> 'p Data_encoding.encoding -> ('l, 'p) node Data_encoding.encoding
val table_encoding : variant:string -> 'l Data_encoding.encoding -> 'p Data_encoding.encoding -> ('l, 'p) node Data_encoding.encoding
*)vallocation:('l,'p)node->'lvalannotations:('l,'p)node->stringlistvalstrip_locations:(_,'p)node->'pcanonicalvalextract_locations:('l,'p)node->'pcanonical*(canonical_location*'l)listvalinject_locations:(canonical_location->'l)->'pcanonical->('l,'p)nodeend# 98 "v1.in.ml"moduleBlock_header:sig# 1 "v1/block_header.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typeshell_header={level:Int32.t;(** The number of preceding block in this chain, i.e. the genesis
has level 0. *)proto_level:int;(** The number of preceding protocol change in the chain (modulo 256),
i.e. the genesis has proto_level 0. *)predecessor:Block_hash.t;timestamp:Time.t;validation_passes:int;operations_hash:Operation_list_list_hash.t;fitness:Bytes.tlist;context:Context_hash.t;}valshell_header_encoding:shell_headerData_encoding.ttypet={shell:shell_header;protocol_data:bytes}includeS.HASHABLEwithtypet:=tandtypehash:=Block_hash.tend# 100 "v1.in.ml"moduleFitness:sig# 1 "v1/fitness.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** The fitness of a block is defined as a list of bytes,
compared in a lexicographical order (longer list are greater). *)includeS.Twithtypet=byteslistend# 102 "v1.in.ml"moduleOperation:sig# 1 "v1/operation.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Tezos operations. *)typeshell_header={branch:Block_hash.t;(** The operation is only valid in a branch containing the
block [branch]. *)}valshell_header_encoding:shell_headerData_encoding.ttypet={shell:shell_header;proto:bytes}includeS.HASHABLEwithtypet:=tandtypehash:=Operation_hash.tend# 104 "v1.in.ml"moduleContext:sig# 1 "v1/context.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** View over the context store, restricted to types, access and
functional manipulation of an existing context. *)typet(** Keys in (kex x value) database implementations *)typekey=stringlist(** Values in (kex x value) database implementations *)typevalue=bytesvalmem:t->key->boolLwt.tvaldir_mem:t->key->boolLwt.tvalget:t->key->valueoptionLwt.tvalset:t->key->value->tLwt.t(** [copy] returns None if the [from] key is not bound *)valcopy:t->from:key->to_:key->toptionLwt.tvalremove_rec:t->key->tLwt.ttypekey_or_dir=[`Keyofkey|`Dirofkey]valfold:t->key->init:'a->f:(key_or_dir->'a->'aLwt.t)->'aLwt.tvalkeys:t->key->keylistLwt.tvalfold_keys:t->key->init:'a->f:(key->'a->'aLwt.t)->'aLwt.tvalregister_resolver:'aBase58.encoding->(t->string->'alistLwt.t)->unitvalcomplete:t->string->stringlistLwt.tend# 106 "v1.in.ml"moduleUpdater:sig# 1 "v1/updater.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Tezos Protocol Environment - Protocol updater. *)(** Validation result: the record returned by the protocol
on the successful validation of a block. *)typevalidation_result={context:Context.t;(** The resulting context, it will be used for the next block. *)fitness:Fitness.t;(** The effective fitness of the block (to be compared with
the 'announced' one in the block header. *)message:stringoption;(** An optional informative message to be used as in the 'git
commit' of the block's context. *)max_operations_ttl:int;(** The "time-to-live" of operation for the next block: any
operations whose 'branch' is older than 'ttl' blocks in the
past cannot be included in the next block. *)last_allowed_fork_level:Int32.t;(** The level of the last block for which the node might consider an
alternate branch. The shell should consider as invalid any
branch whose fork point is older than the given level *)}typequota={max_size:int;(** The maximum size (in bytes) of the serialized list of
operations. *)max_op:intoption;(** The maximum number of operation.
[None] means no limit. *)}typerpc_context={block_hash:Block_hash.t;block_header:Block_header.shell_header;context:Context.t;}(** This is the signature of a Tezos protocol implementation. It has
access to the standard library and the Environment module. *)moduletypePROTOCOL=sig(** The maximum size of a block header in bytes. *)valmax_block_length:int(** The maximum size of an operation in bytes. *)valmax_operation_data_length:int(** The number of validation passes (length of the list) and the
operation's quota for each pass. *)valvalidation_passes:quotalist(** The version specific type of blocks. *)typeblock_header_data(** Encoding for version specific part of block headers. *)valblock_header_data_encoding:block_header_dataData_encoding.t(** A fully parsed block header. *)typeblock_header={shell:Block_header.shell_header;protocol_data:block_header_data;}(** Version-specific side information computed by the protocol
during the validation of a block. Should not include information
about the evaluation of operations which is handled separately by
{!operation_metadata}. To be used as an execution trace by tools
(client, indexer). Not necessary for validation. *)typeblock_header_metadata(** Encoding for version-specific block metadata. *)valblock_header_metadata_encoding:block_header_metadataData_encoding.t(** The version specific type of operations. *)typeoperation_data(** Version-specific side information computed by the protocol
during the validation of each operation, to be used conjointly
with {!block_header_metadata}. *)typeoperation_receipt(** A fully parsed operation. *)typeoperation={shell:Operation.shell_header;protocol_data:operation_data;}(** Encoding for version-specific operation data. *)valoperation_data_encoding:operation_dataData_encoding.t(** Encoding for version-specific operation receipts. *)valoperation_receipt_encoding:operation_receiptData_encoding.t(** Encoding that mixes an operation data and its receipt. *)valoperation_data_and_receipt_encoding:(operation_data*operation_receipt)Data_encoding.t(** The Validation passes in which an operation can appear.
For instance [[0]] if it only belongs to the first pass.
An answer of [[]] means that the operation is ill-formed
and cannot be included at all. *)valacceptable_passes:operation->intlist(** Basic ordering of operations. [compare_operations op1 op2] means
that [op1] should appear before [op2] in a block. *)valcompare_operations:operation->operation->int(** A functional state that is transmitted through the steps of a
block validation sequence. It must retain the current state of
the store (that can be extracted from the outside using
{!current_context}, and whose final value is produced by
{!finalize_block}). It can also contain the information that
must be remembered during the validation, which must be
immutable (as validator or baker implementations are allowed to
pause, replay or backtrack during the validation process). *)typevalidation_state(** Access the context at a given validation step. *)valcurrent_context:validation_state->Context.ttzresultLwt.t(** Checks that a block is well formed in a given context. This
function should run quickly, as its main use is to reject bad
blocks from the chain as early as possible. The input context
is the one resulting of an ancestor block of same protocol
version. This ancestor of the current head is guaranteed to be
more recent than `last_allowed_fork_level`.
The resulting `validation_state` will be used for multi-pass
validation. *)valbegin_partial_application:chain_id:Chain_id.t->ancestor_context:Context.t->predecessor_timestamp:Time.t->predecessor_fitness:Fitness.t->block_header->validation_statetzresultLwt.t(** The first step in a block validation sequence. Initializes a
validation context for validating a block. Takes as argument the
{!Block_header.t} to initialize the context for this block. The
function {!precheck_block} may not have been called before
[begin_application], so all the check performed by the former
must be repeated in the latter. *)valbegin_application:chain_id:Chain_id.t->predecessor_context:Context.t->predecessor_timestamp:Time.t->predecessor_fitness:Fitness.t->block_header->validation_statetzresultLwt.t(** Initializes a validation context for constructing a new block
(as opposed to validating an existing block). When the
[protocol_data] argument is specified, it should contains a
'prototype' of a the protocol specific part of a block header,
and the function should produce the exact same effect on the
context than would produce the validation of a block containing
an "equivalent" (but complete) header. For instance, if the
block header usually includes a signature, the header provided
to {!begin_construction} should includes a faked signature. *)valbegin_construction:chain_id:Chain_id.t->predecessor_context:Context.t->predecessor_timestamp:Time.t->predecessor_level:Int32.t->predecessor_fitness:Fitness.t->predecessor:Block_hash.t->timestamp:Time.t->?protocol_data:block_header_data->unit->validation_statetzresultLwt.t(** Called after {!begin_application} (or {!begin_construction}) and
before {!finalize_block}, with each operation in the block. *)valapply_operation:validation_state->operation->(validation_state*operation_receipt)tzresultLwt.t(** The last step in a block validation sequence. It produces the
context that will be used as input for the validation of its
successor block candidates. *)valfinalize_block:validation_state->(validation_result*block_header_metadata)tzresultLwt.t(** The list of remote procedures exported by this implementation *)valrpc_services:rpc_contextRPC_directory.t(** Initialize the context (or upgrade the context after a protocol
amendment). This function receives the context resulting of the
application of a block that triggered the amendment. It also
receives the header of the block that triggered the amendment. *)valinit:Context.t->Block_header.shell_header->validation_resulttzresultLwt.tend(** Activates a given protocol version from a given context. This
means that the context used for the next block will use this
version (this is not an immediate change). The version must have
been previously compiled successfully. *)valactivate:Context.t->Protocol_hash.t->Context.tLwt.t(** Fork a test chain. The forked chain will use the current block
as genesis, and [protocol] as economic protocol. The chain will
be destroyed when a (successor) block will have a timestamp greater
than [expiration]. The protocol must have been previously compiled
successfully. *)valfork_test_chain:Context.t->protocol:Protocol_hash.t->expiration:Time.t->Context.tLwt.tend# 108 "v1.in.ml"moduleRPC_context:sig# 1 "v1/RPC_context.mli"(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typet=Updater.rpc_contextclasstype['pr]simple=objectmethodcall_proto_service0:'m'q'i'o.(([<RPC_service.meth]as'm),t,t,'q,'i,'o)RPC_service.t->'pr->'q->'i->'oError_monad.shell_tzresultLwt.tmethodcall_proto_service1:'m'a'q'i'o.(([<RPC_service.meth]as'm),t,t*'a,'q,'i,'o)RPC_service.t->'pr->'a->'q->'i->'oError_monad.shell_tzresultLwt.tmethodcall_proto_service2:'m'a'b'q'i'o.(([<RPC_service.meth]as'm),t,(t*'a)*'b,'q,'i,'o)RPC_service.t->'pr->'a->'b->'q->'i->'oError_monad.shell_tzresultLwt.tmethodcall_proto_service3:'m'a'b'c'q'i'o.(([<RPC_service.meth]as'm),t,((t*'a)*'b)*'c,'q,'i,'o)RPC_service.t->'pr->'a->'b->'c->'q->'i->'oError_monad.shell_tzresultLwt.tendvalmake_call0:([<RPC_service.meth],t,t,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'q->'i->'oshell_tzresultLwt.tvalmake_call1:([<RPC_service.meth],t,t*'a,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'a->'q->'i->'oshell_tzresultLwt.tvalmake_call2:([<RPC_service.meth],t,(t*'a)*'b,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'a->'b->'q->'i->'oshell_tzresultLwt.tvalmake_call3:([<RPC_service.meth],t,((t*'a)*'b)*'c,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'a->'b->'c->'q->'i->'oshell_tzresultLwt.tvalmake_opt_call0:([<RPC_service.meth],t,t,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'q->'i->'ooptionshell_tzresultLwt.tvalmake_opt_call1:([<RPC_service.meth],t,t*'a,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'a->'q->'i->'ooptionshell_tzresultLwt.tvalmake_opt_call2:([<RPC_service.meth],t,(t*'a)*'b,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'a->'b->'q->'i->'ooptionshell_tzresultLwt.tvalmake_opt_call3:([<RPC_service.meth],t,((t*'a)*'b)*'c,'q,'i,'o)RPC_service.t->'pr#simple->'pr->'a->'b->'c->'q->'i->'ooptionshell_tzresultLwt.tend# 110 "v1.in.ml"end