musl_freebsd_arm.go 178 KB

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