musl_freebsd_arm64.go 184 KB

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