musl_freebsd_386.go 178 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791
  1. // Code generated by 'ccgo -export-externs X -export-fields F -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6,getnameinfo,gethostbyaddr_r, -nostdinc -nostdlib -o ../musl_freebsd_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c ../freebsd/table.cpp.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isupper.c src/ctype/isxdigit.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strnlen.c src/string/strspn.c', DO NOT EDIT.
  2. package libc
  3. import (
  4. "math"
  5. "reflect"
  6. "sync/atomic"
  7. "unsafe"
  8. )
  9. var _ = math.Pi
  10. var _ reflect.Kind
  11. var _ atomic.Value
  12. var _ unsafe.Pointer
  13. // musl as a whole is licensed under the following standard MIT license:
  14. //
  15. // ----------------------------------------------------------------------
  16. // Copyright © 2005-2020 Rich Felker, et al.
  17. //
  18. // Permission is hereby granted, free of charge, to any person obtaining
  19. // a copy of this software and associated documentation files (the
  20. // "Software"), to deal in the Software without restriction, including
  21. // without limitation the rights to use, copy, modify, merge, publish,
  22. // distribute, sublicense, and/or sell copies of the Software, and to
  23. // permit persons to whom the Software is furnished to do so, subject to
  24. // the following conditions:
  25. //
  26. // The above copyright notice and this permission notice shall be
  27. // included in all copies or substantial portions of the Software.
  28. //
  29. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  30. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  31. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  32. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  33. // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  34. // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  35. // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  36. // ----------------------------------------------------------------------
  37. //
  38. // Authors/contributors include:
  39. //
  40. // A. Wilcox
  41. // Ada Worcester
  42. // Alex Dowad
  43. // Alex Suykov
  44. // Alexander Monakov
  45. // Andre McCurdy
  46. // Andrew Kelley
  47. // Anthony G. Basile
  48. // Aric Belsito
  49. // Arvid Picciani
  50. // Bartosz Brachaczek
  51. // Benjamin Peterson
  52. // Bobby Bingham
  53. // Boris Brezillon
  54. // Brent Cook
  55. // Chris Spiegel
  56. // Clément Vasseur
  57. // Daniel Micay
  58. // Daniel Sabogal
  59. // Daurnimator
  60. // David Carlier
  61. // David Edelsohn
  62. // Denys Vlasenko
  63. // Dmitry Ivanov
  64. // Dmitry V. Levin
  65. // Drew DeVault
  66. // Emil Renner Berthing
  67. // Fangrui Song
  68. // Felix Fietkau
  69. // Felix Janda
  70. // Gianluca Anzolin
  71. // Hauke Mehrtens
  72. // He X
  73. // Hiltjo Posthuma
  74. // Isaac Dunham
  75. // Jaydeep Patil
  76. // Jens Gustedt
  77. // Jeremy Huntwork
  78. // Jo-Philipp Wich
  79. // Joakim Sindholt
  80. // John Spencer
  81. // Julien Ramseier
  82. // Justin Cormack
  83. // Kaarle Ritvanen
  84. // Khem Raj
  85. // Kylie McClain
  86. // Leah Neukirchen
  87. // Luca Barbato
  88. // Luka Perkov
  89. // M Farkas-Dyck (Strake)
  90. // Mahesh Bodapati
  91. // Markus Wichmann
  92. // Masanori Ogino
  93. // Michael Clark
  94. // Michael Forney
  95. // Mikhail Kremnyov
  96. // Natanael Copa
  97. // Nicholas J. Kain
  98. // orc
  99. // Pascal Cuoq
  100. // Patrick Oppenlander
  101. // Petr Hosek
  102. // Petr Skocik
  103. // Pierre Carrier
  104. // Reini Urban
  105. // Rich Felker
  106. // Richard Pennington
  107. // Ryan Fairfax
  108. // Samuel Holland
  109. // Segev Finer
  110. // Shiz
  111. // sin
  112. // Solar Designer
  113. // Stefan Kristiansson
  114. // Stefan O'Rear
  115. // Szabolcs Nagy
  116. // Timo Teräs
  117. // Trutz Behn
  118. // Valentin Ochs
  119. // Will Dietz
  120. // William Haddon
  121. // William Pitcock
  122. //
  123. // Portions of this software are derived from third-party works licensed
  124. // under terms compatible with the above MIT license:
  125. //
  126. // The TRE regular expression implementation (src/regex/reg* and
  127. // src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
  128. // under a 2-clause BSD license (license text in the source files). The
  129. // included version has been heavily modified by Rich Felker in 2012, in
  130. // the interests of size, simplicity, and namespace cleanliness.
  131. //
  132. // Much of the math library code (src/math/* and src/complex/*) is
  133. // Copyright © 1993,2004 Sun Microsystems or
  134. // Copyright © 2003-2011 David Schultz or
  135. // Copyright © 2003-2009 Steven G. Kargl or
  136. // Copyright © 2003-2009 Bruce D. Evans or
  137. // Copyright © 2008 Stephen L. Moshier or
  138. // Copyright © 2017-2018 Arm Limited
  139. // and labelled as such in comments in the individual source files. All
  140. // have been licensed under extremely permissive terms.
  141. //
  142. // The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
  143. // The Android Open Source Project and is licensed under a two-clause BSD
  144. // license. It was taken from Bionic libc, used on Android.
  145. //
  146. // The AArch64 memcpy and memset code (src/string/aarch64/*) are
  147. // Copyright © 1999-2019, Arm Limited.
  148. //
  149. // The implementation of DES for crypt (src/crypt/crypt_des.c) is
  150. // Copyright © 1994 David Burren. It is licensed under a BSD license.
  151. //
  152. // The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
  153. // originally written by Solar Designer and placed into the public
  154. // domain. The code also comes with a fallback permissive license for use
  155. // in jurisdictions that may not recognize the public domain.
  156. //
  157. // The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
  158. // Valentin Ochs and is licensed under an MIT-style license.
  159. //
  160. // The x86_64 port was written by Nicholas J. Kain and is licensed under
  161. // the standard MIT terms.
  162. //
  163. // The mips and microblaze ports were originally written by Richard
  164. // Pennington for use in the ellcc project. The original code was adapted
  165. // by Rich Felker for build system and code conventions during upstream
  166. // integration. It is licensed under the standard MIT terms.
  167. //
  168. // The mips64 port was contributed by Imagination Technologies and is
  169. // licensed under the standard MIT terms.
  170. //
  171. // The powerpc port was also originally written by Richard Pennington,
  172. // and later supplemented and integrated by John Spencer. It is licensed
  173. // under the standard MIT terms.
  174. //
  175. // All other files which have no copyright comments are original works
  176. // produced specifically for use as part of this library, written either
  177. // by Rich Felker, the main author of the library, or by one or more
  178. // contibutors listed above. Details on authorship of individual files
  179. // can be found in the git version control history of the project. The
  180. // omission of copyright and license comments in each file is in the
  181. // interest of source tree size.
  182. //
  183. // In addition, permission is hereby granted for all public header files
  184. // (include/* and arch/*/bits/*) and crt files intended to be linked into
  185. // applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
  186. // the copyright notice and permission notice otherwise required by the
  187. // license, and to use these files without any requirement of
  188. // attribution. These files include substantial contributions from:
  189. //
  190. // Bobby Bingham
  191. // John Spencer
  192. // Nicholas J. Kain
  193. // Rich Felker
  194. // Richard Pennington
  195. // Stefan Kristiansson
  196. // Szabolcs Nagy
  197. //
  198. // all of whom have explicitly granted such permission.
  199. //
  200. // This file previously contained text expressing a belief that most of
  201. // the files covered by the above exception were sufficiently trivial not
  202. // to be subject to copyright, resulting in confusion over whether it
  203. // negated the permissions granted in the license. In the spirit of
  204. // permissive licensing, and of not having licensing issues being an
  205. // obstacle to adoption, that text has been removed.
  206. const ( /* copyright.c:194:1: */
  207. __musl__copyright__ = 0
  208. )
  209. const ( /* nameser.h:117:1: */
  210. ns_uop_delete = 0
  211. ns_uop_add = 1
  212. ns_uop_max = 2
  213. )
  214. const ( /* nameser.h:147:1: */
  215. ns_t_invalid = 0
  216. ns_t_a = 1
  217. ns_t_ns = 2
  218. ns_t_md = 3
  219. ns_t_mf = 4
  220. ns_t_cname = 5
  221. ns_t_soa = 6
  222. ns_t_mb = 7
  223. ns_t_mg = 8
  224. ns_t_mr = 9
  225. ns_t_null = 10
  226. ns_t_wks = 11
  227. ns_t_ptr = 12
  228. ns_t_hinfo = 13
  229. ns_t_minfo = 14
  230. ns_t_mx = 15
  231. ns_t_txt = 16
  232. ns_t_rp = 17
  233. ns_t_afsdb = 18
  234. ns_t_x25 = 19
  235. ns_t_isdn = 20
  236. ns_t_rt = 21
  237. ns_t_nsap = 22
  238. ns_t_nsap_ptr = 23
  239. ns_t_sig = 24
  240. ns_t_key = 25
  241. ns_t_px = 26
  242. ns_t_gpos = 27
  243. ns_t_aaaa = 28
  244. ns_t_loc = 29
  245. ns_t_nxt = 30
  246. ns_t_eid = 31
  247. ns_t_nimloc = 32
  248. ns_t_srv = 33
  249. ns_t_atma = 34
  250. ns_t_naptr = 35
  251. ns_t_kx = 36
  252. ns_t_cert = 37
  253. ns_t_a6 = 38
  254. ns_t_dname = 39
  255. ns_t_sink = 40
  256. ns_t_opt = 41
  257. ns_t_apl = 42
  258. ns_t_tkey = 249
  259. ns_t_tsig = 250
  260. ns_t_ixfr = 251
  261. ns_t_axfr = 252
  262. ns_t_mailb = 253
  263. ns_t_maila = 254
  264. ns_t_any = 255
  265. ns_t_zxfr = 256
  266. ns_t_max = 65536
  267. )
  268. const ( /* nameser.h:210:1: */
  269. ns_c_invalid = 0
  270. ns_c_in = 1
  271. ns_c_2 = 2
  272. ns_c_chaos = 3
  273. ns_c_hs = 4
  274. ns_c_none = 254
  275. ns_c_any = 255
  276. ns_c_max = 65536
  277. )
  278. const ( /* nameser.h:221:1: */
  279. ns_kt_rsa = 1
  280. ns_kt_dh = 2
  281. ns_kt_dsa = 3
  282. ns_kt_private = 254
  283. )
  284. const ( /* nameser.h:228:1: */
  285. cert_t_pkix = 1
  286. cert_t_spki = 2
  287. cert_t_pgp = 3
  288. cert_t_url = 253
  289. cert_t_oid = 254
  290. )
  291. const ( /* nameser.h:28:1: */
  292. ns_s_qd = 0
  293. ns_s_zn = 0
  294. ns_s_an = 1
  295. ns_s_pr = 1
  296. ns_s_ns = 2
  297. ns_s_ud = 2
  298. ns_s_ar = 3
  299. ns_s_max = 4
  300. )
  301. const ( /* nameser.h:75:1: */
  302. ns_f_qr = 0
  303. ns_f_opcode = 1
  304. ns_f_aa = 2
  305. ns_f_tc = 3
  306. ns_f_rd = 4
  307. ns_f_ra = 5
  308. ns_f_z = 6
  309. ns_f_ad = 7
  310. ns_f_cd = 8
  311. ns_f_rcode = 9
  312. ns_f_max = 10
  313. )
  314. const ( /* nameser.h:89:1: */
  315. ns_o_query = 0
  316. ns_o_iquery = 1
  317. ns_o_status = 2
  318. ns_o_notify = 4
  319. ns_o_update = 5
  320. ns_o_max = 6
  321. )
  322. const ( /* nameser.h:98:1: */
  323. ns_r_noerror = 0
  324. ns_r_formerr = 1
  325. ns_r_servfail = 2
  326. ns_r_nxdomain = 3
  327. ns_r_notimpl = 4
  328. ns_r_refused = 5
  329. ns_r_yxdomain = 6
  330. ns_r_yxrrset = 7
  331. ns_r_nxrrset = 8
  332. ns_r_notauth = 9
  333. ns_r_notzone = 10
  334. ns_r_max = 11
  335. ns_r_badvers = 16
  336. ns_r_badsig = 16
  337. ns_r_badkey = 17
  338. ns_r_badtime = 18
  339. )
  340. type ptrdiff_t = int32 /* <builtin>:3:26 */
  341. type size_t = uint32 /* <builtin>:9:23 */
  342. type wchar_t = int32 /* <builtin>:15:24 */
  343. /// typedef __ct_rune_t __wint_t;
  344. ///
  345. ///
  346. ///
  347. /// typedef __uint_least16_t __char16_t;
  348. /// typedef __uint_least32_t __char32_t;
  349. ///
  350. ///
  351. ///
  352. ///
  353. ///
  354. ///
  355. ///
  356. /// typedef struct {
  357. /// long long __max_align1 __attribute__((__aligned__(_Alignof(long long))));
  358. ///
  359. /// long double __max_align2 __attribute__((__aligned__(_Alignof(long double))));
  360. ///
  361. /// } __max_align_t;
  362. ///
  363. /// typedef __uint64_t __dev_t;
  364. ///
  365. /// typedef __uint32_t __fixpt_t;
  366. ///
  367. ///
  368. ///
  369. ///
  370. ///
  371. /// typedef union {
  372. /// char __mbstate8[128];
  373. /// __int64_t _mbstateL;
  374. /// } __mbstate_t;
  375. ///
  376. /// typedef __uintmax_t __rman_res_t;
  377. ///
  378. ///
  379. ///
  380. ///
  381. ///
  382. ///
  383. /// typedef __builtin_va_list __va_list;
  384. ///
  385. ///
  386. ///
  387. ///
  388. ///
  389. ///
  390. /// typedef __va_list __gnuc_va_list;
  391. ///
  392. ///
  393. ///
  394. ///
  395. /// unsigned long ___runetype(__ct_rune_t) __attribute__((__pure__));
  396. /// __ct_rune_t ___tolower(__ct_rune_t) __attribute__((__pure__));
  397. /// __ct_rune_t ___toupper(__ct_rune_t) __attribute__((__pure__));
  398. ///
  399. ///
  400. /// extern int __mb_sb_limit;
  401. type _RuneEntry = struct {
  402. F__min int32
  403. F__max int32
  404. F__map int32
  405. F__types uintptr
  406. } /* table.cpp.c:290:3 */
  407. type _RuneRange = struct {
  408. F__nranges int32
  409. F__ranges uintptr
  410. } /* table.cpp.c:295:3 */
  411. type _RuneLocale = struct {
  412. F__magic [8]int8
  413. F__encoding [32]int8
  414. F__sgetrune uintptr
  415. F__sputrune uintptr
  416. F__invalid_rune int32
  417. F__runetype [256]uint32
  418. F__maplower [256]int32
  419. F__mapupper [256]int32
  420. F__runetype_ext _RuneRange
  421. F__maplower_ext _RuneRange
  422. F__mapupper_ext _RuneRange
  423. F__variable uintptr
  424. F__variable_len int32
  425. } /* table.cpp.c:320:3 */
  426. ///
  427. /// extern const _RuneLocale _DefaultRuneLocale;
  428. /// extern const _RuneLocale *_CurrentRuneLocale;
  429. ///
  430. ///
  431. ///
  432. /// extern _Thread_local const _RuneLocale *_ThreadRuneLocale;
  433. /// static __inline const _RuneLocale *__getCurrentRuneLocale(void)
  434. /// {
  435. ///
  436. /// if (_ThreadRuneLocale)
  437. /// return _ThreadRuneLocale;
  438. /// return _CurrentRuneLocale;
  439. /// }
  440. ///
  441. ///
  442. ///
  443. ///
  444. ///
  445. /// static __inline int
  446. /// __maskrune(__ct_rune_t _c, unsigned long _f)
  447. /// {
  448. /// return ((_c < 0 || _c >= (1 <<8 )) ? ___runetype(_c) :
  449. /// (__getCurrentRuneLocale())->__runetype[_c]) & _f;
  450. /// }
  451. ///
  452. /// static __inline int
  453. /// __sbmaskrune(__ct_rune_t _c, unsigned long _f)
  454. /// {
  455. /// return (_c < 0 || _c >= __mb_sb_limit) ? 0 :
  456. /// (__getCurrentRuneLocale())->__runetype[_c] & _f;
  457. /// }
  458. ///
  459. /// static __inline int
  460. /// __istype(__ct_rune_t _c, unsigned long _f)
  461. /// {
  462. /// return (!!__maskrune(_c, _f));
  463. /// }
  464. ///
  465. /// static __inline int
  466. /// __sbistype(__ct_rune_t _c, unsigned long _f)
  467. /// {
  468. /// return (!!__sbmaskrune(_c, _f));
  469. /// }
  470. ///
  471. /// static __inline int
  472. /// __isctype(__ct_rune_t _c, unsigned long _f)
  473. /// {
  474. /// return (_c < 0 || _c >= 128) ? 0 :
  475. /// !!(_DefaultRuneLocale.__runetype[_c] & _f);
  476. /// }
  477. ///
  478. /// static __inline __ct_rune_t
  479. /// __toupper(__ct_rune_t _c)
  480. /// {
  481. /// return (_c < 0 || _c >= (1 <<8 )) ? ___toupper(_c) :
  482. /// (__getCurrentRuneLocale())->__mapupper[_c];
  483. /// }
  484. ///
  485. /// static __inline __ct_rune_t
  486. /// __sbtoupper(__ct_rune_t _c)
  487. /// {
  488. /// return (_c < 0 || _c >= __mb_sb_limit) ? _c :
  489. /// (__getCurrentRuneLocale())->__mapupper[_c];
  490. /// }
  491. ///
  492. /// static __inline __ct_rune_t
  493. /// __tolower(__ct_rune_t _c)
  494. /// {
  495. /// return (_c < 0 || _c >= (1 <<8 )) ? ___tolower(_c) :
  496. /// (__getCurrentRuneLocale())->__maplower[_c];
  497. /// }
  498. ///
  499. /// static __inline __ct_rune_t
  500. /// __sbtolower(__ct_rune_t _c)
  501. /// {
  502. /// return (_c < 0 || _c >= __mb_sb_limit) ? _c :
  503. /// (__getCurrentRuneLocale())->__maplower[_c];
  504. /// }
  505. ///
  506. /// static __inline int
  507. /// __wcwidth(__ct_rune_t _c)
  508. /// {
  509. /// unsigned int _x;
  510. ///
  511. /// if (_c == 0)
  512. /// return (0);
  513. /// _x = (unsigned int)__maskrune(_c, 0xe0000000L|0x00040000L);
  514. /// if ((_x & 0xe0000000L) != 0)
  515. /// return ((_x & 0xe0000000L) >> 30);
  516. /// return ((_x & 0x00040000L) != 0 ? 1 : -1);
  517. /// }
  518. ///
  519. ///
  520. ///
  521. /// int isalnum(int);
  522. /// int isalpha(int);
  523. /// int iscntrl(int);
  524. /// int isdigit(int);
  525. /// int isgraph(int);
  526. /// int islower(int);
  527. /// int isprint(int);
  528. /// int ispunct(int);
  529. /// int isspace(int);
  530. /// int isupper(int);
  531. /// int isxdigit(int);
  532. /// int tolower(int);
  533. /// int toupper(int);
  534. ///
  535. ///
  536. /// int isascii(int);
  537. /// int toascii(int);
  538. ///
  539. ///
  540. ///
  541. /// int isblank(int);
  542. ///
  543. ///
  544. ///
  545. /// int digittoint(int);
  546. /// int ishexnumber(int);
  547. /// int isideogram(int);
  548. /// int isnumber(int);
  549. /// int isphonogram(int);
  550. /// int isrune(int);
  551. /// int isspecial(int);
  552. ///
  553. ///
  554. ///
  555. ///
  556. ///
  557. /// typedef struct _xlocale *locale_t;
  558. ///
  559. ///
  560. ///
  561. ///
  562. /// unsigned long ___runetype_l(__ct_rune_t, locale_t) __attribute__((__pure__));
  563. /// __ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __attribute__((__pure__));
  564. /// __ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __attribute__((__pure__));
  565. /// _RuneLocale *__runes_for_locale(locale_t, int*);
  566. ///
  567. /// inline int
  568. /// __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
  569. /// inline int
  570. /// __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc);
  571. ///
  572. /// inline int
  573. /// __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
  574. /// {
  575. /// int __limit;
  576. /// _RuneLocale *runes = __runes_for_locale(__loc, &__limit);
  577. /// return (__c < 0 || __c >= __limit) ? 0 :
  578. /// runes->__runetype[__c] & __f;
  579. /// }
  580. ///
  581. /// inline int
  582. /// __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc)
  583. /// {
  584. /// return (!!__sbmaskrune_l(__c, __f, __loc));
  585. /// }
  586. ///
  587. ///
  588. ///
  589. ///
  590. ///
  591. ///
  592. ///
  593. /// inline int isalnum_l(int, locale_t); inline int isalnum_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000100L|0x00000400L|0x00400000L, __l); }
  594. /// inline int isalpha_l(int, locale_t); inline int isalpha_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000100L, __l); }
  595. /// inline int isblank_l(int, locale_t); inline int isblank_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00020000L, __l); }
  596. /// inline int iscntrl_l(int, locale_t); inline int iscntrl_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000200L, __l); }
  597. /// inline int isdigit_l(int, locale_t); inline int isdigit_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000400L, __l); }
  598. /// inline int isgraph_l(int, locale_t); inline int isgraph_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000800L, __l); }
  599. /// inline int ishexnumber_l(int, locale_t); inline int ishexnumber_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00010000L, __l); }
  600. /// inline int isideogram_l(int, locale_t); inline int isideogram_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00080000L, __l); }
  601. /// inline int islower_l(int, locale_t); inline int islower_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00001000L, __l); }
  602. /// inline int isnumber_l(int, locale_t); inline int isnumber_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000400L|0x00400000L, __l); }
  603. /// inline int isphonogram_l(int, locale_t); inline int isphonogram_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00200000L, __l); }
  604. /// inline int isprint_l(int, locale_t); inline int isprint_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00040000L, __l); }
  605. /// inline int ispunct_l(int, locale_t); inline int ispunct_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00002000L, __l); }
  606. /// inline int isrune_l(int, locale_t); inline int isrune_l(int __c, locale_t __l) { return __sbistype_l(__c, 0xFFFFFF00L, __l); }
  607. /// inline int isspace_l(int, locale_t); inline int isspace_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00004000L, __l); }
  608. /// inline int isspecial_l(int, locale_t); inline int isspecial_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00100000L, __l); }
  609. /// inline int isupper_l(int, locale_t); inline int isupper_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00008000L, __l); }
  610. /// inline int isxdigit_l(int, locale_t); inline int isxdigit_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00010000L, __l); }
  611. ///
  612. /// inline int digittoint_l(int, locale_t);
  613. /// inline int tolower_l(int, locale_t);
  614. /// inline int toupper_l(int, locale_t);
  615. ///
  616. /// inline int digittoint_l(int __c, locale_t __l)
  617. /// { return __sbmaskrune_l((__c), 0xFF, __l); }
  618. ///
  619. /// inline int tolower_l(int __c, locale_t __l)
  620. /// {
  621. /// int __limit;
  622. /// _RuneLocale *__runes = __runes_for_locale(__l, &__limit);
  623. /// return (__c < 0 || __c >= __limit) ? __c :
  624. /// __runes->__maplower[__c];
  625. /// }
  626. /// inline int toupper_l(int __c, locale_t __l)
  627. /// {
  628. /// int __limit;
  629. /// _RuneLocale *__runes = __runes_for_locale(__l, &__limit);
  630. /// return (__c < 0 || __c >= __limit) ? __c :
  631. /// __runes->__mapupper[__c];
  632. /// }
  633. ///
  634. ///
  635. ///
  636. ///
  637. ///
  638. ///
  639. ///
  640. ///
  641. ///
  642. ///
  643. ///
  644. ///
  645. ///
  646. ///
  647. ///
  648. /// typedef __mbstate_t mbstate_t;
  649. ///
  650. ///
  651. ///
  652. ///
  653. /// typedef __size_t size_t;
  654. ///
  655. ///
  656. ///
  657. ///
  658. ///
  659. /// typedef __va_list va_list;
  660. ///
  661. ///
  662. ///
  663. ///
  664. ///
  665. ///
  666. /// typedef ___wchar_t wchar_t;
  667. ///
  668. ///
  669. ///
  670. ///
  671. ///
  672. /// typedef __wint_t wint_t;
  673. ///
  674. /// typedef struct __sFILE FILE;
  675. ///
  676. /// struct tm;
  677. ///
  678. ///
  679. /// wint_t btowc(int);
  680. /// wint_t fgetwc(FILE *);
  681. /// wchar_t *
  682. /// fgetws(wchar_t * restrict, int, FILE * restrict);
  683. /// wint_t fputwc(wchar_t, FILE *);
  684. /// int fputws(const wchar_t * restrict, FILE * restrict);
  685. /// int fwide(FILE *, int);
  686. /// int fwprintf(FILE * restrict, const wchar_t * restrict, ...);
  687. /// int fwscanf(FILE * restrict, const wchar_t * restrict, ...);
  688. /// wint_t getwc(FILE *);
  689. /// wint_t getwchar(void);
  690. /// size_t mbrlen(const char * restrict, size_t, mbstate_t * restrict);
  691. /// size_t mbrtowc(wchar_t * restrict, const char * restrict, size_t,
  692. /// mbstate_t * restrict);
  693. /// int mbsinit(const mbstate_t *);
  694. /// size_t mbsrtowcs(wchar_t * restrict, const char ** restrict, size_t,
  695. /// mbstate_t * restrict);
  696. /// wint_t putwc(wchar_t, FILE *);
  697. /// wint_t putwchar(wchar_t);
  698. /// int swprintf(wchar_t * restrict, size_t n, const wchar_t * restrict,
  699. /// ...);
  700. /// int swscanf(const wchar_t * restrict, const wchar_t * restrict, ...);
  701. /// wint_t ungetwc(wint_t, FILE *);
  702. /// int vfwprintf(FILE * restrict, const wchar_t * restrict,
  703. /// __va_list);
  704. /// int vswprintf(wchar_t * restrict, size_t n, const wchar_t * restrict,
  705. /// __va_list);
  706. /// int vwprintf(const wchar_t * restrict, __va_list);
  707. /// size_t wcrtomb(char * restrict, wchar_t, mbstate_t * restrict);
  708. /// wchar_t *wcscat(wchar_t * restrict, const wchar_t * restrict);
  709. /// wchar_t *wcschr(const wchar_t *, wchar_t) __attribute__((__pure__));
  710. /// int wcscmp(const wchar_t *, const wchar_t *) __attribute__((__pure__));
  711. /// int wcscoll(const wchar_t *, const wchar_t *);
  712. /// wchar_t *wcscpy(wchar_t * restrict, const wchar_t * restrict);
  713. /// size_t wcscspn(const wchar_t *, const wchar_t *) __attribute__((__pure__));
  714. /// size_t wcsftime(wchar_t * restrict, size_t, const wchar_t * restrict,
  715. /// const struct tm * restrict);
  716. /// size_t wcslen(const wchar_t *) __attribute__((__pure__));
  717. /// wchar_t *wcsncat(wchar_t * restrict, const wchar_t * restrict,
  718. /// size_t);
  719. /// int wcsncmp(const wchar_t *, const wchar_t *, size_t) __attribute__((__pure__));
  720. /// wchar_t *wcsncpy(wchar_t * restrict , const wchar_t * restrict, size_t);
  721. /// wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __attribute__((__pure__));
  722. /// wchar_t *wcsrchr(const wchar_t *, wchar_t) __attribute__((__pure__));
  723. /// size_t wcsrtombs(char * restrict, const wchar_t ** restrict, size_t,
  724. /// mbstate_t * restrict);
  725. /// size_t wcsspn(const wchar_t *, const wchar_t *) __attribute__((__pure__));
  726. /// wchar_t *wcsstr(const wchar_t * restrict, const wchar_t * restrict)
  727. /// __attribute__((__pure__));
  728. /// size_t wcsxfrm(wchar_t * restrict, const wchar_t * restrict, size_t);
  729. /// int wctob(wint_t);
  730. /// double wcstod(const wchar_t * restrict, wchar_t ** restrict);
  731. /// wchar_t *wcstok(wchar_t * restrict, const wchar_t * restrict,
  732. /// wchar_t ** restrict);
  733. /// long wcstol(const wchar_t * restrict, wchar_t ** restrict, int);
  734. /// unsigned long
  735. /// wcstoul(const wchar_t * restrict, wchar_t ** restrict, int);
  736. /// wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __attribute__((__pure__));
  737. /// int wmemcmp(const wchar_t *, const wchar_t *, size_t) __attribute__((__pure__));
  738. /// wchar_t *wmemcpy(wchar_t * restrict, const wchar_t * restrict, size_t);
  739. /// wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
  740. /// wchar_t *wmemset(wchar_t *, wchar_t, size_t);
  741. /// int wprintf(const wchar_t * restrict, ...);
  742. /// int wscanf(const wchar_t * restrict, ...);
  743. ///
  744. ///
  745. /// extern FILE *__stdinp;
  746. /// extern FILE *__stdoutp;
  747. /// extern FILE *__stderrp;
  748. ///
  749. /// int vfwscanf(FILE * restrict, const wchar_t * restrict,
  750. /// __va_list);
  751. /// int vswscanf(const wchar_t * restrict, const wchar_t * restrict,
  752. /// __va_list);
  753. /// int vwscanf(const wchar_t * restrict, __va_list);
  754. /// float wcstof(const wchar_t * restrict, wchar_t ** restrict);
  755. /// long double
  756. /// wcstold(const wchar_t * restrict, wchar_t ** restrict);
  757. ///
  758. ///
  759. /// long long
  760. /// wcstoll(const wchar_t * restrict, wchar_t ** restrict, int);
  761. ///
  762. /// unsigned long long
  763. /// wcstoull(const wchar_t * restrict, wchar_t ** restrict, int);
  764. ///
  765. ///
  766. ///
  767. ///
  768. /// int wcswidth(const wchar_t *, size_t);
  769. /// int wcwidth(wchar_t);
  770. ///
  771. ///
  772. ///
  773. ///
  774. /// size_t mbsnrtowcs(wchar_t * restrict, const char ** restrict, size_t,
  775. /// size_t, mbstate_t * restrict);
  776. /// FILE *open_wmemstream(wchar_t **, size_t *);
  777. /// wchar_t *wcpcpy(wchar_t * restrict, const wchar_t * restrict);
  778. /// wchar_t *wcpncpy(wchar_t * restrict, const wchar_t * restrict, size_t);
  779. /// wchar_t *wcsdup(const wchar_t *) __attribute__((__malloc__));
  780. /// int wcscasecmp(const wchar_t *, const wchar_t *);
  781. /// int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);
  782. /// size_t wcsnlen(const wchar_t *, size_t) __attribute__((__pure__));
  783. /// size_t wcsnrtombs(char * restrict, const wchar_t ** restrict, size_t,
  784. /// size_t, mbstate_t * restrict);
  785. ///
  786. ///
  787. ///
  788. /// wchar_t *fgetwln(FILE * restrict, size_t * restrict);
  789. /// size_t wcslcat(wchar_t *, const wchar_t *, size_t);
  790. /// size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
  791. ///
  792. ///
  793. ///
  794. ///
  795. ///
  796. /// int wcscasecmp_l(const wchar_t *, const wchar_t *,
  797. /// locale_t);
  798. /// int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t,
  799. /// locale_t);
  800. /// int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
  801. /// size_t wcsxfrm_l(wchar_t * restrict,
  802. /// const wchar_t * restrict, size_t, locale_t);
  803. ///
  804. ///
  805. ///
  806. ///
  807. ///
  808. ///
  809. ///
  810. ///
  811. ///
  812. ///
  813. ///
  814. ///
  815. /// struct lconv {
  816. /// char *decimal_point;
  817. /// char *thousands_sep;
  818. /// char *grouping;
  819. /// char *int_curr_symbol;
  820. /// char *currency_symbol;
  821. /// char *mon_decimal_point;
  822. /// char *mon_thousands_sep;
  823. /// char *mon_grouping;
  824. /// char *positive_sign;
  825. /// char *negative_sign;
  826. /// char int_frac_digits;
  827. /// char frac_digits;
  828. /// char p_cs_precedes;
  829. /// char p_sep_by_space;
  830. /// char n_cs_precedes;
  831. /// char n_sep_by_space;
  832. /// char p_sign_posn;
  833. /// char n_sign_posn;
  834. /// char int_p_cs_precedes;
  835. /// char int_n_cs_precedes;
  836. /// char int_p_sep_by_space;
  837. /// char int_n_sep_by_space;
  838. /// char int_p_sign_posn;
  839. /// char int_n_sign_posn;
  840. /// };
  841. ///
  842. ///
  843. /// struct lconv *localeconv(void);
  844. /// char *setlocale(int, const char *);
  845. ///
  846. ///
  847. ///
  848. ///
  849. /// locale_t duplocale(locale_t base);
  850. /// void freelocale(locale_t loc);
  851. /// locale_t newlocale(int mask, const char *locale, locale_t base);
  852. /// const char *querylocale(int mask, locale_t loc);
  853. /// locale_t uselocale(locale_t loc);
  854. ///
  855. ///
  856. ///
  857. ///
  858. ///
  859. ///
  860. ///
  861. ///
  862. ///
  863. ///
  864. ///
  865. /// wint_t btowc_l(int, locale_t);
  866. /// wint_t fgetwc_l(FILE *, locale_t);
  867. /// wchar_t *fgetws_l(wchar_t * restrict, int, FILE * restrict,
  868. /// locale_t);
  869. /// wint_t fputwc_l(wchar_t, FILE *, locale_t);
  870. /// int fputws_l(const wchar_t * restrict, FILE * restrict,
  871. /// locale_t);
  872. /// int fwprintf_l(FILE * restrict, locale_t,
  873. /// const wchar_t * restrict, ...);
  874. /// int fwscanf_l(FILE * restrict, locale_t,
  875. /// const wchar_t * restrict, ...);
  876. /// wint_t getwc_l(FILE *, locale_t);
  877. /// wint_t getwchar_l(locale_t);
  878. /// size_t mbrlen_l(const char * restrict, size_t,
  879. /// mbstate_t * restrict, locale_t);
  880. /// size_t mbrtowc_l(wchar_t * restrict,
  881. /// const char * restrict, size_t,
  882. /// mbstate_t * restrict, locale_t);
  883. /// int mbsinit_l(const mbstate_t *, locale_t);
  884. /// size_t mbsrtowcs_l(wchar_t * restrict,
  885. /// const char ** restrict, size_t,
  886. /// mbstate_t * restrict, locale_t);
  887. /// wint_t putwc_l(wchar_t, FILE *, locale_t);
  888. /// wint_t putwchar_l(wchar_t, locale_t);
  889. /// int swprintf_l(wchar_t * restrict, size_t n, locale_t,
  890. /// const wchar_t * restrict, ...);
  891. /// int swscanf_l(const wchar_t * restrict, locale_t,
  892. /// const wchar_t * restrict, ...);
  893. /// wint_t ungetwc_l(wint_t, FILE *, locale_t);
  894. /// int vfwprintf_l(FILE * restrict, locale_t,
  895. /// const wchar_t * restrict, __va_list);
  896. /// int vswprintf_l(wchar_t * restrict, size_t n, locale_t,
  897. /// const wchar_t * restrict, __va_list);
  898. /// int vwprintf_l(locale_t, const wchar_t * restrict,
  899. /// __va_list);
  900. /// size_t wcrtomb_l(char * restrict, wchar_t,
  901. /// mbstate_t * restrict, locale_t);
  902. /// size_t wcsftime_l(wchar_t * restrict, size_t,
  903. /// const wchar_t * restrict,
  904. /// const struct tm * restrict, locale_t);
  905. /// size_t wcsrtombs_l(char * restrict,
  906. /// const wchar_t ** restrict, size_t,
  907. /// mbstate_t * restrict, locale_t);
  908. /// double wcstod_l(const wchar_t * restrict,
  909. /// wchar_t ** restrict, locale_t);
  910. /// long wcstol_l(const wchar_t * restrict,
  911. /// wchar_t ** restrict, int, locale_t);
  912. /// unsigned long wcstoul_l(const wchar_t * restrict,
  913. /// wchar_t ** restrict, int, locale_t);
  914. /// int wcswidth_l(const wchar_t *, size_t, locale_t);
  915. /// int wctob_l(wint_t, locale_t);
  916. /// int wcwidth_l(wchar_t, locale_t);
  917. /// int wprintf_l(locale_t, const wchar_t * restrict, ...);
  918. /// int wscanf_l(locale_t, const wchar_t * restrict, ...);
  919. /// int vfwscanf_l(FILE * restrict, locale_t,
  920. /// const wchar_t * restrict, __va_list);
  921. /// int vswscanf_l(const wchar_t * restrict, locale_t,
  922. /// const wchar_t *restrict, __va_list);
  923. /// int vwscanf_l(locale_t, const wchar_t * restrict,
  924. /// __va_list);
  925. /// float wcstof_l(const wchar_t * restrict,
  926. /// wchar_t ** restrict, locale_t);
  927. /// long double wcstold_l(const wchar_t * restrict,
  928. /// wchar_t ** restrict, locale_t);
  929. /// long long wcstoll_l(const wchar_t * restrict,
  930. /// wchar_t ** restrict, int, locale_t);
  931. /// unsigned long long wcstoull_l(const wchar_t * restrict,
  932. /// wchar_t ** restrict, int, locale_t);
  933. /// size_t mbsnrtowcs_l(wchar_t * restrict,
  934. /// const char ** restrict, size_t, size_t,
  935. /// mbstate_t * restrict, locale_t);
  936. /// size_t wcsnrtombs_l(char * restrict,
  937. /// const wchar_t ** restrict, size_t, size_t,
  938. /// mbstate_t * restrict, locale_t);
  939. ///
  940. ///
  941. ///
  942. ///
  943. ///
  944. /// struct lconv *localeconv_l(locale_t);
  945. ///
  946. ///
  947. ///
  948. ///
  949. ///
  950. ///
  951. ///
  952. ///
  953. ///
  954. /// typedef __rune_t rune_t;
  955. ///
  956. /// typedef struct {
  957. /// int quot;
  958. /// int rem;
  959. /// } div_t;
  960. ///
  961. /// typedef struct {
  962. /// long quot;
  963. /// long rem;
  964. /// } ldiv_t;
  965. ///
  966. ///
  967. ///
  968. ///
  969. ///
  970. /// double atof_l(const char *, locale_t);
  971. /// int atoi_l(const char *, locale_t);
  972. /// long atol_l(const char *, locale_t);
  973. /// long long atoll_l(const char *, locale_t);
  974. /// int mblen_l(const char *, size_t, locale_t);
  975. /// size_t mbstowcs_l(wchar_t * restrict,
  976. /// const char * restrict, size_t, locale_t);
  977. /// int mbtowc_l(wchar_t * restrict,
  978. /// const char * restrict, size_t, locale_t);
  979. /// double strtod_l(const char *, char **, locale_t);
  980. /// float strtof_l(const char *, char **, locale_t);
  981. /// long strtol_l(const char *, char **, int, locale_t);
  982. /// long double strtold_l(const char *, char **, locale_t);
  983. /// long long strtoll_l(const char *, char **, int, locale_t);
  984. /// unsigned long strtoul_l(const char *, char **, int, locale_t);
  985. /// unsigned long long strtoull_l(const char *, char **, int, locale_t);
  986. /// size_t wcstombs_l(char * restrict,
  987. /// const wchar_t * restrict, size_t, locale_t);
  988. /// int wctomb_l(char *, wchar_t, locale_t);
  989. ///
  990. /// int ___mb_cur_max_l(locale_t);
  991. ///
  992. ///
  993. /// extern int __mb_cur_max;
  994. /// extern int ___mb_cur_max(void);
  995. ///
  996. ///
  997. /// _Noreturn void abort(void);
  998. /// int abs(int) __attribute__((__const__));
  999. /// int atexit(void (* )(void));
  1000. /// double atof(const char *);
  1001. /// int atoi(const char *);
  1002. /// long atol(const char *);
  1003. /// void *bsearch(const void *, const void *, size_t,
  1004. /// size_t, int (*)(const void * , const void *));
  1005. /// void *calloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__))
  1006. /// __attribute__((__alloc_size__(1, 2)));
  1007. /// div_t div(int, int) __attribute__((__const__));
  1008. /// _Noreturn void exit(int);
  1009. /// void free(void *);
  1010. /// char *getenv(const char *);
  1011. /// long labs(long) __attribute__((__const__));
  1012. /// ldiv_t ldiv(long, long) __attribute__((__const__));
  1013. /// void *malloc(size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(1)));
  1014. /// int mblen(const char *, size_t);
  1015. /// size_t mbstowcs(wchar_t * restrict , const char * restrict, size_t);
  1016. /// int mbtowc(wchar_t * restrict, const char * restrict, size_t);
  1017. /// void qsort(void *, size_t, size_t,
  1018. /// int (* )(const void *, const void *));
  1019. /// int rand(void);
  1020. /// void *realloc(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2)));
  1021. /// void srand(unsigned);
  1022. /// double strtod(const char * restrict, char ** restrict);
  1023. /// float strtof(const char * restrict, char ** restrict);
  1024. /// long strtol(const char * restrict, char ** restrict, int);
  1025. /// long double
  1026. /// strtold(const char * restrict, char ** restrict);
  1027. /// unsigned long
  1028. /// strtoul(const char * restrict, char ** restrict, int);
  1029. /// int system(const char *);
  1030. /// int wctomb(char *, wchar_t);
  1031. /// size_t wcstombs(char * restrict, const wchar_t * restrict, size_t);
  1032. ///
  1033. /// typedef struct {
  1034. /// long long quot;
  1035. /// long long rem;
  1036. /// } lldiv_t;
  1037. ///
  1038. ///
  1039. /// long long
  1040. /// atoll(const char *);
  1041. ///
  1042. /// long long
  1043. /// llabs(long long) __attribute__((__const__));
  1044. ///
  1045. /// lldiv_t lldiv(long long, long long) __attribute__((__const__));
  1046. ///
  1047. /// long long
  1048. /// strtoll(const char * restrict, char ** restrict, int);
  1049. ///
  1050. /// unsigned long long
  1051. /// strtoull(const char * restrict, char ** restrict, int);
  1052. ///
  1053. ///
  1054. /// _Noreturn void _Exit(int);
  1055. ///
  1056. ///
  1057. ///
  1058. ///
  1059. ///
  1060. ///
  1061. /// void * aligned_alloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__alloc_align__(1)))
  1062. /// __attribute__((__alloc_size__(2)));
  1063. /// int at_quick_exit(void (*)(void));
  1064. /// _Noreturn void
  1065. /// quick_exit(int);
  1066. ///
  1067. ///
  1068. ///
  1069. ///
  1070. ///
  1071. /// char *realpath(const char * restrict, char * restrict);
  1072. ///
  1073. ///
  1074. /// int rand_r(unsigned *);
  1075. ///
  1076. ///
  1077. /// int posix_memalign(void **, size_t, size_t);
  1078. /// int setenv(const char *, const char *, int);
  1079. /// int unsetenv(const char *);
  1080. ///
  1081. ///
  1082. ///
  1083. /// int getsubopt(char **, char *const *, char **);
  1084. ///
  1085. /// char *mkdtemp(char *);
  1086. ///
  1087. ///
  1088. ///
  1089. /// int mkstemp(char *);
  1090. ///
  1091. /// long a64l(const char *);
  1092. /// double drand48(void);
  1093. ///
  1094. /// double erand48(unsigned short[3]);
  1095. ///
  1096. ///
  1097. /// char *initstate(unsigned int, char *, size_t);
  1098. /// long jrand48(unsigned short[3]);
  1099. /// char *l64a(long);
  1100. /// void lcong48(unsigned short[7]);
  1101. /// long lrand48(void);
  1102. ///
  1103. /// char *mktemp(char *);
  1104. ///
  1105. ///
  1106. /// long mrand48(void);
  1107. /// long nrand48(unsigned short[3]);
  1108. /// int putenv(char *);
  1109. /// long random(void);
  1110. /// unsigned short
  1111. /// *seed48(unsigned short[3]);
  1112. /// char *setstate( char *);
  1113. /// void srand48(long);
  1114. /// void srandom(unsigned int);
  1115. ///
  1116. ///
  1117. ///
  1118. /// int grantpt(int);
  1119. /// int posix_openpt(int);
  1120. /// char *ptsname(int);
  1121. /// int unlockpt(int);
  1122. ///
  1123. ///
  1124. ///
  1125. /// int ptsname_r(int, char *, size_t);
  1126. ///
  1127. ///
  1128. ///
  1129. /// extern const char *malloc_conf;
  1130. /// extern void (*malloc_message)(void *, const char *);
  1131. ///
  1132. /// void abort2(const char *, int, void **) __attribute__((__noreturn__));
  1133. /// __uint32_t
  1134. /// arc4random(void);
  1135. /// void arc4random_buf(void *, size_t);
  1136. /// __uint32_t
  1137. /// arc4random_uniform(__uint32_t);
  1138. ///
  1139. ///
  1140. ///
  1141. ///
  1142. ///
  1143. ///
  1144. /// char *getbsize(int *, long *);
  1145. ///
  1146. /// char *cgetcap(char *, const char *, int);
  1147. /// int cgetclose(void);
  1148. /// int cgetent(char **, char **, const char *);
  1149. /// int cgetfirst(char **, char **);
  1150. /// int cgetmatch(const char *, const char *);
  1151. /// int cgetnext(char **, char **);
  1152. /// int cgetnum(char *, const char *, long *);
  1153. /// int cgetset(const char *);
  1154. /// int cgetstr(char *, const char *, char **);
  1155. /// int cgetustr(char *, const char *, char **);
  1156. ///
  1157. /// int daemon(int, int);
  1158. /// int daemonfd(int, int);
  1159. /// char *devname(__dev_t, __mode_t);
  1160. /// char *devname_r(__dev_t, __mode_t, char *, int);
  1161. /// char *fdevname(int);
  1162. /// char *fdevname_r(int, char *, int);
  1163. /// int getloadavg(double [], int);
  1164. /// const char *
  1165. /// getprogname(void);
  1166. ///
  1167. /// int heapsort(void *, size_t, size_t,
  1168. /// int (* )(const void *, const void *));
  1169. ///
  1170. ///
  1171. ///
  1172. ///
  1173. ///
  1174. ///
  1175. /// int l64a_r(long, char *, int);
  1176. /// int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
  1177. ///
  1178. ///
  1179. ///
  1180. /// int mkostemp(char *, int);
  1181. /// int mkostemps(char *, int, int);
  1182. /// int mkostempsat(int, char *, int, int);
  1183. /// void qsort_r(void *, size_t, size_t, void *,
  1184. /// int (*)(void *, const void *, const void *));
  1185. /// int radixsort(const unsigned char **, int, const unsigned char *,
  1186. /// unsigned);
  1187. /// void *reallocarray(void *, size_t, size_t) __attribute__((__warn_unused_result__))
  1188. /// __attribute__((__alloc_size__(2, 3)));
  1189. /// void *reallocf(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2)));
  1190. /// int rpmatch(const char *);
  1191. /// void setprogname(const char *);
  1192. /// int sradixsort(const unsigned char **, int, const unsigned char *,
  1193. /// unsigned);
  1194. /// void srandomdev(void);
  1195. /// long long
  1196. /// strtonum(const char *, long long, long long, const char **);
  1197. ///
  1198. ///
  1199. /// __int64_t
  1200. /// strtoq(const char *, char **, int);
  1201. /// __uint64_t
  1202. /// strtouq(const char *, char **, int);
  1203. ///
  1204. /// extern char *suboptarg;
  1205. ///
  1206. ///
  1207. ///
  1208. ///
  1209. ///
  1210. ///
  1211. /// typedef size_t rsize_t;
  1212. ///
  1213. ///
  1214. ///
  1215. ///
  1216. /// typedef int errno_t;
  1217. ///
  1218. ///
  1219. ///
  1220. /// typedef void (*constraint_handler_t)(const char * restrict,
  1221. /// void * restrict, errno_t);
  1222. ///
  1223. /// constraint_handler_t set_constraint_handler_s(constraint_handler_t handler);
  1224. ///
  1225. /// _Noreturn void abort_handler_s(const char * restrict, void * restrict,
  1226. /// errno_t);
  1227. ///
  1228. /// void ignore_handler_s(const char * restrict, void * restrict, errno_t);
  1229. ///
  1230. /// errno_t qsort_s(void *, rsize_t, rsize_t,
  1231. /// int (*)(const void *, const void *, void *), void *);
  1232. ///
  1233. ///
  1234. ///
  1235. ///
  1236. ///
  1237. ///
  1238. ///
  1239. ///
  1240. ///
  1241. ///
  1242. ///
  1243. ///
  1244. ///
  1245. ///
  1246. ///
  1247. ///
  1248. ///
  1249. ///
  1250. ///
  1251. ///
  1252. ///
  1253. ///
  1254. ///
  1255. /// typedef __int8_t int8_t;
  1256. ///
  1257. ///
  1258. ///
  1259. ///
  1260. /// typedef __int16_t int16_t;
  1261. ///
  1262. ///
  1263. ///
  1264. ///
  1265. /// typedef __int32_t int32_t;
  1266. ///
  1267. ///
  1268. ///
  1269. ///
  1270. /// typedef __int64_t int64_t;
  1271. ///
  1272. ///
  1273. ///
  1274. ///
  1275. /// typedef __uint8_t uint8_t;
  1276. ///
  1277. ///
  1278. ///
  1279. ///
  1280. /// typedef __uint16_t uint16_t;
  1281. ///
  1282. ///
  1283. ///
  1284. ///
  1285. /// typedef __uint32_t uint32_t;
  1286. ///
  1287. ///
  1288. ///
  1289. ///
  1290. /// typedef __uint64_t uint64_t;
  1291. ///
  1292. ///
  1293. ///
  1294. ///
  1295. /// typedef __intptr_t intptr_t;
  1296. ///
  1297. ///
  1298. ///
  1299. /// typedef __uintptr_t uintptr_t;
  1300. ///
  1301. ///
  1302. ///
  1303. /// typedef __intmax_t intmax_t;
  1304. ///
  1305. ///
  1306. ///
  1307. /// typedef __uintmax_t uintmax_t;
  1308. ///
  1309. ///
  1310. /// typedef __int_least8_t int_least8_t;
  1311. /// typedef __int_least16_t int_least16_t;
  1312. /// typedef __int_least32_t int_least32_t;
  1313. /// typedef __int_least64_t int_least64_t;
  1314. ///
  1315. /// typedef __uint_least8_t uint_least8_t;
  1316. /// typedef __uint_least16_t uint_least16_t;
  1317. /// typedef __uint_least32_t uint_least32_t;
  1318. /// typedef __uint_least64_t uint_least64_t;
  1319. ///
  1320. /// typedef __int_fast8_t int_fast8_t;
  1321. /// typedef __int_fast16_t int_fast16_t;
  1322. /// typedef __int_fast32_t int_fast32_t;
  1323. /// typedef __int_fast64_t int_fast64_t;
  1324. ///
  1325. /// typedef __uint_fast8_t uint_fast8_t;
  1326. /// typedef __uint_fast16_t uint_fast16_t;
  1327. /// typedef __uint_fast32_t uint_fast32_t;
  1328. /// typedef __uint_fast64_t uint_fast64_t;
  1329. ///
  1330. ///
  1331. ///
  1332. ///
  1333. ///
  1334. ///
  1335. ///
  1336. ///
  1337. ///
  1338. ///
  1339. ///
  1340. ///
  1341. ///
  1342. ///
  1343. ///
  1344. ///
  1345. ///
  1346. /// struct pthread;
  1347. /// struct pthread_attr;
  1348. /// struct pthread_cond;
  1349. /// struct pthread_cond_attr;
  1350. /// struct pthread_mutex;
  1351. /// struct pthread_mutex_attr;
  1352. /// struct pthread_once;
  1353. /// struct pthread_rwlock;
  1354. /// struct pthread_rwlockattr;
  1355. /// struct pthread_barrier;
  1356. /// struct pthread_barrier_attr;
  1357. /// struct pthread_spinlock;
  1358. ///
  1359. /// typedef struct pthread *pthread_t;
  1360. ///
  1361. ///
  1362. /// typedef struct pthread_attr *pthread_attr_t;
  1363. /// typedef struct pthread_mutex *pthread_mutex_t;
  1364. /// typedef struct pthread_mutex_attr *pthread_mutexattr_t;
  1365. /// typedef struct pthread_cond *pthread_cond_t;
  1366. /// typedef struct pthread_cond_attr *pthread_condattr_t;
  1367. /// typedef int pthread_key_t;
  1368. /// typedef struct pthread_once pthread_once_t;
  1369. /// typedef struct pthread_rwlock *pthread_rwlock_t;
  1370. /// typedef struct pthread_rwlockattr *pthread_rwlockattr_t;
  1371. /// typedef struct pthread_barrier *pthread_barrier_t;
  1372. /// typedef struct pthread_barrierattr *pthread_barrierattr_t;
  1373. /// typedef struct pthread_spinlock *pthread_spinlock_t;
  1374. ///
  1375. ///
  1376. ///
  1377. ///
  1378. ///
  1379. ///
  1380. ///
  1381. /// typedef void *pthread_addr_t;
  1382. /// typedef void *(*pthread_startroutine_t)(void *);
  1383. ///
  1384. ///
  1385. ///
  1386. ///
  1387. /// struct pthread_once {
  1388. /// int state;
  1389. /// pthread_mutex_t mutex;
  1390. /// };
  1391. ///
  1392. ///
  1393. ///
  1394. /// typedef unsigned char u_char;
  1395. /// typedef unsigned short u_short;
  1396. /// typedef unsigned int u_int;
  1397. /// typedef unsigned long u_long;
  1398. ///
  1399. /// typedef unsigned short ushort;
  1400. /// typedef unsigned int uint;
  1401. ///
  1402. /// typedef __uint8_t u_int8_t;
  1403. /// typedef __uint16_t u_int16_t;
  1404. /// typedef __uint32_t u_int32_t;
  1405. /// typedef __uint64_t u_int64_t;
  1406. ///
  1407. /// typedef __uint64_t u_quad_t;
  1408. /// typedef __int64_t quad_t;
  1409. /// typedef quad_t * qaddr_t;
  1410. ///
  1411. /// typedef char * caddr_t;
  1412. /// typedef const char * c_caddr_t;
  1413. ///
  1414. ///
  1415. /// typedef __blksize_t blksize_t;
  1416. ///
  1417. ///
  1418. ///
  1419. /// typedef __cpuwhich_t cpuwhich_t;
  1420. /// typedef __cpulevel_t cpulevel_t;
  1421. /// typedef __cpusetid_t cpusetid_t;
  1422. ///
  1423. ///
  1424. /// typedef __blkcnt_t blkcnt_t;
  1425. ///
  1426. ///
  1427. ///
  1428. ///
  1429. /// typedef __clock_t clock_t;
  1430. ///
  1431. ///
  1432. ///
  1433. ///
  1434. /// typedef __clockid_t clockid_t;
  1435. ///
  1436. ///
  1437. ///
  1438. /// typedef __critical_t critical_t;
  1439. /// typedef __daddr_t daddr_t;
  1440. ///
  1441. ///
  1442. /// typedef __dev_t dev_t;
  1443. ///
  1444. ///
  1445. ///
  1446. ///
  1447. /// typedef __fflags_t fflags_t;
  1448. ///
  1449. ///
  1450. ///
  1451. /// typedef __fixpt_t fixpt_t;
  1452. ///
  1453. ///
  1454. /// typedef __fsblkcnt_t fsblkcnt_t;
  1455. /// typedef __fsfilcnt_t fsfilcnt_t;
  1456. ///
  1457. ///
  1458. ///
  1459. ///
  1460. /// typedef __gid_t gid_t;
  1461. ///
  1462. ///
  1463. ///
  1464. ///
  1465. /// typedef __uint32_t in_addr_t;
  1466. ///
  1467. ///
  1468. ///
  1469. ///
  1470. /// typedef __uint16_t in_port_t;
  1471. ///
  1472. ///
  1473. ///
  1474. ///
  1475. /// typedef __id_t id_t;
  1476. ///
  1477. ///
  1478. ///
  1479. ///
  1480. /// typedef __ino_t ino_t;
  1481. ///
  1482. ///
  1483. ///
  1484. ///
  1485. /// typedef __key_t key_t;
  1486. ///
  1487. ///
  1488. ///
  1489. ///
  1490. /// typedef __lwpid_t lwpid_t;
  1491. ///
  1492. ///
  1493. ///
  1494. ///
  1495. /// typedef __mode_t mode_t;
  1496. ///
  1497. ///
  1498. ///
  1499. ///
  1500. /// typedef __accmode_t accmode_t;
  1501. ///
  1502. ///
  1503. ///
  1504. ///
  1505. /// typedef __nlink_t nlink_t;
  1506. ///
  1507. ///
  1508. ///
  1509. ///
  1510. /// typedef __off_t off_t;
  1511. ///
  1512. ///
  1513. ///
  1514. ///
  1515. /// typedef __off64_t off64_t;
  1516. ///
  1517. ///
  1518. ///
  1519. ///
  1520. /// typedef __pid_t pid_t;
  1521. ///
  1522. ///
  1523. ///
  1524. /// typedef __register_t register_t;
  1525. ///
  1526. ///
  1527. /// typedef __rlim_t rlim_t;
  1528. ///
  1529. ///
  1530. ///
  1531. /// typedef __int64_t sbintime_t;
  1532. ///
  1533. /// typedef __segsz_t segsz_t;
  1534. ///
  1535. ///
  1536. ///
  1537. ///
  1538. ///
  1539. ///
  1540. ///
  1541. /// typedef __ssize_t ssize_t;
  1542. ///
  1543. ///
  1544. ///
  1545. ///
  1546. /// typedef __suseconds_t suseconds_t;
  1547. ///
  1548. ///
  1549. ///
  1550. ///
  1551. /// typedef __time_t time_t;
  1552. ///
  1553. ///
  1554. ///
  1555. ///
  1556. /// typedef __timer_t timer_t;
  1557. ///
  1558. ///
  1559. ///
  1560. ///
  1561. /// typedef __mqd_t mqd_t;
  1562. ///
  1563. ///
  1564. ///
  1565. /// typedef __u_register_t u_register_t;
  1566. ///
  1567. ///
  1568. /// typedef __uid_t uid_t;
  1569. ///
  1570. ///
  1571. ///
  1572. ///
  1573. /// typedef __useconds_t useconds_t;
  1574. ///
  1575. ///
  1576. ///
  1577. ///
  1578. ///
  1579. /// typedef unsigned long cap_ioctl_t;
  1580. ///
  1581. ///
  1582. ///
  1583. ///
  1584. /// struct cap_rights;
  1585. ///
  1586. /// typedef struct cap_rights cap_rights_t;
  1587. ///
  1588. /// typedef __uint64_t kpaddr_t;
  1589. /// typedef __uint64_t kvaddr_t;
  1590. /// typedef __uint64_t ksize_t;
  1591. /// typedef __int64_t kssize_t;
  1592. ///
  1593. /// typedef __vm_offset_t vm_offset_t;
  1594. /// typedef __uint64_t vm_ooffset_t;
  1595. /// typedef __vm_paddr_t vm_paddr_t;
  1596. /// typedef __uint64_t vm_pindex_t;
  1597. /// typedef __vm_size_t vm_size_t;
  1598. ///
  1599. /// typedef __rman_res_t rman_res_t;
  1600. ///
  1601. /// static __inline __uint16_t
  1602. /// __bitcount16(__uint16_t _x)
  1603. /// {
  1604. ///
  1605. /// _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
  1606. /// _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
  1607. /// _x = (_x + (_x >> 4)) & 0x0f0f;
  1608. /// _x = (_x + (_x >> 8)) & 0x00ff;
  1609. /// return (_x);
  1610. /// }
  1611. ///
  1612. /// static __inline __uint32_t
  1613. /// __bitcount32(__uint32_t _x)
  1614. /// {
  1615. ///
  1616. /// _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
  1617. /// _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
  1618. /// _x = (_x + (_x >> 4)) & 0x0f0f0f0f;
  1619. /// _x = (_x + (_x >> 8));
  1620. /// _x = (_x + (_x >> 16)) & 0x000000ff;
  1621. /// return (_x);
  1622. /// }
  1623. ///
  1624. ///
  1625. /// static __inline __uint64_t
  1626. /// __bitcount64(__uint64_t _x)
  1627. /// {
  1628. ///
  1629. /// _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
  1630. /// _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
  1631. /// _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
  1632. /// _x = (_x + (_x >> 8));
  1633. /// _x = (_x + (_x >> 16));
  1634. /// _x = (_x + (_x >> 32)) & 0x000000ff;
  1635. /// return (_x);
  1636. /// }
  1637. ///
  1638. ///
  1639. ///
  1640. ///
  1641. ///
  1642. /// typedef struct __sigset {
  1643. /// __uint32_t __bits[4];
  1644. /// } __sigset_t;
  1645. ///
  1646. ///
  1647. ///
  1648. /// struct timeval {
  1649. /// time_t tv_sec;
  1650. /// suseconds_t tv_usec;
  1651. /// };
  1652. ///
  1653. ///
  1654. ///
  1655. ///
  1656. ///
  1657. /// struct timespec {
  1658. /// time_t tv_sec;
  1659. /// long tv_nsec;
  1660. /// };
  1661. ///
  1662. ///
  1663. /// struct itimerspec {
  1664. /// struct timespec it_interval;
  1665. /// struct timespec it_value;
  1666. /// };
  1667. ///
  1668. ///
  1669. /// typedef unsigned long __fd_mask;
  1670. ///
  1671. /// typedef __fd_mask fd_mask;
  1672. ///
  1673. ///
  1674. ///
  1675. ///
  1676. /// typedef __sigset_t sigset_t;
  1677. ///
  1678. /// typedef struct fd_set {
  1679. /// __fd_mask __fds_bits[(((1024) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8)))];
  1680. /// } fd_set;
  1681. ///
  1682. ///
  1683. /// int pselect(int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
  1684. /// const struct timespec *restrict, const sigset_t *restrict);
  1685. ///
  1686. ///
  1687. ///
  1688. /// int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  1689. ///
  1690. ///
  1691. ///
  1692. ///
  1693. /// static __inline int
  1694. /// __major(dev_t _d)
  1695. /// {
  1696. /// return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff));
  1697. /// }
  1698. ///
  1699. /// static __inline int
  1700. /// __minor(dev_t _d)
  1701. /// {
  1702. /// return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff));
  1703. /// }
  1704. ///
  1705. /// static __inline dev_t
  1706. /// __makedev(int _Major, int _Minor)
  1707. /// {
  1708. /// return (((dev_t)(_Major & 0xffffff00) << 32) | ((_Major & 0xff) << 8) |
  1709. /// ((dev_t)(_Minor & 0xff00) << 24) | (_Minor & 0xffff00ff));
  1710. /// }
  1711. ///
  1712. ///
  1713. ///
  1714. ///
  1715. ///
  1716. ///
  1717. ///
  1718. ///
  1719. ///
  1720. ///
  1721. /// int ftruncate(int, off_t);
  1722. ///
  1723. ///
  1724. ///
  1725. /// off_t lseek(int, off_t, int);
  1726. ///
  1727. ///
  1728. ///
  1729. /// void * mmap(void *, size_t, int, int, int, off_t);
  1730. ///
  1731. ///
  1732. ///
  1733. /// int truncate(const char *, off_t);
  1734. ///
  1735. ///
  1736. ///
  1737. ///
  1738. ///
  1739. ///
  1740. ///
  1741. ///
  1742. /// static __inline int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "char" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "char" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); };
  1743. /// static __inline int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "short" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, u_short src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "short" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); };
  1744. /// static __inline int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "int" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "int" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); };
  1745. /// static __inline int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "long" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "long" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); };
  1746. ///
  1747. ///
  1748. ///
  1749. ///
  1750. ///
  1751. /// static __inline u_int
  1752. /// atomic_fetchadd_int(volatile u_int *p, u_int v)
  1753. /// {
  1754. ///
  1755. /// __asm volatile(
  1756. /// " " "lock ; " " "
  1757. /// " xaddl %0,%1 ; "
  1758. /// "# atomic_fetchadd_int"
  1759. /// : "+r" (v),
  1760. /// "+m" (*p)
  1761. /// : : "cc");
  1762. /// return (v);
  1763. /// }
  1764. ///
  1765. ///
  1766. ///
  1767. ///
  1768. ///
  1769. /// static __inline u_long
  1770. /// atomic_fetchadd_long(volatile u_long *p, u_long v)
  1771. /// {
  1772. ///
  1773. /// __asm volatile(
  1774. /// " " "lock ; " " "
  1775. /// " xaddq %0,%1 ; "
  1776. /// "# atomic_fetchadd_long"
  1777. /// : "+r" (v),
  1778. /// "+m" (*p)
  1779. /// : : "cc");
  1780. /// return (v);
  1781. /// }
  1782. ///
  1783. /// static __inline int
  1784. /// atomic_testandset_int(volatile u_int *p, u_int v)
  1785. /// {
  1786. /// u_char res;
  1787. ///
  1788. /// __asm volatile(
  1789. /// " " "lock ; " " "
  1790. /// " btsl %2,%1 ; "
  1791. /// "# atomic_testandset_int"
  1792. /// : "=@ccc" (res),
  1793. /// "+m" (*p)
  1794. /// : "Ir" (v & 0x1f)
  1795. /// : "cc");
  1796. /// return (res);
  1797. /// }
  1798. ///
  1799. /// static __inline int
  1800. /// atomic_testandset_long(volatile u_long *p, u_int v)
  1801. /// {
  1802. /// u_char res;
  1803. ///
  1804. /// __asm volatile(
  1805. /// " " "lock ; " " "
  1806. /// " btsq %2,%1 ; "
  1807. /// "# atomic_testandset_long"
  1808. /// : "=@ccc" (res),
  1809. /// "+m" (*p)
  1810. /// : "Jr" ((u_long)(v & 0x3f))
  1811. /// : "cc");
  1812. /// return (res);
  1813. /// }
  1814. ///
  1815. /// static __inline int
  1816. /// atomic_testandclear_int(volatile u_int *p, u_int v)
  1817. /// {
  1818. /// u_char res;
  1819. ///
  1820. /// __asm volatile(
  1821. /// " " "lock ; " " "
  1822. /// " btrl %2,%1 ; "
  1823. /// "# atomic_testandclear_int"
  1824. /// : "=@ccc" (res),
  1825. /// "+m" (*p)
  1826. /// : "Ir" (v & 0x1f)
  1827. /// : "cc");
  1828. /// return (res);
  1829. /// }
  1830. ///
  1831. /// static __inline int
  1832. /// atomic_testandclear_long(volatile u_long *p, u_int v)
  1833. /// {
  1834. /// u_char res;
  1835. ///
  1836. /// __asm volatile(
  1837. /// " " "lock ; " " "
  1838. /// " btrq %2,%1 ; "
  1839. /// "# atomic_testandclear_long"
  1840. /// : "=@ccc" (res),
  1841. /// "+m" (*p)
  1842. /// : "Jr" ((u_long)(v & 0x3f))
  1843. /// : "cc");
  1844. /// return (res);
  1845. /// }
  1846. ///
  1847. /// static __inline void
  1848. /// __storeload_barrier(void)
  1849. /// {
  1850. ///
  1851. /// __asm volatile("lock; addl $0,-8(%%rsp)" : : : "memory", "cc");
  1852. /// }
  1853. ///
  1854. /// static __inline void
  1855. /// atomic_thread_fence_acq(void)
  1856. /// {
  1857. ///
  1858. /// __asm volatile(" " : : : "memory");
  1859. /// }
  1860. ///
  1861. /// static __inline void
  1862. /// atomic_thread_fence_rel(void)
  1863. /// {
  1864. ///
  1865. /// __asm volatile(" " : : : "memory");
  1866. /// }
  1867. ///
  1868. /// static __inline void
  1869. /// atomic_thread_fence_acq_rel(void)
  1870. /// {
  1871. ///
  1872. /// __asm volatile(" " : : : "memory");
  1873. /// }
  1874. ///
  1875. /// static __inline void
  1876. /// atomic_thread_fence_seq_cst(void)
  1877. /// {
  1878. ///
  1879. /// __storeload_barrier();
  1880. /// }
  1881. ///
  1882. ///
  1883. ///
  1884. /// static __inline void atomic_set_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "orb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_set_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "orb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack;
  1885. /// static __inline void atomic_clear_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "andb %b1,%0" : "+m" (*p) : "iq" (~v) : "cc"); } static __inline void atomic_clear_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "andb %b1,%0" : "+m" (*p) : "iq" (~v) : "memory", "cc"); } struct __hack;
  1886. /// static __inline void atomic_add_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "addb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_add_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "addb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack;
  1887. /// static __inline void atomic_subtract_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "subb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_subtract_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "subb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack;
  1888. ///
  1889. /// static __inline void atomic_set_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "orw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_set_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "orw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack;
  1890. /// static __inline void atomic_clear_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "andw %w1,%0" : "+m" (*p) : "ir" (~v) : "cc"); } static __inline void atomic_clear_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "andw %w1,%0" : "+m" (*p) : "ir" (~v) : "memory", "cc"); } struct __hack;
  1891. /// static __inline void atomic_add_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "addw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_add_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "addw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack;
  1892. /// static __inline void atomic_subtract_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "subw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_subtract_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "subw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack;
  1893. ///
  1894. /// static __inline void atomic_set_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "orl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_set_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "orl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack;
  1895. /// static __inline void atomic_clear_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "andl %1,%0" : "+m" (*p) : "ir" (~v) : "cc"); } static __inline void atomic_clear_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "andl %1,%0" : "+m" (*p) : "ir" (~v) : "memory", "cc"); } struct __hack;
  1896. /// static __inline void atomic_add_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "addl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_add_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "addl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack;
  1897. /// static __inline void atomic_subtract_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "subl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_subtract_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "subl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack;
  1898. ///
  1899. /// static __inline void atomic_set_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "orq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_set_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "orq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack;
  1900. /// static __inline void atomic_clear_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "andq %1,%0" : "+m" (*p) : "er" (~v) : "cc"); } static __inline void atomic_clear_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "andq %1,%0" : "+m" (*p) : "er" (~v) : "memory", "cc"); } struct __hack;
  1901. /// static __inline void atomic_add_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "addq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_add_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "addq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack;
  1902. /// static __inline void atomic_subtract_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "subq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_subtract_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "subq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack;
  1903. ///
  1904. ///
  1905. ///
  1906. ///
  1907. ///
  1908. /// static __inline u_char atomic_load_acq_char(volatile u_char *p) { u_char res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_char(volatile u_char *p, u_char v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack;
  1909. /// static __inline u_short atomic_load_acq_short(volatile u_short *p) { u_short res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_short(volatile u_short *p, u_short v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack;
  1910. /// static __inline u_int atomic_load_acq_int(volatile u_int *p) { u_int res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_int(volatile u_int *p, u_int v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack;
  1911. /// static __inline u_long atomic_load_acq_long(volatile u_long *p) { u_long res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_long(volatile u_long *p, u_long v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack;
  1912. ///
  1913. /// static __inline u_int
  1914. /// atomic_swap_int(volatile u_int *p, u_int v)
  1915. /// {
  1916. ///
  1917. /// __asm volatile(
  1918. /// " xchgl %1,%0 ; "
  1919. /// "# atomic_swap_int"
  1920. /// : "+r" (v),
  1921. /// "+m" (*p));
  1922. /// return (v);
  1923. /// }
  1924. ///
  1925. /// static __inline u_long
  1926. /// atomic_swap_long(volatile u_long *p, u_long v)
  1927. /// {
  1928. ///
  1929. /// __asm volatile(
  1930. /// " xchgq %1,%0 ; "
  1931. /// "# atomic_swap_long"
  1932. /// : "+r" (v),
  1933. /// "+m" (*p));
  1934. /// return (v);
  1935. /// }
  1936. ///
  1937. ///
  1938. ///
  1939. ///
  1940. ///
  1941. /// extern char *_PathLocale;
  1942. ///
  1943. /// int __detect_path_locale(void);
  1944. /// int __wrap_setrunelocale(const char *);
  1945. ///
  1946. ///
  1947. /// enum {
  1948. /// XLC_COLLATE = 0,
  1949. /// XLC_CTYPE,
  1950. /// XLC_MONETARY,
  1951. /// XLC_NUMERIC,
  1952. /// XLC_TIME,
  1953. /// XLC_MESSAGES,
  1954. /// XLC_LAST
  1955. /// };
  1956. ///
  1957. /// _Static_assert(XLC_LAST - XLC_COLLATE == 6, "XLC values should be contiguous");
  1958. /// _Static_assert(XLC_COLLATE ==
  1959. ///
  1960. /// 1
  1961. ///
  1962. /// - 1,
  1963. /// "XLC_COLLATE doesn't match the LC_COLLATE value.");
  1964. /// _Static_assert(XLC_CTYPE ==
  1965. ///
  1966. /// 2
  1967. ///
  1968. /// - 1,
  1969. /// "XLC_CTYPE doesn't match the LC_CTYPE value.");
  1970. /// _Static_assert(XLC_MONETARY ==
  1971. ///
  1972. /// 3
  1973. ///
  1974. /// - 1,
  1975. /// "XLC_MONETARY doesn't match the LC_MONETARY value.");
  1976. /// _Static_assert(XLC_NUMERIC ==
  1977. ///
  1978. /// 4
  1979. ///
  1980. /// - 1,
  1981. /// "XLC_NUMERIC doesn't match the LC_NUMERIC value.");
  1982. /// _Static_assert(XLC_TIME ==
  1983. ///
  1984. /// 5
  1985. ///
  1986. /// - 1,
  1987. /// "XLC_TIME doesn't match the LC_TIME value.");
  1988. /// _Static_assert(XLC_MESSAGES ==
  1989. ///
  1990. /// 6
  1991. ///
  1992. /// - 1,
  1993. /// "XLC_MESSAGES doesn't match the LC_MESSAGES value.");
  1994. ///
  1995. /// struct xlocale_refcounted {
  1996. ///
  1997. /// long retain_count;
  1998. ///
  1999. /// void(*destructor)(void*);
  2000. /// };
  2001. ///
  2002. ///
  2003. ///
  2004. ///
  2005. ///
  2006. ///
  2007. ///
  2008. /// struct xlocale_component {
  2009. /// struct xlocale_refcounted header;
  2010. ///
  2011. /// char locale[31 +1];
  2012. ///
  2013. /// char version[12];
  2014. /// };
  2015. ///
  2016. ///
  2017. ///
  2018. ///
  2019. /// struct _xlocale {
  2020. /// struct xlocale_refcounted header;
  2021. ///
  2022. /// struct xlocale_component *components[XLC_LAST];
  2023. ///
  2024. ///
  2025. /// int monetary_locale_changed;
  2026. ///
  2027. ///
  2028. /// int using_monetary_locale;
  2029. ///
  2030. ///
  2031. /// int numeric_locale_changed;
  2032. ///
  2033. ///
  2034. /// int using_numeric_locale;
  2035. ///
  2036. ///
  2037. /// int using_time_locale;
  2038. ///
  2039. ///
  2040. /// int using_messages_locale;
  2041. ///
  2042. /// struct lconv lconv;
  2043. ///
  2044. /// char *csym;
  2045. /// };
  2046. ///
  2047. ///
  2048. ///
  2049. ///
  2050. /// __attribute__((unused)) static void*
  2051. /// xlocale_retain(void *val)
  2052. /// {
  2053. /// struct xlocale_refcounted *obj = val;
  2054. /// atomic_add_long(&(obj->retain_count), 1);
  2055. /// return (val);
  2056. /// }
  2057. ///
  2058. ///
  2059. ///
  2060. ///
  2061. /// __attribute__((unused)) static void
  2062. /// xlocale_release(void *val)
  2063. /// {
  2064. /// struct xlocale_refcounted *obj = val;
  2065. /// long count;
  2066. ///
  2067. /// count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
  2068. /// if (count < 0 && obj->destructor !=
  2069. ///
  2070. /// ((void *)0)
  2071. ///
  2072. /// )
  2073. /// obj->destructor(obj);
  2074. /// }
  2075. ///
  2076. ///
  2077. ///
  2078. ///
  2079. ///
  2080. /// extern void* __collate_load(const char*, locale_t);
  2081. /// extern void* __ctype_load(const char*, locale_t);
  2082. /// extern void* __messages_load(const char*, locale_t);
  2083. /// extern void* __monetary_load(const char*, locale_t);
  2084. /// extern void* __numeric_load(const char*, locale_t);
  2085. /// extern void* __time_load(const char*, locale_t);
  2086. ///
  2087. /// extern struct _xlocale __xlocale_global_locale;
  2088. /// extern struct _xlocale __xlocale_C_locale;
  2089. ///
  2090. ///
  2091. ///
  2092. ///
  2093. /// void __set_thread_rune_locale(locale_t loc);
  2094. ///
  2095. ///
  2096. ///
  2097. ///
  2098. /// extern int __has_thread_locale;
  2099. ///
  2100. ///
  2101. ///
  2102. ///
  2103. ///
  2104. /// extern _Thread_local locale_t __thread_locale;
  2105. ///
  2106. ///
  2107. ///
  2108. ///
  2109. ///
  2110. ///
  2111. ///
  2112. /// static inline locale_t __get_locale(void)
  2113. /// {
  2114. ///
  2115. /// if (!__has_thread_locale) {
  2116. /// return (&__xlocale_global_locale);
  2117. /// }
  2118. /// return (__thread_locale ? __thread_locale : &__xlocale_global_locale);
  2119. /// }
  2120. ///
  2121. ///
  2122. ///
  2123. ///
  2124. ///
  2125. /// static inline locale_t get_real_locale(locale_t locale)
  2126. /// {
  2127. /// switch ((intptr_t)locale) {
  2128. /// case 0: return (&__xlocale_C_locale);
  2129. /// case -1: return (&__xlocale_global_locale);
  2130. /// default: return (locale);
  2131. /// }
  2132. /// }
  2133. ///
  2134. ///
  2135. ///
  2136. ///
  2137. ///
  2138. ///
  2139. ///
  2140. ///
  2141. /// struct xlocale_ctype {
  2142. /// struct xlocale_component header;
  2143. /// _RuneLocale *runes;
  2144. /// size_t (*__mbrtowc)(wchar_t *
  2145. ///
  2146. /// restrict
  2147. ///
  2148. /// , const char *
  2149. ///
  2150. /// restrict
  2151. ///
  2152. /// ,
  2153. /// size_t, mbstate_t *
  2154. ///
  2155. /// restrict
  2156. ///
  2157. /// );
  2158. /// int (*__mbsinit)(const mbstate_t *);
  2159. /// size_t (*__mbsnrtowcs)(wchar_t *
  2160. ///
  2161. /// restrict
  2162. ///
  2163. /// , const char **
  2164. ///
  2165. /// restrict
  2166. ///
  2167. /// ,
  2168. /// size_t, size_t, mbstate_t *
  2169. ///
  2170. /// restrict
  2171. ///
  2172. /// );
  2173. /// size_t (*__wcrtomb)(char *
  2174. ///
  2175. /// restrict
  2176. ///
  2177. /// , wchar_t, mbstate_t *
  2178. ///
  2179. /// restrict
  2180. ///
  2181. /// );
  2182. /// size_t (*__wcsnrtombs)(char *
  2183. ///
  2184. /// restrict
  2185. ///
  2186. /// , const wchar_t **
  2187. ///
  2188. /// restrict
  2189. ///
  2190. /// ,
  2191. /// size_t, size_t, mbstate_t *
  2192. ///
  2193. /// restrict
  2194. ///
  2195. /// );
  2196. /// int __mb_cur_max;
  2197. /// int __mb_sb_limit;
  2198. ///
  2199. /// __mbstate_t mblen;
  2200. ///
  2201. /// __mbstate_t mbrlen;
  2202. ///
  2203. /// __mbstate_t mbrtoc16;
  2204. ///
  2205. /// __mbstate_t mbrtoc32;
  2206. ///
  2207. /// __mbstate_t mbrtowc;
  2208. ///
  2209. /// __mbstate_t mbsnrtowcs;
  2210. ///
  2211. /// __mbstate_t mbsrtowcs;
  2212. ///
  2213. /// __mbstate_t mbtowc;
  2214. ///
  2215. /// __mbstate_t c16rtomb;
  2216. ///
  2217. /// __mbstate_t c32rtomb;
  2218. ///
  2219. /// __mbstate_t wcrtomb;
  2220. ///
  2221. /// __mbstate_t wcsnrtombs;
  2222. ///
  2223. /// __mbstate_t wcsrtombs;
  2224. ///
  2225. /// __mbstate_t wctomb;
  2226. /// };
  2227. ///
  2228. /// extern struct xlocale_ctype __xlocale_global_ctype;
  2229. ///
  2230. ///
  2231. ///
  2232. ///
  2233. /// int _none_init(struct xlocale_ctype *, _RuneLocale *)
  2234. ///
  2235. /// __attribute__((__visibility__("hidden")))
  2236. ///
  2237. /// ;
  2238. /// int _UTF8_init(struct xlocale_ctype *, _RuneLocale *)
  2239. ///
  2240. /// __attribute__((__visibility__("hidden")))
  2241. ///
  2242. /// ;
  2243. /// int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *)
  2244. ///
  2245. /// __attribute__((__visibility__("hidden")))
  2246. ///
  2247. /// ;
  2248. /// int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *)
  2249. ///
  2250. /// __attribute__((__visibility__("hidden")))
  2251. ///
  2252. /// ;
  2253. /// int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *)
  2254. ///
  2255. /// __attribute__((__visibility__("hidden")))
  2256. ///
  2257. /// ;
  2258. /// int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *)
  2259. ///
  2260. /// __attribute__((__visibility__("hidden")))
  2261. ///
  2262. /// ;
  2263. /// int _GB18030_init(struct xlocale_ctype *, _RuneLocale *)
  2264. ///
  2265. /// __attribute__((__visibility__("hidden")))
  2266. ///
  2267. /// ;
  2268. /// int _GB2312_init(struct xlocale_ctype *, _RuneLocale *)
  2269. ///
  2270. /// __attribute__((__visibility__("hidden")))
  2271. ///
  2272. /// ;
  2273. /// int _GBK_init(struct xlocale_ctype *, _RuneLocale *)
  2274. ///
  2275. /// __attribute__((__visibility__("hidden")))
  2276. ///
  2277. /// ;
  2278. /// int _BIG5_init(struct xlocale_ctype *, _RuneLocale *)
  2279. ///
  2280. /// __attribute__((__visibility__("hidden")))
  2281. ///
  2282. /// ;
  2283. /// int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *)
  2284. ///
  2285. /// __attribute__((__visibility__("hidden")))
  2286. ///
  2287. /// ;
  2288. /// int _ascii_init(struct xlocale_ctype *, _RuneLocale *)
  2289. ///
  2290. /// __attribute__((__visibility__("hidden")))
  2291. ///
  2292. /// ;
  2293. ///
  2294. /// typedef size_t (*mbrtowc_pfn_t)(wchar_t *
  2295. ///
  2296. /// restrict
  2297. ///
  2298. /// ,
  2299. /// const char *
  2300. ///
  2301. /// restrict
  2302. ///
  2303. /// , size_t, mbstate_t *
  2304. ///
  2305. /// restrict
  2306. ///
  2307. /// );
  2308. /// typedef size_t (*wcrtomb_pfn_t)(char *
  2309. ///
  2310. /// restrict
  2311. ///
  2312. /// , wchar_t,
  2313. /// mbstate_t *
  2314. ///
  2315. /// restrict
  2316. ///
  2317. /// );
  2318. /// size_t __mbsnrtowcs_std(wchar_t *
  2319. ///
  2320. /// restrict
  2321. ///
  2322. /// , const char **
  2323. ///
  2324. /// restrict
  2325. ///
  2326. /// ,
  2327. /// size_t, size_t, mbstate_t *
  2328. ///
  2329. /// restrict
  2330. ///
  2331. /// , mbrtowc_pfn_t);
  2332. /// size_t __wcsnrtombs_std(char *
  2333. ///
  2334. /// restrict
  2335. ///
  2336. /// , const wchar_t **
  2337. ///
  2338. /// restrict
  2339. ///
  2340. /// ,
  2341. /// size_t, size_t, mbstate_t *
  2342. ///
  2343. /// restrict
  2344. ///
  2345. /// , wcrtomb_pfn_t);
  2346. ///
  2347. var X_DefaultRuneLocale = _RuneLocale{
  2348. F__magic: *(*[8]int8)(unsafe.Pointer(ts)),
  2349. F__encoding: *(*[32]int8)(unsafe.Pointer(ts + 9)),
  2350. F__invalid_rune: 0xFFFD,
  2351. F__runetype: [256]uint32{
  2352. 0: uint32(0x00000200),
  2353. 1: uint32(0x00000200),
  2354. 2: uint32(0x00000200),
  2355. 3: uint32(0x00000200),
  2356. 4: uint32(0x00000200),
  2357. 5: uint32(0x00000200),
  2358. 6: uint32(0x00000200),
  2359. 7: uint32(0x00000200),
  2360. 8: uint32(0x00000200),
  2361. 9: uint32(0x00000200 |
  2362. 0x00004000 |
  2363. 0x00020000),
  2364. 10: uint32(0x00000200 |
  2365. 0x00004000),
  2366. 11: uint32(0x00000200 |
  2367. 0x00004000),
  2368. 12: uint32(0x00000200 |
  2369. 0x00004000),
  2370. 13: uint32(0x00000200 |
  2371. 0x00004000),
  2372. 14: uint32(0x00000200),
  2373. 15: uint32(0x00000200),
  2374. 16: uint32(0x00000200),
  2375. 17: uint32(0x00000200),
  2376. 18: uint32(0x00000200),
  2377. 19: uint32(0x00000200),
  2378. 20: uint32(0x00000200),
  2379. 21: uint32(0x00000200),
  2380. 22: uint32(0x00000200),
  2381. 23: uint32(0x00000200),
  2382. 24: uint32(0x00000200),
  2383. 25: uint32(0x00000200),
  2384. 26: uint32(0x00000200),
  2385. 27: uint32(0x00000200),
  2386. 28: uint32(0x00000200),
  2387. 29: uint32(0x00000200),
  2388. 30: uint32(0x00000200),
  2389. 31: uint32(0x00000200),
  2390. 32: uint32(0x00004000 |
  2391. 0x00020000 |
  2392. 0x00040000),
  2393. 33: uint32(0x00002000 |
  2394. 0x00040000 |
  2395. 0x00000800),
  2396. 34: uint32(0x00002000 |
  2397. 0x00040000 |
  2398. 0x00000800),
  2399. 35: uint32(0x00002000 |
  2400. 0x00040000 |
  2401. 0x00000800),
  2402. 36: uint32(0x00002000 |
  2403. 0x00040000 |
  2404. 0x00000800),
  2405. 37: uint32(0x00002000 |
  2406. 0x00040000 |
  2407. 0x00000800),
  2408. 38: uint32(0x00002000 |
  2409. 0x00040000 |
  2410. 0x00000800),
  2411. 39: uint32(0x00002000 |
  2412. 0x00040000 |
  2413. 0x00000800),
  2414. 40: uint32(0x00002000 |
  2415. 0x00040000 |
  2416. 0x00000800),
  2417. 41: uint32(0x00002000 |
  2418. 0x00040000 |
  2419. 0x00000800),
  2420. 42: uint32(0x00002000 |
  2421. 0x00040000 |
  2422. 0x00000800),
  2423. 43: uint32(0x00002000 |
  2424. 0x00040000 |
  2425. 0x00000800),
  2426. 44: uint32(0x00002000 |
  2427. 0x00040000 |
  2428. 0x00000800),
  2429. 45: uint32(0x00002000 |
  2430. 0x00040000 |
  2431. 0x00000800),
  2432. 46: uint32(0x00002000 |
  2433. 0x00040000 |
  2434. 0x00000800),
  2435. 47: uint32(0x00002000 |
  2436. 0x00040000 |
  2437. 0x00000800),
  2438. 48: uint32(0x00000400 |
  2439. 0x00040000 |
  2440. 0x00000800 |
  2441. 0x00010000 |
  2442. 0x00400000 |
  2443. 0),
  2444. 49: uint32(0x00000400 |
  2445. 0x00040000 |
  2446. 0x00000800 |
  2447. 0x00010000 |
  2448. 0x00400000 |
  2449. 1),
  2450. 50: uint32(0x00000400 |
  2451. 0x00040000 |
  2452. 0x00000800 |
  2453. 0x00010000 |
  2454. 0x00400000 |
  2455. 2),
  2456. 51: uint32(0x00000400 |
  2457. 0x00040000 |
  2458. 0x00000800 |
  2459. 0x00010000 |
  2460. 0x00400000 |
  2461. 3),
  2462. 52: uint32(0x00000400 |
  2463. 0x00040000 |
  2464. 0x00000800 |
  2465. 0x00010000 |
  2466. 0x00400000 |
  2467. 4),
  2468. 53: uint32(0x00000400 |
  2469. 0x00040000 |
  2470. 0x00000800 |
  2471. 0x00010000 |
  2472. 0x00400000 |
  2473. 5),
  2474. 54: uint32(0x00000400 |
  2475. 0x00040000 |
  2476. 0x00000800 |
  2477. 0x00010000 |
  2478. 0x00400000 |
  2479. 6),
  2480. 55: uint32(0x00000400 |
  2481. 0x00040000 |
  2482. 0x00000800 |
  2483. 0x00010000 |
  2484. 0x00400000 |
  2485. 7),
  2486. 56: uint32(0x00000400 |
  2487. 0x00040000 |
  2488. 0x00000800 |
  2489. 0x00010000 |
  2490. 0x00400000 |
  2491. 8),
  2492. 57: uint32(0x00000400 |
  2493. 0x00040000 |
  2494. 0x00000800 |
  2495. 0x00010000 |
  2496. 0x00400000 |
  2497. 9),
  2498. 58: uint32(0x00002000 |
  2499. 0x00040000 |
  2500. 0x00000800),
  2501. 59: uint32(0x00002000 |
  2502. 0x00040000 |
  2503. 0x00000800),
  2504. 60: uint32(0x00002000 |
  2505. 0x00040000 |
  2506. 0x00000800),
  2507. 61: uint32(0x00002000 |
  2508. 0x00040000 |
  2509. 0x00000800),
  2510. 62: uint32(0x00002000 |
  2511. 0x00040000 |
  2512. 0x00000800),
  2513. 63: uint32(0x00002000 |
  2514. 0x00040000 |
  2515. 0x00000800),
  2516. 64: uint32(0x00002000 |
  2517. 0x00040000 |
  2518. 0x00000800),
  2519. 65: uint32(0x00008000 |
  2520. 0x00010000 |
  2521. 0x00040000 |
  2522. 0x00000800 |
  2523. 0x00000100 |
  2524. 10),
  2525. 66: uint32(0x00008000 |
  2526. 0x00010000 |
  2527. 0x00040000 |
  2528. 0x00000800 |
  2529. 0x00000100 |
  2530. 11),
  2531. 67: uint32(0x00008000 |
  2532. 0x00010000 |
  2533. 0x00040000 |
  2534. 0x00000800 |
  2535. 0x00000100 |
  2536. 12),
  2537. 68: uint32(0x00008000 |
  2538. 0x00010000 |
  2539. 0x00040000 |
  2540. 0x00000800 |
  2541. 0x00000100 |
  2542. 13),
  2543. 69: uint32(0x00008000 |
  2544. 0x00010000 |
  2545. 0x00040000 |
  2546. 0x00000800 |
  2547. 0x00000100 |
  2548. 14),
  2549. 70: uint32(0x00008000 |
  2550. 0x00010000 |
  2551. 0x00040000 |
  2552. 0x00000800 |
  2553. 0x00000100 |
  2554. 15),
  2555. 71: uint32(0x00008000 |
  2556. 0x00040000 |
  2557. 0x00000800 |
  2558. 0x00000100),
  2559. 72: uint32(0x00008000 |
  2560. 0x00040000 |
  2561. 0x00000800 |
  2562. 0x00000100),
  2563. 73: uint32(0x00008000 |
  2564. 0x00040000 |
  2565. 0x00000800 |
  2566. 0x00000100),
  2567. 74: uint32(0x00008000 |
  2568. 0x00040000 |
  2569. 0x00000800 |
  2570. 0x00000100),
  2571. 75: uint32(0x00008000 |
  2572. 0x00040000 |
  2573. 0x00000800 |
  2574. 0x00000100),
  2575. 76: uint32(0x00008000 |
  2576. 0x00040000 |
  2577. 0x00000800 |
  2578. 0x00000100),
  2579. 77: uint32(0x00008000 |
  2580. 0x00040000 |
  2581. 0x00000800 |
  2582. 0x00000100),
  2583. 78: uint32(0x00008000 |
  2584. 0x00040000 |
  2585. 0x00000800 |
  2586. 0x00000100),
  2587. 79: uint32(0x00008000 |
  2588. 0x00040000 |
  2589. 0x00000800 |
  2590. 0x00000100),
  2591. 80: uint32(0x00008000 |
  2592. 0x00040000 |
  2593. 0x00000800 |
  2594. 0x00000100),
  2595. 81: uint32(0x00008000 |
  2596. 0x00040000 |
  2597. 0x00000800 |
  2598. 0x00000100),
  2599. 82: uint32(0x00008000 |
  2600. 0x00040000 |
  2601. 0x00000800 |
  2602. 0x00000100),
  2603. 83: uint32(0x00008000 |
  2604. 0x00040000 |
  2605. 0x00000800 |
  2606. 0x00000100),
  2607. 84: uint32(0x00008000 |
  2608. 0x00040000 |
  2609. 0x00000800 |
  2610. 0x00000100),
  2611. 85: uint32(0x00008000 |
  2612. 0x00040000 |
  2613. 0x00000800 |
  2614. 0x00000100),
  2615. 86: uint32(0x00008000 |
  2616. 0x00040000 |
  2617. 0x00000800 |
  2618. 0x00000100),
  2619. 87: uint32(0x00008000 |
  2620. 0x00040000 |
  2621. 0x00000800 |
  2622. 0x00000100),
  2623. 88: uint32(0x00008000 |
  2624. 0x00040000 |
  2625. 0x00000800 |
  2626. 0x00000100),
  2627. 89: uint32(0x00008000 |
  2628. 0x00040000 |
  2629. 0x00000800 |
  2630. 0x00000100),
  2631. 90: uint32(0x00008000 |
  2632. 0x00040000 |
  2633. 0x00000800 |
  2634. 0x00000100),
  2635. 91: uint32(0x00002000 |
  2636. 0x00040000 |
  2637. 0x00000800),
  2638. 92: uint32(0x00002000 |
  2639. 0x00040000 |
  2640. 0x00000800),
  2641. 93: uint32(0x00002000 |
  2642. 0x00040000 |
  2643. 0x00000800),
  2644. 94: uint32(0x00002000 |
  2645. 0x00040000 |
  2646. 0x00000800),
  2647. 95: uint32(0x00002000 |
  2648. 0x00040000 |
  2649. 0x00000800),
  2650. 96: uint32(0x00002000 |
  2651. 0x00040000 |
  2652. 0x00000800),
  2653. 97: uint32(0x00001000 |
  2654. 0x00010000 |
  2655. 0x00040000 |
  2656. 0x00000800 |
  2657. 0x00000100 |
  2658. 10),
  2659. 98: uint32(0x00001000 |
  2660. 0x00010000 |
  2661. 0x00040000 |
  2662. 0x00000800 |
  2663. 0x00000100 |
  2664. 11),
  2665. 99: uint32(0x00001000 |
  2666. 0x00010000 |
  2667. 0x00040000 |
  2668. 0x00000800 |
  2669. 0x00000100 |
  2670. 12),
  2671. 100: uint32(0x00001000 |
  2672. 0x00010000 |
  2673. 0x00040000 |
  2674. 0x00000800 |
  2675. 0x00000100 |
  2676. 13),
  2677. 101: uint32(0x00001000 |
  2678. 0x00010000 |
  2679. 0x00040000 |
  2680. 0x00000800 |
  2681. 0x00000100 |
  2682. 14),
  2683. 102: uint32(0x00001000 |
  2684. 0x00010000 |
  2685. 0x00040000 |
  2686. 0x00000800 |
  2687. 0x00000100 |
  2688. 15),
  2689. 103: uint32(0x00001000 |
  2690. 0x00040000 |
  2691. 0x00000800 |
  2692. 0x00000100),
  2693. 104: uint32(0x00001000 |
  2694. 0x00040000 |
  2695. 0x00000800 |
  2696. 0x00000100),
  2697. 105: uint32(0x00001000 |
  2698. 0x00040000 |
  2699. 0x00000800 |
  2700. 0x00000100),
  2701. 106: uint32(0x00001000 |
  2702. 0x00040000 |
  2703. 0x00000800 |
  2704. 0x00000100),
  2705. 107: uint32(0x00001000 |
  2706. 0x00040000 |
  2707. 0x00000800 |
  2708. 0x00000100),
  2709. 108: uint32(0x00001000 |
  2710. 0x00040000 |
  2711. 0x00000800 |
  2712. 0x00000100),
  2713. 109: uint32(0x00001000 |
  2714. 0x00040000 |
  2715. 0x00000800 |
  2716. 0x00000100),
  2717. 110: uint32(0x00001000 |
  2718. 0x00040000 |
  2719. 0x00000800 |
  2720. 0x00000100),
  2721. 111: uint32(0x00001000 |
  2722. 0x00040000 |
  2723. 0x00000800 |
  2724. 0x00000100),
  2725. 112: uint32(0x00001000 |
  2726. 0x00040000 |
  2727. 0x00000800 |
  2728. 0x00000100),
  2729. 113: uint32(0x00001000 |
  2730. 0x00040000 |
  2731. 0x00000800 |
  2732. 0x00000100),
  2733. 114: uint32(0x00001000 |
  2734. 0x00040000 |
  2735. 0x00000800 |
  2736. 0x00000100),
  2737. 115: uint32(0x00001000 |
  2738. 0x00040000 |
  2739. 0x00000800 |
  2740. 0x00000100),
  2741. 116: uint32(0x00001000 |
  2742. 0x00040000 |
  2743. 0x00000800 |
  2744. 0x00000100),
  2745. 117: uint32(0x00001000 |
  2746. 0x00040000 |
  2747. 0x00000800 |
  2748. 0x00000100),
  2749. 118: uint32(0x00001000 |
  2750. 0x00040000 |
  2751. 0x00000800 |
  2752. 0x00000100),
  2753. 119: uint32(0x00001000 |
  2754. 0x00040000 |
  2755. 0x00000800 |
  2756. 0x00000100),
  2757. 120: uint32(0x00001000 |
  2758. 0x00040000 |
  2759. 0x00000800 |
  2760. 0x00000100),
  2761. 121: uint32(0x00001000 |
  2762. 0x00040000 |
  2763. 0x00000800 |
  2764. 0x00000100),
  2765. 122: uint32(0x00001000 |
  2766. 0x00040000 |
  2767. 0x00000800 |
  2768. 0x00000100),
  2769. 123: uint32(0x00002000 |
  2770. 0x00040000 |
  2771. 0x00000800),
  2772. 124: uint32(0x00002000 |
  2773. 0x00040000 |
  2774. 0x00000800),
  2775. 125: uint32(0x00002000 |
  2776. 0x00040000 |
  2777. 0x00000800),
  2778. 126: uint32(0x00002000 |
  2779. 0x00040000 |
  2780. 0x00000800),
  2781. 127: uint32(0x00000200),
  2782. },
  2783. F__maplower: [256]int32{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  2784. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  2785. 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
  2786. 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  2787. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  2788. 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
  2789. 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
  2790. 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  2791. 0x40, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
  2792. 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
  2793. 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
  2794. 'x', 'y', 'z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  2795. 0x60, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
  2796. 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
  2797. 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
  2798. 'x', 'y', 'z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  2799. 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
  2800. 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
  2801. 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
  2802. 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  2803. 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
  2804. 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
  2805. 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
  2806. 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  2807. 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
  2808. 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
  2809. 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
  2810. 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  2811. 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
  2812. 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
  2813. 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
  2814. 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
  2815. },
  2816. F__mapupper: [256]int32{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  2817. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  2818. 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
  2819. 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  2820. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  2821. 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
  2822. 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
  2823. 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  2824. 0x40, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  2825. 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  2826. 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  2827. 'X', 'Y', 'Z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
  2828. 0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  2829. 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
  2830. 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
  2831. 'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
  2832. 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
  2833. 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
  2834. 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
  2835. 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
  2836. 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
  2837. 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
  2838. 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
  2839. 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
  2840. 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
  2841. 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
  2842. 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
  2843. 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
  2844. 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
  2845. 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
  2846. 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
  2847. 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
  2848. },
  2849. } /* table.cpp.c:2243:19 */
  2850. var X_CurrentRuneLocale uintptr = 0 /* table.cpp.c:4092:19 */
  2851. /// _RuneLocale *
  2852. /// __runes_for_locale(locale_t locale, int *mb_sb_limit)
  2853. /// {
  2854. /// (locale = get_real_locale(locale));
  2855. /// struct xlocale_ctype *c = ((struct xlocale_ctype*)(locale)->components[XLC_CTYPE]);
  2856. /// *mb_sb_limit = c->__mb_sb_limit;
  2857. /// return c->runes;
  2858. /// }
  2859. func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
  2860. return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5))
  2861. }
  2862. type locale_t = uintptr /* alltypes.h:366:32 */
  2863. func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
  2864. return Bool32(func() int32 {
  2865. if 0 != 0 {
  2866. return Xisalpha(tls, c)
  2867. }
  2868. return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
  2869. }() != 0 || func() int32 {
  2870. if 0 != 0 {
  2871. return Xisdigit(tls, c)
  2872. }
  2873. return Bool32(uint32(c)-uint32('0') < uint32(10))
  2874. }() != 0)
  2875. }
  2876. func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
  2877. return Xisalnum(tls, c)
  2878. }
  2879. func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
  2880. return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
  2881. }
  2882. func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
  2883. return Xisalpha(tls, c)
  2884. }
  2885. func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
  2886. return Bool32(uint32(c)-uint32('0') < uint32(10))
  2887. }
  2888. func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
  2889. return Xisdigit(tls, c)
  2890. }
  2891. func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
  2892. return Bool32(uint32(c)-uint32('a') < uint32(26))
  2893. }
  2894. func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
  2895. return Xislower(tls, c)
  2896. }
  2897. func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
  2898. return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
  2899. }
  2900. func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
  2901. return Xisprint(tls, c)
  2902. }
  2903. func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
  2904. return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
  2905. }
  2906. func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
  2907. return Xisspace(tls, c)
  2908. }
  2909. func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
  2910. return Bool32(uint32(c)-uint32('A') < uint32(26))
  2911. }
  2912. func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
  2913. return Xisupper(tls, c)
  2914. }
  2915. func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
  2916. return Bool32(func() int32 {
  2917. if 0 != 0 {
  2918. return Xisdigit(tls, c)
  2919. }
  2920. return Bool32(uint32(c)-uint32('0') < uint32(10))
  2921. }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6))
  2922. }
  2923. func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
  2924. return Xisxdigit(tls, c)
  2925. }
  2926. type uintptr_t = uint32 /* alltypes.h:78:24 */
  2927. type intptr_t = int32 /* alltypes.h:93:15 */
  2928. type int8_t = int8 /* alltypes.h:119:25 */
  2929. type int16_t = int16 /* alltypes.h:124:25 */
  2930. type int32_t = int32 /* alltypes.h:129:25 */
  2931. type int64_t = int64 /* alltypes.h:134:25 */
  2932. type intmax_t = int64 /* alltypes.h:139:25 */
  2933. type uint8_t = uint8 /* alltypes.h:144:25 */
  2934. type uint16_t = uint16 /* alltypes.h:149:25 */
  2935. type uint32_t = uint32 /* alltypes.h:154:25 */
  2936. type uint64_t = uint64 /* alltypes.h:159:25 */
  2937. type uintmax_t = uint64 /* alltypes.h:169:25 */
  2938. type int_fast8_t = int8_t /* stdint.h:22:16 */
  2939. type int_fast64_t = int64_t /* stdint.h:23:17 */
  2940. type int_least8_t = int8_t /* stdint.h:25:17 */
  2941. type int_least16_t = int16_t /* stdint.h:26:17 */
  2942. type int_least32_t = int32_t /* stdint.h:27:17 */
  2943. type int_least64_t = int64_t /* stdint.h:28:17 */
  2944. type uint_fast8_t = uint8_t /* stdint.h:30:17 */
  2945. type uint_fast64_t = uint64_t /* stdint.h:31:18 */
  2946. type uint_least8_t = uint8_t /* stdint.h:33:18 */
  2947. type uint_least16_t = uint16_t /* stdint.h:34:18 */
  2948. type uint_least32_t = uint32_t /* stdint.h:35:18 */
  2949. type uint_least64_t = uint64_t /* stdint.h:36:18 */
  2950. type int_fast16_t = int32_t /* stdint.h:1:17 */
  2951. type int_fast32_t = int32_t /* stdint.h:2:17 */
  2952. type uint_fast16_t = uint32_t /* stdint.h:3:18 */
  2953. type uint_fast32_t = uint32_t /* stdint.h:4:18 */
  2954. type ssize_t = int32 /* alltypes.h:88:15 */
  2955. type off_t = int64 /* alltypes.h:185:16 */
  2956. type _IO_FILE = struct {
  2957. Fflags uint32
  2958. Frpos uintptr
  2959. Frend uintptr
  2960. Fclose uintptr
  2961. Fwend uintptr
  2962. Fwpos uintptr
  2963. Fmustbezero_1 uintptr
  2964. Fwbase uintptr
  2965. Fread uintptr
  2966. Fwrite uintptr
  2967. Fseek uintptr
  2968. Fbuf uintptr
  2969. Fbuf_size size_t
  2970. Fprev uintptr
  2971. Fnext uintptr
  2972. Ffd int32
  2973. Fpipe_pid int32
  2974. Flockcount int32
  2975. Fmode int32
  2976. Flock int32
  2977. Flbf int32
  2978. Fcookie uintptr
  2979. Foff off_t
  2980. Fgetln_buf uintptr
  2981. Fmustbezero_2 uintptr
  2982. Fshend uintptr
  2983. Fshlim off_t
  2984. Fshcnt off_t
  2985. Fprev_locked uintptr
  2986. Fnext_locked uintptr
  2987. Flocale uintptr
  2988. } /* alltypes.h:343:9 */
  2989. type FILE = _IO_FILE /* alltypes.h:343:25 */
  2990. type va_list = uintptr /* alltypes.h:349:27 */
  2991. type _G_fpos64_t = struct {
  2992. F__ccgo_pad1 [0]uint32
  2993. F__opaque [16]int8
  2994. } /* stdio.h:54:9 */
  2995. type fpos_t = _G_fpos64_t /* stdio.h:58:3 */
  2996. type float_t = float64 /* alltypes.h:38:21 */
  2997. type double_t = float64 /* alltypes.h:43:21 */
  2998. func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */
  2999. bp := tls.Alloc(4)
  3000. defer tls.Free(4)
  3001. // var __u struct {F__f float32;} at bp, 4
  3002. *(*float32)(unsafe.Pointer(bp)) = __f
  3003. return *(*uint32)(unsafe.Pointer(bp))
  3004. }
  3005. func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */
  3006. bp := tls.Alloc(8)
  3007. defer tls.Free(8)
  3008. // var __u struct {F__f float64;} at bp, 8
  3009. *(*float64)(unsafe.Pointer(bp)) = __f
  3010. return *(*uint64)(unsafe.Pointer(bp))
  3011. }
  3012. type syscall_arg_t = int32 /* syscall.h:22:14 */
  3013. func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */
  3014. var c int32
  3015. var x int32
  3016. var y int64
  3017. var neg int32 = 0
  3018. c = func() int32 {
  3019. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3020. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3021. }
  3022. return X__shgetc(tls, f)
  3023. }()
  3024. if c == '+' || c == '-' {
  3025. neg = Bool32(c == '-')
  3026. c = func() int32 {
  3027. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3028. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3029. }
  3030. return X__shgetc(tls, f)
  3031. }()
  3032. if uint32(c-'0') >= 10 && pok != 0 {
  3033. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3034. (*FILE)(unsafe.Pointer(f)).Frpos--
  3035. } else {
  3036. }
  3037. }
  3038. }
  3039. if uint32(c-'0') >= 10 {
  3040. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3041. (*FILE)(unsafe.Pointer(f)).Frpos--
  3042. } else {
  3043. }
  3044. return -0x7fffffffffffffff - int64(1)
  3045. }
  3046. for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 {
  3047. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3048. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3049. }
  3050. return X__shgetc(tls, f)
  3051. }() {
  3052. x = 10*x + c - '0'
  3053. }
  3054. for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 {
  3055. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3056. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3057. }
  3058. return X__shgetc(tls, f)
  3059. }() {
  3060. y = int64(10)*y + int64(c) - int64('0')
  3061. }
  3062. for ; uint32(c-'0') < 10; c = func() int32 {
  3063. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3064. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3065. }
  3066. return X__shgetc(tls, f)
  3067. }() {
  3068. }
  3069. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3070. (*FILE)(unsafe.Pointer(f)).Frpos--
  3071. } else {
  3072. }
  3073. if neg != 0 {
  3074. return -y
  3075. }
  3076. return y
  3077. }
  3078. func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */
  3079. bp := tls.Alloc(512)
  3080. defer tls.Free(512)
  3081. // var x [128]uint32_t at bp, 512
  3082. var i int32
  3083. var j int32
  3084. var k int32
  3085. var a int32
  3086. var z int32
  3087. var lrp int64 = int64(0)
  3088. var dc int64 = int64(0)
  3089. var e10 int64 = int64(0)
  3090. var lnz int32 = 0
  3091. var gotdig int32 = 0
  3092. var gotrad int32 = 0
  3093. var rp int32
  3094. var e2 int32
  3095. var emax int32 = -emin - bits + 3
  3096. var denormal int32 = 0
  3097. var y float64
  3098. var frac float64 = float64(0)
  3099. var bias float64 = float64(0)
  3100. j = 0
  3101. k = 0
  3102. // Don't let leading zeros consume buffer space
  3103. for ; c == '0'; c = func() int32 {
  3104. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3105. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3106. }
  3107. return X__shgetc(tls, f)
  3108. }() {
  3109. gotdig = 1
  3110. }
  3111. if c == '.' {
  3112. gotrad = 1
  3113. for c = func() int32 {
  3114. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3115. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3116. }
  3117. return X__shgetc(tls, f)
  3118. }(); c == '0'; c = func() int32 {
  3119. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3120. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3121. }
  3122. return X__shgetc(tls, f)
  3123. }() {
  3124. gotdig = 1
  3125. lrp--
  3126. }
  3127. }
  3128. *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0)
  3129. for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 {
  3130. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3131. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3132. }
  3133. return X__shgetc(tls, f)
  3134. }() {
  3135. if c == '.' {
  3136. if gotrad != 0 {
  3137. break
  3138. }
  3139. gotrad = 1
  3140. lrp = dc
  3141. } else if k < 128-3 {
  3142. dc++
  3143. if c != '0' {
  3144. lnz = int32(dc)
  3145. }
  3146. if j != 0 {
  3147. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))*uint32_t(10) + uint32_t(c) - uint32_t('0')
  3148. } else {
  3149. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0')
  3150. }
  3151. if PreIncInt32(&j, 1) == 9 {
  3152. k++
  3153. j = 0
  3154. }
  3155. gotdig = 1
  3156. } else {
  3157. dc++
  3158. if c != '0' {
  3159. lnz = (128 - 4) * 9
  3160. *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1)
  3161. }
  3162. }
  3163. }
  3164. if !(gotrad != 0) {
  3165. lrp = dc
  3166. }
  3167. if gotdig != 0 && c|32 == 'e' {
  3168. e10 = scanexp(tls, f, pok)
  3169. if e10 == -0x7fffffffffffffff-int64(1) {
  3170. if pok != 0 {
  3171. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3172. (*FILE)(unsafe.Pointer(f)).Frpos--
  3173. } else {
  3174. }
  3175. } else {
  3176. X__shlim(tls, f, int64(0))
  3177. return float64(0)
  3178. }
  3179. e10 = int64(0)
  3180. }
  3181. lrp = lrp + e10
  3182. } else if c >= 0 {
  3183. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3184. (*FILE)(unsafe.Pointer(f)).Frpos--
  3185. } else {
  3186. }
  3187. }
  3188. if !(gotdig != 0) {
  3189. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3190. X__shlim(tls, f, int64(0))
  3191. return float64(0)
  3192. }
  3193. // Handle zero specially to avoid nasty special cases later
  3194. if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) {
  3195. return float64(sign) * 0.0
  3196. }
  3197. // Optimize small integers (w/no exponent) and over/under-flow
  3198. if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) {
  3199. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
  3200. }
  3201. if lrp > int64(-emin/2) {
  3202. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3203. return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
  3204. }
  3205. if lrp < int64(emin-2*53) {
  3206. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3207. return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
  3208. }
  3209. // Align incomplete final B1B digit
  3210. if j != 0 {
  3211. for ; j < 9; j++ {
  3212. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10)
  3213. }
  3214. k++
  3215. j = 0
  3216. }
  3217. a = 0
  3218. z = k
  3219. e2 = 0
  3220. rp = int32(lrp)
  3221. // Optimize small to mid-size integers (even in exp. notation)
  3222. if lnz < 9 && lnz <= rp && rp < 18 {
  3223. if rp == 9 {
  3224. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
  3225. }
  3226. if rp < 9 {
  3227. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp])
  3228. }
  3229. var bitlim int32 = bits - 3*(rp-9)
  3230. if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) {
  3231. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10])
  3232. }
  3233. }
  3234. // Drop trailing zeros
  3235. for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- {
  3236. }
  3237. // Align radix point to B1B digit boundary
  3238. if rp%9 != 0 {
  3239. var rpm9 int32
  3240. if rp >= 0 {
  3241. rpm9 = rp % 9
  3242. } else {
  3243. rpm9 = rp%9 + 9
  3244. }
  3245. var p10 int32 = _sp10s[8-rpm9]
  3246. var carry uint32_t = uint32_t(0)
  3247. for k = a; k != z; k++ {
  3248. var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10)
  3249. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry
  3250. carry = uint32_t(1000000000/p10) * tmp
  3251. if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  3252. a = (a + 1) & (128 - 1)
  3253. rp = rp - 9
  3254. }
  3255. }
  3256. if carry != 0 {
  3257. *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry
  3258. }
  3259. rp = rp + (9 - rpm9)
  3260. }
  3261. // Upscale until desired number of bits are left of radix point
  3262. for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] {
  3263. var carry uint32_t = uint32_t(0)
  3264. e2 = e2 - 29
  3265. for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) {
  3266. var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry)
  3267. if tmp > uint64(1000000000) {
  3268. carry = uint32_t(tmp / uint64(1000000000))
  3269. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000))
  3270. } else {
  3271. carry = uint32_t(0)
  3272. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp)
  3273. }
  3274. if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  3275. z = k
  3276. }
  3277. if k == a {
  3278. break
  3279. }
  3280. }
  3281. if carry != 0 {
  3282. rp = rp + 9
  3283. a = (a - 1) & (128 - 1)
  3284. if a == z {
  3285. z = (z - 1) & (128 - 1)
  3286. *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4))
  3287. }
  3288. *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry
  3289. }
  3290. }
  3291. // Downscale until exactly number of bits are left of radix point
  3292. for {
  3293. var carry uint32_t = uint32_t(0)
  3294. var sh int32 = 1
  3295. for i = 0; i < 2; i++ {
  3296. k = (a + i) & (128 - 1)
  3297. if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] {
  3298. i = 2
  3299. break
  3300. }
  3301. if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] {
  3302. break
  3303. }
  3304. }
  3305. if i == 2 && rp == 9*2 {
  3306. break
  3307. }
  3308. // FIXME: find a way to compute optimal sh
  3309. if rp > 9+9*2 {
  3310. sh = 9
  3311. }
  3312. e2 = e2 + sh
  3313. for k = a; k != z; k = (k + 1) & (128 - 1) {
  3314. var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1)
  3315. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry
  3316. carry = uint32_t(int32(1000000000)>>sh) * tmp
  3317. if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  3318. a = (a + 1) & (128 - 1)
  3319. i--
  3320. rp = rp - 9
  3321. }
  3322. }
  3323. if carry != 0 {
  3324. if (z+1)&(128-1) != a {
  3325. *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry
  3326. z = (z + 1) & (128 - 1)
  3327. } else {
  3328. *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1)
  3329. }
  3330. }
  3331. }
  3332. // Assemble desired bits into floating point variable
  3333. for y = float64(AssignInt32(&i, 0)); i < 2; i++ {
  3334. if (a+i)&(128-1) == z {
  3335. *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0)
  3336. }
  3337. y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)))
  3338. }
  3339. y = y * float64(sign)
  3340. // Limit precision for denormal results
  3341. if bits > 53+e2-emin {
  3342. bits = 53 + e2 - emin
  3343. if bits < 0 {
  3344. bits = 0
  3345. }
  3346. denormal = 1
  3347. }
  3348. // Calculate bias term to force rounding, move out lower bits
  3349. if bits < 53 {
  3350. bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y)
  3351. frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits))
  3352. y = y - frac
  3353. y = y + bias
  3354. }
  3355. // Process tail of decimal input so it can affect rounding
  3356. if (a+i)&(128-1) != z {
  3357. var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))
  3358. if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) {
  3359. frac = frac + 0.25*float64(sign)
  3360. } else if t > uint32_t(500000000) {
  3361. frac = frac + 0.75*float64(sign)
  3362. } else if t == uint32_t(500000000) {
  3363. if (a+i+1)&(128-1) == z {
  3364. frac = frac + 0.5*float64(sign)
  3365. } else {
  3366. frac = frac + 0.75*float64(sign)
  3367. }
  3368. }
  3369. if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) {
  3370. frac += 1
  3371. }
  3372. }
  3373. y = y + frac
  3374. y = y - bias
  3375. if (e2+53)&0x7fffffff > emax-5 {
  3376. if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 {
  3377. if denormal != 0 && bits == 53+e2-emin {
  3378. denormal = 0
  3379. }
  3380. y = y * 0.5
  3381. e2++
  3382. }
  3383. if e2+53 > emax || denormal != 0 && frac != 0 {
  3384. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3385. }
  3386. }
  3387. return Xscalbnl(tls, y, e2)
  3388. }
  3389. var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */
  3390. var _sp10s = [8]int32{10, 100, 1000, 10000,
  3391. 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */
  3392. func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */
  3393. var x uint32_t = uint32_t(0)
  3394. var y float64 = float64(0)
  3395. var scale float64 = float64(1)
  3396. var bias float64 = float64(0)
  3397. var gottail int32 = 0
  3398. var gotrad int32 = 0
  3399. var gotdig int32 = 0
  3400. var rp int64 = int64(0)
  3401. var dc int64 = int64(0)
  3402. var e2 int64 = int64(0)
  3403. var d int32
  3404. var c int32
  3405. c = func() int32 {
  3406. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3407. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3408. }
  3409. return X__shgetc(tls, f)
  3410. }()
  3411. // Skip leading zeros
  3412. for ; c == '0'; c = func() int32 {
  3413. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3414. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3415. }
  3416. return X__shgetc(tls, f)
  3417. }() {
  3418. gotdig = 1
  3419. }
  3420. if c == '.' {
  3421. gotrad = 1
  3422. c = func() int32 {
  3423. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3424. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3425. }
  3426. return X__shgetc(tls, f)
  3427. }()
  3428. // Count zeros after the radix point before significand
  3429. rp = int64(0)
  3430. __1:
  3431. if !(c == '0') {
  3432. goto __3
  3433. }
  3434. gotdig = 1
  3435. goto __2
  3436. __2:
  3437. c = func() int32 {
  3438. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3439. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3440. }
  3441. return X__shgetc(tls, f)
  3442. }()
  3443. rp--
  3444. goto __1
  3445. goto __3
  3446. __3:
  3447. }
  3448. for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 {
  3449. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3450. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3451. }
  3452. return X__shgetc(tls, f)
  3453. }() {
  3454. if c == '.' {
  3455. if gotrad != 0 {
  3456. break
  3457. }
  3458. rp = dc
  3459. gotrad = 1
  3460. } else {
  3461. gotdig = 1
  3462. if c > '9' {
  3463. d = c | 32 + 10 - 'a'
  3464. } else {
  3465. d = c - '0'
  3466. }
  3467. if dc < int64(8) {
  3468. x = x*uint32_t(16) + uint32_t(d)
  3469. } else if dc < int64(53/4+1) {
  3470. y = y + float64(d)*AssignDivFloat64(&scale, float64(16))
  3471. } else if d != 0 && !(gottail != 0) {
  3472. y = y + 0.5*scale
  3473. gottail = 1
  3474. }
  3475. dc++
  3476. }
  3477. }
  3478. if !(gotdig != 0) {
  3479. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3480. (*FILE)(unsafe.Pointer(f)).Frpos--
  3481. } else {
  3482. }
  3483. if pok != 0 {
  3484. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3485. (*FILE)(unsafe.Pointer(f)).Frpos--
  3486. } else {
  3487. }
  3488. if gotrad != 0 {
  3489. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3490. (*FILE)(unsafe.Pointer(f)).Frpos--
  3491. } else {
  3492. }
  3493. }
  3494. } else {
  3495. X__shlim(tls, f, int64(0))
  3496. }
  3497. return float64(sign) * 0.0
  3498. }
  3499. if !(gotrad != 0) {
  3500. rp = dc
  3501. }
  3502. for dc < int64(8) {
  3503. x = x * uint32_t(16)
  3504. dc++
  3505. }
  3506. if c|32 == 'p' {
  3507. e2 = scanexp(tls, f, pok)
  3508. if e2 == -0x7fffffffffffffff-int64(1) {
  3509. if pok != 0 {
  3510. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3511. (*FILE)(unsafe.Pointer(f)).Frpos--
  3512. } else {
  3513. }
  3514. } else {
  3515. X__shlim(tls, f, int64(0))
  3516. return float64(0)
  3517. }
  3518. e2 = int64(0)
  3519. }
  3520. } else {
  3521. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3522. (*FILE)(unsafe.Pointer(f)).Frpos--
  3523. } else {
  3524. }
  3525. }
  3526. e2 = e2 + (int64(4)*rp - int64(32))
  3527. if !(x != 0) {
  3528. return float64(sign) * 0.0
  3529. }
  3530. if e2 > int64(-emin) {
  3531. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3532. return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
  3533. }
  3534. if e2 < int64(emin-2*53) {
  3535. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3536. return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
  3537. }
  3538. for x < 0x80000000 {
  3539. if y >= 0.5 {
  3540. x = x + (x + uint32_t(1))
  3541. y = y + (y - float64(1))
  3542. } else {
  3543. x = x + x
  3544. y = y + y
  3545. }
  3546. e2--
  3547. }
  3548. if int64(bits) > int64(32)+e2-int64(emin) {
  3549. bits = int32(int64(32) + e2 - int64(emin))
  3550. if bits < 0 {
  3551. bits = 0
  3552. }
  3553. }
  3554. if bits < 53 {
  3555. bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign))
  3556. }
  3557. if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) {
  3558. x++
  3559. y = float64(0)
  3560. }
  3561. y = bias + float64(sign)*float64(x) + float64(sign)*y
  3562. y = y - bias
  3563. if !(y != 0) {
  3564. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3565. }
  3566. return Xscalbnl(tls, y, int32(e2))
  3567. }
  3568. func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
  3569. var sign int32 = 1
  3570. var i size_t
  3571. var bits int32
  3572. var emin int32
  3573. var c int32
  3574. switch prec {
  3575. case 0:
  3576. bits = 24
  3577. emin = -125 - bits
  3578. break
  3579. case 1:
  3580. bits = 53
  3581. emin = -1021 - bits
  3582. break
  3583. case 2:
  3584. bits = 53
  3585. emin = -1021 - bits
  3586. break
  3587. default:
  3588. return float64(0)
  3589. }
  3590. for __isspace(tls, AssignInt32(&c, func() int32 {
  3591. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3592. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3593. }
  3594. return X__shgetc(tls, f)
  3595. }())) != 0 {
  3596. }
  3597. if c == '+' || c == '-' {
  3598. sign = sign - 2*Bool32(c == '-')
  3599. c = func() int32 {
  3600. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3601. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3602. }
  3603. return X__shgetc(tls, f)
  3604. }()
  3605. }
  3606. for i = size_t(0); i < size_t(8) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 41 /* "infinity" */ + uintptr(i)))); i++ {
  3607. if i < size_t(7) {
  3608. c = func() int32 {
  3609. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3610. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3611. }
  3612. return X__shgetc(tls, f)
  3613. }()
  3614. }
  3615. }
  3616. if i == size_t(3) || i == size_t(8) || i > size_t(3) && pok != 0 {
  3617. if i != size_t(8) {
  3618. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3619. (*FILE)(unsafe.Pointer(f)).Frpos--
  3620. } else {
  3621. }
  3622. if pok != 0 {
  3623. for ; i > size_t(3); i-- {
  3624. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3625. (*FILE)(unsafe.Pointer(f)).Frpos--
  3626. } else {
  3627. }
  3628. }
  3629. }
  3630. }
  3631. return float64(float32(sign) * X__builtin_inff(tls))
  3632. }
  3633. if !(i != 0) {
  3634. for i = size_t(0); i < size_t(3) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 50 /* "nan" */ + uintptr(i)))); i++ {
  3635. if i < size_t(2) {
  3636. c = func() int32 {
  3637. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3638. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3639. }
  3640. return X__shgetc(tls, f)
  3641. }()
  3642. }
  3643. }
  3644. }
  3645. if i == size_t(3) {
  3646. if func() int32 {
  3647. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3648. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3649. }
  3650. return X__shgetc(tls, f)
  3651. }() != '(' {
  3652. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3653. (*FILE)(unsafe.Pointer(f)).Frpos--
  3654. } else {
  3655. }
  3656. return float64(X__builtin_nanf(tls, ts+54))
  3657. }
  3658. for i = size_t(1); ; i++ {
  3659. c = func() int32 {
  3660. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3661. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3662. }
  3663. return X__shgetc(tls, f)
  3664. }()
  3665. if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' {
  3666. continue
  3667. }
  3668. if c == ')' {
  3669. return float64(X__builtin_nanf(tls, ts+54))
  3670. }
  3671. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3672. (*FILE)(unsafe.Pointer(f)).Frpos--
  3673. } else {
  3674. }
  3675. if !(pok != 0) {
  3676. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3677. X__shlim(tls, f, int64(0))
  3678. return float64(0)
  3679. }
  3680. for PostDecUint32(&i, 1) != 0 {
  3681. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3682. (*FILE)(unsafe.Pointer(f)).Frpos--
  3683. } else {
  3684. }
  3685. }
  3686. return float64(X__builtin_nanf(tls, ts+54))
  3687. }
  3688. return float64(X__builtin_nanf(tls, ts+54))
  3689. }
  3690. if i != 0 {
  3691. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3692. (*FILE)(unsafe.Pointer(f)).Frpos--
  3693. } else {
  3694. }
  3695. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3696. X__shlim(tls, f, int64(0))
  3697. return float64(0)
  3698. }
  3699. if c == '0' {
  3700. c = func() int32 {
  3701. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3702. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3703. }
  3704. return X__shgetc(tls, f)
  3705. }()
  3706. if c|32 == 'x' {
  3707. return hexfloat(tls, f, bits, emin, sign, pok)
  3708. }
  3709. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3710. (*FILE)(unsafe.Pointer(f)).Frpos--
  3711. } else {
  3712. }
  3713. c = '0'
  3714. }
  3715. return decfloat(tls, f, c, bits, emin, sign, pok)
  3716. }
  3717. // Lookup table for digit values. -1==255>=36 -> invalid
  3718. var table = [257]uint8{Uint8FromInt32(-1),
  3719. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3720. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3721. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3722. uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3723. Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24),
  3724. uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3725. Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24),
  3726. uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3727. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3728. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3729. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3730. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3731. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3732. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3733. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3734. Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
  3735. } /* intscan.c:7:28 */
  3736. func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
  3737. var val uintptr
  3738. var c int32
  3739. var neg int32
  3740. var x uint32
  3741. var y uint64
  3742. var bs int32
  3743. val = uintptr(unsafe.Pointer(&table)) + uintptr(1)
  3744. neg = 0
  3745. if !(base > uint32(36) || base == uint32(1)) {
  3746. goto __1
  3747. }
  3748. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3749. return uint64(0)
  3750. __1:
  3751. ;
  3752. __2:
  3753. if !(__isspace(tls, AssignInt32(&c, func() int32 {
  3754. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3755. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3756. }
  3757. return X__shgetc(tls, f)
  3758. }())) != 0) {
  3759. goto __3
  3760. }
  3761. goto __2
  3762. __3:
  3763. ;
  3764. if !(c == '+' || c == '-') {
  3765. goto __4
  3766. }
  3767. neg = -Bool32(c == '-')
  3768. c = func() int32 {
  3769. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3770. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3771. }
  3772. return X__shgetc(tls, f)
  3773. }()
  3774. __4:
  3775. ;
  3776. if !((base == uint32(0) || base == uint32(16)) && c == '0') {
  3777. goto __5
  3778. }
  3779. c = func() int32 {
  3780. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3781. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3782. }
  3783. return X__shgetc(tls, f)
  3784. }()
  3785. if !(c|32 == 'x') {
  3786. goto __7
  3787. }
  3788. c = func() int32 {
  3789. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3790. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3791. }
  3792. return X__shgetc(tls, f)
  3793. }()
  3794. if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) {
  3795. goto __9
  3796. }
  3797. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3798. (*FILE)(unsafe.Pointer(f)).Frpos--
  3799. } else {
  3800. }
  3801. if !(pok != 0) {
  3802. goto __10
  3803. }
  3804. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3805. (*FILE)(unsafe.Pointer(f)).Frpos--
  3806. } else {
  3807. }
  3808. goto __11
  3809. __10:
  3810. X__shlim(tls, f, int64(0))
  3811. __11:
  3812. ;
  3813. return uint64(0)
  3814. __9:
  3815. ;
  3816. base = uint32(16)
  3817. goto __8
  3818. __7:
  3819. if !(base == uint32(0)) {
  3820. goto __12
  3821. }
  3822. base = uint32(8)
  3823. __12:
  3824. ;
  3825. __8:
  3826. ;
  3827. goto __6
  3828. __5:
  3829. if !(base == uint32(0)) {
  3830. goto __13
  3831. }
  3832. base = uint32(10)
  3833. __13:
  3834. ;
  3835. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) {
  3836. goto __14
  3837. }
  3838. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3839. (*FILE)(unsafe.Pointer(f)).Frpos--
  3840. } else {
  3841. }
  3842. X__shlim(tls, f, int64(0))
  3843. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3844. return uint64(0)
  3845. __14:
  3846. ;
  3847. __6:
  3848. ;
  3849. if !(base == uint32(10)) {
  3850. goto __15
  3851. }
  3852. x = uint32(0)
  3853. __17:
  3854. if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) {
  3855. goto __19
  3856. }
  3857. x = x*uint32(10) + uint32(c-'0')
  3858. goto __18
  3859. __18:
  3860. c = func() int32 {
  3861. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3862. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3863. }
  3864. return X__shgetc(tls, f)
  3865. }()
  3866. goto __17
  3867. goto __19
  3868. __19:
  3869. ;
  3870. y = uint64(x)
  3871. __20:
  3872. if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) {
  3873. goto __22
  3874. }
  3875. y = y*uint64(10) + uint64(c-'0')
  3876. goto __21
  3877. __21:
  3878. c = func() int32 {
  3879. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3880. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3881. }
  3882. return X__shgetc(tls, f)
  3883. }()
  3884. goto __20
  3885. goto __22
  3886. __22:
  3887. ;
  3888. if !(uint32(c-'0') >= 10) {
  3889. goto __23
  3890. }
  3891. goto done
  3892. __23:
  3893. ;
  3894. goto __16
  3895. __15:
  3896. if !!(base&(base-uint32(1)) != 0) {
  3897. goto __24
  3898. }
  3899. bs = int32(*(*int8)(unsafe.Pointer(ts + 55 + uintptr(uint32(0x17)*base>>5&uint32(7)))))
  3900. x = uint32(0)
  3901. __26:
  3902. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) {
  3903. goto __28
  3904. }
  3905. x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  3906. goto __27
  3907. __27:
  3908. c = func() int32 {
  3909. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3910. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3911. }
  3912. return X__shgetc(tls, f)
  3913. }()
  3914. goto __26
  3915. goto __28
  3916. __28:
  3917. ;
  3918. y = uint64(x)
  3919. __29:
  3920. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) {
  3921. goto __31
  3922. }
  3923. y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  3924. goto __30
  3925. __30:
  3926. c = func() int32 {
  3927. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3928. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3929. }
  3930. return X__shgetc(tls, f)
  3931. }()
  3932. goto __29
  3933. goto __31
  3934. __31:
  3935. ;
  3936. goto __25
  3937. __24:
  3938. x = uint32(0)
  3939. __32:
  3940. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) {
  3941. goto __34
  3942. }
  3943. x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  3944. goto __33
  3945. __33:
  3946. c = func() int32 {
  3947. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3948. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3949. }
  3950. return X__shgetc(tls, f)
  3951. }()
  3952. goto __32
  3953. goto __34
  3954. __34:
  3955. ;
  3956. y = uint64(x)
  3957. __35:
  3958. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(base) && uint64(base)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) {
  3959. goto __37
  3960. }
  3961. y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  3962. goto __36
  3963. __36:
  3964. c = func() int32 {
  3965. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3966. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3967. }
  3968. return X__shgetc(tls, f)
  3969. }()
  3970. goto __35
  3971. goto __37
  3972. __37:
  3973. ;
  3974. __25:
  3975. ;
  3976. __16:
  3977. ;
  3978. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
  3979. goto __38
  3980. }
  3981. __39:
  3982. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
  3983. goto __41
  3984. }
  3985. goto __40
  3986. __40:
  3987. c = func() int32 {
  3988. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3989. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3990. }
  3991. return X__shgetc(tls, f)
  3992. }()
  3993. goto __39
  3994. goto __41
  3995. __41:
  3996. ;
  3997. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3998. y = lim
  3999. if !(lim&uint64(1) != 0) {
  4000. goto __42
  4001. }
  4002. neg = 0
  4003. __42:
  4004. ;
  4005. __38:
  4006. ;
  4007. done:
  4008. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  4009. (*FILE)(unsafe.Pointer(f)).Frpos--
  4010. } else {
  4011. }
  4012. if !(y >= lim) {
  4013. goto __43
  4014. }
  4015. if !(!(lim&uint64(1) != 0) && !(neg != 0)) {
  4016. goto __44
  4017. }
  4018. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  4019. return lim - uint64(1)
  4020. goto __45
  4021. __44:
  4022. if !(y > lim) {
  4023. goto __46
  4024. }
  4025. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  4026. return lim
  4027. __46:
  4028. ;
  4029. __45:
  4030. ;
  4031. __43:
  4032. ;
  4033. return y ^ uint64(neg) - uint64(neg)
  4034. }
  4035. // The shcnt field stores the number of bytes read so far, offset by
  4036. // the value of buf-rpos at the last function call (__shlim or __shgetc),
  4037. // so that between calls the inline shcnt macro can add rpos-buf to get
  4038. // the actual count.
  4039. func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
  4040. (*FILE)(unsafe.Pointer(f)).Fshlim = lim
  4041. (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf) - int32((*FILE)(unsafe.Pointer(f)).Frpos)) / 1)
  4042. // If lim is nonzero, rend must be a valid pointer.
  4043. if lim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).Frend)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) > lim {
  4044. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr(lim)
  4045. } else {
  4046. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
  4047. }
  4048. }
  4049. func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
  4050. var c int32
  4051. var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).Frpos)-int32((*FILE)(unsafe.Pointer(f)).Fbuf))/1)
  4052. if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
  4053. (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) + cnt
  4054. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos
  4055. (*FILE)(unsafe.Pointer(f)).Fshlim = int64(-1)
  4056. return -1
  4057. }
  4058. cnt++
  4059. if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).Frend)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) > (*FILE)(unsafe.Pointer(f)).Fshlim-cnt {
  4060. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr((*FILE)(unsafe.Pointer(f)).Fshlim-cnt)
  4061. } else {
  4062. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
  4063. }
  4064. (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) + cnt
  4065. if (*FILE)(unsafe.Pointer(f)).Frpos <= (*FILE)(unsafe.Pointer(f)).Fbuf {
  4066. *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).Frpos + UintptrFromInt32(-1))) = uint8(c)
  4067. }
  4068. return c
  4069. }
  4070. func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
  4071. return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24
  4072. }
  4073. func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
  4074. return Xcopysign(tls, x, y)
  4075. }
  4076. func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
  4077. return Xfabs(tls, x)
  4078. }
  4079. func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
  4080. return Xfmod(tls, x, y)
  4081. }
  4082. var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
  4083. func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
  4084. bp := tls.Alloc(8)
  4085. defer tls.Free(8)
  4086. *(*struct{ Ff float64 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float64 }) {
  4087. *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
  4088. return r
  4089. }()
  4090. var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
  4091. var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63)
  4092. var y double_t
  4093. if e >= 0x3ff+52 {
  4094. return x
  4095. }
  4096. if s != 0 {
  4097. y = x - toint + toint
  4098. } else {
  4099. y = x + toint - toint
  4100. }
  4101. if y == float64(0) {
  4102. if s != 0 {
  4103. return -Float64FromFloat64(0.0)
  4104. }
  4105. return float64(0)
  4106. }
  4107. return y
  4108. }
  4109. func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
  4110. bp := tls.Alloc(8)
  4111. defer tls.Free(8)
  4112. // var u struct {Ff float64;} at bp, 8
  4113. var y double_t = x
  4114. if n > 1023 {
  4115. y = y * 0x1p1023
  4116. n = n - 1023
  4117. if n > 1023 {
  4118. y = y * 0x1p1023
  4119. n = n - 1023
  4120. if n > 1023 {
  4121. n = 1023
  4122. }
  4123. }
  4124. } else if n < -1022 {
  4125. // make sure final n < -53 to avoid double
  4126. // rounding in the subnormal range
  4127. y = y * (float64(0x1p-1022) * 0x1p53)
  4128. n = n + (1022 - 53)
  4129. if n < -1022 {
  4130. y = y * (float64(0x1p-1022) * 0x1p53)
  4131. n = n + (1022 - 53)
  4132. if n < -1022 {
  4133. n = -1022
  4134. }
  4135. }
  4136. }
  4137. *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52
  4138. x = y * *(*float64)(unsafe.Pointer(bp))
  4139. return x
  4140. }
  4141. func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
  4142. return Xscalbn(tls, x, n)
  4143. }
  4144. type div_t = struct {
  4145. Fquot int32
  4146. Frem int32
  4147. } /* stdlib.h:62:35 */
  4148. type ldiv_t = struct {
  4149. Fquot int32
  4150. Frem int32
  4151. } /* stdlib.h:63:36 */
  4152. type lldiv_t = struct {
  4153. Fquot int64
  4154. Frem int64
  4155. } /* stdlib.h:64:41 */
  4156. type max_align_t = struct {
  4157. F__ll int64
  4158. F__ld float64
  4159. } /* alltypes.h:51:66 */
  4160. type imaxdiv_t = struct {
  4161. Fquot intmax_t
  4162. Frem intmax_t
  4163. } /* inttypes.h:14:40 */
  4164. type pid_t = int32 /* alltypes.h:258:13 */
  4165. type uid_t = uint32 /* alltypes.h:268:18 */
  4166. type gid_t = uint32 /* alltypes.h:273:18 */
  4167. type iovec = struct {
  4168. Fiov_base uintptr
  4169. Fiov_len size_t
  4170. } /* alltypes.h:378:1 */
  4171. type socklen_t = uint32 /* alltypes.h:384:18 */
  4172. type sa_family_t = uint16 /* alltypes.h:389:24 */
  4173. type msghdr = struct {
  4174. Fmsg_name uintptr
  4175. Fmsg_namelen socklen_t
  4176. Fmsg_iov uintptr
  4177. Fmsg_iovlen int32
  4178. Fmsg_control uintptr
  4179. Fmsg_controllen socklen_t
  4180. Fmsg_flags int32
  4181. } /* socket.h:22:1 */
  4182. type cmsghdr = struct {
  4183. Fcmsg_len socklen_t
  4184. Fcmsg_level int32
  4185. Fcmsg_type int32
  4186. } /* socket.h:44:1 */
  4187. type linger = struct {
  4188. Fl_onoff int32
  4189. Fl_linger int32
  4190. } /* socket.h:74:1 */
  4191. type sockaddr = struct {
  4192. Fsa_family sa_family_t
  4193. Fsa_data [14]int8
  4194. } /* socket.h:367:1 */
  4195. type sockaddr_storage = struct {
  4196. Fss_family sa_family_t
  4197. F__ss_padding [122]int8
  4198. F__ss_align uint32
  4199. } /* socket.h:372:1 */
  4200. type in_port_t = uint16_t /* in.h:12:18 */
  4201. type in_addr_t = uint32_t /* in.h:13:18 */
  4202. type in_addr = struct{ Fs_addr in_addr_t } /* in.h:14:1 */
  4203. type sockaddr_in = struct {
  4204. Fsin_family sa_family_t
  4205. Fsin_port in_port_t
  4206. Fsin_addr struct{ Fs_addr in_addr_t }
  4207. Fsin_zero [8]uint8_t
  4208. } /* in.h:16:1 */
  4209. type in6_addr = struct {
  4210. F__in6_union struct {
  4211. F__ccgo_pad1 [0]uint32
  4212. F__s6_addr [16]uint8_t
  4213. }
  4214. } /* in.h:23:1 */
  4215. type sockaddr_in6 = struct {
  4216. Fsin6_family sa_family_t
  4217. Fsin6_port in_port_t
  4218. Fsin6_flowinfo uint32_t
  4219. Fsin6_addr struct {
  4220. F__in6_union struct {
  4221. F__ccgo_pad1 [0]uint32
  4222. F__s6_addr [16]uint8_t
  4223. }
  4224. }
  4225. Fsin6_scope_id uint32_t
  4226. } /* in.h:34:1 */
  4227. type ipv6_mreq = struct {
  4228. Fipv6mr_multiaddr struct {
  4229. F__in6_union struct {
  4230. F__ccgo_pad1 [0]uint32
  4231. F__s6_addr [16]uint8_t
  4232. }
  4233. }
  4234. Fipv6mr_interface uint32
  4235. } /* in.h:42:1 */
  4236. type ip_opts = struct {
  4237. Fip_dst struct{ Fs_addr in_addr_t }
  4238. Fip_opts [40]int8
  4239. } /* in.h:229:1 */
  4240. type ip_mreq = struct {
  4241. Fimr_multiaddr struct{ Fs_addr in_addr_t }
  4242. Fimr_interface struct{ Fs_addr in_addr_t }
  4243. } /* in.h:247:1 */
  4244. type ip_mreqn = struct {
  4245. Fimr_multiaddr struct{ Fs_addr in_addr_t }
  4246. Fimr_address struct{ Fs_addr in_addr_t }
  4247. Fimr_ifindex int32
  4248. } /* in.h:252:1 */
  4249. type ip_mreq_source = struct {
  4250. Fimr_multiaddr struct{ Fs_addr in_addr_t }
  4251. Fimr_interface struct{ Fs_addr in_addr_t }
  4252. Fimr_sourceaddr struct{ Fs_addr in_addr_t }
  4253. } /* in.h:258:1 */
  4254. type ip_msfilter = struct {
  4255. Fimsf_multiaddr struct{ Fs_addr in_addr_t }
  4256. Fimsf_interface struct{ Fs_addr in_addr_t }
  4257. Fimsf_fmode uint32_t
  4258. Fimsf_numsrc uint32_t
  4259. Fimsf_slist [1]struct{ Fs_addr in_addr_t }
  4260. } /* in.h:264:1 */
  4261. type group_req = struct {
  4262. Fgr_interface uint32_t
  4263. Fgr_group struct {
  4264. Fss_family sa_family_t
  4265. F__ss_padding [122]int8
  4266. F__ss_align uint32
  4267. }
  4268. } /* in.h:275:1 */
  4269. type group_source_req = struct {
  4270. Fgsr_interface uint32_t
  4271. Fgsr_group struct {
  4272. Fss_family sa_family_t
  4273. F__ss_padding [122]int8
  4274. F__ss_align uint32
  4275. }
  4276. Fgsr_source struct {
  4277. Fss_family sa_family_t
  4278. F__ss_padding [122]int8
  4279. F__ss_align uint32
  4280. }
  4281. } /* in.h:280:1 */
  4282. type group_filter = struct {
  4283. Fgf_interface uint32_t
  4284. Fgf_group struct {
  4285. Fss_family sa_family_t
  4286. F__ss_padding [122]int8
  4287. F__ss_align uint32
  4288. }
  4289. Fgf_fmode uint32_t
  4290. Fgf_numsrc uint32_t
  4291. Fgf_slist [1]struct {
  4292. Fss_family sa_family_t
  4293. F__ss_padding [122]int8
  4294. F__ss_align uint32
  4295. }
  4296. } /* in.h:286:1 */
  4297. type in_pktinfo = struct {
  4298. Fipi_ifindex int32
  4299. Fipi_spec_dst struct{ Fs_addr in_addr_t }
  4300. Fipi_addr struct{ Fs_addr in_addr_t }
  4301. } /* in.h:297:1 */
  4302. type in6_pktinfo = struct {
  4303. Fipi6_addr struct {
  4304. F__in6_union struct {
  4305. F__ccgo_pad1 [0]uint32
  4306. F__s6_addr [16]uint8_t
  4307. }
  4308. }
  4309. Fipi6_ifindex uint32
  4310. } /* in.h:303:1 */
  4311. type ip6_mtuinfo = struct {
  4312. Fip6m_addr struct {
  4313. Fsin6_family sa_family_t
  4314. Fsin6_port in_port_t
  4315. Fsin6_flowinfo uint32_t
  4316. Fsin6_addr struct {
  4317. F__in6_union struct {
  4318. F__ccgo_pad1 [0]uint32
  4319. F__s6_addr [16]uint8_t
  4320. }
  4321. }
  4322. Fsin6_scope_id uint32_t
  4323. }
  4324. Fip6m_mtu uint32_t
  4325. } /* in.h:308:1 */
  4326. type addrinfo = struct {
  4327. Fai_flags int32
  4328. Fai_family int32
  4329. Fai_socktype int32
  4330. Fai_protocol int32
  4331. Fai_addrlen socklen_t
  4332. Fai_addr uintptr
  4333. Fai_canonname uintptr
  4334. Fai_next uintptr
  4335. } /* netdb.h:16:1 */
  4336. // Legacy functions follow (marked OBsolete in SUS)
  4337. type netent = struct {
  4338. Fn_name uintptr
  4339. Fn_aliases uintptr
  4340. Fn_addrtype int32
  4341. Fn_net uint32_t
  4342. } /* netdb.h:62:1 */
  4343. type hostent = struct {
  4344. Fh_name uintptr
  4345. Fh_aliases uintptr
  4346. Fh_addrtype int32
  4347. Fh_length int32
  4348. Fh_addr_list uintptr
  4349. } /* netdb.h:69:1 */
  4350. type servent = struct {
  4351. Fs_name uintptr
  4352. Fs_aliases uintptr
  4353. Fs_port int32
  4354. Fs_proto uintptr
  4355. } /* netdb.h:78:1 */
  4356. type protoent = struct {
  4357. Fp_name uintptr
  4358. Fp_aliases uintptr
  4359. Fp_proto int32
  4360. } /* netdb.h:85:1 */
  4361. type aibuf = struct {
  4362. Fai struct {
  4363. Fai_flags int32
  4364. Fai_family int32
  4365. Fai_socktype int32
  4366. Fai_protocol int32
  4367. Fai_addrlen socklen_t
  4368. Fai_addr uintptr
  4369. Fai_canonname uintptr
  4370. Fai_next uintptr
  4371. }
  4372. Fsa struct {
  4373. Fsin struct {
  4374. Fsin_family sa_family_t
  4375. Fsin_port in_port_t
  4376. Fsin_addr struct{ Fs_addr in_addr_t }
  4377. Fsin_zero [8]uint8_t
  4378. }
  4379. F__ccgo_pad1 [12]byte
  4380. }
  4381. Flock [1]int32
  4382. Fslot int16
  4383. Fref int16
  4384. } /* lookup.h:10:1 */
  4385. type sa = struct {
  4386. Fsin struct {
  4387. Fsin_family sa_family_t
  4388. Fsin_port in_port_t
  4389. Fsin_addr struct{ Fs_addr in_addr_t }
  4390. Fsin_zero [8]uint8_t
  4391. }
  4392. F__ccgo_pad1 [12]byte
  4393. } /* lookup.h:10:1 */
  4394. type address = struct {
  4395. Ffamily int32
  4396. Fscopeid uint32
  4397. Faddr [16]uint8_t
  4398. Fsortkey int32
  4399. } /* lookup.h:20:1 */
  4400. type service = struct {
  4401. Fport uint16_t
  4402. Fproto uint8
  4403. Fsocktype uint8
  4404. } /* lookup.h:27:1 */
  4405. type resolvconf = struct {
  4406. Fns [3]struct {
  4407. Ffamily int32
  4408. Fscopeid uint32
  4409. Faddr [16]uint8_t
  4410. Fsortkey int32
  4411. }
  4412. Fnns uint32
  4413. Fattempts uint32
  4414. Fndots uint32
  4415. Ftimeout uint32
  4416. } /* lookup.h:34:1 */
  4417. func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
  4418. var cnt size_t
  4419. cnt = size_t(1)
  4420. __1:
  4421. if !((*addrinfo)(unsafe.Pointer(p)).Fai_next != 0) {
  4422. goto __3
  4423. }
  4424. goto __2
  4425. __2:
  4426. cnt++
  4427. p = (*addrinfo)(unsafe.Pointer(p)).Fai_next
  4428. goto __1
  4429. goto __3
  4430. __3:
  4431. ;
  4432. var b uintptr = p - uintptr(uint32(uintptr(0)))
  4433. b -= 68 * uintptr((*aibuf)(unsafe.Pointer(b)).Fslot)
  4434. //TODO LOCK(b->lock);
  4435. if !(int32(AssignSubPtrInt16(b+66, int16(cnt))) != 0) {
  4436. Xfree(tls, b)
  4437. }
  4438. //TODO else UNLOCK(b->lock);
  4439. }
  4440. type time_t = int64 /* alltypes.h:108:16 */
  4441. type clockid_t = int32 /* alltypes.h:237:13 */
  4442. type timespec = struct {
  4443. Ftv_sec time_t
  4444. Ftv_nsec int32
  4445. __12 uint32 /* int : 32 */
  4446. } /* alltypes.h:252:1 */
  4447. type pthread_t = uintptr /* alltypes.h:296:26 */
  4448. type pthread_once_t = int32 /* alltypes.h:302:13 */
  4449. type pthread_key_t = uint32 /* alltypes.h:307:18 */
  4450. type pthread_spinlock_t = int32 /* alltypes.h:312:13 */
  4451. type pthread_mutexattr_t = struct{ F__attr uint32 } /* alltypes.h:317:37 */
  4452. type pthread_condattr_t = struct{ F__attr uint32 } /* alltypes.h:322:37 */
  4453. type pthread_barrierattr_t = struct{ F__attr uint32 } /* alltypes.h:327:37 */
  4454. type pthread_rwlockattr_t = struct{ F__attr [2]uint32 } /* alltypes.h:332:40 */
  4455. type __sigset_t = struct{ F__bits [32]uint32 } /* alltypes.h:372:9 */
  4456. type sigset_t = __sigset_t /* alltypes.h:372:71 */
  4457. type pthread_attr_t = struct{ F__u struct{ F__i [9]int32 } } /* alltypes.h:395:147 */
  4458. type pthread_mutex_t = struct{ F__u struct{ F__i [6]int32 } } /* alltypes.h:400:157 */
  4459. type pthread_cond_t = struct{ F__u struct{ F__i [12]int32 } } /* alltypes.h:410:112 */
  4460. type pthread_rwlock_t = struct{ F__u struct{ F__i [8]int32 } } /* alltypes.h:420:139 */
  4461. type pthread_barrier_t = struct{ F__u struct{ F__i [5]int32 } } /* alltypes.h:425:137 */
  4462. type sched_param = struct {
  4463. Fsched_priority int32
  4464. F__reserved1 int32
  4465. F__reserved2 [4]int32
  4466. F__reserved3 int32
  4467. } /* sched.h:19:1 */
  4468. type timer_t = uintptr /* alltypes.h:232:14 */
  4469. type clock_t = int32 /* alltypes.h:242:14 */
  4470. type tm = struct {
  4471. Ftm_sec int32
  4472. Ftm_min int32
  4473. Ftm_hour int32
  4474. Ftm_mday int32
  4475. Ftm_mon int32
  4476. Ftm_year int32
  4477. Ftm_wday int32
  4478. Ftm_yday int32
  4479. Ftm_isdst int32
  4480. Ftm_gmtoff int32
  4481. Ftm_zone uintptr
  4482. } /* time.h:38:1 */
  4483. type itimerspec = struct {
  4484. Fit_interval struct {
  4485. Ftv_sec time_t
  4486. Ftv_nsec int32
  4487. __12 uint32 /* int : 32 */
  4488. }
  4489. Fit_value struct {
  4490. Ftv_sec time_t
  4491. Ftv_nsec int32
  4492. __12 uint32 /* int : 32 */
  4493. }
  4494. } /* time.h:80:1 */
  4495. type __ptcb = struct {
  4496. F__f uintptr
  4497. F__x uintptr
  4498. F__next uintptr
  4499. } /* pthread.h:206:1 */
  4500. type useconds_t = uint32 /* alltypes.h:283:18 */
  4501. func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
  4502. bp := tls.Alloc(1608)
  4503. defer tls.Free(1608)
  4504. // var ports [2]service at bp, 8
  4505. // var addrs [48]address at bp+8, 1344
  4506. // var canon [256]int8 at bp+1352, 256
  4507. var outcanon uintptr
  4508. var nservs int32
  4509. var naddrs int32
  4510. var nais int32
  4511. var canon_len int32
  4512. var i int32
  4513. var j int32
  4514. var k int32
  4515. var family int32 = 0
  4516. var flags int32 = 0
  4517. var proto int32 = 0
  4518. var socktype int32 = 0
  4519. var out uintptr
  4520. if !(host != 0) && !(serv != 0) {
  4521. return -2
  4522. }
  4523. if hint != 0 {
  4524. family = (*addrinfo)(unsafe.Pointer(hint)).Fai_family
  4525. flags = (*addrinfo)(unsafe.Pointer(hint)).Fai_flags
  4526. proto = (*addrinfo)(unsafe.Pointer(hint)).Fai_protocol
  4527. socktype = (*addrinfo)(unsafe.Pointer(hint)).Fai_socktype
  4528. var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400
  4529. if flags&mask != flags {
  4530. return -1
  4531. }
  4532. switch family {
  4533. case 2:
  4534. fallthrough
  4535. case 10:
  4536. fallthrough
  4537. case 0:
  4538. break
  4539. fallthrough
  4540. default:
  4541. return -6
  4542. }
  4543. }
  4544. if flags&0x20 != 0 {
  4545. Xabort(tls) //TODO-
  4546. // /* Define the "an address is configured" condition for address
  4547. // * families via ability to create a socket for the family plus
  4548. // * routability of the loopback address for the family. */
  4549. // static const struct sockaddr_in lo4 = {
  4550. // .sin_family = AF_INET, .sin_port = 65535,
  4551. // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN
  4552. // ? 0x7f000001 : 0x0100007f
  4553. // };
  4554. // static const struct sockaddr_in6 lo6 = {
  4555. // .sin6_family = AF_INET6, .sin6_port = 65535,
  4556. // .sin6_addr = IN6ADDR_LOOPBACK_INIT
  4557. // };
  4558. // int tf[2] = { AF_INET, AF_INET6 };
  4559. // const void *ta[2] = { &lo4, &lo6 };
  4560. // socklen_t tl[2] = { sizeof lo4, sizeof lo6 };
  4561. // for (i=0; i<2; i++) {
  4562. // if (family==tf[1-i]) continue;
  4563. // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM,
  4564. // IPPROTO_UDP);
  4565. // if (s>=0) {
  4566. // int cs;
  4567. // pthread_setcancelstate(
  4568. // PTHREAD_CANCEL_DISABLE, &cs);
  4569. // int r = connect(s, ta[i], tl[i]);
  4570. // pthread_setcancelstate(cs, 0);
  4571. // close(s);
  4572. // if (!r) continue;
  4573. // }
  4574. // switch (errno) {
  4575. // case EADDRNOTAVAIL:
  4576. // case EAFNOSUPPORT:
  4577. // case EHOSTUNREACH:
  4578. // case ENETDOWN:
  4579. // case ENETUNREACH:
  4580. // break;
  4581. // default:
  4582. // return EAI_SYSTEM;
  4583. // }
  4584. // if (family == tf[i]) return EAI_NONAME;
  4585. // family = tf[1-i];
  4586. // }
  4587. }
  4588. nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags)
  4589. if nservs < 0 {
  4590. return nservs
  4591. }
  4592. naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags)
  4593. if naddrs < 0 {
  4594. return naddrs
  4595. }
  4596. nais = nservs * naddrs
  4597. canon_len = int32(Xstrlen(tls, bp+1352))
  4598. out = Xcalloc(tls, uint32(1), uint32(nais)*uint32(unsafe.Sizeof(aibuf{}))+uint32(canon_len)+uint32(1))
  4599. if !(out != 0) {
  4600. return -10
  4601. }
  4602. if canon_len != 0 {
  4603. outcanon = out + uintptr(nais)*68
  4604. Xmemcpy(tls, outcanon, bp+1352, uint32(canon_len+1))
  4605. } else {
  4606. outcanon = uintptr(0)
  4607. }
  4608. for k = AssignInt32(&i, 0); i < naddrs; i++ {
  4609. j = 0
  4610. __1:
  4611. if !(j < nservs) {
  4612. goto __3
  4613. }
  4614. {
  4615. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fslot = int16(k)
  4616. //TODO out[k].ai = (struct addrinfo){
  4617. //TODO .ai_family = addrs[i].family,
  4618. //TODO .ai_socktype = ports[j].socktype,
  4619. //TODO .ai_protocol = ports[j].proto,
  4620. //TODO .ai_addrlen = addrs[i].family == AF_INET
  4621. //TODO ? sizeof(struct sockaddr_in)
  4622. //TODO : sizeof(struct sockaddr_in6),
  4623. //TODO .ai_addr = (void *)&out[k].sa,
  4624. //TODO .ai_canonname = outcanon };
  4625. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily
  4626. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fsocktype)
  4627. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fproto)
  4628. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_addrlen = func() uint32 {
  4629. if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).Ffamily == 2 {
  4630. return uint32(unsafe.Sizeof(sockaddr_in{}))
  4631. }
  4632. return uint32(unsafe.Sizeof(sockaddr_in6{}))
  4633. }()
  4634. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_addr = out + uintptr(k)*68 + 32
  4635. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_canonname = outcanon
  4636. if k != 0 {
  4637. (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*68)).Fai.Fai_next = out + uintptr(k)*68
  4638. }
  4639. switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily {
  4640. case 2:
  4641. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin_family = sa_family_t(2)
  4642. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
  4643. Xmemcpy(tls, out+uintptr(k)*68+32+4, bp+8+uintptr(i)*28+8, uint32(4))
  4644. break
  4645. case 10:
  4646. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_family = sa_family_t(10)
  4647. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
  4648. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Fscopeid
  4649. Xmemcpy(tls, out+uintptr(k)*68+32+8, bp+8+uintptr(i)*28+8, uint32(16))
  4650. break
  4651. }
  4652. }
  4653. goto __2
  4654. __2:
  4655. j++
  4656. k++
  4657. goto __1
  4658. goto __3
  4659. __3:
  4660. }
  4661. (*aibuf)(unsafe.Pointer(out)).Fref = int16(nais)
  4662. *(*uintptr)(unsafe.Pointer(res)) = out
  4663. return 0
  4664. }
  4665. type ucred = struct {
  4666. Fpid pid_t
  4667. Fuid uid_t
  4668. Fgid gid_t
  4669. } /* socket.h:57:1 */
  4670. type mmsghdr = struct {
  4671. Fmsg_hdr struct {
  4672. Fmsg_name uintptr
  4673. Fmsg_namelen socklen_t
  4674. Fmsg_iov uintptr
  4675. Fmsg_iovlen int32
  4676. Fmsg_control uintptr
  4677. Fmsg_controllen socklen_t
  4678. Fmsg_flags int32
  4679. }
  4680. Fmsg_len uint32
  4681. } /* socket.h:63:1 */
  4682. func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
  4683. bp := tls.Alloc(4)
  4684. defer tls.Free(4)
  4685. var size size_t = size_t(63)
  4686. // var res uintptr at bp, 4
  4687. var err int32
  4688. for __ccgo := true; __ccgo; __ccgo = err == 34 {
  4689. Xfree(tls, _sh)
  4690. _sh = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1)))
  4691. if !(_sh != 0) {
  4692. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  4693. return uintptr(0)
  4694. }
  4695. err = Xgethostbyaddr_r(tls, a, l, af, _sh,
  4696. _sh+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  4697. }
  4698. if err != 0 {
  4699. return uintptr(0)
  4700. }
  4701. return _sh
  4702. }
  4703. var _sh uintptr /* gethostbyaddr.c:9:24: */
  4704. func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
  4705. return Xgethostbyname2(tls, name, 2)
  4706. }
  4707. func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
  4708. bp := tls.Alloc(4)
  4709. defer tls.Free(4)
  4710. var size size_t = size_t(63)
  4711. // var res uintptr at bp, 4
  4712. var err int32
  4713. for __ccgo := true; __ccgo; __ccgo = err == 34 {
  4714. Xfree(tls, _sh1)
  4715. _sh1 = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1)))
  4716. if !(_sh1 != 0) {
  4717. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  4718. return uintptr(0)
  4719. }
  4720. err = Xgethostbyname2_r(tls, name, af, _sh1,
  4721. _sh1+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  4722. }
  4723. if err != 0 {
  4724. return uintptr(0)
  4725. }
  4726. return _sh1
  4727. }
  4728. var _sh1 uintptr /* gethostbyname2.c:10:24: */
  4729. func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
  4730. bp := tls.Alloc(1600)
  4731. defer tls.Free(1600)
  4732. // var addrs [48]address at bp, 1344
  4733. // var canon [256]int8 at bp+1344, 256
  4734. var i int32
  4735. var cnt int32
  4736. var align size_t
  4737. var need size_t
  4738. *(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
  4739. cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02)
  4740. if cnt < 0 {
  4741. switch cnt {
  4742. case -2:
  4743. *(*int32)(unsafe.Pointer(err)) = 1
  4744. return 2
  4745. fallthrough
  4746. case -3:
  4747. *(*int32)(unsafe.Pointer(err)) = 2
  4748. return 11
  4749. fallthrough
  4750. default:
  4751. fallthrough
  4752. case -4:
  4753. *(*int32)(unsafe.Pointer(err)) = 3
  4754. return 74
  4755. fallthrough
  4756. case -10:
  4757. fallthrough
  4758. case -11:
  4759. *(*int32)(unsafe.Pointer(err)) = 3
  4760. return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
  4761. }
  4762. }
  4763. (*hostent)(unsafe.Pointer(h)).Fh_addrtype = af
  4764. (*hostent)(unsafe.Pointer(h)).Fh_length = func() int32 {
  4765. if af == 10 {
  4766. return 16
  4767. }
  4768. return 4
  4769. }()
  4770. // Align buffer
  4771. align = -uintptr_t(buf) & (uint32(unsafe.Sizeof(uintptr(0))) - uint32(1))
  4772. need = uint32(4) * uint32(unsafe.Sizeof(uintptr(0)))
  4773. need = need + uint32(cnt+1)*(uint32(unsafe.Sizeof(uintptr(0)))+uint32((*hostent)(unsafe.Pointer(h)).Fh_length))
  4774. need = need + (Xstrlen(tls, name) + size_t(1))
  4775. need = need + (Xstrlen(tls, bp+1344) + size_t(1))
  4776. need = need + align
  4777. if need > buflen {
  4778. return 34
  4779. }
  4780. buf += uintptr(align)
  4781. (*hostent)(unsafe.Pointer(h)).Fh_aliases = buf
  4782. buf += uintptr(uint32(3) * uint32(unsafe.Sizeof(uintptr(0))))
  4783. (*hostent)(unsafe.Pointer(h)).Fh_addr_list = buf
  4784. buf += uintptr(uint32(cnt+1) * uint32(unsafe.Sizeof(uintptr(0))))
  4785. for i = 0; i < cnt; i++ {
  4786. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)) = buf
  4787. buf += uintptr((*hostent)(unsafe.Pointer(h)).Fh_length)
  4788. Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)), bp+uintptr(i)*28+8, uint32((*hostent)(unsafe.Pointer(h)).Fh_length))
  4789. }
  4790. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)) = uintptr(0)
  4791. (*hostent)(unsafe.Pointer(h)).Fh_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).Fh_aliases, buf)
  4792. Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, bp+1344)
  4793. buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).Fh_name) + size_t(1))
  4794. if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, name) != 0 {
  4795. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)) = buf
  4796. Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)), name)
  4797. buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4))) + size_t(1))
  4798. } else {
  4799. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)) = uintptr(0)
  4800. }
  4801. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 2*4)) = uintptr(0)
  4802. *(*uintptr)(unsafe.Pointer(res)) = h
  4803. return 0
  4804. }
  4805. type if_nameindex = struct {
  4806. Fif_index uint32
  4807. Fif_name uintptr
  4808. } /* if.h:12:1 */
  4809. type ifaddr = struct {
  4810. Fifa_addr struct {
  4811. Fsa_family sa_family_t
  4812. Fsa_data [14]int8
  4813. }
  4814. Fifa_ifu struct {
  4815. Fifu_broadaddr struct {
  4816. Fsa_family sa_family_t
  4817. Fsa_data [14]int8
  4818. }
  4819. }
  4820. Fifa_ifp uintptr
  4821. Fifa_next uintptr
  4822. } /* if.h:51:1 */
  4823. type ifmap = struct {
  4824. Fmem_start uint32
  4825. Fmem_end uint32
  4826. Fbase_addr uint16
  4827. Firq uint8
  4828. Fdma uint8
  4829. Fport uint8
  4830. F__ccgo_pad1 [3]byte
  4831. } /* if.h:64:1 */
  4832. type ifreq = struct {
  4833. Fifr_ifrn struct{ Fifrn_name [16]int8 }
  4834. Fifr_ifru struct {
  4835. F__ccgo_pad1 [0]uint32
  4836. Fifru_addr struct {
  4837. Fsa_family sa_family_t
  4838. Fsa_data [14]int8
  4839. }
  4840. }
  4841. } /* if.h:76:1 */
  4842. type ifconf = struct {
  4843. Fifc_len int32
  4844. Fifc_ifcu struct{ Fifcu_buf uintptr }
  4845. } /* if.h:116:1 */
  4846. type ns_sect = uint32 /* nameser.h:37:3 */
  4847. type __ns_msg = struct {
  4848. F_msg uintptr
  4849. F_eom uintptr
  4850. F_id uint16_t
  4851. F_flags uint16_t
  4852. F_counts [4]uint16_t
  4853. F_sections [4]uintptr
  4854. F_sect ns_sect
  4855. F_rrnum int32
  4856. F_msg_ptr uintptr
  4857. } /* nameser.h:39:9 */
  4858. type ns_msg = __ns_msg /* nameser.h:46:3 */
  4859. type _ns_flagdata = struct {
  4860. Fmask int32
  4861. Fshift int32
  4862. } /* nameser.h:48:1 */
  4863. type __ns_rr = struct {
  4864. Fname [1025]int8
  4865. F__ccgo_pad1 [1]byte
  4866. Ftype uint16_t
  4867. Frr_class uint16_t
  4868. F__ccgo_pad2 [2]byte
  4869. Fttl uint32_t
  4870. Frdlength uint16_t
  4871. F__ccgo_pad3 [2]byte
  4872. Frdata uintptr
  4873. } /* nameser.h:59:9 */
  4874. type ns_rr = __ns_rr /* nameser.h:66:3 */
  4875. type ns_flag = uint32 /* nameser.h:87:3 */
  4876. type ns_opcode = uint32 /* nameser.h:96:3 */
  4877. type ns_rcode = uint32 /* nameser.h:115:3 */
  4878. type ns_update_operation = uint32 /* nameser.h:121:3 */
  4879. type ns_tsig_key1 = struct {
  4880. Fname [1025]int8
  4881. Falg [1025]int8
  4882. F__ccgo_pad1 [2]byte
  4883. Fdata uintptr
  4884. Flen int32
  4885. } /* nameser.h:123:1 */
  4886. type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */
  4887. type ns_tcp_tsig_state1 = struct {
  4888. Fcounter int32
  4889. Fkey uintptr
  4890. Fctx uintptr
  4891. Fsig [512]uint8
  4892. Fsiglen int32
  4893. } /* nameser.h:130:1 */
  4894. type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */
  4895. type ns_type = uint32 /* nameser.h:200:3 */
  4896. type ns_class = uint32 /* nameser.h:219:3 */
  4897. type ns_key_types = uint32 /* nameser.h:226:3 */
  4898. type ns_cert_types = uint32 /* nameser.h:234:3 */
  4899. type HEADER = struct {
  4900. F__ccgo_pad1 [0]uint32
  4901. Fid uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */
  4902. Fqdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */
  4903. Fnscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */
  4904. } /* nameser.h:353:3 */
  4905. // unused; purely for broken apps
  4906. type __res_state = struct {
  4907. Fretrans int32
  4908. Fretry int32
  4909. Foptions uint32
  4910. Fnscount int32
  4911. Fnsaddr_list [3]struct {
  4912. Fsin_family sa_family_t
  4913. Fsin_port in_port_t
  4914. Fsin_addr struct{ Fs_addr in_addr_t }
  4915. Fsin_zero [8]uint8_t
  4916. }
  4917. Fid uint16
  4918. F__ccgo_pad1 [2]byte
  4919. Fdnsrch [7]uintptr
  4920. Fdefdname [256]int8
  4921. Fpfcode uint32
  4922. Fndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */
  4923. F__ccgo_pad2 [4]byte
  4924. Fsort_list [10]struct {
  4925. Faddr struct{ Fs_addr in_addr_t }
  4926. Fmask uint32_t
  4927. }
  4928. Fqhook uintptr
  4929. Frhook uintptr
  4930. Fres_h_errno int32
  4931. F_vcsock int32
  4932. F_flags uint32
  4933. F_u struct {
  4934. F__ccgo_pad1 [0]uint32
  4935. Fpad [52]int8
  4936. }
  4937. } /* resolv.h:26:9 */
  4938. // unused; purely for broken apps
  4939. type res_state = uintptr /* resolv.h:62:3 */
  4940. type res_sym = struct {
  4941. Fnumber int32
  4942. Fname uintptr
  4943. Fhumanname uintptr
  4944. } /* resolv.h:70:1 */
  4945. func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */
  4946. p += uintptr(uint32(3) * uint32(unsafe.Sizeof(int32(0))))
  4947. *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0)
  4948. for __ccgo := true; __ccgo; __ccgo = x != 0 {
  4949. *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(uint32('0') + x%uint32(10))
  4950. x = x / uint32(10)
  4951. }
  4952. return p
  4953. }
  4954. func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */
  4955. bp := tls.Alloc(32)
  4956. defer tls.Free(32)
  4957. Xsprintf(tls, s, ts+64,
  4958. VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip)))))
  4959. }
  4960. func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */
  4961. var i int32
  4962. for i = 15; i >= 0; i-- {
  4963. *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15]
  4964. *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.')
  4965. *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4]
  4966. *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.')
  4967. }
  4968. Xstrcpy(tls, s, ts+89)
  4969. }
  4970. var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 98)) /* getnameinfo.c:36:20 */
  4971. func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */
  4972. bp := tls.Alloc(556)
  4973. defer tls.Free(556)
  4974. // var line [512]int8 at bp+16, 512
  4975. var p uintptr
  4976. var z uintptr
  4977. var _buf [1032]uint8
  4978. _ = _buf
  4979. // var atmp [16]uint8 at bp, 16
  4980. // var iplit address at bp+528, 28
  4981. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  4982. var f uintptr = Xfopen(tls, ts+115, ts+126)
  4983. if !(f != 0) {
  4984. return
  4985. }
  4986. if family == 2 {
  4987. Xmemcpy(tls, bp+uintptr(12), a, uint32(4))
  4988. Xmemcpy(tls, bp, ts+129, uint32(12))
  4989. a = bp /* &atmp[0] */
  4990. }
  4991. for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]int8{})), f) != 0 {
  4992. if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 {
  4993. *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n')
  4994. *(*int8)(unsafe.Pointer(p)) = int8(0)
  4995. }
  4996. for p = bp + 16; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ {
  4997. }
  4998. *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0)
  4999. if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 {
  5000. continue
  5001. }
  5002. if (*address)(unsafe.Pointer(bp+528)).Ffamily == 2 {
  5003. Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint32(4))
  5004. Xmemcpy(tls, bp+528+8, ts+129, uint32(12))
  5005. (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).Fscopeid = uint32(0)
  5006. }
  5007. if Xmemcmp(tls, a, bp+528+8, uint32(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).Fscopeid != scopeid {
  5008. continue
  5009. }
  5010. for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ {
  5011. }
  5012. for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ {
  5013. }
  5014. *(*int8)(unsafe.Pointer(z)) = int8(0)
  5015. if (int32(z)-int32(p))/1 < 256 {
  5016. Xmemcpy(tls, buf, p, uint32((int32(z)-int32(p))/1+1))
  5017. break
  5018. }
  5019. }
  5020. //TODO __fclose_ca(f);
  5021. Xfclose(tls, f)
  5022. }
  5023. func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */
  5024. Xabort(tls) //TODO-
  5025. // unsigned long svport;
  5026. // char line[128], *p, *z;
  5027. // unsigned char _buf[1032];
  5028. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  5029. // if (!f) return;
  5030. // while (fgets(line, sizeof line, f)) {
  5031. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  5032. // for (p=line; *p && !isspace(*p); p++);
  5033. // if (!*p) continue;
  5034. // *p++ = 0;
  5035. // svport = strtoul(p, &z, 10);
  5036. // if (svport != port || z==p) continue;
  5037. // if (dgram && strncmp(z, "/udp", 4)) continue;
  5038. // if (!dgram && strncmp(z, "/tcp", 4)) continue;
  5039. // if (p-line > 32) continue;
  5040. // memcpy(buf, line, p-line);
  5041. // break;
  5042. // }
  5043. // __fclose_ca(f);
  5044. }
  5045. var Xh_errno int32 /* h_errno.c:4:5: */
  5046. func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
  5047. return uintptr(unsafe.Pointer(&Xh_errno))
  5048. }
  5049. func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
  5050. bp := tls.Alloc(20)
  5051. defer tls.Free(20)
  5052. var s uintptr = s0
  5053. var d uintptr = dest
  5054. *(*[4]uint32)(unsafe.Pointer(bp /* a */)) = [4]uint32{0: uint32(0)}
  5055. // var z uintptr at bp+16, 4
  5056. var i int32
  5057. for i = 0; i < 4; i++ {
  5058. *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) = Xstrtoul(tls, s, bp+16, 0)
  5059. if *(*uintptr)(unsafe.Pointer(bp + 16)) == s || *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) != 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != '.' || !(func() int32 {
  5060. if 0 != 0 {
  5061. return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s))))
  5062. }
  5063. return Bool32(uint32(*(*int8)(unsafe.Pointer(s)))-uint32('0') < uint32(10))
  5064. }() != 0) {
  5065. return 0
  5066. }
  5067. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != 0) {
  5068. break
  5069. }
  5070. s = *(*uintptr)(unsafe.Pointer(bp + 16)) + uintptr(1)
  5071. }
  5072. if i == 4 {
  5073. return 0
  5074. }
  5075. switch i {
  5076. case 0:
  5077. *(*uint32)(unsafe.Pointer(bp + 1*4)) = *(*uint32)(unsafe.Pointer(bp)) & uint32(0xffffff)
  5078. AssignShrPtrUint32(bp, int(24))
  5079. fallthrough
  5080. case 1:
  5081. *(*uint32)(unsafe.Pointer(bp + 2*4)) = *(*uint32)(unsafe.Pointer(bp + 1*4)) & uint32(0xffff)
  5082. AssignShrPtrUint32(bp+1*4, int(16))
  5083. fallthrough
  5084. case 2:
  5085. *(*uint32)(unsafe.Pointer(bp + 3*4)) = *(*uint32)(unsafe.Pointer(bp + 2*4)) & uint32(0xff)
  5086. AssignShrPtrUint32(bp+2*4, int(8))
  5087. }
  5088. for i = 0; i < 4; i++ {
  5089. if *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) > uint32(255) {
  5090. return 0
  5091. }
  5092. *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)))
  5093. }
  5094. return 1
  5095. }
  5096. func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
  5097. bp := tls.Alloc(276)
  5098. defer tls.Free(276)
  5099. var a uintptr = a0
  5100. var i int32
  5101. var j int32
  5102. var max int32
  5103. var best int32
  5104. // var buf [100]int8 at bp+176, 100
  5105. switch af {
  5106. case 2:
  5107. if socklen_t(Xsnprintf(tls, s, l, ts+142, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l {
  5108. return s
  5109. }
  5110. break
  5111. case 10:
  5112. if Xmemcmp(tls, a, ts+129, uint32(12)) != 0 {
  5113. Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]int8{})),
  5114. ts+154,
  5115. VaList(bp+32, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))),
  5116. 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))),
  5117. 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))),
  5118. 256*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), 256*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15)))))
  5119. } else {
  5120. Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]int8{})),
  5121. ts+178,
  5122. VaList(bp+96, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))),
  5123. 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))),
  5124. 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))),
  5125. int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15)))))
  5126. }
  5127. // Replace longest /(^0|:)[:0]{2,}/ with "::"
  5128. i = AssignInt32(&best, 0)
  5129. max = 2
  5130. for ; *(*int8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ {
  5131. if i != 0 && int32(*(*int8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' {
  5132. continue
  5133. }
  5134. j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+208))
  5135. if j > max {
  5136. best = i
  5137. max = j
  5138. }
  5139. }
  5140. if max > 3 {
  5141. *(*int8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrInt8(bp+176+uintptr(best+1), int8(':'))
  5142. Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint32(i-best-max+1))
  5143. }
  5144. if Xstrlen(tls, bp+176) < l {
  5145. Xstrcpy(tls, s, bp+176)
  5146. return s
  5147. }
  5148. break
  5149. default:
  5150. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  5151. return uintptr(0)
  5152. }
  5153. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28
  5154. return uintptr(0)
  5155. }
  5156. func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
  5157. if c-uint32('0') < uint32(10) {
  5158. return int32(c - uint32('0'))
  5159. }
  5160. c = c | uint32(32)
  5161. if c-uint32('a') < uint32(6) {
  5162. return int32(c - uint32('a') + uint32(10))
  5163. }
  5164. return -1
  5165. }
  5166. func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
  5167. bp := tls.Alloc(16)
  5168. defer tls.Free(16)
  5169. // var ip [8]uint16_t at bp, 16
  5170. var a uintptr = a0
  5171. var i int32
  5172. var j int32
  5173. var v int32
  5174. var d int32
  5175. var brk int32 = -1
  5176. var need_v4 int32 = 0
  5177. if af == 2 {
  5178. for i = 0; i < 4; i++ {
  5179. for v = AssignInt32(&j, 0); j < 3 && func() int32 {
  5180. if 0 != 0 {
  5181. return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))
  5182. }
  5183. return Bool32(uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10))
  5184. }() != 0; j++ {
  5185. v = 10*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - '0'
  5186. }
  5187. if j == 0 || j > 1 && int32(*(*int8)(unsafe.Pointer(s))) == '0' || v > 255 {
  5188. return 0
  5189. }
  5190. *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v)
  5191. if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 {
  5192. return 1
  5193. }
  5194. if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' {
  5195. return 0
  5196. }
  5197. s += uintptr(j + 1)
  5198. }
  5199. return 0
  5200. } else if af != 10 {
  5201. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  5202. return -1
  5203. }
  5204. if int32(*(*int8)(unsafe.Pointer(s))) == ':' && int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' {
  5205. return 0
  5206. }
  5207. for i = 0; ; i++ {
  5208. if int32(*(*int8)(unsafe.Pointer(s))) == ':' && brk < 0 {
  5209. brk = i
  5210. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0)
  5211. if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) {
  5212. break
  5213. }
  5214. if i == 7 {
  5215. return 0
  5216. }
  5217. continue
  5218. }
  5219. for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ {
  5220. v = 16*v + d
  5221. }
  5222. if j == 0 {
  5223. return 0
  5224. }
  5225. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v)
  5226. if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) {
  5227. break
  5228. }
  5229. if i == 7 {
  5230. return 0
  5231. }
  5232. if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' {
  5233. if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 {
  5234. return 0
  5235. }
  5236. need_v4 = 1
  5237. i++
  5238. break
  5239. }
  5240. s += uintptr(j + 1)
  5241. }
  5242. if brk >= 0 {
  5243. Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint32(2*(i+1-brk)))
  5244. for j = 0; j < 7-i; j++ {
  5245. *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0)
  5246. }
  5247. }
  5248. for j = 0; j < 8; j++ {
  5249. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8)
  5250. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2)))
  5251. }
  5252. if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 {
  5253. return 0
  5254. }
  5255. return 1
  5256. }
  5257. func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
  5258. bp := tls.Alloc(88)
  5259. defer tls.Free(88)
  5260. // var a4 in_addr at bp, 4
  5261. // var a6 in6_addr at bp+68, 16
  5262. if X__inet_aton(tls, name, bp) > 0 {
  5263. if family == 10 { // wrong family
  5264. return -2
  5265. }
  5266. Xmemcpy(tls, buf+8, bp, uint32(unsafe.Sizeof(in_addr{})))
  5267. (*address)(unsafe.Pointer(buf)).Ffamily = 2
  5268. (*address)(unsafe.Pointer(buf)).Fscopeid = uint32(0)
  5269. return 1
  5270. }
  5271. // var tmp [64]int8 at bp+4, 64
  5272. var p uintptr = Xstrchr(tls, name, '%')
  5273. // var z uintptr at bp+84, 4
  5274. var scopeid uint64 = uint64(0)
  5275. if p != 0 && (int32(p)-int32(name))/1 < 64 {
  5276. Xmemcpy(tls, bp+4, name, uint32((int32(p)-int32(name))/1))
  5277. *(*int8)(unsafe.Pointer(bp + 4 + uintptr((int32(p)-int32(name))/1))) = int8(0)
  5278. name = bp + 4 /* &tmp[0] */
  5279. }
  5280. if Xinet_pton(tls, 10, name, bp+68) <= 0 {
  5281. return 0
  5282. }
  5283. if family == 2 { // wrong family
  5284. return -2
  5285. }
  5286. Xmemcpy(tls, buf+8, bp+68, uint32(unsafe.Sizeof(in6_addr{})))
  5287. (*address)(unsafe.Pointer(buf)).Ffamily = 10
  5288. if p != 0 {
  5289. if func() int32 {
  5290. if 0 != 0 {
  5291. return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1)))))
  5292. }
  5293. return Bool32(uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10))
  5294. }() != 0 {
  5295. scopeid = Xstrtoull(tls, p, bp+84, 10)
  5296. } else {
  5297. *(*uintptr)(unsafe.Pointer(bp + 84 /* z */)) = p - uintptr(1)
  5298. }
  5299. if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 84)))) != 0 {
  5300. Xabort(tls) //TODO-
  5301. // if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
  5302. // !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
  5303. // return EAI_NONAME;
  5304. // scopeid = if_nametoindex(p);
  5305. // if (!scopeid) return EAI_NONAME;
  5306. }
  5307. if scopeid > uint64(0xffffffff) {
  5308. return -2
  5309. }
  5310. }
  5311. (*address)(unsafe.Pointer(buf)).Fscopeid = uint32(scopeid)
  5312. return 1
  5313. }
  5314. type mode_t = uint32 /* alltypes.h:175:18 */
  5315. type flock = struct {
  5316. Fl_type int16
  5317. Fl_whence int16
  5318. Fl_start off_t
  5319. Fl_len off_t
  5320. Fl_pid pid_t
  5321. } /* fcntl.h:24:1 */
  5322. func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */
  5323. var s uintptr
  5324. //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0;
  5325. if Xstrnlen(tls, host, uint32(255))-size_t(1) >= size_t(254) {
  5326. return 0
  5327. }
  5328. for s = host; int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80 || int32(*(*uint8)(unsafe.Pointer(s))) == '.' || int32(*(*uint8)(unsafe.Pointer(s))) == '-' || Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0; s++ {
  5329. }
  5330. return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0))
  5331. }
  5332. var Xzero_struct_address address /* lookup_name.c:27:16: */
  5333. func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */
  5334. var cnt int32 = 0
  5335. if name != 0 {
  5336. return 0
  5337. }
  5338. if flags&0x01 != 0 {
  5339. //TODO if (family != AF_INET6)
  5340. //TODO buf[cnt++] = (struct address){ .family = AF_INET };
  5341. if family != 10 {
  5342. var x = Xzero_struct_address
  5343. x.Ffamily = 2
  5344. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  5345. }
  5346. //TODO if (family != AF_INET)
  5347. //TODO buf[cnt++] = (struct address){ .family = AF_INET6 };
  5348. if family != 2 {
  5349. var x = Xzero_struct_address
  5350. x.Ffamily = 10
  5351. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  5352. }
  5353. } else {
  5354. Xabort(tls) //TODO-
  5355. // if (family != AF_INET6)
  5356. // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
  5357. // if (family != AF_INET)
  5358. // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
  5359. }
  5360. return cnt
  5361. }
  5362. func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */
  5363. return X__lookup_ipliteral(tls, buf, name, family)
  5364. }
  5365. func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */
  5366. bp := tls.Alloc(512)
  5367. defer tls.Free(512)
  5368. // var line [512]int8 at bp, 512
  5369. var l size_t = Xstrlen(tls, name)
  5370. var cnt int32 = 0
  5371. var badfam int32 = 0
  5372. var _buf [1032]uint8
  5373. _ = _buf
  5374. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  5375. var _f FILE
  5376. _ = _f
  5377. var f uintptr = Xfopen(tls, ts+115, ts+126)
  5378. if !(f != 0) {
  5379. switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) {
  5380. case 2:
  5381. fallthrough
  5382. case 20:
  5383. fallthrough
  5384. case 13:
  5385. return 0
  5386. fallthrough
  5387. default:
  5388. return -11
  5389. }
  5390. }
  5391. for Xfgets(tls, bp, int32(unsafe.Sizeof([512]int8{})), f) != 0 && cnt < 48 {
  5392. var p uintptr
  5393. var z uintptr
  5394. if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 {
  5395. *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n')
  5396. *(*int8)(unsafe.Pointer(p)) = int8(0)
  5397. }
  5398. for p = bp + uintptr(1); AssignUintptr(&p, Xstrstr(tls, p, name)) != 0 && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ {
  5399. }
  5400. if !(p != 0) {
  5401. continue
  5402. }
  5403. // Isolate IP address to parse
  5404. for p = bp; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ {
  5405. }
  5406. *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0)
  5407. switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) {
  5408. case 1:
  5409. cnt++
  5410. break
  5411. case 0:
  5412. continue
  5413. default:
  5414. badfam = -2
  5415. continue
  5416. }
  5417. // Extract first name as canonical name
  5418. for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ {
  5419. }
  5420. for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ {
  5421. }
  5422. *(*int8)(unsafe.Pointer(z)) = int8(0)
  5423. if is_valid_hostname(tls, p) != 0 {
  5424. Xmemcpy(tls, canon, p, uint32((int32(z)-int32(p))/1+1))
  5425. }
  5426. }
  5427. //TODO __fclose_ca(f);
  5428. Xfclose(tls, f)
  5429. if cnt != 0 {
  5430. return cnt
  5431. }
  5432. return badfam
  5433. }
  5434. type dpc_ctx = struct {
  5435. Faddrs uintptr
  5436. Fcanon uintptr
  5437. Fcnt int32
  5438. } /* lookup_name.c:112:1 */
  5439. func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */
  5440. return -1 //TODO-
  5441. Xabort(tls)
  5442. return int32(0) //TODO-
  5443. // char search[256];
  5444. // struct resolvconf conf;
  5445. // size_t l, dots;
  5446. // char *p, *z;
  5447. // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1;
  5448. // /* Count dots, suppress search when >=ndots or name ends in
  5449. // * a dot, which is an explicit request for global scope. */
  5450. // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++;
  5451. // if (dots >= conf.ndots || name[l-1]=='.') *search = 0;
  5452. // /* Strip final dot for canon, fail if multiple trailing dots. */
  5453. // if (name[l-1]=='.') l--;
  5454. // if (!l || name[l-1]=='.') return EAI_NONAME;
  5455. // /* This can never happen; the caller already checked length. */
  5456. // if (l >= 256) return EAI_NONAME;
  5457. // /* Name with search domain appended is setup in canon[]. This both
  5458. // * provides the desired default canonical name (if the requested
  5459. // * name is not a CNAME record) and serves as a buffer for passing
  5460. // * the full requested name to name_from_dns. */
  5461. // memcpy(canon, name, l);
  5462. // canon[l] = '.';
  5463. // for (p=search; *p; p=z) {
  5464. // for (; isspace(*p); p++);
  5465. // for (z=p; *z && !isspace(*z); z++);
  5466. // if (z==p) break;
  5467. // if (z-p < 256 - l - 1) {
  5468. // memcpy(canon+l+1, p, z-p);
  5469. // canon[z-p+1+l] = 0;
  5470. // int cnt = name_from_dns(buf, canon, canon, family, &conf);
  5471. // if (cnt) return cnt;
  5472. // }
  5473. // }
  5474. // canon[l] = 0;
  5475. // return name_from_dns(buf, canon, name, family, &conf);
  5476. }
  5477. type policy = struct {
  5478. Faddr [16]uint8
  5479. Flen uint8
  5480. Fmask uint8
  5481. Fprec uint8
  5482. Flabel uint8
  5483. } /* lookup_name.c:237:14 */
  5484. var defpolicy = [6]policy{
  5485. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 211)), Flen: uint8(15), Fmask: uint8(0xff), Fprec: uint8(50)},
  5486. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 228)), Flen: uint8(11), Fmask: uint8(0xff), Fprec: uint8(35), Flabel: uint8(4)},
  5487. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 244)), Flen: uint8(1), Fmask: uint8(0xff), Fprec: uint8(30), Flabel: uint8(2)},
  5488. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 260)), Flen: uint8(3), Fmask: uint8(0xff), Fprec: uint8(5), Flabel: uint8(5)},
  5489. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 276)), Fmask: uint8(0xfe), Fprec: uint8(3), Flabel: uint8(13)},
  5490. // Last rule must match all addresses to stop loop.
  5491. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 292)), Fprec: uint8(40), Flabel: uint8(1)},
  5492. } /* lookup_name.c:241:3 */
  5493. func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */
  5494. var i int32
  5495. for i = 0; ; i++ {
  5496. if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint32(defpolicy[i].Flen)) != 0 {
  5497. continue
  5498. }
  5499. if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].Flen))))&int32(defpolicy[i].Fmask) !=
  5500. int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].Flen)))) {
  5501. continue
  5502. }
  5503. return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20
  5504. }
  5505. return uintptr(0)
  5506. }
  5507. func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */
  5508. return int32((*policy)(unsafe.Pointer(policyof(tls, a))).Flabel)
  5509. }
  5510. func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */
  5511. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff {
  5512. return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15
  5513. }
  5514. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 {
  5515. return 2
  5516. }
  5517. if *(*uint32_t)(unsafe.Pointer(a)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 1*4)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 2*4)) == uint32_t(0) && int32(*(*uint8_t)(unsafe.Pointer(a + 12))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 13))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 14))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 15))) == 1 {
  5518. return 2
  5519. }
  5520. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 {
  5521. return 5
  5522. }
  5523. return 14
  5524. }
  5525. func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */
  5526. // FIXME: The common prefix length should be limited to no greater
  5527. // than the nominal length of the prefix portion of the source
  5528. // address. However the definition of the source prefix length is
  5529. // not clear and thus this limiting is not yet implemented.
  5530. var i uint32
  5531. for i = uint32(0); i < uint32(128) && !((int32(*(*uint8_t)(unsafe.Pointer(s /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8)))))^int32(*(*uint8_t)(unsafe.Pointer(d /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8))))))&(int32(128)>>(i%uint32(8))) != 0); i++ {
  5532. }
  5533. return int32(i)
  5534. }
  5535. func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */
  5536. var a uintptr = _a
  5537. var b uintptr = _b
  5538. return (*address)(unsafe.Pointer(b)).Fsortkey - (*address)(unsafe.Pointer(a)).Fsortkey
  5539. }
  5540. func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
  5541. bp := tls.Alloc(92)
  5542. defer tls.Free(92)
  5543. var cnt int32 = 0
  5544. var i int32
  5545. var j int32
  5546. _ = j
  5547. *(*int8)(unsafe.Pointer(canon)) = int8(0)
  5548. if name != 0 {
  5549. // reject empty name and check len so it fits into temp bufs
  5550. var l size_t = Xstrnlen(tls, name, uint32(255))
  5551. if l-size_t(1) >= size_t(254) {
  5552. return -2
  5553. }
  5554. Xmemcpy(tls, canon, name, l+size_t(1))
  5555. }
  5556. // Procedurally, a request for v6 addresses with the v4-mapped
  5557. // flag set is like a request for unspecified family, followed
  5558. // by filtering of the results.
  5559. if flags&0x08 != 0 {
  5560. if family == 10 {
  5561. family = 0
  5562. } else {
  5563. flags = flags - 0x08
  5564. }
  5565. }
  5566. // Try each backend until there's at least one result.
  5567. cnt = name_from_null(tls, buf, name, family, flags)
  5568. if !(cnt != 0) {
  5569. cnt = name_from_numeric(tls, buf, name, family)
  5570. }
  5571. if !(cnt != 0) && !(flags&0x04 != 0) {
  5572. cnt = name_from_hosts(tls, buf, canon, name, family)
  5573. if !(cnt != 0) {
  5574. cnt = name_from_dns_search(tls, buf, canon, name, family)
  5575. }
  5576. }
  5577. if cnt <= 0 {
  5578. if cnt != 0 {
  5579. return cnt
  5580. }
  5581. return -2
  5582. }
  5583. // Filter/transform results for v4-mapped lookup, if requested.
  5584. if flags&0x08 != 0 {
  5585. Xabort(tls) //TODO-
  5586. // if (!(flags & AI_ALL)) {
  5587. // /* If any v6 results exist, remove v4 results. */
  5588. // for (i=0; i<cnt && buf[i].family != AF_INET6; i++);
  5589. // if (i<cnt) {
  5590. // for (j=0; i<cnt; i++) {
  5591. // if (buf[i].family == AF_INET6)
  5592. // buf[j++] = buf[i];
  5593. // }
  5594. // cnt = i = j;
  5595. // }
  5596. // }
  5597. // /* Translate any remaining v4 results to v6 */
  5598. // for (i=0; i<cnt; i++) {
  5599. // if (buf[i].family != AF_INET) continue;
  5600. // memcpy(buf[i].addr+12, buf[i].addr, 4);
  5601. // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
  5602. // buf[i].family = AF_INET6;
  5603. // }
  5604. }
  5605. // No further processing is needed if there are fewer than 2
  5606. // results or if there are only IPv4 results.
  5607. if cnt < 2 || family == 2 {
  5608. return cnt
  5609. }
  5610. for i = 0; i < cnt; i++ {
  5611. if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).Ffamily != 2 {
  5612. break
  5613. }
  5614. }
  5615. if i == cnt {
  5616. return cnt
  5617. }
  5618. var cs int32
  5619. _ = cs
  5620. //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
  5621. // The following implements a subset of RFC 3484/6724 destination
  5622. // address selection by generating a single 31-bit sort key for
  5623. // each address. Rules 3, 4, and 7 are omitted for having
  5624. // excessive runtime and code size cost and dubious benefit.
  5625. // So far the label/precedence table cannot be customized.
  5626. for i = 0; i < cnt; i++ {
  5627. var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Ffamily
  5628. var key int32 = 0
  5629. *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{}
  5630. *(*sockaddr_in6)(unsafe.Pointer(bp /* da6 */)) = sockaddr_in6{Fsin6_family: sa_family_t(10), Fsin6_port: in_port_t(65535), Fsin6_scope_id: (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fscopeid}
  5631. *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{}
  5632. *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{Fsin_family: sa_family_t(2), Fsin_port: in_port_t(65535)}
  5633. var sa1 uintptr
  5634. var da uintptr
  5635. // var salen socklen_t at bp+88, 4
  5636. var dalen socklen_t
  5637. if family == 10 {
  5638. Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint32(16))
  5639. da = bp /* &da6 */
  5640. dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  5641. sa1 = bp + 28 /* &sa6 */
  5642. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  5643. } else {
  5644. Xmemcpy(tls, bp+28+8,
  5645. ts+129, uint32(12))
  5646. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4))
  5647. Xmemcpy(tls, bp+8,
  5648. ts+129, uint32(12))
  5649. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4))
  5650. Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint32(4))
  5651. da = bp + 56 /* &da4 */
  5652. dalen = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  5653. sa1 = bp + 72 /* &sa4 */
  5654. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  5655. }
  5656. var dpolicy uintptr = policyof(tls, bp+8)
  5657. var dscope int32 = scopeof(tls, bp+8)
  5658. var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Flabel)
  5659. var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Fprec)
  5660. var prefixlen int32 = 0
  5661. var fd int32 = Xsocket(tls, family, 2|02000000, 17)
  5662. if fd >= 0 {
  5663. if !(Xconnect(tls, fd, da, dalen) != 0) {
  5664. key = key | 0x40000000
  5665. if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) {
  5666. if family == 2 {
  5667. Xmemcpy(tls,
  5668. bp+28+8+uintptr(12),
  5669. bp+72+4, uint32(4))
  5670. }
  5671. if dscope == scopeof(tls, bp+28+8) {
  5672. key = key | 0x20000000
  5673. }
  5674. if dlabel == labelof(tls, bp+28+8) {
  5675. key = key | 0x10000000
  5676. }
  5677. prefixlen = prefixmatch(tls, bp+28+8,
  5678. bp+8)
  5679. }
  5680. }
  5681. Xclose(tls, fd)
  5682. }
  5683. key = key | dprec<<20
  5684. key = key | (15-dscope)<<16
  5685. key = key | prefixlen<<8
  5686. key = key | (48-i)<<0
  5687. (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fsortkey = key
  5688. }
  5689. Xqsort(tls, buf, uint32(cnt), uint32(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct {
  5690. f func(*TLS, uintptr, uintptr) int32
  5691. }{addrcmp})))
  5692. //TODO pthread_setcancelstate(cs, 0);
  5693. return cnt
  5694. }
  5695. func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
  5696. bp := tls.Alloc(4)
  5697. defer tls.Free(4)
  5698. var line [128]int8
  5699. _ = line
  5700. var cnt int32 = 0
  5701. var p uintptr
  5702. _ = p
  5703. *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 54 /* "" */
  5704. var port uint32 = uint32(0)
  5705. switch socktype {
  5706. case 1:
  5707. switch proto {
  5708. case 0:
  5709. proto = 6
  5710. fallthrough
  5711. case 6:
  5712. break
  5713. default:
  5714. return -8
  5715. }
  5716. break
  5717. case 2:
  5718. switch proto {
  5719. case 0:
  5720. proto = 17
  5721. fallthrough
  5722. case 17:
  5723. break
  5724. default:
  5725. return -8
  5726. }
  5727. fallthrough
  5728. case 0:
  5729. break
  5730. default:
  5731. if name != 0 {
  5732. return -8
  5733. }
  5734. (*service)(unsafe.Pointer(buf)).Fport = uint16_t(0)
  5735. (*service)(unsafe.Pointer(buf)).Fproto = uint8(proto)
  5736. (*service)(unsafe.Pointer(buf)).Fsocktype = uint8(socktype)
  5737. return 1
  5738. }
  5739. if name != 0 {
  5740. if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) {
  5741. return -8
  5742. }
  5743. port = Xstrtoul(tls, name, bp, 10)
  5744. }
  5745. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) {
  5746. if port > uint32(65535) {
  5747. return -8
  5748. }
  5749. if proto != 17 {
  5750. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
  5751. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(1)
  5752. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(6)
  5753. }
  5754. if proto != 6 {
  5755. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
  5756. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(2)
  5757. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(17)
  5758. }
  5759. return cnt
  5760. }
  5761. if flags&0x400 != 0 {
  5762. return -2
  5763. }
  5764. var l size_t = Xstrlen(tls, name)
  5765. _ = l
  5766. Xabort(tls) //TODO-
  5767. // unsigned char _buf[1032];
  5768. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  5769. // if (!f) switch (errno) {
  5770. // case ENOENT:
  5771. // case ENOTDIR:
  5772. // case EACCES:
  5773. // return EAI_SERVICE;
  5774. // default:
  5775. // return EAI_SYSTEM;
  5776. // }
  5777. Xabort(tls) //TODO-
  5778. // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
  5779. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  5780. // /* Find service name */
  5781. // for(p=line; (p=strstr(p, name)); p++) {
  5782. // if (p>line && !isspace(p[-1])) continue;
  5783. // if (p[l] && !isspace(p[l])) continue;
  5784. // break;
  5785. // }
  5786. // if (!p) continue;
  5787. // /* Skip past canonical name at beginning of line */
  5788. // for (p=line; *p && !isspace(*p); p++);
  5789. // port = strtoul(p, &z, 10);
  5790. // if (port > 65535 || z==p) continue;
  5791. // if (!strncmp(z, "/udp", 4)) {
  5792. // if (proto == IPPROTO_TCP) continue;
  5793. // buf[cnt].port = port;
  5794. // buf[cnt].socktype = SOCK_DGRAM;
  5795. // buf[cnt++].proto = IPPROTO_UDP;
  5796. // }
  5797. // if (!strncmp(z, "/tcp", 4)) {
  5798. // if (proto == IPPROTO_UDP) continue;
  5799. // buf[cnt].port = port;
  5800. // buf[cnt].socktype = SOCK_STREAM;
  5801. // buf[cnt++].proto = IPPROTO_TCP;
  5802. // }
  5803. // }
  5804. // __fclose_ca(f);
  5805. // return cnt > 0 ? cnt : EAI_SERVICE;
  5806. Xabort(tls)
  5807. return int32(0) //TODO-
  5808. }
  5809. func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
  5810. *(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
  5811. if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
  5812. (*struct {
  5813. f func(*TLS, uintptr, uintptr, size_t) size_t
  5814. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fwrite})).f(tls, f, uintptr(0), uint32(0))
  5815. }
  5816. (*FILE)(unsafe.Pointer(f)).Fwpos = AssignPtrUintptr(f+28, AssignPtrUintptr(f+16, uintptr(0)))
  5817. if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(4) != 0 {
  5818. *(*uint32)(unsafe.Pointer(f)) |= uint32(32)
  5819. return -1
  5820. }
  5821. (*FILE)(unsafe.Pointer(f)).Frpos = AssignPtrUintptr(f+8, (*FILE)(unsafe.Pointer(f)).Fbuf+uintptr((*FILE)(unsafe.Pointer(f)).Fbuf_size))
  5822. if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(16) != 0 {
  5823. return -1
  5824. }
  5825. return 0
  5826. }
  5827. func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
  5828. X__builtin_abort(tls) //TODO-
  5829. // __stdio_exit_needed();
  5830. }
  5831. // This function assumes it will never be called if there is already
  5832. // data buffered for reading.
  5833. func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
  5834. bp := tls.Alloc(1)
  5835. defer tls.Free(1)
  5836. // var c uint8 at bp, 1
  5837. if !(X__toread(tls, f) != 0) && (*struct {
  5838. f func(*TLS, uintptr, uintptr, size_t) size_t
  5839. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fread})).f(tls, f, bp, uint32(1)) == size_t(1) {
  5840. return int32(*(*uint8)(unsafe.Pointer(bp)))
  5841. }
  5842. return -1
  5843. }
  5844. func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
  5845. var try uintptr
  5846. var sign int32
  5847. for nel > size_t(0) {
  5848. try = base + uintptr(width*(nel/size_t(2)))
  5849. sign = (*struct {
  5850. f func(*TLS, uintptr, uintptr) int32
  5851. })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try)
  5852. if sign < 0 {
  5853. nel = nel / size_t(2)
  5854. } else if sign > 0 {
  5855. base = try + uintptr(width)
  5856. nel = nel - (nel/size_t(2) + size_t(1))
  5857. } else {
  5858. return try
  5859. }
  5860. }
  5861. return uintptr(0)
  5862. }
  5863. func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */
  5864. bp := tls.Alloc(136)
  5865. defer tls.Free(136)
  5866. // var f FILE at bp, 136
  5867. (*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+4, s)
  5868. (*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
  5869. X__shlim(tls, bp, int64(0))
  5870. var y float64 = X__floatscan(tls, bp, prec, 1)
  5871. var cnt off_t = (*FILE)(unsafe.Pointer(bp)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).Frpos)-int32((*FILE)(unsafe.Pointer(bp)).Fbuf))/1)
  5872. if p != 0 {
  5873. *(*uintptr)(unsafe.Pointer(p)) = func() uintptr {
  5874. if cnt != 0 {
  5875. return s + uintptr(cnt)
  5876. }
  5877. return s
  5878. }()
  5879. }
  5880. return y
  5881. }
  5882. func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
  5883. return float32(strtox(tls, s, p, 0))
  5884. }
  5885. func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
  5886. return strtox(tls, s, p, 1)
  5887. }
  5888. func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
  5889. return strtox(tls, s, p, 2)
  5890. }
  5891. func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */
  5892. bp := tls.Alloc(136)
  5893. defer tls.Free(136)
  5894. // var f FILE at bp, 136
  5895. (*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+4, s)
  5896. (*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
  5897. X__shlim(tls, bp, int64(0))
  5898. var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim)
  5899. if p != 0 {
  5900. var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).Frpos)-int32((*FILE)(unsafe.Pointer(bp)).Fbuf))/1))
  5901. *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt)
  5902. }
  5903. return y
  5904. }
  5905. func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
  5906. return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
  5907. }
  5908. func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
  5909. return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
  5910. }
  5911. func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
  5912. return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
  5913. }
  5914. func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
  5915. return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
  5916. }
  5917. func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
  5918. return Xstrtoll(tls, s, p, base)
  5919. }
  5920. func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
  5921. return Xstrtoull(tls, s, p, base)
  5922. }
  5923. func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
  5924. var l size_t = Xstrlen(tls, s)
  5925. var d uintptr = Xmalloc(tls, l+size_t(1))
  5926. if !(d != 0) {
  5927. return uintptr(0)
  5928. }
  5929. return Xmemcpy(tls, d, s, l+size_t(1))
  5930. }
  5931. func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
  5932. var p uintptr = Xmemchr(tls, s, 0, n)
  5933. if p != 0 {
  5934. return uint32((int32(p) - int32(s)) / 1)
  5935. }
  5936. return n
  5937. }
  5938. func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
  5939. bp := tls.Alloc(32)
  5940. defer tls.Free(32)
  5941. var a uintptr = s
  5942. *(*[8]size_t)(unsafe.Pointer(bp /* byteset */)) = [8]size_t{0: size_t(0)}
  5943. if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) {
  5944. return size_t(0)
  5945. }
  5946. if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) {
  5947. for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ {
  5948. }
  5949. return size_t((int32(s) - int32(a)) / 1)
  5950. }
  5951. for ; *(*int8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint32(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4, size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; c++ {
  5952. }
  5953. for ; *(*int8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4))&(size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; s++ {
  5954. }
  5955. return size_t((int32(s) - int32(a)) / 1)
  5956. }
  5957. func init() {
  5958. *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_CurrentRuneLocale)) + 0)) = uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) // table.cpp.c:4092:41:
  5959. }
  5960. var ts1 = "RuneMagi\x00NONE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  5961. var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data