musl_freebsd_amd64.go 179 KB

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