musl_freebsd_arm.go 183 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960
  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. if __ccgo_strace {
  2865. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2866. }
  2867. return Bool32(func() int32 {
  2868. if 0 != 0 {
  2869. return Xisalpha(tls, c)
  2870. }
  2871. return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
  2872. }() != 0 || func() int32 {
  2873. if 0 != 0 {
  2874. return Xisdigit(tls, c)
  2875. }
  2876. return Bool32(uint32(c)-uint32('0') < uint32(10))
  2877. }() != 0)
  2878. }
  2879. func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
  2880. if __ccgo_strace {
  2881. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2882. }
  2883. return Xisalnum(tls, c)
  2884. }
  2885. func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
  2886. if __ccgo_strace {
  2887. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2888. }
  2889. return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
  2890. }
  2891. func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
  2892. if __ccgo_strace {
  2893. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2894. }
  2895. return Xisalpha(tls, c)
  2896. }
  2897. func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
  2898. if __ccgo_strace {
  2899. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2900. }
  2901. return Bool32(uint32(c)-uint32('0') < uint32(10))
  2902. }
  2903. func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
  2904. if __ccgo_strace {
  2905. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2906. }
  2907. return Xisdigit(tls, c)
  2908. }
  2909. func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
  2910. if __ccgo_strace {
  2911. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2912. }
  2913. return Bool32(uint32(c)-uint32('a') < uint32(26))
  2914. }
  2915. func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
  2916. if __ccgo_strace {
  2917. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2918. }
  2919. return Xislower(tls, c)
  2920. }
  2921. func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
  2922. if __ccgo_strace {
  2923. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2924. }
  2925. return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
  2926. }
  2927. func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
  2928. if __ccgo_strace {
  2929. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2930. }
  2931. return Xisprint(tls, c)
  2932. }
  2933. func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
  2934. if __ccgo_strace {
  2935. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2936. }
  2937. return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
  2938. }
  2939. func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
  2940. if __ccgo_strace {
  2941. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2942. }
  2943. return Xisspace(tls, c)
  2944. }
  2945. func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
  2946. if __ccgo_strace {
  2947. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2948. }
  2949. return Bool32(uint32(c)-uint32('A') < uint32(26))
  2950. }
  2951. func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
  2952. if __ccgo_strace {
  2953. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2954. }
  2955. return Xisupper(tls, c)
  2956. }
  2957. func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
  2958. if __ccgo_strace {
  2959. trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
  2960. }
  2961. return Bool32(func() int32 {
  2962. if 0 != 0 {
  2963. return Xisdigit(tls, c)
  2964. }
  2965. return Bool32(uint32(c)-uint32('0') < uint32(10))
  2966. }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6))
  2967. }
  2968. func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
  2969. if __ccgo_strace {
  2970. trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
  2971. }
  2972. return Xisxdigit(tls, c)
  2973. }
  2974. type uintptr_t = uint32 /* alltypes.h:48:24 */
  2975. type intptr_t = int32 /* alltypes.h:63:15 */
  2976. type int8_t = int8 /* alltypes.h:89:25 */
  2977. type int16_t = int16 /* alltypes.h:94:25 */
  2978. type int32_t = int32 /* alltypes.h:99:25 */
  2979. type int64_t = int64 /* alltypes.h:104:25 */
  2980. type intmax_t = int64 /* alltypes.h:109:25 */
  2981. type uint8_t = uint8 /* alltypes.h:114:25 */
  2982. type uint16_t = uint16 /* alltypes.h:119:25 */
  2983. type uint32_t = uint32 /* alltypes.h:124:25 */
  2984. type uint64_t = uint64 /* alltypes.h:129:25 */
  2985. type uintmax_t = uint64 /* alltypes.h:139:25 */
  2986. type int_fast8_t = int8_t /* stdint.h:22:16 */
  2987. type int_fast64_t = int64_t /* stdint.h:23:17 */
  2988. type int_least8_t = int8_t /* stdint.h:25:17 */
  2989. type int_least16_t = int16_t /* stdint.h:26:17 */
  2990. type int_least32_t = int32_t /* stdint.h:27:17 */
  2991. type int_least64_t = int64_t /* stdint.h:28:17 */
  2992. type uint_fast8_t = uint8_t /* stdint.h:30:17 */
  2993. type uint_fast64_t = uint64_t /* stdint.h:31:18 */
  2994. type uint_least8_t = uint8_t /* stdint.h:33:18 */
  2995. type uint_least16_t = uint16_t /* stdint.h:34:18 */
  2996. type uint_least32_t = uint32_t /* stdint.h:35:18 */
  2997. type uint_least64_t = uint64_t /* stdint.h:36:18 */
  2998. type int_fast16_t = int32_t /* stdint.h:1:17 */
  2999. type int_fast32_t = int32_t /* stdint.h:2:17 */
  3000. type uint_fast16_t = uint32_t /* stdint.h:3:18 */
  3001. type uint_fast32_t = uint32_t /* stdint.h:4:18 */
  3002. type ssize_t = int32 /* alltypes.h:58:15 */
  3003. type off_t = int64 /* alltypes.h:155:16 */
  3004. type _IO_FILE = struct {
  3005. Fflags uint32
  3006. Frpos uintptr
  3007. Frend uintptr
  3008. Fclose uintptr
  3009. Fwend uintptr
  3010. Fwpos uintptr
  3011. Fmustbezero_1 uintptr
  3012. Fwbase uintptr
  3013. Fread uintptr
  3014. Fwrite uintptr
  3015. Fseek uintptr
  3016. Fbuf uintptr
  3017. Fbuf_size size_t
  3018. Fprev uintptr
  3019. Fnext uintptr
  3020. Ffd int32
  3021. Fpipe_pid int32
  3022. Flockcount int32
  3023. Fmode int32
  3024. Flock int32
  3025. Flbf int32
  3026. Fcookie uintptr
  3027. Foff off_t
  3028. Fgetln_buf uintptr
  3029. Fmustbezero_2 uintptr
  3030. Fshend uintptr
  3031. F__ccgo_pad1 [4]byte
  3032. Fshlim off_t
  3033. Fshcnt off_t
  3034. Fprev_locked uintptr
  3035. Fnext_locked uintptr
  3036. Flocale uintptr
  3037. F__ccgo_pad2 [4]byte
  3038. } /* alltypes.h:313:9 */
  3039. type FILE = _IO_FILE /* alltypes.h:313:25 */
  3040. type va_list = uintptr /* alltypes.h:319:27 */
  3041. type _G_fpos64_t = struct {
  3042. F__ccgo_pad1 [0]uint64
  3043. F__opaque [16]uint8
  3044. } /* stdio.h:54:9 */
  3045. type fpos_t = _G_fpos64_t /* stdio.h:58:3 */
  3046. type float_t = float32 /* alltypes.h:23:15 */
  3047. type double_t = float64 /* alltypes.h:28:16 */
  3048. func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */
  3049. bp := tls.Alloc(4)
  3050. defer tls.Free(4)
  3051. // var __u struct {F__f float32;} at bp, 4
  3052. *(*float32)(unsafe.Pointer(bp)) = __f
  3053. return *(*uint32)(unsafe.Pointer(bp))
  3054. }
  3055. func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */
  3056. bp := tls.Alloc(8)
  3057. defer tls.Free(8)
  3058. // var __u struct {F__f float64;} at bp, 8
  3059. *(*float64)(unsafe.Pointer(bp)) = __f
  3060. return *(*uint64)(unsafe.Pointer(bp))
  3061. }
  3062. type syscall_arg_t = int32 /* syscall.h:22:14 */
  3063. func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */
  3064. var c int32
  3065. var x int32
  3066. var y int64
  3067. var neg int32 = 0
  3068. c = func() int32 {
  3069. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3070. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3071. }
  3072. return X__shgetc(tls, f)
  3073. }()
  3074. if c == '+' || c == '-' {
  3075. neg = Bool32(c == '-')
  3076. c = func() int32 {
  3077. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3078. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3079. }
  3080. return X__shgetc(tls, f)
  3081. }()
  3082. if uint32(c-'0') >= 10 && pok != 0 {
  3083. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3084. (*FILE)(unsafe.Pointer(f)).Frpos--
  3085. } else {
  3086. }
  3087. }
  3088. }
  3089. if uint32(c-'0') >= 10 {
  3090. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3091. (*FILE)(unsafe.Pointer(f)).Frpos--
  3092. } else {
  3093. }
  3094. return -0x7fffffffffffffff - int64(1)
  3095. }
  3096. for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 {
  3097. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3098. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3099. }
  3100. return X__shgetc(tls, f)
  3101. }() {
  3102. x = 10*x + c - '0'
  3103. }
  3104. for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 {
  3105. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3106. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3107. }
  3108. return X__shgetc(tls, f)
  3109. }() {
  3110. y = int64(10)*y + int64(c) - int64('0')
  3111. }
  3112. for ; uint32(c-'0') < 10; c = func() int32 {
  3113. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3114. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3115. }
  3116. return X__shgetc(tls, f)
  3117. }() {
  3118. }
  3119. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3120. (*FILE)(unsafe.Pointer(f)).Frpos--
  3121. } else {
  3122. }
  3123. if neg != 0 {
  3124. return -y
  3125. }
  3126. return y
  3127. }
  3128. func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */
  3129. bp := tls.Alloc(512)
  3130. defer tls.Free(512)
  3131. // var x [128]uint32_t at bp, 512
  3132. var i int32
  3133. var j int32
  3134. var k int32
  3135. var a int32
  3136. var z int32
  3137. var lrp int64 = int64(0)
  3138. var dc int64 = int64(0)
  3139. var e10 int64 = int64(0)
  3140. var lnz int32 = 0
  3141. var gotdig int32 = 0
  3142. var gotrad int32 = 0
  3143. var rp int32
  3144. var e2 int32
  3145. var emax int32 = -emin - bits + 3
  3146. var denormal int32 = 0
  3147. var y float64
  3148. var frac float64 = float64(0)
  3149. var bias float64 = float64(0)
  3150. j = 0
  3151. k = 0
  3152. // Don't let leading zeros consume buffer space
  3153. for ; c == '0'; c = func() int32 {
  3154. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3155. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3156. }
  3157. return X__shgetc(tls, f)
  3158. }() {
  3159. gotdig = 1
  3160. }
  3161. if c == '.' {
  3162. gotrad = 1
  3163. for c = func() int32 {
  3164. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3165. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3166. }
  3167. return X__shgetc(tls, f)
  3168. }(); c == '0'; c = func() int32 {
  3169. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3170. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3171. }
  3172. return X__shgetc(tls, f)
  3173. }() {
  3174. gotdig = 1
  3175. lrp--
  3176. }
  3177. }
  3178. *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0)
  3179. for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 {
  3180. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3181. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3182. }
  3183. return X__shgetc(tls, f)
  3184. }() {
  3185. if c == '.' {
  3186. if gotrad != 0 {
  3187. break
  3188. }
  3189. gotrad = 1
  3190. lrp = dc
  3191. } else if k < 128-3 {
  3192. dc++
  3193. if c != '0' {
  3194. lnz = int32(dc)
  3195. }
  3196. if j != 0 {
  3197. *(*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')
  3198. } else {
  3199. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0')
  3200. }
  3201. if PreIncInt32(&j, 1) == 9 {
  3202. k++
  3203. j = 0
  3204. }
  3205. gotdig = 1
  3206. } else {
  3207. dc++
  3208. if c != '0' {
  3209. lnz = (128 - 4) * 9
  3210. *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1)
  3211. }
  3212. }
  3213. }
  3214. if !(gotrad != 0) {
  3215. lrp = dc
  3216. }
  3217. if gotdig != 0 && c|32 == 'e' {
  3218. e10 = scanexp(tls, f, pok)
  3219. if e10 == -0x7fffffffffffffff-int64(1) {
  3220. if pok != 0 {
  3221. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3222. (*FILE)(unsafe.Pointer(f)).Frpos--
  3223. } else {
  3224. }
  3225. } else {
  3226. X__shlim(tls, f, int64(0))
  3227. return float64(0)
  3228. }
  3229. e10 = int64(0)
  3230. }
  3231. lrp = lrp + e10
  3232. } else if c >= 0 {
  3233. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3234. (*FILE)(unsafe.Pointer(f)).Frpos--
  3235. } else {
  3236. }
  3237. }
  3238. if !(gotdig != 0) {
  3239. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3240. X__shlim(tls, f, int64(0))
  3241. return float64(0)
  3242. }
  3243. // Handle zero specially to avoid nasty special cases later
  3244. if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) {
  3245. return float64(sign) * 0.0
  3246. }
  3247. // Optimize small integers (w/no exponent) and over/under-flow
  3248. if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) {
  3249. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
  3250. }
  3251. if lrp > int64(-emin/2) {
  3252. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3253. return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
  3254. }
  3255. if lrp < int64(emin-2*53) {
  3256. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3257. return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
  3258. }
  3259. // Align incomplete final B1B digit
  3260. if j != 0 {
  3261. for ; j < 9; j++ {
  3262. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10)
  3263. }
  3264. k++
  3265. j = 0
  3266. }
  3267. a = 0
  3268. z = k
  3269. e2 = 0
  3270. rp = int32(lrp)
  3271. // Optimize small to mid-size integers (even in exp. notation)
  3272. if lnz < 9 && lnz <= rp && rp < 18 {
  3273. if rp == 9 {
  3274. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
  3275. }
  3276. if rp < 9 {
  3277. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp])
  3278. }
  3279. var bitlim int32 = bits - 3*(rp-9)
  3280. if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) {
  3281. return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10])
  3282. }
  3283. }
  3284. // Drop trailing zeros
  3285. for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- {
  3286. }
  3287. // Align radix point to B1B digit boundary
  3288. if rp%9 != 0 {
  3289. var rpm9 int32
  3290. if rp >= 0 {
  3291. rpm9 = rp % 9
  3292. } else {
  3293. rpm9 = rp%9 + 9
  3294. }
  3295. var p10 int32 = _sp10s[8-rpm9]
  3296. var carry uint32_t = uint32_t(0)
  3297. for k = a; k != z; k++ {
  3298. var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10)
  3299. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry
  3300. carry = uint32_t(1000000000/p10) * tmp
  3301. if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  3302. a = (a + 1) & (128 - 1)
  3303. rp = rp - 9
  3304. }
  3305. }
  3306. if carry != 0 {
  3307. *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry
  3308. }
  3309. rp = rp + (9 - rpm9)
  3310. }
  3311. // Upscale until desired number of bits are left of radix point
  3312. for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] {
  3313. var carry uint32_t = uint32_t(0)
  3314. e2 = e2 - 29
  3315. for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) {
  3316. var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry)
  3317. if tmp > uint64(1000000000) {
  3318. carry = uint32_t(tmp / uint64(1000000000))
  3319. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000))
  3320. } else {
  3321. carry = uint32_t(0)
  3322. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp)
  3323. }
  3324. if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  3325. z = k
  3326. }
  3327. if k == a {
  3328. break
  3329. }
  3330. }
  3331. if carry != 0 {
  3332. rp = rp + 9
  3333. a = (a - 1) & (128 - 1)
  3334. if a == z {
  3335. z = (z - 1) & (128 - 1)
  3336. *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4))
  3337. }
  3338. *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry
  3339. }
  3340. }
  3341. // Downscale until exactly number of bits are left of radix point
  3342. for {
  3343. var carry uint32_t = uint32_t(0)
  3344. var sh int32 = 1
  3345. for i = 0; i < 2; i++ {
  3346. k = (a + i) & (128 - 1)
  3347. if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] {
  3348. i = 2
  3349. break
  3350. }
  3351. if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] {
  3352. break
  3353. }
  3354. }
  3355. if i == 2 && rp == 9*2 {
  3356. break
  3357. }
  3358. // FIXME: find a way to compute optimal sh
  3359. if rp > 9+9*2 {
  3360. sh = 9
  3361. }
  3362. e2 = e2 + sh
  3363. for k = a; k != z; k = (k + 1) & (128 - 1) {
  3364. var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1)
  3365. *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry
  3366. carry = uint32_t(int32(1000000000)>>sh) * tmp
  3367. if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
  3368. a = (a + 1) & (128 - 1)
  3369. i--
  3370. rp = rp - 9
  3371. }
  3372. }
  3373. if carry != 0 {
  3374. if (z+1)&(128-1) != a {
  3375. *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry
  3376. z = (z + 1) & (128 - 1)
  3377. } else {
  3378. *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1)
  3379. }
  3380. }
  3381. }
  3382. // Assemble desired bits into floating point variable
  3383. for y = float64(AssignInt32(&i, 0)); i < 2; i++ {
  3384. if (a+i)&(128-1) == z {
  3385. *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0)
  3386. }
  3387. y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)))
  3388. }
  3389. y = y * float64(sign)
  3390. // Limit precision for denormal results
  3391. if bits > 53+e2-emin {
  3392. bits = 53 + e2 - emin
  3393. if bits < 0 {
  3394. bits = 0
  3395. }
  3396. denormal = 1
  3397. }
  3398. // Calculate bias term to force rounding, move out lower bits
  3399. if bits < 53 {
  3400. bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y)
  3401. frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits))
  3402. y = y - frac
  3403. y = y + bias
  3404. }
  3405. // Process tail of decimal input so it can affect rounding
  3406. if (a+i)&(128-1) != z {
  3407. var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))
  3408. if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) {
  3409. frac = frac + 0.25*float64(sign)
  3410. } else if t > uint32_t(500000000) {
  3411. frac = frac + 0.75*float64(sign)
  3412. } else if t == uint32_t(500000000) {
  3413. if (a+i+1)&(128-1) == z {
  3414. frac = frac + 0.5*float64(sign)
  3415. } else {
  3416. frac = frac + 0.75*float64(sign)
  3417. }
  3418. }
  3419. if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) {
  3420. frac += 1
  3421. }
  3422. }
  3423. y = y + frac
  3424. y = y - bias
  3425. if (e2+53)&0x7fffffff > emax-5 {
  3426. if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 {
  3427. if denormal != 0 && bits == 53+e2-emin {
  3428. denormal = 0
  3429. }
  3430. y = y * 0.5
  3431. e2++
  3432. }
  3433. if e2+53 > emax || denormal != 0 && frac != 0 {
  3434. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3435. }
  3436. }
  3437. return Xscalbnl(tls, y, e2)
  3438. }
  3439. var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */
  3440. var _sp10s = [8]int32{10, 100, 1000, 10000,
  3441. 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */
  3442. func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */
  3443. var x uint32_t = uint32_t(0)
  3444. var y float64 = float64(0)
  3445. var scale float64 = float64(1)
  3446. var bias float64 = float64(0)
  3447. var gottail int32 = 0
  3448. var gotrad int32 = 0
  3449. var gotdig int32 = 0
  3450. var rp int64 = int64(0)
  3451. var dc int64 = int64(0)
  3452. var e2 int64 = int64(0)
  3453. var d int32
  3454. var c int32
  3455. c = func() int32 {
  3456. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3457. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3458. }
  3459. return X__shgetc(tls, f)
  3460. }()
  3461. // Skip leading zeros
  3462. for ; c == '0'; c = func() int32 {
  3463. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3464. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3465. }
  3466. return X__shgetc(tls, f)
  3467. }() {
  3468. gotdig = 1
  3469. }
  3470. if c == '.' {
  3471. gotrad = 1
  3472. c = func() int32 {
  3473. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3474. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3475. }
  3476. return X__shgetc(tls, f)
  3477. }()
  3478. // Count zeros after the radix point before significand
  3479. rp = int64(0)
  3480. __1:
  3481. if !(c == '0') {
  3482. goto __3
  3483. }
  3484. gotdig = 1
  3485. goto __2
  3486. __2:
  3487. c = func() int32 {
  3488. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3489. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3490. }
  3491. return X__shgetc(tls, f)
  3492. }()
  3493. rp--
  3494. goto __1
  3495. goto __3
  3496. __3:
  3497. }
  3498. for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 {
  3499. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3500. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3501. }
  3502. return X__shgetc(tls, f)
  3503. }() {
  3504. if c == '.' {
  3505. if gotrad != 0 {
  3506. break
  3507. }
  3508. rp = dc
  3509. gotrad = 1
  3510. } else {
  3511. gotdig = 1
  3512. if c > '9' {
  3513. d = c | 32 + 10 - 'a'
  3514. } else {
  3515. d = c - '0'
  3516. }
  3517. if dc < int64(8) {
  3518. x = x*uint32_t(16) + uint32_t(d)
  3519. } else if dc < int64(53/4+1) {
  3520. y = y + float64(d)*AssignDivFloat64(&scale, float64(16))
  3521. } else if d != 0 && !(gottail != 0) {
  3522. y = y + 0.5*scale
  3523. gottail = 1
  3524. }
  3525. dc++
  3526. }
  3527. }
  3528. if !(gotdig != 0) {
  3529. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3530. (*FILE)(unsafe.Pointer(f)).Frpos--
  3531. } else {
  3532. }
  3533. if pok != 0 {
  3534. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3535. (*FILE)(unsafe.Pointer(f)).Frpos--
  3536. } else {
  3537. }
  3538. if gotrad != 0 {
  3539. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3540. (*FILE)(unsafe.Pointer(f)).Frpos--
  3541. } else {
  3542. }
  3543. }
  3544. } else {
  3545. X__shlim(tls, f, int64(0))
  3546. }
  3547. return float64(sign) * 0.0
  3548. }
  3549. if !(gotrad != 0) {
  3550. rp = dc
  3551. }
  3552. for dc < int64(8) {
  3553. x = x * uint32_t(16)
  3554. dc++
  3555. }
  3556. if c|32 == 'p' {
  3557. e2 = scanexp(tls, f, pok)
  3558. if e2 == -0x7fffffffffffffff-int64(1) {
  3559. if pok != 0 {
  3560. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3561. (*FILE)(unsafe.Pointer(f)).Frpos--
  3562. } else {
  3563. }
  3564. } else {
  3565. X__shlim(tls, f, int64(0))
  3566. return float64(0)
  3567. }
  3568. e2 = int64(0)
  3569. }
  3570. } else {
  3571. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3572. (*FILE)(unsafe.Pointer(f)).Frpos--
  3573. } else {
  3574. }
  3575. }
  3576. e2 = e2 + (int64(4)*rp - int64(32))
  3577. if !(x != 0) {
  3578. return float64(sign) * 0.0
  3579. }
  3580. if e2 > int64(-emin) {
  3581. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3582. return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
  3583. }
  3584. if e2 < int64(emin-2*53) {
  3585. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3586. return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
  3587. }
  3588. for x < 0x80000000 {
  3589. if y >= 0.5 {
  3590. x = x + (x + uint32_t(1))
  3591. y = y + (y - float64(1))
  3592. } else {
  3593. x = x + x
  3594. y = y + y
  3595. }
  3596. e2--
  3597. }
  3598. if int64(bits) > int64(32)+e2-int64(emin) {
  3599. bits = int32(int64(32) + e2 - int64(emin))
  3600. if bits < 0 {
  3601. bits = 0
  3602. }
  3603. }
  3604. if bits < 53 {
  3605. bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign))
  3606. }
  3607. if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) {
  3608. x++
  3609. y = float64(0)
  3610. }
  3611. y = bias + float64(sign)*float64(x) + float64(sign)*y
  3612. y = y - bias
  3613. if !(y != 0) {
  3614. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  3615. }
  3616. return Xscalbnl(tls, y, int32(e2))
  3617. }
  3618. func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
  3619. if __ccgo_strace {
  3620. trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
  3621. }
  3622. var sign int32 = 1
  3623. var i size_t
  3624. var bits int32
  3625. var emin int32
  3626. var c int32
  3627. switch prec {
  3628. case 0:
  3629. bits = 24
  3630. emin = -125 - bits
  3631. break
  3632. case 1:
  3633. bits = 53
  3634. emin = -1021 - bits
  3635. break
  3636. case 2:
  3637. bits = 53
  3638. emin = -1021 - bits
  3639. break
  3640. default:
  3641. return float64(0)
  3642. }
  3643. for __isspace(tls, AssignInt32(&c, func() int32 {
  3644. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3645. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3646. }
  3647. return X__shgetc(tls, f)
  3648. }())) != 0 {
  3649. }
  3650. if c == '+' || c == '-' {
  3651. sign = sign - 2*Bool32(c == '-')
  3652. c = func() int32 {
  3653. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3654. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3655. }
  3656. return X__shgetc(tls, f)
  3657. }()
  3658. }
  3659. for i = size_t(0); i < size_t(8) && c|32 == int32(*(*uint8)(unsafe.Pointer(ts + 41 /* "infinity" */ + uintptr(i)))); i++ {
  3660. if i < size_t(7) {
  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. }
  3668. }
  3669. if i == size_t(3) || i == size_t(8) || i > size_t(3) && pok != 0 {
  3670. if i != size_t(8) {
  3671. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3672. (*FILE)(unsafe.Pointer(f)).Frpos--
  3673. } else {
  3674. }
  3675. if pok != 0 {
  3676. for ; i > size_t(3); i-- {
  3677. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3678. (*FILE)(unsafe.Pointer(f)).Frpos--
  3679. } else {
  3680. }
  3681. }
  3682. }
  3683. }
  3684. return float64(float32(sign) * X__builtin_inff(tls))
  3685. }
  3686. if !(i != 0) {
  3687. for i = size_t(0); i < size_t(3) && c|32 == int32(*(*uint8)(unsafe.Pointer(ts + 50 /* "nan" */ + uintptr(i)))); i++ {
  3688. if i < size_t(2) {
  3689. c = func() int32 {
  3690. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3691. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3692. }
  3693. return X__shgetc(tls, f)
  3694. }()
  3695. }
  3696. }
  3697. }
  3698. if i == size_t(3) {
  3699. if func() int32 {
  3700. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3701. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3702. }
  3703. return X__shgetc(tls, f)
  3704. }() != '(' {
  3705. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3706. (*FILE)(unsafe.Pointer(f)).Frpos--
  3707. } else {
  3708. }
  3709. return float64(X__builtin_nanf(tls, ts+54))
  3710. }
  3711. for i = size_t(1); ; i++ {
  3712. c = func() int32 {
  3713. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3714. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3715. }
  3716. return X__shgetc(tls, f)
  3717. }()
  3718. if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' {
  3719. continue
  3720. }
  3721. if c == ')' {
  3722. return float64(X__builtin_nanf(tls, ts+54))
  3723. }
  3724. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3725. (*FILE)(unsafe.Pointer(f)).Frpos--
  3726. } else {
  3727. }
  3728. if !(pok != 0) {
  3729. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3730. X__shlim(tls, f, int64(0))
  3731. return float64(0)
  3732. }
  3733. for PostDecUint32(&i, 1) != 0 {
  3734. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3735. (*FILE)(unsafe.Pointer(f)).Frpos--
  3736. } else {
  3737. }
  3738. }
  3739. return float64(X__builtin_nanf(tls, ts+54))
  3740. }
  3741. return float64(X__builtin_nanf(tls, ts+54))
  3742. }
  3743. if i != 0 {
  3744. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3745. (*FILE)(unsafe.Pointer(f)).Frpos--
  3746. } else {
  3747. }
  3748. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3749. X__shlim(tls, f, int64(0))
  3750. return float64(0)
  3751. }
  3752. if c == '0' {
  3753. c = func() int32 {
  3754. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3755. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3756. }
  3757. return X__shgetc(tls, f)
  3758. }()
  3759. if c|32 == 'x' {
  3760. return hexfloat(tls, f, bits, emin, sign, pok)
  3761. }
  3762. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3763. (*FILE)(unsafe.Pointer(f)).Frpos--
  3764. } else {
  3765. }
  3766. c = '0'
  3767. }
  3768. return decfloat(tls, f, c, bits, emin, sign, pok)
  3769. }
  3770. // Lookup table for digit values. -1==255>=36 -> invalid
  3771. var table = [257]uint8{Uint8FromInt32(-1),
  3772. 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),
  3773. 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),
  3774. 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),
  3775. 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),
  3776. 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),
  3777. 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),
  3778. 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),
  3779. 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),
  3780. 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),
  3781. 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),
  3782. 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),
  3783. 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),
  3784. 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),
  3785. 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),
  3786. 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),
  3787. 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),
  3788. } /* intscan.c:7:28 */
  3789. func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
  3790. if __ccgo_strace {
  3791. trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
  3792. }
  3793. var val uintptr
  3794. var c int32
  3795. var neg int32
  3796. var x uint32
  3797. var y uint64
  3798. var bs int32
  3799. val = uintptr(unsafe.Pointer(&table)) + uintptr(1)
  3800. neg = 0
  3801. if !(base > uint32(36) || base == uint32(1)) {
  3802. goto __1
  3803. }
  3804. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3805. return uint64(0)
  3806. __1:
  3807. ;
  3808. __2:
  3809. if !(__isspace(tls, AssignInt32(&c, func() int32 {
  3810. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3811. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3812. }
  3813. return X__shgetc(tls, f)
  3814. }())) != 0) {
  3815. goto __3
  3816. }
  3817. goto __2
  3818. __3:
  3819. ;
  3820. if !(c == '+' || c == '-') {
  3821. goto __4
  3822. }
  3823. neg = -Bool32(c == '-')
  3824. c = func() int32 {
  3825. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3826. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3827. }
  3828. return X__shgetc(tls, f)
  3829. }()
  3830. __4:
  3831. ;
  3832. if !((base == uint32(0) || base == uint32(16)) && c == '0') {
  3833. goto __5
  3834. }
  3835. c = func() int32 {
  3836. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3837. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3838. }
  3839. return X__shgetc(tls, f)
  3840. }()
  3841. if !(c|32 == 'x') {
  3842. goto __7
  3843. }
  3844. c = func() int32 {
  3845. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3846. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3847. }
  3848. return X__shgetc(tls, f)
  3849. }()
  3850. if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) {
  3851. goto __9
  3852. }
  3853. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3854. (*FILE)(unsafe.Pointer(f)).Frpos--
  3855. } else {
  3856. }
  3857. if !(pok != 0) {
  3858. goto __10
  3859. }
  3860. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3861. (*FILE)(unsafe.Pointer(f)).Frpos--
  3862. } else {
  3863. }
  3864. goto __11
  3865. __10:
  3866. X__shlim(tls, f, int64(0))
  3867. __11:
  3868. ;
  3869. return uint64(0)
  3870. __9:
  3871. ;
  3872. base = uint32(16)
  3873. goto __8
  3874. __7:
  3875. if !(base == uint32(0)) {
  3876. goto __12
  3877. }
  3878. base = uint32(8)
  3879. __12:
  3880. ;
  3881. __8:
  3882. ;
  3883. goto __6
  3884. __5:
  3885. if !(base == uint32(0)) {
  3886. goto __13
  3887. }
  3888. base = uint32(10)
  3889. __13:
  3890. ;
  3891. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) {
  3892. goto __14
  3893. }
  3894. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  3895. (*FILE)(unsafe.Pointer(f)).Frpos--
  3896. } else {
  3897. }
  3898. X__shlim(tls, f, int64(0))
  3899. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
  3900. return uint64(0)
  3901. __14:
  3902. ;
  3903. __6:
  3904. ;
  3905. if !(base == uint32(10)) {
  3906. goto __15
  3907. }
  3908. x = uint32(0)
  3909. __17:
  3910. if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) {
  3911. goto __19
  3912. }
  3913. x = x*uint32(10) + uint32(c-'0')
  3914. goto __18
  3915. __18:
  3916. c = func() int32 {
  3917. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3918. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3919. }
  3920. return X__shgetc(tls, f)
  3921. }()
  3922. goto __17
  3923. goto __19
  3924. __19:
  3925. ;
  3926. y = uint64(x)
  3927. __20:
  3928. if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) {
  3929. goto __22
  3930. }
  3931. y = y*uint64(10) + uint64(c-'0')
  3932. goto __21
  3933. __21:
  3934. c = func() int32 {
  3935. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3936. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3937. }
  3938. return X__shgetc(tls, f)
  3939. }()
  3940. goto __20
  3941. goto __22
  3942. __22:
  3943. ;
  3944. if !(uint32(c-'0') >= 10) {
  3945. goto __23
  3946. }
  3947. goto done
  3948. __23:
  3949. ;
  3950. goto __16
  3951. __15:
  3952. if !!(base&(base-uint32(1)) != 0) {
  3953. goto __24
  3954. }
  3955. bs = int32(*(*uint8)(unsafe.Pointer(ts + 55 + uintptr(uint32(0x17)*base>>5&uint32(7)))))
  3956. x = uint32(0)
  3957. __26:
  3958. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) {
  3959. goto __28
  3960. }
  3961. x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  3962. goto __27
  3963. __27:
  3964. c = func() int32 {
  3965. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3966. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3967. }
  3968. return X__shgetc(tls, f)
  3969. }()
  3970. goto __26
  3971. goto __28
  3972. __28:
  3973. ;
  3974. y = uint64(x)
  3975. __29:
  3976. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) {
  3977. goto __31
  3978. }
  3979. y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  3980. goto __30
  3981. __30:
  3982. c = func() int32 {
  3983. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  3984. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  3985. }
  3986. return X__shgetc(tls, f)
  3987. }()
  3988. goto __29
  3989. goto __31
  3990. __31:
  3991. ;
  3992. goto __25
  3993. __24:
  3994. x = uint32(0)
  3995. __32:
  3996. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) {
  3997. goto __34
  3998. }
  3999. x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  4000. goto __33
  4001. __33:
  4002. c = func() int32 {
  4003. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  4004. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  4005. }
  4006. return X__shgetc(tls, f)
  4007. }()
  4008. goto __32
  4009. goto __34
  4010. __34:
  4011. ;
  4012. y = uint64(x)
  4013. __35:
  4014. 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))))) {
  4015. goto __37
  4016. }
  4017. y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
  4018. goto __36
  4019. __36:
  4020. c = func() int32 {
  4021. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  4022. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  4023. }
  4024. return X__shgetc(tls, f)
  4025. }()
  4026. goto __35
  4027. goto __37
  4028. __37:
  4029. ;
  4030. __25:
  4031. ;
  4032. __16:
  4033. ;
  4034. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
  4035. goto __38
  4036. }
  4037. __39:
  4038. if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
  4039. goto __41
  4040. }
  4041. goto __40
  4042. __40:
  4043. c = func() int32 {
  4044. if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
  4045. return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
  4046. }
  4047. return X__shgetc(tls, f)
  4048. }()
  4049. goto __39
  4050. goto __41
  4051. __41:
  4052. ;
  4053. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  4054. y = lim
  4055. if !(lim&uint64(1) != 0) {
  4056. goto __42
  4057. }
  4058. neg = 0
  4059. __42:
  4060. ;
  4061. __38:
  4062. ;
  4063. done:
  4064. if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
  4065. (*FILE)(unsafe.Pointer(f)).Frpos--
  4066. } else {
  4067. }
  4068. if !(y >= lim) {
  4069. goto __43
  4070. }
  4071. if !(!(lim&uint64(1) != 0) && !(neg != 0)) {
  4072. goto __44
  4073. }
  4074. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  4075. return lim - uint64(1)
  4076. goto __45
  4077. __44:
  4078. if !(y > lim) {
  4079. goto __46
  4080. }
  4081. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
  4082. return lim
  4083. __46:
  4084. ;
  4085. __45:
  4086. ;
  4087. __43:
  4088. ;
  4089. return y ^ uint64(neg) - uint64(neg)
  4090. }
  4091. // The shcnt field stores the number of bytes read so far, offset by
  4092. // the value of buf-rpos at the last function call (__shlim or __shgetc),
  4093. // so that between calls the inline shcnt macro can add rpos-buf to get
  4094. // the actual count.
  4095. func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
  4096. if __ccgo_strace {
  4097. trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
  4098. }
  4099. (*FILE)(unsafe.Pointer(f)).Fshlim = lim
  4100. (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf) - int32((*FILE)(unsafe.Pointer(f)).Frpos)) / 1)
  4101. // If lim is nonzero, rend must be a valid pointer.
  4102. if lim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).Frend)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) > lim {
  4103. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr(lim)
  4104. } else {
  4105. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
  4106. }
  4107. }
  4108. func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
  4109. if __ccgo_strace {
  4110. trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
  4111. }
  4112. var c int32
  4113. var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).Frpos)-int32((*FILE)(unsafe.Pointer(f)).Fbuf))/1)
  4114. if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
  4115. (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) + cnt
  4116. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos
  4117. (*FILE)(unsafe.Pointer(f)).Fshlim = int64(-1)
  4118. return -1
  4119. }
  4120. cnt++
  4121. 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 {
  4122. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr((*FILE)(unsafe.Pointer(f)).Fshlim-cnt)
  4123. } else {
  4124. (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
  4125. }
  4126. (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) + cnt
  4127. if (*FILE)(unsafe.Pointer(f)).Frpos <= (*FILE)(unsafe.Pointer(f)).Fbuf {
  4128. *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).Frpos + UintptrFromInt32(-1))) = uint8(c)
  4129. }
  4130. return c
  4131. }
  4132. func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
  4133. return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24
  4134. }
  4135. func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
  4136. if __ccgo_strace {
  4137. trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
  4138. }
  4139. return Xcopysign(tls, x, y)
  4140. }
  4141. func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
  4142. if __ccgo_strace {
  4143. trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
  4144. }
  4145. return Xfabs(tls, x)
  4146. }
  4147. func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
  4148. if __ccgo_strace {
  4149. trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
  4150. }
  4151. return Xfmod(tls, x, y)
  4152. }
  4153. var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
  4154. func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
  4155. if __ccgo_strace {
  4156. trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
  4157. }
  4158. bp := tls.Alloc(8)
  4159. defer tls.Free(8)
  4160. *(*struct{ Ff float64 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float64 }) {
  4161. *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
  4162. return r
  4163. }()
  4164. var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
  4165. var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63)
  4166. var y double_t
  4167. if e >= 0x3ff+52 {
  4168. return x
  4169. }
  4170. if s != 0 {
  4171. y = x - toint + toint
  4172. } else {
  4173. y = x + toint - toint
  4174. }
  4175. if y == float64(0) {
  4176. if s != 0 {
  4177. return -Float64FromFloat64(0.0)
  4178. }
  4179. return float64(0)
  4180. }
  4181. return y
  4182. }
  4183. func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
  4184. if __ccgo_strace {
  4185. trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
  4186. }
  4187. bp := tls.Alloc(8)
  4188. defer tls.Free(8)
  4189. // var u struct {Ff float64;} at bp, 8
  4190. var y double_t = x
  4191. if n > 1023 {
  4192. y = y * 0x1p1023
  4193. n = n - 1023
  4194. if n > 1023 {
  4195. y = y * 0x1p1023
  4196. n = n - 1023
  4197. if n > 1023 {
  4198. n = 1023
  4199. }
  4200. }
  4201. } else if n < -1022 {
  4202. // make sure final n < -53 to avoid double
  4203. // rounding in the subnormal range
  4204. y = y * (float64(0x1p-1022) * 0x1p53)
  4205. n = n + (1022 - 53)
  4206. if n < -1022 {
  4207. y = y * (float64(0x1p-1022) * 0x1p53)
  4208. n = n + (1022 - 53)
  4209. if n < -1022 {
  4210. n = -1022
  4211. }
  4212. }
  4213. }
  4214. *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52
  4215. x = y * *(*float64)(unsafe.Pointer(bp))
  4216. return x
  4217. }
  4218. func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
  4219. if __ccgo_strace {
  4220. trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
  4221. }
  4222. return Xscalbn(tls, x, n)
  4223. }
  4224. type div_t = struct {
  4225. Fquot int32
  4226. Frem int32
  4227. } /* stdlib.h:62:35 */
  4228. type ldiv_t = struct {
  4229. Fquot int32
  4230. Frem int32
  4231. } /* stdlib.h:63:36 */
  4232. type lldiv_t = struct {
  4233. Fquot int64
  4234. Frem int64
  4235. } /* stdlib.h:64:41 */
  4236. type max_align_t = struct {
  4237. F__ll int64
  4238. F__ld float64
  4239. } /* alltypes.h:34:54 */
  4240. type imaxdiv_t = struct {
  4241. Fquot intmax_t
  4242. Frem intmax_t
  4243. } /* inttypes.h:14:40 */
  4244. type pid_t = int32 /* alltypes.h:228:13 */
  4245. type uid_t = uint32 /* alltypes.h:238:18 */
  4246. type gid_t = uint32 /* alltypes.h:243:18 */
  4247. type iovec = struct {
  4248. Fiov_base uintptr
  4249. Fiov_len size_t
  4250. } /* alltypes.h:348:1 */
  4251. type socklen_t = uint32 /* alltypes.h:354:18 */
  4252. type sa_family_t = uint16 /* alltypes.h:359:24 */
  4253. type msghdr = struct {
  4254. Fmsg_name uintptr
  4255. Fmsg_namelen socklen_t
  4256. Fmsg_iov uintptr
  4257. Fmsg_iovlen int32
  4258. Fmsg_control uintptr
  4259. Fmsg_controllen socklen_t
  4260. Fmsg_flags int32
  4261. } /* socket.h:22:1 */
  4262. type cmsghdr = struct {
  4263. Fcmsg_len socklen_t
  4264. Fcmsg_level int32
  4265. Fcmsg_type int32
  4266. } /* socket.h:44:1 */
  4267. type linger = struct {
  4268. Fl_onoff int32
  4269. Fl_linger int32
  4270. } /* socket.h:74:1 */
  4271. type sockaddr = struct {
  4272. Fsa_family sa_family_t
  4273. Fsa_data [14]uint8
  4274. } /* socket.h:367:1 */
  4275. type sockaddr_storage = struct {
  4276. Fss_family sa_family_t
  4277. F__ss_padding [122]uint8
  4278. F__ss_align uint32
  4279. } /* socket.h:372:1 */
  4280. type in_port_t = uint16_t /* in.h:12:18 */
  4281. type in_addr_t = uint32_t /* in.h:13:18 */
  4282. type in_addr = struct{ Fs_addr in_addr_t } /* in.h:14:1 */
  4283. type sockaddr_in = struct {
  4284. Fsin_family sa_family_t
  4285. Fsin_port in_port_t
  4286. Fsin_addr struct{ Fs_addr in_addr_t }
  4287. Fsin_zero [8]uint8_t
  4288. } /* in.h:16:1 */
  4289. type in6_addr = struct {
  4290. F__in6_union struct {
  4291. F__ccgo_pad1 [0]uint32
  4292. F__s6_addr [16]uint8_t
  4293. }
  4294. } /* in.h:23:1 */
  4295. type sockaddr_in6 = struct {
  4296. Fsin6_family sa_family_t
  4297. Fsin6_port in_port_t
  4298. Fsin6_flowinfo uint32_t
  4299. Fsin6_addr struct {
  4300. F__in6_union struct {
  4301. F__ccgo_pad1 [0]uint32
  4302. F__s6_addr [16]uint8_t
  4303. }
  4304. }
  4305. Fsin6_scope_id uint32_t
  4306. } /* in.h:34:1 */
  4307. type ipv6_mreq = struct {
  4308. Fipv6mr_multiaddr struct {
  4309. F__in6_union struct {
  4310. F__ccgo_pad1 [0]uint32
  4311. F__s6_addr [16]uint8_t
  4312. }
  4313. }
  4314. Fipv6mr_interface uint32
  4315. } /* in.h:42:1 */
  4316. type ip_opts = struct {
  4317. Fip_dst struct{ Fs_addr in_addr_t }
  4318. Fip_opts [40]uint8
  4319. } /* in.h:229:1 */
  4320. type ip_mreq = struct {
  4321. Fimr_multiaddr struct{ Fs_addr in_addr_t }
  4322. Fimr_interface struct{ Fs_addr in_addr_t }
  4323. } /* in.h:247:1 */
  4324. type ip_mreqn = struct {
  4325. Fimr_multiaddr struct{ Fs_addr in_addr_t }
  4326. Fimr_address struct{ Fs_addr in_addr_t }
  4327. Fimr_ifindex int32
  4328. } /* in.h:252:1 */
  4329. type ip_mreq_source = struct {
  4330. Fimr_multiaddr struct{ Fs_addr in_addr_t }
  4331. Fimr_interface struct{ Fs_addr in_addr_t }
  4332. Fimr_sourceaddr struct{ Fs_addr in_addr_t }
  4333. } /* in.h:258:1 */
  4334. type ip_msfilter = struct {
  4335. Fimsf_multiaddr struct{ Fs_addr in_addr_t }
  4336. Fimsf_interface struct{ Fs_addr in_addr_t }
  4337. Fimsf_fmode uint32_t
  4338. Fimsf_numsrc uint32_t
  4339. Fimsf_slist [1]struct{ Fs_addr in_addr_t }
  4340. } /* in.h:264:1 */
  4341. type group_req = struct {
  4342. Fgr_interface uint32_t
  4343. Fgr_group struct {
  4344. Fss_family sa_family_t
  4345. F__ss_padding [122]uint8
  4346. F__ss_align uint32
  4347. }
  4348. } /* in.h:275:1 */
  4349. type group_source_req = struct {
  4350. Fgsr_interface uint32_t
  4351. Fgsr_group struct {
  4352. Fss_family sa_family_t
  4353. F__ss_padding [122]uint8
  4354. F__ss_align uint32
  4355. }
  4356. Fgsr_source struct {
  4357. Fss_family sa_family_t
  4358. F__ss_padding [122]uint8
  4359. F__ss_align uint32
  4360. }
  4361. } /* in.h:280:1 */
  4362. type group_filter = struct {
  4363. Fgf_interface uint32_t
  4364. Fgf_group struct {
  4365. Fss_family sa_family_t
  4366. F__ss_padding [122]uint8
  4367. F__ss_align uint32
  4368. }
  4369. Fgf_fmode uint32_t
  4370. Fgf_numsrc uint32_t
  4371. Fgf_slist [1]struct {
  4372. Fss_family sa_family_t
  4373. F__ss_padding [122]uint8
  4374. F__ss_align uint32
  4375. }
  4376. } /* in.h:286:1 */
  4377. type in_pktinfo = struct {
  4378. Fipi_ifindex int32
  4379. Fipi_spec_dst struct{ Fs_addr in_addr_t }
  4380. Fipi_addr struct{ Fs_addr in_addr_t }
  4381. } /* in.h:297:1 */
  4382. type in6_pktinfo = struct {
  4383. Fipi6_addr struct {
  4384. F__in6_union struct {
  4385. F__ccgo_pad1 [0]uint32
  4386. F__s6_addr [16]uint8_t
  4387. }
  4388. }
  4389. Fipi6_ifindex uint32
  4390. } /* in.h:303:1 */
  4391. type ip6_mtuinfo = struct {
  4392. Fip6m_addr struct {
  4393. Fsin6_family sa_family_t
  4394. Fsin6_port in_port_t
  4395. Fsin6_flowinfo uint32_t
  4396. Fsin6_addr struct {
  4397. F__in6_union struct {
  4398. F__ccgo_pad1 [0]uint32
  4399. F__s6_addr [16]uint8_t
  4400. }
  4401. }
  4402. Fsin6_scope_id uint32_t
  4403. }
  4404. Fip6m_mtu uint32_t
  4405. } /* in.h:308:1 */
  4406. type addrinfo = struct {
  4407. Fai_flags int32
  4408. Fai_family int32
  4409. Fai_socktype int32
  4410. Fai_protocol int32
  4411. Fai_addrlen socklen_t
  4412. Fai_addr uintptr
  4413. Fai_canonname uintptr
  4414. Fai_next uintptr
  4415. } /* netdb.h:16:1 */
  4416. // Legacy functions follow (marked OBsolete in SUS)
  4417. type netent = struct {
  4418. Fn_name uintptr
  4419. Fn_aliases uintptr
  4420. Fn_addrtype int32
  4421. Fn_net uint32_t
  4422. } /* netdb.h:62:1 */
  4423. type hostent = struct {
  4424. Fh_name uintptr
  4425. Fh_aliases uintptr
  4426. Fh_addrtype int32
  4427. Fh_length int32
  4428. Fh_addr_list uintptr
  4429. } /* netdb.h:69:1 */
  4430. type servent = struct {
  4431. Fs_name uintptr
  4432. Fs_aliases uintptr
  4433. Fs_port int32
  4434. Fs_proto uintptr
  4435. } /* netdb.h:78:1 */
  4436. type protoent = struct {
  4437. Fp_name uintptr
  4438. Fp_aliases uintptr
  4439. Fp_proto int32
  4440. } /* netdb.h:85:1 */
  4441. type aibuf = struct {
  4442. Fai struct {
  4443. Fai_flags int32
  4444. Fai_family int32
  4445. Fai_socktype int32
  4446. Fai_protocol int32
  4447. Fai_addrlen socklen_t
  4448. Fai_addr uintptr
  4449. Fai_canonname uintptr
  4450. Fai_next uintptr
  4451. }
  4452. Fsa struct {
  4453. Fsin struct {
  4454. Fsin_family sa_family_t
  4455. Fsin_port in_port_t
  4456. Fsin_addr struct{ Fs_addr in_addr_t }
  4457. Fsin_zero [8]uint8_t
  4458. }
  4459. F__ccgo_pad1 [12]byte
  4460. }
  4461. Flock [1]int32
  4462. Fslot int16
  4463. Fref int16
  4464. } /* lookup.h:10:1 */
  4465. type sa = struct {
  4466. Fsin struct {
  4467. Fsin_family sa_family_t
  4468. Fsin_port in_port_t
  4469. Fsin_addr struct{ Fs_addr in_addr_t }
  4470. Fsin_zero [8]uint8_t
  4471. }
  4472. F__ccgo_pad1 [12]byte
  4473. } /* lookup.h:10:1 */
  4474. type address = struct {
  4475. Ffamily int32
  4476. Fscopeid uint32
  4477. Faddr [16]uint8_t
  4478. Fsortkey int32
  4479. } /* lookup.h:20:1 */
  4480. type service = struct {
  4481. Fport uint16_t
  4482. Fproto uint8
  4483. Fsocktype uint8
  4484. } /* lookup.h:27:1 */
  4485. type resolvconf = struct {
  4486. Fns [3]struct {
  4487. Ffamily int32
  4488. Fscopeid uint32
  4489. Faddr [16]uint8_t
  4490. Fsortkey int32
  4491. }
  4492. Fnns uint32
  4493. Fattempts uint32
  4494. Fndots uint32
  4495. Ftimeout uint32
  4496. } /* lookup.h:34:1 */
  4497. func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
  4498. if __ccgo_strace {
  4499. trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
  4500. }
  4501. var cnt size_t
  4502. cnt = size_t(1)
  4503. __1:
  4504. if !((*addrinfo)(unsafe.Pointer(p)).Fai_next != 0) {
  4505. goto __3
  4506. }
  4507. goto __2
  4508. __2:
  4509. cnt++
  4510. p = (*addrinfo)(unsafe.Pointer(p)).Fai_next
  4511. goto __1
  4512. goto __3
  4513. __3:
  4514. ;
  4515. var b uintptr = p - uintptr(uint32(uintptr(0)))
  4516. b -= 68 * uintptr((*aibuf)(unsafe.Pointer(b)).Fslot)
  4517. //TODO LOCK(b->lock);
  4518. if !(int32(AssignSubPtrInt16(b+66, int16(cnt))) != 0) {
  4519. Xfree(tls, b)
  4520. }
  4521. //TODO else UNLOCK(b->lock);
  4522. }
  4523. type time_t = int64 /* alltypes.h:78:16 */
  4524. type clockid_t = int32 /* alltypes.h:207:13 */
  4525. type timespec = struct {
  4526. Ftv_sec time_t
  4527. Ftv_nsec int32
  4528. __12 uint32 /* int : 32 */
  4529. } /* alltypes.h:222:1 */
  4530. type pthread_t = uintptr /* alltypes.h:266:26 */
  4531. type pthread_once_t = int32 /* alltypes.h:272:13 */
  4532. type pthread_key_t = uint32 /* alltypes.h:277:18 */
  4533. type pthread_spinlock_t = int32 /* alltypes.h:282:13 */
  4534. type pthread_mutexattr_t = struct{ F__attr uint32 } /* alltypes.h:287:37 */
  4535. type pthread_condattr_t = struct{ F__attr uint32 } /* alltypes.h:292:37 */
  4536. type pthread_barrierattr_t = struct{ F__attr uint32 } /* alltypes.h:297:37 */
  4537. type pthread_rwlockattr_t = struct{ F__attr [2]uint32 } /* alltypes.h:302:40 */
  4538. type __sigset_t = struct{ F__bits [32]uint32 } /* alltypes.h:342:9 */
  4539. type sigset_t = __sigset_t /* alltypes.h:342:71 */
  4540. type pthread_attr_t = struct{ F__u struct{ F__i [9]int32 } } /* alltypes.h:365:147 */
  4541. type pthread_mutex_t = struct{ F__u struct{ F__i [6]int32 } } /* alltypes.h:370:157 */
  4542. type pthread_cond_t = struct{ F__u struct{ F__i [12]int32 } } /* alltypes.h:380:112 */
  4543. type pthread_rwlock_t = struct{ F__u struct{ F__i [8]int32 } } /* alltypes.h:390:139 */
  4544. type pthread_barrier_t = struct{ F__u struct{ F__i [5]int32 } } /* alltypes.h:395:137 */
  4545. type sched_param = struct {
  4546. Fsched_priority int32
  4547. F__reserved1 int32
  4548. F__reserved2 [4]int32
  4549. F__reserved3 int32
  4550. } /* sched.h:19:1 */
  4551. type timer_t = uintptr /* alltypes.h:202:14 */
  4552. type clock_t = int32 /* alltypes.h:212:14 */
  4553. type tm = struct {
  4554. Ftm_sec int32
  4555. Ftm_min int32
  4556. Ftm_hour int32
  4557. Ftm_mday int32
  4558. Ftm_mon int32
  4559. Ftm_year int32
  4560. Ftm_wday int32
  4561. Ftm_yday int32
  4562. Ftm_isdst int32
  4563. Ftm_gmtoff int32
  4564. Ftm_zone uintptr
  4565. } /* time.h:38:1 */
  4566. type itimerspec = struct {
  4567. Fit_interval struct {
  4568. Ftv_sec time_t
  4569. Ftv_nsec int32
  4570. __12 uint32 /* int : 32 */
  4571. }
  4572. Fit_value struct {
  4573. Ftv_sec time_t
  4574. Ftv_nsec int32
  4575. __12 uint32 /* int : 32 */
  4576. }
  4577. } /* time.h:80:1 */
  4578. type __ptcb = struct {
  4579. F__f uintptr
  4580. F__x uintptr
  4581. F__next uintptr
  4582. } /* pthread.h:206:1 */
  4583. type useconds_t = uint32 /* alltypes.h:253:18 */
  4584. func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
  4585. if __ccgo_strace {
  4586. trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
  4587. }
  4588. bp := tls.Alloc(1608)
  4589. defer tls.Free(1608)
  4590. // var ports [2]service at bp, 8
  4591. // var addrs [48]address at bp+8, 1344
  4592. // var canon [256]uint8 at bp+1352, 256
  4593. var outcanon uintptr
  4594. var nservs int32
  4595. var naddrs int32
  4596. var nais int32
  4597. var canon_len int32
  4598. var i int32
  4599. var j int32
  4600. var k int32
  4601. var family int32 = 0
  4602. var flags int32 = 0
  4603. var proto int32 = 0
  4604. var socktype int32 = 0
  4605. var out uintptr
  4606. if !(host != 0) && !(serv != 0) {
  4607. return -2
  4608. }
  4609. if hint != 0 {
  4610. family = (*addrinfo)(unsafe.Pointer(hint)).Fai_family
  4611. flags = (*addrinfo)(unsafe.Pointer(hint)).Fai_flags
  4612. proto = (*addrinfo)(unsafe.Pointer(hint)).Fai_protocol
  4613. socktype = (*addrinfo)(unsafe.Pointer(hint)).Fai_socktype
  4614. var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400
  4615. if flags&mask != flags {
  4616. return -1
  4617. }
  4618. switch family {
  4619. case 2:
  4620. fallthrough
  4621. case 10:
  4622. fallthrough
  4623. case 0:
  4624. break
  4625. fallthrough
  4626. default:
  4627. return -6
  4628. }
  4629. }
  4630. if flags&0x20 != 0 {
  4631. Xabort(tls) //TODO-
  4632. // /* Define the "an address is configured" condition for address
  4633. // * families via ability to create a socket for the family plus
  4634. // * routability of the loopback address for the family. */
  4635. // static const struct sockaddr_in lo4 = {
  4636. // .sin_family = AF_INET, .sin_port = 65535,
  4637. // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN
  4638. // ? 0x7f000001 : 0x0100007f
  4639. // };
  4640. // static const struct sockaddr_in6 lo6 = {
  4641. // .sin6_family = AF_INET6, .sin6_port = 65535,
  4642. // .sin6_addr = IN6ADDR_LOOPBACK_INIT
  4643. // };
  4644. // int tf[2] = { AF_INET, AF_INET6 };
  4645. // const void *ta[2] = { &lo4, &lo6 };
  4646. // socklen_t tl[2] = { sizeof lo4, sizeof lo6 };
  4647. // for (i=0; i<2; i++) {
  4648. // if (family==tf[1-i]) continue;
  4649. // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM,
  4650. // IPPROTO_UDP);
  4651. // if (s>=0) {
  4652. // int cs;
  4653. // pthread_setcancelstate(
  4654. // PTHREAD_CANCEL_DISABLE, &cs);
  4655. // int r = connect(s, ta[i], tl[i]);
  4656. // pthread_setcancelstate(cs, 0);
  4657. // close(s);
  4658. // if (!r) continue;
  4659. // }
  4660. // switch (errno) {
  4661. // case EADDRNOTAVAIL:
  4662. // case EAFNOSUPPORT:
  4663. // case EHOSTUNREACH:
  4664. // case ENETDOWN:
  4665. // case ENETUNREACH:
  4666. // break;
  4667. // default:
  4668. // return EAI_SYSTEM;
  4669. // }
  4670. // if (family == tf[i]) return EAI_NONAME;
  4671. // family = tf[1-i];
  4672. // }
  4673. }
  4674. nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags)
  4675. if nservs < 0 {
  4676. return nservs
  4677. }
  4678. naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags)
  4679. if naddrs < 0 {
  4680. return naddrs
  4681. }
  4682. nais = nservs * naddrs
  4683. canon_len = int32(Xstrlen(tls, bp+1352))
  4684. out = Xcalloc(tls, uint32(1), uint32(nais)*uint32(unsafe.Sizeof(aibuf{}))+uint32(canon_len)+uint32(1))
  4685. if !(out != 0) {
  4686. return -10
  4687. }
  4688. if canon_len != 0 {
  4689. outcanon = out + uintptr(nais)*68
  4690. Xmemcpy(tls, outcanon, bp+1352, uint32(canon_len+1))
  4691. } else {
  4692. outcanon = uintptr(0)
  4693. }
  4694. for k = AssignInt32(&i, 0); i < naddrs; i++ {
  4695. j = 0
  4696. __1:
  4697. if !(j < nservs) {
  4698. goto __3
  4699. }
  4700. {
  4701. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fslot = int16(k)
  4702. //TODO out[k].ai = (struct addrinfo){
  4703. //TODO .ai_family = addrs[i].family,
  4704. //TODO .ai_socktype = ports[j].socktype,
  4705. //TODO .ai_protocol = ports[j].proto,
  4706. //TODO .ai_addrlen = addrs[i].family == AF_INET
  4707. //TODO ? sizeof(struct sockaddr_in)
  4708. //TODO : sizeof(struct sockaddr_in6),
  4709. //TODO .ai_addr = (void *)&out[k].sa,
  4710. //TODO .ai_canonname = outcanon };
  4711. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily
  4712. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fsocktype)
  4713. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fproto)
  4714. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_addrlen = func() uint32 {
  4715. if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).Ffamily == 2 {
  4716. return uint32(unsafe.Sizeof(sockaddr_in{}))
  4717. }
  4718. return uint32(unsafe.Sizeof(sockaddr_in6{}))
  4719. }()
  4720. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_addr = out + uintptr(k)*68 + 32
  4721. (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_canonname = outcanon
  4722. if k != 0 {
  4723. (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*68)).Fai.Fai_next = out + uintptr(k)*68
  4724. }
  4725. switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily {
  4726. case 2:
  4727. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin_family = sa_family_t(2)
  4728. (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
  4729. Xmemcpy(tls, out+uintptr(k)*68+32+4, bp+8+uintptr(i)*28+8, uint32(4))
  4730. break
  4731. case 10:
  4732. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_family = sa_family_t(10)
  4733. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
  4734. (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Fscopeid
  4735. Xmemcpy(tls, out+uintptr(k)*68+32+8, bp+8+uintptr(i)*28+8, uint32(16))
  4736. break
  4737. }
  4738. }
  4739. goto __2
  4740. __2:
  4741. j++
  4742. k++
  4743. goto __1
  4744. goto __3
  4745. __3:
  4746. }
  4747. (*aibuf)(unsafe.Pointer(out)).Fref = int16(nais)
  4748. *(*uintptr)(unsafe.Pointer(res)) = out
  4749. return 0
  4750. }
  4751. type ucred = struct {
  4752. Fpid pid_t
  4753. Fuid uid_t
  4754. Fgid gid_t
  4755. } /* socket.h:57:1 */
  4756. type mmsghdr = struct {
  4757. Fmsg_hdr struct {
  4758. Fmsg_name uintptr
  4759. Fmsg_namelen socklen_t
  4760. Fmsg_iov uintptr
  4761. Fmsg_iovlen int32
  4762. Fmsg_control uintptr
  4763. Fmsg_controllen socklen_t
  4764. Fmsg_flags int32
  4765. }
  4766. Fmsg_len uint32
  4767. } /* socket.h:63:1 */
  4768. func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
  4769. if __ccgo_strace {
  4770. trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
  4771. }
  4772. bp := tls.Alloc(4)
  4773. defer tls.Free(4)
  4774. var size size_t = size_t(63)
  4775. // var res uintptr at bp, 4
  4776. var err int32
  4777. for __ccgo := true; __ccgo; __ccgo = err == 34 {
  4778. Xfree(tls, _sh)
  4779. _sh = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1)))
  4780. if !(_sh != 0) {
  4781. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  4782. return uintptr(0)
  4783. }
  4784. err = Xgethostbyaddr_r(tls, a, l, af, _sh,
  4785. _sh+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  4786. }
  4787. if err != 0 {
  4788. return uintptr(0)
  4789. }
  4790. return _sh
  4791. }
  4792. var _sh uintptr /* gethostbyaddr.c:9:24: */
  4793. func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
  4794. if __ccgo_strace {
  4795. trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
  4796. }
  4797. return Xgethostbyname2(tls, name, 2)
  4798. }
  4799. func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
  4800. if __ccgo_strace {
  4801. trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
  4802. }
  4803. bp := tls.Alloc(4)
  4804. defer tls.Free(4)
  4805. var size size_t = size_t(63)
  4806. // var res uintptr at bp, 4
  4807. var err int32
  4808. for __ccgo := true; __ccgo; __ccgo = err == 34 {
  4809. Xfree(tls, _sh1)
  4810. _sh1 = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1)))
  4811. if !(_sh1 != 0) {
  4812. *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
  4813. return uintptr(0)
  4814. }
  4815. err = Xgethostbyname2_r(tls, name, af, _sh1,
  4816. _sh1+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
  4817. }
  4818. if err != 0 {
  4819. return uintptr(0)
  4820. }
  4821. return _sh1
  4822. }
  4823. var _sh1 uintptr /* gethostbyname2.c:10:24: */
  4824. 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: */
  4825. if __ccgo_strace {
  4826. trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
  4827. }
  4828. bp := tls.Alloc(1600)
  4829. defer tls.Free(1600)
  4830. // var addrs [48]address at bp, 1344
  4831. // var canon [256]uint8 at bp+1344, 256
  4832. var i int32
  4833. var cnt int32
  4834. var align size_t
  4835. var need size_t
  4836. *(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
  4837. cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02)
  4838. if cnt < 0 {
  4839. switch cnt {
  4840. case -2:
  4841. *(*int32)(unsafe.Pointer(err)) = 1
  4842. return 2
  4843. fallthrough
  4844. case -3:
  4845. *(*int32)(unsafe.Pointer(err)) = 2
  4846. return 11
  4847. fallthrough
  4848. default:
  4849. fallthrough
  4850. case -4:
  4851. *(*int32)(unsafe.Pointer(err)) = 3
  4852. return 74
  4853. fallthrough
  4854. case -10:
  4855. fallthrough
  4856. case -11:
  4857. *(*int32)(unsafe.Pointer(err)) = 3
  4858. return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
  4859. }
  4860. }
  4861. (*hostent)(unsafe.Pointer(h)).Fh_addrtype = af
  4862. (*hostent)(unsafe.Pointer(h)).Fh_length = func() int32 {
  4863. if af == 10 {
  4864. return 16
  4865. }
  4866. return 4
  4867. }()
  4868. // Align buffer
  4869. align = -uintptr_t(buf) & (uint32(unsafe.Sizeof(uintptr(0))) - uint32(1))
  4870. need = uint32(4) * uint32(unsafe.Sizeof(uintptr(0)))
  4871. need = need + uint32(cnt+1)*(uint32(unsafe.Sizeof(uintptr(0)))+uint32((*hostent)(unsafe.Pointer(h)).Fh_length))
  4872. need = need + (Xstrlen(tls, name) + size_t(1))
  4873. need = need + (Xstrlen(tls, bp+1344) + size_t(1))
  4874. need = need + align
  4875. if need > buflen {
  4876. return 34
  4877. }
  4878. buf += uintptr(align)
  4879. (*hostent)(unsafe.Pointer(h)).Fh_aliases = buf
  4880. buf += uintptr(uint32(3) * uint32(unsafe.Sizeof(uintptr(0))))
  4881. (*hostent)(unsafe.Pointer(h)).Fh_addr_list = buf
  4882. buf += uintptr(uint32(cnt+1) * uint32(unsafe.Sizeof(uintptr(0))))
  4883. for i = 0; i < cnt; i++ {
  4884. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)) = buf
  4885. buf += uintptr((*hostent)(unsafe.Pointer(h)).Fh_length)
  4886. 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))
  4887. }
  4888. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)) = uintptr(0)
  4889. (*hostent)(unsafe.Pointer(h)).Fh_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).Fh_aliases, buf)
  4890. Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, bp+1344)
  4891. buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).Fh_name) + size_t(1))
  4892. if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, name) != 0 {
  4893. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)) = buf
  4894. Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)), name)
  4895. buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4))) + size_t(1))
  4896. } else {
  4897. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)) = uintptr(0)
  4898. }
  4899. *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 2*4)) = uintptr(0)
  4900. *(*uintptr)(unsafe.Pointer(res)) = h
  4901. return 0
  4902. }
  4903. type if_nameindex = struct {
  4904. Fif_index uint32
  4905. Fif_name uintptr
  4906. } /* if.h:12:1 */
  4907. type ifaddr = struct {
  4908. Fifa_addr struct {
  4909. Fsa_family sa_family_t
  4910. Fsa_data [14]uint8
  4911. }
  4912. Fifa_ifu struct {
  4913. Fifu_broadaddr struct {
  4914. Fsa_family sa_family_t
  4915. Fsa_data [14]uint8
  4916. }
  4917. }
  4918. Fifa_ifp uintptr
  4919. Fifa_next uintptr
  4920. } /* if.h:51:1 */
  4921. type ifmap = struct {
  4922. Fmem_start uint32
  4923. Fmem_end uint32
  4924. Fbase_addr uint16
  4925. Firq uint8
  4926. Fdma uint8
  4927. Fport uint8
  4928. F__ccgo_pad1 [3]byte
  4929. } /* if.h:64:1 */
  4930. type ifreq = struct {
  4931. Fifr_ifrn struct{ Fifrn_name [16]uint8 }
  4932. Fifr_ifru struct {
  4933. F__ccgo_pad1 [0]uint32
  4934. Fifru_addr struct {
  4935. Fsa_family sa_family_t
  4936. Fsa_data [14]uint8
  4937. }
  4938. }
  4939. } /* if.h:76:1 */
  4940. type ifconf = struct {
  4941. Fifc_len int32
  4942. Fifc_ifcu struct{ Fifcu_buf uintptr }
  4943. } /* if.h:116:1 */
  4944. type ns_sect = uint32 /* nameser.h:37:3 */
  4945. type __ns_msg = struct {
  4946. F_msg uintptr
  4947. F_eom uintptr
  4948. F_id uint16_t
  4949. F_flags uint16_t
  4950. F_counts [4]uint16_t
  4951. F_sections [4]uintptr
  4952. F_sect ns_sect
  4953. F_rrnum int32
  4954. F_msg_ptr uintptr
  4955. } /* nameser.h:39:9 */
  4956. type ns_msg = __ns_msg /* nameser.h:46:3 */
  4957. type _ns_flagdata = struct {
  4958. Fmask int32
  4959. Fshift int32
  4960. } /* nameser.h:48:1 */
  4961. type __ns_rr = struct {
  4962. Fname [1025]uint8
  4963. F__ccgo_pad1 [1]byte
  4964. Ftype uint16_t
  4965. Frr_class uint16_t
  4966. F__ccgo_pad2 [2]byte
  4967. Fttl uint32_t
  4968. Frdlength uint16_t
  4969. F__ccgo_pad3 [2]byte
  4970. Frdata uintptr
  4971. } /* nameser.h:59:9 */
  4972. type ns_rr = __ns_rr /* nameser.h:66:3 */
  4973. type ns_flag = uint32 /* nameser.h:87:3 */
  4974. type ns_opcode = uint32 /* nameser.h:96:3 */
  4975. type ns_rcode = uint32 /* nameser.h:115:3 */
  4976. type ns_update_operation = uint32 /* nameser.h:121:3 */
  4977. type ns_tsig_key1 = struct {
  4978. Fname [1025]uint8
  4979. Falg [1025]uint8
  4980. F__ccgo_pad1 [2]byte
  4981. Fdata uintptr
  4982. Flen int32
  4983. } /* nameser.h:123:1 */
  4984. type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */
  4985. type ns_tcp_tsig_state1 = struct {
  4986. Fcounter int32
  4987. Fkey uintptr
  4988. Fctx uintptr
  4989. Fsig [512]uint8
  4990. Fsiglen int32
  4991. } /* nameser.h:130:1 */
  4992. type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */
  4993. type ns_type = uint32 /* nameser.h:200:3 */
  4994. type ns_class = uint32 /* nameser.h:219:3 */
  4995. type ns_key_types = uint32 /* nameser.h:226:3 */
  4996. type ns_cert_types = uint32 /* nameser.h:234:3 */
  4997. type HEADER = struct {
  4998. F__ccgo_pad1 [0]uint32
  4999. 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 */
  5000. Fqdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */
  5001. Fnscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */
  5002. } /* nameser.h:353:3 */
  5003. // unused; purely for broken apps
  5004. type __res_state = struct {
  5005. Fretrans int32
  5006. Fretry int32
  5007. Foptions uint32
  5008. Fnscount int32
  5009. Fnsaddr_list [3]struct {
  5010. Fsin_family sa_family_t
  5011. Fsin_port in_port_t
  5012. Fsin_addr struct{ Fs_addr in_addr_t }
  5013. Fsin_zero [8]uint8_t
  5014. }
  5015. Fid uint16
  5016. F__ccgo_pad1 [2]byte
  5017. Fdnsrch [7]uintptr
  5018. Fdefdname [256]uint8
  5019. Fpfcode uint32
  5020. Fndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */
  5021. F__ccgo_pad2 [4]byte
  5022. Fsort_list [10]struct {
  5023. Faddr struct{ Fs_addr in_addr_t }
  5024. Fmask uint32_t
  5025. }
  5026. Fqhook uintptr
  5027. Frhook uintptr
  5028. Fres_h_errno int32
  5029. F_vcsock int32
  5030. F_flags uint32
  5031. F_u struct {
  5032. F__ccgo_pad1 [0]uint32
  5033. Fpad [52]uint8
  5034. }
  5035. } /* resolv.h:26:9 */
  5036. // unused; purely for broken apps
  5037. type res_state = uintptr /* resolv.h:62:3 */
  5038. type res_sym = struct {
  5039. Fnumber int32
  5040. Fname uintptr
  5041. Fhumanname uintptr
  5042. } /* resolv.h:70:1 */
  5043. func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */
  5044. p += uintptr(uint32(3) * uint32(unsafe.Sizeof(int32(0))))
  5045. *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(0)
  5046. for __ccgo := true; __ccgo; __ccgo = x != 0 {
  5047. *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(uint32('0') + x%uint32(10))
  5048. x = x / uint32(10)
  5049. }
  5050. return p
  5051. }
  5052. func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */
  5053. bp := tls.Alloc(32)
  5054. defer tls.Free(32)
  5055. Xsprintf(tls, s, ts+64,
  5056. 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)))))
  5057. }
  5058. func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */
  5059. var i int32
  5060. for i = 15; i >= 0; i-- {
  5061. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15]
  5062. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.')
  5063. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4]
  5064. *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.')
  5065. }
  5066. Xstrcpy(tls, s, ts+89)
  5067. }
  5068. var _sxdigits = *(*[17]uint8)(unsafe.Pointer(ts + 98)) /* getnameinfo.c:36:20 */
  5069. func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */
  5070. bp := tls.Alloc(556)
  5071. defer tls.Free(556)
  5072. // var line [512]uint8 at bp+16, 512
  5073. var p uintptr
  5074. var z uintptr
  5075. var _buf [1032]uint8
  5076. _ = _buf
  5077. // var atmp [16]uint8 at bp, 16
  5078. // var iplit address at bp+528, 28
  5079. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  5080. var f uintptr = Xfopen(tls, ts+115, ts+126)
  5081. if !(f != 0) {
  5082. return
  5083. }
  5084. if family == 2 {
  5085. Xmemcpy(tls, bp+uintptr(12), a, uint32(4))
  5086. Xmemcpy(tls, bp, ts+129, uint32(12))
  5087. a = bp /* &atmp[0] */
  5088. }
  5089. for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]uint8{})), f) != 0 {
  5090. if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 {
  5091. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n')
  5092. *(*uint8)(unsafe.Pointer(p)) = uint8(0)
  5093. }
  5094. for p = bp + 16; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ {
  5095. }
  5096. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0)
  5097. if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 {
  5098. continue
  5099. }
  5100. if (*address)(unsafe.Pointer(bp+528)).Ffamily == 2 {
  5101. Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint32(4))
  5102. Xmemcpy(tls, bp+528+8, ts+129, uint32(12))
  5103. (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).Fscopeid = uint32(0)
  5104. }
  5105. if Xmemcmp(tls, a, bp+528+8, uint32(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).Fscopeid != scopeid {
  5106. continue
  5107. }
  5108. for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ {
  5109. }
  5110. for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ {
  5111. }
  5112. *(*uint8)(unsafe.Pointer(z)) = uint8(0)
  5113. if (int32(z)-int32(p))/1 < 256 {
  5114. Xmemcpy(tls, buf, p, uint32((int32(z)-int32(p))/1+1))
  5115. break
  5116. }
  5117. }
  5118. //TODO __fclose_ca(f);
  5119. Xfclose(tls, f)
  5120. }
  5121. func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */
  5122. Xabort(tls) //TODO-
  5123. // unsigned long svport;
  5124. // char line[128], *p, *z;
  5125. // unsigned char _buf[1032];
  5126. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  5127. // if (!f) return;
  5128. // while (fgets(line, sizeof line, f)) {
  5129. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  5130. // for (p=line; *p && !isspace(*p); p++);
  5131. // if (!*p) continue;
  5132. // *p++ = 0;
  5133. // svport = strtoul(p, &z, 10);
  5134. // if (svport != port || z==p) continue;
  5135. // if (dgram && strncmp(z, "/udp", 4)) continue;
  5136. // if (!dgram && strncmp(z, "/tcp", 4)) continue;
  5137. // if (p-line > 32) continue;
  5138. // memcpy(buf, line, p-line);
  5139. // break;
  5140. // }
  5141. // __fclose_ca(f);
  5142. }
  5143. var Xh_errno int32 /* h_errno.c:4:5: */
  5144. func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
  5145. if __ccgo_strace {
  5146. trc("tls=%v, (%v:)", tls, origin(2))
  5147. }
  5148. return uintptr(unsafe.Pointer(&Xh_errno))
  5149. }
  5150. func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
  5151. if __ccgo_strace {
  5152. trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
  5153. }
  5154. bp := tls.Alloc(20)
  5155. defer tls.Free(20)
  5156. var s uintptr = s0
  5157. var d uintptr = dest
  5158. *(*[4]uint32)(unsafe.Pointer(bp /* a */)) = [4]uint32{0: uint32(0)}
  5159. // var z uintptr at bp+16, 4
  5160. var i int32
  5161. for i = 0; i < 4; i++ {
  5162. *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) = Xstrtoul(tls, s, bp+16, 0)
  5163. 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 {
  5164. if 0 != 0 {
  5165. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s))))
  5166. }
  5167. return Bool32(uint32(*(*uint8)(unsafe.Pointer(s)))-uint32('0') < uint32(10))
  5168. }() != 0) {
  5169. return 0
  5170. }
  5171. if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != 0) {
  5172. break
  5173. }
  5174. s = *(*uintptr)(unsafe.Pointer(bp + 16)) + uintptr(1)
  5175. }
  5176. if i == 4 {
  5177. return 0
  5178. }
  5179. switch i {
  5180. case 0:
  5181. *(*uint32)(unsafe.Pointer(bp + 1*4)) = *(*uint32)(unsafe.Pointer(bp)) & uint32(0xffffff)
  5182. AssignShrPtrUint32(bp, int(24))
  5183. fallthrough
  5184. case 1:
  5185. *(*uint32)(unsafe.Pointer(bp + 2*4)) = *(*uint32)(unsafe.Pointer(bp + 1*4)) & uint32(0xffff)
  5186. AssignShrPtrUint32(bp+1*4, int(16))
  5187. fallthrough
  5188. case 2:
  5189. *(*uint32)(unsafe.Pointer(bp + 3*4)) = *(*uint32)(unsafe.Pointer(bp + 2*4)) & uint32(0xff)
  5190. AssignShrPtrUint32(bp+2*4, int(8))
  5191. }
  5192. for i = 0; i < 4; i++ {
  5193. if *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) > uint32(255) {
  5194. return 0
  5195. }
  5196. *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)))
  5197. }
  5198. return 1
  5199. }
  5200. func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
  5201. if __ccgo_strace {
  5202. trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
  5203. }
  5204. bp := tls.Alloc(276)
  5205. defer tls.Free(276)
  5206. var a uintptr = a0
  5207. var i int32
  5208. var j int32
  5209. var max int32
  5210. var best int32
  5211. // var buf [100]uint8 at bp+176, 100
  5212. switch af {
  5213. case 2:
  5214. 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 {
  5215. return s
  5216. }
  5217. break
  5218. case 10:
  5219. if Xmemcmp(tls, a, ts+129, uint32(12)) != 0 {
  5220. Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]uint8{})),
  5221. ts+154,
  5222. 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))),
  5223. 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))),
  5224. 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))),
  5225. 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)))))
  5226. } else {
  5227. Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]uint8{})),
  5228. ts+178,
  5229. 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))),
  5230. 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))),
  5231. 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))),
  5232. int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15)))))
  5233. }
  5234. // Replace longest /(^0|:)[:0]{2,}/ with "::"
  5235. i = AssignInt32(&best, 0)
  5236. max = 2
  5237. for ; *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ {
  5238. if i != 0 && int32(*(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' {
  5239. continue
  5240. }
  5241. j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+208))
  5242. if j > max {
  5243. best = i
  5244. max = j
  5245. }
  5246. }
  5247. if max > 3 {
  5248. *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrUint8(bp+176+uintptr(best+1), uint8(':'))
  5249. Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint32(i-best-max+1))
  5250. }
  5251. if Xstrlen(tls, bp+176) < l {
  5252. Xstrcpy(tls, s, bp+176)
  5253. return s
  5254. }
  5255. break
  5256. default:
  5257. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  5258. return uintptr(0)
  5259. }
  5260. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28
  5261. return uintptr(0)
  5262. }
  5263. func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
  5264. if c-uint32('0') < uint32(10) {
  5265. return int32(c - uint32('0'))
  5266. }
  5267. c = c | uint32(32)
  5268. if c-uint32('a') < uint32(6) {
  5269. return int32(c - uint32('a') + uint32(10))
  5270. }
  5271. return -1
  5272. }
  5273. func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
  5274. if __ccgo_strace {
  5275. trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
  5276. }
  5277. bp := tls.Alloc(16)
  5278. defer tls.Free(16)
  5279. // var ip [8]uint16_t at bp, 16
  5280. var a uintptr = a0
  5281. var i int32
  5282. var j int32
  5283. var v int32
  5284. var d int32
  5285. var brk int32 = -1
  5286. var need_v4 int32 = 0
  5287. if af == 2 {
  5288. for i = 0; i < 4; i++ {
  5289. for v = AssignInt32(&j, 0); j < 3 && func() int32 {
  5290. if 0 != 0 {
  5291. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))
  5292. }
  5293. return Bool32(uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10))
  5294. }() != 0; j++ {
  5295. v = 10*v + int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) - '0'
  5296. }
  5297. if j == 0 || j > 1 && int32(*(*uint8)(unsafe.Pointer(s))) == '0' || v > 255 {
  5298. return 0
  5299. }
  5300. *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v)
  5301. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 {
  5302. return 1
  5303. }
  5304. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' {
  5305. return 0
  5306. }
  5307. s += uintptr(j + 1)
  5308. }
  5309. return 0
  5310. } else if af != 10 {
  5311. *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
  5312. return -1
  5313. }
  5314. if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' {
  5315. return 0
  5316. }
  5317. for i = 0; ; i++ {
  5318. if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && brk < 0 {
  5319. brk = i
  5320. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0)
  5321. if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) {
  5322. break
  5323. }
  5324. if i == 7 {
  5325. return 0
  5326. }
  5327. continue
  5328. }
  5329. for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ {
  5330. v = 16*v + d
  5331. }
  5332. if j == 0 {
  5333. return 0
  5334. }
  5335. *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v)
  5336. if !(int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) {
  5337. break
  5338. }
  5339. if i == 7 {
  5340. return 0
  5341. }
  5342. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != ':' {
  5343. if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 {
  5344. return 0
  5345. }
  5346. need_v4 = 1
  5347. i++
  5348. break
  5349. }
  5350. s += uintptr(j + 1)
  5351. }
  5352. if brk >= 0 {
  5353. Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint32(2*(i+1-brk)))
  5354. for j = 0; j < 7-i; j++ {
  5355. *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0)
  5356. }
  5357. }
  5358. for j = 0; j < 8; j++ {
  5359. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8)
  5360. *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2)))
  5361. }
  5362. if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 {
  5363. return 0
  5364. }
  5365. return 1
  5366. }
  5367. func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
  5368. if __ccgo_strace {
  5369. trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
  5370. }
  5371. bp := tls.Alloc(88)
  5372. defer tls.Free(88)
  5373. // var a4 in_addr at bp, 4
  5374. // var a6 in6_addr at bp+68, 16
  5375. if X__inet_aton(tls, name, bp) > 0 {
  5376. if family == 10 { // wrong family
  5377. return -2
  5378. }
  5379. Xmemcpy(tls, buf+8, bp, uint32(unsafe.Sizeof(in_addr{})))
  5380. (*address)(unsafe.Pointer(buf)).Ffamily = 2
  5381. (*address)(unsafe.Pointer(buf)).Fscopeid = uint32(0)
  5382. return 1
  5383. }
  5384. // var tmp [64]uint8 at bp+4, 64
  5385. var p uintptr = Xstrchr(tls, name, '%')
  5386. // var z uintptr at bp+84, 4
  5387. var scopeid uint64 = uint64(0)
  5388. if p != 0 && (int32(p)-int32(name))/1 < 64 {
  5389. Xmemcpy(tls, bp+4, name, uint32((int32(p)-int32(name))/1))
  5390. *(*uint8)(unsafe.Pointer(bp + 4 + uintptr((int32(p)-int32(name))/1))) = uint8(0)
  5391. name = bp + 4 /* &tmp[0] */
  5392. }
  5393. if Xinet_pton(tls, 10, name, bp+68) <= 0 {
  5394. return 0
  5395. }
  5396. if family == 2 { // wrong family
  5397. return -2
  5398. }
  5399. Xmemcpy(tls, buf+8, bp+68, uint32(unsafe.Sizeof(in6_addr{})))
  5400. (*address)(unsafe.Pointer(buf)).Ffamily = 10
  5401. if p != 0 {
  5402. if func() int32 {
  5403. if 0 != 0 {
  5404. return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))))
  5405. }
  5406. return Bool32(uint32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10))
  5407. }() != 0 {
  5408. scopeid = Xstrtoull(tls, p, bp+84, 10)
  5409. } else {
  5410. *(*uintptr)(unsafe.Pointer(bp + 84 /* z */)) = p - uintptr(1)
  5411. }
  5412. if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 84)))) != 0 {
  5413. Xabort(tls) //TODO-
  5414. // if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
  5415. // !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
  5416. // return EAI_NONAME;
  5417. // scopeid = if_nametoindex(p);
  5418. // if (!scopeid) return EAI_NONAME;
  5419. }
  5420. if scopeid > uint64(0xffffffff) {
  5421. return -2
  5422. }
  5423. }
  5424. (*address)(unsafe.Pointer(buf)).Fscopeid = uint32(scopeid)
  5425. return 1
  5426. }
  5427. type mode_t = uint32 /* alltypes.h:145:18 */
  5428. type flock = struct {
  5429. Fl_type int16
  5430. Fl_whence int16
  5431. F__ccgo_pad1 [4]byte
  5432. Fl_start off_t
  5433. Fl_len off_t
  5434. Fl_pid pid_t
  5435. F__ccgo_pad2 [4]byte
  5436. } /* fcntl.h:24:1 */
  5437. func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */
  5438. var s uintptr
  5439. //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0;
  5440. if Xstrnlen(tls, host, uint32(255))-size_t(1) >= size_t(254) {
  5441. return 0
  5442. }
  5443. 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++ {
  5444. }
  5445. return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0))
  5446. }
  5447. var Xzero_struct_address address /* lookup_name.c:27:16: */
  5448. func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */
  5449. var cnt int32 = 0
  5450. if name != 0 {
  5451. return 0
  5452. }
  5453. if flags&0x01 != 0 {
  5454. //TODO if (family != AF_INET6)
  5455. //TODO buf[cnt++] = (struct address){ .family = AF_INET };
  5456. if family != 10 {
  5457. var x = Xzero_struct_address
  5458. x.Ffamily = 2
  5459. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  5460. }
  5461. //TODO if (family != AF_INET)
  5462. //TODO buf[cnt++] = (struct address){ .family = AF_INET6 };
  5463. if family != 2 {
  5464. var x = Xzero_struct_address
  5465. x.Ffamily = 10
  5466. *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
  5467. }
  5468. } else {
  5469. Xabort(tls) //TODO-
  5470. // if (family != AF_INET6)
  5471. // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
  5472. // if (family != AF_INET)
  5473. // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
  5474. }
  5475. return cnt
  5476. }
  5477. func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */
  5478. return X__lookup_ipliteral(tls, buf, name, family)
  5479. }
  5480. func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */
  5481. bp := tls.Alloc(512)
  5482. defer tls.Free(512)
  5483. // var line [512]uint8 at bp, 512
  5484. var l size_t = Xstrlen(tls, name)
  5485. var cnt int32 = 0
  5486. var badfam int32 = 0
  5487. var _buf [1032]uint8
  5488. _ = _buf
  5489. //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
  5490. var _f FILE
  5491. _ = _f
  5492. var f uintptr = Xfopen(tls, ts+115, ts+126)
  5493. if !(f != 0) {
  5494. switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) {
  5495. case 2:
  5496. fallthrough
  5497. case 20:
  5498. fallthrough
  5499. case 13:
  5500. return 0
  5501. fallthrough
  5502. default:
  5503. return -11
  5504. }
  5505. }
  5506. for Xfgets(tls, bp, int32(unsafe.Sizeof([512]uint8{})), f) != 0 && cnt < 48 {
  5507. var p uintptr
  5508. var z uintptr
  5509. if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 {
  5510. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n')
  5511. *(*uint8)(unsafe.Pointer(p)) = uint8(0)
  5512. }
  5513. 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++ {
  5514. }
  5515. if !(p != 0) {
  5516. continue
  5517. }
  5518. // Isolate IP address to parse
  5519. for p = bp; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ {
  5520. }
  5521. *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0)
  5522. switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) {
  5523. case 1:
  5524. cnt++
  5525. break
  5526. case 0:
  5527. continue
  5528. default:
  5529. badfam = -2
  5530. continue
  5531. }
  5532. // Extract first name as canonical name
  5533. for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ {
  5534. }
  5535. for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ {
  5536. }
  5537. *(*uint8)(unsafe.Pointer(z)) = uint8(0)
  5538. if is_valid_hostname(tls, p) != 0 {
  5539. Xmemcpy(tls, canon, p, uint32((int32(z)-int32(p))/1+1))
  5540. }
  5541. }
  5542. //TODO __fclose_ca(f);
  5543. Xfclose(tls, f)
  5544. if cnt != 0 {
  5545. return cnt
  5546. }
  5547. return badfam
  5548. }
  5549. type dpc_ctx = struct {
  5550. Faddrs uintptr
  5551. Fcanon uintptr
  5552. Fcnt int32
  5553. } /* lookup_name.c:112:1 */
  5554. func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */
  5555. return -1 //TODO-
  5556. Xabort(tls)
  5557. return int32(0) //TODO-
  5558. // char search[256];
  5559. // struct resolvconf conf;
  5560. // size_t l, dots;
  5561. // char *p, *z;
  5562. // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1;
  5563. // /* Count dots, suppress search when >=ndots or name ends in
  5564. // * a dot, which is an explicit request for global scope. */
  5565. // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++;
  5566. // if (dots >= conf.ndots || name[l-1]=='.') *search = 0;
  5567. // /* Strip final dot for canon, fail if multiple trailing dots. */
  5568. // if (name[l-1]=='.') l--;
  5569. // if (!l || name[l-1]=='.') return EAI_NONAME;
  5570. // /* This can never happen; the caller already checked length. */
  5571. // if (l >= 256) return EAI_NONAME;
  5572. // /* Name with search domain appended is setup in canon[]. This both
  5573. // * provides the desired default canonical name (if the requested
  5574. // * name is not a CNAME record) and serves as a buffer for passing
  5575. // * the full requested name to name_from_dns. */
  5576. // memcpy(canon, name, l);
  5577. // canon[l] = '.';
  5578. // for (p=search; *p; p=z) {
  5579. // for (; isspace(*p); p++);
  5580. // for (z=p; *z && !isspace(*z); z++);
  5581. // if (z==p) break;
  5582. // if (z-p < 256 - l - 1) {
  5583. // memcpy(canon+l+1, p, z-p);
  5584. // canon[z-p+1+l] = 0;
  5585. // int cnt = name_from_dns(buf, canon, canon, family, &conf);
  5586. // if (cnt) return cnt;
  5587. // }
  5588. // }
  5589. // canon[l] = 0;
  5590. // return name_from_dns(buf, canon, name, family, &conf);
  5591. }
  5592. type policy = struct {
  5593. Faddr [16]uint8
  5594. Flen uint8
  5595. Fmask uint8
  5596. Fprec uint8
  5597. Flabel uint8
  5598. } /* lookup_name.c:237:14 */
  5599. var defpolicy = [6]policy{
  5600. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 211)), Flen: uint8(15), Fmask: uint8(0xff), Fprec: uint8(50)},
  5601. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 228)), Flen: uint8(11), Fmask: uint8(0xff), Fprec: uint8(35), Flabel: uint8(4)},
  5602. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 244)), Flen: uint8(1), Fmask: uint8(0xff), Fprec: uint8(30), Flabel: uint8(2)},
  5603. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 260)), Flen: uint8(3), Fmask: uint8(0xff), Fprec: uint8(5), Flabel: uint8(5)},
  5604. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 276)), Fmask: uint8(0xfe), Fprec: uint8(3), Flabel: uint8(13)},
  5605. // Last rule must match all addresses to stop loop.
  5606. {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 292)), Fprec: uint8(40), Flabel: uint8(1)},
  5607. } /* lookup_name.c:241:3 */
  5608. func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */
  5609. var i int32
  5610. for i = 0; ; i++ {
  5611. if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint32(defpolicy[i].Flen)) != 0 {
  5612. continue
  5613. }
  5614. if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].Flen))))&int32(defpolicy[i].Fmask) !=
  5615. int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].Flen)))) {
  5616. continue
  5617. }
  5618. return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20
  5619. }
  5620. return uintptr(0)
  5621. }
  5622. func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */
  5623. return int32((*policy)(unsafe.Pointer(policyof(tls, a))).Flabel)
  5624. }
  5625. func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */
  5626. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff {
  5627. return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15
  5628. }
  5629. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 {
  5630. return 2
  5631. }
  5632. 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 {
  5633. return 2
  5634. }
  5635. if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 {
  5636. return 5
  5637. }
  5638. return 14
  5639. }
  5640. func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */
  5641. // FIXME: The common prefix length should be limited to no greater
  5642. // than the nominal length of the prefix portion of the source
  5643. // address. However the definition of the source prefix length is
  5644. // not clear and thus this limiting is not yet implemented.
  5645. var i uint32
  5646. 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++ {
  5647. }
  5648. return int32(i)
  5649. }
  5650. func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */
  5651. var a uintptr = _a
  5652. var b uintptr = _b
  5653. return (*address)(unsafe.Pointer(b)).Fsortkey - (*address)(unsafe.Pointer(a)).Fsortkey
  5654. }
  5655. func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
  5656. if __ccgo_strace {
  5657. trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
  5658. }
  5659. bp := tls.Alloc(92)
  5660. defer tls.Free(92)
  5661. var cnt int32 = 0
  5662. var i int32
  5663. var j int32
  5664. _ = j
  5665. *(*uint8)(unsafe.Pointer(canon)) = uint8(0)
  5666. if name != 0 {
  5667. // reject empty name and check len so it fits into temp bufs
  5668. var l size_t = Xstrnlen(tls, name, uint32(255))
  5669. if l-size_t(1) >= size_t(254) {
  5670. return -2
  5671. }
  5672. Xmemcpy(tls, canon, name, l+size_t(1))
  5673. }
  5674. // Procedurally, a request for v6 addresses with the v4-mapped
  5675. // flag set is like a request for unspecified family, followed
  5676. // by filtering of the results.
  5677. if flags&0x08 != 0 {
  5678. if family == 10 {
  5679. family = 0
  5680. } else {
  5681. flags = flags - 0x08
  5682. }
  5683. }
  5684. // Try each backend until there's at least one result.
  5685. cnt = name_from_null(tls, buf, name, family, flags)
  5686. if !(cnt != 0) {
  5687. cnt = name_from_numeric(tls, buf, name, family)
  5688. }
  5689. if !(cnt != 0) && !(flags&0x04 != 0) {
  5690. cnt = name_from_hosts(tls, buf, canon, name, family)
  5691. if !(cnt != 0) {
  5692. cnt = name_from_dns_search(tls, buf, canon, name, family)
  5693. }
  5694. }
  5695. if cnt <= 0 {
  5696. if cnt != 0 {
  5697. return cnt
  5698. }
  5699. return -2
  5700. }
  5701. // Filter/transform results for v4-mapped lookup, if requested.
  5702. if flags&0x08 != 0 {
  5703. Xabort(tls) //TODO-
  5704. // if (!(flags & AI_ALL)) {
  5705. // /* If any v6 results exist, remove v4 results. */
  5706. // for (i=0; i<cnt && buf[i].family != AF_INET6; i++);
  5707. // if (i<cnt) {
  5708. // for (j=0; i<cnt; i++) {
  5709. // if (buf[i].family == AF_INET6)
  5710. // buf[j++] = buf[i];
  5711. // }
  5712. // cnt = i = j;
  5713. // }
  5714. // }
  5715. // /* Translate any remaining v4 results to v6 */
  5716. // for (i=0; i<cnt; i++) {
  5717. // if (buf[i].family != AF_INET) continue;
  5718. // memcpy(buf[i].addr+12, buf[i].addr, 4);
  5719. // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
  5720. // buf[i].family = AF_INET6;
  5721. // }
  5722. }
  5723. // No further processing is needed if there are fewer than 2
  5724. // results or if there are only IPv4 results.
  5725. if cnt < 2 || family == 2 {
  5726. return cnt
  5727. }
  5728. for i = 0; i < cnt; i++ {
  5729. if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).Ffamily != 2 {
  5730. break
  5731. }
  5732. }
  5733. if i == cnt {
  5734. return cnt
  5735. }
  5736. var cs int32
  5737. _ = cs
  5738. //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
  5739. // The following implements a subset of RFC 3484/6724 destination
  5740. // address selection by generating a single 31-bit sort key for
  5741. // each address. Rules 3, 4, and 7 are omitted for having
  5742. // excessive runtime and code size cost and dubious benefit.
  5743. // So far the label/precedence table cannot be customized.
  5744. for i = 0; i < cnt; i++ {
  5745. var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Ffamily
  5746. var key int32 = 0
  5747. *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{}
  5748. *(*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}
  5749. *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{}
  5750. *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{Fsin_family: sa_family_t(2), Fsin_port: in_port_t(65535)}
  5751. var sa1 uintptr
  5752. var da uintptr
  5753. // var salen socklen_t at bp+88, 4
  5754. var dalen socklen_t
  5755. if family == 10 {
  5756. Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint32(16))
  5757. da = bp /* &da6 */
  5758. dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  5759. sa1 = bp + 28 /* &sa6 */
  5760. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
  5761. } else {
  5762. Xmemcpy(tls, bp+28+8,
  5763. ts+129, uint32(12))
  5764. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4))
  5765. Xmemcpy(tls, bp+8,
  5766. ts+129, uint32(12))
  5767. Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4))
  5768. Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint32(4))
  5769. da = bp + 56 /* &da4 */
  5770. dalen = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  5771. sa1 = bp + 72 /* &sa4 */
  5772. *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{}))
  5773. }
  5774. var dpolicy uintptr = policyof(tls, bp+8)
  5775. var dscope int32 = scopeof(tls, bp+8)
  5776. var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Flabel)
  5777. var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Fprec)
  5778. var prefixlen int32 = 0
  5779. var fd int32 = Xsocket(tls, family, 2|02000000, 17)
  5780. if fd >= 0 {
  5781. if !(Xconnect(tls, fd, da, dalen) != 0) {
  5782. key = key | 0x40000000
  5783. if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) {
  5784. if family == 2 {
  5785. Xmemcpy(tls,
  5786. bp+28+8+uintptr(12),
  5787. bp+72+4, uint32(4))
  5788. }
  5789. if dscope == scopeof(tls, bp+28+8) {
  5790. key = key | 0x20000000
  5791. }
  5792. if dlabel == labelof(tls, bp+28+8) {
  5793. key = key | 0x10000000
  5794. }
  5795. prefixlen = prefixmatch(tls, bp+28+8,
  5796. bp+8)
  5797. }
  5798. }
  5799. Xclose(tls, fd)
  5800. }
  5801. key = key | dprec<<20
  5802. key = key | (15-dscope)<<16
  5803. key = key | prefixlen<<8
  5804. key = key | (48-i)<<0
  5805. (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fsortkey = key
  5806. }
  5807. Xqsort(tls, buf, uint32(cnt), uint32(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct {
  5808. f func(*TLS, uintptr, uintptr) int32
  5809. }{addrcmp})))
  5810. //TODO pthread_setcancelstate(cs, 0);
  5811. return cnt
  5812. }
  5813. func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
  5814. if __ccgo_strace {
  5815. trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
  5816. }
  5817. bp := tls.Alloc(4)
  5818. defer tls.Free(4)
  5819. var line [128]uint8
  5820. _ = line
  5821. var cnt int32 = 0
  5822. var p uintptr
  5823. _ = p
  5824. *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 54 /* "" */
  5825. var port uint32 = uint32(0)
  5826. switch socktype {
  5827. case 1:
  5828. switch proto {
  5829. case 0:
  5830. proto = 6
  5831. fallthrough
  5832. case 6:
  5833. break
  5834. default:
  5835. return -8
  5836. }
  5837. break
  5838. case 2:
  5839. switch proto {
  5840. case 0:
  5841. proto = 17
  5842. fallthrough
  5843. case 17:
  5844. break
  5845. default:
  5846. return -8
  5847. }
  5848. fallthrough
  5849. case 0:
  5850. break
  5851. default:
  5852. if name != 0 {
  5853. return -8
  5854. }
  5855. (*service)(unsafe.Pointer(buf)).Fport = uint16_t(0)
  5856. (*service)(unsafe.Pointer(buf)).Fproto = uint8(proto)
  5857. (*service)(unsafe.Pointer(buf)).Fsocktype = uint8(socktype)
  5858. return 1
  5859. }
  5860. if name != 0 {
  5861. if !(int32(*(*uint8)(unsafe.Pointer(name))) != 0) {
  5862. return -8
  5863. }
  5864. port = Xstrtoul(tls, name, bp, 10)
  5865. }
  5866. if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) {
  5867. if port > uint32(65535) {
  5868. return -8
  5869. }
  5870. if proto != 17 {
  5871. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
  5872. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(1)
  5873. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(6)
  5874. }
  5875. if proto != 6 {
  5876. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
  5877. (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(2)
  5878. (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(17)
  5879. }
  5880. return cnt
  5881. }
  5882. if flags&0x400 != 0 {
  5883. return -2
  5884. }
  5885. var l size_t = Xstrlen(tls, name)
  5886. _ = l
  5887. Xabort(tls) //TODO-
  5888. // unsigned char _buf[1032];
  5889. // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
  5890. // if (!f) switch (errno) {
  5891. // case ENOENT:
  5892. // case ENOTDIR:
  5893. // case EACCES:
  5894. // return EAI_SERVICE;
  5895. // default:
  5896. // return EAI_SYSTEM;
  5897. // }
  5898. Xabort(tls) //TODO-
  5899. // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
  5900. // if ((p=strchr(line, '#'))) *p++='\n', *p=0;
  5901. // /* Find service name */
  5902. // for(p=line; (p=strstr(p, name)); p++) {
  5903. // if (p>line && !isspace(p[-1])) continue;
  5904. // if (p[l] && !isspace(p[l])) continue;
  5905. // break;
  5906. // }
  5907. // if (!p) continue;
  5908. // /* Skip past canonical name at beginning of line */
  5909. // for (p=line; *p && !isspace(*p); p++);
  5910. // port = strtoul(p, &z, 10);
  5911. // if (port > 65535 || z==p) continue;
  5912. // if (!strncmp(z, "/udp", 4)) {
  5913. // if (proto == IPPROTO_TCP) continue;
  5914. // buf[cnt].port = port;
  5915. // buf[cnt].socktype = SOCK_DGRAM;
  5916. // buf[cnt++].proto = IPPROTO_UDP;
  5917. // }
  5918. // if (!strncmp(z, "/tcp", 4)) {
  5919. // if (proto == IPPROTO_UDP) continue;
  5920. // buf[cnt].port = port;
  5921. // buf[cnt].socktype = SOCK_STREAM;
  5922. // buf[cnt++].proto = IPPROTO_TCP;
  5923. // }
  5924. // }
  5925. // __fclose_ca(f);
  5926. // return cnt > 0 ? cnt : EAI_SERVICE;
  5927. Xabort(tls)
  5928. return int32(0) //TODO-
  5929. }
  5930. func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
  5931. if __ccgo_strace {
  5932. trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
  5933. }
  5934. *(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
  5935. if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
  5936. (*struct {
  5937. f func(*TLS, uintptr, uintptr, size_t) size_t
  5938. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fwrite})).f(tls, f, uintptr(0), uint32(0))
  5939. }
  5940. (*FILE)(unsafe.Pointer(f)).Fwpos = AssignPtrUintptr(f+28, AssignPtrUintptr(f+16, uintptr(0)))
  5941. if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(4) != 0 {
  5942. *(*uint32)(unsafe.Pointer(f)) |= uint32(32)
  5943. return -1
  5944. }
  5945. (*FILE)(unsafe.Pointer(f)).Frpos = AssignPtrUintptr(f+8, (*FILE)(unsafe.Pointer(f)).Fbuf+uintptr((*FILE)(unsafe.Pointer(f)).Fbuf_size))
  5946. if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(16) != 0 {
  5947. return -1
  5948. }
  5949. return 0
  5950. }
  5951. func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
  5952. if __ccgo_strace {
  5953. trc("tls=%v, (%v:)", tls, origin(2))
  5954. }
  5955. X__builtin_abort(tls) //TODO-
  5956. // __stdio_exit_needed();
  5957. }
  5958. // This function assumes it will never be called if there is already
  5959. // data buffered for reading.
  5960. func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
  5961. if __ccgo_strace {
  5962. trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
  5963. }
  5964. bp := tls.Alloc(1)
  5965. defer tls.Free(1)
  5966. // var c uint8 at bp, 1
  5967. if !(X__toread(tls, f) != 0) && (*struct {
  5968. f func(*TLS, uintptr, uintptr, size_t) size_t
  5969. })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fread})).f(tls, f, bp, uint32(1)) == size_t(1) {
  5970. return int32(*(*uint8)(unsafe.Pointer(bp)))
  5971. }
  5972. return -1
  5973. }
  5974. func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
  5975. if __ccgo_strace {
  5976. trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
  5977. }
  5978. var try uintptr
  5979. var sign int32
  5980. for nel > size_t(0) {
  5981. try = base + uintptr(width*(nel/size_t(2)))
  5982. sign = (*struct {
  5983. f func(*TLS, uintptr, uintptr) int32
  5984. })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try)
  5985. if sign < 0 {
  5986. nel = nel / size_t(2)
  5987. } else if sign > 0 {
  5988. base = try + uintptr(width)
  5989. nel = nel - (nel/size_t(2) + size_t(1))
  5990. } else {
  5991. return try
  5992. }
  5993. }
  5994. return uintptr(0)
  5995. }
  5996. func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */
  5997. bp := tls.Alloc(144)
  5998. defer tls.Free(144)
  5999. // var f FILE at bp, 144
  6000. (*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+4, s)
  6001. (*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
  6002. X__shlim(tls, bp, int64(0))
  6003. var y float64 = X__floatscan(tls, bp, prec, 1)
  6004. var cnt off_t = (*FILE)(unsafe.Pointer(bp)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).Frpos)-int32((*FILE)(unsafe.Pointer(bp)).Fbuf))/1)
  6005. if p != 0 {
  6006. *(*uintptr)(unsafe.Pointer(p)) = func() uintptr {
  6007. if cnt != 0 {
  6008. return s + uintptr(cnt)
  6009. }
  6010. return s
  6011. }()
  6012. }
  6013. return y
  6014. }
  6015. func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
  6016. if __ccgo_strace {
  6017. trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
  6018. }
  6019. return float32(strtox(tls, s, p, 0))
  6020. }
  6021. func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
  6022. if __ccgo_strace {
  6023. trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
  6024. }
  6025. return strtox(tls, s, p, 1)
  6026. }
  6027. func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
  6028. if __ccgo_strace {
  6029. trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
  6030. }
  6031. return strtox(tls, s, p, 2)
  6032. }
  6033. func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */
  6034. bp := tls.Alloc(144)
  6035. defer tls.Free(144)
  6036. // var f FILE at bp, 144
  6037. (*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+4, s)
  6038. (*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
  6039. X__shlim(tls, bp, int64(0))
  6040. var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim)
  6041. if p != 0 {
  6042. 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))
  6043. *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt)
  6044. }
  6045. return y
  6046. }
  6047. func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
  6048. if __ccgo_strace {
  6049. trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
  6050. }
  6051. return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
  6052. }
  6053. func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
  6054. if __ccgo_strace {
  6055. trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
  6056. }
  6057. return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
  6058. }
  6059. func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
  6060. if __ccgo_strace {
  6061. trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
  6062. }
  6063. return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
  6064. }
  6065. func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
  6066. if __ccgo_strace {
  6067. trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
  6068. }
  6069. return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
  6070. }
  6071. func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
  6072. if __ccgo_strace {
  6073. trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
  6074. }
  6075. return Xstrtoll(tls, s, p, base)
  6076. }
  6077. func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
  6078. if __ccgo_strace {
  6079. trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
  6080. }
  6081. return Xstrtoull(tls, s, p, base)
  6082. }
  6083. func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
  6084. if __ccgo_strace {
  6085. trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
  6086. }
  6087. var l size_t = Xstrlen(tls, s)
  6088. var d uintptr = Xmalloc(tls, l+size_t(1))
  6089. if !(d != 0) {
  6090. return uintptr(0)
  6091. }
  6092. return Xmemcpy(tls, d, s, l+size_t(1))
  6093. }
  6094. func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
  6095. if __ccgo_strace {
  6096. trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
  6097. }
  6098. var p uintptr = Xmemchr(tls, s, 0, n)
  6099. if p != 0 {
  6100. return uint32((int32(p) - int32(s)) / 1)
  6101. }
  6102. return n
  6103. }
  6104. func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
  6105. if __ccgo_strace {
  6106. trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
  6107. }
  6108. bp := tls.Alloc(32)
  6109. defer tls.Free(32)
  6110. var a uintptr = s
  6111. *(*[8]size_t)(unsafe.Pointer(bp /* byteset */)) = [8]size_t{0: size_t(0)}
  6112. if !(int32(*(*uint8)(unsafe.Pointer(c))) != 0) {
  6113. return size_t(0)
  6114. }
  6115. if !(int32(*(*uint8)(unsafe.Pointer(c + 1))) != 0) {
  6116. for ; int32(*(*uint8)(unsafe.Pointer(s))) == int32(*(*uint8)(unsafe.Pointer(c))); s++ {
  6117. }
  6118. return size_t((int32(s) - int32(a)) / 1)
  6119. }
  6120. 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++ {
  6121. }
  6122. 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++ {
  6123. }
  6124. return size_t((int32(s) - int32(a)) / 1)
  6125. }
  6126. func init() {
  6127. *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_CurrentRuneLocale)) + 0)) = uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) // table.cpp.c:4092:41:
  6128. }
  6129. 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"
  6130. var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data