ccgo_freebsd_amd64.go 1.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531
  1. // Code generated for freebsd/amd64 by 'generator --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-macro=m_ --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/libbsd/include/freebsd/amd64 -extended-errors -ignore-unsupported-alignment -ignore-link-errors -lbsd -o libexpat.go --package-name libexpat lib/.libs/libexpat.a', DO NOT EDIT.
  2. //go:build freebsd && amd64
  3. package libexpat
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. )
  9. var _ reflect.Type
  10. var _ unsafe.Pointer
  11. const m_ASCII_0 = 48
  12. const m_ASCII_1 = 49
  13. const m_ASCII_2 = 50
  14. const m_ASCII_3 = 51
  15. const m_ASCII_4 = 0x34
  16. const m_ASCII_5 = 0x35
  17. const m_ASCII_6 = 0x36
  18. const m_ASCII_7 = 0x37
  19. const m_ASCII_8 = 56
  20. const m_ASCII_9 = 57
  21. const m_ASCII_A = 65
  22. const m_ASCII_AMP = 0x26
  23. const m_ASCII_APOS = 0x27
  24. const m_ASCII_B = 0x42
  25. const m_ASCII_C = 67
  26. const m_ASCII_COLON = 58
  27. const m_ASCII_COMMA = 44
  28. const m_ASCII_D = 68
  29. const m_ASCII_E = 69
  30. const m_ASCII_EQUALS = 61
  31. const m_ASCII_EXCL = 33
  32. const m_ASCII_F = 70
  33. const m_ASCII_FF = 12
  34. const m_ASCII_G = 0x47
  35. const m_ASCII_GT = 0x3E
  36. const m_ASCII_H = 0x48
  37. const m_ASCII_HASH = 35
  38. const m_ASCII_I = 73
  39. const m_ASCII_J = 0x4A
  40. const m_ASCII_K = 75
  41. const m_ASCII_L = 76
  42. const m_ASCII_LPAREN = 40
  43. const m_ASCII_LSQB = 0x5B
  44. const m_ASCII_LT = 0x3C
  45. const m_ASCII_M = 77
  46. const m_ASCII_MINUS = 0x2D
  47. const m_ASCII_N = 78
  48. const m_ASCII_O = 79
  49. const m_ASCII_P = 0x50
  50. const m_ASCII_PERIOD = 46
  51. const m_ASCII_PIPE = 124
  52. const m_ASCII_Q = 0x51
  53. const m_ASCII_QUOT = 0x22
  54. const m_ASCII_R = 82
  55. const m_ASCII_RPAREN = 41
  56. const m_ASCII_RSQB = 0x5D
  57. const m_ASCII_S = 83
  58. const m_ASCII_SEMI = 0x3B
  59. const m_ASCII_SLASH = 47
  60. const m_ASCII_SPACE = 0x20
  61. const m_ASCII_T = 84
  62. const m_ASCII_TAB = 0x09
  63. const m_ASCII_U = 0x55
  64. const m_ASCII_UNDERSCORE = 0x5F
  65. const m_ASCII_V = 0x56
  66. const m_ASCII_W = 0x57
  67. const m_ASCII_X = 88
  68. const m_ASCII_Y = 89
  69. const m_ASCII_Z = 0x5A
  70. const m_ASCII_a = 97
  71. const m_ASCII_b = 0x62
  72. const m_ASCII_c = 99
  73. const m_ASCII_d = 0x64
  74. const m_ASCII_e = 101
  75. const m_ASCII_f = 0x66
  76. const m_ASCII_g = 103
  77. const m_ASCII_h = 104
  78. const m_ASCII_i = 0x69
  79. const m_ASCII_j = 0x6A
  80. const m_ASCII_k = 0x6B
  81. const m_ASCII_l = 108
  82. const m_ASCII_m = 109
  83. const m_ASCII_n = 110
  84. const m_ASCII_o = 111
  85. const m_ASCII_p = 112
  86. const m_ASCII_q = 0x71
  87. const m_ASCII_r = 114
  88. const m_ASCII_s = 115
  89. const m_ASCII_t = 116
  90. const m_ASCII_u = 0x75
  91. const m_ASCII_v = 0x76
  92. const m_ASCII_w = 119
  93. const m_ASCII_x = 120
  94. const m_ASCII_y = 0x79
  95. const m_ASCII_z = 0x7A
  96. const m_AT_EACCESS = 0x0100
  97. const m_AT_EMPTY_PATH = 0x4000
  98. const m_AT_REMOVEDIR = 0x0800
  99. const m_AT_RESOLVE_BENEATH = 0x2000
  100. const m_AT_SYMLINK_FOLLOW = 0x0400
  101. const m_AT_SYMLINK_NOFOLLOW = 0x0200
  102. const m_BC_BASE_MAX = 99
  103. const m_BC_DIM_MAX = 2048
  104. const m_BC_SCALE_MAX = 99
  105. const m_BC_STRING_MAX = 1000
  106. const m_BIG_ENDIAN = "_BIG_ENDIAN"
  107. const m_BUFSIZ = 1024
  108. const m_BYTEORDER = 1234
  109. const m_BYTE_ORDER = "_BYTE_ORDER"
  110. const m_CHARCLASS_NAME_MAX = 14
  111. const m_CHAR_BIT = "__CHAR_BIT"
  112. const m_CHAR_MAX = "SCHAR_MAX"
  113. const m_CHAR_MIN = "SCHAR_MIN"
  114. const m_CHILD_MAX = 40
  115. const m_CLK_TCK = 128
  116. const m_CLOCKS_PER_SEC = 128
  117. const m_CLOCK_BOOTTIME = "CLOCK_UPTIME"
  118. const m_CLOCK_MONOTONIC = 4
  119. const m_CLOCK_MONOTONIC_COARSE = "CLOCK_MONOTONIC_FAST"
  120. const m_CLOCK_MONOTONIC_FAST = 12
  121. const m_CLOCK_MONOTONIC_PRECISE = 11
  122. const m_CLOCK_PROCESS_CPUTIME_ID = 15
  123. const m_CLOCK_PROF = 2
  124. const m_CLOCK_REALTIME = 0
  125. const m_CLOCK_REALTIME_COARSE = "CLOCK_REALTIME_FAST"
  126. const m_CLOCK_REALTIME_FAST = 10
  127. const m_CLOCK_REALTIME_PRECISE = 9
  128. const m_CLOCK_SECOND = 13
  129. const m_CLOCK_THREAD_CPUTIME_ID = 14
  130. const m_CLOCK_UPTIME = 5
  131. const m_CLOCK_UPTIME_FAST = 8
  132. const m_CLOCK_UPTIME_PRECISE = 7
  133. const m_CLOCK_VIRTUAL = 1
  134. const m_COLL_WEIGHTS_MAX = 10
  135. const m_CPUCLOCK_WHICH_PID = 0
  136. const m_CPUCLOCK_WHICH_TID = 1
  137. const m_DST_AUST = 2
  138. const m_DST_CAN = 6
  139. const m_DST_EET = 5
  140. const m_DST_MET = 4
  141. const m_DST_NONE = 0
  142. const m_DST_USA = 1
  143. const m_DST_WET = 3
  144. const m_E2BIG = 7
  145. const m_EACCES = 13
  146. const m_EADDRINUSE = 48
  147. const m_EADDRNOTAVAIL = 49
  148. const m_EAFNOSUPPORT = 47
  149. const m_EAGAIN = 35
  150. const m_EALREADY = 37
  151. const m_EAUTH = 80
  152. const m_EBADF = 9
  153. const m_EBADMSG = 89
  154. const m_EBADRPC = 72
  155. const m_EBUSY = 16
  156. const m_ECANCELED = 85
  157. const m_ECAPMODE = 94
  158. const m_ECHILD = 10
  159. const m_ECONNABORTED = 53
  160. const m_ECONNREFUSED = 61
  161. const m_ECONNRESET = 54
  162. const m_EDEADLK = 11
  163. const m_EDESTADDRREQ = 39
  164. const m_EDOM = 33
  165. const m_EDOOFUS = 88
  166. const m_EDQUOT = 69
  167. const m_EEXIST = 17
  168. const m_EFAULT = 14
  169. const m_EFBIG = 27
  170. const m_EFTYPE = 79
  171. const m_EHOSTDOWN = 64
  172. const m_EHOSTUNREACH = 65
  173. const m_EIDRM = 82
  174. const m_EILSEQ = 86
  175. const m_EINPROGRESS = 36
  176. const m_EINTEGRITY = 97
  177. const m_EINTR = 4
  178. const m_EINVAL = 22
  179. const m_EIO = 5
  180. const m_EISCONN = 56
  181. const m_EISDIR = 21
  182. const m_ELAST = 97
  183. const m_ELOOP = 62
  184. const m_EMFILE = 24
  185. const m_EMLINK = 31
  186. const m_EMSGSIZE = 40
  187. const m_EMULTIHOP = 90
  188. const m_ENAMETOOLONG = 63
  189. const m_ENEEDAUTH = 81
  190. const m_ENETDOWN = 50
  191. const m_ENETRESET = 52
  192. const m_ENETUNREACH = 51
  193. const m_ENFILE = 23
  194. const m_ENOATTR = 87
  195. const m_ENOBUFS = 55
  196. const m_ENODEV = 19
  197. const m_ENOENT = 2
  198. const m_ENOEXEC = 8
  199. const m_ENOLCK = 77
  200. const m_ENOLINK = 91
  201. const m_ENOMEM = 12
  202. const m_ENOMSG = 83
  203. const m_ENOPROTOOPT = 42
  204. const m_ENOSPC = 28
  205. const m_ENOSYS = 78
  206. const m_ENOTBLK = 15
  207. const m_ENOTCAPABLE = 93
  208. const m_ENOTCONN = 57
  209. const m_ENOTDIR = 20
  210. const m_ENOTEMPTY = 66
  211. const m_ENOTRECOVERABLE = 95
  212. const m_ENOTSOCK = 38
  213. const m_ENOTSUP = "EOPNOTSUPP"
  214. const m_ENOTTY = 25
  215. const m_ENXIO = 6
  216. const m_EOPNOTSUPP = 45
  217. const m_EOVERFLOW = 84
  218. const m_EOWNERDEAD = 96
  219. const m_EPERM = 1
  220. const m_EPFNOSUPPORT = 46
  221. const m_EPIPE = 32
  222. const m_EPROCLIM = 67
  223. const m_EPROCUNAVAIL = 76
  224. const m_EPROGMISMATCH = 75
  225. const m_EPROGUNAVAIL = 74
  226. const m_EPROTO = 92
  227. const m_EPROTONOSUPPORT = 43
  228. const m_EPROTOTYPE = 41
  229. const m_ERANGE = 34
  230. const m_EREMOTE = 71
  231. const m_EROFS = 30
  232. const m_ERPCMISMATCH = 73
  233. const m_ESHUTDOWN = 58
  234. const m_ESOCKTNOSUPPORT = 44
  235. const m_ESPIPE = 29
  236. const m_ESRCH = 3
  237. const m_ESTALE = 70
  238. const m_ETIMEDOUT = 60
  239. const m_ETOOMANYREFS = 59
  240. const m_ETXTBSY = 26
  241. const m_EUSERS = 68
  242. const m_EWOULDBLOCK = "EAGAIN"
  243. const m_EXDEV = 18
  244. const m_EXIT_FAILURE = 1
  245. const m_EXIT_SUCCESS = 0
  246. const m_EXPAND_SPARE = 24
  247. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 8388608
  248. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 100
  249. const m_EXPAT_CONFIG_H = 1
  250. const m_EXPR_NEST_MAX = 32
  251. const m_Expat_External_INCLUDED = 1
  252. const m_Expat_INCLUDED = 1
  253. const m_FAPPEND = "O_APPEND"
  254. const m_FASYNC = "O_ASYNC"
  255. const m_FDSYNC = "O_DSYNC"
  256. const m_FD_CLOEXEC = 1
  257. const m_FD_SETSIZE = 1024
  258. const m_FFSYNC = "O_FSYNC"
  259. const m_FILENAME_MAX = 1024
  260. const m_FNDELAY = "O_NONBLOCK"
  261. const m_FNONBLOCK = "O_NONBLOCK"
  262. const m_FOPEN_MAX = 20
  263. const m_FP_FAST_FMAF = 1
  264. const m_FP_ILOGBNAN = "__INT_MAX"
  265. const m_FP_INFINITE = 0x01
  266. const m_FP_NAN = 0x02
  267. const m_FP_NORMAL = 0x04
  268. const m_FP_SUBNORMAL = 0x08
  269. const m_FP_ZERO = 0x10
  270. const m_FRDAHEAD = "O_CREAT"
  271. const m_FREAD = 0x0001
  272. const m_FWRITE = 0x0002
  273. const m_F_ADD_SEALS = 19
  274. const m_F_CANCEL = 5
  275. const m_F_DUP2FD = 10
  276. const m_F_DUP2FD_CLOEXEC = 18
  277. const m_F_DUPFD = 0
  278. const m_F_DUPFD_CLOEXEC = 17
  279. const m_F_GETFD = 1
  280. const m_F_GETFL = 3
  281. const m_F_GETLK = 11
  282. const m_F_GETOWN = 5
  283. const m_F_GET_SEALS = 20
  284. const m_F_ISUNIONSTACK = 21
  285. const m_F_KINFO = 22
  286. const m_F_LOCK = 1
  287. const m_F_OGETLK = 7
  288. const m_F_OK = 0
  289. const m_F_OSETLK = 8
  290. const m_F_OSETLKW = 9
  291. const m_F_RDAHEAD = 16
  292. const m_F_RDLCK = 1
  293. const m_F_READAHEAD = 15
  294. const m_F_SEAL_GROW = 0x0004
  295. const m_F_SEAL_SEAL = 0x0001
  296. const m_F_SEAL_SHRINK = 0x0002
  297. const m_F_SEAL_WRITE = 0x0008
  298. const m_F_SETFD = 2
  299. const m_F_SETFL = 4
  300. const m_F_SETLK = 12
  301. const m_F_SETLKW = 13
  302. const m_F_SETLK_REMOTE = 14
  303. const m_F_SETOWN = 6
  304. const m_F_TEST = 3
  305. const m_F_TLOCK = 2
  306. const m_F_ULOCK = 0
  307. const m_F_UNLCK = 2
  308. const m_F_UNLCKSYS = 4
  309. const m_F_WRLCK = 3
  310. const m_GID_MAX = "UINT_MAX"
  311. const m_GRND_INSECURE = 0x4
  312. const m_GRND_NONBLOCK = 0x1
  313. const m_GRND_RANDOM = 0x2
  314. const m_HAVE_ARC4RANDOM_BUF = 1
  315. const m_HAVE_CONFIG_H = 1
  316. const m_HAVE_DLFCN_H = 1
  317. const m_HAVE_FCNTL_H = 1
  318. const m_HAVE_GETPAGESIZE = 1
  319. const m_HAVE_GETRANDOM = 1
  320. const m_HAVE_INTTYPES_H = 1
  321. const m_HAVE_MMAP = 1
  322. const m_HAVE_STDINT_H = 1
  323. const m_HAVE_STDIO_H = 1
  324. const m_HAVE_STDLIB_H = 1
  325. const m_HAVE_STRINGS_H = 1
  326. const m_HAVE_STRING_H = 1
  327. const m_HAVE_SYSCALL_GETRANDOM = 1
  328. const m_HAVE_SYS_PARAM_H = 1
  329. const m_HAVE_SYS_STAT_H = 1
  330. const m_HAVE_SYS_TYPES_H = 1
  331. const m_HAVE_UNISTD_H = 1
  332. const m_HUGE = "MAXFLOAT"
  333. const m_INIT_ATTS_SIZE = 16
  334. const m_INIT_ATTS_VERSION = 4294967295
  335. const m_INIT_BLOCK_SIZE = 1024
  336. const m_INIT_BUFFER_SIZE = 1024
  337. const m_INIT_DATA_BUF_SIZE = 1024
  338. const m_INIT_POWER = 6
  339. const m_INIT_SCAFFOLD_ELEMENTS = 32
  340. const m_INIT_TAG_BUF_SIZE = 32
  341. const m_INT16_MAX = 0x7fff
  342. const m_INT32_MAX = 0x7fffffff
  343. const m_INT64_MAX = 0x7fffffffffffffff
  344. const m_INT8_MAX = 0x7f
  345. const m_INTMAX_MAX = "INT64_MAX"
  346. const m_INTMAX_MIN = "INT64_MIN"
  347. const m_INTPTR_MAX = "INT64_MAX"
  348. const m_INTPTR_MIN = "INT64_MIN"
  349. const m_INT_FAST16_MAX = "INT32_MAX"
  350. const m_INT_FAST16_MIN = "INT32_MIN"
  351. const m_INT_FAST32_MAX = "INT32_MAX"
  352. const m_INT_FAST32_MIN = "INT32_MIN"
  353. const m_INT_FAST64_MAX = "INT64_MAX"
  354. const m_INT_FAST64_MIN = "INT64_MIN"
  355. const m_INT_FAST8_MAX = "INT32_MAX"
  356. const m_INT_FAST8_MIN = "INT32_MIN"
  357. const m_INT_LEAST16_MAX = "INT16_MAX"
  358. const m_INT_LEAST16_MIN = "INT16_MIN"
  359. const m_INT_LEAST32_MAX = "INT32_MAX"
  360. const m_INT_LEAST32_MIN = "INT32_MIN"
  361. const m_INT_LEAST64_MAX = "INT64_MAX"
  362. const m_INT_LEAST64_MIN = "INT64_MIN"
  363. const m_INT_LEAST8_MAX = "INT8_MAX"
  364. const m_INT_LEAST8_MIN = "INT8_MIN"
  365. const m_INT_MAX = "__INT_MAX"
  366. const m_INT_MIN = "__INT_MIN"
  367. const m_IOV_MAX = 1024
  368. const m_ITIMER_PROF = 2
  369. const m_ITIMER_REAL = 0
  370. const m_ITIMER_VIRTUAL = 1
  371. const m_KCMP_FILE = 100
  372. const m_KCMP_FILEOBJ = 101
  373. const m_KCMP_FILES = 102
  374. const m_KCMP_SIGHAND = 103
  375. const m_KCMP_VM = 104
  376. const m_LINE_MAX = 2048
  377. const m_LITTLE_ENDIAN = "_LITTLE_ENDIAN"
  378. const m_LLONG_MAX = "__LLONG_MAX"
  379. const m_LLONG_MIN = "__LLONG_MIN"
  380. const m_LOCK_EX = 0x02
  381. const m_LOCK_NB = 0x04
  382. const m_LOCK_SH = 0x01
  383. const m_LOCK_UN = 0x08
  384. const m_LONG_BIT = "__LONG_BIT"
  385. const m_LONG_MAX = "__LONG_MAX"
  386. const m_LONG_MIN = "__LONG_MIN"
  387. const m_LT_OBJDIR = ".libs/"
  388. const m_L_INCR = "SEEK_CUR"
  389. const m_L_SET = "SEEK_SET"
  390. const m_L_XTND = "SEEK_END"
  391. const m_L_ctermid = 1024
  392. const m_L_cuserid = 17
  393. const m_L_tmpnam = 1024
  394. const m_MATH_ERREXCEPT = 2
  395. const m_MATH_ERRNO = 1
  396. const m_MAX_CANON = 255
  397. const m_MAX_INPUT = 255
  398. const m_MB_LEN_MAX = 6
  399. const m_MQ_PRIO_MAX = 64
  400. const m_M_1_PI = 0.31830988618379067154
  401. const m_M_2_PI = 0.63661977236758134308
  402. const m_M_2_SQRTPI = 1.12837916709551257390
  403. const m_M_E = 2.7182818284590452354
  404. const m_M_LN10 = 2.30258509299404568402
  405. const m_M_LN2 = 0.69314718055994530942
  406. const m_M_LOG10E = 0.43429448190325182765
  407. const m_M_LOG2E = 1.4426950408889634074
  408. const m_M_PI = 3.14159265358979323846
  409. const m_M_PI_2 = 1.57079632679489661923
  410. const m_M_PI_4 = 0.78539816339744830962
  411. const m_M_SQRT1_2 = 0.70710678118654752440
  412. const m_M_SQRT2 = 1.41421356237309504880
  413. const m_NAME_MAX = 255
  414. const m_NDEBUG = 1
  415. const m_NFDBITS = "_NFDBITS"
  416. const m_NGROUPS_MAX = 1023
  417. const m_NL_ARGMAX = 4096
  418. const m_NL_LANGMAX = 31
  419. const m_NL_MSGMAX = 32767
  420. const m_NL_NMAX = 1
  421. const m_NL_SETMAX = 255
  422. const m_NL_TEXTMAX = 2048
  423. const m_OFF_MAX = "__OFF_MAX"
  424. const m_OFF_MIN = "__OFF_MIN"
  425. const m_OPEN_MAX = 64
  426. const m_O_ACCMODE = 0x0003
  427. const m_O_APPEND = 0x0008
  428. const m_O_ASYNC = 0x0040
  429. const m_O_CLOEXEC = 0x00100000
  430. const m_O_CREAT = 0x0200
  431. const m_O_DIRECT = 0x00010000
  432. const m_O_DIRECTORY = 0x00020000
  433. const m_O_DSYNC = 0x01000000
  434. const m_O_EMPTY_PATH = 0x02000000
  435. const m_O_EXCL = 0x0800
  436. const m_O_EXEC = 0x00040000
  437. const m_O_EXLOCK = 0x0020
  438. const m_O_FSYNC = 0x0080
  439. const m_O_NDELAY = "O_NONBLOCK"
  440. const m_O_NOCTTY = 0x8000
  441. const m_O_NOFOLLOW = 0x0100
  442. const m_O_NONBLOCK = 0x0004
  443. const m_O_PATH = 0x00400000
  444. const m_O_RDONLY = 0x0000
  445. const m_O_RDWR = 0x0002
  446. const m_O_RESOLVE_BENEATH = 0x00800000
  447. const m_O_SEARCH = "O_EXEC"
  448. const m_O_SHLOCK = 0x0010
  449. const m_O_SYNC = 0x0080
  450. const m_O_TRUNC = 0x0400
  451. const m_O_TTY_INIT = 0x00080000
  452. const m_O_VERIFY = 0x00200000
  453. const m_O_WRONLY = 0x0001
  454. const m_PACKAGE = "expat"
  455. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  456. const m_PACKAGE_NAME = "expat"
  457. const m_PACKAGE_STRING = "expat 2.5.0"
  458. const m_PACKAGE_TARNAME = "expat"
  459. const m_PACKAGE_URL = ""
  460. const m_PACKAGE_VERSION = "2.5.0"
  461. const m_PASS_MAX = 128
  462. const m_PATH_MAX = 1024
  463. const m_PDP_ENDIAN = "_PDP_ENDIAN"
  464. const m_PIPE_BUF = 512
  465. const m_POSIX_FADV_DONTNEED = 4
  466. const m_POSIX_FADV_NOREUSE = 5
  467. const m_POSIX_FADV_NORMAL = 0
  468. const m_POSIX_FADV_RANDOM = 1
  469. const m_POSIX_FADV_SEQUENTIAL = 2
  470. const m_POSIX_FADV_WILLNEED = 3
  471. const m_PTRDIFF_MAX = "INT64_MAX"
  472. const m_PTRDIFF_MIN = "INT64_MIN"
  473. const m_P_tmpdir = "/tmp/"
  474. const m_QUAD_MAX = "__QUAD_MAX"
  475. const m_QUAD_MIN = "__QUAD_MIN"
  476. const m_RAND_MAX = 0x7fffffff
  477. const m_RE_DUP_MAX = 255
  478. const m_RFTSIGMASK = 0xFF
  479. const m_RFTSIGSHIFT = 20
  480. const m_R_OK = 0x04
  481. const m_SBT_MAX = 0x7fffffffffffffff
  482. const m_SCHAR_MAX = "__SCHAR_MAX"
  483. const m_SCHAR_MIN = "__SCHAR_MIN"
  484. const m_SEEK_CUR = 1
  485. const m_SEEK_DATA = 3
  486. const m_SEEK_END = 2
  487. const m_SEEK_HOLE = 4
  488. const m_SEEK_SET = 0
  489. const m_SHRT_MAX = "__SHRT_MAX"
  490. const m_SHRT_MIN = "__SHRT_MIN"
  491. const m_SIG_ATOMIC_MAX = "INT64_MAX"
  492. const m_SIG_ATOMIC_MIN = "INT64_MIN"
  493. const m_SIP_KEYLEN = 16
  494. const m_SIZE_MAX = "UINT64_MAX"
  495. const m_SIZE_T_MAX = "__SIZE_T_MAX"
  496. const m_SPACECTL_DEALLOC = 1
  497. const m_SPACECTL_F_SUPPORTED = 0
  498. const m_SSIZE_MAX = "__SSIZE_MAX"
  499. const m_STDC_HEADERS = 1
  500. const m_STDERR_FILENO = 2
  501. const m_STDIN_FILENO = 0
  502. const m_STDOUT_FILENO = 1
  503. const m_SWAPOFF_FORCE = 0x00000001
  504. const m_TIMER_ABSTIME = 0x1
  505. const m_TIMER_RELTIME = 0x0
  506. const m_TIME_MONOTONIC = 2
  507. const m_TIME_UTC = 1
  508. const m_TMP_MAX = 308915776
  509. const m_UCHAR_MAX = "__UCHAR_MAX"
  510. const m_UID_MAX = "UINT_MAX"
  511. const m_UINT16_MAX = 0xffff
  512. const m_UINT32_MAX = 0xffffffff
  513. const m_UINT64_MAX = 0xffffffffffffffff
  514. const m_UINT8_MAX = 0xff
  515. const m_UINTMAX_MAX = "UINT64_MAX"
  516. const m_UINTPTR_MAX = "UINT64_MAX"
  517. const m_UINT_FAST16_MAX = "UINT32_MAX"
  518. const m_UINT_FAST32_MAX = "UINT32_MAX"
  519. const m_UINT_FAST64_MAX = "UINT64_MAX"
  520. const m_UINT_FAST8_MAX = "UINT32_MAX"
  521. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  522. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  523. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  524. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  525. const m_UINT_MAX = "__UINT_MAX"
  526. const m_ULLONG_MAX = "__ULLONG_MAX"
  527. const m_ULONG_MAX = "__ULONG_MAX"
  528. const m_UQUAD_MAX = "__UQUAD_MAX"
  529. const m_USHRT_MAX = "__USHRT_MAX"
  530. const m_VERSION = "2.5.0"
  531. const m_WCHAR_MAX = "__WCHAR_MAX"
  532. const m_WCHAR_MIN = "__WCHAR_MIN"
  533. const m_WINT_MAX = "INT32_MAX"
  534. const m_WINT_MIN = "INT32_MIN"
  535. const m_WORD_BIT = "__WORD_BIT"
  536. const m_W_OK = 0x02
  537. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  538. const m_XML_BUILDING_EXPAT = 1
  539. const m_XML_CDATA_SECTION_STATE = 2
  540. const m_XML_CONTENT_STATE = 1
  541. const m_XML_CONTEXT_BYTES = 1024
  542. const m_XML_DEV_URANDOM = 1
  543. const m_XML_DTD = 1
  544. const m_XML_ENABLE_VISIBILITY = 0
  545. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  546. const m_XML_ENTITY_VALUE_LITERAL = 1
  547. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  548. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  549. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  550. const m_XML_IGNORE_SECTION_STATE = 3
  551. const m_XML_MAJOR_VERSION = 2
  552. const m_XML_MICRO_VERSION = 0
  553. const m_XML_MINOR_VERSION = 5
  554. const m_XML_NS = 1
  555. const m_XML_N_LITERAL_TYPES = 2
  556. const m_XML_N_STATES = 4
  557. const m_XML_PROLOG_STATE = 0
  558. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  559. const m_XML_TOK_BOM = 14
  560. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  561. const m_XML_TOK_CDATA_SECT_OPEN = 8
  562. const m_XML_TOK_CHAR_REF = 10
  563. const m_XML_TOK_CLOSE_BRACKET = 26
  564. const m_XML_TOK_CLOSE_PAREN = 24
  565. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  566. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  567. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  568. const m_XML_TOK_COMMA = 38
  569. const m_XML_TOK_COMMENT = 13
  570. const m_XML_TOK_COND_SECT_CLOSE = 34
  571. const m_XML_TOK_COND_SECT_OPEN = 33
  572. const m_XML_TOK_DATA_CHARS = 6
  573. const m_XML_TOK_DATA_NEWLINE = 7
  574. const m_XML_TOK_DECL_CLOSE = 17
  575. const m_XML_TOK_DECL_OPEN = 16
  576. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  577. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  578. const m_XML_TOK_END_TAG = 5
  579. const m_XML_TOK_ENTITY_REF = 9
  580. const m_XML_TOK_IGNORE_SECT = 42
  581. const m_XML_TOK_INSTANCE_START = 29
  582. const m_XML_TOK_INVALID = 0
  583. const m_XML_TOK_LITERAL = 27
  584. const m_XML_TOK_NAME = 18
  585. const m_XML_TOK_NAME_ASTERISK = 31
  586. const m_XML_TOK_NAME_PLUS = 32
  587. const m_XML_TOK_NAME_QUESTION = 30
  588. const m_XML_TOK_NMTOKEN = 19
  589. const m_XML_TOK_OPEN_BRACKET = 25
  590. const m_XML_TOK_OPEN_PAREN = 23
  591. const m_XML_TOK_OR = 21
  592. const m_XML_TOK_PARAM_ENTITY_REF = 28
  593. const m_XML_TOK_PERCENT = 22
  594. const m_XML_TOK_PI = 11
  595. const m_XML_TOK_POUND_NAME = 20
  596. const m_XML_TOK_PREFIXED_NAME = 41
  597. const m_XML_TOK_PROLOG_S = 15
  598. const m_XML_TOK_START_TAG_NO_ATTS = 2
  599. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  600. const m_XML_TOK_XML_DECL = 12
  601. const m_XML_UTF16_ENCODE_MAX = 2
  602. const m_XML_UTF8_ENCODE_MAX = 4
  603. const m_X_OK = 0x01
  604. const m_XmlConvert = "XmlUtf8Convert"
  605. const m_XmlEncode = "XmlUtf8Encode"
  606. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  607. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  608. const m_XmlRole_INCLUDED = 1
  609. const m_XmlTok_INCLUDED = 1
  610. const m__BYTE_ORDER = "__BYTE_ORDER__"
  611. const m__CS_PATH = 1
  612. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2
  613. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3
  614. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 4
  615. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5
  616. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6
  617. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7
  618. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 8
  619. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9
  620. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 10
  621. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11
  622. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12
  623. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13
  624. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14
  625. const m__GNU_SOURCE = 1
  626. const m__IOFBF = 0
  627. const m__IOLBF = 1
  628. const m__IONBF = 2
  629. const m__LP64 = 1
  630. const m__PC_ACL_EXTENDED = 59
  631. const m__PC_ACL_NFS4 = 64
  632. const m__PC_ACL_PATH_MAX = 60
  633. const m__PC_ALLOC_SIZE_MIN = 10
  634. const m__PC_ASYNC_IO = 53
  635. const m__PC_CAP_PRESENT = 61
  636. const m__PC_CHOWN_RESTRICTED = 7
  637. const m__PC_DEALLOC_PRESENT = 65
  638. const m__PC_FILESIZEBITS = 12
  639. const m__PC_INF_PRESENT = 62
  640. const m__PC_LINK_MAX = 1
  641. const m__PC_MAC_PRESENT = 63
  642. const m__PC_MAX_CANON = 2
  643. const m__PC_MAX_INPUT = 3
  644. const m__PC_MIN_HOLE_SIZE = 21
  645. const m__PC_NAME_MAX = 4
  646. const m__PC_NO_TRUNC = 8
  647. const m__PC_PATH_MAX = 5
  648. const m__PC_PIPE_BUF = 6
  649. const m__PC_PRIO_IO = 54
  650. const m__PC_REC_INCR_XFER_SIZE = 14
  651. const m__PC_REC_MAX_XFER_SIZE = 15
  652. const m__PC_REC_MIN_XFER_SIZE = 16
  653. const m__PC_REC_XFER_ALIGN = 17
  654. const m__PC_SYMLINK_MAX = 18
  655. const m__PC_SYNC_IO = 55
  656. const m__PC_VDISABLE = 9
  657. const m__PDP_ENDIAN = "__ORDER_PDP_ENDIAN__"
  658. const m__POSIX2_BC_BASE_MAX = 99
  659. const m__POSIX2_BC_DIM_MAX = 2048
  660. const m__POSIX2_BC_SCALE_MAX = 99
  661. const m__POSIX2_BC_STRING_MAX = 1000
  662. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  663. const m__POSIX2_CHAR_TERM = 1
  664. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  665. const m__POSIX2_C_BIND = 200112
  666. const m__POSIX2_EQUIV_CLASS_MAX = 2
  667. const m__POSIX2_EXPR_NEST_MAX = 32
  668. const m__POSIX2_FORT_RUN = 200112
  669. const m__POSIX2_LINE_MAX = 2048
  670. const m__POSIX2_RE_DUP_MAX = 255
  671. const m__POSIX2_UPE = 200112
  672. const m__POSIX2_VERSION = 199212
  673. const m__POSIX_ADVISORY_INFO = 200112
  674. const m__POSIX_AIO_LISTIO_MAX = 2
  675. const m__POSIX_AIO_MAX = 1
  676. const m__POSIX_ARG_MAX = 4096
  677. const m__POSIX_ASYNCHRONOUS_IO = 200112
  678. const m__POSIX_BARRIERS = 200112
  679. const m__POSIX_CHILD_MAX = 25
  680. const m__POSIX_CHOWN_RESTRICTED = 1
  681. const m__POSIX_CLOCKRES_MIN = 20000000
  682. const m__POSIX_CPUTIME = 200112
  683. const m__POSIX_DELAYTIMER_MAX = 32
  684. const m__POSIX_FSYNC = 200112
  685. const m__POSIX_HOST_NAME_MAX = 255
  686. const m__POSIX_IPV6 = 0
  687. const m__POSIX_JOB_CONTROL = 1
  688. const m__POSIX_LINK_MAX = 8
  689. const m__POSIX_LOGIN_NAME_MAX = 9
  690. const m__POSIX_MAPPED_FILES = 200112
  691. const m__POSIX_MAX_CANON = 255
  692. const m__POSIX_MAX_INPUT = 255
  693. const m__POSIX_MEMLOCK_RANGE = 200112
  694. const m__POSIX_MEMORY_PROTECTION = 200112
  695. const m__POSIX_MESSAGE_PASSING = 200112
  696. const m__POSIX_MONOTONIC_CLOCK = 200112
  697. const m__POSIX_MQ_OPEN_MAX = 8
  698. const m__POSIX_MQ_PRIO_MAX = 32
  699. const m__POSIX_NAME_MAX = 14
  700. const m__POSIX_NGROUPS_MAX = 8
  701. const m__POSIX_NO_TRUNC = 1
  702. const m__POSIX_OPEN_MAX = 20
  703. const m__POSIX_PATH_MAX = 256
  704. const m__POSIX_PIPE_BUF = 512
  705. const m__POSIX_PRIORITY_SCHEDULING = 0
  706. const m__POSIX_RAW_SOCKETS = 200112
  707. const m__POSIX_READER_WRITER_LOCKS = 200112
  708. const m__POSIX_REALTIME_SIGNALS = 200112
  709. const m__POSIX_REGEXP = 1
  710. const m__POSIX_RE_DUP_MAX = "_POSIX2_RE_DUP_MAX"
  711. const m__POSIX_RTSIG_MAX = 8
  712. const m__POSIX_SEMAPHORES = 200112
  713. const m__POSIX_SEM_NSEMS_MAX = 256
  714. const m__POSIX_SEM_VALUE_MAX = 32767
  715. const m__POSIX_SHARED_MEMORY_OBJECTS = 200112
  716. const m__POSIX_SHELL = 1
  717. const m__POSIX_SIGQUEUE_MAX = 32
  718. const m__POSIX_SPAWN = 200112
  719. const m__POSIX_SPIN_LOCKS = 200112
  720. const m__POSIX_SSIZE_MAX = 32767
  721. const m__POSIX_SS_REPL_MAX = 4
  722. const m__POSIX_STREAM_MAX = 8
  723. const m__POSIX_SYMLINK_MAX = 255
  724. const m__POSIX_SYMLOOP_MAX = 8
  725. const m__POSIX_THREADS = 200112
  726. const m__POSIX_THREAD_ATTR_STACKADDR = 200112
  727. const m__POSIX_THREAD_ATTR_STACKSIZE = 200112
  728. const m__POSIX_THREAD_CPUTIME = 200112
  729. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  730. const m__POSIX_THREAD_KEYS_MAX = 128
  731. const m__POSIX_THREAD_PRIORITY_SCHEDULING = 200112
  732. const m__POSIX_THREAD_PRIO_INHERIT = 200112
  733. const m__POSIX_THREAD_PRIO_PROTECT = 200112
  734. const m__POSIX_THREAD_PROCESS_SHARED = 200112
  735. const m__POSIX_THREAD_THREADS_MAX = 64
  736. const m__POSIX_TIMEOUTS = 200112
  737. const m__POSIX_TIMERS = 200112
  738. const m__POSIX_TIMER_MAX = 32
  739. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  740. const m__POSIX_TRACE_NAME_MAX = 8
  741. const m__POSIX_TRACE_SYS_MAX = 8
  742. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  743. const m__POSIX_TTY_NAME_MAX = 9
  744. const m__POSIX_TZNAME_MAX = 6
  745. const m__POSIX_VDISABLE = 0xff
  746. const m__POSIX_VERSION = 200112
  747. const m__QUAD_HIGHWORD = 1
  748. const m__QUAD_LOWWORD = 0
  749. const m__SC_2_CHAR_TERM = 20
  750. const m__SC_2_C_BIND = 18
  751. const m__SC_2_C_DEV = 19
  752. const m__SC_2_FORT_DEV = 21
  753. const m__SC_2_FORT_RUN = 22
  754. const m__SC_2_LOCALEDEF = 23
  755. const m__SC_2_PBS = 59
  756. const m__SC_2_PBS_ACCOUNTING = 60
  757. const m__SC_2_PBS_CHECKPOINT = 61
  758. const m__SC_2_PBS_LOCATE = 62
  759. const m__SC_2_PBS_MESSAGE = 63
  760. const m__SC_2_PBS_TRACK = 64
  761. const m__SC_2_SW_DEV = 24
  762. const m__SC_2_UPE = 25
  763. const m__SC_2_VERSION = 17
  764. const m__SC_ADVISORY_INFO = 65
  765. const m__SC_AIO_LISTIO_MAX = 42
  766. const m__SC_AIO_MAX = 43
  767. const m__SC_AIO_PRIO_DELTA_MAX = 44
  768. const m__SC_ARG_MAX = 1
  769. const m__SC_ASYNCHRONOUS_IO = 28
  770. const m__SC_ATEXIT_MAX = 107
  771. const m__SC_BARRIERS = 66
  772. const m__SC_BC_BASE_MAX = 9
  773. const m__SC_BC_DIM_MAX = 10
  774. const m__SC_BC_SCALE_MAX = 11
  775. const m__SC_BC_STRING_MAX = 12
  776. const m__SC_CHILD_MAX = 2
  777. const m__SC_CLK_TCK = 3
  778. const m__SC_CLOCK_SELECTION = 67
  779. const m__SC_COLL_WEIGHTS_MAX = 13
  780. const m__SC_CPUSET_SIZE = 122
  781. const m__SC_CPUTIME = 68
  782. const m__SC_DELAYTIMER_MAX = 45
  783. const m__SC_EXPR_NEST_MAX = 14
  784. const m__SC_FILE_LOCKING = 69
  785. const m__SC_FSYNC = 38
  786. const m__SC_GETGR_R_SIZE_MAX = 70
  787. const m__SC_GETPW_R_SIZE_MAX = 71
  788. const m__SC_HOST_NAME_MAX = 72
  789. const m__SC_IOV_MAX = 56
  790. const m__SC_IPV6 = 118
  791. const m__SC_JOB_CONTROL = 6
  792. const m__SC_LINE_MAX = 15
  793. const m__SC_LOGIN_NAME_MAX = 73
  794. const m__SC_MAPPED_FILES = 29
  795. const m__SC_MEMLOCK = 30
  796. const m__SC_MEMLOCK_RANGE = 31
  797. const m__SC_MEMORY_PROTECTION = 32
  798. const m__SC_MESSAGE_PASSING = 33
  799. const m__SC_MONOTONIC_CLOCK = 74
  800. const m__SC_MQ_OPEN_MAX = 46
  801. const m__SC_MQ_PRIO_MAX = 75
  802. const m__SC_NGROUPS_MAX = 4
  803. const m__SC_NPROCESSORS_CONF = 57
  804. const m__SC_NPROCESSORS_ONLN = 58
  805. const m__SC_OPEN_MAX = 5
  806. const m__SC_PAGESIZE = 47
  807. const m__SC_PAGE_SIZE = "_SC_PAGESIZE"
  808. const m__SC_PHYS_PAGES = 121
  809. const m__SC_PRIORITIZED_IO = 34
  810. const m__SC_PRIORITY_SCHEDULING = 35
  811. const m__SC_RAW_SOCKETS = 119
  812. const m__SC_READER_WRITER_LOCKS = 76
  813. const m__SC_REALTIME_SIGNALS = 36
  814. const m__SC_REGEXP = 77
  815. const m__SC_RE_DUP_MAX = 16
  816. const m__SC_RTSIG_MAX = 48
  817. const m__SC_SAVED_IDS = 7
  818. const m__SC_SEMAPHORES = 37
  819. const m__SC_SEM_NSEMS_MAX = 49
  820. const m__SC_SEM_VALUE_MAX = 50
  821. const m__SC_SHARED_MEMORY_OBJECTS = 39
  822. const m__SC_SHELL = 78
  823. const m__SC_SIGQUEUE_MAX = 51
  824. const m__SC_SPAWN = 79
  825. const m__SC_SPIN_LOCKS = 80
  826. const m__SC_SPORADIC_SERVER = 81
  827. const m__SC_STREAM_MAX = 26
  828. const m__SC_SYMLOOP_MAX = 120
  829. const m__SC_SYNCHRONIZED_IO = 40
  830. const m__SC_THREADS = 96
  831. const m__SC_THREAD_ATTR_STACKADDR = 82
  832. const m__SC_THREAD_ATTR_STACKSIZE = 83
  833. const m__SC_THREAD_CPUTIME = 84
  834. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 85
  835. const m__SC_THREAD_KEYS_MAX = 86
  836. const m__SC_THREAD_PRIORITY_SCHEDULING = 89
  837. const m__SC_THREAD_PRIO_INHERIT = 87
  838. const m__SC_THREAD_PRIO_PROTECT = 88
  839. const m__SC_THREAD_PROCESS_SHARED = 90
  840. const m__SC_THREAD_SAFE_FUNCTIONS = 91
  841. const m__SC_THREAD_SPORADIC_SERVER = 92
  842. const m__SC_THREAD_STACK_MIN = 93
  843. const m__SC_THREAD_THREADS_MAX = 94
  844. const m__SC_TIMEOUTS = 95
  845. const m__SC_TIMERS = 41
  846. const m__SC_TIMER_MAX = 52
  847. const m__SC_TRACE = 97
  848. const m__SC_TRACE_EVENT_FILTER = 98
  849. const m__SC_TRACE_INHERIT = 99
  850. const m__SC_TRACE_LOG = 100
  851. const m__SC_TTY_NAME_MAX = 101
  852. const m__SC_TYPED_MEMORY_OBJECTS = 102
  853. const m__SC_TZNAME_MAX = 27
  854. const m__SC_V6_ILP32_OFF32 = 103
  855. const m__SC_V6_ILP32_OFFBIG = 104
  856. const m__SC_V6_LP64_OFF64 = 105
  857. const m__SC_V6_LPBIG_OFFBIG = 106
  858. const m__SC_VERSION = 8
  859. const m__SC_XOPEN_CRYPT = 108
  860. const m__SC_XOPEN_ENH_I18N = 109
  861. const m__SC_XOPEN_LEGACY = 110
  862. const m__SC_XOPEN_REALTIME = 111
  863. const m__SC_XOPEN_REALTIME_THREADS = 112
  864. const m__SC_XOPEN_SHM = 113
  865. const m__SC_XOPEN_STREAMS = 114
  866. const m__SC_XOPEN_UNIX = 115
  867. const m__SC_XOPEN_VERSION = 116
  868. const m__SC_XOPEN_XCU_VERSION = 117
  869. const m__SIG_MAXSIG = 128
  870. const m__SIG_WORDS = 4
  871. const m__V6_ILP32_OFFBIG = 0
  872. const m__V6_LP64_OFF64 = 0
  873. const m__XOPEN_IOV_MAX = 16
  874. const m__XOPEN_NAME_MAX = 255
  875. const m__XOPEN_PATH_MAX = 1024
  876. const m__XOPEN_SHM = 1
  877. const m___ATOMIC_ACQUIRE = 2
  878. const m___ATOMIC_ACQ_REL = 4
  879. const m___ATOMIC_CONSUME = 1
  880. const m___ATOMIC_RELAXED = 0
  881. const m___ATOMIC_RELEASE = 3
  882. const m___ATOMIC_SEQ_CST = 5
  883. const m___BIGGEST_ALIGNMENT__ = 16
  884. const m___BITINT_MAXWIDTH__ = 8388608
  885. const m___BOOL_WIDTH__ = 8
  886. const m___BSD_VISIBLE = 1
  887. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  888. const m___CCGO__ = 1
  889. const m___CC_SUPPORTS_DYNAMIC_ARRAY_INIT = 1
  890. const m___CC_SUPPORTS_INLINE = 1
  891. const m___CC_SUPPORTS_VARADIC_XXX = 1
  892. const m___CC_SUPPORTS_WARNING = 1
  893. const m___CC_SUPPORTS___FUNC__ = 1
  894. const m___CC_SUPPORTS___INLINE = 1
  895. const m___CC_SUPPORTS___INLINE__ = 1
  896. const m___CHAR_BIT = 8
  897. const m___CHAR_BIT__ = 8
  898. const m___CLANG_ATOMIC_BOOL_LOCK_FREE = 2
  899. const m___CLANG_ATOMIC_CHAR16_T_LOCK_FREE = 2
  900. const m___CLANG_ATOMIC_CHAR32_T_LOCK_FREE = 2
  901. const m___CLANG_ATOMIC_CHAR_LOCK_FREE = 2
  902. const m___CLANG_ATOMIC_INT_LOCK_FREE = 2
  903. const m___CLANG_ATOMIC_LLONG_LOCK_FREE = 2
  904. const m___CLANG_ATOMIC_LONG_LOCK_FREE = 2
  905. const m___CLANG_ATOMIC_POINTER_LOCK_FREE = 2
  906. const m___CLANG_ATOMIC_SHORT_LOCK_FREE = 2
  907. const m___CLANG_ATOMIC_WCHAR_T_LOCK_FREE = 2
  908. const m___CONSTANT_CFSTRINGS__ = 1
  909. const m___DBL_DECIMAL_DIG__ = 17
  910. const m___DBL_DENORM_MIN__ = 4.9406564584124654e-324
  911. const m___DBL_DIG__ = 15
  912. const m___DBL_EPSILON__ = 2.2204460492503131e-16
  913. const m___DBL_HAS_DENORM__ = 1
  914. const m___DBL_HAS_INFINITY__ = 1
  915. const m___DBL_HAS_QUIET_NAN__ = 1
  916. const m___DBL_MANT_DIG__ = 53
  917. const m___DBL_MAX_10_EXP__ = 308
  918. const m___DBL_MAX_EXP__ = 1024
  919. const m___DBL_MAX__ = 1.7976931348623157e+308
  920. const m___DBL_MIN__ = 2.2250738585072014e-308
  921. const m___DECIMAL_DIG__ = "__LDBL_DECIMAL_DIG__"
  922. const m___ELF__ = 1
  923. const m___EXT1_VISIBLE = 1
  924. const m___FINITE_MATH_ONLY__ = 0
  925. const m___FLOAT128__ = 1
  926. const m___FLT16_DECIMAL_DIG__ = 5
  927. const m___FLT16_DENORM_MIN__ = 5.9604644775390625e-8
  928. const m___FLT16_DIG__ = 3
  929. const m___FLT16_EPSILON__ = 9.765625e-4
  930. const m___FLT16_HAS_DENORM__ = 1
  931. const m___FLT16_HAS_INFINITY__ = 1
  932. const m___FLT16_HAS_QUIET_NAN__ = 1
  933. const m___FLT16_MANT_DIG__ = 11
  934. const m___FLT16_MAX_10_EXP__ = 4
  935. const m___FLT16_MAX_EXP__ = 16
  936. const m___FLT16_MAX__ = 6.5504e+4
  937. const m___FLT16_MIN__ = 6.103515625e-5
  938. const m___FLT_DECIMAL_DIG__ = 9
  939. const m___FLT_DENORM_MIN__ = 1.40129846e-45
  940. const m___FLT_DIG__ = 6
  941. const m___FLT_EPSILON__ = 1.19209290e-7
  942. const m___FLT_HAS_DENORM__ = 1
  943. const m___FLT_HAS_INFINITY__ = 1
  944. const m___FLT_HAS_QUIET_NAN__ = 1
  945. const m___FLT_MANT_DIG__ = 24
  946. const m___FLT_MAX_10_EXP__ = 38
  947. const m___FLT_MAX_EXP__ = 128
  948. const m___FLT_MAX__ = 3.40282347e+38
  949. const m___FLT_MIN__ = 1.17549435e-38
  950. const m___FLT_RADIX__ = 2
  951. const m___FPCLASS_NEGINF = 0x0004
  952. const m___FPCLASS_NEGNORMAL = 0x0008
  953. const m___FPCLASS_NEGSUBNORMAL = 0x0010
  954. const m___FPCLASS_NEGZERO = 0x0020
  955. const m___FPCLASS_POSINF = 0x0200
  956. const m___FPCLASS_POSNORMAL = 0x0100
  957. const m___FPCLASS_POSSUBNORMAL = 0x0080
  958. const m___FPCLASS_POSZERO = 0x0040
  959. const m___FPCLASS_QNAN = 0x0002
  960. const m___FPCLASS_SNAN = 0x0001
  961. const m___FUNCTION__ = "__func__"
  962. const m___FXSR__ = 1
  963. const m___FreeBSD__ = 14
  964. const m___FreeBSD_cc_version = 1400006
  965. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  966. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  967. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  968. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  969. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  970. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  971. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  972. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  973. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  974. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  975. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  976. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  977. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  978. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  979. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  980. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  981. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  982. const m___GNUCLIKE_ASM = 3
  983. const m___GNUCLIKE_BUILTIN_CONSTANT_P = 1
  984. const m___GNUCLIKE_BUILTIN_MEMCPY = 1
  985. const m___GNUCLIKE_BUILTIN_NEXT_ARG = 1
  986. const m___GNUCLIKE_BUILTIN_STDARG = 1
  987. const m___GNUCLIKE_BUILTIN_VAALIST = 1
  988. const m___GNUCLIKE_BUILTIN_VARARGS = 1
  989. const m___GNUCLIKE_CTOR_SECTION_HANDLING = 1
  990. const m___GNUCLIKE___SECTION = 1
  991. const m___GNUCLIKE___TYPEOF = 1
  992. const m___GNUC_MINOR__ = 2
  993. const m___GNUC_PATCHLEVEL__ = 1
  994. const m___GNUC_STDC_INLINE__ = 1
  995. const m___GNUC_VA_LIST_COMPATIBILITY = 1
  996. const m___GNUC__ = 4
  997. const m___GXX_ABI_VERSION = 1002
  998. const m___INT16_FMTd__ = "hd"
  999. const m___INT16_FMTi__ = "hi"
  1000. const m___INT16_MAX__ = 32767
  1001. const m___INT16_TYPE__ = "short"
  1002. const m___INT32_FMTd__ = "d"
  1003. const m___INT32_FMTi__ = "i"
  1004. const m___INT32_MAX__ = 2147483647
  1005. const m___INT32_TYPE__ = "int"
  1006. const m___INT64_C_SUFFIX__ = "L"
  1007. const m___INT64_FMTd__ = "ld"
  1008. const m___INT64_FMTi__ = "li"
  1009. const m___INT64_MAX__ = 9223372036854775807
  1010. const m___INT8_FMTd__ = "hhd"
  1011. const m___INT8_FMTi__ = "hhi"
  1012. const m___INT8_MAX__ = 127
  1013. const m___INTMAX_C_SUFFIX__ = "L"
  1014. const m___INTMAX_FMTd__ = "ld"
  1015. const m___INTMAX_FMTi__ = "li"
  1016. const m___INTMAX_MAX__ = 9223372036854775807
  1017. const m___INTMAX_WIDTH__ = 64
  1018. const m___INTPTR_FMTd__ = "ld"
  1019. const m___INTPTR_FMTi__ = "li"
  1020. const m___INTPTR_MAX__ = 9223372036854775807
  1021. const m___INTPTR_WIDTH__ = 64
  1022. const m___INT_FAST16_FMTd__ = "hd"
  1023. const m___INT_FAST16_FMTi__ = "hi"
  1024. const m___INT_FAST16_MAX__ = 32767
  1025. const m___INT_FAST16_TYPE__ = "short"
  1026. const m___INT_FAST16_WIDTH__ = 16
  1027. const m___INT_FAST32_FMTd__ = "d"
  1028. const m___INT_FAST32_FMTi__ = "i"
  1029. const m___INT_FAST32_MAX__ = 2147483647
  1030. const m___INT_FAST32_TYPE__ = "int"
  1031. const m___INT_FAST32_WIDTH__ = 32
  1032. const m___INT_FAST64_FMTd__ = "ld"
  1033. const m___INT_FAST64_FMTi__ = "li"
  1034. const m___INT_FAST64_MAX__ = 9223372036854775807
  1035. const m___INT_FAST64_WIDTH__ = 64
  1036. const m___INT_FAST8_FMTd__ = "hhd"
  1037. const m___INT_FAST8_FMTi__ = "hhi"
  1038. const m___INT_FAST8_MAX__ = 127
  1039. const m___INT_FAST8_WIDTH__ = 8
  1040. const m___INT_LEAST16_FMTd__ = "hd"
  1041. const m___INT_LEAST16_FMTi__ = "hi"
  1042. const m___INT_LEAST16_MAX__ = 32767
  1043. const m___INT_LEAST16_TYPE__ = "short"
  1044. const m___INT_LEAST16_WIDTH__ = 16
  1045. const m___INT_LEAST32_FMTd__ = "d"
  1046. const m___INT_LEAST32_FMTi__ = "i"
  1047. const m___INT_LEAST32_MAX__ = 2147483647
  1048. const m___INT_LEAST32_TYPE__ = "int"
  1049. const m___INT_LEAST32_WIDTH__ = 32
  1050. const m___INT_LEAST64_FMTd__ = "ld"
  1051. const m___INT_LEAST64_FMTi__ = "li"
  1052. const m___INT_LEAST64_MAX__ = 9223372036854775807
  1053. const m___INT_LEAST64_WIDTH__ = 64
  1054. const m___INT_LEAST8_FMTd__ = "hhd"
  1055. const m___INT_LEAST8_FMTi__ = "hhi"
  1056. const m___INT_LEAST8_MAX__ = 127
  1057. const m___INT_LEAST8_WIDTH__ = 8
  1058. const m___INT_MAX = 2147483647
  1059. const m___INT_MAX__ = 2147483647
  1060. const m___INT_WIDTH__ = 32
  1061. const m___ISO_C_VISIBLE = 2011
  1062. const m___KPRINTF_ATTRIBUTE__ = 1
  1063. const m___LDBL_DECIMAL_DIG__ = 17
  1064. const m___LDBL_DENORM_MIN__ = 4.9406564584124654e-324
  1065. const m___LDBL_DIG__ = 15
  1066. const m___LDBL_EPSILON__ = 2.2204460492503131e-16
  1067. const m___LDBL_HAS_DENORM__ = 1
  1068. const m___LDBL_HAS_INFINITY__ = 1
  1069. const m___LDBL_HAS_QUIET_NAN__ = 1
  1070. const m___LDBL_MANT_DIG__ = 53
  1071. const m___LDBL_MAX_10_EXP__ = 308
  1072. const m___LDBL_MAX_EXP__ = 1024
  1073. const m___LDBL_MAX__ = 1.7976931348623157e+308
  1074. const m___LDBL_MIN__ = 2.2250738585072014e-308
  1075. const m___LITTLE_ENDIAN__ = 1
  1076. const m___LLONG_MAX = 0x7fffffffffffffff
  1077. const m___LLONG_WIDTH__ = 64
  1078. const m___LONG_BIT = 64
  1079. const m___LONG_LONG_MAX__ = 9223372036854775807
  1080. const m___LONG_MAX = 0x7fffffffffffffff
  1081. const m___LONG_MAX__ = 9223372036854775807
  1082. const m___LONG_WIDTH__ = 64
  1083. const m___LP64__ = 1
  1084. const m___MEMORY_SCOPE_DEVICE = 1
  1085. const m___MEMORY_SCOPE_SINGLE = 4
  1086. const m___MEMORY_SCOPE_SYSTEM = 0
  1087. const m___MEMORY_SCOPE_WRKGRP = 2
  1088. const m___MEMORY_SCOPE_WVFRNT = 3
  1089. const m___MMX__ = 1
  1090. const m___NO_INLINE__ = 1
  1091. const m___NO_MATH_ERRNO__ = 1
  1092. const m___NO_MATH_INLINES = 1
  1093. const m___OBJC_BOOL_IS_BOOL = 0
  1094. const m___OFF_MAX = "__LONG_MAX"
  1095. const m___OFF_MIN = "__LONG_MIN"
  1096. const m___OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES = 3
  1097. const m___OPENCL_MEMORY_SCOPE_DEVICE = 2
  1098. const m___OPENCL_MEMORY_SCOPE_SUB_GROUP = 4
  1099. const m___OPENCL_MEMORY_SCOPE_WORK_GROUP = 1
  1100. const m___OPENCL_MEMORY_SCOPE_WORK_ITEM = 0
  1101. const m___ORDER_BIG_ENDIAN__ = 4321
  1102. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1103. const m___ORDER_PDP_ENDIAN__ = 3412
  1104. const m___POINTER_WIDTH__ = 64
  1105. const m___POSIX_VISIBLE = 200809
  1106. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1107. const m___PRETTY_FUNCTION__ = "__func__"
  1108. const m___PTRDIFF_FMTd__ = "ld"
  1109. const m___PTRDIFF_FMTi__ = "li"
  1110. const m___PTRDIFF_MAX__ = 9223372036854775807
  1111. const m___PTRDIFF_WIDTH__ = 64
  1112. const m___QUAD_MAX = "__LONG_MAX"
  1113. const m___QUAD_MIN = "__LONG_MIN"
  1114. const m___S2OAP = 0x0001
  1115. const m___SALC = 0x4000
  1116. const m___SAPP = 0x0100
  1117. const m___SCHAR_MAX = 0x7f
  1118. const m___SCHAR_MAX__ = 127
  1119. const m___SEG_FS = 1
  1120. const m___SEG_GS = 1
  1121. const m___SEOF = 0x0020
  1122. const m___SERR = 0x0040
  1123. const m___SHRT_MAX = 0x7fff
  1124. const m___SHRT_MAX__ = 32767
  1125. const m___SHRT_WIDTH__ = 16
  1126. const m___SIGN = 0x8000
  1127. const m___SIG_ATOMIC_MAX__ = 2147483647
  1128. const m___SIG_ATOMIC_WIDTH__ = 32
  1129. const m___SIZEOF_DOUBLE__ = 8
  1130. const m___SIZEOF_FLOAT128__ = 16
  1131. const m___SIZEOF_FLOAT__ = 4
  1132. const m___SIZEOF_INT128__ = 16
  1133. const m___SIZEOF_INT__ = 4
  1134. const m___SIZEOF_LONG_DOUBLE__ = 8
  1135. const m___SIZEOF_LONG_LONG__ = 8
  1136. const m___SIZEOF_LONG__ = 8
  1137. const m___SIZEOF_POINTER__ = 8
  1138. const m___SIZEOF_PTRDIFF_T__ = 8
  1139. const m___SIZEOF_SHORT__ = 2
  1140. const m___SIZEOF_SIZE_T__ = 8
  1141. const m___SIZEOF_WCHAR_T__ = 4
  1142. const m___SIZEOF_WINT_T__ = 4
  1143. const m___SIZE_FMTX__ = "lX"
  1144. const m___SIZE_FMTo__ = "lo"
  1145. const m___SIZE_FMTu__ = "lu"
  1146. const m___SIZE_FMTx__ = "lx"
  1147. const m___SIZE_MAX__ = 18446744073709551615
  1148. const m___SIZE_T_MAX = "__ULONG_MAX"
  1149. const m___SIZE_WIDTH__ = 64
  1150. const m___SLBF = 0x0001
  1151. const m___SMBF = 0x0080
  1152. const m___SMOD = 0x2000
  1153. const m___SNBF = 0x0002
  1154. const m___SNPT = 0x0800
  1155. const m___SOFF = 0x1000
  1156. const m___SOPT = 0x0400
  1157. const m___SRD = 0x0004
  1158. const m___SRW = 0x0010
  1159. const m___SSE2_MATH__ = 1
  1160. const m___SSE2__ = 1
  1161. const m___SSE_MATH__ = 1
  1162. const m___SSE__ = 1
  1163. const m___SSIZE_MAX = "__LONG_MAX"
  1164. const m___SSTR = 0x0200
  1165. const m___STDC_HOSTED__ = 1
  1166. const m___STDC_MB_MIGHT_NEQ_WC__ = 1
  1167. const m___STDC_UTF_16__ = 1
  1168. const m___STDC_UTF_32__ = 1
  1169. const m___STDC_VERSION__ = 201710
  1170. const m___STDC__ = 1
  1171. const m___SWR = 0x0008
  1172. const m___UCHAR_MAX = 0xff
  1173. const m___UINT16_FMTX__ = "hX"
  1174. const m___UINT16_FMTo__ = "ho"
  1175. const m___UINT16_FMTu__ = "hu"
  1176. const m___UINT16_FMTx__ = "hx"
  1177. const m___UINT16_MAX__ = 65535
  1178. const m___UINT32_C_SUFFIX__ = "U"
  1179. const m___UINT32_FMTX__ = "X"
  1180. const m___UINT32_FMTo__ = "o"
  1181. const m___UINT32_FMTu__ = "u"
  1182. const m___UINT32_FMTx__ = "x"
  1183. const m___UINT32_MAX__ = 4294967295
  1184. const m___UINT64_C_SUFFIX__ = "UL"
  1185. const m___UINT64_FMTX__ = "lX"
  1186. const m___UINT64_FMTo__ = "lo"
  1187. const m___UINT64_FMTu__ = "lu"
  1188. const m___UINT64_FMTx__ = "lx"
  1189. const m___UINT64_MAX__ = 18446744073709551615
  1190. const m___UINT8_FMTX__ = "hhX"
  1191. const m___UINT8_FMTo__ = "hho"
  1192. const m___UINT8_FMTu__ = "hhu"
  1193. const m___UINT8_FMTx__ = "hhx"
  1194. const m___UINT8_MAX__ = 255
  1195. const m___UINTMAX_C_SUFFIX__ = "UL"
  1196. const m___UINTMAX_FMTX__ = "lX"
  1197. const m___UINTMAX_FMTo__ = "lo"
  1198. const m___UINTMAX_FMTu__ = "lu"
  1199. const m___UINTMAX_FMTx__ = "lx"
  1200. const m___UINTMAX_MAX__ = 18446744073709551615
  1201. const m___UINTMAX_WIDTH__ = 64
  1202. const m___UINTPTR_FMTX__ = "lX"
  1203. const m___UINTPTR_FMTo__ = "lo"
  1204. const m___UINTPTR_FMTu__ = "lu"
  1205. const m___UINTPTR_FMTx__ = "lx"
  1206. const m___UINTPTR_MAX__ = 18446744073709551615
  1207. const m___UINTPTR_WIDTH__ = 64
  1208. const m___UINT_FAST16_FMTX__ = "hX"
  1209. const m___UINT_FAST16_FMTo__ = "ho"
  1210. const m___UINT_FAST16_FMTu__ = "hu"
  1211. const m___UINT_FAST16_FMTx__ = "hx"
  1212. const m___UINT_FAST16_MAX__ = 65535
  1213. const m___UINT_FAST32_FMTX__ = "X"
  1214. const m___UINT_FAST32_FMTo__ = "o"
  1215. const m___UINT_FAST32_FMTu__ = "u"
  1216. const m___UINT_FAST32_FMTx__ = "x"
  1217. const m___UINT_FAST32_MAX__ = 4294967295
  1218. const m___UINT_FAST64_FMTX__ = "lX"
  1219. const m___UINT_FAST64_FMTo__ = "lo"
  1220. const m___UINT_FAST64_FMTu__ = "lu"
  1221. const m___UINT_FAST64_FMTx__ = "lx"
  1222. const m___UINT_FAST64_MAX__ = 18446744073709551615
  1223. const m___UINT_FAST8_FMTX__ = "hhX"
  1224. const m___UINT_FAST8_FMTo__ = "hho"
  1225. const m___UINT_FAST8_FMTu__ = "hhu"
  1226. const m___UINT_FAST8_FMTx__ = "hhx"
  1227. const m___UINT_FAST8_MAX__ = 255
  1228. const m___UINT_LEAST16_FMTX__ = "hX"
  1229. const m___UINT_LEAST16_FMTo__ = "ho"
  1230. const m___UINT_LEAST16_FMTu__ = "hu"
  1231. const m___UINT_LEAST16_FMTx__ = "hx"
  1232. const m___UINT_LEAST16_MAX__ = 65535
  1233. const m___UINT_LEAST32_FMTX__ = "X"
  1234. const m___UINT_LEAST32_FMTo__ = "o"
  1235. const m___UINT_LEAST32_FMTu__ = "u"
  1236. const m___UINT_LEAST32_FMTx__ = "x"
  1237. const m___UINT_LEAST32_MAX__ = 4294967295
  1238. const m___UINT_LEAST64_FMTX__ = "lX"
  1239. const m___UINT_LEAST64_FMTo__ = "lo"
  1240. const m___UINT_LEAST64_FMTu__ = "lu"
  1241. const m___UINT_LEAST64_FMTx__ = "lx"
  1242. const m___UINT_LEAST64_MAX__ = 18446744073709551615
  1243. const m___UINT_LEAST8_FMTX__ = "hhX"
  1244. const m___UINT_LEAST8_FMTo__ = "hho"
  1245. const m___UINT_LEAST8_FMTu__ = "hhu"
  1246. const m___UINT_LEAST8_FMTx__ = "hhx"
  1247. const m___UINT_LEAST8_MAX__ = 255
  1248. const m___UINT_MAX = 4294967295
  1249. const m___ULLONG_MAX = "0xffffffffffffffffU"
  1250. const m___ULONG_MAX = 0xffffffffffffffff
  1251. const m___UQUAD_MAX = "__ULONG_MAX"
  1252. const m___USHRT_MAX = 0xffff
  1253. const m___VERSION__ = "FreeBSD Clang 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)"
  1254. const m___WCHAR_MAX = "__INT_MAX"
  1255. const m___WCHAR_MAX__ = 2147483647
  1256. const m___WCHAR_MIN = "__INT_MIN"
  1257. const m___WCHAR_TYPE__ = "int"
  1258. const m___WCHAR_WIDTH__ = 32
  1259. const m___WINT_MAX__ = 2147483647
  1260. const m___WINT_TYPE__ = "int"
  1261. const m___WINT_WIDTH__ = 32
  1262. const m___WORDSIZE = 64
  1263. const m___WORD_BIT = 32
  1264. const m___XSI_VISIBLE = 700
  1265. const m___amd64 = 1
  1266. const m___amd64__ = 1
  1267. const m___clang__ = 1
  1268. const m___clang_literal_encoding__ = "UTF-8"
  1269. const m___clang_major__ = 18
  1270. const m___clang_minor__ = 1
  1271. const m___clang_patchlevel__ = 6
  1272. const m___clang_version__ = "18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)"
  1273. const m___clang_wide_literal_encoding__ = "UTF-32"
  1274. const m___code_model_small__ = 1
  1275. const m___const = "const"
  1276. const m___has_extension = "__has_feature"
  1277. const m___isnan = "__inline_isnan"
  1278. const m___isnanf = "__inline_isnanf"
  1279. const m___k8 = 1
  1280. const m___k8__ = 1
  1281. const m___llvm__ = 1
  1282. const m___restrict = "restrict"
  1283. const m___restrict_arr = "restrict"
  1284. const m___signed = "signed"
  1285. const m___tune_k8__ = 1
  1286. const m___unix = 1
  1287. const m___unix__ = 1
  1288. const m___volatile = "volatile"
  1289. const m___writeonly = "__unused"
  1290. const m___x86_64 = 1
  1291. const m___x86_64__ = 1
  1292. const m_fds_bits = "__fds_bits"
  1293. const m_inline = "__inline"
  1294. const m_math_errhandling = "MATH_ERREXCEPT"
  1295. const m_static_assert = "_Static_assert"
  1296. const m_stderr = "__stderrp"
  1297. const m_stdin = "__stdinp"
  1298. const m_stdout = "__stdoutp"
  1299. const m_unix = 1
  1300. type t__builtin_va_list = uintptr
  1301. type t__predefined_size_t = uint64
  1302. type t__predefined_wchar_t = int32
  1303. type t__predefined_ptrdiff_t = int64
  1304. type t__int8_t = int8
  1305. type t__uint8_t = uint8
  1306. type t__int16_t = int16
  1307. type t__uint16_t = uint16
  1308. type t__int32_t = int32
  1309. type t__uint32_t = uint32
  1310. type t__int64_t = int64
  1311. type t__uint64_t = uint64
  1312. type t__int_least8_t = int8
  1313. type t__int_least16_t = int16
  1314. type t__int_least32_t = int32
  1315. type t__int_least64_t = int64
  1316. type t__intmax_t = int64
  1317. type t__uint_least8_t = uint8
  1318. type t__uint_least16_t = uint16
  1319. type t__uint_least32_t = uint32
  1320. type t__uint_least64_t = uint64
  1321. type t__uintmax_t = uint64
  1322. type t__intptr_t = int64
  1323. type t__intfptr_t = int64
  1324. type t__uintptr_t = uint64
  1325. type t__uintfptr_t = uint64
  1326. type t__vm_offset_t = uint64
  1327. type t__vm_size_t = uint64
  1328. type t__size_t = uint64
  1329. type t__ssize_t = int64
  1330. type t__ptrdiff_t = int64
  1331. type t__clock_t = int32
  1332. type t__critical_t = int64
  1333. type t__double_t = float64
  1334. type t__float_t = float32
  1335. type t__int_fast8_t = int32
  1336. type t__int_fast16_t = int32
  1337. type t__int_fast32_t = int32
  1338. type t__int_fast64_t = int64
  1339. type t__register_t = int64
  1340. type t__segsz_t = int64
  1341. type t__time_t = int64
  1342. type t__uint_fast8_t = uint32
  1343. type t__uint_fast16_t = uint32
  1344. type t__uint_fast32_t = uint32
  1345. type t__uint_fast64_t = uint64
  1346. type t__u_register_t = uint64
  1347. type t__vm_paddr_t = uint64
  1348. type T___wchar_t = int32
  1349. type t__blksize_t = int32
  1350. type t__blkcnt_t = int64
  1351. type t__clockid_t = int32
  1352. type t__fflags_t = uint32
  1353. type t__fsblkcnt_t = uint64
  1354. type t__fsfilcnt_t = uint64
  1355. type t__gid_t = uint32
  1356. type t__id_t = int64
  1357. type t__ino_t = uint64
  1358. type t__key_t = int64
  1359. type t__lwpid_t = int32
  1360. type t__mode_t = uint16
  1361. type t__accmode_t = int32
  1362. type t__nl_item = int32
  1363. type t__nlink_t = uint64
  1364. type t__off_t = int64
  1365. type t__off64_t = int64
  1366. type t__pid_t = int32
  1367. type t__sbintime_t = int64
  1368. type t__rlim_t = int64
  1369. type t__sa_family_t = uint8
  1370. type t__socklen_t = uint32
  1371. type t__suseconds_t = int64
  1372. type t__timer_t = uintptr
  1373. type t__mqd_t = uintptr
  1374. type t__uid_t = uint32
  1375. type t__useconds_t = uint32
  1376. type t__cpuwhich_t = int32
  1377. type t__cpulevel_t = int32
  1378. type t__cpusetid_t = int32
  1379. type t__daddr_t = int64
  1380. type t__ct_rune_t = int32
  1381. type t__rune_t = int32
  1382. type t__wint_t = int32
  1383. type t__char16_t = uint16
  1384. type t__char32_t = uint32
  1385. type t__max_align_t = struct {
  1386. F__max_align1 int64
  1387. F__max_align2 float64
  1388. }
  1389. type t__dev_t = uint64
  1390. type t__fixpt_t = uint32
  1391. type t__mbstate_t = struct {
  1392. F_mbstateL [0]t__int64_t
  1393. F__mbstate8 [128]int8
  1394. }
  1395. type t__rman_res_t = uint64
  1396. type t__va_list = uintptr
  1397. type t__gnuc_va_list = uintptr
  1398. type Tptrdiff_t = int64
  1399. type Trune_t = int32
  1400. type Tsize_t = uint64
  1401. type Twchar_t = int32
  1402. type Tmax_align_t = struct {
  1403. F__max_align1 int64
  1404. F__max_align2 float64
  1405. }
  1406. type Trsize_t = uint64
  1407. type Tlocale_t = uintptr
  1408. type Tmode_t = uint16
  1409. type Tssize_t = int64
  1410. type Terrno_t = int32
  1411. type Tfpos_t = int64
  1412. type Toff_t = int64
  1413. type Toff64_t = int64
  1414. type Tva_list = uintptr
  1415. type t__sbuf = struct {
  1416. F_base uintptr
  1417. F_size int32
  1418. }
  1419. type t__sFILE = struct {
  1420. F_p uintptr
  1421. F_r int32
  1422. F_w int32
  1423. F_flags int16
  1424. F_file int16
  1425. F_bf t__sbuf
  1426. F_lbfsize int32
  1427. F_cookie uintptr
  1428. F_close uintptr
  1429. F_read uintptr
  1430. F_seek uintptr
  1431. F_write uintptr
  1432. F_ub t__sbuf
  1433. F_up uintptr
  1434. F_ur int32
  1435. F_ubuf [3]uint8
  1436. F_nbuf [1]uint8
  1437. F_lb t__sbuf
  1438. F_blksize int32
  1439. F_offset Tfpos_t
  1440. F_fl_mutex uintptr
  1441. F_fl_owner uintptr
  1442. F_fl_count int32
  1443. F_orientation int32
  1444. F_mbstate t__mbstate_t
  1445. F_flags2 int32
  1446. }
  1447. type TFILE = struct {
  1448. F_p uintptr
  1449. F_r int32
  1450. F_w int32
  1451. F_flags int16
  1452. F_file int16
  1453. F_bf t__sbuf
  1454. F_lbfsize int32
  1455. F_cookie uintptr
  1456. F_close uintptr
  1457. F_read uintptr
  1458. F_seek uintptr
  1459. F_write uintptr
  1460. F_ub t__sbuf
  1461. F_up uintptr
  1462. F_ur int32
  1463. F_ubuf [3]uint8
  1464. F_nbuf [1]uint8
  1465. F_lb t__sbuf
  1466. F_blksize int32
  1467. F_offset Tfpos_t
  1468. F_fl_mutex uintptr
  1469. F_fl_owner uintptr
  1470. F_fl_count int32
  1471. F_orientation int32
  1472. F_mbstate t__mbstate_t
  1473. F_flags2 int32
  1474. }
  1475. type Tcookie_io_functions_t = struct {
  1476. Fread uintptr
  1477. Fwrite uintptr
  1478. Fseek uintptr
  1479. Fclose1 uintptr
  1480. }
  1481. type Tdiv_t = struct {
  1482. Fquot int32
  1483. Frem int32
  1484. }
  1485. type Tldiv_t = struct {
  1486. Fquot int64
  1487. Frem int64
  1488. }
  1489. type Tlldiv_t = struct {
  1490. Fquot int64
  1491. Frem int64
  1492. }
  1493. type Tconstraint_handler_t = uintptr
  1494. type Tint8_t = int8
  1495. type Tint16_t = int16
  1496. type Tint32_t = int32
  1497. type Tint64_t = int64
  1498. type Tuint8_t = uint8
  1499. type Tuint16_t = uint16
  1500. type Tuint32_t = uint32
  1501. type Tuint64_t = uint64
  1502. type Tintptr_t = int64
  1503. type Tuintptr_t = uint64
  1504. type Tintmax_t = int64
  1505. type Tuintmax_t = uint64
  1506. type Tint_least8_t = int8
  1507. type Tint_least16_t = int16
  1508. type Tint_least32_t = int32
  1509. type Tint_least64_t = int64
  1510. type Tuint_least8_t = uint8
  1511. type Tuint_least16_t = uint16
  1512. type Tuint_least32_t = uint32
  1513. type Tuint_least64_t = uint64
  1514. type Tint_fast8_t = int32
  1515. type Tint_fast16_t = int32
  1516. type Tint_fast32_t = int32
  1517. type Tint_fast64_t = int64
  1518. type Tuint_fast8_t = uint32
  1519. type Tuint_fast16_t = uint32
  1520. type Tuint_fast32_t = uint32
  1521. type Tuint_fast64_t = uint64
  1522. type Tdouble_t = float64
  1523. type Tfloat_t = float32
  1524. type Tsuseconds_t = int64
  1525. type Ttime_t = int64
  1526. type Ttimeval = struct {
  1527. Ftv_sec Ttime_t
  1528. Ftv_usec Tsuseconds_t
  1529. }
  1530. type Tpthread_once = struct {
  1531. Fstate int32
  1532. Fmutex Tpthread_mutex_t
  1533. }
  1534. type Tpthread_t = uintptr
  1535. type Tpthread_attr_t = uintptr
  1536. type Tpthread_mutex_t = uintptr
  1537. type Tpthread_mutexattr_t = uintptr
  1538. type Tpthread_cond_t = uintptr
  1539. type Tpthread_condattr_t = uintptr
  1540. type Tpthread_key_t = int32
  1541. type Tpthread_once_t = struct {
  1542. Fstate int32
  1543. Fmutex Tpthread_mutex_t
  1544. }
  1545. type Tpthread_rwlock_t = uintptr
  1546. type Tpthread_rwlockattr_t = uintptr
  1547. type Tpthread_barrier_t = uintptr
  1548. type Tpthread_barrierattr_t = uintptr
  1549. type Tpthread_spinlock_t = uintptr
  1550. type Tpthread_addr_t = uintptr
  1551. type Tpthread_startroutine_t = uintptr
  1552. type Tu_char = uint8
  1553. type Tu_short = uint16
  1554. type Tu_int = uint32
  1555. type Tu_long = uint64
  1556. type Tushort = uint16
  1557. type Tuint = uint32
  1558. type Tu_int8_t = uint8
  1559. type Tu_int16_t = uint16
  1560. type Tu_int32_t = uint32
  1561. type Tu_int64_t = uint64
  1562. type Tu_quad_t = uint64
  1563. type Tquad_t = int64
  1564. type Tqaddr_t = uintptr
  1565. type Tcaddr_t = uintptr
  1566. type Tc_caddr_t = uintptr
  1567. type Tblksize_t = int32
  1568. type Tcpuwhich_t = int32
  1569. type Tcpulevel_t = int32
  1570. type Tcpusetid_t = int32
  1571. type Tblkcnt_t = int64
  1572. type Tclock_t = int32
  1573. type Tclockid_t = int32
  1574. type Tcritical_t = int64
  1575. type Tdaddr_t = int64
  1576. type Tdev_t = uint64
  1577. type Tfflags_t = uint32
  1578. type Tfixpt_t = uint32
  1579. type Tfsblkcnt_t = uint64
  1580. type Tfsfilcnt_t = uint64
  1581. type Tgid_t = uint32
  1582. type Tin_addr_t = uint32
  1583. type Tin_port_t = uint16
  1584. type Tid_t = int64
  1585. type Tino_t = uint64
  1586. type Tkey_t = int64
  1587. type Tlwpid_t = int32
  1588. type Taccmode_t = int32
  1589. type Tnlink_t = uint64
  1590. type Tpid_t = int32
  1591. type Tregister_t = int64
  1592. type Trlim_t = int64
  1593. type Tsbintime_t = int64
  1594. type Tsegsz_t = int64
  1595. type Ttimer_t = uintptr
  1596. type Tmqd_t = uintptr
  1597. type Tu_register_t = uint64
  1598. type Tuid_t = uint32
  1599. type Tuseconds_t = uint32
  1600. type Tcap_ioctl_t = uint64
  1601. type Tkpaddr_t = uint64
  1602. type Tkvaddr_t = uint64
  1603. type Tksize_t = uint64
  1604. type Tkssize_t = int64
  1605. type Tvm_offset_t = uint64
  1606. type Tvm_ooffset_t = uint64
  1607. type Tvm_paddr_t = uint64
  1608. type Tvm_pindex_t = uint64
  1609. type Tvm_size_t = uint64
  1610. type Trman_res_t = uint64
  1611. type Tsyscallarg_t = int64
  1612. type t__sigset_t = struct {
  1613. F__bits [4]t__uint32_t
  1614. }
  1615. type t__sigset = t__sigset_t
  1616. type Ttimespec = struct {
  1617. Ftv_sec Ttime_t
  1618. Ftv_nsec int64
  1619. }
  1620. type Titimerspec = struct {
  1621. Fit_interval Ttimespec
  1622. Fit_value Ttimespec
  1623. }
  1624. type t__fd_mask = uint64
  1625. type Tfd_mask = uint64
  1626. type Tsigset_t = struct {
  1627. F__bits [4]t__uint32_t
  1628. }
  1629. type Tfd_set = struct {
  1630. F__fds_bits [16]t__fd_mask
  1631. }
  1632. type Ttimezone = struct {
  1633. Ftz_minuteswest int32
  1634. Ftz_dsttime int32
  1635. }
  1636. type Tbintime = struct {
  1637. Fsec Ttime_t
  1638. Ffrac Tuint64_t
  1639. }
  1640. type Titimerval = struct {
  1641. Fit_interval Ttimeval
  1642. Fit_value Ttimeval
  1643. }
  1644. type Tclockinfo = struct {
  1645. Fhz int32
  1646. Ftick int32
  1647. Fspare int32
  1648. Fstathz int32
  1649. Fprofhz int32
  1650. }
  1651. type Ttm = struct {
  1652. Ftm_sec int32
  1653. Ftm_min int32
  1654. Ftm_hour int32
  1655. Ftm_mday int32
  1656. Ftm_mon int32
  1657. Ftm_year int32
  1658. Ftm_wday int32
  1659. Ftm_yday int32
  1660. Ftm_isdst int32
  1661. Ftm_gmtoff int64
  1662. Ftm_zone uintptr
  1663. }
  1664. type Tcrypt_data = struct {
  1665. Finitialized int32
  1666. F__buf [256]int8
  1667. }
  1668. type Tflock = struct {
  1669. Fl_start Toff_t
  1670. Fl_len Toff_t
  1671. Fl_pid Tpid_t
  1672. Fl_type int16
  1673. Fl_whence int16
  1674. Fl_sysid int32
  1675. }
  1676. type t__oflock = struct {
  1677. Fl_start Toff_t
  1678. Fl_len Toff_t
  1679. Fl_pid Tpid_t
  1680. Fl_type int16
  1681. Fl_whence int16
  1682. }
  1683. type Tspacectl_range = struct {
  1684. Fr_offset Toff_t
  1685. Fr_len Toff_t
  1686. }
  1687. type TXML_Char = int8
  1688. type TXML_LChar = int8
  1689. type TXML_Index = int64
  1690. type TXML_Size = uint64
  1691. type TXML_ParserStruct = struct {
  1692. Fm_userData uintptr
  1693. Fm_handlerArg uintptr
  1694. Fm_buffer uintptr
  1695. Fm_mem TXML_Memory_Handling_Suite
  1696. Fm_bufferPtr uintptr
  1697. Fm_bufferEnd uintptr
  1698. Fm_bufferLim uintptr
  1699. Fm_parseEndByteIndex TXML_Index
  1700. Fm_parseEndPtr uintptr
  1701. Fm_dataBuf uintptr
  1702. Fm_dataBufEnd uintptr
  1703. Fm_startElementHandler TXML_StartElementHandler
  1704. Fm_endElementHandler TXML_EndElementHandler
  1705. Fm_characterDataHandler TXML_CharacterDataHandler
  1706. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1707. Fm_commentHandler TXML_CommentHandler
  1708. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1709. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1710. Fm_defaultHandler TXML_DefaultHandler
  1711. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1712. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1713. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1714. Fm_notationDeclHandler TXML_NotationDeclHandler
  1715. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1716. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1717. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1718. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1719. Fm_externalEntityRefHandlerArg TXML_Parser
  1720. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1721. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1722. Fm_elementDeclHandler TXML_ElementDeclHandler
  1723. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1724. Fm_entityDeclHandler TXML_EntityDeclHandler
  1725. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1726. Fm_encoding uintptr
  1727. Fm_initEncoding TINIT_ENCODING
  1728. Fm_internalEncoding uintptr
  1729. Fm_protocolEncodingName uintptr
  1730. Fm_ns TXML_Bool
  1731. Fm_ns_triplets TXML_Bool
  1732. Fm_unknownEncodingMem uintptr
  1733. Fm_unknownEncodingData uintptr
  1734. Fm_unknownEncodingHandlerData uintptr
  1735. Fm_unknownEncodingRelease uintptr
  1736. Fm_prologState TPROLOG_STATE
  1737. Fm_processor uintptr
  1738. Fm_errorCode _XML_Error
  1739. Fm_eventPtr uintptr
  1740. Fm_eventEndPtr uintptr
  1741. Fm_positionPtr uintptr
  1742. Fm_openInternalEntities uintptr
  1743. Fm_freeInternalEntities uintptr
  1744. Fm_defaultExpandInternalEntities TXML_Bool
  1745. Fm_tagLevel int32
  1746. Fm_declEntity uintptr
  1747. Fm_doctypeName uintptr
  1748. Fm_doctypeSysid uintptr
  1749. Fm_doctypePubid uintptr
  1750. Fm_declAttributeType uintptr
  1751. Fm_declNotationName uintptr
  1752. Fm_declNotationPublicId uintptr
  1753. Fm_declElementType uintptr
  1754. Fm_declAttributeId uintptr
  1755. Fm_declAttributeIsCdata TXML_Bool
  1756. Fm_declAttributeIsId TXML_Bool
  1757. Fm_dtd uintptr
  1758. Fm_curBase uintptr
  1759. Fm_tagStack uintptr
  1760. Fm_freeTagList uintptr
  1761. Fm_inheritedBindings uintptr
  1762. Fm_freeBindingList uintptr
  1763. Fm_attsSize int32
  1764. Fm_nSpecifiedAtts int32
  1765. Fm_idAttIndex int32
  1766. Fm_atts uintptr
  1767. Fm_nsAtts uintptr
  1768. Fm_nsAttsVersion uint64
  1769. Fm_nsAttsPower uint8
  1770. Fm_position TPOSITION
  1771. Fm_tempPool TSTRING_POOL
  1772. Fm_temp2Pool TSTRING_POOL
  1773. Fm_groupConnector uintptr
  1774. Fm_groupSize uint32
  1775. Fm_namespaceSeparator TXML_Char
  1776. Fm_parentParser TXML_Parser
  1777. Fm_parsingStatus TXML_ParsingStatus
  1778. Fm_isParamEntity TXML_Bool
  1779. Fm_useForeignDTD TXML_Bool
  1780. Fm_paramEntityParsing _XML_ParamEntityParsing
  1781. Fm_hash_secret_salt uint64
  1782. Fm_accounting TACCOUNTING
  1783. Fm_entity_stats TENTITY_STATS
  1784. }
  1785. type _XML_Error = int32
  1786. const _XML_ERROR_NONE = 0
  1787. const _XML_ERROR_NO_MEMORY = 1
  1788. const _XML_ERROR_SYNTAX = 2
  1789. const _XML_ERROR_NO_ELEMENTS = 3
  1790. const _XML_ERROR_INVALID_TOKEN = 4
  1791. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1792. const _XML_ERROR_PARTIAL_CHAR = 6
  1793. const _XML_ERROR_TAG_MISMATCH = 7
  1794. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1795. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1796. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1797. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1798. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1799. const _XML_ERROR_ASYNC_ENTITY = 13
  1800. const _XML_ERROR_BAD_CHAR_REF = 14
  1801. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1802. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1803. const _XML_ERROR_MISPLACED_XML_PI = 17
  1804. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1805. const _XML_ERROR_INCORRECT_ENCODING = 19
  1806. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1807. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1808. const _XML_ERROR_NOT_STANDALONE = 22
  1809. const _XML_ERROR_UNEXPECTED_STATE = 23
  1810. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1811. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1812. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1813. const _XML_ERROR_UNBOUND_PREFIX = 27
  1814. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1815. const _XML_ERROR_INCOMPLETE_PE = 29
  1816. const _XML_ERROR_XML_DECL = 30
  1817. const _XML_ERROR_TEXT_DECL = 31
  1818. const _XML_ERROR_PUBLICID = 32
  1819. const _XML_ERROR_SUSPENDED = 33
  1820. const _XML_ERROR_NOT_SUSPENDED = 34
  1821. const _XML_ERROR_ABORTED = 35
  1822. const _XML_ERROR_FINISHED = 36
  1823. const _XML_ERROR_SUSPEND_PE = 37
  1824. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1825. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1826. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1827. const _XML_ERROR_INVALID_ARGUMENT = 41
  1828. const _XML_ERROR_NO_BUFFER = 42
  1829. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1830. type _XML_ParamEntityParsing = int32
  1831. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1832. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1833. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1834. type TXML_Parser = uintptr
  1835. type TXML_Bool = uint8
  1836. type _XML_Status = int32
  1837. const _XML_STATUS_ERROR = 0
  1838. const _XML_STATUS_OK = 1
  1839. const _XML_STATUS_SUSPENDED = 2
  1840. type _XML_Content_Type = int32
  1841. const _XML_CTYPE_EMPTY = 1
  1842. const _XML_CTYPE_ANY = 2
  1843. const _XML_CTYPE_MIXED = 3
  1844. const _XML_CTYPE_NAME = 4
  1845. const _XML_CTYPE_CHOICE = 5
  1846. const _XML_CTYPE_SEQ = 6
  1847. type _XML_Content_Quant = int32
  1848. const _XML_CQUANT_NONE = 0
  1849. const _XML_CQUANT_OPT = 1
  1850. const _XML_CQUANT_REP = 2
  1851. const _XML_CQUANT_PLUS = 3
  1852. type TXML_Content = struct {
  1853. Ftype1 _XML_Content_Type
  1854. Fquant _XML_Content_Quant
  1855. Fname uintptr
  1856. Fnumchildren uint32
  1857. Fchildren uintptr
  1858. }
  1859. type TXML_cp = TXML_Content
  1860. type TXML_ElementDeclHandler = uintptr
  1861. type TXML_AttlistDeclHandler = uintptr
  1862. type TXML_XmlDeclHandler = uintptr
  1863. type TXML_Memory_Handling_Suite = struct {
  1864. Fmalloc_fcn uintptr
  1865. Frealloc_fcn uintptr
  1866. Ffree_fcn uintptr
  1867. }
  1868. type TXML_StartElementHandler = uintptr
  1869. type TXML_EndElementHandler = uintptr
  1870. type TXML_CharacterDataHandler = uintptr
  1871. type TXML_ProcessingInstructionHandler = uintptr
  1872. type TXML_CommentHandler = uintptr
  1873. type TXML_StartCdataSectionHandler = uintptr
  1874. type TXML_EndCdataSectionHandler = uintptr
  1875. type TXML_DefaultHandler = uintptr
  1876. type TXML_StartDoctypeDeclHandler = uintptr
  1877. type TXML_EndDoctypeDeclHandler = uintptr
  1878. type TXML_EntityDeclHandler = uintptr
  1879. type TXML_UnparsedEntityDeclHandler = uintptr
  1880. type TXML_NotationDeclHandler = uintptr
  1881. type TXML_StartNamespaceDeclHandler = uintptr
  1882. type TXML_EndNamespaceDeclHandler = uintptr
  1883. type TXML_NotStandaloneHandler = uintptr
  1884. type TXML_ExternalEntityRefHandler = uintptr
  1885. type TXML_SkippedEntityHandler = uintptr
  1886. type TXML_Encoding = struct {
  1887. Fmap1 [256]int32
  1888. Fdata uintptr
  1889. Fconvert uintptr
  1890. Frelease uintptr
  1891. }
  1892. type TXML_UnknownEncodingHandler = uintptr
  1893. type _XML_Parsing = int32
  1894. const _XML_INITIALIZED = 0
  1895. const _XML_PARSING = 1
  1896. const _XML_FINISHED = 2
  1897. const _XML_SUSPENDED = 3
  1898. type TXML_ParsingStatus = struct {
  1899. Fparsing _XML_Parsing
  1900. FfinalBuffer TXML_Bool
  1901. }
  1902. type TXML_Expat_Version = struct {
  1903. Fmajor int32
  1904. Fminor int32
  1905. Fmicro int32
  1906. }
  1907. type _XML_FeatureEnum = int32
  1908. const _XML_FEATURE_END = 0
  1909. const _XML_FEATURE_UNICODE = 1
  1910. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1911. const _XML_FEATURE_DTD = 3
  1912. const _XML_FEATURE_CONTEXT_BYTES = 4
  1913. const _XML_FEATURE_MIN_SIZE = 5
  1914. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1915. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1916. const _XML_FEATURE_NS = 8
  1917. const _XML_FEATURE_LARGE_SIZE = 9
  1918. const _XML_FEATURE_ATTR_INFO = 10
  1919. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1920. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1921. type TXML_Feature = struct {
  1922. Ffeature _XML_FeatureEnum
  1923. Fname uintptr
  1924. Fvalue int64
  1925. }
  1926. type Tsiphash = struct {
  1927. Fv0 Tuint64_t
  1928. Fv1 Tuint64_t
  1929. Fv2 Tuint64_t
  1930. Fv3 Tuint64_t
  1931. Fbuf [8]uint8
  1932. Fp uintptr
  1933. Fc Tuint64_t
  1934. }
  1935. type Tsipkey = struct {
  1936. Fk [2]Tuint64_t
  1937. }
  1938. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1939. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(*(*uint8)(unsafe.Pointer(src)))<<libc.Int32FromInt32(0) | uint64(*(*uint8)(unsafe.Pointer(src + 1)))<<libc.Int32FromInt32(8) | uint64(*(*uint8)(unsafe.Pointer(src + 2)))<<libc.Int32FromInt32(16) | uint64(*(*uint8)(unsafe.Pointer(src + 3)))<<libc.Int32FromInt32(24) | uint64(*(*uint8)(unsafe.Pointer(src + 4)))<<libc.Int32FromInt32(32) | uint64(*(*uint8)(unsafe.Pointer(src + 5)))<<libc.Int32FromInt32(40) | uint64(*(*uint8)(unsafe.Pointer(src + 6)))<<libc.Int32FromInt32(48) | uint64(*(*uint8)(unsafe.Pointer(src + 7)))<<libc.Int32FromInt32(56)
  1940. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8))))<<libc.Int32FromInt32(0) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 1)))<<libc.Int32FromInt32(8) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 2)))<<libc.Int32FromInt32(16) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 3)))<<libc.Int32FromInt32(24) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 4)))<<libc.Int32FromInt32(32) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 5)))<<libc.Int32FromInt32(40) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 6)))<<libc.Int32FromInt32(48) | uint64(*(*uint8)(unsafe.Pointer(src + libc.UintptrFromInt32(8) + 7)))<<libc.Int32FromInt32(56)
  1941. return key
  1942. }
  1943. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1944. var i int32
  1945. _ = i
  1946. i = 0
  1947. for {
  1948. if !(i < rounds) {
  1949. break
  1950. }
  1951. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1952. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1953. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1954. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1955. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1956. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1957. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1958. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1959. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1960. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1961. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1962. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1963. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1964. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1965. goto _1
  1966. _1:
  1967. ;
  1968. i++
  1969. }
  1970. }
  1971. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1972. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1973. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1974. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1975. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1976. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1977. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1978. return H
  1979. }
  1980. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1981. var m Tuint64_t
  1982. var p, pe, v1, v2, v3 uintptr
  1983. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1984. p = src
  1985. pe = p + uintptr(len1)
  1986. for cond := true; cond; cond = p < pe {
  1987. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1988. v2 = H + 40
  1989. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1990. *(*uintptr)(unsafe.Pointer(v2))++
  1991. v3 = p
  1992. p++
  1993. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1994. }
  1995. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1996. break
  1997. }
  1998. m = uint64(*(*uint8)(unsafe.Pointer(H + 32)))<<libc.Int32FromInt32(0) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1)))<<libc.Int32FromInt32(8) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2)))<<libc.Int32FromInt32(16) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3)))<<libc.Int32FromInt32(24) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4)))<<libc.Int32FromInt32(32) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5)))<<libc.Int32FromInt32(40) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6)))<<libc.Int32FromInt32(48) | uint64(*(*uint8)(unsafe.Pointer(H + 32 + 7)))<<libc.Int32FromInt32(56)
  1999. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  2000. _sip_round(tls, H, int32(2))
  2001. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  2002. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  2003. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  2004. }
  2005. return H
  2006. }
  2007. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  2008. var b Tuint64_t
  2009. var left int8
  2010. _, _ = b, left
  2011. left = int8(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  2012. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + libc.Uint64FromInt8(left)) << int32(56)
  2013. switch int32(left) {
  2014. case int32(7):
  2015. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  2016. fallthrough
  2017. case int32(6):
  2018. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  2019. fallthrough
  2020. case int32(5):
  2021. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  2022. fallthrough
  2023. case int32(4):
  2024. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  2025. fallthrough
  2026. case int32(3):
  2027. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  2028. fallthrough
  2029. case int32(2):
  2030. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  2031. fallthrough
  2032. case int32(1):
  2033. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  2034. fallthrough
  2035. case 0:
  2036. break
  2037. }
  2038. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  2039. _sip_round(tls, H, int32(2))
  2040. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  2041. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  2042. _sip_round(tls, H, int32(4))
  2043. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  2044. }
  2045. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  2046. bp := tls.Alloc(64)
  2047. defer tls.Free(64)
  2048. var _ /* state at bp+0 */ Tsiphash
  2049. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  2050. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  2051. }
  2052. func _sip24_valid(tls *libc.TLS) (r int32) {
  2053. bp := tls.Alloc(80)
  2054. defer tls.Free(80)
  2055. var i Tsize_t
  2056. var _ /* in at bp+0 */ [64]uint8
  2057. var _ /* k at bp+64 */ Tsipkey
  2058. _ = i
  2059. _sip_tokey(tls, bp+64, __ccgo_ts)
  2060. i = uint64(0)
  2061. for {
  2062. if !(i < uint64(64)) {
  2063. break
  2064. }
  2065. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  2066. if _siphash24(tls, bp, i, bp+64) != uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8)))<<libc.Int32FromInt32(0)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 1)))<<libc.Int32FromInt32(8)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 2)))<<libc.Int32FromInt32(16)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 3)))<<libc.Int32FromInt32(24)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 4)))<<libc.Int32FromInt32(32)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 5)))<<libc.Int32FromInt32(40)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 6)))<<libc.Int32FromInt32(48)|uint64(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_vectors)) + uintptr(i)*8 + 7)))<<libc.Int32FromInt32(56) {
  2067. return 0
  2068. }
  2069. goto _1
  2070. _1:
  2071. ;
  2072. i++
  2073. }
  2074. return int32(1)
  2075. }
  2076. var _vectors = [64][8]uint8{
  2077. 0: {
  2078. 0: uint8(0x31),
  2079. 1: uint8(0x0e),
  2080. 2: uint8(0x0e),
  2081. 3: uint8(0xdd),
  2082. 4: uint8(0x47),
  2083. 5: uint8(0xdb),
  2084. 6: uint8(0x6f),
  2085. 7: uint8(0x72),
  2086. },
  2087. 1: {
  2088. 0: uint8(0xfd),
  2089. 1: uint8(0x67),
  2090. 2: uint8(0xdc),
  2091. 3: uint8(0x93),
  2092. 4: uint8(0xc5),
  2093. 5: uint8(0x39),
  2094. 6: uint8(0xf8),
  2095. 7: uint8(0x74),
  2096. },
  2097. 2: {
  2098. 0: uint8(0x5a),
  2099. 1: uint8(0x4f),
  2100. 2: uint8(0xa9),
  2101. 3: uint8(0xd9),
  2102. 4: uint8(0x09),
  2103. 5: uint8(0x80),
  2104. 6: uint8(0x6c),
  2105. 7: uint8(0x0d),
  2106. },
  2107. 3: {
  2108. 0: uint8(0x2d),
  2109. 1: uint8(0x7e),
  2110. 2: uint8(0xfb),
  2111. 3: uint8(0xd7),
  2112. 4: uint8(0x96),
  2113. 5: uint8(0x66),
  2114. 6: uint8(0x67),
  2115. 7: uint8(0x85),
  2116. },
  2117. 4: {
  2118. 0: uint8(0xb7),
  2119. 1: uint8(0x87),
  2120. 2: uint8(0x71),
  2121. 3: uint8(0x27),
  2122. 4: uint8(0xe0),
  2123. 5: uint8(0x94),
  2124. 6: uint8(0x27),
  2125. 7: uint8(0xcf),
  2126. },
  2127. 5: {
  2128. 0: uint8(0x8d),
  2129. 1: uint8(0xa6),
  2130. 2: uint8(0x99),
  2131. 3: uint8(0xcd),
  2132. 4: uint8(0x64),
  2133. 5: uint8(0x55),
  2134. 6: uint8(0x76),
  2135. 7: uint8(0x18),
  2136. },
  2137. 6: {
  2138. 0: uint8(0xce),
  2139. 1: uint8(0xe3),
  2140. 2: uint8(0xfe),
  2141. 3: uint8(0x58),
  2142. 4: uint8(0x6e),
  2143. 5: uint8(0x46),
  2144. 6: uint8(0xc9),
  2145. 7: uint8(0xcb),
  2146. },
  2147. 7: {
  2148. 0: uint8(0x37),
  2149. 1: uint8(0xd1),
  2150. 2: uint8(0x01),
  2151. 3: uint8(0x8b),
  2152. 4: uint8(0xf5),
  2153. 6: uint8(0x02),
  2154. 7: uint8(0xab),
  2155. },
  2156. 8: {
  2157. 0: uint8(0x62),
  2158. 1: uint8(0x24),
  2159. 2: uint8(0x93),
  2160. 3: uint8(0x9a),
  2161. 4: uint8(0x79),
  2162. 5: uint8(0xf5),
  2163. 6: uint8(0xf5),
  2164. 7: uint8(0x93),
  2165. },
  2166. 9: {
  2167. 0: uint8(0xb0),
  2168. 1: uint8(0xe4),
  2169. 2: uint8(0xa9),
  2170. 3: uint8(0x0b),
  2171. 4: uint8(0xdf),
  2172. 5: uint8(0x82),
  2173. 7: uint8(0x9e),
  2174. },
  2175. 10: {
  2176. 0: uint8(0xf3),
  2177. 1: uint8(0xb9),
  2178. 2: uint8(0xdd),
  2179. 3: uint8(0x94),
  2180. 4: uint8(0xc5),
  2181. 5: uint8(0xbb),
  2182. 6: uint8(0x5d),
  2183. 7: uint8(0x7a),
  2184. },
  2185. 11: {
  2186. 0: uint8(0xa7),
  2187. 1: uint8(0xad),
  2188. 2: uint8(0x6b),
  2189. 3: uint8(0x22),
  2190. 4: uint8(0x46),
  2191. 5: uint8(0x2f),
  2192. 6: uint8(0xb3),
  2193. 7: uint8(0xf4),
  2194. },
  2195. 12: {
  2196. 0: uint8(0xfb),
  2197. 1: uint8(0xe5),
  2198. 2: uint8(0x0e),
  2199. 3: uint8(0x86),
  2200. 4: uint8(0xbc),
  2201. 5: uint8(0x8f),
  2202. 6: uint8(0x1e),
  2203. 7: uint8(0x75),
  2204. },
  2205. 13: {
  2206. 0: uint8(0x90),
  2207. 1: uint8(0x3d),
  2208. 2: uint8(0x84),
  2209. 3: uint8(0xc0),
  2210. 4: uint8(0x27),
  2211. 5: uint8(0x56),
  2212. 6: uint8(0xea),
  2213. 7: uint8(0x14),
  2214. },
  2215. 14: {
  2216. 0: uint8(0xee),
  2217. 1: uint8(0xf2),
  2218. 2: uint8(0x7a),
  2219. 3: uint8(0x8e),
  2220. 4: uint8(0x90),
  2221. 5: uint8(0xca),
  2222. 6: uint8(0x23),
  2223. 7: uint8(0xf7),
  2224. },
  2225. 15: {
  2226. 0: uint8(0xe5),
  2227. 1: uint8(0x45),
  2228. 2: uint8(0xbe),
  2229. 3: uint8(0x49),
  2230. 4: uint8(0x61),
  2231. 5: uint8(0xca),
  2232. 6: uint8(0x29),
  2233. 7: uint8(0xa1),
  2234. },
  2235. 16: {
  2236. 0: uint8(0xdb),
  2237. 1: uint8(0x9b),
  2238. 2: uint8(0xc2),
  2239. 3: uint8(0x57),
  2240. 4: uint8(0x7f),
  2241. 5: uint8(0xcc),
  2242. 6: uint8(0x2a),
  2243. 7: uint8(0x3f),
  2244. },
  2245. 17: {
  2246. 0: uint8(0x94),
  2247. 1: uint8(0x47),
  2248. 2: uint8(0xbe),
  2249. 3: uint8(0x2c),
  2250. 4: uint8(0xf5),
  2251. 5: uint8(0xe9),
  2252. 6: uint8(0x9a),
  2253. 7: uint8(0x69),
  2254. },
  2255. 18: {
  2256. 0: uint8(0x9c),
  2257. 1: uint8(0xd3),
  2258. 2: uint8(0x8d),
  2259. 3: uint8(0x96),
  2260. 4: uint8(0xf0),
  2261. 5: uint8(0xb3),
  2262. 6: uint8(0xc1),
  2263. 7: uint8(0x4b),
  2264. },
  2265. 19: {
  2266. 0: uint8(0xbd),
  2267. 1: uint8(0x61),
  2268. 2: uint8(0x79),
  2269. 3: uint8(0xa7),
  2270. 4: uint8(0x1d),
  2271. 5: uint8(0xc9),
  2272. 6: uint8(0x6d),
  2273. 7: uint8(0xbb),
  2274. },
  2275. 20: {
  2276. 0: uint8(0x98),
  2277. 1: uint8(0xee),
  2278. 2: uint8(0xa2),
  2279. 3: uint8(0x1a),
  2280. 4: uint8(0xf2),
  2281. 5: uint8(0x5c),
  2282. 6: uint8(0xd6),
  2283. 7: uint8(0xbe),
  2284. },
  2285. 21: {
  2286. 0: uint8(0xc7),
  2287. 1: uint8(0x67),
  2288. 2: uint8(0x3b),
  2289. 3: uint8(0x2e),
  2290. 4: uint8(0xb0),
  2291. 5: uint8(0xcb),
  2292. 6: uint8(0xf2),
  2293. 7: uint8(0xd0),
  2294. },
  2295. 22: {
  2296. 0: uint8(0x88),
  2297. 1: uint8(0x3e),
  2298. 2: uint8(0xa3),
  2299. 3: uint8(0xe3),
  2300. 4: uint8(0x95),
  2301. 5: uint8(0x67),
  2302. 6: uint8(0x53),
  2303. 7: uint8(0x93),
  2304. },
  2305. 23: {
  2306. 0: uint8(0xc8),
  2307. 1: uint8(0xce),
  2308. 2: uint8(0x5c),
  2309. 3: uint8(0xcd),
  2310. 4: uint8(0x8c),
  2311. 5: uint8(0x03),
  2312. 6: uint8(0x0c),
  2313. 7: uint8(0xa8),
  2314. },
  2315. 24: {
  2316. 0: uint8(0x94),
  2317. 1: uint8(0xaf),
  2318. 2: uint8(0x49),
  2319. 3: uint8(0xf6),
  2320. 4: uint8(0xc6),
  2321. 5: uint8(0x50),
  2322. 6: uint8(0xad),
  2323. 7: uint8(0xb8),
  2324. },
  2325. 25: {
  2326. 0: uint8(0xea),
  2327. 1: uint8(0xb8),
  2328. 2: uint8(0x85),
  2329. 3: uint8(0x8a),
  2330. 4: uint8(0xde),
  2331. 5: uint8(0x92),
  2332. 6: uint8(0xe1),
  2333. 7: uint8(0xbc),
  2334. },
  2335. 26: {
  2336. 0: uint8(0xf3),
  2337. 1: uint8(0x15),
  2338. 2: uint8(0xbb),
  2339. 3: uint8(0x5b),
  2340. 4: uint8(0xb8),
  2341. 5: uint8(0x35),
  2342. 6: uint8(0xd8),
  2343. 7: uint8(0x17),
  2344. },
  2345. 27: {
  2346. 0: uint8(0xad),
  2347. 1: uint8(0xcf),
  2348. 2: uint8(0x6b),
  2349. 3: uint8(0x07),
  2350. 4: uint8(0x63),
  2351. 5: uint8(0x61),
  2352. 6: uint8(0x2e),
  2353. 7: uint8(0x2f),
  2354. },
  2355. 28: {
  2356. 0: uint8(0xa5),
  2357. 1: uint8(0xc9),
  2358. 2: uint8(0x1d),
  2359. 3: uint8(0xa7),
  2360. 4: uint8(0xac),
  2361. 5: uint8(0xaa),
  2362. 6: uint8(0x4d),
  2363. 7: uint8(0xde),
  2364. },
  2365. 29: {
  2366. 0: uint8(0x71),
  2367. 1: uint8(0x65),
  2368. 2: uint8(0x95),
  2369. 3: uint8(0x87),
  2370. 4: uint8(0x66),
  2371. 5: uint8(0x50),
  2372. 6: uint8(0xa2),
  2373. 7: uint8(0xa6),
  2374. },
  2375. 30: {
  2376. 0: uint8(0x28),
  2377. 1: uint8(0xef),
  2378. 2: uint8(0x49),
  2379. 3: uint8(0x5c),
  2380. 4: uint8(0x53),
  2381. 5: uint8(0xa3),
  2382. 6: uint8(0x87),
  2383. 7: uint8(0xad),
  2384. },
  2385. 31: {
  2386. 0: uint8(0x42),
  2387. 1: uint8(0xc3),
  2388. 2: uint8(0x41),
  2389. 3: uint8(0xd8),
  2390. 4: uint8(0xfa),
  2391. 5: uint8(0x92),
  2392. 6: uint8(0xd8),
  2393. 7: uint8(0x32),
  2394. },
  2395. 32: {
  2396. 0: uint8(0xce),
  2397. 1: uint8(0x7c),
  2398. 2: uint8(0xf2),
  2399. 3: uint8(0x72),
  2400. 4: uint8(0x2f),
  2401. 5: uint8(0x51),
  2402. 6: uint8(0x27),
  2403. 7: uint8(0x71),
  2404. },
  2405. 33: {
  2406. 0: uint8(0xe3),
  2407. 1: uint8(0x78),
  2408. 2: uint8(0x59),
  2409. 3: uint8(0xf9),
  2410. 4: uint8(0x46),
  2411. 5: uint8(0x23),
  2412. 6: uint8(0xf3),
  2413. 7: uint8(0xa7),
  2414. },
  2415. 34: {
  2416. 0: uint8(0x38),
  2417. 1: uint8(0x12),
  2418. 2: uint8(0x05),
  2419. 3: uint8(0xbb),
  2420. 4: uint8(0x1a),
  2421. 5: uint8(0xb0),
  2422. 6: uint8(0xe0),
  2423. 7: uint8(0x12),
  2424. },
  2425. 35: {
  2426. 0: uint8(0xae),
  2427. 1: uint8(0x97),
  2428. 2: uint8(0xa1),
  2429. 3: uint8(0x0f),
  2430. 4: uint8(0xd4),
  2431. 5: uint8(0x34),
  2432. 6: uint8(0xe0),
  2433. 7: uint8(0x15),
  2434. },
  2435. 36: {
  2436. 0: uint8(0xb4),
  2437. 1: uint8(0xa3),
  2438. 2: uint8(0x15),
  2439. 3: uint8(0x08),
  2440. 4: uint8(0xbe),
  2441. 5: uint8(0xff),
  2442. 6: uint8(0x4d),
  2443. 7: uint8(0x31),
  2444. },
  2445. 37: {
  2446. 0: uint8(0x81),
  2447. 1: uint8(0x39),
  2448. 2: uint8(0x62),
  2449. 3: uint8(0x29),
  2450. 4: uint8(0xf0),
  2451. 5: uint8(0x90),
  2452. 6: uint8(0x79),
  2453. 7: uint8(0x02),
  2454. },
  2455. 38: {
  2456. 0: uint8(0x4d),
  2457. 1: uint8(0x0c),
  2458. 2: uint8(0xf4),
  2459. 3: uint8(0x9e),
  2460. 4: uint8(0xe5),
  2461. 5: uint8(0xd4),
  2462. 6: uint8(0xdc),
  2463. 7: uint8(0xca),
  2464. },
  2465. 39: {
  2466. 0: uint8(0x5c),
  2467. 1: uint8(0x73),
  2468. 2: uint8(0x33),
  2469. 3: uint8(0x6a),
  2470. 4: uint8(0x76),
  2471. 5: uint8(0xd8),
  2472. 6: uint8(0xbf),
  2473. 7: uint8(0x9a),
  2474. },
  2475. 40: {
  2476. 0: uint8(0xd0),
  2477. 1: uint8(0xa7),
  2478. 2: uint8(0x04),
  2479. 3: uint8(0x53),
  2480. 4: uint8(0x6b),
  2481. 5: uint8(0xa9),
  2482. 6: uint8(0x3e),
  2483. 7: uint8(0x0e),
  2484. },
  2485. 41: {
  2486. 0: uint8(0x92),
  2487. 1: uint8(0x59),
  2488. 2: uint8(0x58),
  2489. 3: uint8(0xfc),
  2490. 4: uint8(0xd6),
  2491. 5: uint8(0x42),
  2492. 6: uint8(0x0c),
  2493. 7: uint8(0xad),
  2494. },
  2495. 42: {
  2496. 0: uint8(0xa9),
  2497. 1: uint8(0x15),
  2498. 2: uint8(0xc2),
  2499. 3: uint8(0x9b),
  2500. 4: uint8(0xc8),
  2501. 5: uint8(0x06),
  2502. 6: uint8(0x73),
  2503. 7: uint8(0x18),
  2504. },
  2505. 43: {
  2506. 0: uint8(0x95),
  2507. 1: uint8(0x2b),
  2508. 2: uint8(0x79),
  2509. 3: uint8(0xf3),
  2510. 4: uint8(0xbc),
  2511. 5: uint8(0x0a),
  2512. 6: uint8(0xa6),
  2513. 7: uint8(0xd4),
  2514. },
  2515. 44: {
  2516. 0: uint8(0xf2),
  2517. 1: uint8(0x1d),
  2518. 2: uint8(0xf2),
  2519. 3: uint8(0xe4),
  2520. 4: uint8(0x1d),
  2521. 5: uint8(0x45),
  2522. 6: uint8(0x35),
  2523. 7: uint8(0xf9),
  2524. },
  2525. 45: {
  2526. 0: uint8(0x87),
  2527. 1: uint8(0x57),
  2528. 2: uint8(0x75),
  2529. 3: uint8(0x19),
  2530. 4: uint8(0x04),
  2531. 5: uint8(0x8f),
  2532. 6: uint8(0x53),
  2533. 7: uint8(0xa9),
  2534. },
  2535. 46: {
  2536. 0: uint8(0x10),
  2537. 1: uint8(0xa5),
  2538. 2: uint8(0x6c),
  2539. 3: uint8(0xf5),
  2540. 4: uint8(0xdf),
  2541. 5: uint8(0xcd),
  2542. 6: uint8(0x9a),
  2543. 7: uint8(0xdb),
  2544. },
  2545. 47: {
  2546. 0: uint8(0xeb),
  2547. 1: uint8(0x75),
  2548. 2: uint8(0x09),
  2549. 3: uint8(0x5c),
  2550. 4: uint8(0xcd),
  2551. 5: uint8(0x98),
  2552. 6: uint8(0x6c),
  2553. 7: uint8(0xd0),
  2554. },
  2555. 48: {
  2556. 0: uint8(0x51),
  2557. 1: uint8(0xa9),
  2558. 2: uint8(0xcb),
  2559. 3: uint8(0x9e),
  2560. 4: uint8(0xcb),
  2561. 5: uint8(0xa3),
  2562. 6: uint8(0x12),
  2563. 7: uint8(0xe6),
  2564. },
  2565. 49: {
  2566. 0: uint8(0x96),
  2567. 1: uint8(0xaf),
  2568. 2: uint8(0xad),
  2569. 3: uint8(0xfc),
  2570. 4: uint8(0x2c),
  2571. 5: uint8(0xe6),
  2572. 6: uint8(0x66),
  2573. 7: uint8(0xc7),
  2574. },
  2575. 50: {
  2576. 0: uint8(0x72),
  2577. 1: uint8(0xfe),
  2578. 2: uint8(0x52),
  2579. 3: uint8(0x97),
  2580. 4: uint8(0x5a),
  2581. 5: uint8(0x43),
  2582. 6: uint8(0x64),
  2583. 7: uint8(0xee),
  2584. },
  2585. 51: {
  2586. 0: uint8(0x5a),
  2587. 1: uint8(0x16),
  2588. 2: uint8(0x45),
  2589. 3: uint8(0xb2),
  2590. 4: uint8(0x76),
  2591. 5: uint8(0xd5),
  2592. 6: uint8(0x92),
  2593. 7: uint8(0xa1),
  2594. },
  2595. 52: {
  2596. 0: uint8(0xb2),
  2597. 1: uint8(0x74),
  2598. 2: uint8(0xcb),
  2599. 3: uint8(0x8e),
  2600. 4: uint8(0xbf),
  2601. 5: uint8(0x87),
  2602. 6: uint8(0x87),
  2603. 7: uint8(0x0a),
  2604. },
  2605. 53: {
  2606. 0: uint8(0x6f),
  2607. 1: uint8(0x9b),
  2608. 2: uint8(0xb4),
  2609. 3: uint8(0x20),
  2610. 4: uint8(0x3d),
  2611. 5: uint8(0xe7),
  2612. 6: uint8(0xb3),
  2613. 7: uint8(0x81),
  2614. },
  2615. 54: {
  2616. 0: uint8(0xea),
  2617. 1: uint8(0xec),
  2618. 2: uint8(0xb2),
  2619. 3: uint8(0xa3),
  2620. 4: uint8(0x0b),
  2621. 5: uint8(0x22),
  2622. 6: uint8(0xa8),
  2623. 7: uint8(0x7f),
  2624. },
  2625. 55: {
  2626. 0: uint8(0x99),
  2627. 1: uint8(0x24),
  2628. 2: uint8(0xa4),
  2629. 3: uint8(0x3c),
  2630. 4: uint8(0xc1),
  2631. 5: uint8(0x31),
  2632. 6: uint8(0x57),
  2633. 7: uint8(0x24),
  2634. },
  2635. 56: {
  2636. 0: uint8(0xbd),
  2637. 1: uint8(0x83),
  2638. 2: uint8(0x8d),
  2639. 3: uint8(0x3a),
  2640. 4: uint8(0xaf),
  2641. 5: uint8(0xbf),
  2642. 6: uint8(0x8d),
  2643. 7: uint8(0xb7),
  2644. },
  2645. 57: {
  2646. 0: uint8(0x0b),
  2647. 1: uint8(0x1a),
  2648. 2: uint8(0x2a),
  2649. 3: uint8(0x32),
  2650. 4: uint8(0x65),
  2651. 5: uint8(0xd5),
  2652. 6: uint8(0x1a),
  2653. 7: uint8(0xea),
  2654. },
  2655. 58: {
  2656. 0: uint8(0x13),
  2657. 1: uint8(0x50),
  2658. 2: uint8(0x79),
  2659. 3: uint8(0xa3),
  2660. 4: uint8(0x23),
  2661. 5: uint8(0x1c),
  2662. 6: uint8(0xe6),
  2663. 7: uint8(0x60),
  2664. },
  2665. 59: {
  2666. 0: uint8(0x93),
  2667. 1: uint8(0x2b),
  2668. 2: uint8(0x28),
  2669. 3: uint8(0x46),
  2670. 4: uint8(0xe4),
  2671. 5: uint8(0xd7),
  2672. 6: uint8(0x06),
  2673. 7: uint8(0x66),
  2674. },
  2675. 60: {
  2676. 0: uint8(0xe1),
  2677. 1: uint8(0x91),
  2678. 2: uint8(0x5f),
  2679. 3: uint8(0x5c),
  2680. 4: uint8(0xb1),
  2681. 5: uint8(0xec),
  2682. 6: uint8(0xa4),
  2683. 7: uint8(0x6c),
  2684. },
  2685. 61: {
  2686. 0: uint8(0xf3),
  2687. 1: uint8(0x25),
  2688. 2: uint8(0x96),
  2689. 3: uint8(0x5c),
  2690. 4: uint8(0xa1),
  2691. 5: uint8(0x6d),
  2692. 6: uint8(0x62),
  2693. 7: uint8(0x9f),
  2694. },
  2695. 62: {
  2696. 0: uint8(0x57),
  2697. 1: uint8(0x5f),
  2698. 2: uint8(0xf2),
  2699. 3: uint8(0x8e),
  2700. 4: uint8(0x60),
  2701. 5: uint8(0x38),
  2702. 6: uint8(0x1b),
  2703. 7: uint8(0xe5),
  2704. },
  2705. 63: {
  2706. 0: uint8(0x72),
  2707. 1: uint8(0x45),
  2708. 2: uint8(0x06),
  2709. 3: uint8(0xeb),
  2710. 4: uint8(0x4c),
  2711. 5: uint8(0x32),
  2712. 6: uint8(0x8a),
  2713. 7: uint8(0x95),
  2714. },
  2715. }
  2716. type TICHAR = int8
  2717. type TPOSITION = struct {
  2718. FlineNumber TXML_Size
  2719. FcolumnNumber TXML_Size
  2720. }
  2721. type Tposition = TPOSITION
  2722. type TATTRIBUTE = struct {
  2723. Fname uintptr
  2724. FvaluePtr uintptr
  2725. FvalueEnd uintptr
  2726. Fnormalized int8
  2727. }
  2728. type Tencoding = struct {
  2729. Fscanners [4]TSCANNER
  2730. FliteralScanners [2]TSCANNER
  2731. FnameMatchesAscii uintptr
  2732. FnameLength uintptr
  2733. FskipS uintptr
  2734. FgetAtts uintptr
  2735. FcharRefNumber uintptr
  2736. FpredefinedEntityName uintptr
  2737. FupdatePosition uintptr
  2738. FisPublicId uintptr
  2739. Futf8Convert uintptr
  2740. Futf16Convert uintptr
  2741. FminBytesPerChar int32
  2742. FisUtf8 int8
  2743. FisUtf16 int8
  2744. }
  2745. type TENCODING = struct {
  2746. Fscanners [4]TSCANNER
  2747. FliteralScanners [2]TSCANNER
  2748. FnameMatchesAscii uintptr
  2749. FnameLength uintptr
  2750. FskipS uintptr
  2751. FgetAtts uintptr
  2752. FcharRefNumber uintptr
  2753. FpredefinedEntityName uintptr
  2754. FupdatePosition uintptr
  2755. FisPublicId uintptr
  2756. Futf8Convert uintptr
  2757. Futf16Convert uintptr
  2758. FminBytesPerChar int32
  2759. FisUtf8 int8
  2760. FisUtf16 int8
  2761. }
  2762. type TSCANNER = uintptr
  2763. type _XML_Convert_Result = int32
  2764. const _XML_CONVERT_COMPLETED = 0
  2765. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2766. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2767. type TINIT_ENCODING = struct {
  2768. FinitEnc TENCODING
  2769. FencPtr uintptr
  2770. }
  2771. type TCONVERTER = uintptr
  2772. const _XML_ROLE_ERROR = -1
  2773. const _XML_ROLE_NONE = 0
  2774. const _XML_ROLE_XML_DECL = 1
  2775. const _XML_ROLE_INSTANCE_START = 2
  2776. const _XML_ROLE_DOCTYPE_NONE = 3
  2777. const _XML_ROLE_DOCTYPE_NAME = 4
  2778. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2779. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2780. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2781. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2782. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2783. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2784. const _XML_ROLE_ENTITY_NONE = 11
  2785. const _XML_ROLE_ENTITY_VALUE = 12
  2786. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2787. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2788. const _XML_ROLE_ENTITY_COMPLETE = 15
  2789. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2790. const _XML_ROLE_NOTATION_NONE = 17
  2791. const _XML_ROLE_NOTATION_NAME = 18
  2792. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2793. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2794. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2795. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2796. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2797. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2798. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2799. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2800. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2801. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2802. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2803. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2804. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2805. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2806. const _XML_ROLE_ATTLIST_NONE = 33
  2807. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2808. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2809. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2810. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2811. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2812. const _XML_ROLE_ELEMENT_NONE = 39
  2813. const _XML_ROLE_ELEMENT_NAME = 40
  2814. const _XML_ROLE_CONTENT_ANY = 41
  2815. const _XML_ROLE_CONTENT_EMPTY = 42
  2816. const _XML_ROLE_CONTENT_PCDATA = 43
  2817. const _XML_ROLE_GROUP_OPEN = 44
  2818. const _XML_ROLE_GROUP_CLOSE = 45
  2819. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2820. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2821. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2822. const _XML_ROLE_GROUP_CHOICE = 49
  2823. const _XML_ROLE_GROUP_SEQUENCE = 50
  2824. const _XML_ROLE_CONTENT_ELEMENT = 51
  2825. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2826. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2827. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2828. const _XML_ROLE_PI = 55
  2829. const _XML_ROLE_COMMENT = 56
  2830. const _XML_ROLE_TEXT_DECL = 57
  2831. const _XML_ROLE_IGNORE_SECT = 58
  2832. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2833. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2834. type TPROLOG_STATE = struct {
  2835. Fhandler uintptr
  2836. Flevel uint32
  2837. Frole_none int32
  2838. FincludeLevel uint32
  2839. FdocumentEntity int32
  2840. FinEntityValue int32
  2841. }
  2842. type Tprolog_state = TPROLOG_STATE
  2843. type TKEY = uintptr
  2844. type TNAMED = struct {
  2845. Fname TKEY
  2846. }
  2847. type THASH_TABLE = struct {
  2848. Fv uintptr
  2849. Fpower uint8
  2850. Fsize Tsize_t
  2851. Fused Tsize_t
  2852. Fmem uintptr
  2853. }
  2854. /* For probing (after a collision) we need a step size relative prime
  2855. to the hash table size, which is a power of 2. We use double-hashing,
  2856. since we can calculate a second hash value cheaply by taking those bits
  2857. of the first hash value that were discarded (masked out) when the table
  2858. index was calculated: index = hash & mask, where mask = table->size - 1.
  2859. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2860. it odd, since odd numbers are always relative prime to a power of 2.
  2861. */
  2862. type THASH_TABLE_ITER = struct {
  2863. Fp uintptr
  2864. Fend uintptr
  2865. }
  2866. type TBINDING = struct {
  2867. Fprefix uintptr
  2868. FnextTagBinding uintptr
  2869. FprevPrefixBinding uintptr
  2870. FattId uintptr
  2871. Furi uintptr
  2872. FuriLen int32
  2873. FuriAlloc int32
  2874. }
  2875. type Tbinding = TBINDING
  2876. type TPREFIX = struct {
  2877. Fname uintptr
  2878. Fbinding uintptr
  2879. }
  2880. type Tprefix = TPREFIX
  2881. type TTAG_NAME = struct {
  2882. Fstr uintptr
  2883. FlocalPart uintptr
  2884. Fprefix uintptr
  2885. FstrLen int32
  2886. FuriLen int32
  2887. FprefixLen int32
  2888. }
  2889. // C documentation
  2890. //
  2891. // /* TAG represents an open element.
  2892. // The name of the element is stored in both the document and API
  2893. // encodings. The memory buffer 'buf' is a separately-allocated
  2894. // memory area which stores the name. During the XML_Parse()/
  2895. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2896. // version of the name (in the document encoding) is shared with the
  2897. // document buffer. If the element is open across calls to
  2898. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2899. // contain the 'raw' name as well.
  2900. //
  2901. // A parser re-uses these structures, maintaining a list of allocated
  2902. // TAG objects in a free list.
  2903. // */
  2904. type TTAG = struct {
  2905. Fparent uintptr
  2906. FrawName uintptr
  2907. FrawNameLength int32
  2908. Fname TTAG_NAME
  2909. Fbuf uintptr
  2910. FbufEnd uintptr
  2911. Fbindings uintptr
  2912. }
  2913. // C documentation
  2914. //
  2915. // /* TAG represents an open element.
  2916. // The name of the element is stored in both the document and API
  2917. // encodings. The memory buffer 'buf' is a separately-allocated
  2918. // memory area which stores the name. During the XML_Parse()/
  2919. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2920. // version of the name (in the document encoding) is shared with the
  2921. // document buffer. If the element is open across calls to
  2922. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2923. // contain the 'raw' name as well.
  2924. //
  2925. // A parser re-uses these structures, maintaining a list of allocated
  2926. // TAG objects in a free list.
  2927. // */
  2928. type Ttag = TTAG
  2929. type TENTITY = struct {
  2930. Fname uintptr
  2931. FtextPtr uintptr
  2932. FtextLen int32
  2933. Fprocessed int32
  2934. FsystemId uintptr
  2935. Fbase uintptr
  2936. FpublicId uintptr
  2937. Fnotation uintptr
  2938. Fopen TXML_Bool
  2939. Fis_param TXML_Bool
  2940. Fis_internal TXML_Bool
  2941. }
  2942. type TCONTENT_SCAFFOLD = struct {
  2943. Ftype1 _XML_Content_Type
  2944. Fquant _XML_Content_Quant
  2945. Fname uintptr
  2946. Ffirstchild int32
  2947. Flastchild int32
  2948. Fchildcnt int32
  2949. Fnextsib int32
  2950. }
  2951. type TBLOCK = struct {
  2952. Fnext uintptr
  2953. Fsize int32
  2954. Fs [1]TXML_Char
  2955. }
  2956. type Tblock = TBLOCK
  2957. type TSTRING_POOL = struct {
  2958. Fblocks uintptr
  2959. FfreeBlocks uintptr
  2960. Fend uintptr
  2961. Fptr uintptr
  2962. Fstart uintptr
  2963. Fmem uintptr
  2964. }
  2965. // C documentation
  2966. //
  2967. // /* The XML_Char before the name is used to determine whether
  2968. // an attribute has been specified. */
  2969. type TATTRIBUTE_ID = struct {
  2970. Fname uintptr
  2971. Fprefix uintptr
  2972. FmaybeTokenized TXML_Bool
  2973. Fxmlns TXML_Bool
  2974. }
  2975. // C documentation
  2976. //
  2977. // /* The XML_Char before the name is used to determine whether
  2978. // an attribute has been specified. */
  2979. type Tattribute_id = TATTRIBUTE_ID
  2980. type TDEFAULT_ATTRIBUTE = struct {
  2981. Fid uintptr
  2982. FisCdata TXML_Bool
  2983. Fvalue uintptr
  2984. }
  2985. type TNS_ATT = struct {
  2986. Fversion uint64
  2987. Fhash uint64
  2988. FuriName uintptr
  2989. }
  2990. type TELEMENT_TYPE = struct {
  2991. Fname uintptr
  2992. Fprefix uintptr
  2993. FidAtt uintptr
  2994. FnDefaultAtts int32
  2995. FallocDefaultAtts int32
  2996. FdefaultAtts uintptr
  2997. }
  2998. type TDTD = struct {
  2999. FgeneralEntities THASH_TABLE
  3000. FelementTypes THASH_TABLE
  3001. FattributeIds THASH_TABLE
  3002. Fprefixes THASH_TABLE
  3003. Fpool TSTRING_POOL
  3004. FentityValuePool TSTRING_POOL
  3005. FkeepProcessing TXML_Bool
  3006. FhasParamEntityRefs TXML_Bool
  3007. Fstandalone TXML_Bool
  3008. FparamEntityRead TXML_Bool
  3009. FparamEntities THASH_TABLE
  3010. FdefaultPrefix TPREFIX
  3011. Fin_eldecl TXML_Bool
  3012. Fscaffold uintptr
  3013. FcontentStringLen uint32
  3014. FscaffSize uint32
  3015. FscaffCount uint32
  3016. FscaffLevel int32
  3017. FscaffIndex uintptr
  3018. }
  3019. type TOPEN_INTERNAL_ENTITY = struct {
  3020. FinternalEventPtr uintptr
  3021. FinternalEventEndPtr uintptr
  3022. Fnext uintptr
  3023. Fentity uintptr
  3024. FstartTagLevel int32
  3025. FbetweenDecl TXML_Bool
  3026. }
  3027. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  3028. type _XML_Account = int32
  3029. const _XML_ACCOUNT_DIRECT = 0
  3030. const /* bytes directly passed to the Expat parser */
  3031. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  3032. const /* intermediate bytes produced during entity
  3033. expansion */
  3034. _XML_ACCOUNT_NONE = 2
  3035. type TXmlBigCount = uint64
  3036. type TACCOUNTING = struct {
  3037. FcountBytesDirect TXmlBigCount
  3038. FcountBytesIndirect TXmlBigCount
  3039. FdebugLevel int32
  3040. FmaximumAmplificationFactor float32
  3041. FactivationThresholdBytes uint64
  3042. }
  3043. type Taccounting = TACCOUNTING
  3044. type TENTITY_STATS = struct {
  3045. FcountEverOpened uint32
  3046. FcurrentDepth uint32
  3047. FmaximumDepthSeen uint32
  3048. FdebugLevel int32
  3049. }
  3050. type Tentity_stats = TENTITY_STATS
  3051. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  3052. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  3053. }
  3054. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  3055. bp := tls.Alloc(16)
  3056. defer tls.Free(16)
  3057. var _ /* tmp at bp+0 */ [2]TXML_Char
  3058. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3059. 0: nsSep,
  3060. }
  3061. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  3062. }
  3063. // C documentation
  3064. //
  3065. // // "xml=http://www.w3.org/XML/1998/namespace"
  3066. var _implicitContext = [41]TXML_Char{
  3067. 0: int8(m_ASCII_x),
  3068. 1: int8(m_ASCII_m),
  3069. 2: int8(m_ASCII_l),
  3070. 3: int8(m_ASCII_EQUALS),
  3071. 4: int8(m_ASCII_h),
  3072. 5: int8(m_ASCII_t),
  3073. 6: int8(m_ASCII_t),
  3074. 7: int8(m_ASCII_p),
  3075. 8: int8(m_ASCII_COLON),
  3076. 9: int8(m_ASCII_SLASH),
  3077. 10: int8(m_ASCII_SLASH),
  3078. 11: int8(m_ASCII_w),
  3079. 12: int8(m_ASCII_w),
  3080. 13: int8(m_ASCII_w),
  3081. 14: int8(m_ASCII_PERIOD),
  3082. 15: int8(m_ASCII_w),
  3083. 16: int8(m_ASCII_3),
  3084. 17: int8(m_ASCII_PERIOD),
  3085. 18: int8(m_ASCII_o),
  3086. 19: int8(m_ASCII_r),
  3087. 20: int8(m_ASCII_g),
  3088. 21: int8(m_ASCII_SLASH),
  3089. 22: int8(m_ASCII_X),
  3090. 23: int8(m_ASCII_M),
  3091. 24: int8(m_ASCII_L),
  3092. 25: int8(m_ASCII_SLASH),
  3093. 26: int8(m_ASCII_1),
  3094. 27: int8(m_ASCII_9),
  3095. 28: int8(m_ASCII_9),
  3096. 29: int8(m_ASCII_8),
  3097. 30: int8(m_ASCII_SLASH),
  3098. 31: int8(m_ASCII_n),
  3099. 32: int8(m_ASCII_a),
  3100. 33: int8(m_ASCII_m),
  3101. 34: int8(m_ASCII_e),
  3102. 35: int8(m_ASCII_s),
  3103. 36: int8(m_ASCII_p),
  3104. 37: int8(m_ASCII_a),
  3105. 38: int8(m_ASCII_c),
  3106. 39: int8(m_ASCII_e),
  3107. }
  3108. /* To avoid warnings about unused functions: */
  3109. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  3110. bp := tls.Alloc(48)
  3111. defer tls.Free(48)
  3112. if _getDebugLevel(tls, __ccgo_ts+17, uint64(0)) >= uint64(1) {
  3113. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  3114. }
  3115. return entropy
  3116. }
  3117. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  3118. bp := tls.Alloc(16)
  3119. defer tls.Free(16)
  3120. var _ /* entropy at bp+0 */ uint64
  3121. _ = parser
  3122. /* "Failproof" high quality providers: */
  3123. _arc4random_buf(tls, bp, uint64(8))
  3124. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint64)(unsafe.Pointer(bp)))
  3125. }
  3126. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  3127. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  3128. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  3129. }
  3130. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3131. }
  3132. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  3133. /* hash functions must be initialized before setContext() is called */
  3134. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  3135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  3136. }
  3137. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3138. /* implicit context only set for root parser, since child
  3139. parsers (i.e. external entity parsers) will inherit it
  3140. */
  3141. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  3142. }
  3143. return libc.Uint8FromInt32(1)
  3144. }
  3145. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  3146. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  3147. }
  3148. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  3149. var mtemp, mtemp1 uintptr
  3150. var parser TXML_Parser
  3151. _, _, _ = mtemp, mtemp1, parser
  3152. if memsuite != 0 {
  3153. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(976))
  3154. if parser != libc.UintptrFromInt32(0) {
  3155. mtemp = parser + 24
  3156. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  3157. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  3158. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  3159. }
  3160. } else {
  3161. parser = libc.Xmalloc(tls, uint64(976))
  3162. if parser != libc.UintptrFromInt32(0) {
  3163. mtemp1 = parser + 24
  3164. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  3165. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  3166. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  3167. }
  3168. }
  3169. if !(parser != 0) {
  3170. return parser
  3171. }
  3172. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  3173. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  3174. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  3175. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  3176. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  3177. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3178. return libc.UintptrFromInt32(0)
  3179. }
  3180. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_DATA_BUF_SIZE)*libc.Uint64FromInt64(1))
  3181. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  3182. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  3183. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3184. return libc.UintptrFromInt32(0)
  3185. }
  3186. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  3187. if dtd != 0 {
  3188. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  3189. } else {
  3190. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  3191. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  3192. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)
  3193. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  3194. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3195. return libc.UintptrFromInt32(0)
  3196. }
  3197. }
  3198. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  3199. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3200. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3201. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  3202. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  3203. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  3204. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  3205. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = int8(m_ASCII_EXCL)
  3206. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  3207. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  3208. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  3209. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  3210. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  3211. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3212. _poolInit(tls, parser+784, parser+24)
  3213. _poolInit(tls, parser+832, parser+24)
  3214. _parserInit(tls, parser, encodingName)
  3215. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3216. if dtd != 0 {
  3217. // We need to stop the upcoming call to XML_ParserFree from happily
  3218. // destroying parser->m_dtd because the DTD is shared with the parent
  3219. // parser and the only guard that keeps XML_ParserFree from destroying
  3220. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  3221. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  3222. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  3223. }
  3224. XXML_ParserFree(tls, parser)
  3225. return libc.UintptrFromInt32(0)
  3226. }
  3227. if nameSep != 0 {
  3228. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3229. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3230. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3231. } else {
  3232. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3233. }
  3234. return parser
  3235. }
  3236. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3237. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3238. XXmlPrologStateInit(tls, parser+496)
  3239. if encodingName != libc.UintptrFromInt32(0) {
  3240. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3241. }
  3242. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3243. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  3244. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3245. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3246. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3247. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3248. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3249. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3250. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3251. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3252. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3254. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3255. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3257. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3258. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3259. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3260. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3262. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3263. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3266. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3269. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3272. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3273. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3274. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3275. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3276. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3277. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3278. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3280. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3281. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3282. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3283. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3284. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3285. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3286. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3287. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3288. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3290. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3291. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3292. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3293. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3294. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3296. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3297. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3298. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3299. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3300. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3301. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3302. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3303. libc.Xmemset(tls, parser+928, 0, uint64(32))
  3304. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3305. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3306. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3307. libc.Xmemset(tls, parser+960, 0, uint64(16))
  3308. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3309. }
  3310. // C documentation
  3311. //
  3312. // /* moves list of bindings to m_freeBindingList */
  3313. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3314. var b uintptr
  3315. _ = b
  3316. for bindings != 0 {
  3317. b = bindings
  3318. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3319. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3320. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3321. }
  3322. }
  3323. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3324. var openEntity, openEntityList, tStk, tag uintptr
  3325. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3326. if parser == libc.UintptrFromInt32(0) {
  3327. return libc.Uint8FromInt32(0)
  3328. }
  3329. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3330. return libc.Uint8FromInt32(0)
  3331. }
  3332. /* move m_tagStack to m_freeTagList */
  3333. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3334. for tStk != 0 {
  3335. tag = tStk
  3336. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3337. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3338. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3339. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3340. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3341. }
  3342. /* move m_openInternalEntities to m_freeInternalEntities */
  3343. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3344. for openEntityList != 0 {
  3345. openEntity = openEntityList
  3346. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3347. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3348. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3349. }
  3350. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3351. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem)
  3352. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3353. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3354. }
  3355. _poolClear(tls, parser+784)
  3356. _poolClear(tls, parser+832)
  3357. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  3358. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3359. _parserInit(tls, parser, encodingName)
  3360. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3361. return libc.Uint8FromInt32(1)
  3362. }
  3363. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3364. if parser == libc.UintptrFromInt32(0) {
  3365. return int32(_XML_STATUS_ERROR)
  3366. }
  3367. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3368. XXX There's no way for the caller to determine which of the
  3369. XXX possible error cases caused the XML_STATUS_ERROR return.
  3370. */
  3371. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3372. return int32(_XML_STATUS_ERROR)
  3373. }
  3374. /* Get rid of any previous encoding name */
  3375. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  3376. if encodingName == libc.UintptrFromInt32(0) {
  3377. /* No new encoding name */
  3378. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3379. } else {
  3380. /* Copy the new encoding name into allocated memory */
  3381. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3382. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3383. return int32(_XML_STATUS_ERROR)
  3384. }
  3385. }
  3386. return int32(_XML_STATUS_OK)
  3387. }
  3388. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3389. bp := tls.Alloc(16)
  3390. defer tls.Free(16)
  3391. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3392. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3393. var oldCharacterDataHandler TXML_CharacterDataHandler
  3394. var oldCommentHandler TXML_CommentHandler
  3395. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3396. var oldDefaultHandler TXML_DefaultHandler
  3397. var oldElementDeclHandler TXML_ElementDeclHandler
  3398. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3399. var oldEndElementHandler TXML_EndElementHandler
  3400. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3401. var oldEntityDeclHandler TXML_EntityDeclHandler
  3402. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3403. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3404. var oldInEntityValue int32
  3405. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3406. var oldNotationDeclHandler TXML_NotationDeclHandler
  3407. var oldParamEntityParsing _XML_ParamEntityParsing
  3408. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3409. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3410. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3411. var oldStartElementHandler TXML_StartElementHandler
  3412. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3413. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3414. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3415. var oldXmlDeclHandler TXML_XmlDeclHandler
  3416. var oldhash_secret_salt uint64
  3417. var _ /* tmp at bp+0 */ [2]TXML_Char
  3418. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = newDtd, oldAttlistDeclHandler, oldCharacterDataHandler, oldCommentHandler, oldDeclElementType, oldDefaultExpandInternalEntities, oldDefaultHandler, oldDtd, oldElementDeclHandler, oldEndCdataSectionHandler, oldEndElementHandler, oldEndNamespaceDeclHandler, oldEntityDeclHandler, oldExternalEntityRefHandler, oldExternalEntityRefHandlerArg, oldHandlerArg, oldInEntityValue, oldNotStandaloneHandler, oldNotationDeclHandler, oldParamEntityParsing, oldProcessingInstructionHandler, oldSkippedEntityHandler, oldStartCdataSectionHandler, oldStartElementHandler, oldStartNamespaceDeclHandler, oldUnknownEncodingHandler, oldUnparsedEntityDeclHandler, oldUserData, oldXmlDeclHandler, oldhash_secret_salt, oldns_triplets, parser
  3419. parser = oldParser
  3420. newDtd = libc.UintptrFromInt32(0)
  3421. /* Validate the oldParser parameter before we pull everything out of it */
  3422. if oldParser == libc.UintptrFromInt32(0) {
  3423. return libc.UintptrFromInt32(0)
  3424. }
  3425. /* Stash the original parser contents on the stack */
  3426. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3427. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3428. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3429. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3430. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3431. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3432. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3433. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3434. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3435. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3436. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3437. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3438. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3439. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3440. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3441. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3442. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3443. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3444. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3445. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3446. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3447. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3448. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3449. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3450. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3451. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3452. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3453. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3454. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3455. /* Note that the new parser shares the same hash secret as the old
  3456. parser, so that dtdCopy and copyEntityTable can lookup values
  3457. from hash tables associated with either parser without us having
  3458. to worry which hash secrets each table has.
  3459. */
  3460. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3461. if !(context != 0) {
  3462. newDtd = oldDtd
  3463. }
  3464. /* Note that the magical uses of the pre-processor to make field
  3465. access look more like C++ require that `parser' be overwritten
  3466. here. This makes this function more painful to follow than it
  3467. would be otherwise.
  3468. */
  3469. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3470. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3471. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3472. }
  3473. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3474. } else {
  3475. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3476. }
  3477. if !(parser != 0) {
  3478. return libc.UintptrFromInt32(0)
  3479. }
  3480. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3481. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3483. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3484. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3485. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3486. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3487. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3489. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3490. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3491. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3492. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3493. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3494. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3495. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3496. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3497. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3499. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3500. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3501. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3502. if oldUserData == oldHandlerArg {
  3503. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3504. } else {
  3505. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3506. }
  3507. if oldExternalEntityRefHandlerArg != oldParser {
  3508. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3509. }
  3510. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3511. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3512. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3514. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3516. if context != 0 {
  3517. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3518. XXML_ParserFree(tls, parser)
  3519. return libc.UintptrFromInt32(0)
  3520. }
  3521. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3522. } else {
  3523. /* The DTD instance referenced by parser->m_dtd is shared between the
  3524. document's root parser and external PE parsers, therefore one does not
  3525. need to call setContext. In addition, one also *must* not call
  3526. setContext, because this would overwrite existing prefix->binding
  3527. pointers in parser->m_dtd with ones that get destroyed with the external
  3528. PE parser. This would leave those prefixes with dangling pointers.
  3529. */
  3530. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3531. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3532. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3533. }
  3534. return parser
  3535. }
  3536. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3537. var b uintptr
  3538. _ = b
  3539. for {
  3540. b = bindings
  3541. if !(b != 0) {
  3542. break
  3543. }
  3544. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3545. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3546. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3547. goto _1
  3548. _1:
  3549. }
  3550. }
  3551. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3552. var entityList, openEntity, p, tagList uintptr
  3553. _, _, _, _ = entityList, openEntity, p, tagList
  3554. if parser == libc.UintptrFromInt32(0) {
  3555. return
  3556. }
  3557. /* free m_tagStack and m_freeTagList */
  3558. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3559. for {
  3560. if tagList == libc.UintptrFromInt32(0) {
  3561. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3562. break
  3563. }
  3564. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3565. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3566. }
  3567. p = tagList
  3568. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3569. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3570. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3571. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3572. goto _1
  3573. _1:
  3574. }
  3575. /* free m_openInternalEntities and m_freeInternalEntities */
  3576. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3577. for {
  3578. if entityList == libc.UintptrFromInt32(0) {
  3579. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3580. break
  3581. }
  3582. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3583. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3584. }
  3585. openEntity = entityList
  3586. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3587. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3588. goto _2
  3589. _2:
  3590. }
  3591. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3592. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3593. _poolDestroy(tls, parser+784)
  3594. _poolDestroy(tls, parser+832)
  3595. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  3596. /* external parameter entity parsers share the DTD structure
  3597. parser->m_dtd with the root parser, so we must not destroy it
  3598. */
  3599. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3600. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3601. }
  3602. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  3603. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector)
  3604. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3605. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)
  3606. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts)
  3607. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem)
  3608. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3609. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3610. }
  3611. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3612. }
  3613. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3614. if parser != libc.UintptrFromInt32(0) {
  3615. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3616. }
  3617. }
  3618. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3619. if parser == libc.UintptrFromInt32(0) {
  3620. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3621. }
  3622. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3623. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3624. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3625. }
  3626. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3627. return int32(_XML_ERROR_NONE)
  3628. }
  3629. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3630. var v1 int32
  3631. _ = v1
  3632. if parser == libc.UintptrFromInt32(0) {
  3633. return
  3634. }
  3635. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3636. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3637. return
  3638. }
  3639. if do_nst != 0 {
  3640. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3641. } else {
  3642. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3643. }
  3644. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3645. }
  3646. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3647. var v1 uintptr
  3648. _ = v1
  3649. if parser == libc.UintptrFromInt32(0) {
  3650. return
  3651. }
  3652. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3653. v1 = p
  3654. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3655. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3656. } else {
  3657. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3658. }
  3659. }
  3660. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3661. if parser == libc.UintptrFromInt32(0) {
  3662. return int32(_XML_STATUS_ERROR)
  3663. }
  3664. if p != 0 {
  3665. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3666. if !(p != 0) {
  3667. return int32(_XML_STATUS_ERROR)
  3668. }
  3669. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3670. } else {
  3671. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3672. }
  3673. return int32(_XML_STATUS_OK)
  3674. }
  3675. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3676. if parser == libc.UintptrFromInt32(0) {
  3677. return libc.UintptrFromInt32(0)
  3678. }
  3679. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3680. }
  3681. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3682. if parser == libc.UintptrFromInt32(0) {
  3683. return -int32(1)
  3684. }
  3685. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3686. }
  3687. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3688. if parser == libc.UintptrFromInt32(0) {
  3689. return -int32(1)
  3690. }
  3691. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3692. }
  3693. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3694. if parser == libc.UintptrFromInt32(0) {
  3695. return
  3696. }
  3697. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3698. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3699. }
  3700. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3701. if parser != libc.UintptrFromInt32(0) {
  3702. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3703. }
  3704. }
  3705. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3706. if parser != libc.UintptrFromInt32(0) {
  3707. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3708. }
  3709. }
  3710. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3711. if parser != libc.UintptrFromInt32(0) {
  3712. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3713. }
  3714. }
  3715. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3716. if parser != libc.UintptrFromInt32(0) {
  3717. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3718. }
  3719. }
  3720. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3721. if parser != libc.UintptrFromInt32(0) {
  3722. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3723. }
  3724. }
  3725. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3726. if parser == libc.UintptrFromInt32(0) {
  3727. return
  3728. }
  3729. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3730. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3731. }
  3732. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3733. if parser != libc.UintptrFromInt32(0) {
  3734. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3735. }
  3736. }
  3737. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3738. if parser != libc.UintptrFromInt32(0) {
  3739. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3740. }
  3741. }
  3742. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3743. if parser == libc.UintptrFromInt32(0) {
  3744. return
  3745. }
  3746. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3747. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3748. }
  3749. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3750. if parser == libc.UintptrFromInt32(0) {
  3751. return
  3752. }
  3753. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3754. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3755. }
  3756. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3757. if parser == libc.UintptrFromInt32(0) {
  3758. return
  3759. }
  3760. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3761. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3762. }
  3763. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3764. if parser != libc.UintptrFromInt32(0) {
  3765. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3766. }
  3767. }
  3768. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3769. if parser != libc.UintptrFromInt32(0) {
  3770. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3771. }
  3772. }
  3773. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3774. if parser != libc.UintptrFromInt32(0) {
  3775. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3776. }
  3777. }
  3778. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3779. if parser != libc.UintptrFromInt32(0) {
  3780. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3781. }
  3782. }
  3783. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3784. if parser == libc.UintptrFromInt32(0) {
  3785. return
  3786. }
  3787. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3788. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3789. }
  3790. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3791. if parser != libc.UintptrFromInt32(0) {
  3792. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3793. }
  3794. }
  3795. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3796. if parser != libc.UintptrFromInt32(0) {
  3797. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3798. }
  3799. }
  3800. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3801. if parser != libc.UintptrFromInt32(0) {
  3802. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3803. }
  3804. }
  3805. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3806. if parser != libc.UintptrFromInt32(0) {
  3807. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3808. }
  3809. }
  3810. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3811. if parser == libc.UintptrFromInt32(0) {
  3812. return
  3813. }
  3814. if arg != 0 {
  3815. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3816. } else {
  3817. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3818. }
  3819. }
  3820. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3821. if parser != libc.UintptrFromInt32(0) {
  3822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3823. }
  3824. }
  3825. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3826. if parser == libc.UintptrFromInt32(0) {
  3827. return
  3828. }
  3829. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3830. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3831. }
  3832. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3833. if parser != libc.UintptrFromInt32(0) {
  3834. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3835. }
  3836. }
  3837. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3838. if parser != libc.UintptrFromInt32(0) {
  3839. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3840. }
  3841. }
  3842. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3843. if parser != libc.UintptrFromInt32(0) {
  3844. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3845. }
  3846. }
  3847. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3848. if parser != libc.UintptrFromInt32(0) {
  3849. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3850. }
  3851. }
  3852. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3853. if parser == libc.UintptrFromInt32(0) {
  3854. return 0
  3855. }
  3856. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3857. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3858. return 0
  3859. }
  3860. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3861. return int32(1)
  3862. }
  3863. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3864. if parser == libc.UintptrFromInt32(0) {
  3865. return 0
  3866. }
  3867. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3868. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3869. }
  3870. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3871. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3872. return 0
  3873. }
  3874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3875. return int32(1)
  3876. }
  3877. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3878. var buff uintptr
  3879. _ = buff
  3880. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3881. if parser != libc.UintptrFromInt32(0) {
  3882. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3883. }
  3884. return int32(_XML_STATUS_ERROR)
  3885. }
  3886. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3887. case int32(_XML_SUSPENDED):
  3888. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3889. return int32(_XML_STATUS_ERROR)
  3890. case int32(_XML_FINISHED):
  3891. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3892. return int32(_XML_STATUS_ERROR)
  3893. case int32(_XML_INITIALIZED):
  3894. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3895. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3896. return int32(_XML_STATUS_ERROR)
  3897. }
  3898. /* fall through */
  3899. fallthrough
  3900. default:
  3901. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3902. }
  3903. if len1 == 0 {
  3904. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3905. if !(isFinal != 0) {
  3906. return int32(_XML_STATUS_OK)
  3907. }
  3908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3909. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3910. /* If data are left over from last buffer, and we now know that these
  3911. data are the final chunk of input, then we have to check them again
  3912. to detect errors based on that fact.
  3913. */
  3914. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3915. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3916. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3917. case int32(_XML_SUSPENDED):
  3918. /* It is hard to be certain, but it seems that this case
  3919. * cannot occur. This code is cleaning up a previous parse
  3920. * with no new data (since len == 0). Changing the parsing
  3921. * state requires getting to execute a handler function, and
  3922. * there doesn't seem to be an opportunity for that while in
  3923. * this circumstance.
  3924. *
  3925. * Given the uncertainty, we retain the code but exclude it
  3926. * from coverage tests.
  3927. *
  3928. * LCOV_EXCL_START
  3929. */
  3930. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  3931. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3932. return int32(_XML_STATUS_SUSPENDED)
  3933. /* LCOV_EXCL_STOP */
  3934. fallthrough
  3935. case int32(_XML_INITIALIZED):
  3936. fallthrough
  3937. case int32(_XML_PARSING):
  3938. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3939. /* fall through */
  3940. fallthrough
  3941. default:
  3942. return int32(_XML_STATUS_OK)
  3943. }
  3944. }
  3945. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3946. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3947. return int32(_XML_STATUS_ERROR)
  3948. } else {
  3949. buff = XXML_GetBuffer(tls, parser, len1)
  3950. if buff == libc.UintptrFromInt32(0) {
  3951. return int32(_XML_STATUS_ERROR)
  3952. } else {
  3953. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3954. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3955. }
  3956. }
  3957. return r
  3958. }
  3959. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3960. var result _XML_Status
  3961. var start uintptr
  3962. _, _ = result, start
  3963. result = int32(_XML_STATUS_OK)
  3964. if parser == libc.UintptrFromInt32(0) {
  3965. return int32(_XML_STATUS_ERROR)
  3966. }
  3967. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3968. case int32(_XML_SUSPENDED):
  3969. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3970. return int32(_XML_STATUS_ERROR)
  3971. case int32(_XML_FINISHED):
  3972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3973. return int32(_XML_STATUS_ERROR)
  3974. case int32(_XML_INITIALIZED):
  3975. /* Has someone called XML_GetBuffer successfully before? */
  3976. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3978. return int32(_XML_STATUS_ERROR)
  3979. }
  3980. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3982. return int32(_XML_STATUS_ERROR)
  3983. }
  3984. /* fall through */
  3985. fallthrough
  3986. default:
  3987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3988. }
  3989. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3991. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3992. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3993. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3994. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3995. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, start, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3996. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3997. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3998. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3999. return int32(_XML_STATUS_ERROR)
  4000. } else {
  4001. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4002. case int32(_XML_SUSPENDED):
  4003. result = int32(_XML_STATUS_SUSPENDED)
  4004. case int32(_XML_INITIALIZED):
  4005. fallthrough
  4006. case int32(_XML_PARSING):
  4007. if isFinal != 0 {
  4008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4009. return result
  4010. }
  4011. fallthrough
  4012. default: /* should not happen */
  4013. }
  4014. }
  4015. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  4016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  4017. return result
  4018. }
  4019. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  4020. var bufferSize, keep, neededSize, offset int32
  4021. var newBuf, v10, v11 uintptr
  4022. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  4023. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  4024. if parser == libc.UintptrFromInt32(0) {
  4025. return libc.UintptrFromInt32(0)
  4026. }
  4027. if len1 < 0 {
  4028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  4029. return libc.UintptrFromInt32(0)
  4030. }
  4031. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4032. case int32(_XML_SUSPENDED):
  4033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  4034. return libc.UintptrFromInt32(0)
  4035. case int32(_XML_FINISHED):
  4036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  4037. return libc.UintptrFromInt32(0)
  4038. default:
  4039. }
  4040. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  4041. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  4042. } else {
  4043. v1 = 0
  4044. }
  4045. if int64(len1) > v1 {
  4046. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  4047. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  4048. } else {
  4049. v2 = 0
  4050. }
  4051. /* Do not invoke signed arithmetic overflow: */
  4052. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  4053. if neededSize < 0 {
  4054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  4055. return libc.UintptrFromInt32(0)
  4056. }
  4057. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4058. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4059. } else {
  4060. v3 = 0
  4061. }
  4062. keep = int32(v3)
  4063. if keep > int32(m_XML_CONTEXT_BYTES) {
  4064. keep = int32(m_XML_CONTEXT_BYTES)
  4065. }
  4066. /* Detect and prevent integer overflow */
  4067. if keep > int32(m___INT_MAX)-neededSize {
  4068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  4069. return libc.UintptrFromInt32(0)
  4070. }
  4071. neededSize += keep
  4072. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4073. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4074. } else {
  4075. v4 = 0
  4076. }
  4077. if int64(neededSize) <= v4 {
  4078. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4079. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4080. } else {
  4081. v5 = 0
  4082. }
  4083. if int64(keep) < v5 {
  4084. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4085. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4086. } else {
  4087. v6 = 0
  4088. }
  4089. offset = int32(v6) - keep
  4090. /* The buffer pointers cannot be NULL here; we have at least some bytes
  4091. * in the buffer */
  4092. libc.Xmemmove(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer+uintptr(offset), libc.Uint64FromInt64(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)+int64(keep)))
  4093. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  4094. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  4095. }
  4096. } else {
  4097. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  4098. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  4099. } else {
  4100. v7 = 0
  4101. }
  4102. bufferSize = int32(v7)
  4103. if bufferSize == 0 {
  4104. bufferSize = int32(m_INIT_BUFFER_SIZE)
  4105. }
  4106. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  4107. /* Do not invoke signed arithmetic overflow: */
  4108. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  4109. }
  4110. if bufferSize <= 0 {
  4111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  4112. return libc.UintptrFromInt32(0)
  4113. }
  4114. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  4115. if newBuf == uintptr(0) {
  4116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  4117. return libc.UintptrFromInt32(0)
  4118. }
  4119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  4120. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  4121. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  4122. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  4123. } else {
  4124. v8 = 0
  4125. }
  4126. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  4127. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4128. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  4129. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  4130. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  4131. } else {
  4132. v9 = 0
  4133. }
  4134. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  4135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  4136. } else {
  4137. /* This must be a brand new buffer with no data in it yet */
  4138. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  4139. v10 = newBuf
  4140. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  4141. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  4142. }
  4143. }
  4144. v11 = libc.UintptrFromInt32(0)
  4145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  4146. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  4147. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  4148. }
  4149. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  4150. }
  4151. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  4152. if parser == libc.UintptrFromInt32(0) {
  4153. return int32(_XML_STATUS_ERROR)
  4154. }
  4155. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4156. case int32(_XML_SUSPENDED):
  4157. if resumable != 0 {
  4158. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  4159. return int32(_XML_STATUS_ERROR)
  4160. }
  4161. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4162. case int32(_XML_FINISHED):
  4163. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  4164. return int32(_XML_STATUS_ERROR)
  4165. default:
  4166. if resumable != 0 {
  4167. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  4168. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  4169. return int32(_XML_STATUS_ERROR)
  4170. }
  4171. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  4172. } else {
  4173. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4174. }
  4175. }
  4176. return int32(_XML_STATUS_OK)
  4177. }
  4178. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  4179. var result _XML_Status
  4180. _ = result
  4181. result = int32(_XML_STATUS_OK)
  4182. if parser == libc.UintptrFromInt32(0) {
  4183. return int32(_XML_STATUS_ERROR)
  4184. }
  4185. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  4186. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  4187. return int32(_XML_STATUS_ERROR)
  4188. }
  4189. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  4190. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  4191. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  4192. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4193. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  4194. return int32(_XML_STATUS_ERROR)
  4195. } else {
  4196. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4197. case int32(_XML_SUSPENDED):
  4198. result = int32(_XML_STATUS_SUSPENDED)
  4199. case int32(_XML_INITIALIZED):
  4200. fallthrough
  4201. case int32(_XML_PARSING):
  4202. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  4203. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4204. return result
  4205. }
  4206. fallthrough
  4207. default:
  4208. }
  4209. }
  4210. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  4211. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  4212. return result
  4213. }
  4214. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  4215. if parser == libc.UintptrFromInt32(0) {
  4216. return
  4217. }
  4218. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  4219. }
  4220. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  4221. if parser == libc.UintptrFromInt32(0) {
  4222. return int32(_XML_ERROR_INVALID_ARGUMENT)
  4223. }
  4224. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  4225. }
  4226. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  4227. if parser == libc.UintptrFromInt32(0) {
  4228. return int64(-int32(1))
  4229. }
  4230. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4231. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4232. }
  4233. return int64(-int32(1))
  4234. }
  4235. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4236. if parser == libc.UintptrFromInt32(0) {
  4237. return 0
  4238. }
  4239. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4240. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4241. }
  4242. return 0
  4243. }
  4244. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4245. if parser == libc.UintptrFromInt32(0) {
  4246. return libc.UintptrFromInt32(0)
  4247. }
  4248. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4249. if offset != libc.UintptrFromInt32(0) {
  4250. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4251. }
  4252. if size != libc.UintptrFromInt32(0) {
  4253. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4254. }
  4255. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4256. }
  4257. return libc.UintptrFromInt32(0)
  4258. }
  4259. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4260. if parser == libc.UintptrFromInt32(0) {
  4261. return uint64(0)
  4262. }
  4263. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4264. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  4265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4266. }
  4267. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  4268. }
  4269. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4270. if parser == libc.UintptrFromInt32(0) {
  4271. return uint64(0)
  4272. }
  4273. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4274. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  4275. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4276. }
  4277. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4278. }
  4279. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4280. if parser != libc.UintptrFromInt32(0) {
  4281. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4282. }
  4283. }
  4284. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4285. if parser == libc.UintptrFromInt32(0) {
  4286. return libc.UintptrFromInt32(0)
  4287. }
  4288. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4289. }
  4290. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4291. if parser == libc.UintptrFromInt32(0) {
  4292. return libc.UintptrFromInt32(0)
  4293. }
  4294. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4295. }
  4296. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4297. if parser != libc.UintptrFromInt32(0) {
  4298. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4299. }
  4300. }
  4301. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4302. if parser == libc.UintptrFromInt32(0) {
  4303. return
  4304. }
  4305. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4306. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4307. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FinternalEventPtr, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FinternalEventEndPtr)
  4308. } else {
  4309. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4310. }
  4311. }
  4312. }
  4313. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4314. switch code {
  4315. case int32(_XML_ERROR_NONE):
  4316. return libc.UintptrFromInt32(0)
  4317. case int32(_XML_ERROR_NO_MEMORY):
  4318. return __ccgo_ts + 138
  4319. case int32(_XML_ERROR_SYNTAX):
  4320. return __ccgo_ts + 152
  4321. case int32(_XML_ERROR_NO_ELEMENTS):
  4322. return __ccgo_ts + 165
  4323. case int32(_XML_ERROR_INVALID_TOKEN):
  4324. return __ccgo_ts + 182
  4325. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4326. return __ccgo_ts + 214
  4327. case int32(_XML_ERROR_PARTIAL_CHAR):
  4328. return __ccgo_ts + 229
  4329. case int32(_XML_ERROR_TAG_MISMATCH):
  4330. return __ccgo_ts + 247
  4331. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4332. return __ccgo_ts + 262
  4333. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4334. return __ccgo_ts + 282
  4335. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4336. return __ccgo_ts + 310
  4337. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4338. return __ccgo_ts + 345
  4339. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4340. return __ccgo_ts + 362
  4341. case int32(_XML_ERROR_ASYNC_ENTITY):
  4342. return __ccgo_ts + 389
  4343. case int32(_XML_ERROR_BAD_CHAR_REF):
  4344. return __ccgo_ts + 409
  4345. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4346. return __ccgo_ts + 447
  4347. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4348. return __ccgo_ts + 474
  4349. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4350. return __ccgo_ts + 516
  4351. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4352. return __ccgo_ts + 563
  4353. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4354. return __ccgo_ts + 580
  4355. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4356. return __ccgo_ts + 631
  4357. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4358. return __ccgo_ts + 654
  4359. case int32(_XML_ERROR_NOT_STANDALONE):
  4360. return __ccgo_ts + 700
  4361. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4362. return __ccgo_ts + 727
  4363. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4364. return __ccgo_ts + 778
  4365. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4366. return __ccgo_ts + 814
  4367. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4368. return __ccgo_ts + 866
  4369. /* Added in 1.95.7. */
  4370. fallthrough
  4371. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4372. return __ccgo_ts + 911
  4373. /* Added in 1.95.8. */
  4374. fallthrough
  4375. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4376. return __ccgo_ts + 926
  4377. case int32(_XML_ERROR_INCOMPLETE_PE):
  4378. return __ccgo_ts + 952
  4379. case int32(_XML_ERROR_XML_DECL):
  4380. return __ccgo_ts + 990
  4381. case int32(_XML_ERROR_TEXT_DECL):
  4382. return __ccgo_ts + 1022
  4383. case int32(_XML_ERROR_PUBLICID):
  4384. return __ccgo_ts + 1055
  4385. case int32(_XML_ERROR_SUSPENDED):
  4386. return __ccgo_ts + 1089
  4387. case int32(_XML_ERROR_NOT_SUSPENDED):
  4388. return __ccgo_ts + 1106
  4389. case int32(_XML_ERROR_ABORTED):
  4390. return __ccgo_ts + 1127
  4391. case int32(_XML_ERROR_FINISHED):
  4392. return __ccgo_ts + 1143
  4393. case int32(_XML_ERROR_SUSPEND_PE):
  4394. return __ccgo_ts + 1160
  4395. /* Added in 2.0.0. */
  4396. fallthrough
  4397. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4398. return __ccgo_ts + 1204
  4399. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4400. return __ccgo_ts + 1284
  4401. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4402. return __ccgo_ts + 1343
  4403. /* Added in 2.2.5. */
  4404. fallthrough
  4405. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4406. return __ccgo_ts + 1407
  4407. /* Added in 2.3.0. */
  4408. fallthrough
  4409. case int32(_XML_ERROR_NO_BUFFER):
  4410. return __ccgo_ts + 1424
  4411. /* Added in 2.4.0. */
  4412. fallthrough
  4413. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4414. return __ccgo_ts + 1486
  4415. }
  4416. return libc.UintptrFromInt32(0)
  4417. }
  4418. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4419. /* V1 is used to string-ize the version number. However, it would
  4420. string-ize the actual version macro *names* unless we get them
  4421. substituted before being passed to V1. CPP is defined to expand
  4422. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4423. the version macros, then CPP will expand the resulting V1() macro
  4424. with the correct numerals. */
  4425. /* ### I'm assuming cpp is portable in this respect... */
  4426. return __ccgo_ts + 1555
  4427. }
  4428. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4429. var version TXML_Expat_Version
  4430. _ = version
  4431. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4432. version.Fminor = int32(m_XML_MINOR_VERSION)
  4433. version.Fmicro = m_XML_MICRO_VERSION
  4434. return version
  4435. }
  4436. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4437. return uintptr(unsafe.Pointer(&_features))
  4438. }
  4439. var _features = [8]TXML_Feature{
  4440. 0: {
  4441. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4442. Fname: __ccgo_ts + 1567,
  4443. Fvalue: int64(1),
  4444. },
  4445. 1: {
  4446. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4447. Fname: __ccgo_ts + 1584,
  4448. Fvalue: int64(1),
  4449. },
  4450. 2: {
  4451. Ffeature: int32(_XML_FEATURE_DTD),
  4452. Fname: __ccgo_ts + 1602,
  4453. },
  4454. 3: {
  4455. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4456. Fname: __ccgo_ts + 1610,
  4457. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4458. },
  4459. 4: {
  4460. Ffeature: int32(_XML_FEATURE_NS),
  4461. Fname: __ccgo_ts + 1628,
  4462. },
  4463. 5: {
  4464. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4465. Fname: __ccgo_ts + 1635,
  4466. Fvalue: libc.Int64FromFloat32(100),
  4467. },
  4468. 6: {
  4469. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4470. Fname: __ccgo_ts + 1652,
  4471. Fvalue: int64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4472. },
  4473. 7: {},
  4474. }
  4475. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4476. var v1 float32
  4477. var v2 int32
  4478. var v4 bool
  4479. _, _, _ = v1, v2, v4
  4480. if v4 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v4 {
  4481. v1 = maximumAmplificationFactor
  4482. v2 = libc.BoolInt32(v1 != v1)
  4483. goto _3
  4484. _3:
  4485. }
  4486. if v4 || v2 != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4487. return libc.Uint8FromInt32(0)
  4488. }
  4489. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4490. return libc.Uint8FromInt32(1)
  4491. }
  4492. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4493. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4494. return libc.Uint8FromInt32(0)
  4495. }
  4496. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4497. return libc.Uint8FromInt32(1)
  4498. }
  4499. // C documentation
  4500. //
  4501. // /* Initially tag->rawName always points into the parse buffer;
  4502. // for those TAG instances opened while the current parse buffer was
  4503. // processed, and not yet closed, we need to store tag->rawName in a more
  4504. // permanent location, since the parse buffer is about to be discarded.
  4505. // */
  4506. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4507. var bufSize, nameLen int32
  4508. var rawNameBuf, tag, temp uintptr
  4509. var rawNameLen Tsize_t
  4510. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4511. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4512. for tag != 0 {
  4513. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4514. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4515. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4516. at the first entry that has already been copied; everything
  4517. below it in the stack is already been accounted for in a
  4518. previous call to this function.
  4519. */
  4520. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4521. break
  4522. }
  4523. /* For re-use purposes we need to ensure that the
  4524. size of tag->buf is a multiple of sizeof(XML_Char).
  4525. */
  4526. rawNameLen = (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  4527. /* Detect and prevent integer overflow. */
  4528. if rawNameLen > libc.Uint64FromInt32(m___INT_MAX)-libc.Uint64FromInt32(nameLen) {
  4529. return libc.Uint8FromInt32(0)
  4530. }
  4531. bufSize = nameLen + libc.Int32FromUint64(rawNameLen)
  4532. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4533. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  4534. if temp == libc.UintptrFromInt32(0) {
  4535. return libc.Uint8FromInt32(0)
  4536. }
  4537. /* if tag->name.str points to tag->buf (only when namespace
  4538. processing is off) then we have to update it
  4539. */
  4540. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4541. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4542. }
  4543. /* if tag->name.localPart is set (when namespace processing is on)
  4544. then update it as well, since it will always point into tag->buf
  4545. */
  4546. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4547. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4548. }
  4549. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4550. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4551. rawNameBuf = temp + uintptr(nameLen)
  4552. }
  4553. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4554. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4555. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4556. }
  4557. return libc.Uint8FromInt32(1)
  4558. }
  4559. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4560. var result _XML_Error
  4561. _ = result
  4562. result = _doContent(tls, parser, 0, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), int32(_XML_ACCOUNT_DIRECT))
  4563. if result == int32(_XML_ERROR_NONE) {
  4564. if !(_storeRawNames(tls, parser) != 0) {
  4565. return int32(_XML_ERROR_NO_MEMORY)
  4566. }
  4567. }
  4568. return result
  4569. }
  4570. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4571. var result _XML_Error
  4572. _ = result
  4573. result = _initializeEncoding(tls, parser)
  4574. if result != int32(_XML_ERROR_NONE) {
  4575. return result
  4576. }
  4577. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4578. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4579. }
  4580. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4581. bp := tls.Alloc(16)
  4582. defer tls.Free(16)
  4583. var tok int32
  4584. var _ /* next at bp+0 */ uintptr
  4585. _ = tok
  4586. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4587. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4588. switch tok {
  4589. case int32(m_XML_TOK_BOM):
  4590. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4591. _accountingOnAbort(tls, parser)
  4592. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4593. }
  4594. /* If we are at the end of the buffer, this would cause the next stage,
  4595. i.e. externalEntityInitProcessor3, to pass control directly to
  4596. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4597. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4598. */
  4599. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4600. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4601. return int32(_XML_ERROR_NONE)
  4602. }
  4603. start = *(*uintptr)(unsafe.Pointer(bp))
  4604. case -int32(1):
  4605. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4606. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4607. return int32(_XML_ERROR_NONE)
  4608. }
  4609. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4610. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4611. case -int32(2):
  4612. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4613. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4614. return int32(_XML_ERROR_NONE)
  4615. }
  4616. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4617. return int32(_XML_ERROR_PARTIAL_CHAR)
  4618. }
  4619. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4620. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4621. }
  4622. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4623. bp := tls.Alloc(16)
  4624. defer tls.Free(16)
  4625. var result _XML_Error
  4626. var tok int32
  4627. var _ /* next at bp+0 */ uintptr
  4628. _, _ = result, tok
  4629. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4630. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4631. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4632. /* Note: These bytes are accounted later in:
  4633. - processXmlDecl
  4634. - externalEntityContentProcessor
  4635. */
  4636. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4637. switch tok {
  4638. case int32(m_XML_TOK_XML_DECL):
  4639. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4640. if result != int32(_XML_ERROR_NONE) {
  4641. return result
  4642. }
  4643. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4644. case int32(_XML_SUSPENDED):
  4645. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4646. return int32(_XML_ERROR_NONE)
  4647. case int32(_XML_FINISHED):
  4648. return int32(_XML_ERROR_ABORTED)
  4649. default:
  4650. start = *(*uintptr)(unsafe.Pointer(bp))
  4651. }
  4652. case -int32(1):
  4653. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4654. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4655. return int32(_XML_ERROR_NONE)
  4656. }
  4657. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4658. case -int32(2):
  4659. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4660. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4661. return int32(_XML_ERROR_NONE)
  4662. }
  4663. return int32(_XML_ERROR_PARTIAL_CHAR)
  4664. }
  4665. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4666. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4667. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4668. }
  4669. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4670. var result _XML_Error
  4671. _ = result
  4672. result = _doContent(tls, parser, int32(1), (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4673. if result == int32(_XML_ERROR_NONE) {
  4674. if !(_storeRawNames(tls, parser) != 0) {
  4675. return int32(_XML_ERROR_NO_MEMORY)
  4676. }
  4677. }
  4678. return result
  4679. }
  4680. func _doContent(tls *libc.TLS, parser TXML_Parser, startTagLevel int32, enc uintptr, _s uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool, account _XML_Account) (r _XML_Error) {
  4681. bp := tls.Alloc(112)
  4682. defer tls.Free(112)
  4683. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4684. var accountAfter, b, context, dtd, entity, eventEndPP, eventPP, localPart, name, prefix, rawName, rawName1, rawNameEnd, tag, tag1, temp, uri, v11, v2, v3, v5, v6, v7, v8, v9 uintptr
  4685. var bufSize, convLen, len1, n, tok int32
  4686. var charDataHandler TXML_CharacterDataHandler
  4687. var convert_res, convert_res1 _XML_Convert_Result
  4688. var noElmHandlers TXML_Bool
  4689. var result, result1, result2, result3 _XML_Error
  4690. var _ /* bindings at bp+40 */ uintptr
  4691. var _ /* buf at bp+88 */ [4]TXML_Char
  4692. var _ /* c at bp+16 */ TXML_Char
  4693. var _ /* c at bp+92 */ TXML_Char
  4694. var _ /* ch at bp+17 */ TXML_Char
  4695. var _ /* dataPtr at bp+104 */ uintptr
  4696. var _ /* dataPtr at bp+96 */ uintptr
  4697. var _ /* fromPtr at bp+32 */ uintptr
  4698. var _ /* name at bp+48 */ TTAG_NAME
  4699. var _ /* next at bp+8 */ uintptr
  4700. var _ /* toPtr at bp+24 */ uintptr
  4701. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = accountAfter, b, bufSize, charDataHandler, context, convLen, convert_res, convert_res1, dtd, entity, eventEndPP, eventPP, len1, localPart, n, name, noElmHandlers, prefix, rawName, rawName1, rawNameEnd, result, result1, result2, result3, tag, tag1, temp, tok, uri, v11, v2, v3, v5, v6, v7, v8, v9
  4702. /* save one level of indirection */
  4703. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4704. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4705. eventPP = parser + 544
  4706. eventEndPP = parser + 552
  4707. } else {
  4708. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4709. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4710. }
  4711. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4712. for {
  4713. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4714. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 1*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  4715. if tok == -int32(5) || tok == -int32(3) {
  4716. if haveMore != 0 {
  4717. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4718. } else {
  4719. v3 = end
  4720. }
  4721. v2 = v3
  4722. } else {
  4723. v2 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4724. }
  4725. accountAfter = v2
  4726. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4727. _accountingOnAbort(tls, parser)
  4728. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4729. }
  4730. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4731. switch tok {
  4732. case -int32(3):
  4733. if haveMore != 0 {
  4734. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4735. return int32(_XML_ERROR_NONE)
  4736. }
  4737. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4738. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4739. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  4740. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  4741. } else {
  4742. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4743. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4744. }
  4745. }
  4746. /* We are at the end of the final buffer, should we check for
  4747. XML_SUSPENDED, XML_FINISHED?
  4748. */
  4749. if startTagLevel == 0 {
  4750. return int32(_XML_ERROR_NO_ELEMENTS)
  4751. }
  4752. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4753. return int32(_XML_ERROR_ASYNC_ENTITY)
  4754. }
  4755. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4756. return int32(_XML_ERROR_NONE)
  4757. case -int32(4):
  4758. if haveMore != 0 {
  4759. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4760. return int32(_XML_ERROR_NONE)
  4761. }
  4762. if startTagLevel > 0 {
  4763. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4764. return int32(_XML_ERROR_ASYNC_ENTITY)
  4765. }
  4766. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4767. return int32(_XML_ERROR_NONE)
  4768. }
  4769. return int32(_XML_ERROR_NO_ELEMENTS)
  4770. case m_XML_TOK_INVALID:
  4771. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4772. return int32(_XML_ERROR_INVALID_TOKEN)
  4773. case -int32(1):
  4774. if haveMore != 0 {
  4775. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4776. return int32(_XML_ERROR_NONE)
  4777. }
  4778. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4779. case -int32(2):
  4780. if haveMore != 0 {
  4781. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4782. return int32(_XML_ERROR_NONE)
  4783. }
  4784. return int32(_XML_ERROR_PARTIAL_CHAR)
  4785. case int32(m_XML_TOK_ENTITY_REF):
  4786. *(*TXML_Char)(unsafe.Pointer(bp + 17)) = int8((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  4787. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4788. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4789. * so there is no amplification and hence recording without
  4790. * protection. */
  4791. _accountingDiffTolerated(tls, parser, tok, bp+17, bp+17+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4792. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4793. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+17, int32(1))
  4794. } else {
  4795. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4796. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4797. }
  4798. }
  4799. break
  4800. }
  4801. name = _poolStoreString(tls, dtd+160, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  4802. if !(name != 0) {
  4803. return int32(_XML_ERROR_NO_MEMORY)
  4804. }
  4805. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4806. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4807. /* First, determine if a check for an existing declaration is needed;
  4808. if yes, check that the entity exists, and that it is internal,
  4809. otherwise call the skipped entity or default handler.
  4810. */
  4811. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4812. if !(entity != 0) {
  4813. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4814. } else {
  4815. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4816. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4817. }
  4818. }
  4819. } else {
  4820. if !(entity != 0) {
  4821. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4822. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, name, 0)
  4823. } else {
  4824. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4825. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4826. }
  4827. }
  4828. break
  4829. }
  4830. }
  4831. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4832. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4833. }
  4834. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4835. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4836. }
  4837. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4838. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4839. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4840. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer(entity)).Fname, 0)
  4841. } else {
  4842. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4843. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4844. }
  4845. }
  4846. break
  4847. }
  4848. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4849. if result != int32(_XML_ERROR_NONE) {
  4850. return result
  4851. }
  4852. } else {
  4853. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4854. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4855. context = _getContext(tls, parser)
  4856. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4857. if !(context != 0) {
  4858. return int32(_XML_ERROR_NO_MEMORY)
  4859. }
  4860. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, context, (*TENTITY)(unsafe.Pointer(entity)).Fbase, (*TENTITY)(unsafe.Pointer(entity)).FsystemId, (*TENTITY)(unsafe.Pointer(entity)).FpublicId) != 0) {
  4861. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4862. }
  4863. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4864. } else {
  4865. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4866. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4867. }
  4868. }
  4869. }
  4870. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4871. /* fall through */
  4872. fallthrough
  4873. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4874. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4875. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4876. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4877. } else {
  4878. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4879. if !(tag != 0) {
  4880. return int32(_XML_ERROR_NO_MEMORY)
  4881. }
  4882. (*TTAG)(unsafe.Pointer(tag)).Fbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(libc.Int32FromInt32(m_INIT_TAG_BUF_SIZE)))
  4883. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4884. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4885. return int32(_XML_ERROR_NO_MEMORY)
  4886. }
  4887. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4888. }
  4889. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4890. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4891. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4892. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4893. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4894. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4895. (*TTAG)(unsafe.Pointer(tag)).FrawNameLength = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, (*TTAG)(unsafe.Pointer(tag)).FrawName)
  4896. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4897. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4898. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4899. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4900. for {
  4901. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp+32, rawNameEnd, bp+24, (*TTAG)(unsafe.Pointer(tag)).FbufEnd-uintptr(1))
  4902. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4903. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4904. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4905. break
  4906. }
  4907. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4908. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  4909. if temp == libc.UintptrFromInt32(0) {
  4910. return int32(_XML_ERROR_NO_MEMORY)
  4911. }
  4912. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4913. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4914. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4915. goto _4
  4916. _4:
  4917. }
  4918. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4919. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = int8('\000')
  4920. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80, account)
  4921. if result1 != 0 {
  4922. return result1
  4923. }
  4924. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4925. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4926. } else {
  4927. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4928. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4929. }
  4930. }
  4931. _poolClear(tls, parser+784)
  4932. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4933. /* fall through */
  4934. fallthrough
  4935. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4936. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4937. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4938. noElmHandlers = libc.Uint8FromInt32(1)
  4939. (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr = _poolStoreString(tls, parser+784, enc, rawName, rawName+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName)))
  4940. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4941. return int32(_XML_ERROR_NO_MEMORY)
  4942. }
  4943. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4944. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40, int32(_XML_ACCOUNT_NONE))
  4945. if result2 != int32(_XML_ERROR_NONE) {
  4946. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4947. return result2
  4948. }
  4949. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4950. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4951. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4952. noElmHandlers = libc.Uint8FromInt32(0)
  4953. }
  4954. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4955. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4956. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4957. }
  4958. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr)
  4959. noElmHandlers = libc.Uint8FromInt32(0)
  4960. }
  4961. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4962. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4963. }
  4964. _poolClear(tls, parser+784)
  4965. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4966. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4967. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4968. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4969. } else {
  4970. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4971. }
  4972. }
  4973. case int32(m_XML_TOK_END_TAG):
  4974. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4975. return int32(_XML_ERROR_ASYNC_ENTITY)
  4976. } else {
  4977. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4978. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4979. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4980. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4981. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4982. return int32(_XML_ERROR_TAG_MISMATCH)
  4983. }
  4984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4985. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4986. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4988. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4989. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4990. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4991. /* localPart and prefix may have been overwritten in
  4992. tag->name.str, since this points to the binding->uri
  4993. buffer which gets re-used; so we have to add them again
  4994. */
  4995. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4996. /* don't need to check for space - already done in storeAtts() */
  4997. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4998. v5 = uri
  4999. uri++
  5000. v6 = localPart
  5001. localPart++
  5002. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  5003. }
  5004. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  5005. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  5006. v7 = uri
  5007. uri++
  5008. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5009. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  5010. v8 = uri
  5011. uri++
  5012. v9 = prefix
  5013. prefix++
  5014. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  5015. }
  5016. }
  5017. *(*TXML_Char)(unsafe.Pointer(uri)) = int8('\000')
  5018. }
  5019. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr)
  5020. } else {
  5021. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5022. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5023. }
  5024. }
  5025. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  5026. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  5027. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  5028. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname)
  5029. }
  5030. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  5031. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  5033. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  5034. }
  5035. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  5036. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  5037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  5038. } else {
  5039. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  5040. }
  5041. }
  5042. }
  5043. case int32(m_XML_TOK_CHAR_REF):
  5044. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  5045. if n < 0 {
  5046. return int32(_XML_ERROR_BAD_CHAR_REF)
  5047. }
  5048. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5049. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+88, XXmlUtf8Encode(tls, n, bp+88))
  5050. } else {
  5051. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5052. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5053. }
  5054. }
  5055. case int32(m_XML_TOK_XML_DECL):
  5056. return int32(_XML_ERROR_MISPLACED_XML_PI)
  5057. case int32(m_XML_TOK_DATA_NEWLINE):
  5058. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5059. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = int8(0xA)
  5060. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+92, int32(1))
  5061. } else {
  5062. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5063. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5064. }
  5065. }
  5066. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  5067. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  5068. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  5069. } else {
  5070. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5071. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, 0)
  5072. } else {
  5073. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5074. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5075. }
  5076. }
  5077. }
  5078. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore, account)
  5079. if result3 != int32(_XML_ERROR_NONE) {
  5080. return result3
  5081. } else {
  5082. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  5083. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  5084. return result3
  5085. }
  5086. }
  5087. case -int32(5):
  5088. if haveMore != 0 {
  5089. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5090. return int32(_XML_ERROR_NONE)
  5091. }
  5092. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5093. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  5094. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  5095. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+96, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  5096. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 96)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  5097. } else {
  5098. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  5099. }
  5100. } else {
  5101. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5102. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  5103. }
  5104. }
  5105. /* We are at the end of the final buffer, should we check for
  5106. XML_SUSPENDED, XML_FINISHED?
  5107. */
  5108. if startTagLevel == 0 {
  5109. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  5110. return int32(_XML_ERROR_NO_ELEMENTS)
  5111. }
  5112. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  5113. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  5114. return int32(_XML_ERROR_ASYNC_ENTITY)
  5115. }
  5116. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  5117. return int32(_XML_ERROR_NONE)
  5118. case int32(m_XML_TOK_DATA_CHARS):
  5119. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  5120. if charDataHandler != 0 {
  5121. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  5122. for {
  5123. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  5124. convert_res1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+104, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  5125. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5126. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 104)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  5127. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  5128. break
  5129. }
  5130. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5131. goto _10
  5132. _10:
  5133. }
  5134. } else {
  5135. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  5136. }
  5137. } else {
  5138. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5139. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5140. }
  5141. }
  5142. case int32(m_XML_TOK_PI):
  5143. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  5144. return int32(_XML_ERROR_NO_MEMORY)
  5145. }
  5146. case int32(m_XML_TOK_COMMENT):
  5147. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  5148. return int32(_XML_ERROR_NO_MEMORY)
  5149. }
  5150. default:
  5151. /* All of the tokens produced by XmlContentTok() have their own
  5152. * explicit cases, so this default is not strictly necessary.
  5153. * However it is a useful safety net, so we retain the code and
  5154. * simply exclude it from the coverage tests.
  5155. *
  5156. * LCOV_EXCL_START
  5157. */
  5158. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5159. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5160. }
  5161. break
  5162. /* LCOV_EXCL_STOP */
  5163. }
  5164. v11 = *(*uintptr)(unsafe.Pointer(bp + 8))
  5165. *(*uintptr)(unsafe.Pointer(bp)) = v11
  5166. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  5167. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5168. case int32(_XML_SUSPENDED):
  5169. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5170. return int32(_XML_ERROR_NONE)
  5171. case int32(_XML_FINISHED):
  5172. return int32(_XML_ERROR_ABORTED)
  5173. default:
  5174. }
  5175. goto _1
  5176. _1:
  5177. }
  5178. /* not reached */
  5179. return r
  5180. }
  5181. // C documentation
  5182. //
  5183. // /* This function does not call free() on the allocated memory, merely
  5184. // * moving it to the parser's m_freeBindingList where it can be freed or
  5185. // * reused as appropriate.
  5186. // */
  5187. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  5188. var b uintptr
  5189. _ = b
  5190. for bindings != 0 {
  5191. b = bindings
  5192. /* m_startNamespaceDeclHandler will have been called for this
  5193. * binding in addBindings(), so call the end handler now.
  5194. */
  5195. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  5196. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname)
  5197. }
  5198. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  5199. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5200. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  5201. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  5202. }
  5203. }
  5204. // C documentation
  5205. //
  5206. // /* Precondition: all arguments must be non-NULL;
  5207. // Purpose:
  5208. // - normalize attributes
  5209. // - check attributes for well-formedness
  5210. // - generate namespace aware attribute names (URI, prefix)
  5211. // - build list of attributes for startElementHandler
  5212. // - default attributes
  5213. // - process namespace declarations (check and report them)
  5214. // - generate namespace aware element name (URI, prefix)
  5215. // */
  5216. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  5217. bp := tls.Alloc(80)
  5218. defer tls.Free(80)
  5219. var appAtts, attId, b, binding, currAtt, da, dtd, elementType, id, localPart, name, p, s, s1, s2, temp, temp1, uri, v11, v18, v19, v20, v21, v24, v25, v28, v31, v32, v36 uintptr
  5220. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  5221. var c TXML_Char
  5222. var isCdata TXML_Bool
  5223. var mask, uriHash, version, v14 uint64
  5224. var nsAttsSize uint32
  5225. var oldNsAttsPower, step, v10 uint8
  5226. var result, result1, result2 _XML_Error
  5227. var _ /* sip_key at bp+56 */ Tsipkey
  5228. var _ /* sip_state at bp+0 */ Tsiphash
  5229. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = appAtts, attId, attIndex, b, binding, c, currAtt, da, dtd, elementType, i, id, isCdata, j, j1, localPart, mask, n, nDefaultAtts, nPrefixes, name, nsAttsSize, oldAttsSize, oldNsAttsPower, p, prefixLen, result, result1, result2, s, s1, s2, step, temp, temp1, uri, uriHash, version, v10, v11, v13, v14, v17, v18, v19, v2, v20, v21, v23, v24, v25, v28, v30, v31, v32, v33, v36, v38, v40, v6, v7, v8, v9
  5230. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5231. attIndex = 0
  5232. nPrefixes = 0
  5233. /* lookup the element type name */
  5234. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  5235. if !(elementType != 0) {
  5236. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5237. if !(name != 0) {
  5238. return int32(_XML_ERROR_NO_MEMORY)
  5239. }
  5240. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  5241. if !(elementType != 0) {
  5242. return int32(_XML_ERROR_NO_MEMORY)
  5243. }
  5244. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5245. return int32(_XML_ERROR_NO_MEMORY)
  5246. }
  5247. }
  5248. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5249. /* get the attributes from the tokenizer */
  5250. n = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FgetAtts})))(tls, enc, attStr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  5251. /* Detect and prevent integer overflow */
  5252. if n > int32(m___INT_MAX)-nDefaultAtts {
  5253. return int32(_XML_ERROR_NO_MEMORY)
  5254. }
  5255. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5256. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5257. /* Detect and prevent integer overflow */
  5258. if nDefaultAtts > libc.Int32FromInt32(m___INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m___INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5259. return int32(_XML_ERROR_NO_MEMORY)
  5260. }
  5261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5262. /* Detect and prevent integer overflow.
  5263. * The preprocessor guard addresses the "always false" warning
  5264. * from -Wtype-limits on platforms where
  5265. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5266. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  5267. if temp == libc.UintptrFromInt32(0) {
  5268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5269. return int32(_XML_ERROR_NO_MEMORY)
  5270. }
  5271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5272. if n > oldAttsSize {
  5273. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FgetAtts})))(tls, enc, attStr, n, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  5274. }
  5275. }
  5276. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5277. i = 0
  5278. for {
  5279. if !(i < n) {
  5280. break
  5281. }
  5282. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  5283. /* add the name and value to the attribute list */
  5284. attId = _getAttributeId(tls, parser, enc, (*TATTRIBUTE)(unsafe.Pointer(currAtt)).Fname, (*TATTRIBUTE)(unsafe.Pointer(currAtt)).Fname+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, (*TATTRIBUTE)(unsafe.Pointer(currAtt)).Fname)))
  5285. if !(attId != 0) {
  5286. return int32(_XML_ERROR_NO_MEMORY)
  5287. }
  5288. /* Detect duplicate attributes by their QNames. This does not work when
  5289. namespace processing is turned on and different prefixes for the same
  5290. namespace are used. For this case we have a check further down.
  5291. */
  5292. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5293. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5294. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  5295. }
  5296. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5297. }
  5298. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5299. v2 = attIndex
  5300. attIndex++
  5301. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5302. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  5303. isCdata = libc.Uint8FromInt32(1)
  5304. /* figure out whether declared as other than CDATA */
  5305. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5306. j = 0
  5307. for {
  5308. if !(j < nDefaultAtts) {
  5309. break
  5310. }
  5311. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  5312. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  5313. break
  5314. }
  5315. goto _3
  5316. _3:
  5317. ;
  5318. j++
  5319. }
  5320. }
  5321. /* normalize the attribute value */
  5322. result = _storeAttributeValue(tls, parser, enc, isCdata, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd, parser+784, account)
  5323. if result != 0 {
  5324. return result
  5325. }
  5326. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5327. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5328. } else {
  5329. /* the value did not need normalizing */
  5330. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = _poolStoreString(tls, parser+784, enc, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd)
  5331. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  5332. return int32(_XML_ERROR_NO_MEMORY)
  5333. }
  5334. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5335. }
  5336. /* handle prefixed attribute names */
  5337. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5338. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5339. /* deal with namespace declarations here */
  5340. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  5341. if result1 != 0 {
  5342. return result1
  5343. }
  5344. attIndex--
  5345. } else {
  5346. /* deal with other prefixed names later */
  5347. attIndex++
  5348. nPrefixes++
  5349. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5350. }
  5351. } else {
  5352. attIndex++
  5353. }
  5354. goto _1
  5355. _1:
  5356. ;
  5357. i++
  5358. }
  5359. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5360. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5361. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt != 0 && *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5362. i = 0
  5363. for {
  5364. if !(i < attIndex) {
  5365. break
  5366. }
  5367. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5368. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5369. break
  5370. }
  5371. goto _4
  5372. _4:
  5373. ;
  5374. i += int32(2)
  5375. }
  5376. } else {
  5377. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5378. }
  5379. /* do attribute defaulting */
  5380. i = 0
  5381. for {
  5382. if !(i < nDefaultAtts) {
  5383. break
  5384. }
  5385. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5386. if !(*(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0) && (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue != 0 {
  5387. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5388. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5389. result2 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix, (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid, (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue, bindingsPtr)
  5390. if result2 != 0 {
  5391. return result2
  5392. }
  5393. } else {
  5394. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5395. nPrefixes++
  5396. v6 = attIndex
  5397. attIndex++
  5398. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5399. v7 = attIndex
  5400. attIndex++
  5401. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5402. }
  5403. } else {
  5404. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5405. v8 = attIndex
  5406. attIndex++
  5407. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5408. v9 = attIndex
  5409. attIndex++
  5410. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5411. }
  5412. }
  5413. goto _5
  5414. _5:
  5415. ;
  5416. i++
  5417. }
  5418. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5419. /* expand prefixed attribute names, check for duplicates,
  5420. and clear flags that say whether attributes were specified */
  5421. i = 0
  5422. if nPrefixes != 0 { /* hash table index */
  5423. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5424. /* Detect and prevent invalid shift */
  5425. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5426. return int32(_XML_ERROR_NO_MEMORY)
  5427. }
  5428. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5429. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5430. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5431. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5432. /* hash table size must also be a power of 2 and >= 8 */
  5433. for {
  5434. v11 = parser + 760
  5435. v10 = *(*uint8)(unsafe.Pointer(v11))
  5436. *(*uint8)(unsafe.Pointer(v11))++
  5437. if !(nPrefixes>>v10 != 0) {
  5438. break
  5439. }
  5440. }
  5441. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5442. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5443. }
  5444. /* Detect and prevent invalid shift */
  5445. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5446. /* Restore actual size of memory in m_nsAtts */
  5447. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5448. return int32(_XML_ERROR_NO_MEMORY)
  5449. }
  5450. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5451. /* Detect and prevent integer overflow.
  5452. * The preprocessor guard addresses the "always false" warning
  5453. * from -Wtype-limits on platforms where
  5454. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5455. temp1 = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts, uint64(nsAttsSize)*libc.Uint64FromInt64(24))
  5456. if !(temp1 != 0) {
  5457. /* Restore actual size of memory in m_nsAtts */
  5458. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5459. return int32(_XML_ERROR_NO_MEMORY)
  5460. }
  5461. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5462. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5463. }
  5464. /* using a version flag saves us from initializing m_nsAtts every time */
  5465. if !(version != 0) { /* initialize version flags when version wraps around */
  5466. version = uint64(m_INIT_ATTS_VERSION)
  5467. j1 = libc.Int32FromUint32(nsAttsSize)
  5468. for {
  5469. if !(j1 != 0) {
  5470. break
  5471. }
  5472. j1--
  5473. v13 = j1
  5474. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5475. goto _12
  5476. _12:
  5477. }
  5478. }
  5479. version--
  5480. v14 = version
  5481. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5482. /* expand prefixed names and check for duplicates */
  5483. for {
  5484. if !(i < attIndex) {
  5485. break
  5486. }
  5487. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5488. if int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5489. _copy_salt_to_sipkey(tls, parser, bp+56)
  5490. _sip24_init(tls, bp, bp+56)
  5491. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0 /* clear flag */
  5492. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5493. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5494. /* This code is walking through the appAtts array, dealing
  5495. * with (in this case) a prefixed attribute name. To be in
  5496. * the array, the attribute must have already been bound, so
  5497. * has to have passed through the hash table lookup once
  5498. * already. That implies that an entry for it already
  5499. * exists, so the lookup above will return a pointer to
  5500. * already allocated memory. There is no opportunaity for
  5501. * the allocator to fail, so the condition above cannot be
  5502. * fulfilled.
  5503. *
  5504. * Since it is difficult to be certain that the above
  5505. * analysis is complete, we retain the test and merely
  5506. * remove the code from coverage tests.
  5507. */
  5508. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5509. }
  5510. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5511. if !(b != 0) {
  5512. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5513. }
  5514. j1 = 0
  5515. for {
  5516. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5517. break
  5518. }
  5519. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5520. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5521. v17 = 0
  5522. } else {
  5523. v19 = parser + 784 + 24
  5524. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5525. *(*uintptr)(unsafe.Pointer(v19))++
  5526. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5527. v17 = libc.Int32FromInt32(1)
  5528. }
  5529. if !(v17 != 0) {
  5530. return int32(_XML_ERROR_NO_MEMORY)
  5531. }
  5532. goto _16
  5533. _16:
  5534. ;
  5535. j1++
  5536. }
  5537. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5538. for {
  5539. v20 = s
  5540. s++
  5541. if !(int32(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5542. break
  5543. }
  5544. }
  5545. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5546. for { /* copies null terminator */
  5547. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5548. v23 = 0
  5549. } else {
  5550. v25 = parser + 784 + 24
  5551. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5552. *(*uintptr)(unsafe.Pointer(v25))++
  5553. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5554. v23 = libc.Int32FromInt32(1)
  5555. }
  5556. if !(v23 != 0) {
  5557. return int32(_XML_ERROR_NO_MEMORY)
  5558. }
  5559. goto _22
  5560. _22:
  5561. ;
  5562. v21 = s
  5563. s++
  5564. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5565. break
  5566. }
  5567. }
  5568. uriHash = _sip24_final(tls, bp)
  5569. /* Check hash table for duplicate of expanded name (uriName).
  5570. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5571. */
  5572. step = uint8(0)
  5573. mask = uint64(nsAttsSize - uint32(1))
  5574. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5575. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5576. /* for speed we compare stored hash values first */
  5577. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5578. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5579. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5580. /* s1 is null terminated, but not s2 */
  5581. for {
  5582. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2))) && int32(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5583. break
  5584. }
  5585. goto _26
  5586. _26:
  5587. ;
  5588. s1++
  5589. s2++
  5590. }
  5591. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5592. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5593. }
  5594. }
  5595. if !(step != 0) {
  5596. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5597. }
  5598. if j1 < libc.Int32FromUint8(step) {
  5599. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5600. } else {
  5601. j1 -= libc.Int32FromUint8(step)
  5602. }
  5603. }
  5604. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5605. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5606. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5607. for {
  5608. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5609. v30 = 0
  5610. } else {
  5611. v32 = parser + 784 + 24
  5612. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5613. *(*uintptr)(unsafe.Pointer(v32))++
  5614. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5615. v30 = libc.Int32FromInt32(1)
  5616. }
  5617. if !(v30 != 0) {
  5618. return int32(_XML_ERROR_NO_MEMORY)
  5619. }
  5620. goto _29
  5621. _29:
  5622. ;
  5623. v28 = s
  5624. s++
  5625. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5626. break
  5627. }
  5628. }
  5629. }
  5630. /* store expanded name in attribute list */
  5631. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5632. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5633. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5634. /* fill empty slot with new version, uriName and hash value */
  5635. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5636. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5637. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5638. nPrefixes--
  5639. v33 = nPrefixes
  5640. if !(v33 != 0) {
  5641. i += int32(2)
  5642. break
  5643. }
  5644. } else { /* not prefixed */
  5645. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0
  5646. } /* clear flag */
  5647. goto _15
  5648. _15:
  5649. ;
  5650. i += int32(2)
  5651. }
  5652. }
  5653. /* clear flags for the remaining attributes */
  5654. for {
  5655. if !(i < attIndex) {
  5656. break
  5657. }
  5658. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = 0
  5659. goto _34
  5660. _34:
  5661. ;
  5662. i += int32(2)
  5663. }
  5664. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5665. for {
  5666. if !(binding != 0) {
  5667. break
  5668. }
  5669. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = 0
  5670. goto _35
  5671. _35:
  5672. ;
  5673. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5674. }
  5675. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5676. return int32(_XML_ERROR_NONE)
  5677. }
  5678. /* expand the element type name */
  5679. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5680. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5681. if !(binding != 0) {
  5682. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5683. }
  5684. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5685. for {
  5686. v36 = localPart
  5687. localPart++
  5688. if !(int32(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5689. break
  5690. }
  5691. }
  5692. } else {
  5693. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5694. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5695. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5696. } else {
  5697. return int32(_XML_ERROR_NONE)
  5698. }
  5699. }
  5700. prefixLen = 0
  5701. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5702. for {
  5703. v38 = prefixLen
  5704. prefixLen++
  5705. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5706. break
  5707. }
  5708. goto _37
  5709. _37:
  5710. } /* prefixLen includes null terminator */
  5711. }
  5712. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5713. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5714. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5715. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5716. i = 0
  5717. for {
  5718. v40 = i
  5719. i++
  5720. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5721. break
  5722. }
  5723. goto _39
  5724. _39:
  5725. } /* i includes null terminator */
  5726. /* Detect and prevent integer overflow */
  5727. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m___INT_MAX)-prefixLen || i > int32(m___INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5728. return int32(_XML_ERROR_NO_MEMORY)
  5729. }
  5730. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5731. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5732. /* Detect and prevent integer overflow */
  5733. if n > libc.Int32FromInt32(m___INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5734. return int32(_XML_ERROR_NO_MEMORY)
  5735. }
  5736. /* Detect and prevent integer overflow.
  5737. * The preprocessor guard addresses the "always false" warning
  5738. * from -Wtype-limits on platforms where
  5739. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5740. uri = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE))*libc.Uint64FromInt64(1))
  5741. if !(uri != 0) {
  5742. return int32(_XML_ERROR_NO_MEMORY)
  5743. }
  5744. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5745. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5746. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5747. for {
  5748. if !(p != 0) {
  5749. break
  5750. }
  5751. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5752. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5753. }
  5754. goto _41
  5755. _41:
  5756. ;
  5757. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5758. }
  5759. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5760. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5761. }
  5762. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5763. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5764. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5765. /* we always have a namespace separator between localPart and prefix */
  5766. if prefixLen != 0 {
  5767. uri += uintptr(i - int32(1))
  5768. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5769. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5770. }
  5771. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5772. return int32(_XML_ERROR_NONE)
  5773. }
  5774. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5775. // For the RFC 3986 ANBF grammar see
  5776. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5777. switch int32(candidate) {
  5778. // From rule "ALPHA" (uppercase half)
  5779. case int32('A'):
  5780. fallthrough
  5781. case int32('B'):
  5782. fallthrough
  5783. case int32('C'):
  5784. fallthrough
  5785. case int32('D'):
  5786. fallthrough
  5787. case int32('E'):
  5788. fallthrough
  5789. case int32('F'):
  5790. fallthrough
  5791. case int32('G'):
  5792. fallthrough
  5793. case int32('H'):
  5794. fallthrough
  5795. case int32('I'):
  5796. fallthrough
  5797. case int32('J'):
  5798. fallthrough
  5799. case int32('K'):
  5800. fallthrough
  5801. case int32('L'):
  5802. fallthrough
  5803. case int32('M'):
  5804. fallthrough
  5805. case int32('N'):
  5806. fallthrough
  5807. case int32('O'):
  5808. fallthrough
  5809. case int32('P'):
  5810. fallthrough
  5811. case int32('Q'):
  5812. fallthrough
  5813. case int32('R'):
  5814. fallthrough
  5815. case int32('S'):
  5816. fallthrough
  5817. case int32('T'):
  5818. fallthrough
  5819. case int32('U'):
  5820. fallthrough
  5821. case int32('V'):
  5822. fallthrough
  5823. case int32('W'):
  5824. fallthrough
  5825. case int32('X'):
  5826. fallthrough
  5827. case int32('Y'):
  5828. fallthrough
  5829. case int32('Z'):
  5830. // From rule "ALPHA" (lowercase half)
  5831. fallthrough
  5832. case int32('a'):
  5833. fallthrough
  5834. case int32('b'):
  5835. fallthrough
  5836. case int32('c'):
  5837. fallthrough
  5838. case int32('d'):
  5839. fallthrough
  5840. case int32('e'):
  5841. fallthrough
  5842. case int32('f'):
  5843. fallthrough
  5844. case int32('g'):
  5845. fallthrough
  5846. case int32('h'):
  5847. fallthrough
  5848. case int32('i'):
  5849. fallthrough
  5850. case int32('j'):
  5851. fallthrough
  5852. case int32('k'):
  5853. fallthrough
  5854. case int32('l'):
  5855. fallthrough
  5856. case int32('m'):
  5857. fallthrough
  5858. case int32('n'):
  5859. fallthrough
  5860. case int32('o'):
  5861. fallthrough
  5862. case int32('p'):
  5863. fallthrough
  5864. case int32('q'):
  5865. fallthrough
  5866. case int32('r'):
  5867. fallthrough
  5868. case int32('s'):
  5869. fallthrough
  5870. case int32('t'):
  5871. fallthrough
  5872. case int32('u'):
  5873. fallthrough
  5874. case int32('v'):
  5875. fallthrough
  5876. case int32('w'):
  5877. fallthrough
  5878. case int32('x'):
  5879. fallthrough
  5880. case int32('y'):
  5881. fallthrough
  5882. case int32('z'):
  5883. // From rule "DIGIT"
  5884. fallthrough
  5885. case int32('0'):
  5886. fallthrough
  5887. case int32('1'):
  5888. fallthrough
  5889. case int32('2'):
  5890. fallthrough
  5891. case int32('3'):
  5892. fallthrough
  5893. case int32('4'):
  5894. fallthrough
  5895. case int32('5'):
  5896. fallthrough
  5897. case int32('6'):
  5898. fallthrough
  5899. case int32('7'):
  5900. fallthrough
  5901. case int32('8'):
  5902. fallthrough
  5903. case int32('9'):
  5904. // From rule "pct-encoded"
  5905. fallthrough
  5906. case int32('%'):
  5907. // From rule "unreserved"
  5908. fallthrough
  5909. case int32('-'):
  5910. fallthrough
  5911. case int32('.'):
  5912. fallthrough
  5913. case int32('_'):
  5914. fallthrough
  5915. case int32('~'):
  5916. // From rule "gen-delims"
  5917. fallthrough
  5918. case int32(':'):
  5919. fallthrough
  5920. case int32('/'):
  5921. fallthrough
  5922. case int32('?'):
  5923. fallthrough
  5924. case int32('#'):
  5925. fallthrough
  5926. case int32('['):
  5927. fallthrough
  5928. case int32(']'):
  5929. fallthrough
  5930. case int32('@'):
  5931. // From rule "sub-delims"
  5932. fallthrough
  5933. case int32('!'):
  5934. fallthrough
  5935. case int32('$'):
  5936. fallthrough
  5937. case int32('&'):
  5938. fallthrough
  5939. case int32('\''):
  5940. fallthrough
  5941. case int32('('):
  5942. fallthrough
  5943. case int32(')'):
  5944. fallthrough
  5945. case int32('*'):
  5946. fallthrough
  5947. case int32('+'):
  5948. fallthrough
  5949. case int32(','):
  5950. fallthrough
  5951. case int32(';'):
  5952. fallthrough
  5953. case int32('='):
  5954. return libc.Uint8FromInt32(1)
  5955. default:
  5956. return libc.Uint8FromInt32(0)
  5957. }
  5958. return r
  5959. }
  5960. // C documentation
  5961. //
  5962. // /* addBinding() overwrites the value of prefix->binding without checking.
  5963. // Therefore one must keep track of the old value outside of addBinding().
  5964. // */
  5965. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5966. var b, temp, v3 uintptr
  5967. var isXML, isXMLNS, mustBeXML TXML_Bool
  5968. var len1, v2 int32
  5969. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5970. mustBeXML = libc.Uint8FromInt32(0)
  5971. isXML = libc.Uint8FromInt32(1)
  5972. isXMLNS = libc.Uint8FromInt32(1)
  5973. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5974. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5975. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5976. }
  5977. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5978. /* Not allowed to bind xmlns */
  5979. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5980. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5981. }
  5982. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5983. mustBeXML = libc.Uint8FromInt32(1)
  5984. }
  5985. }
  5986. len1 = 0
  5987. for {
  5988. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5989. break
  5990. }
  5991. if isXML != 0 && (len1 > _xmlLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlNamespace[len1])) {
  5992. isXML = libc.Uint8FromInt32(0)
  5993. }
  5994. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlnsNamespace[len1])) {
  5995. isXMLNS = libc.Uint8FromInt32(0)
  5996. }
  5997. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5998. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5999. // namespaces specification) we have to at least make sure, that
  6000. // the application on top of Expat (that is likely splitting expanded
  6001. // element names ("qualified names") of form
  6002. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  6003. // in its element handler code) cannot be confused by an attacker
  6004. // putting additional namespace separator characters into namespace
  6005. // declarations. That would be ambiguous and not to be expected.
  6006. //
  6007. // While the HTML API docs of function XML_ParserCreateNS have been
  6008. // advising against use of a namespace separator character that can
  6009. // appear in a URI for >20 years now, some widespread applications
  6010. // are using URI characters (':' (colon) in particular) for a
  6011. // namespace separator, in practice. To keep these applications
  6012. // functional, we only reject namespaces URIs containing the
  6013. // application-chosen namespace separator if the chosen separator
  6014. // is a non-URI character with regard to RFC 3986.
  6015. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  6016. return int32(_XML_ERROR_SYNTAX)
  6017. }
  6018. goto _1
  6019. _1:
  6020. ;
  6021. len1++
  6022. }
  6023. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  6024. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  6025. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  6026. if mustBeXML != 0 {
  6027. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  6028. } else {
  6029. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  6030. }
  6031. return v2
  6032. }
  6033. if isXMLNS != 0 {
  6034. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  6035. }
  6036. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  6037. len1++
  6038. }
  6039. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  6040. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  6041. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  6042. /* Detect and prevent integer overflow */
  6043. if len1 > libc.Int32FromInt32(m___INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  6044. return int32(_XML_ERROR_NO_MEMORY)
  6045. }
  6046. /* Detect and prevent integer overflow.
  6047. * The preprocessor guard addresses the "always false" warning
  6048. * from -Wtype-limits on platforms where
  6049. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  6050. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  6051. if temp == libc.UintptrFromInt32(0) {
  6052. return int32(_XML_ERROR_NO_MEMORY)
  6053. }
  6054. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  6055. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  6056. }
  6057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  6058. } else {
  6059. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  6060. if !(b != 0) {
  6061. return int32(_XML_ERROR_NO_MEMORY)
  6062. }
  6063. /* Detect and prevent integer overflow */
  6064. if len1 > libc.Int32FromInt32(m___INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  6065. return int32(_XML_ERROR_NO_MEMORY)
  6066. }
  6067. /* Detect and prevent integer overflow.
  6068. * The preprocessor guard addresses the "always false" warning
  6069. * from -Wtype-limits on platforms where
  6070. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  6071. (*TBINDING)(unsafe.Pointer(b)).Furi = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  6072. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  6073. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  6074. return int32(_XML_ERROR_NO_MEMORY)
  6075. }
  6076. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  6077. }
  6078. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  6079. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  6080. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  6081. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  6082. }
  6083. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  6084. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  6085. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  6086. /* NULL binding when default namespace undeclared */
  6087. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  6088. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  6089. } else {
  6090. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  6091. }
  6092. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  6093. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  6094. /* if attId == NULL then we are not starting a namespace scope */
  6095. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  6096. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  6097. v3 = uri
  6098. } else {
  6099. v3 = uintptr(0)
  6100. }
  6101. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TPREFIX)(unsafe.Pointer(prefix)).Fname, v3)
  6102. }
  6103. return int32(_XML_ERROR_NONE)
  6104. }
  6105. // "http://www.w3.org/XML/1998/namespace"
  6106. var _xmlNamespace = [37]TXML_Char{
  6107. 0: int8(m_ASCII_h),
  6108. 1: int8(m_ASCII_t),
  6109. 2: int8(m_ASCII_t),
  6110. 3: int8(m_ASCII_p),
  6111. 4: int8(m_ASCII_COLON),
  6112. 5: int8(m_ASCII_SLASH),
  6113. 6: int8(m_ASCII_SLASH),
  6114. 7: int8(m_ASCII_w),
  6115. 8: int8(m_ASCII_w),
  6116. 9: int8(m_ASCII_w),
  6117. 10: int8(m_ASCII_PERIOD),
  6118. 11: int8(m_ASCII_w),
  6119. 12: int8(m_ASCII_3),
  6120. 13: int8(m_ASCII_PERIOD),
  6121. 14: int8(m_ASCII_o),
  6122. 15: int8(m_ASCII_r),
  6123. 16: int8(m_ASCII_g),
  6124. 17: int8(m_ASCII_SLASH),
  6125. 18: int8(m_ASCII_X),
  6126. 19: int8(m_ASCII_M),
  6127. 20: int8(m_ASCII_L),
  6128. 21: int8(m_ASCII_SLASH),
  6129. 22: int8(m_ASCII_1),
  6130. 23: int8(m_ASCII_9),
  6131. 24: int8(m_ASCII_9),
  6132. 25: int8(m_ASCII_8),
  6133. 26: int8(m_ASCII_SLASH),
  6134. 27: int8(m_ASCII_n),
  6135. 28: int8(m_ASCII_a),
  6136. 29: int8(m_ASCII_m),
  6137. 30: int8(m_ASCII_e),
  6138. 31: int8(m_ASCII_s),
  6139. 32: int8(m_ASCII_p),
  6140. 33: int8(m_ASCII_a),
  6141. 34: int8(m_ASCII_c),
  6142. 35: int8(m_ASCII_e),
  6143. }
  6144. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  6145. // "http://www.w3.org/2000/xmlns/"
  6146. var _xmlnsNamespace = [30]TXML_Char{
  6147. 0: int8(m_ASCII_h),
  6148. 1: int8(m_ASCII_t),
  6149. 2: int8(m_ASCII_t),
  6150. 3: int8(m_ASCII_p),
  6151. 4: int8(m_ASCII_COLON),
  6152. 5: int8(m_ASCII_SLASH),
  6153. 6: int8(m_ASCII_SLASH),
  6154. 7: int8(m_ASCII_w),
  6155. 8: int8(m_ASCII_w),
  6156. 9: int8(m_ASCII_w),
  6157. 10: int8(m_ASCII_PERIOD),
  6158. 11: int8(m_ASCII_w),
  6159. 12: int8(m_ASCII_3),
  6160. 13: int8(m_ASCII_PERIOD),
  6161. 14: int8(m_ASCII_o),
  6162. 15: int8(m_ASCII_r),
  6163. 16: int8(m_ASCII_g),
  6164. 17: int8(m_ASCII_SLASH),
  6165. 18: int8(m_ASCII_2),
  6166. 19: int8(m_ASCII_0),
  6167. 20: int8(m_ASCII_0),
  6168. 21: int8(m_ASCII_0),
  6169. 22: int8(m_ASCII_SLASH),
  6170. 23: int8(m_ASCII_x),
  6171. 24: int8(m_ASCII_m),
  6172. 25: int8(m_ASCII_l),
  6173. 26: int8(m_ASCII_n),
  6174. 27: int8(m_ASCII_s),
  6175. 28: int8(m_ASCII_SLASH),
  6176. }
  6177. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  6178. // C documentation
  6179. //
  6180. // /* The idea here is to avoid using stack for each CDATA section when
  6181. // the whole file is parsed with one call.
  6182. // */
  6183. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6184. bp := tls.Alloc(16)
  6185. defer tls.Free(16)
  6186. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6187. var result _XML_Error
  6188. _ = result
  6189. result = _doCdataSection(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, bp, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), int32(_XML_ACCOUNT_DIRECT))
  6190. if result != int32(_XML_ERROR_NONE) {
  6191. return result
  6192. }
  6193. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6194. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  6195. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  6196. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6197. } else {
  6198. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6199. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6200. }
  6201. }
  6202. return result
  6203. }
  6204. // C documentation
  6205. //
  6206. // /* startPtr gets set to non-null if the section is closed, and to null if
  6207. // the section is not yet closed.
  6208. // */
  6209. func _doCdataSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool, account _XML_Account) (r _XML_Error) {
  6210. bp := tls.Alloc(32)
  6211. defer tls.Free(32)
  6212. var charDataHandler TXML_CharacterDataHandler
  6213. var convert_res _XML_Convert_Result
  6214. var eventEndPP, eventPP, v3 uintptr
  6215. var tok int32
  6216. var _ /* c at bp+16 */ TXML_Char
  6217. var _ /* dataPtr at bp+24 */ uintptr
  6218. var _ /* next at bp+8 */ uintptr
  6219. var _ /* s at bp+0 */ uintptr
  6220. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  6221. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6222. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6223. eventPP = parser + 544
  6224. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6225. eventEndPP = parser + 552
  6226. } else {
  6227. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6228. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6229. }
  6230. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6231. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6232. for {
  6233. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6234. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 2*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  6235. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4044), account) != 0) {
  6236. _accountingOnAbort(tls, parser)
  6237. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6238. }
  6239. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6240. switch tok {
  6241. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6242. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6243. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6244. } else {
  6245. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6246. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, 0)
  6247. } else {
  6248. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6249. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6250. }
  6251. }
  6252. }
  6253. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6254. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6255. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6256. return int32(_XML_ERROR_ABORTED)
  6257. } else {
  6258. return int32(_XML_ERROR_NONE)
  6259. }
  6260. fallthrough
  6261. case int32(m_XML_TOK_DATA_NEWLINE):
  6262. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6263. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  6264. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  6265. } else {
  6266. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6267. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6268. }
  6269. }
  6270. case int32(m_XML_TOK_DATA_CHARS):
  6271. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6272. if charDataHandler != 0 {
  6273. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6274. for {
  6275. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6276. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+24, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  6277. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6278. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  6279. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6280. break
  6281. }
  6282. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6283. goto _2
  6284. _2:
  6285. }
  6286. } else {
  6287. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  6288. }
  6289. } else {
  6290. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6291. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6292. }
  6293. }
  6294. case m_XML_TOK_INVALID:
  6295. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6296. return int32(_XML_ERROR_INVALID_TOKEN)
  6297. case -int32(2):
  6298. if haveMore != 0 {
  6299. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6300. return int32(_XML_ERROR_NONE)
  6301. }
  6302. return int32(_XML_ERROR_PARTIAL_CHAR)
  6303. case -int32(1):
  6304. fallthrough
  6305. case -int32(4):
  6306. if haveMore != 0 {
  6307. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6308. return int32(_XML_ERROR_NONE)
  6309. }
  6310. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6311. default:
  6312. /* Every token returned by XmlCdataSectionTok() has its own
  6313. * explicit case, so this default case will never be executed.
  6314. * We retain it as a safety net and exclude it from the coverage
  6315. * statistics.
  6316. *
  6317. * LCOV_EXCL_START
  6318. */
  6319. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6320. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6321. /* LCOV_EXCL_STOP */
  6322. }
  6323. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6324. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6325. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6326. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6327. case int32(_XML_SUSPENDED):
  6328. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6329. return int32(_XML_ERROR_NONE)
  6330. case int32(_XML_FINISHED):
  6331. return int32(_XML_ERROR_ABORTED)
  6332. default:
  6333. }
  6334. goto _1
  6335. _1:
  6336. }
  6337. /* not reached */
  6338. return r
  6339. }
  6340. // C documentation
  6341. //
  6342. // /* The idea here is to avoid using stack for each IGNORE section when
  6343. // the whole file is parsed with one call.
  6344. // */
  6345. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6346. bp := tls.Alloc(16)
  6347. defer tls.Free(16)
  6348. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6349. var result _XML_Error
  6350. _ = result
  6351. result = _doIgnoreSection(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, bp, end, endPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)))
  6352. if result != int32(_XML_ERROR_NONE) {
  6353. return result
  6354. }
  6355. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6356. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6357. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6358. }
  6359. return result
  6360. }
  6361. // C documentation
  6362. //
  6363. // /* startPtr gets set to non-null is the section is closed, and to null
  6364. // if the section is not yet closed.
  6365. // */
  6366. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6367. bp := tls.Alloc(16)
  6368. defer tls.Free(16)
  6369. var eventEndPP, eventPP, s uintptr
  6370. var tok int32
  6371. var _ /* next at bp+0 */ uintptr
  6372. _, _, _, _ = eventEndPP, eventPP, s, tok
  6373. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6374. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6375. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6376. eventPP = parser + 544
  6377. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6378. eventEndPP = parser + 552
  6379. } else {
  6380. /* It's not entirely clear, but it seems the following two lines
  6381. * of code cannot be executed. The only occasions on which 'enc'
  6382. * is not 'encoding' are when this function is called
  6383. * from the internal entity processing, and IGNORE sections are an
  6384. * error in internal entities.
  6385. *
  6386. * Since it really isn't clear that this is true, we keep the code
  6387. * and just remove it from our coverage tests.
  6388. *
  6389. * LCOV_EXCL_START
  6390. */
  6391. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6392. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6393. /* LCOV_EXCL_STOP */
  6394. }
  6395. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6396. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6397. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  6398. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6399. _accountingOnAbort(tls, parser)
  6400. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6401. }
  6402. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6403. switch tok {
  6404. case int32(m_XML_TOK_IGNORE_SECT):
  6405. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6406. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6407. }
  6408. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6409. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6410. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6411. return int32(_XML_ERROR_ABORTED)
  6412. } else {
  6413. return int32(_XML_ERROR_NONE)
  6414. }
  6415. fallthrough
  6416. case m_XML_TOK_INVALID:
  6417. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6418. return int32(_XML_ERROR_INVALID_TOKEN)
  6419. case -int32(2):
  6420. if haveMore != 0 {
  6421. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6422. return int32(_XML_ERROR_NONE)
  6423. }
  6424. return int32(_XML_ERROR_PARTIAL_CHAR)
  6425. case -int32(1):
  6426. fallthrough
  6427. case -int32(4):
  6428. if haveMore != 0 {
  6429. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6430. return int32(_XML_ERROR_NONE)
  6431. }
  6432. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6433. default:
  6434. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6435. * explicit cases to handle them, so this default case is never
  6436. * executed. We keep it as a safety net anyway, and remove it
  6437. * from our test coverage statistics.
  6438. *
  6439. * LCOV_EXCL_START
  6440. */
  6441. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6442. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6443. /* LCOV_EXCL_STOP */
  6444. }
  6445. /* not reached */
  6446. return r
  6447. }
  6448. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6449. var s uintptr
  6450. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6451. _, _ = s, v1
  6452. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6453. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6454. v1 = XXmlInitEncodingNS
  6455. } else {
  6456. v1 = XXmlInitEncoding
  6457. }
  6458. if v1(tls, parser+296, parser+288, s) != 0 {
  6459. return int32(_XML_ERROR_NONE)
  6460. }
  6461. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6462. }
  6463. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6464. bp := tls.Alloc(48)
  6465. defer tls.Free(48)
  6466. var result _XML_Error
  6467. var storedEncName, storedversion uintptr
  6468. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6469. var _ /* encodingName at bp+0 */ uintptr
  6470. var _ /* newEncoding at bp+8 */ uintptr
  6471. var _ /* standalone at bp+32 */ int32
  6472. var _ /* version at bp+16 */ uintptr
  6473. var _ /* versionend at bp+24 */ uintptr
  6474. _, _, _, _ = result, storedEncName, storedversion, v1
  6475. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6476. storedEncName = libc.UintptrFromInt32(0)
  6477. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6478. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  6479. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  6480. storedversion = libc.UintptrFromInt32(0)
  6481. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  6482. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6483. _accountingOnAbort(tls, parser)
  6484. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6485. }
  6486. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6487. v1 = XXmlParseXmlDeclNS
  6488. } else {
  6489. v1 = XXmlParseXmlDecl
  6490. }
  6491. if !(v1(tls, isGeneralTextEntity, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next, parser+544, bp+16, bp+24, bp, bp+8, bp+32) != 0) {
  6492. if isGeneralTextEntity != 0 {
  6493. return int32(_XML_ERROR_TEXT_DECL)
  6494. } else {
  6495. return int32(_XML_ERROR_XML_DECL)
  6496. }
  6497. }
  6498. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  6499. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6500. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6501. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6502. }
  6503. }
  6504. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6505. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6506. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  6507. if !(storedEncName != 0) {
  6508. return int32(_XML_ERROR_NO_MEMORY)
  6509. }
  6510. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  6511. }
  6512. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  6513. storedversion = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24))-uintptr((*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar))
  6514. if !(storedversion != 0) {
  6515. return int32(_XML_ERROR_NO_MEMORY)
  6516. }
  6517. }
  6518. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, storedversion, storedEncName, *(*int32)(unsafe.Pointer(bp + 32)))
  6519. } else {
  6520. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6521. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6522. }
  6523. }
  6524. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6525. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6526. /* Check that the specified encoding does not conflict with what
  6527. * the parser has already deduced. Do we have the same number
  6528. * of bytes in the smallest representation of a character? If
  6529. * this is UTF-16, is it the same endianness?
  6530. */
  6531. if (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar != (*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar || (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar == int32(2) && *(*uintptr)(unsafe.Pointer(bp + 8)) != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6532. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6533. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6534. }
  6535. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  6536. } else {
  6537. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6538. if !(storedEncName != 0) {
  6539. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  6540. if !(storedEncName != 0) {
  6541. return int32(_XML_ERROR_NO_MEMORY)
  6542. }
  6543. }
  6544. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6545. _poolClear(tls, parser+832)
  6546. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6547. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6548. }
  6549. return result
  6550. }
  6551. }
  6552. }
  6553. if storedEncName != 0 || storedversion != 0 {
  6554. _poolClear(tls, parser+832)
  6555. }
  6556. return int32(_XML_ERROR_NONE)
  6557. }
  6558. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6559. bp := tls.Alloc(1056)
  6560. defer tls.Free(1056)
  6561. var enc uintptr
  6562. var i int32
  6563. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6564. var _ /* info at bp+0 */ TXML_Encoding
  6565. _, _, _ = enc, i, v2
  6566. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6567. i = 0
  6568. for {
  6569. if !(i < int32(256)) {
  6570. break
  6571. }
  6572. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6573. goto _1
  6574. _1:
  6575. ;
  6576. i++
  6577. }
  6578. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6579. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6580. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6581. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData, encodingName, bp) != 0 {
  6582. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(XXmlSizeOfUnknownEncoding(tls)))
  6583. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6584. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6585. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6586. }
  6587. return int32(_XML_ERROR_NO_MEMORY)
  6588. }
  6589. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6590. v2 = XXmlInitUnknownEncodingNS
  6591. } else {
  6592. v2 = XXmlInitUnknownEncoding
  6593. }
  6594. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6595. if enc != 0 {
  6596. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6597. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6599. return int32(_XML_ERROR_NONE)
  6600. }
  6601. }
  6602. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6603. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6604. }
  6605. }
  6606. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6607. }
  6608. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6609. var result _XML_Error
  6610. _ = result
  6611. result = _initializeEncoding(tls, parser)
  6612. if result != int32(_XML_ERROR_NONE) {
  6613. return result
  6614. }
  6615. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6616. return _prologProcessor(tls, parser, s, end, nextPtr)
  6617. }
  6618. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6619. var result _XML_Error
  6620. _ = result
  6621. result = _initializeEncoding(tls, parser)
  6622. if result != int32(_XML_ERROR_NONE) {
  6623. return result
  6624. }
  6625. /* we know now that XML_Parse(Buffer) has been called,
  6626. so we consider the external parameter entity read */
  6627. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6628. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6629. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6630. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6631. } else {
  6632. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6633. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6634. }
  6635. return r
  6636. }
  6637. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6638. bp := tls.Alloc(16)
  6639. defer tls.Free(16)
  6640. var result _XML_Error
  6641. var start uintptr
  6642. var tok int32
  6643. var _ /* next at bp+0 */ uintptr
  6644. _, _, _ = result, start, tok
  6645. start = s
  6646. *(*uintptr)(unsafe.Pointer(bp)) = start
  6647. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6648. for {
  6649. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  6650. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6651. - storeEntityValue
  6652. - processXmlDecl
  6653. */
  6654. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6655. if tok <= 0 {
  6656. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6657. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6658. return int32(_XML_ERROR_NONE)
  6659. }
  6660. switch tok {
  6661. case m_XML_TOK_INVALID:
  6662. return int32(_XML_ERROR_INVALID_TOKEN)
  6663. case -int32(1):
  6664. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6665. case -int32(2):
  6666. return int32(_XML_ERROR_PARTIAL_CHAR)
  6667. case -int32(4): /* start == end */
  6668. fallthrough
  6669. default:
  6670. break
  6671. }
  6672. /* found end of entity value - can store it now */
  6673. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6674. } else {
  6675. if tok == int32(m_XML_TOK_XML_DECL) {
  6676. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6677. if result != int32(_XML_ERROR_NONE) {
  6678. return result
  6679. }
  6680. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6681. * that to happen, a parameter entity parsing handler must have attempted
  6682. * to suspend the parser, which fails and raises an error. The parser can
  6683. * be aborted, but can't be suspended.
  6684. */
  6685. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6686. return int32(_XML_ERROR_ABORTED)
  6687. }
  6688. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6689. /* stop scanning for text declaration - we found one */
  6690. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6691. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6692. } else {
  6693. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6694. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6695. _accountingOnAbort(tls, parser)
  6696. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6697. }
  6698. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6699. return int32(_XML_ERROR_NONE)
  6700. } else {
  6701. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6702. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6703. return int32(_XML_ERROR_SYNTAX)
  6704. }
  6705. }
  6706. }
  6707. }
  6708. start = *(*uintptr)(unsafe.Pointer(bp))
  6709. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6710. goto _1
  6711. _1:
  6712. }
  6713. return r
  6714. }
  6715. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6716. bp := tls.Alloc(16)
  6717. defer tls.Free(16)
  6718. var tok int32
  6719. var _ /* next at bp+0 */ uintptr
  6720. _ = tok
  6721. *(*uintptr)(unsafe.Pointer(bp)) = s
  6722. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  6723. if tok <= 0 {
  6724. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6725. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6726. return int32(_XML_ERROR_NONE)
  6727. }
  6728. switch tok {
  6729. case m_XML_TOK_INVALID:
  6730. return int32(_XML_ERROR_INVALID_TOKEN)
  6731. case -int32(1):
  6732. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6733. case -int32(2):
  6734. return int32(_XML_ERROR_PARTIAL_CHAR)
  6735. case -int32(4): /* start == end */
  6736. fallthrough
  6737. default:
  6738. break
  6739. }
  6740. } else {
  6741. if tok == int32(m_XML_TOK_BOM) {
  6742. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6743. _accountingOnAbort(tls, parser)
  6744. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6745. }
  6746. s = *(*uintptr)(unsafe.Pointer(bp))
  6747. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  6748. }
  6749. }
  6750. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6751. return _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, tok, *(*uintptr)(unsafe.Pointer(bp)), nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), libc.Uint8FromInt32(1), int32(_XML_ACCOUNT_DIRECT))
  6752. }
  6753. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6754. bp := tls.Alloc(16)
  6755. defer tls.Free(16)
  6756. var enc, start uintptr
  6757. var tok int32
  6758. var _ /* next at bp+0 */ uintptr
  6759. _, _, _ = enc, start, tok
  6760. start = s
  6761. *(*uintptr)(unsafe.Pointer(bp)) = s
  6762. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6763. for {
  6764. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6765. /* Note: These bytes are accounted later in:
  6766. - storeEntityValue
  6767. */
  6768. if tok <= 0 {
  6769. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6770. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6771. return int32(_XML_ERROR_NONE)
  6772. }
  6773. switch tok {
  6774. case m_XML_TOK_INVALID:
  6775. return int32(_XML_ERROR_INVALID_TOKEN)
  6776. case -int32(1):
  6777. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6778. case -int32(2):
  6779. return int32(_XML_ERROR_PARTIAL_CHAR)
  6780. case -int32(4): /* start == end */
  6781. fallthrough
  6782. default:
  6783. break
  6784. }
  6785. /* found end of entity value - can store it now */
  6786. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6787. }
  6788. start = *(*uintptr)(unsafe.Pointer(bp))
  6789. goto _1
  6790. _1:
  6791. }
  6792. return r
  6793. }
  6794. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6795. bp := tls.Alloc(16)
  6796. defer tls.Free(16)
  6797. var tok int32
  6798. var _ /* next at bp+0 */ uintptr
  6799. _ = tok
  6800. *(*uintptr)(unsafe.Pointer(bp)) = s
  6801. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  6802. return _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, tok, *(*uintptr)(unsafe.Pointer(bp)), nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), libc.Uint8FromInt32(1), int32(_XML_ACCOUNT_DIRECT))
  6803. }
  6804. func _doProlog(tls *libc.TLS, parser TXML_Parser, enc uintptr, s uintptr, end uintptr, tok int32, _next uintptr, nextPtr uintptr, haveMore TXML_Bool, allowClosingDoctype TXML_Bool, account _XML_Account) (r _XML_Error) {
  6805. bp := tls.Alloc(16)
  6806. defer tls.Free(16)
  6807. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6808. var attVal, content, dtd, el, entity, entity1, entity2, eventEndPP, eventPP, model, name, name1, name2, name3, new_connector, new_scaff_index, nxt, prefix, pubId, systemId, tem, tem1, v65, v67, v68, v70, v71, v74, v75, v77, v78, v86, p80 uintptr
  6809. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6810. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6811. var nameLen, v88 Tsize_t
  6812. var quant _XML_Content_Quant
  6813. var result, result1, result2, result3, result4, result5 _XML_Error
  6814. var v72, v79, v83 bool
  6815. var v81 uint32
  6816. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = attVal, betweenDecl, content, dtd, el, entity, entity1, entity2, eventEndPP, eventPP, hadParamEntityRefs, hadParamEntityRefs1, handleDefault, model, myindex, myindex1, name, name1, name2, name3, nameLen, new_connector, new_scaff_index, nxt, prefix, pubId, quant, result, result1, result2, result3, result4, result5, role, systemId, tem, tem1, v65, v66, v67, v68, v69, v70, v71, v72, v73, v74, v75, v76, v77, v78, v79, v81, v82, v83, v84, v85, v86, v88, p80
  6817. /* save one level of indirection */
  6818. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6819. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6820. eventPP = parser + 544
  6821. eventEndPP = parser + 552
  6822. } else {
  6823. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6824. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6825. }
  6826. for {
  6827. handleDefault = libc.Uint8FromInt32(1)
  6828. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6829. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6830. if tok <= 0 {
  6831. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6832. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6833. return int32(_XML_ERROR_NONE)
  6834. }
  6835. switch tok {
  6836. case m_XML_TOK_INVALID:
  6837. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6838. return int32(_XML_ERROR_INVALID_TOKEN)
  6839. case -int32(1):
  6840. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6841. case -int32(2):
  6842. return int32(_XML_ERROR_PARTIAL_CHAR)
  6843. case -int32(m_XML_TOK_PROLOG_S):
  6844. tok = -tok
  6845. case -int32(4):
  6846. /* for internal PE NOT referenced between declarations */
  6847. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6848. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6849. return int32(_XML_ERROR_NONE)
  6850. }
  6851. /* WFC: PE Between Declarations - must check that PE contains
  6852. complete markup, not only for external PEs, but also for
  6853. internal PEs if the reference occurs between declarations.
  6854. */
  6855. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6856. if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, -int32(4), end, end, enc) == int32(_XML_ROLE_ERROR) {
  6857. return int32(_XML_ERROR_INCOMPLETE_PE)
  6858. }
  6859. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6860. return int32(_XML_ERROR_NONE)
  6861. }
  6862. return int32(_XML_ERROR_NO_ELEMENTS)
  6863. default:
  6864. tok = -tok
  6865. *(*uintptr)(unsafe.Pointer(bp)) = end
  6866. break
  6867. }
  6868. }
  6869. role = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, tok, s, *(*uintptr)(unsafe.Pointer(bp)), enc)
  6870. switch role {
  6871. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6872. fallthrough
  6873. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6874. fallthrough
  6875. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6876. default:
  6877. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6878. _accountingOnAbort(tls, parser)
  6879. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6880. }
  6881. }
  6882. switch role {
  6883. case int32(_XML_ROLE_XML_DECL):
  6884. goto _2
  6885. case int32(_XML_ROLE_DOCTYPE_NAME):
  6886. goto _3
  6887. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6888. goto _4
  6889. case int32(_XML_ROLE_TEXT_DECL):
  6890. goto _5
  6891. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6892. goto _6
  6893. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6894. goto _7
  6895. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6896. goto _8
  6897. case int32(_XML_ROLE_INSTANCE_START):
  6898. goto _9
  6899. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6900. goto _10
  6901. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6902. goto _11
  6903. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6904. goto _12
  6905. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6906. goto _13
  6907. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6908. goto _14
  6909. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6910. goto _15
  6911. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6912. goto _16
  6913. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6914. goto _17
  6915. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6916. goto _18
  6917. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6918. goto _19
  6919. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6920. goto _20
  6921. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6922. goto _21
  6923. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6924. goto _22
  6925. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6926. goto _23
  6927. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6928. goto _24
  6929. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6930. goto _25
  6931. case int32(_XML_ROLE_ENTITY_VALUE):
  6932. goto _26
  6933. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6934. goto _27
  6935. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6936. goto _28
  6937. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6938. goto _29
  6939. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6940. goto _30
  6941. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6942. goto _31
  6943. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6944. goto _32
  6945. case int32(_XML_ROLE_NOTATION_NAME):
  6946. goto _33
  6947. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6948. goto _34
  6949. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6950. goto _35
  6951. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6952. goto _36
  6953. case int32(_XML_ROLE_ERROR):
  6954. goto _37
  6955. case int32(_XML_ROLE_IGNORE_SECT):
  6956. goto _38
  6957. case int32(_XML_ROLE_GROUP_OPEN):
  6958. goto _39
  6959. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6960. goto _40
  6961. case int32(_XML_ROLE_GROUP_CHOICE):
  6962. goto _41
  6963. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6964. goto _42
  6965. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6966. goto _43
  6967. case int32(_XML_ROLE_ELEMENT_NAME):
  6968. goto _44
  6969. case int32(_XML_ROLE_CONTENT_EMPTY):
  6970. goto _45
  6971. case int32(_XML_ROLE_CONTENT_ANY):
  6972. goto _46
  6973. case int32(_XML_ROLE_CONTENT_PCDATA):
  6974. goto _47
  6975. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6976. goto _48
  6977. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6978. goto _49
  6979. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6980. goto _50
  6981. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6982. goto _51
  6983. case int32(_XML_ROLE_GROUP_CLOSE):
  6984. goto _52
  6985. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6986. goto _53
  6987. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6988. goto _54
  6989. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6990. goto _55
  6991. case int32(_XML_ROLE_PI):
  6992. goto _56
  6993. case int32(_XML_ROLE_COMMENT):
  6994. goto _57
  6995. case int32(_XML_ROLE_NONE):
  6996. goto _58
  6997. case int32(_XML_ROLE_DOCTYPE_NONE):
  6998. goto _59
  6999. case int32(_XML_ROLE_ENTITY_NONE):
  7000. goto _60
  7001. case int32(_XML_ROLE_NOTATION_NONE):
  7002. goto _61
  7003. case int32(_XML_ROLE_ATTLIST_NONE):
  7004. goto _62
  7005. case int32(_XML_ROLE_ELEMENT_NONE):
  7006. goto _63
  7007. }
  7008. goto _64
  7009. _2:
  7010. ;
  7011. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  7012. if result != int32(_XML_ERROR_NONE) {
  7013. return result
  7014. }
  7015. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  7016. handleDefault = libc.Uint8FromInt32(0)
  7017. goto _64
  7018. _3:
  7019. ;
  7020. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7022. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  7023. return int32(_XML_ERROR_NO_MEMORY)
  7024. }
  7025. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  7027. handleDefault = libc.Uint8FromInt32(0)
  7028. }
  7029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  7030. goto _64
  7031. _4:
  7032. ;
  7033. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7034. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid, int32(1))
  7035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  7036. _poolClear(tls, parser+784)
  7037. handleDefault = libc.Uint8FromInt32(0)
  7038. }
  7039. goto _64
  7040. _5:
  7041. ;
  7042. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  7043. if result1 != int32(_XML_ERROR_NONE) {
  7044. return result1
  7045. }
  7046. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  7047. handleDefault = libc.Uint8FromInt32(0)
  7048. goto _64
  7049. _6:
  7050. ;
  7051. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7052. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7053. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7054. return int32(_XML_ERROR_NO_MEMORY)
  7055. }
  7056. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7057. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7058. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FisPublicId})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp)), eventPP) != 0) {
  7059. return int32(_XML_ERROR_PUBLICID)
  7060. }
  7061. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7062. if !(pubId != 0) {
  7063. return int32(_XML_ERROR_NO_MEMORY)
  7064. }
  7065. _normalizePublicId(tls, pubId)
  7066. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  7068. handleDefault = libc.Uint8FromInt32(0)
  7069. goto alreadyChecked
  7070. }
  7071. /* fall through */
  7072. _7:
  7073. ;
  7074. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FisPublicId})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp)), eventPP) != 0) {
  7075. return int32(_XML_ERROR_PUBLICID)
  7076. }
  7077. goto alreadyChecked
  7078. alreadyChecked:
  7079. ;
  7080. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7081. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7082. if !(tem != 0) {
  7083. return int32(_XML_ERROR_NO_MEMORY)
  7084. }
  7085. _normalizePublicId(tls, tem)
  7086. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  7087. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7088. /* Don't suppress the default handler if we fell through from
  7089. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  7090. */
  7091. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  7092. handleDefault = libc.Uint8FromInt32(0)
  7093. }
  7094. }
  7095. goto _64
  7096. _8:
  7097. ;
  7098. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  7099. /* Must not close doctype from within expanded parameter entities */
  7100. return int32(_XML_ERROR_INVALID_TOKEN)
  7101. }
  7102. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  7103. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid, 0)
  7104. _poolClear(tls, parser+784)
  7105. handleDefault = libc.Uint8FromInt32(0)
  7106. }
  7107. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  7108. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  7109. was not set, indicating an external subset
  7110. */
  7111. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  7112. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  7113. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7114. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7115. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7116. if !(entity != 0) {
  7117. /* The external subset name "#" will have already been
  7118. * inserted into the hash table at the start of the
  7119. * external entity parsing, so no allocation will happen
  7120. * and lookup() cannot fail.
  7121. */
  7122. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  7123. }
  7124. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  7125. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7126. }
  7127. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7128. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity)).Fbase, (*TENTITY)(unsafe.Pointer(entity)).FsystemId, (*TENTITY)(unsafe.Pointer(entity)).FpublicId) != 0) {
  7129. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7130. }
  7131. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  7132. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  7133. return int32(_XML_ERROR_NOT_STANDALONE)
  7134. }
  7135. } else {
  7136. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  7137. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  7138. }
  7139. }
  7140. /* end of DTD - no need to update dtd->keepProcessing */
  7141. }
  7142. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7143. }
  7144. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  7145. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  7146. handleDefault = libc.Uint8FromInt32(0)
  7147. }
  7148. goto _64
  7149. _9:
  7150. ;
  7151. /* if there is no DOCTYPE declaration then now is the
  7152. last chance to read the foreign DTD
  7153. */
  7154. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  7155. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  7156. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7157. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7158. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7159. if !(entity1 != 0) {
  7160. return int32(_XML_ERROR_NO_MEMORY)
  7161. }
  7162. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7163. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7164. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity1)).Fbase, (*TENTITY)(unsafe.Pointer(entity1)).FsystemId, (*TENTITY)(unsafe.Pointer(entity1)).FpublicId) != 0) {
  7165. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7166. }
  7167. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  7168. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  7169. return int32(_XML_ERROR_NOT_STANDALONE)
  7170. }
  7171. } else {
  7172. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  7173. }
  7174. /* end of DTD - no need to update dtd->keepProcessing */
  7175. }
  7176. }
  7177. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  7178. return _contentProcessor(tls, parser, s, end, nextPtr)
  7179. _10:
  7180. ;
  7181. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7182. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7183. return int32(_XML_ERROR_NO_MEMORY)
  7184. }
  7185. goto checkAttListDeclHandler
  7186. _11:
  7187. ;
  7188. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7189. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  7190. return int32(_XML_ERROR_NO_MEMORY)
  7191. }
  7192. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  7193. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  7194. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  7195. goto checkAttListDeclHandler
  7196. _12:
  7197. ;
  7198. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  7199. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  7200. goto checkAttListDeclHandler
  7201. _13:
  7202. ;
  7203. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  7204. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  7205. goto checkAttListDeclHandler
  7206. _14:
  7207. ;
  7208. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  7209. goto checkAttListDeclHandler
  7210. _15:
  7211. ;
  7212. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  7213. goto checkAttListDeclHandler
  7214. _16:
  7215. ;
  7216. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  7217. goto checkAttListDeclHandler
  7218. _17:
  7219. ;
  7220. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  7221. goto checkAttListDeclHandler
  7222. _18:
  7223. ;
  7224. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  7225. goto checkAttListDeclHandler
  7226. _19:
  7227. ;
  7228. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7229. goto checkAttListDeclHandler
  7230. checkAttListDeclHandler:
  7231. ;
  7232. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7233. handleDefault = libc.Uint8FromInt32(0)
  7234. }
  7235. goto _64
  7236. _21:
  7237. ;
  7238. _20:
  7239. ;
  7240. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7241. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7242. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7243. } else {
  7244. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7245. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7246. } else {
  7247. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7248. }
  7249. prefix = v65
  7250. }
  7251. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  7252. return int32(_XML_ERROR_NO_MEMORY)
  7253. }
  7254. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7255. return int32(_XML_ERROR_NO_MEMORY)
  7256. }
  7257. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7258. handleDefault = libc.Uint8FromInt32(0)
  7259. }
  7260. goto _64
  7261. _23:
  7262. ;
  7263. _22:
  7264. ;
  7265. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7266. if !(_defineAttribute(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId, uintptr(0), parser) != 0) {
  7267. return int32(_XML_ERROR_NO_MEMORY)
  7268. }
  7269. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7270. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7271. /* Enumerated or Notation type */
  7272. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7273. v66 = 0
  7274. } else {
  7275. v68 = parser + 784 + 24
  7276. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7277. *(*uintptr)(unsafe.Pointer(v68))++
  7278. *(*TXML_Char)(unsafe.Pointer(v67)) = int8(m_ASCII_RPAREN)
  7279. v66 = libc.Int32FromInt32(1)
  7280. }
  7281. if v72 = !(v66 != 0); !v72 {
  7282. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7283. v69 = 0
  7284. } else {
  7285. v71 = parser + 784 + 24
  7286. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7287. *(*uintptr)(unsafe.Pointer(v71))++
  7288. *(*TXML_Char)(unsafe.Pointer(v70)) = int8('\000')
  7289. v69 = libc.Int32FromInt32(1)
  7290. }
  7291. }
  7292. if v72 || !(v69 != 0) {
  7293. return int32(_XML_ERROR_NO_MEMORY)
  7294. }
  7295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7296. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7297. }
  7298. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7299. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, (*TATTRIBUTE_ID)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId)).Fname, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType, uintptr(0), libc.BoolInt32(role == int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)))
  7300. handleDefault = libc.Uint8FromInt32(0)
  7301. }
  7302. }
  7303. _poolClear(tls, parser+784)
  7304. goto _64
  7305. _25:
  7306. ;
  7307. _24:
  7308. ;
  7309. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7310. result2 = _storeAttributeValue(tls, parser, enc, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), dtd+160, int32(_XML_ACCOUNT_NONE))
  7311. if result2 != 0 {
  7312. return result2
  7313. }
  7314. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7315. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7316. /* ID attributes aren't allowed to have a default */
  7317. if !(_defineAttribute(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, libc.Uint8FromInt32(0), attVal, parser) != 0) {
  7318. return int32(_XML_ERROR_NO_MEMORY)
  7319. }
  7320. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7321. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7322. /* Enumerated or Notation type */
  7323. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7324. v73 = 0
  7325. } else {
  7326. v75 = parser + 784 + 24
  7327. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7328. *(*uintptr)(unsafe.Pointer(v75))++
  7329. *(*TXML_Char)(unsafe.Pointer(v74)) = int8(m_ASCII_RPAREN)
  7330. v73 = libc.Int32FromInt32(1)
  7331. }
  7332. if v79 = !(v73 != 0); !v79 {
  7333. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7334. v76 = 0
  7335. } else {
  7336. v78 = parser + 784 + 24
  7337. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7338. *(*uintptr)(unsafe.Pointer(v78))++
  7339. *(*TXML_Char)(unsafe.Pointer(v77)) = int8('\000')
  7340. v76 = libc.Int32FromInt32(1)
  7341. }
  7342. }
  7343. if v79 || !(v76 != 0) {
  7344. return int32(_XML_ERROR_NO_MEMORY)
  7345. }
  7346. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7347. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7348. }
  7349. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7350. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, (*TATTRIBUTE_ID)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId)).Fname, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType, attVal, libc.BoolInt32(role == int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)))
  7351. _poolClear(tls, parser+784)
  7352. handleDefault = libc.Uint8FromInt32(0)
  7353. }
  7354. }
  7355. goto _64
  7356. _26:
  7357. ;
  7358. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7359. result3 = _storeEntityValue(tls, parser, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), int32(_XML_ACCOUNT_NONE))
  7360. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7361. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7362. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen = int32(int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fstart))
  7363. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  7364. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7365. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7366. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, libc.Int32FromUint8((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param), (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase, uintptr(0), uintptr(0), uintptr(0))
  7367. handleDefault = libc.Uint8FromInt32(0)
  7368. }
  7369. } else {
  7370. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7371. }
  7372. if result3 != int32(_XML_ERROR_NONE) {
  7373. return result3
  7374. }
  7375. }
  7376. goto _64
  7377. _27:
  7378. ;
  7379. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7380. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7381. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7382. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7383. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7384. return int32(_XML_ERROR_NO_MEMORY)
  7385. }
  7386. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7387. handleDefault = libc.Uint8FromInt32(0)
  7388. } else {
  7389. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7390. for the case where no parser->m_startDoctypeDeclHandler is set */
  7391. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7392. }
  7393. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  7394. return int32(_XML_ERROR_NOT_STANDALONE)
  7395. }
  7396. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7397. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7398. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7399. return int32(_XML_ERROR_NO_MEMORY)
  7400. }
  7401. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7402. }
  7403. /* fall through */
  7404. _28:
  7405. ;
  7406. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7407. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7408. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7409. return int32(_XML_ERROR_NO_MEMORY)
  7410. }
  7411. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7412. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7413. /* Don't suppress the default handler if we fell through from
  7414. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7415. */
  7416. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7417. handleDefault = libc.Uint8FromInt32(0)
  7418. }
  7419. }
  7420. goto _64
  7421. _29:
  7422. ;
  7423. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7424. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7425. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, libc.Int32FromUint8((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param), uintptr(0), 0, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId, uintptr(0))
  7426. handleDefault = libc.Uint8FromInt32(0)
  7427. }
  7428. goto _64
  7429. _30:
  7430. ;
  7431. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7432. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7433. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7434. return int32(_XML_ERROR_NO_MEMORY)
  7435. }
  7436. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7437. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7438. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7439. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation)
  7440. handleDefault = libc.Uint8FromInt32(0)
  7441. } else {
  7442. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7443. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7444. (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname, 0, uintptr(0), 0, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId, (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation)
  7445. handleDefault = libc.Uint8FromInt32(0)
  7446. }
  7447. }
  7448. }
  7449. goto _64
  7450. _31:
  7451. ;
  7452. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  7453. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7454. goto _64
  7455. }
  7456. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7457. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7458. if !(name != 0) {
  7459. return int32(_XML_ERROR_NO_MEMORY)
  7460. }
  7461. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  7462. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7463. return int32(_XML_ERROR_NO_MEMORY)
  7464. }
  7465. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7466. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7467. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7468. } else {
  7469. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7470. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7471. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7472. /* if we have a parent parser or are reading an internal parameter
  7473. entity, then the entity declaration is not considered "internal"
  7474. */
  7475. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_internal = libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7476. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7477. handleDefault = libc.Uint8FromInt32(0)
  7478. }
  7479. }
  7480. } else {
  7481. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7483. }
  7484. goto _64
  7485. _32:
  7486. ;
  7487. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7488. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7489. if !(name1 != 0) {
  7490. return int32(_XML_ERROR_NO_MEMORY)
  7491. }
  7492. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  7493. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7494. return int32(_XML_ERROR_NO_MEMORY)
  7495. }
  7496. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7497. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7499. } else {
  7500. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7501. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7502. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7503. /* if we have a parent parser or are reading an internal parameter
  7504. entity, then the entity declaration is not considered "internal"
  7505. */
  7506. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_internal = libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7507. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7508. handleDefault = libc.Uint8FromInt32(0)
  7509. }
  7510. }
  7511. } else {
  7512. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7514. }
  7515. goto _64
  7516. _33:
  7517. ;
  7518. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7519. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7520. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7521. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7522. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7523. return int32(_XML_ERROR_NO_MEMORY)
  7524. }
  7525. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7526. handleDefault = libc.Uint8FromInt32(0)
  7527. }
  7528. goto _64
  7529. _34:
  7530. ;
  7531. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FisPublicId})))(tls, enc, s, *(*uintptr)(unsafe.Pointer(bp)), eventPP) != 0) {
  7532. return int32(_XML_ERROR_PUBLICID)
  7533. }
  7534. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7535. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7536. if !(tem1 != 0) {
  7537. return int32(_XML_ERROR_NO_MEMORY)
  7538. }
  7539. _normalizePublicId(tls, tem1)
  7540. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7541. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7542. handleDefault = libc.Uint8FromInt32(0)
  7543. }
  7544. goto _64
  7545. _35:
  7546. ;
  7547. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7548. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7549. if !(systemId != 0) {
  7550. return int32(_XML_ERROR_NO_MEMORY)
  7551. }
  7552. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7553. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase, systemId, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId)
  7554. handleDefault = libc.Uint8FromInt32(0)
  7555. }
  7556. _poolClear(tls, parser+784)
  7557. goto _64
  7558. _36:
  7559. ;
  7560. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7561. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7562. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase, uintptr(0), (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId)
  7563. handleDefault = libc.Uint8FromInt32(0)
  7564. }
  7565. _poolClear(tls, parser+784)
  7566. goto _64
  7567. _37:
  7568. ;
  7569. switch tok {
  7570. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7571. /* PE references in internal subset are
  7572. not allowed within declarations. */
  7573. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7574. case int32(m_XML_TOK_XML_DECL):
  7575. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7576. default:
  7577. return int32(_XML_ERROR_SYNTAX)
  7578. }
  7579. _38:
  7580. ;
  7581. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7582. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7583. }
  7584. handleDefault = libc.Uint8FromInt32(0)
  7585. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7586. if result4 != int32(_XML_ERROR_NONE) {
  7587. return result4
  7588. } else {
  7589. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7590. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7591. return result4
  7592. }
  7593. }
  7594. goto _64
  7595. _39:
  7596. ;
  7597. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7598. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7599. /* Detect and prevent integer overflow */
  7600. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7601. return int32(_XML_ERROR_NO_MEMORY)
  7602. }
  7603. p80 = parser + 888
  7604. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7605. new_connector = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector, uint64(*(*uint32)(unsafe.Pointer(p80))))
  7606. if new_connector == libc.UintptrFromInt32(0) {
  7607. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  7608. return int32(_XML_ERROR_NO_MEMORY)
  7609. }
  7610. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7611. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7612. /* Detect and prevent integer overflow.
  7613. * The preprocessor guard addresses the "always false" warning
  7614. * from -Wtype-limits on platforms where
  7615. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7616. new_scaff_index = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  7617. if new_scaff_index == libc.UintptrFromInt32(0) {
  7618. return int32(_XML_ERROR_NO_MEMORY)
  7619. }
  7620. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7621. }
  7622. } else {
  7623. v81 = libc.Uint32FromInt32(32)
  7624. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7625. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64(v81))
  7626. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7627. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7628. return int32(_XML_ERROR_NO_MEMORY)
  7629. }
  7630. }
  7631. }
  7632. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = 0
  7633. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7634. myindex = _nextScaffoldPart(tls, parser)
  7635. if myindex < 0 {
  7636. return int32(_XML_ERROR_NO_MEMORY)
  7637. }
  7638. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7639. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7640. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7641. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7642. handleDefault = libc.Uint8FromInt32(0)
  7643. }
  7644. }
  7645. goto _64
  7646. _40:
  7647. ;
  7648. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  7649. return int32(_XML_ERROR_SYNTAX)
  7650. }
  7651. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_COMMA)
  7652. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7653. handleDefault = libc.Uint8FromInt32(0)
  7654. }
  7655. goto _64
  7656. _41:
  7657. ;
  7658. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  7659. return int32(_XML_ERROR_SYNTAX)
  7660. }
  7661. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) != 0) && (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 != int32(_XML_CTYPE_MIXED) {
  7662. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_CHOICE)
  7663. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7664. handleDefault = libc.Uint8FromInt32(0)
  7665. }
  7666. }
  7667. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_PIPE)
  7668. goto _64
  7669. _43:
  7670. ;
  7671. _42:
  7672. ;
  7673. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7674. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7675. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7676. } else {
  7677. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7678. if !(name2 != 0) {
  7679. return int32(_XML_ERROR_NO_MEMORY)
  7680. }
  7681. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7682. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7683. /* first, determine if a check for an existing declaration is needed;
  7684. if yes, check that the entity exists, and that it is internal,
  7685. otherwise call the skipped entity handler
  7686. */
  7687. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7688. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7689. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7690. } else {
  7691. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7692. }
  7693. }
  7694. if v83 && v82 != 0 {
  7695. if !(entity2 != 0) {
  7696. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7697. } else {
  7698. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7699. /* It's hard to exhaustively search the code to be sure,
  7700. * but there doesn't seem to be a way of executing the
  7701. * following line. There are two cases:
  7702. *
  7703. * If 'standalone' is false, the DTD must have no
  7704. * parameter entities or we wouldn't have passed the outer
  7705. * 'if' statement. That means the only entity in the hash
  7706. * table is the external subset name "#" which cannot be
  7707. * given as a parameter entity name in XML syntax, so the
  7708. * lookup must have returned NULL and we don't even reach
  7709. * the test for an internal entity.
  7710. *
  7711. * If 'standalone' is true, it does not seem to be
  7712. * possible to create entities taking this code path that
  7713. * are not internal entities, so fail the test above.
  7714. *
  7715. * Because this analysis is very uncertain, the code is
  7716. * being left in place and merely removed from the
  7717. * coverage test statistics.
  7718. */
  7719. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7720. }
  7721. }
  7722. } else {
  7723. if !(entity2 != 0) {
  7724. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7725. /* cannot report skipped entities in declarations */
  7726. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7727. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, name2, int32(1))
  7728. handleDefault = libc.Uint8FromInt32(0)
  7729. }
  7730. goto _64
  7731. }
  7732. }
  7733. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7734. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7735. }
  7736. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7737. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7738. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7739. } else {
  7740. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7741. }
  7742. betweenDecl = libc.Uint8FromInt32(v84)
  7743. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7744. if result5 != int32(_XML_ERROR_NONE) {
  7745. return result5
  7746. }
  7747. handleDefault = libc.Uint8FromInt32(0)
  7748. goto _64
  7749. }
  7750. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7751. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7752. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7753. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7754. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity2)).Fbase, (*TENTITY)(unsafe.Pointer(entity2)).FsystemId, (*TENTITY)(unsafe.Pointer(entity2)).FpublicId) != 0) {
  7755. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7756. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7757. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7758. }
  7759. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7760. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7761. handleDefault = libc.Uint8FromInt32(0)
  7762. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7763. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7764. goto _64
  7765. }
  7766. } else {
  7767. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7768. goto _64
  7769. }
  7770. }
  7771. if !((*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler != 0 && !((*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg) != 0) {
  7772. return int32(_XML_ERROR_NOT_STANDALONE)
  7773. }
  7774. goto _64
  7775. /* Element declaration stuff */
  7776. _44:
  7777. ;
  7778. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7779. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7780. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7781. return int32(_XML_ERROR_NO_MEMORY)
  7782. }
  7783. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7784. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7785. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7786. handleDefault = libc.Uint8FromInt32(0)
  7787. }
  7788. goto _64
  7789. _46:
  7790. ;
  7791. _45:
  7792. ;
  7793. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7794. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7795. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7796. if !(content != 0) {
  7797. return int32(_XML_ERROR_NO_MEMORY)
  7798. }
  7799. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7800. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7801. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7802. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7803. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7804. v85 = int32(_XML_CTYPE_ANY)
  7805. } else {
  7806. v85 = int32(_XML_CTYPE_EMPTY)
  7807. }
  7808. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7809. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7810. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, content)
  7811. handleDefault = libc.Uint8FromInt32(0)
  7812. }
  7813. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7814. }
  7815. goto _64
  7816. _47:
  7817. ;
  7818. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7819. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_MIXED)
  7820. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7821. handleDefault = libc.Uint8FromInt32(0)
  7822. }
  7823. }
  7824. goto _64
  7825. _48:
  7826. ;
  7827. quant = int32(_XML_CQUANT_NONE)
  7828. goto elementContent
  7829. _49:
  7830. ;
  7831. quant = int32(_XML_CQUANT_OPT)
  7832. goto elementContent
  7833. _50:
  7834. ;
  7835. quant = int32(_XML_CQUANT_REP)
  7836. goto elementContent
  7837. _51:
  7838. ;
  7839. quant = int32(_XML_CQUANT_PLUS)
  7840. goto elementContent
  7841. elementContent:
  7842. ;
  7843. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7844. if quant == int32(_XML_CQUANT_NONE) {
  7845. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7846. } else {
  7847. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7848. }
  7849. nxt = v86
  7850. myindex1 = _nextScaffoldPart(tls, parser)
  7851. if myindex1 < 0 {
  7852. return int32(_XML_ERROR_NO_MEMORY)
  7853. }
  7854. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7855. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7856. el = _getElementType(tls, parser, enc, s, nxt)
  7857. if !(el != 0) {
  7858. return int32(_XML_ERROR_NO_MEMORY)
  7859. }
  7860. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7861. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7862. nameLen = uint64(0)
  7863. for {
  7864. v88 = nameLen
  7865. nameLen++
  7866. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7867. break
  7868. }
  7869. goto _87
  7870. _87:
  7871. }
  7872. /* Detect and prevent integer overflow */
  7873. if nameLen > uint64(uint32(m___UINT_MAX)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen) {
  7874. return int32(_XML_ERROR_NO_MEMORY)
  7875. }
  7876. *(*uint32)(unsafe.Pointer(dtd + 336)) += uint32(nameLen)
  7877. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7878. handleDefault = libc.Uint8FromInt32(0)
  7879. }
  7880. }
  7881. goto _64
  7882. _52:
  7883. ;
  7884. quant = int32(_XML_CQUANT_NONE)
  7885. goto closeGroup
  7886. _53:
  7887. ;
  7888. quant = int32(_XML_CQUANT_OPT)
  7889. goto closeGroup
  7890. _54:
  7891. ;
  7892. quant = int32(_XML_CQUANT_REP)
  7893. goto closeGroup
  7894. _55:
  7895. ;
  7896. quant = int32(_XML_CQUANT_PLUS)
  7897. goto closeGroup
  7898. closeGroup:
  7899. ;
  7900. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7901. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7902. handleDefault = libc.Uint8FromInt32(0)
  7903. }
  7904. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7905. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)))*32))).Fquant = quant
  7906. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7907. if !(handleDefault != 0) {
  7908. model = _build_model(tls, parser)
  7909. if !(model != 0) {
  7910. return int32(_XML_ERROR_NO_MEMORY)
  7911. }
  7912. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7913. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TELEMENT_TYPE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType)).Fname, model)
  7914. }
  7915. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7916. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7917. }
  7918. }
  7919. goto _64
  7920. /* End element declaration stuff */
  7921. _56:
  7922. ;
  7923. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7924. return int32(_XML_ERROR_NO_MEMORY)
  7925. }
  7926. handleDefault = libc.Uint8FromInt32(0)
  7927. goto _64
  7928. _57:
  7929. ;
  7930. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7931. return int32(_XML_ERROR_NO_MEMORY)
  7932. }
  7933. handleDefault = libc.Uint8FromInt32(0)
  7934. goto _64
  7935. _58:
  7936. ;
  7937. switch tok {
  7938. case int32(m_XML_TOK_BOM):
  7939. handleDefault = libc.Uint8FromInt32(0)
  7940. break
  7941. }
  7942. goto _64
  7943. _59:
  7944. ;
  7945. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7946. handleDefault = libc.Uint8FromInt32(0)
  7947. }
  7948. goto _64
  7949. _60:
  7950. ;
  7951. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7952. handleDefault = libc.Uint8FromInt32(0)
  7953. }
  7954. goto _64
  7955. _61:
  7956. ;
  7957. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7958. handleDefault = libc.Uint8FromInt32(0)
  7959. }
  7960. goto _64
  7961. _62:
  7962. ;
  7963. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7964. handleDefault = libc.Uint8FromInt32(0)
  7965. }
  7966. goto _64
  7967. _63:
  7968. ;
  7969. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7970. handleDefault = libc.Uint8FromInt32(0)
  7971. }
  7972. goto _64
  7973. _64:
  7974. ; /* end of big switch */
  7975. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7976. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7977. }
  7978. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7979. case int32(_XML_SUSPENDED):
  7980. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7981. return int32(_XML_ERROR_NONE)
  7982. case int32(_XML_FINISHED):
  7983. return int32(_XML_ERROR_ABORTED)
  7984. default:
  7985. s = *(*uintptr)(unsafe.Pointer(bp))
  7986. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7987. }
  7988. goto _1
  7989. _1:
  7990. }
  7991. /* not reached */
  7992. return r
  7993. }
  7994. var _externalSubsetName = [2]TXML_Char{
  7995. 0: int8(m_ASCII_HASH),
  7996. }
  7997. var _atypeCDATA = [6]TXML_Char{
  7998. 0: int8(m_ASCII_C),
  7999. 1: int8(m_ASCII_D),
  8000. 2: int8(m_ASCII_A),
  8001. 3: int8(m_ASCII_T),
  8002. 4: int8(m_ASCII_A),
  8003. }
  8004. var _atypeID = [3]TXML_Char{
  8005. 0: int8(m_ASCII_I),
  8006. 1: int8(m_ASCII_D),
  8007. }
  8008. var _atypeIDREF = [6]TXML_Char{
  8009. 0: int8(m_ASCII_I),
  8010. 1: int8(m_ASCII_D),
  8011. 2: int8(m_ASCII_R),
  8012. 3: int8(m_ASCII_E),
  8013. 4: int8(m_ASCII_F),
  8014. }
  8015. var _atypeIDREFS = [7]TXML_Char{
  8016. 0: int8(m_ASCII_I),
  8017. 1: int8(m_ASCII_D),
  8018. 2: int8(m_ASCII_R),
  8019. 3: int8(m_ASCII_E),
  8020. 4: int8(m_ASCII_F),
  8021. 5: int8(m_ASCII_S),
  8022. }
  8023. var _atypeENTITY = [7]TXML_Char{
  8024. 0: int8(m_ASCII_E),
  8025. 1: int8(m_ASCII_N),
  8026. 2: int8(m_ASCII_T),
  8027. 3: int8(m_ASCII_I),
  8028. 4: int8(m_ASCII_T),
  8029. 5: int8(m_ASCII_Y),
  8030. }
  8031. var _atypeENTITIES = [9]TXML_Char{
  8032. 0: int8(m_ASCII_E),
  8033. 1: int8(m_ASCII_N),
  8034. 2: int8(m_ASCII_T),
  8035. 3: int8(m_ASCII_I),
  8036. 4: int8(m_ASCII_T),
  8037. 5: int8(m_ASCII_I),
  8038. 6: int8(m_ASCII_E),
  8039. 7: int8(m_ASCII_S),
  8040. }
  8041. var _atypeNMTOKEN = [8]TXML_Char{
  8042. 0: int8(m_ASCII_N),
  8043. 1: int8(m_ASCII_M),
  8044. 2: int8(m_ASCII_T),
  8045. 3: int8(m_ASCII_O),
  8046. 4: int8(m_ASCII_K),
  8047. 5: int8(m_ASCII_E),
  8048. 6: int8(m_ASCII_N),
  8049. }
  8050. var _atypeNMTOKENS = [9]TXML_Char{
  8051. 0: int8(m_ASCII_N),
  8052. 1: int8(m_ASCII_M),
  8053. 2: int8(m_ASCII_T),
  8054. 3: int8(m_ASCII_O),
  8055. 4: int8(m_ASCII_K),
  8056. 5: int8(m_ASCII_E),
  8057. 6: int8(m_ASCII_N),
  8058. 7: int8(m_ASCII_S),
  8059. }
  8060. var _notationPrefix = [10]TXML_Char{
  8061. 0: int8(m_ASCII_N),
  8062. 1: int8(m_ASCII_O),
  8063. 2: int8(m_ASCII_T),
  8064. 3: int8(m_ASCII_A),
  8065. 4: int8(m_ASCII_T),
  8066. 5: int8(m_ASCII_I),
  8067. 6: int8(m_ASCII_O),
  8068. 7: int8(m_ASCII_N),
  8069. 8: int8(m_ASCII_LPAREN),
  8070. }
  8071. var _enumValueSep = [2]TXML_Char{
  8072. 0: int8(m_ASCII_PIPE),
  8073. }
  8074. var _enumValueStart = [2]TXML_Char{
  8075. 0: int8(m_ASCII_LPAREN),
  8076. }
  8077. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8078. bp := tls.Alloc(16)
  8079. defer tls.Free(16)
  8080. var tok int32
  8081. var v2 uintptr
  8082. var _ /* next at bp+0 */ uintptr
  8083. _, _ = tok, v2
  8084. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  8085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  8086. for {
  8087. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  8088. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  8089. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  8090. _accountingOnAbort(tls, parser)
  8091. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8092. }
  8093. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  8094. switch tok {
  8095. /* report partial linebreak - it might be the last token */
  8096. case -int32(m_XML_TOK_PROLOG_S):
  8097. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8098. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  8099. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  8100. return int32(_XML_ERROR_ABORTED)
  8101. }
  8102. }
  8103. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8104. return int32(_XML_ERROR_NONE)
  8105. case -int32(4):
  8106. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8107. return int32(_XML_ERROR_NONE)
  8108. case int32(m_XML_TOK_PROLOG_S):
  8109. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8110. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  8111. }
  8112. case int32(m_XML_TOK_PI):
  8113. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8114. return int32(_XML_ERROR_NO_MEMORY)
  8115. }
  8116. case int32(m_XML_TOK_COMMENT):
  8117. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8118. return int32(_XML_ERROR_NO_MEMORY)
  8119. }
  8120. case m_XML_TOK_INVALID:
  8121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8122. return int32(_XML_ERROR_INVALID_TOKEN)
  8123. case -int32(1):
  8124. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  8125. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8126. return int32(_XML_ERROR_NONE)
  8127. }
  8128. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  8129. case -int32(2):
  8130. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  8131. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8132. return int32(_XML_ERROR_NONE)
  8133. }
  8134. return int32(_XML_ERROR_PARTIAL_CHAR)
  8135. default:
  8136. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  8137. }
  8138. v2 = *(*uintptr)(unsafe.Pointer(bp))
  8139. s = v2
  8140. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  8141. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  8142. case int32(_XML_SUSPENDED):
  8143. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8144. return int32(_XML_ERROR_NONE)
  8145. case int32(_XML_FINISHED):
  8146. return int32(_XML_ERROR_ABORTED)
  8147. default:
  8148. }
  8149. goto _1
  8150. _1:
  8151. }
  8152. return r
  8153. }
  8154. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  8155. bp := tls.Alloc(16)
  8156. defer tls.Free(16)
  8157. var openEntity, textEnd, textStart uintptr
  8158. var result _XML_Error
  8159. var tok int32
  8160. var _ /* next at bp+0 */ uintptr
  8161. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  8162. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  8163. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8164. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8165. } else {
  8166. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  8167. if !(openEntity != 0) {
  8168. return int32(_XML_ERROR_NO_MEMORY)
  8169. }
  8170. }
  8171. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8172. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  8173. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  8174. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8175. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  8176. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  8177. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  8178. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  8179. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  8180. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  8181. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  8182. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8183. /* Set a safe default value in case 'next' does not get set */
  8184. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8185. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8186. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp)
  8187. result = _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, tok, *(*uintptr)(unsafe.Pointer(bp)), bp, libc.Uint8FromInt32(0), libc.Uint8FromInt32(0), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8188. } else {
  8189. result = _doContent(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8190. }
  8191. if result == int32(_XML_ERROR_NONE) {
  8192. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8193. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  8194. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  8195. } else {
  8196. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  8197. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8198. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8199. /* put openEntity back in list of free instances */
  8200. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8201. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8202. }
  8203. }
  8204. return result
  8205. }
  8206. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8207. bp := tls.Alloc(16)
  8208. defer tls.Free(16)
  8209. var entity, openEntity, textEnd, textStart uintptr
  8210. var result _XML_Error
  8211. var tok, tok1, v1 int32
  8212. var _ /* next at bp+0 */ uintptr
  8213. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  8214. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8215. if !(openEntity != 0) {
  8216. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8217. }
  8218. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  8219. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  8220. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8221. /* Set a safe default value in case 'next' does not get set */
  8222. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8223. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8224. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp)
  8225. result = _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, tok, *(*uintptr)(unsafe.Pointer(bp)), bp, libc.Uint8FromInt32(0), libc.Uint8FromInt32(1), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8226. } else {
  8227. result = _doContent(tls, parser, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8228. }
  8229. if result != int32(_XML_ERROR_NONE) {
  8230. return result
  8231. }
  8232. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8233. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  8234. return result
  8235. }
  8236. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8237. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8238. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8239. /* put openEntity back in list of free instances */
  8240. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8241. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8242. // If there are more open entities we want to stop right here and have the
  8243. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8244. // be ignored altogether.
  8245. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8246. return int32(_XML_ERROR_NONE)
  8247. }
  8248. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8249. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8250. tok1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, bp)
  8251. return _doProlog(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, tok1, *(*uintptr)(unsafe.Pointer(bp)), nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), libc.Uint8FromInt32(1), int32(_XML_ACCOUNT_DIRECT))
  8252. } else {
  8253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8254. /* see externalEntityContentProcessor vs contentProcessor */
  8255. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8256. v1 = int32(1)
  8257. } else {
  8258. v1 = 0
  8259. }
  8260. result = _doContent(tls, parser, v1, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, nextPtr, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0)), int32(_XML_ACCOUNT_DIRECT))
  8261. if result == int32(_XML_ERROR_NONE) {
  8262. if !(_storeRawNames(tls, parser) != 0) {
  8263. return int32(_XML_ERROR_NO_MEMORY)
  8264. }
  8265. }
  8266. return result
  8267. }
  8268. return r
  8269. }
  8270. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8271. _ = s
  8272. _ = end
  8273. _ = nextPtr
  8274. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8275. }
  8276. func _storeAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr, account _XML_Account) (r _XML_Error) {
  8277. var result _XML_Error
  8278. var v1 int32
  8279. var v2, v3 uintptr
  8280. _, _, _, _ = result, v1, v2, v3
  8281. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8282. if result != 0 {
  8283. return result
  8284. }
  8285. if !(isCdata != 0) && int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8286. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8287. }
  8288. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8289. v1 = 0
  8290. } else {
  8291. v3 = pool + 24
  8292. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8293. *(*uintptr)(unsafe.Pointer(v3))++
  8294. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8295. v1 = libc.Int32FromInt32(1)
  8296. }
  8297. if !(v1 != 0) {
  8298. return int32(_XML_ERROR_NO_MEMORY)
  8299. }
  8300. return int32(_XML_ERROR_NONE)
  8301. }
  8302. func _appendAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr, account _XML_Account) (r _XML_Error) {
  8303. bp := tls.Alloc(16)
  8304. defer tls.Free(16)
  8305. var checkEntityDecl int8
  8306. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8307. var i, n, tok, v12, v3, v6, v9 int32
  8308. var result _XML_Error
  8309. var v13 bool
  8310. var _ /* buf at bp+8 */ [4]TXML_Char
  8311. var _ /* ch at bp+12 */ TXML_Char
  8312. var _ /* next at bp+0 */ uintptr
  8313. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8314. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8315. for {
  8316. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8317. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  8318. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8319. _accountingOnAbort(tls, parser)
  8320. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8321. }
  8322. switch tok {
  8323. case -int32(4):
  8324. return int32(_XML_ERROR_NONE)
  8325. case m_XML_TOK_INVALID:
  8326. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8327. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8328. }
  8329. return int32(_XML_ERROR_INVALID_TOKEN)
  8330. case -int32(1):
  8331. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8332. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8333. }
  8334. return int32(_XML_ERROR_INVALID_TOKEN)
  8335. case int32(m_XML_TOK_CHAR_REF):
  8336. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8337. if n < 0 {
  8338. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8339. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8340. }
  8341. return int32(_XML_ERROR_BAD_CHAR_REF)
  8342. }
  8343. if !(isCdata != 0) && n == int32(0x20) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8344. break
  8345. }
  8346. n = XXmlUtf8Encode(tls, n, bp+8)
  8347. /* The XmlEncode() functions can never return 0 here. That
  8348. * error return happens if the code point passed in is either
  8349. * negative or greater than or equal to 0x110000. The
  8350. * XmlCharRefNumber() functions will all return a number
  8351. * strictly less than 0x110000 or a negative value if an error
  8352. * occurred. The negative value is intercepted above, so
  8353. * XmlEncode() is never passed a value it might return an
  8354. * error for.
  8355. */
  8356. i = 0
  8357. for {
  8358. if !(i < n) {
  8359. break
  8360. }
  8361. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8362. v3 = 0
  8363. } else {
  8364. v5 = pool + 24
  8365. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8366. *(*uintptr)(unsafe.Pointer(v5))++
  8367. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8368. v3 = libc.Int32FromInt32(1)
  8369. }
  8370. if !(v3 != 0) {
  8371. return int32(_XML_ERROR_NO_MEMORY)
  8372. }
  8373. goto _2
  8374. _2:
  8375. ;
  8376. i++
  8377. }
  8378. case int32(m_XML_TOK_DATA_CHARS):
  8379. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8380. return int32(_XML_ERROR_NO_MEMORY)
  8381. }
  8382. case -int32(3):
  8383. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8384. /* fall through */
  8385. fallthrough
  8386. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8387. fallthrough
  8388. case int32(m_XML_TOK_DATA_NEWLINE):
  8389. if !(isCdata != 0) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8390. break
  8391. }
  8392. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8393. v6 = 0
  8394. } else {
  8395. v8 = pool + 24
  8396. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8397. *(*uintptr)(unsafe.Pointer(v8))++
  8398. *(*TXML_Char)(unsafe.Pointer(v7)) = int8(0x20)
  8399. v6 = libc.Int32FromInt32(1)
  8400. }
  8401. if !(v6 != 0) {
  8402. return int32(_XML_ERROR_NO_MEMORY)
  8403. }
  8404. case int32(m_XML_TOK_ENTITY_REF):
  8405. *(*TXML_Char)(unsafe.Pointer(bp + 12)) = int8((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  8406. if *(*TXML_Char)(unsafe.Pointer(bp + 12)) != 0 {
  8407. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8408. * so there is no amplification and hence recording without
  8409. * protection. */
  8410. _accountingDiffTolerated(tls, parser, tok, bp+12, bp+12+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8411. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8412. v9 = 0
  8413. } else {
  8414. v11 = pool + 24
  8415. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8416. *(*uintptr)(unsafe.Pointer(v11))++
  8417. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 12))
  8418. v9 = libc.Int32FromInt32(1)
  8419. }
  8420. if !(v9 != 0) {
  8421. return int32(_XML_ERROR_NO_MEMORY)
  8422. }
  8423. break
  8424. }
  8425. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8426. if !(name != 0) {
  8427. return int32(_XML_ERROR_NO_MEMORY)
  8428. }
  8429. entity = _lookup(tls, parser, dtd, name, uint64(0))
  8430. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  8431. /* First, determine if a check for an existing declaration is needed;
  8432. if yes, check that the entity exists, and that it is internal.
  8433. */
  8434. if pool == dtd+160 { /* are we called from prolog? */
  8435. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8436. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8437. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8438. } else {
  8439. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8440. }
  8441. }
  8442. checkEntityDecl = libc.BoolInt8(v13 && v12 != 0)
  8443. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8444. checkEntityDecl = libc.BoolInt8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8445. }
  8446. if checkEntityDecl != 0 {
  8447. if !(entity != 0) {
  8448. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8449. } else {
  8450. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8451. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8452. }
  8453. }
  8454. } else {
  8455. if !(entity != 0) {
  8456. /* Cannot report skipped entity here - see comments on
  8457. parser->m_skippedEntityHandler.
  8458. if (parser->m_skippedEntityHandler)
  8459. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8460. */
  8461. /* Cannot call the default handler because this would be
  8462. out of sync with the call to the startElementHandler.
  8463. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8464. reportDefault(parser, enc, ptr, next);
  8465. */
  8466. break
  8467. }
  8468. }
  8469. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8470. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8471. /* It does not appear that this line can be executed.
  8472. *
  8473. * The "if (entity->open)" check catches recursive entity
  8474. * definitions. In order to be called with an open
  8475. * entity, it must have gone through this code before and
  8476. * been through the recursive call to
  8477. * appendAttributeValue() some lines below. That call
  8478. * sets the local encoding ("enc") to the parser's
  8479. * internal encoding (internal_utf8 or internal_utf16),
  8480. * which can never be the same as the principle encoding.
  8481. * It doesn't appear there is another code path that gets
  8482. * here with entity->open being TRUE.
  8483. *
  8484. * Since it is not certain that this logic is watertight,
  8485. * we keep the line and merely exclude it from coverage
  8486. * tests.
  8487. */
  8488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8489. }
  8490. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8491. }
  8492. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8493. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8494. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8495. }
  8496. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8497. }
  8498. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8499. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8500. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8501. }
  8502. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8503. } else {
  8504. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8505. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8506. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8507. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8508. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8509. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8510. if result != 0 {
  8511. return result
  8512. }
  8513. }
  8514. default:
  8515. /* The only token returned by XmlAttributeValueTok() that does
  8516. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8517. * Getting that would require an entity name to contain an
  8518. * incomplete XML character (e.g. \xE2\x82); however previous
  8519. * tokenisers will have already recognised and rejected such
  8520. * names before XmlAttributeValueTok() gets a look-in. This
  8521. * default case should be retained as a safety net, but the code
  8522. * excluded from coverage tests.
  8523. *
  8524. * LCOV_EXCL_START
  8525. */
  8526. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8527. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8528. }
  8529. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8530. /* LCOV_EXCL_STOP */
  8531. }
  8532. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8533. goto _1
  8534. _1:
  8535. }
  8536. /* not reached */
  8537. return r
  8538. }
  8539. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8540. bp := tls.Alloc(16)
  8541. defer tls.Free(16)
  8542. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8543. var i, n, oldInEntityValue, tok int32
  8544. var result _XML_Error
  8545. var _ /* buf at bp+8 */ [4]TXML_Char
  8546. var _ /* next at bp+0 */ uintptr
  8547. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8548. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8549. pool = dtd + 208
  8550. result = int32(_XML_ERROR_NONE)
  8551. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8552. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8553. /* never return Null for the value argument in EntityDeclHandler,
  8554. since this would indicate an external entity; therefore we
  8555. have to make sure that entityValuePool.start is not null */
  8556. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8557. if !(_poolGrow(tls, pool) != 0) {
  8558. return int32(_XML_ERROR_NO_MEMORY)
  8559. }
  8560. }
  8561. for {
  8562. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8563. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32 + 1*8))})))(tls, enc, entityTextPtr, entityTextEnd, bp)
  8564. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8565. _accountingOnAbort(tls, parser)
  8566. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8567. goto endEntityValue
  8568. }
  8569. switch tok {
  8570. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8571. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8572. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8573. if !(name != 0) {
  8574. result = int32(_XML_ERROR_NO_MEMORY)
  8575. goto endEntityValue
  8576. }
  8577. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  8578. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8579. if !(entity != 0) {
  8580. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8581. /* cannot report skipped entity here - see comments on
  8582. parser->m_skippedEntityHandler
  8583. if (parser->m_skippedEntityHandler)
  8584. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8585. */
  8586. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8587. goto endEntityValue
  8588. }
  8589. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8590. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8591. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8592. }
  8593. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8594. goto endEntityValue
  8595. }
  8596. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8597. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8598. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8599. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8600. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8601. if !((*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg, uintptr(0), (*TENTITY)(unsafe.Pointer(entity)).Fbase, (*TENTITY)(unsafe.Pointer(entity)).FsystemId, (*TENTITY)(unsafe.Pointer(entity)).FpublicId) != 0) {
  8602. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8603. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8604. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8605. goto endEntityValue
  8606. }
  8607. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8608. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8609. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8610. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8611. }
  8612. } else {
  8613. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8614. }
  8615. } else {
  8616. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8617. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8618. result = _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr+uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8619. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8620. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8621. if result != 0 {
  8622. goto endEntityValue
  8623. }
  8624. }
  8625. break
  8626. }
  8627. /* In the internal subset, PE references are not legal
  8628. within markup declarations, e.g entity values in this case. */
  8629. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8630. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8631. goto endEntityValue
  8632. case -int32(4):
  8633. result = int32(_XML_ERROR_NONE)
  8634. goto endEntityValue
  8635. case int32(m_XML_TOK_ENTITY_REF):
  8636. fallthrough
  8637. case int32(m_XML_TOK_DATA_CHARS):
  8638. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8639. result = int32(_XML_ERROR_NO_MEMORY)
  8640. goto endEntityValue
  8641. }
  8642. case -int32(3):
  8643. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8644. /* fall through */
  8645. fallthrough
  8646. case int32(m_XML_TOK_DATA_NEWLINE):
  8647. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8648. result = int32(_XML_ERROR_NO_MEMORY)
  8649. goto endEntityValue
  8650. }
  8651. v3 = pool + 24
  8652. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8653. *(*uintptr)(unsafe.Pointer(v3))++
  8654. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8655. case int32(m_XML_TOK_CHAR_REF):
  8656. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8657. if n < 0 {
  8658. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8659. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8660. }
  8661. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8662. goto endEntityValue
  8663. }
  8664. n = XXmlUtf8Encode(tls, n, bp+8)
  8665. /* The XmlEncode() functions can never return 0 here. That
  8666. * error return happens if the code point passed in is either
  8667. * negative or greater than or equal to 0x110000. The
  8668. * XmlCharRefNumber() functions will all return a number
  8669. * strictly less than 0x110000 or a negative value if an error
  8670. * occurred. The negative value is intercepted above, so
  8671. * XmlEncode() is never passed a value it might return an
  8672. * error for.
  8673. */
  8674. i = 0
  8675. for {
  8676. if !(i < n) {
  8677. break
  8678. }
  8679. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8680. result = int32(_XML_ERROR_NO_MEMORY)
  8681. goto endEntityValue
  8682. }
  8683. v6 = pool + 24
  8684. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8685. *(*uintptr)(unsafe.Pointer(v6))++
  8686. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8687. goto _4
  8688. _4:
  8689. ;
  8690. i++
  8691. }
  8692. case -int32(1):
  8693. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8694. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8695. }
  8696. result = int32(_XML_ERROR_INVALID_TOKEN)
  8697. goto endEntityValue
  8698. case m_XML_TOK_INVALID:
  8699. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8700. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8701. }
  8702. result = int32(_XML_ERROR_INVALID_TOKEN)
  8703. goto endEntityValue
  8704. default:
  8705. /* This default case should be unnecessary -- all the tokens
  8706. * that XmlEntityValueTok() can return have their own explicit
  8707. * cases -- but should be retained for safety. We do however
  8708. * exclude it from the coverage statistics.
  8709. *
  8710. * LCOV_EXCL_START
  8711. */
  8712. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8713. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8714. }
  8715. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8716. goto endEntityValue
  8717. /* LCOV_EXCL_STOP */
  8718. }
  8719. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8720. goto _1
  8721. _1:
  8722. }
  8723. goto endEntityValue
  8724. endEntityValue:
  8725. ;
  8726. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8727. return result
  8728. }
  8729. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8730. var p, v2, v3, v4, v5 uintptr
  8731. _, _, _, _, _ = p, v2, v3, v4, v5
  8732. for {
  8733. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8734. return
  8735. }
  8736. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8737. break
  8738. }
  8739. goto _1
  8740. _1:
  8741. ;
  8742. s++
  8743. }
  8744. p = s
  8745. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8746. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8747. v2 = p
  8748. p++
  8749. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8750. s++
  8751. v3 = s
  8752. if int32(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8753. s++
  8754. }
  8755. } else {
  8756. v4 = p
  8757. p++
  8758. v5 = s
  8759. s++
  8760. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8761. }
  8762. }
  8763. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  8764. }
  8765. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8766. var data, target, tem uintptr
  8767. _, _, _ = data, target, tem
  8768. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8769. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8770. _reportDefault(tls, parser, enc, start, end)
  8771. }
  8772. return int32(1)
  8773. }
  8774. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8775. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8776. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8777. if !(target != 0) {
  8778. return 0
  8779. }
  8780. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8781. data = _poolStoreString(tls, parser+784, enc, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FskipS})))(tls, enc, tem), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2)))
  8782. if !(data != 0) {
  8783. return 0
  8784. }
  8785. _normalizeLines(tls, data)
  8786. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, target, data)
  8787. _poolClear(tls, parser+784)
  8788. return int32(1)
  8789. }
  8790. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8791. var data uintptr
  8792. _ = data
  8793. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8794. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8795. _reportDefault(tls, parser, enc, start, end)
  8796. }
  8797. return int32(1)
  8798. }
  8799. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8800. if !(data != 0) {
  8801. return 0
  8802. }
  8803. _normalizeLines(tls, data)
  8804. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, data)
  8805. _poolClear(tls, parser+784)
  8806. return int32(1)
  8807. }
  8808. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8809. bp := tls.Alloc(16)
  8810. defer tls.Free(16)
  8811. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8812. var convert_res _XML_Convert_Result
  8813. var eventEndPP, eventPP uintptr
  8814. var _ /* dataPtr at bp+8 */ uintptr
  8815. _, _, _ = convert_res, eventEndPP, eventPP
  8816. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8817. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8818. eventPP = parser + 544
  8819. eventEndPP = parser + 552
  8820. } else {
  8821. /* To get here, two things must be true; the parser must be
  8822. * using a character encoding that is not the same as the
  8823. * encoding passed in, and the encoding passed in must need
  8824. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8825. * is defined). The only occasions on which the encoding passed
  8826. * in is not the same as the parser's encoding are when it is
  8827. * the internal encoding (e.g. a previously defined parameter
  8828. * entity, already converted to internal format). This by
  8829. * definition doesn't need conversion, so the whole branch never
  8830. * gets executed.
  8831. *
  8832. * For safety's sake we don't delete these lines and merely
  8833. * exclude them from coverage statistics.
  8834. *
  8835. * LCOV_EXCL_START
  8836. */
  8837. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8838. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8839. /* LCOV_EXCL_STOP */
  8840. }
  8841. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8842. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8843. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+8, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  8844. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8845. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  8846. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8847. }
  8848. } else {
  8849. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  8850. }
  8851. }
  8852. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8853. var att, temp uintptr
  8854. var count, i int32
  8855. _, _, _, _ = att, count, i, temp
  8856. if value != 0 || isId != 0 {
  8857. i = 0
  8858. for {
  8859. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8860. break
  8861. }
  8862. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8863. return int32(1)
  8864. }
  8865. goto _1
  8866. _1:
  8867. ;
  8868. i++
  8869. }
  8870. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8871. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8872. }
  8873. }
  8874. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8875. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8876. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8877. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts)*libc.Uint64FromInt64(24))
  8878. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8879. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8880. return 0
  8881. }
  8882. } else {
  8883. /* Detect and prevent integer overflow */
  8884. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m___INT_MAX)/libc.Int32FromInt32(2) {
  8885. return 0
  8886. }
  8887. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8888. /* Detect and prevent integer overflow.
  8889. * The preprocessor guard addresses the "always false" warning
  8890. * from -Wtype-limits on platforms where
  8891. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8892. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts, libc.Uint64FromInt32(count)*libc.Uint64FromInt64(24))
  8893. if temp == libc.UintptrFromInt32(0) {
  8894. return 0
  8895. }
  8896. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8897. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8898. }
  8899. }
  8900. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8901. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8902. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8903. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8904. if !(isCdata != 0) {
  8905. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8906. }
  8907. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8908. return int32(1)
  8909. }
  8910. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8911. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8912. var v3, v6 int32
  8913. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8914. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8915. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8916. for {
  8917. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8918. break
  8919. }
  8920. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8921. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8922. for {
  8923. if !(s != name) {
  8924. break
  8925. }
  8926. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8927. v3 = 0
  8928. } else {
  8929. v5 = dtd + 160 + 24
  8930. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8931. *(*uintptr)(unsafe.Pointer(v5))++
  8932. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8933. v3 = libc.Int32FromInt32(1)
  8934. }
  8935. if !(v3 != 0) {
  8936. return 0
  8937. }
  8938. goto _2
  8939. _2:
  8940. ;
  8941. s++
  8942. }
  8943. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8944. v6 = 0
  8945. } else {
  8946. v8 = dtd + 160 + 24
  8947. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8948. *(*uintptr)(unsafe.Pointer(v8))++
  8949. *(*TXML_Char)(unsafe.Pointer(v7)) = int8('\000')
  8950. v6 = libc.Int32FromInt32(1)
  8951. }
  8952. if !(v6 != 0) {
  8953. return 0
  8954. }
  8955. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8956. if !(prefix != 0) {
  8957. return 0
  8958. }
  8959. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8960. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8961. } else {
  8962. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8963. }
  8964. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8965. break
  8966. }
  8967. goto _1
  8968. _1:
  8969. ;
  8970. name++
  8971. }
  8972. return int32(1)
  8973. }
  8974. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8975. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8976. var i, j, v1, v6, v9 int32
  8977. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8978. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8979. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8980. v1 = 0
  8981. } else {
  8982. v3 = dtd + 160 + 24
  8983. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8984. *(*uintptr)(unsafe.Pointer(v3))++
  8985. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8986. v1 = libc.Int32FromInt32(1)
  8987. }
  8988. if !(v1 != 0) {
  8989. return libc.UintptrFromInt32(0)
  8990. }
  8991. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8992. if !(name != 0) {
  8993. return libc.UintptrFromInt32(0)
  8994. }
  8995. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8996. name++
  8997. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8998. if !(id != 0) {
  8999. return libc.UintptrFromInt32(0)
  9000. }
  9001. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  9002. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9003. } else {
  9004. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9005. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  9006. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && int32(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  9007. if int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  9008. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  9009. } else {
  9010. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  9011. }
  9012. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  9013. } else {
  9014. i = 0
  9015. for {
  9016. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  9017. break
  9018. }
  9019. /* attributes without prefix are *not* in the default namespace */
  9020. if int32(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  9021. j = 0
  9022. for {
  9023. if !(j < i) {
  9024. break
  9025. }
  9026. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  9027. v6 = 0
  9028. } else {
  9029. v8 = dtd + 160 + 24
  9030. v7 = *(*uintptr)(unsafe.Pointer(v8))
  9031. *(*uintptr)(unsafe.Pointer(v8))++
  9032. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  9033. v6 = libc.Int32FromInt32(1)
  9034. }
  9035. if !(v6 != 0) {
  9036. return libc.UintptrFromInt32(0)
  9037. }
  9038. goto _5
  9039. _5:
  9040. ;
  9041. j++
  9042. }
  9043. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  9044. v9 = 0
  9045. } else {
  9046. v11 = dtd + 160 + 24
  9047. v10 = *(*uintptr)(unsafe.Pointer(v11))
  9048. *(*uintptr)(unsafe.Pointer(v11))++
  9049. *(*TXML_Char)(unsafe.Pointer(v10)) = int8('\000')
  9050. v9 = libc.Int32FromInt32(1)
  9051. }
  9052. if !(v9 != 0) {
  9053. return libc.UintptrFromInt32(0)
  9054. }
  9055. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  9056. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  9057. return libc.UintptrFromInt32(0)
  9058. }
  9059. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  9060. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9061. } else {
  9062. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9063. }
  9064. break
  9065. }
  9066. goto _4
  9067. _4:
  9068. ;
  9069. i++
  9070. }
  9071. }
  9072. }
  9073. }
  9074. return id
  9075. }
  9076. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  9077. bp := tls.Alloc(16)
  9078. defer tls.Free(16)
  9079. var dtd, e, prefix, s, s1, v10, v11, v15, v16, v18, v19, v2, v22, v23, v26, v27, v3, v31, v32, v34, v35, v6, v7 uintptr
  9080. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  9081. var needSep TXML_Bool
  9082. var v12, v28 bool
  9083. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9084. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, i, i1, len1, len11, needSep, prefix, s, s1, v1, v10, v11, v12, v14, v15, v16, v17, v18, v19, v2, v21, v22, v23, v25, v26, v27, v28, v3, v30, v31, v32, v33, v34, v35, v5, v6, v7, v9
  9085. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  9086. needSep = libc.Uint8FromInt32(0)
  9087. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  9088. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9089. v1 = 0
  9090. } else {
  9091. v3 = parser + 784 + 24
  9092. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9093. *(*uintptr)(unsafe.Pointer(v3))++
  9094. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(m_ASCII_EQUALS)
  9095. v1 = libc.Int32FromInt32(1)
  9096. }
  9097. if !(v1 != 0) {
  9098. return libc.UintptrFromInt32(0)
  9099. }
  9100. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  9101. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  9102. len1--
  9103. }
  9104. i = 0
  9105. for {
  9106. if !(i < len1) {
  9107. break
  9108. }
  9109. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9110. v5 = 0
  9111. } else {
  9112. v7 = parser + 784 + 24
  9113. v6 = *(*uintptr)(unsafe.Pointer(v7))
  9114. *(*uintptr)(unsafe.Pointer(v7))++
  9115. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  9116. v5 = libc.Int32FromInt32(1)
  9117. }
  9118. if !(v5 != 0) {
  9119. /* Because of memory caching, I don't believe this line can be
  9120. * executed.
  9121. *
  9122. * This is part of a loop copying the default prefix binding
  9123. * URI into the parser's temporary string pool. Previously,
  9124. * that URI was copied into the same string pool, with a
  9125. * terminating NUL character, as part of setContext(). When
  9126. * the pool was cleared, that leaves a block definitely big
  9127. * enough to hold the URI on the free block list of the pool.
  9128. * The URI copy in getContext() therefore cannot run out of
  9129. * memory.
  9130. *
  9131. * If the pool is used between the setContext() and
  9132. * getContext() calls, the worst it can do is leave a bigger
  9133. * block on the front of the free list. Given that this is
  9134. * all somewhat inobvious and program logic can be changed, we
  9135. * don't delete the line but we do exclude it from the test
  9136. * coverage statistics.
  9137. */
  9138. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9139. }
  9140. goto _4
  9141. _4:
  9142. ;
  9143. i++
  9144. }
  9145. needSep = libc.Uint8FromInt32(1)
  9146. }
  9147. _hashTableIterInit(tls, bp, dtd+120)
  9148. for {
  9149. prefix = _hashTableIterNext(tls, bp)
  9150. if !(prefix != 0) {
  9151. break
  9152. }
  9153. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  9154. /* This test appears to be (justifiable) paranoia. There does
  9155. * not seem to be a way of injecting a prefix without a binding
  9156. * that doesn't get errored long before this function is called.
  9157. * The test should remain for safety's sake, so we instead
  9158. * exclude the following line from the coverage statistics.
  9159. */
  9160. goto _8 /* LCOV_EXCL_LINE */
  9161. }
  9162. if v12 = needSep != 0; v12 {
  9163. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9164. v9 = 0
  9165. } else {
  9166. v11 = parser + 784 + 24
  9167. v10 = *(*uintptr)(unsafe.Pointer(v11))
  9168. *(*uintptr)(unsafe.Pointer(v11))++
  9169. *(*TXML_Char)(unsafe.Pointer(v10)) = int8(m_ASCII_FF)
  9170. v9 = libc.Int32FromInt32(1)
  9171. }
  9172. }
  9173. if v12 && !(v9 != 0) {
  9174. return libc.UintptrFromInt32(0)
  9175. }
  9176. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  9177. for {
  9178. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9179. break
  9180. }
  9181. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9182. v14 = 0
  9183. } else {
  9184. v16 = parser + 784 + 24
  9185. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9186. *(*uintptr)(unsafe.Pointer(v16))++
  9187. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9188. v14 = libc.Int32FromInt32(1)
  9189. }
  9190. if !(v14 != 0) {
  9191. return libc.UintptrFromInt32(0)
  9192. }
  9193. goto _13
  9194. _13:
  9195. ;
  9196. s++
  9197. }
  9198. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9199. v17 = 0
  9200. } else {
  9201. v19 = parser + 784 + 24
  9202. v18 = *(*uintptr)(unsafe.Pointer(v19))
  9203. *(*uintptr)(unsafe.Pointer(v19))++
  9204. *(*TXML_Char)(unsafe.Pointer(v18)) = int8(m_ASCII_EQUALS)
  9205. v17 = libc.Int32FromInt32(1)
  9206. }
  9207. if !(v17 != 0) {
  9208. return libc.UintptrFromInt32(0)
  9209. }
  9210. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  9211. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  9212. len11--
  9213. }
  9214. i1 = 0
  9215. for {
  9216. if !(i1 < len11) {
  9217. break
  9218. }
  9219. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9220. v21 = 0
  9221. } else {
  9222. v23 = parser + 784 + 24
  9223. v22 = *(*uintptr)(unsafe.Pointer(v23))
  9224. *(*uintptr)(unsafe.Pointer(v23))++
  9225. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  9226. v21 = libc.Int32FromInt32(1)
  9227. }
  9228. if !(v21 != 0) {
  9229. return libc.UintptrFromInt32(0)
  9230. }
  9231. goto _20
  9232. _20:
  9233. ;
  9234. i1++
  9235. }
  9236. needSep = libc.Uint8FromInt32(1)
  9237. goto _8
  9238. _8:
  9239. }
  9240. _hashTableIterInit(tls, bp, dtd)
  9241. for {
  9242. e = _hashTableIterNext(tls, bp)
  9243. if !(e != 0) {
  9244. break
  9245. }
  9246. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9247. goto _24
  9248. }
  9249. if v28 = needSep != 0; v28 {
  9250. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9251. v25 = 0
  9252. } else {
  9253. v27 = parser + 784 + 24
  9254. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9255. *(*uintptr)(unsafe.Pointer(v27))++
  9256. *(*TXML_Char)(unsafe.Pointer(v26)) = int8(m_ASCII_FF)
  9257. v25 = libc.Int32FromInt32(1)
  9258. }
  9259. }
  9260. if v28 && !(v25 != 0) {
  9261. return libc.UintptrFromInt32(0)
  9262. }
  9263. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9264. for {
  9265. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9266. break
  9267. }
  9268. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9269. v30 = 0
  9270. } else {
  9271. v32 = parser + 784 + 24
  9272. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9273. *(*uintptr)(unsafe.Pointer(v32))++
  9274. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9275. v30 = libc.Int32FromInt32(1)
  9276. }
  9277. if !(v30 != 0) {
  9278. return uintptr(0)
  9279. }
  9280. goto _29
  9281. _29:
  9282. ;
  9283. s1++
  9284. }
  9285. needSep = libc.Uint8FromInt32(1)
  9286. goto _24
  9287. _24:
  9288. }
  9289. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9290. v33 = 0
  9291. } else {
  9292. v35 = parser + 784 + 24
  9293. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9294. *(*uintptr)(unsafe.Pointer(v35))++
  9295. *(*TXML_Char)(unsafe.Pointer(v34)) = int8('\000')
  9296. v33 = libc.Int32FromInt32(1)
  9297. }
  9298. if !(v33 != 0) {
  9299. return libc.UintptrFromInt32(0)
  9300. }
  9301. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9302. }
  9303. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9304. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9305. var v1, v11, v14, v4, v8 int32
  9306. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9307. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9308. s = context
  9309. for int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9310. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9311. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9312. v1 = 0
  9313. } else {
  9314. v3 = parser + 784 + 24
  9315. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9316. *(*uintptr)(unsafe.Pointer(v3))++
  9317. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  9318. v1 = libc.Int32FromInt32(1)
  9319. }
  9320. if !(v1 != 0) {
  9321. return libc.Uint8FromInt32(0)
  9322. }
  9323. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  9324. if e != 0 {
  9325. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9326. }
  9327. if int32(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9328. s++
  9329. }
  9330. context = s
  9331. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9332. } else {
  9333. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9334. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  9335. prefix = dtd + 304
  9336. } else {
  9337. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9338. v4 = 0
  9339. } else {
  9340. v6 = parser + 784 + 24
  9341. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9342. *(*uintptr)(unsafe.Pointer(v6))++
  9343. *(*TXML_Char)(unsafe.Pointer(v5)) = int8('\000')
  9344. v4 = libc.Int32FromInt32(1)
  9345. }
  9346. if !(v4 != 0) {
  9347. return libc.Uint8FromInt32(0)
  9348. }
  9349. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  9350. if !(prefix != 0) {
  9351. return libc.Uint8FromInt32(0)
  9352. }
  9353. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  9354. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9355. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9356. return libc.Uint8FromInt32(0)
  9357. }
  9358. }
  9359. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9360. }
  9361. context = s + uintptr(1)
  9362. for {
  9363. if !(int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9364. break
  9365. }
  9366. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9367. v8 = 0
  9368. } else {
  9369. v10 = parser + 784 + 24
  9370. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9371. *(*uintptr)(unsafe.Pointer(v10))++
  9372. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9373. v8 = libc.Int32FromInt32(1)
  9374. }
  9375. if !(v8 != 0) {
  9376. return libc.Uint8FromInt32(0)
  9377. }
  9378. goto _7
  9379. _7:
  9380. ;
  9381. context++
  9382. }
  9383. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9384. v11 = 0
  9385. } else {
  9386. v13 = parser + 784 + 24
  9387. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9388. *(*uintptr)(unsafe.Pointer(v13))++
  9389. *(*TXML_Char)(unsafe.Pointer(v12)) = int8('\000')
  9390. v11 = libc.Int32FromInt32(1)
  9391. }
  9392. if !(v11 != 0) {
  9393. return libc.Uint8FromInt32(0)
  9394. }
  9395. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  9396. return libc.Uint8FromInt32(0)
  9397. }
  9398. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9399. if int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9400. context++
  9401. }
  9402. s = context
  9403. } else {
  9404. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9405. v14 = 0
  9406. } else {
  9407. v16 = parser + 784 + 24
  9408. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9409. *(*uintptr)(unsafe.Pointer(v16))++
  9410. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9411. v14 = libc.Int32FromInt32(1)
  9412. }
  9413. if !(v14 != 0) {
  9414. return libc.Uint8FromInt32(0)
  9415. }
  9416. s++
  9417. }
  9418. }
  9419. }
  9420. return libc.Uint8FromInt32(1)
  9421. }
  9422. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9423. var p, s, v2, v3 uintptr
  9424. _, _, _, _ = p, s, v2, v3
  9425. p = publicId
  9426. s = publicId
  9427. for {
  9428. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9429. break
  9430. }
  9431. switch int32(*(*TXML_Char)(unsafe.Pointer(s))) {
  9432. case int32(0x20):
  9433. fallthrough
  9434. case int32(0xD):
  9435. fallthrough
  9436. case int32(0xA):
  9437. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9438. v2 = p
  9439. p++
  9440. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0x20)
  9441. }
  9442. default:
  9443. v3 = p
  9444. p++
  9445. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9446. }
  9447. goto _1
  9448. _1:
  9449. ;
  9450. s++
  9451. }
  9452. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9453. p--
  9454. }
  9455. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  9456. }
  9457. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9458. var p uintptr
  9459. _ = p
  9460. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  9461. if p == libc.UintptrFromInt32(0) {
  9462. return p
  9463. }
  9464. _poolInit(tls, p+160, ms)
  9465. _poolInit(tls, p+208, ms)
  9466. _hashTableInit(tls, p, ms)
  9467. _hashTableInit(tls, p+40, ms)
  9468. _hashTableInit(tls, p+80, ms)
  9469. _hashTableInit(tls, p+120, ms)
  9470. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9471. _hashTableInit(tls, p+264, ms)
  9472. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9473. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9474. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9475. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9476. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9477. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9478. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9479. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9480. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9481. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9482. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9483. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9484. return p
  9485. }
  9486. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9487. bp := tls.Alloc(16)
  9488. defer tls.Free(16)
  9489. var e uintptr
  9490. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9491. _ = e
  9492. _hashTableIterInit(tls, bp, p+40)
  9493. for {
  9494. e = _hashTableIterNext(tls, bp)
  9495. if !(e != 0) {
  9496. break
  9497. }
  9498. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9499. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9500. }
  9501. goto _1
  9502. _1:
  9503. }
  9504. _hashTableClear(tls, p)
  9505. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9506. _hashTableClear(tls, p+264)
  9507. _hashTableClear(tls, p+40)
  9508. _hashTableClear(tls, p+80)
  9509. _hashTableClear(tls, p+120)
  9510. _poolClear(tls, p+160)
  9511. _poolClear(tls, p+208)
  9512. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9513. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9514. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9515. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9516. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9517. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9518. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9519. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9520. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9521. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9522. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9523. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9524. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9525. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9526. }
  9527. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9528. bp := tls.Alloc(16)
  9529. defer tls.Free(16)
  9530. var e uintptr
  9531. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9532. _ = e
  9533. _hashTableIterInit(tls, bp, p+40)
  9534. for {
  9535. e = _hashTableIterNext(tls, bp)
  9536. if !(e != 0) {
  9537. break
  9538. }
  9539. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9540. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9541. }
  9542. goto _1
  9543. _1:
  9544. }
  9545. _hashTableDestroy(tls, p)
  9546. _hashTableDestroy(tls, p+264)
  9547. _hashTableDestroy(tls, p+40)
  9548. _hashTableDestroy(tls, p+80)
  9549. _hashTableDestroy(tls, p+120)
  9550. _poolDestroy(tls, p+160)
  9551. _poolDestroy(tls, p+208)
  9552. if isDocEntity != 0 {
  9553. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9554. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9555. }
  9556. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9557. }
  9558. // C documentation
  9559. //
  9560. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9561. // The new DTD has already been initialized.
  9562. // */
  9563. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9564. bp := tls.Alloc(16)
  9565. defer tls.Free(16)
  9566. var i, v3, v7 int32
  9567. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9568. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9569. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9570. /* Copy the prefix table. */
  9571. _hashTableIterInit(tls, bp, oldDtd+120)
  9572. for {
  9573. oldP = _hashTableIterNext(tls, bp)
  9574. if !(oldP != 0) {
  9575. break
  9576. }
  9577. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9578. if !(name != 0) {
  9579. return 0
  9580. }
  9581. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  9582. return 0
  9583. }
  9584. goto _1
  9585. _1:
  9586. }
  9587. _hashTableIterInit(tls, bp, oldDtd+80)
  9588. /* Copy the attribute id table. */
  9589. for {
  9590. oldA = _hashTableIterNext(tls, bp)
  9591. if !(oldA != 0) {
  9592. break
  9593. }
  9594. /* Remember to allocate the scratch byte before the name. */
  9595. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  9596. v3 = 0
  9597. } else {
  9598. v5 = newDtd + 160 + 24
  9599. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9600. *(*uintptr)(unsafe.Pointer(v5))++
  9601. *(*TXML_Char)(unsafe.Pointer(v4)) = int8('\000')
  9602. v3 = libc.Int32FromInt32(1)
  9603. }
  9604. if !(v3 != 0) {
  9605. return 0
  9606. }
  9607. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9608. if !(name1 != 0) {
  9609. return 0
  9610. }
  9611. name1++
  9612. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  9613. if !(newA != 0) {
  9614. return 0
  9615. }
  9616. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9617. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9618. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9619. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  9620. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  9621. } else {
  9622. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  9623. }
  9624. }
  9625. goto _2
  9626. _2:
  9627. }
  9628. /* Copy the element type table. */
  9629. _hashTableIterInit(tls, bp, oldDtd+40)
  9630. for {
  9631. oldE = _hashTableIterNext(tls, bp)
  9632. if !(oldE != 0) {
  9633. break
  9634. }
  9635. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9636. if !(name2 != 0) {
  9637. return 0
  9638. }
  9639. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  9640. if !(newE != 0) {
  9641. return 0
  9642. }
  9643. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9644. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts)*uint64(24))
  9645. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9646. return 0
  9647. }
  9648. }
  9649. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9650. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  9651. }
  9652. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9653. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9654. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9655. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9656. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  9657. }
  9658. i = 0
  9659. for {
  9660. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9661. break
  9662. }
  9663. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fid = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fid)).Fname, uint64(0))
  9664. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).FisCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).FisCdata
  9665. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  9666. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = _poolCopyString(tls, newDtd+160, (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue)
  9667. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  9668. return 0
  9669. }
  9670. } else {
  9671. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  9672. }
  9673. goto _8
  9674. _8:
  9675. ;
  9676. i++
  9677. }
  9678. goto _6
  9679. _6:
  9680. }
  9681. /* Copy the entity tables. */
  9682. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  9683. return 0
  9684. }
  9685. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  9686. return 0
  9687. }
  9688. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9689. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9690. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9691. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9692. /* Don't want deep copying for scaffolding */
  9693. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9694. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9695. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9696. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9697. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9698. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9699. return int32(1)
  9700. }
  9701. /* End dtdCopy */
  9702. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9703. bp := tls.Alloc(16)
  9704. defer tls.Free(16)
  9705. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9706. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9707. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9708. cachedOldBase = libc.UintptrFromInt32(0)
  9709. cachedNewBase = libc.UintptrFromInt32(0)
  9710. _hashTableIterInit(tls, bp, oldTable)
  9711. for {
  9712. oldE = _hashTableIterNext(tls, bp)
  9713. if !(oldE != 0) {
  9714. break
  9715. }
  9716. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9717. if !(name != 0) {
  9718. return 0
  9719. }
  9720. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  9721. if !(newE != 0) {
  9722. return 0
  9723. }
  9724. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9725. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9726. if !(tem != 0) {
  9727. return 0
  9728. }
  9729. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9730. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9731. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9732. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9733. } else {
  9734. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9735. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9736. if !(tem != 0) {
  9737. return 0
  9738. }
  9739. v2 = tem
  9740. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9741. cachedNewBase = v2
  9742. }
  9743. }
  9744. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9745. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9746. if !(tem != 0) {
  9747. return 0
  9748. }
  9749. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9750. }
  9751. } else {
  9752. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9753. if !(tem1 != 0) {
  9754. return 0
  9755. }
  9756. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9757. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9758. }
  9759. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9760. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9761. if !(tem2 != 0) {
  9762. return 0
  9763. }
  9764. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9765. }
  9766. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9767. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9768. goto _1
  9769. _1:
  9770. }
  9771. return int32(1)
  9772. }
  9773. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9774. for {
  9775. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9776. break
  9777. }
  9778. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9779. return libc.Uint8FromInt32(1)
  9780. }
  9781. goto _1
  9782. _1:
  9783. ;
  9784. s1++
  9785. s2++
  9786. }
  9787. return libc.Uint8FromInt32(0)
  9788. }
  9789. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9790. var len1 Tsize_t
  9791. _ = len1
  9792. len1 = uint64(0)
  9793. for {
  9794. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9795. break
  9796. }
  9797. goto _1
  9798. _1:
  9799. ;
  9800. s++
  9801. len1++
  9802. }
  9803. return len1
  9804. }
  9805. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9806. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9807. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9808. }
  9809. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9810. bp := tls.Alloc(80)
  9811. defer tls.Free(80)
  9812. var _ /* key at bp+56 */ Tsipkey
  9813. var _ /* state at bp+0 */ Tsiphash
  9814. _ = __ccgo_fp(_sip24_valid)
  9815. _copy_salt_to_sipkey(tls, parser, bp+56)
  9816. _sip24_init(tls, bp, bp+56)
  9817. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9818. return _sip24_final(tls, bp)
  9819. }
  9820. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9821. var h, mask, newHash, newMask uint64
  9822. var i, j, newSize, tsize, tsize1 Tsize_t
  9823. var newPower, step uint8
  9824. var newV uintptr
  9825. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9826. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9827. if !(createSize != 0) {
  9828. return libc.UintptrFromInt32(0)
  9829. }
  9830. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9831. /* table->size is a power of 2 */
  9832. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9833. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9834. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, tsize)
  9835. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9836. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9837. return libc.UintptrFromInt32(0)
  9838. }
  9839. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9840. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9841. } else {
  9842. h = _hash(tls, parser, name)
  9843. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9844. step = uint8(0)
  9845. i = h & mask
  9846. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9847. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9848. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9849. }
  9850. if !(step != 0) {
  9851. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9852. }
  9853. if i < uint64(step) {
  9854. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9855. } else {
  9856. i -= uint64(step)
  9857. }
  9858. }
  9859. if !(createSize != 0) {
  9860. return libc.UintptrFromInt32(0)
  9861. }
  9862. /* check for overflow (table is half full) */
  9863. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9864. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9865. /* Detect and prevent invalid shift */
  9866. if uint64(newPower) >= libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8) {
  9867. return libc.UintptrFromInt32(0)
  9868. }
  9869. newSize = libc.Uint64FromInt32(1) << newPower
  9870. newMask = newSize - uint64(1)
  9871. /* Detect and prevent integer overflow */
  9872. if newSize > libc.Uint64FromInt32(-libc.Int32FromInt32(1))/libc.Uint64FromInt64(8) {
  9873. return libc.UintptrFromInt32(0)
  9874. }
  9875. tsize1 = newSize * uint64(8)
  9876. newV = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, tsize1)
  9877. if !(newV != 0) {
  9878. return libc.UintptrFromInt32(0)
  9879. }
  9880. libc.Xmemset(tls, newV, 0, tsize1)
  9881. i = uint64(0)
  9882. for {
  9883. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9884. break
  9885. }
  9886. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9887. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9888. j = newHash & newMask
  9889. step = uint8(0)
  9890. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9891. if !(step != 0) {
  9892. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9893. }
  9894. if j < uint64(step) {
  9895. j += newSize - uint64(step)
  9896. } else {
  9897. j -= uint64(step)
  9898. }
  9899. }
  9900. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9901. }
  9902. goto _2
  9903. _2:
  9904. ;
  9905. i++
  9906. }
  9907. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv)
  9908. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9909. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9910. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9911. i = h & newMask
  9912. step = uint8(0)
  9913. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9914. if !(step != 0) {
  9915. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9916. }
  9917. if i < uint64(step) {
  9918. i += newSize - uint64(step)
  9919. } else {
  9920. i -= uint64(step)
  9921. }
  9922. }
  9923. }
  9924. }
  9925. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, createSize)
  9926. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9927. return libc.UintptrFromInt32(0)
  9928. }
  9929. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9930. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9931. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9932. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9933. }
  9934. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9935. var i Tsize_t
  9936. _ = i
  9937. i = uint64(0)
  9938. for {
  9939. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9940. break
  9941. }
  9942. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  9943. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9944. goto _1
  9945. _1:
  9946. ;
  9947. i++
  9948. }
  9949. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9950. }
  9951. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9952. var i Tsize_t
  9953. _ = i
  9954. i = uint64(0)
  9955. for {
  9956. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9957. break
  9958. }
  9959. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  9960. goto _1
  9961. _1:
  9962. ;
  9963. i++
  9964. }
  9965. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv)
  9966. }
  9967. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9968. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9969. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9970. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9971. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9972. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9973. }
  9974. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9975. var v1 uintptr
  9976. _ = v1
  9977. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9978. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9979. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9980. } else {
  9981. v1 = libc.UintptrFromInt32(0)
  9982. }
  9983. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9984. }
  9985. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9986. var tem, v1, v2 uintptr
  9987. _, _, _ = tem, v1, v2
  9988. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9989. v2 = iter
  9990. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9991. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9992. tem = *(*uintptr)(unsafe.Pointer(v1))
  9993. if tem != 0 {
  9994. return tem
  9995. }
  9996. }
  9997. return libc.UintptrFromInt32(0)
  9998. }
  9999. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  10000. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  10001. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  10002. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  10003. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  10004. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  10005. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  10006. }
  10007. func _poolClear(tls *libc.TLS, pool uintptr) {
  10008. var p, tem uintptr
  10009. _, _ = p, tem
  10010. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  10011. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10012. } else {
  10013. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10014. for p != 0 {
  10015. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  10016. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10017. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  10018. p = tem
  10019. }
  10020. }
  10021. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  10022. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  10023. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  10024. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  10025. }
  10026. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  10027. var p, tem, tem1 uintptr
  10028. _, _, _ = p, tem, tem1
  10029. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10030. for p != 0 {
  10031. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  10032. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  10033. p = tem
  10034. }
  10035. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10036. for p != 0 {
  10037. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  10038. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  10039. p = tem1
  10040. }
  10041. }
  10042. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  10043. bp := tls.Alloc(16)
  10044. defer tls.Free(16)
  10045. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  10046. var convert_res _XML_Convert_Result
  10047. _ = convert_res
  10048. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  10049. return libc.UintptrFromInt32(0)
  10050. }
  10051. for {
  10052. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, pool+24, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)
  10053. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  10054. break
  10055. }
  10056. if !(_poolGrow(tls, pool) != 0) {
  10057. return libc.UintptrFromInt32(0)
  10058. }
  10059. goto _1
  10060. _1:
  10061. }
  10062. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10063. }
  10064. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  10065. var v1, v4, v5 uintptr
  10066. var v3 int32
  10067. _, _, _, _ = v1, v3, v4, v5
  10068. for {
  10069. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10070. v3 = 0
  10071. } else {
  10072. v5 = pool + 24
  10073. v4 = *(*uintptr)(unsafe.Pointer(v5))
  10074. *(*uintptr)(unsafe.Pointer(v5))++
  10075. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  10076. v3 = libc.Int32FromInt32(1)
  10077. }
  10078. if !(v3 != 0) {
  10079. return libc.UintptrFromInt32(0)
  10080. }
  10081. goto _2
  10082. _2:
  10083. ;
  10084. v1 = s
  10085. s++
  10086. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  10087. break
  10088. }
  10089. }
  10090. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10091. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  10092. return s
  10093. }
  10094. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  10095. var v2 int32
  10096. var v3, v4 uintptr
  10097. _, _, _ = v2, v3, v4
  10098. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  10099. /* The following line is unreachable given the current usage of
  10100. * poolCopyStringN(). Currently it is called from exactly one
  10101. * place to copy the text of a simple general entity. By that
  10102. * point, the name of the entity is already stored in the pool, so
  10103. * pool->ptr cannot be NULL.
  10104. *
  10105. * If poolCopyStringN() is used elsewhere as it well might be,
  10106. * this line may well become executable again. Regardless, this
  10107. * sort of check shouldn't be removed lightly, so we just exclude
  10108. * it from the coverage statistics.
  10109. */
  10110. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  10111. }
  10112. for {
  10113. if !(n > 0) {
  10114. break
  10115. }
  10116. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10117. v2 = 0
  10118. } else {
  10119. v4 = pool + 24
  10120. v3 = *(*uintptr)(unsafe.Pointer(v4))
  10121. *(*uintptr)(unsafe.Pointer(v4))++
  10122. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  10123. v2 = libc.Int32FromInt32(1)
  10124. }
  10125. if !(v2 != 0) {
  10126. return libc.UintptrFromInt32(0)
  10127. }
  10128. goto _1
  10129. _1:
  10130. ;
  10131. n--
  10132. s++
  10133. }
  10134. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10135. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  10136. return s
  10137. }
  10138. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  10139. var v1 int32
  10140. var v2, v3 uintptr
  10141. _, _, _ = v1, v2, v3
  10142. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  10143. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10144. v1 = 0
  10145. } else {
  10146. v3 = pool + 24
  10147. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10148. *(*uintptr)(unsafe.Pointer(v3))++
  10149. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  10150. v1 = libc.Int32FromInt32(1)
  10151. }
  10152. if !(v1 != 0) {
  10153. return libc.UintptrFromInt32(0)
  10154. }
  10155. s++
  10156. }
  10157. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10158. }
  10159. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10160. var v1, v2 uintptr
  10161. _, _ = v1, v2
  10162. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  10163. return libc.UintptrFromInt32(0)
  10164. }
  10165. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10166. return libc.UintptrFromInt32(0)
  10167. }
  10168. v2 = pool + 24
  10169. v1 = *(*uintptr)(unsafe.Pointer(v2))
  10170. *(*uintptr)(unsafe.Pointer(v2))++
  10171. *(*TXML_Char)(unsafe.Pointer(v1)) = 0
  10172. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10173. }
  10174. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  10175. var bytesToAllocate, stretchedBlockSize int32
  10176. var stretch Tsize_t
  10177. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  10178. /* Unprotected math would be:
  10179. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  10180. **
  10181. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  10182. ** For a + b * c we check b * c in isolation first, so that addition of a
  10183. ** on top has no chance of making us accept a small non-negative number
  10184. */
  10185. stretch = uint64(1) /* can be 4 bytes */
  10186. if blockSize <= 0 {
  10187. return uint64(0)
  10188. }
  10189. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m___INT_MAX)/stretch) {
  10190. return uint64(0)
  10191. }
  10192. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  10193. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  10194. if bytesToAllocate < 0 {
  10195. return uint64(0)
  10196. }
  10197. return libc.Uint64FromInt32(bytesToAllocate)
  10198. return r
  10199. }
  10200. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  10201. var blockSize, blockSize1 int32
  10202. var bytesToAllocate, bytesToAllocate1 Tsize_t
  10203. var offsetInsideBlock Tptrdiff_t
  10204. var tem, tem1, temp uintptr
  10205. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  10206. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  10207. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  10208. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10209. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10210. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  10211. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10212. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10213. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10214. return libc.Uint8FromInt32(1)
  10215. }
  10216. if int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) < int64((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fsize) {
  10217. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10218. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10219. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10220. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  10221. libc.Xmemcpy(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1))
  10222. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10223. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10224. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10225. return libc.Uint8FromInt32(1)
  10226. }
  10227. }
  10228. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  10229. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10230. /* NOTE: Needs to be calculated prior to calling `realloc`
  10231. to avoid dangling pointers: */
  10232. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10233. if blockSize < 0 {
  10234. /* This condition traps a situation where either more than
  10235. * INT_MAX/2 bytes have already been allocated. This isn't
  10236. * readily testable, since it is unlikely that an average
  10237. * machine will have that much memory, so we exclude it from the
  10238. * coverage statistics.
  10239. */
  10240. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10241. }
  10242. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10243. if bytesToAllocate == uint64(0) {
  10244. return libc.Uint8FromInt32(0)
  10245. }
  10246. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Frealloc_fcn})))(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks, uint64(uint32(bytesToAllocate)))
  10247. if temp == libc.UintptrFromInt32(0) {
  10248. return libc.Uint8FromInt32(0)
  10249. }
  10250. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10251. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10252. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  10253. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10254. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10255. } else {
  10256. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10257. if blockSize1 < 0 {
  10258. /* This condition traps a situation where either more than
  10259. * INT_MAX bytes have already been allocated (which is prevented
  10260. * by various pieces of program logic, not least this one, never
  10261. * mind the unlikelihood of actually having that much memory) or
  10262. * the pool control fields have been corrupted (which could
  10263. * conceivably happen in an extremely buggy user handler
  10264. * function). Either way it isn't readily testable, so we
  10265. * exclude it from the coverage statistics.
  10266. */
  10267. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10268. }
  10269. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10270. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10271. } else {
  10272. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10273. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10274. return libc.Uint8FromInt32(0)
  10275. }
  10276. blockSize1 *= int32(2)
  10277. }
  10278. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10279. if bytesToAllocate1 == uint64(0) {
  10280. return libc.Uint8FromInt32(0)
  10281. }
  10282. tem1 = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Fmalloc_fcn})))(tls, bytesToAllocate1)
  10283. if !(tem1 != 0) {
  10284. return libc.Uint8FromInt32(0)
  10285. }
  10286. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10287. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10288. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10289. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10290. libc.Xmemcpy(tls, tem1+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1))
  10291. }
  10292. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10293. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  10294. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  10295. }
  10296. return libc.Uint8FromInt32(1)
  10297. }
  10298. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10299. var dtd, me, parent, temp, v2 uintptr
  10300. var next, v3, v4, v5 int32
  10301. var v1 uint32
  10302. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10303. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10304. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10305. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  10306. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10307. return -int32(1)
  10308. }
  10309. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10310. }
  10311. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10312. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10313. /* Detect and prevent integer overflow */
  10314. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(m___UINT_MAX)/libc.Uint32FromUint32(2) {
  10315. return -int32(1)
  10316. }
  10317. /* Detect and prevent integer overflow.
  10318. * The preprocessor guard addresses the "always false" warning
  10319. * from -Wtype-limits on platforms where
  10320. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10321. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).Fscaffold, uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffSize*libc.Uint32FromInt32(2))*libc.Uint64FromInt64(32))
  10322. if temp == libc.UintptrFromInt32(0) {
  10323. return -int32(1)
  10324. }
  10325. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  10326. } else {
  10327. temp = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_SCAFFOLD_ELEMENTS)*libc.Uint64FromInt64(32))
  10328. if temp == libc.UintptrFromInt32(0) {
  10329. return -int32(1)
  10330. }
  10331. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10332. }
  10333. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10334. }
  10335. v2 = dtd + 344
  10336. v1 = *(*uint32)(unsafe.Pointer(v2))
  10337. *(*uint32)(unsafe.Pointer(v2))++
  10338. next = libc.Int32FromUint32(v1)
  10339. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  10340. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10341. parent = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32
  10342. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10343. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  10344. }
  10345. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10346. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10347. }
  10348. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10349. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10350. }
  10351. v5 = libc.Int32FromInt32(0)
  10352. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10353. v4 = v5
  10354. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10355. v3 = v4
  10356. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10357. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10358. return next
  10359. }
  10360. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10361. var allocsize Tsize_t
  10362. var cn, src_node int32
  10363. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10364. var i uint32
  10365. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10366. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10367. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10368. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10369. * strings. */
  10370. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10371. /* Detect and prevent integer overflow.
  10372. * The preprocessor guard addresses the "always false" warning
  10373. * from -Wtype-limits on platforms where
  10374. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10375. if uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*uint64(32) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*uint64(1) {
  10376. return libc.UintptrFromInt32(0)
  10377. }
  10378. allocsize = uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1)
  10379. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10380. if !(ret != 0) {
  10381. return libc.UintptrFromInt32(0)
  10382. }
  10383. /* What follows is an iterative implementation (of what was previously done
  10384. * recursively in a dedicated function called "build_node". The old recursive
  10385. * build_node could be forced into stack exhaustion from input as small as a
  10386. * few megabyte, and so that was a security issue. Hence, a function call
  10387. * stack is avoided now by resolving recursion.)
  10388. *
  10389. * The iterative approach works as follows:
  10390. *
  10391. * - We have two writing pointers, both walking up the result array; one does
  10392. * the work, the other creates "jobs" for its colleague to do, and leads
  10393. * the way:
  10394. *
  10395. * - The faster one, pointer jobDest, always leads and writes "what job
  10396. * to do" by the other, once they reach that place in the
  10397. * array: leader "jobDest" stores the source node array index (relative
  10398. * to array dtd->scaffold) in field "numchildren".
  10399. *
  10400. * - The slower one, pointer dest, looks at the value stored in the
  10401. * "numchildren" field (which actually holds a source node array index
  10402. * at that time) and puts the real data from dtd->scaffold in.
  10403. *
  10404. * - Before the loop starts, jobDest writes source array index 0
  10405. * (where the root node is located) so that dest will have something to do
  10406. * when it starts operation.
  10407. *
  10408. * - Whenever nodes with children are encountered, jobDest appends
  10409. * them as new jobs, in order. As a result, tree node siblings are
  10410. * adjacent in the resulting array, for example:
  10411. *
  10412. * [0] root, has two children
  10413. * [1] first child of 0, has three children
  10414. * [3] first child of 1, does not have children
  10415. * [4] second child of 1, does not have children
  10416. * [5] third child of 1, does not have children
  10417. * [2] second child of 0, does not have children
  10418. *
  10419. * Or (the same data) presented in flat array view:
  10420. *
  10421. * [0] root, has two children
  10422. *
  10423. * [1] first child of 0, has three children
  10424. * [2] second child of 0, does not have children
  10425. *
  10426. * [3] first child of 1, does not have children
  10427. * [4] second child of 1, does not have children
  10428. * [5] third child of 1, does not have children
  10429. *
  10430. * - The algorithm repeats until all target array indices have been processed.
  10431. */
  10432. dest = ret /* tree node writing location, moves upwards */
  10433. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10434. jobDest = ret /* next free writing location in target array */
  10435. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10436. /* Add the starting job, the root node (index 0) of the source tree */
  10437. v1 = jobDest
  10438. jobDest += 32
  10439. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10440. for {
  10441. if !(dest < destLimit) {
  10442. break
  10443. }
  10444. /* Retrieve source tree array index from job storage */
  10445. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10446. /* Convert item */
  10447. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  10448. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  10449. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10450. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10451. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  10452. for {
  10453. v4 = str
  10454. str++
  10455. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10456. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10457. break
  10458. }
  10459. src++
  10460. goto _3
  10461. _3:
  10462. }
  10463. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10464. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10465. } else {
  10466. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10467. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  10468. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10469. /* Append scaffold indices of children to array */
  10470. i = uint32(0)
  10471. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  10472. for {
  10473. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10474. break
  10475. }
  10476. v6 = jobDest
  10477. jobDest += 32
  10478. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10479. goto _5
  10480. _5:
  10481. ;
  10482. i++
  10483. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  10484. }
  10485. }
  10486. goto _2
  10487. _2:
  10488. ;
  10489. dest += 32
  10490. }
  10491. return ret
  10492. }
  10493. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10494. var dtd, name, ret uintptr
  10495. _, _, _ = dtd, name, ret
  10496. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10497. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  10498. if !(name != 0) {
  10499. return libc.UintptrFromInt32(0)
  10500. }
  10501. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  10502. if !(ret != 0) {
  10503. return libc.UintptrFromInt32(0)
  10504. }
  10505. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10506. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10507. } else {
  10508. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10509. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10510. return libc.UintptrFromInt32(0)
  10511. }
  10512. }
  10513. return ret
  10514. }
  10515. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10516. var charsRequired Tsize_t
  10517. var result uintptr
  10518. _, _ = charsRequired, result
  10519. charsRequired = uint64(0)
  10520. /* First determine how long the string is */
  10521. for int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10522. charsRequired++
  10523. }
  10524. /* Include the terminator */
  10525. charsRequired++
  10526. /* Now allocate space for the copy */
  10527. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint64(1))
  10528. if result == libc.UintptrFromInt32(0) {
  10529. return libc.UintptrFromInt32(0)
  10530. }
  10531. /* Copy the original into place */
  10532. libc.Xmemcpy(tls, result, s, charsRequired*uint64(1))
  10533. return result
  10534. }
  10535. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10536. var amplificationFactor, v1 float32
  10537. var countBytesOutput TXmlBigCount
  10538. _, _, _ = amplificationFactor, countBytesOutput, v1
  10539. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10540. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10541. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10542. } else {
  10543. v1 = libc.Float32FromFloat32(1)
  10544. }
  10545. amplificationFactor = v1
  10546. return amplificationFactor
  10547. }
  10548. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10549. bp := tls.Alloc(48)
  10550. defer tls.Free(48)
  10551. var amplificationFactor float32
  10552. var rootParser TXML_Parser
  10553. _, _ = amplificationFactor, rootParser
  10554. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10555. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10556. return
  10557. }
  10558. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10559. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1671, libc.VaList(bp+8, rootParser, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect, float64(amplificationFactor), epilog))
  10560. }
  10561. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10562. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10563. }
  10564. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10565. bp := tls.Alloc(64)
  10566. defer tls.Free(64)
  10567. var contextLength uint32
  10568. var ellipsisLength Tsize_t
  10569. var walker, v1 uintptr
  10570. var _ /* ellipis at bp+0 */ [5]int8
  10571. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10572. if account == int32(_XML_ACCOUNT_DIRECT) {
  10573. v1 = __ccgo_ts + 1759
  10574. } else {
  10575. v1 = __ccgo_ts + 1763
  10576. }
  10577. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1808))
  10578. *(*[5]int8)(unsafe.Pointer(bp)) = [5]int8{'[', '.', '.', ']'}
  10579. ellipsisLength = libc.Uint64FromInt64(5) - libc.Uint64FromInt32(1)
  10580. contextLength = uint32(10)
  10581. /* Note: Performance is of no concern here */
  10582. walker = before
  10583. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int64(after)-int64(before) <= libc.Int64FromUint64(uint64(contextLength)+ellipsisLength+uint64(contextLength)) {
  10584. for {
  10585. if !(walker < after) {
  10586. break
  10587. }
  10588. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10589. goto _2
  10590. _2:
  10591. ;
  10592. walker++
  10593. }
  10594. } else {
  10595. for {
  10596. if !(walker < before+uintptr(contextLength)) {
  10597. break
  10598. }
  10599. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10600. goto _3
  10601. _3:
  10602. ;
  10603. walker++
  10604. }
  10605. libc.Xfprintf(tls, libc.X__stderrp, bp, 0)
  10606. walker = after - uintptr(contextLength)
  10607. for {
  10608. if !(walker < after) {
  10609. break
  10610. }
  10611. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10612. goto _4
  10613. _4:
  10614. ;
  10615. walker++
  10616. }
  10617. }
  10618. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1812, 0)
  10619. }
  10620. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10621. bp := tls.Alloc(16)
  10622. defer tls.Free(16)
  10623. var additionTarget, v1 uintptr
  10624. var amplificationFactor float32
  10625. var bytesMore Tptrdiff_t
  10626. var countBytesOutput TXmlBigCount
  10627. var isDirect int32
  10628. var rootParser TXML_Parser
  10629. var tolerated TXML_Bool
  10630. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10631. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10632. /* Note: We need to check the token type *first* to be sure that
  10633. * we can even access variable <after>, safely.
  10634. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10635. switch tok {
  10636. case m_XML_TOK_INVALID:
  10637. fallthrough
  10638. case -int32(1):
  10639. fallthrough
  10640. case -int32(2):
  10641. fallthrough
  10642. case -int32(4):
  10643. return libc.Uint8FromInt32(1)
  10644. }
  10645. if account == int32(_XML_ACCOUNT_NONE) {
  10646. return libc.Uint8FromInt32(1)
  10647. }
  10648. rootParser = _getRootParserOf(tls, originParser, bp)
  10649. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10650. bytesMore = int64(after) - int64(before)
  10651. if isDirect != 0 {
  10652. v1 = rootParser + 928
  10653. } else {
  10654. v1 = rootParser + 928 + 8
  10655. }
  10656. additionTarget = v1
  10657. /* Detect and avoid integer overflow */
  10658. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt64(bytesMore) {
  10659. return libc.Uint8FromInt32(0)
  10660. }
  10661. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt64(bytesMore)
  10662. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10663. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10664. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10665. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10666. _accountingReportStats(tls, rootParser, __ccgo_ts+1808)
  10667. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10668. }
  10669. return tolerated
  10670. }
  10671. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10672. if !(parser != 0) {
  10673. return uint64(0)
  10674. }
  10675. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10676. }
  10677. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10678. if !(parser != 0) {
  10679. return uint64(0)
  10680. }
  10681. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10682. }
  10683. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10684. bp := tls.Alloc(96)
  10685. defer tls.Free(96)
  10686. var entityName, v1 uintptr
  10687. _, _ = entityName, v1
  10688. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10689. return
  10690. }
  10691. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10692. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10693. v1 = __ccgo_ts + 1815
  10694. } else {
  10695. v1 = __ccgo_ts + 1817
  10696. }
  10697. libc.Xfprintf(tls, libc.X__stderrp, __ccgo_ts+1819, libc.VaList(bp+8, rootParser, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth, (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen, ((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth-uint32(1))*uint32(2), __ccgo_ts+1808, v1, entityName, action, (*TENTITY)(unsafe.Pointer(entity)).FtextLen, sourceLine))
  10698. }
  10699. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10700. var rootParser TXML_Parser
  10701. _ = rootParser
  10702. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10703. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10704. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10705. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10706. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10707. }
  10708. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1904, sourceLine)
  10709. }
  10710. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10711. var rootParser TXML_Parser
  10712. _ = rootParser
  10713. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10714. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1910, sourceLine)
  10715. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10716. }
  10717. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10718. var rootParser TXML_Parser
  10719. var stepsTakenUpwards uint32
  10720. _, _ = rootParser, stepsTakenUpwards
  10721. rootParser = parser
  10722. stepsTakenUpwards = uint32(0)
  10723. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10724. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10725. stepsTakenUpwards++
  10726. }
  10727. if outLevelDiff != libc.UintptrFromInt32(0) {
  10728. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10729. }
  10730. return rootParser
  10731. }
  10732. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10733. switch libc.Int32FromUint8(c) {
  10734. case 0:
  10735. return __ccgo_ts + 1916
  10736. case int32(1):
  10737. return __ccgo_ts + 1919
  10738. case int32(2):
  10739. return __ccgo_ts + 1923
  10740. case int32(3):
  10741. return __ccgo_ts + 1927
  10742. case int32(4):
  10743. return __ccgo_ts + 1931
  10744. case int32(5):
  10745. return __ccgo_ts + 1935
  10746. case int32(6):
  10747. return __ccgo_ts + 1939
  10748. case int32(7):
  10749. return __ccgo_ts + 1943
  10750. case int32(8):
  10751. return __ccgo_ts + 1947
  10752. case int32(9):
  10753. return __ccgo_ts + 1951
  10754. case int32(10):
  10755. return __ccgo_ts + 1954
  10756. case int32(11):
  10757. return __ccgo_ts + 1957
  10758. case int32(12):
  10759. return __ccgo_ts + 1961
  10760. case int32(13):
  10761. return __ccgo_ts + 1965
  10762. case int32(14):
  10763. return __ccgo_ts + 1968
  10764. case int32(15):
  10765. return __ccgo_ts + 1972
  10766. case int32(16):
  10767. return __ccgo_ts + 1976
  10768. case int32(17):
  10769. return __ccgo_ts + 1981
  10770. case int32(18):
  10771. return __ccgo_ts + 1986
  10772. case int32(19):
  10773. return __ccgo_ts + 1991
  10774. case int32(20):
  10775. return __ccgo_ts + 1996
  10776. case int32(21):
  10777. return __ccgo_ts + 2001
  10778. case int32(22):
  10779. return __ccgo_ts + 2006
  10780. case int32(23):
  10781. return __ccgo_ts + 2011
  10782. case int32(24):
  10783. return __ccgo_ts + 2016
  10784. case int32(25):
  10785. return __ccgo_ts + 2021
  10786. case int32(26):
  10787. return __ccgo_ts + 2026
  10788. case int32(27):
  10789. return __ccgo_ts + 2031
  10790. case int32(28):
  10791. return __ccgo_ts + 2036
  10792. case int32(29):
  10793. return __ccgo_ts + 2041
  10794. case int32(30):
  10795. return __ccgo_ts + 2046
  10796. case int32(31):
  10797. return __ccgo_ts + 2051
  10798. case int32(32):
  10799. return __ccgo_ts + 2056
  10800. case int32(33):
  10801. return __ccgo_ts + 2058
  10802. case int32(34):
  10803. return __ccgo_ts + 2060
  10804. case int32(35):
  10805. return __ccgo_ts + 2063
  10806. case int32(36):
  10807. return __ccgo_ts + 2065
  10808. case int32(37):
  10809. return __ccgo_ts + 1815
  10810. case int32(38):
  10811. return __ccgo_ts + 1817
  10812. case int32(39):
  10813. return __ccgo_ts + 2067
  10814. case int32(40):
  10815. return __ccgo_ts + 2069
  10816. case int32(41):
  10817. return __ccgo_ts + 2071
  10818. case int32(42):
  10819. return __ccgo_ts + 2073
  10820. case int32(43):
  10821. return __ccgo_ts + 2075
  10822. case int32(44):
  10823. return __ccgo_ts + 2077
  10824. case int32(45):
  10825. return __ccgo_ts + 2079
  10826. case int32(46):
  10827. return __ccgo_ts + 2081
  10828. case int32(47):
  10829. return __ccgo_ts + 2083
  10830. case int32(48):
  10831. return __ccgo_ts + 2085
  10832. case int32(49):
  10833. return __ccgo_ts + 2087
  10834. case int32(50):
  10835. return __ccgo_ts + 2089
  10836. case int32(51):
  10837. return __ccgo_ts + 2091
  10838. case int32(52):
  10839. return __ccgo_ts + 2093
  10840. case int32(53):
  10841. return __ccgo_ts + 2095
  10842. case int32(54):
  10843. return __ccgo_ts + 2097
  10844. case int32(55):
  10845. return __ccgo_ts + 2099
  10846. case int32(56):
  10847. return __ccgo_ts + 2101
  10848. case int32(57):
  10849. return __ccgo_ts + 2103
  10850. case int32(58):
  10851. return __ccgo_ts + 2105
  10852. case int32(59):
  10853. return __ccgo_ts + 2107
  10854. case int32(60):
  10855. return __ccgo_ts + 2109
  10856. case int32(61):
  10857. return __ccgo_ts + 2111
  10858. case int32(62):
  10859. return __ccgo_ts + 2113
  10860. case int32(63):
  10861. return __ccgo_ts + 2115
  10862. case int32(64):
  10863. return __ccgo_ts + 2117
  10864. case int32(65):
  10865. return __ccgo_ts + 2119
  10866. case int32(66):
  10867. return __ccgo_ts + 2121
  10868. case int32(67):
  10869. return __ccgo_ts + 2123
  10870. case int32(68):
  10871. return __ccgo_ts + 2125
  10872. case int32(69):
  10873. return __ccgo_ts + 2127
  10874. case int32(70):
  10875. return __ccgo_ts + 2129
  10876. case int32(71):
  10877. return __ccgo_ts + 2131
  10878. case int32(72):
  10879. return __ccgo_ts + 2133
  10880. case int32(73):
  10881. return __ccgo_ts + 2135
  10882. case int32(74):
  10883. return __ccgo_ts + 2137
  10884. case int32(75):
  10885. return __ccgo_ts + 2139
  10886. case int32(76):
  10887. return __ccgo_ts + 2141
  10888. case int32(77):
  10889. return __ccgo_ts + 2143
  10890. case int32(78):
  10891. return __ccgo_ts + 2145
  10892. case int32(79):
  10893. return __ccgo_ts + 2147
  10894. case int32(80):
  10895. return __ccgo_ts + 2149
  10896. case int32(81):
  10897. return __ccgo_ts + 2151
  10898. case int32(82):
  10899. return __ccgo_ts + 2153
  10900. case int32(83):
  10901. return __ccgo_ts + 2155
  10902. case int32(84):
  10903. return __ccgo_ts + 2157
  10904. case int32(85):
  10905. return __ccgo_ts + 2159
  10906. case int32(86):
  10907. return __ccgo_ts + 2161
  10908. case int32(87):
  10909. return __ccgo_ts + 2163
  10910. case int32(88):
  10911. return __ccgo_ts + 2165
  10912. case int32(89):
  10913. return __ccgo_ts + 2167
  10914. case int32(90):
  10915. return __ccgo_ts + 2169
  10916. case int32(91):
  10917. return __ccgo_ts + 2171
  10918. case int32(92):
  10919. return __ccgo_ts + 2173
  10920. case int32(93):
  10921. return __ccgo_ts + 2176
  10922. case int32(94):
  10923. return __ccgo_ts + 2178
  10924. case int32(95):
  10925. return __ccgo_ts + 2180
  10926. case int32(96):
  10927. return __ccgo_ts + 2182
  10928. case int32(97):
  10929. return __ccgo_ts + 2184
  10930. case int32(98):
  10931. return __ccgo_ts + 2186
  10932. case int32(99):
  10933. return __ccgo_ts + 2188
  10934. case int32(100):
  10935. return __ccgo_ts + 2190
  10936. case int32(101):
  10937. return __ccgo_ts + 2192
  10938. case int32(102):
  10939. return __ccgo_ts + 2194
  10940. case int32(103):
  10941. return __ccgo_ts + 2196
  10942. case int32(104):
  10943. return __ccgo_ts + 2198
  10944. case int32(105):
  10945. return __ccgo_ts + 2200
  10946. case int32(106):
  10947. return __ccgo_ts + 2202
  10948. case int32(107):
  10949. return __ccgo_ts + 2204
  10950. case int32(108):
  10951. return __ccgo_ts + 2206
  10952. case int32(109):
  10953. return __ccgo_ts + 2208
  10954. case int32(110):
  10955. return __ccgo_ts + 2210
  10956. case int32(111):
  10957. return __ccgo_ts + 2212
  10958. case int32(112):
  10959. return __ccgo_ts + 2214
  10960. case int32(113):
  10961. return __ccgo_ts + 2216
  10962. case int32(114):
  10963. return __ccgo_ts + 2218
  10964. case int32(115):
  10965. return __ccgo_ts + 2220
  10966. case int32(116):
  10967. return __ccgo_ts + 2222
  10968. case int32(117):
  10969. return __ccgo_ts + 2224
  10970. case int32(118):
  10971. return __ccgo_ts + 2226
  10972. case int32(119):
  10973. return __ccgo_ts + 2228
  10974. case int32(120):
  10975. return __ccgo_ts + 2230
  10976. case int32(121):
  10977. return __ccgo_ts + 2232
  10978. case int32(122):
  10979. return __ccgo_ts + 2234
  10980. case int32(123):
  10981. return __ccgo_ts + 2236
  10982. case int32(124):
  10983. return __ccgo_ts + 2238
  10984. case int32(125):
  10985. return __ccgo_ts + 2240
  10986. case int32(126):
  10987. return __ccgo_ts + 2242
  10988. case int32(127):
  10989. return __ccgo_ts + 2244
  10990. case int32(128):
  10991. return __ccgo_ts + 2249
  10992. case int32(129):
  10993. return __ccgo_ts + 2254
  10994. case int32(130):
  10995. return __ccgo_ts + 2259
  10996. case int32(131):
  10997. return __ccgo_ts + 2264
  10998. case int32(132):
  10999. return __ccgo_ts + 2269
  11000. case int32(133):
  11001. return __ccgo_ts + 2274
  11002. case int32(134):
  11003. return __ccgo_ts + 2279
  11004. case int32(135):
  11005. return __ccgo_ts + 2284
  11006. case int32(136):
  11007. return __ccgo_ts + 2289
  11008. case int32(137):
  11009. return __ccgo_ts + 2294
  11010. case int32(138):
  11011. return __ccgo_ts + 2299
  11012. case int32(139):
  11013. return __ccgo_ts + 2304
  11014. case int32(140):
  11015. return __ccgo_ts + 2309
  11016. case int32(141):
  11017. return __ccgo_ts + 2314
  11018. case int32(142):
  11019. return __ccgo_ts + 2319
  11020. case int32(143):
  11021. return __ccgo_ts + 2324
  11022. case int32(144):
  11023. return __ccgo_ts + 2329
  11024. case int32(145):
  11025. return __ccgo_ts + 2334
  11026. case int32(146):
  11027. return __ccgo_ts + 2339
  11028. case int32(147):
  11029. return __ccgo_ts + 2344
  11030. case int32(148):
  11031. return __ccgo_ts + 2349
  11032. case int32(149):
  11033. return __ccgo_ts + 2354
  11034. case int32(150):
  11035. return __ccgo_ts + 2359
  11036. case int32(151):
  11037. return __ccgo_ts + 2364
  11038. case int32(152):
  11039. return __ccgo_ts + 2369
  11040. case int32(153):
  11041. return __ccgo_ts + 2374
  11042. case int32(154):
  11043. return __ccgo_ts + 2379
  11044. case int32(155):
  11045. return __ccgo_ts + 2384
  11046. case int32(156):
  11047. return __ccgo_ts + 2389
  11048. case int32(157):
  11049. return __ccgo_ts + 2394
  11050. case int32(158):
  11051. return __ccgo_ts + 2399
  11052. case int32(159):
  11053. return __ccgo_ts + 2404
  11054. case int32(160):
  11055. return __ccgo_ts + 2409
  11056. case int32(161):
  11057. return __ccgo_ts + 2414
  11058. case int32(162):
  11059. return __ccgo_ts + 2419
  11060. case int32(163):
  11061. return __ccgo_ts + 2424
  11062. case int32(164):
  11063. return __ccgo_ts + 2429
  11064. case int32(165):
  11065. return __ccgo_ts + 2434
  11066. case int32(166):
  11067. return __ccgo_ts + 2439
  11068. case int32(167):
  11069. return __ccgo_ts + 2444
  11070. case int32(168):
  11071. return __ccgo_ts + 2449
  11072. case int32(169):
  11073. return __ccgo_ts + 2454
  11074. case int32(170):
  11075. return __ccgo_ts + 2459
  11076. case int32(171):
  11077. return __ccgo_ts + 2464
  11078. case int32(172):
  11079. return __ccgo_ts + 2469
  11080. case int32(173):
  11081. return __ccgo_ts + 2474
  11082. case int32(174):
  11083. return __ccgo_ts + 2479
  11084. case int32(175):
  11085. return __ccgo_ts + 2484
  11086. case int32(176):
  11087. return __ccgo_ts + 2489
  11088. case int32(177):
  11089. return __ccgo_ts + 2494
  11090. case int32(178):
  11091. return __ccgo_ts + 2499
  11092. case int32(179):
  11093. return __ccgo_ts + 2504
  11094. case int32(180):
  11095. return __ccgo_ts + 2509
  11096. case int32(181):
  11097. return __ccgo_ts + 2514
  11098. case int32(182):
  11099. return __ccgo_ts + 2519
  11100. case int32(183):
  11101. return __ccgo_ts + 2524
  11102. case int32(184):
  11103. return __ccgo_ts + 2529
  11104. case int32(185):
  11105. return __ccgo_ts + 2534
  11106. case int32(186):
  11107. return __ccgo_ts + 2539
  11108. case int32(187):
  11109. return __ccgo_ts + 2544
  11110. case int32(188):
  11111. return __ccgo_ts + 2549
  11112. case int32(189):
  11113. return __ccgo_ts + 2554
  11114. case int32(190):
  11115. return __ccgo_ts + 2559
  11116. case int32(191):
  11117. return __ccgo_ts + 2564
  11118. case int32(192):
  11119. return __ccgo_ts + 2569
  11120. case int32(193):
  11121. return __ccgo_ts + 2574
  11122. case int32(194):
  11123. return __ccgo_ts + 2579
  11124. case int32(195):
  11125. return __ccgo_ts + 2584
  11126. case int32(196):
  11127. return __ccgo_ts + 2589
  11128. case int32(197):
  11129. return __ccgo_ts + 2594
  11130. case int32(198):
  11131. return __ccgo_ts + 2599
  11132. case int32(199):
  11133. return __ccgo_ts + 2604
  11134. case int32(200):
  11135. return __ccgo_ts + 2609
  11136. case int32(201):
  11137. return __ccgo_ts + 2614
  11138. case int32(202):
  11139. return __ccgo_ts + 2619
  11140. case int32(203):
  11141. return __ccgo_ts + 2624
  11142. case int32(204):
  11143. return __ccgo_ts + 2629
  11144. case int32(205):
  11145. return __ccgo_ts + 2634
  11146. case int32(206):
  11147. return __ccgo_ts + 2639
  11148. case int32(207):
  11149. return __ccgo_ts + 2644
  11150. case int32(208):
  11151. return __ccgo_ts + 2649
  11152. case int32(209):
  11153. return __ccgo_ts + 2654
  11154. case int32(210):
  11155. return __ccgo_ts + 2659
  11156. case int32(211):
  11157. return __ccgo_ts + 2664
  11158. case int32(212):
  11159. return __ccgo_ts + 2669
  11160. case int32(213):
  11161. return __ccgo_ts + 2674
  11162. case int32(214):
  11163. return __ccgo_ts + 2679
  11164. case int32(215):
  11165. return __ccgo_ts + 2684
  11166. case int32(216):
  11167. return __ccgo_ts + 2689
  11168. case int32(217):
  11169. return __ccgo_ts + 2694
  11170. case int32(218):
  11171. return __ccgo_ts + 2699
  11172. case int32(219):
  11173. return __ccgo_ts + 2704
  11174. case int32(220):
  11175. return __ccgo_ts + 2709
  11176. case int32(221):
  11177. return __ccgo_ts + 2714
  11178. case int32(222):
  11179. return __ccgo_ts + 2719
  11180. case int32(223):
  11181. return __ccgo_ts + 2724
  11182. case int32(224):
  11183. return __ccgo_ts + 2729
  11184. case int32(225):
  11185. return __ccgo_ts + 2734
  11186. case int32(226):
  11187. return __ccgo_ts + 2739
  11188. case int32(227):
  11189. return __ccgo_ts + 2744
  11190. case int32(228):
  11191. return __ccgo_ts + 2749
  11192. case int32(229):
  11193. return __ccgo_ts + 2754
  11194. case int32(230):
  11195. return __ccgo_ts + 2759
  11196. case int32(231):
  11197. return __ccgo_ts + 2764
  11198. case int32(232):
  11199. return __ccgo_ts + 2769
  11200. case int32(233):
  11201. return __ccgo_ts + 2774
  11202. case int32(234):
  11203. return __ccgo_ts + 2779
  11204. case int32(235):
  11205. return __ccgo_ts + 2784
  11206. case int32(236):
  11207. return __ccgo_ts + 2789
  11208. case int32(237):
  11209. return __ccgo_ts + 2794
  11210. case int32(238):
  11211. return __ccgo_ts + 2799
  11212. case int32(239):
  11213. return __ccgo_ts + 2804
  11214. case int32(240):
  11215. return __ccgo_ts + 2809
  11216. case int32(241):
  11217. return __ccgo_ts + 2814
  11218. case int32(242):
  11219. return __ccgo_ts + 2819
  11220. case int32(243):
  11221. return __ccgo_ts + 2824
  11222. case int32(244):
  11223. return __ccgo_ts + 2829
  11224. case int32(245):
  11225. return __ccgo_ts + 2834
  11226. case int32(246):
  11227. return __ccgo_ts + 2839
  11228. case int32(247):
  11229. return __ccgo_ts + 2844
  11230. case int32(248):
  11231. return __ccgo_ts + 2849
  11232. case int32(249):
  11233. return __ccgo_ts + 2854
  11234. case int32(250):
  11235. return __ccgo_ts + 2859
  11236. case int32(251):
  11237. return __ccgo_ts + 2864
  11238. case int32(252):
  11239. return __ccgo_ts + 2869
  11240. case int32(253):
  11241. return __ccgo_ts + 2874
  11242. case int32(254):
  11243. return __ccgo_ts + 2879
  11244. case int32(255):
  11245. return __ccgo_ts + 2884
  11246. default:
  11247. /* never gets here */
  11248. return __ccgo_ts + 2889
  11249. }
  11250. /* never gets here */
  11251. return r
  11252. }
  11253. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint64) (r uint64) {
  11254. bp := tls.Alloc(16)
  11255. defer tls.Free(16)
  11256. var debugLevel uint64
  11257. var value, valueOrNull uintptr
  11258. var _ /* afterValue at bp+0 */ uintptr
  11259. _, _, _ = debugLevel, value, valueOrNull
  11260. valueOrNull = libc.Xgetenv(tls, variableName)
  11261. if valueOrNull == libc.UintptrFromInt32(0) {
  11262. return defaultDebugLevel
  11263. }
  11264. value = valueOrNull
  11265. *(*int32)(unsafe.Pointer(libc.X__error(tls))) = 0
  11266. *(*uintptr)(unsafe.Pointer(bp)) = value
  11267. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11268. if *(*int32)(unsafe.Pointer(libc.X__error(tls))) != 0 || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11269. *(*int32)(unsafe.Pointer(libc.X__error(tls))) = 0
  11270. return defaultDebugLevel
  11271. }
  11272. return debugLevel
  11273. }
  11274. const m_ASCII_01 = 0x30
  11275. const m_ASCII_11 = 0x31
  11276. const m_ASCII_21 = 0x32
  11277. const m_ASCII_31 = 0x33
  11278. const m_ASCII_81 = 0x38
  11279. const m_ASCII_91 = 0x39
  11280. const m_ASCII_B1 = 66
  11281. const m_ASCII_COLON1 = 0x3A
  11282. const m_ASCII_COMMA1 = 0x2C
  11283. const m_ASCII_EQUALS1 = 0x3D
  11284. const m_ASCII_EXCL1 = 0x21
  11285. const m_ASCII_FF1 = 0x0C
  11286. const m_ASCII_G1 = 71
  11287. const m_ASCII_HASH1 = 0x23
  11288. const m_ASCII_LPAREN1 = 0x28
  11289. const m_ASCII_P1 = 80
  11290. const m_ASCII_PERIOD1 = 0x2E
  11291. const m_ASCII_PIPE1 = 0x7C
  11292. const m_ASCII_Q1 = 81
  11293. const m_ASCII_RPAREN1 = 0x29
  11294. const m_ASCII_SLASH1 = 0x2F
  11295. const m_ASCII_U1 = 85
  11296. const m_ASCII_a1 = 0x61
  11297. const m_ASCII_c1 = 0x63
  11298. const m_ASCII_e1 = 0x65
  11299. const m_ASCII_g1 = 0x67
  11300. const m_ASCII_h1 = 0x68
  11301. const m_ASCII_l1 = 0x6C
  11302. const m_ASCII_m1 = 0x6D
  11303. const m_ASCII_n1 = 0x6E
  11304. const m_ASCII_o1 = 0x6F
  11305. const m_ASCII_p1 = 0x70
  11306. const m_ASCII_r1 = 0x72
  11307. const m_ASCII_s1 = 0x73
  11308. const m_ASCII_t1 = 0x74
  11309. const m_ASCII_w1 = 0x77
  11310. const m_ASCII_x1 = 0x78
  11311. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11312. const m___INT_MAX1 = 0x7fffffff
  11313. const m___UINT_MAX1 = 0xffffffff
  11314. /*
  11315. __ __ _
  11316. ___\ \/ /_ __ __ _| |_
  11317. / _ \\ /| '_ \ / _` | __|
  11318. | __// \| |_) | (_| | |_
  11319. \___/_/\_\ .__/ \__,_|\__|
  11320. |_| XML parser
  11321. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11322. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11323. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11324. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11325. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11326. Licensed under the MIT license:
  11327. Permission is hereby granted, free of charge, to any person obtaining
  11328. a copy of this software and associated documentation files (the
  11329. "Software"), to deal in the Software without restriction, including
  11330. without limitation the rights to use, copy, modify, merge, publish,
  11331. distribute, sublicense, and/or sell copies of the Software, and to permit
  11332. persons to whom the Software is furnished to do so, subject to the
  11333. following conditions:
  11334. The above copyright notice and this permission notice shall be included
  11335. in all copies or substantial portions of the Software.
  11336. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11337. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11338. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11339. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11340. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11341. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11342. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11343. */
  11344. /* Doesn't check:
  11345. that ,| are not mixed in a model group
  11346. content of literals
  11347. */
  11348. var _KW_ANY = [4]int8{
  11349. 0: int8(m_ASCII_A),
  11350. 1: int8(m_ASCII_N),
  11351. 2: int8(m_ASCII_Y),
  11352. }
  11353. var _KW_ATTLIST = [8]int8{
  11354. 0: int8(m_ASCII_A),
  11355. 1: int8(m_ASCII_T),
  11356. 2: int8(m_ASCII_T),
  11357. 3: int8(m_ASCII_L),
  11358. 4: int8(m_ASCII_I),
  11359. 5: int8(m_ASCII_S),
  11360. 6: int8(m_ASCII_T),
  11361. }
  11362. var _KW_CDATA = [6]int8{
  11363. 0: int8(m_ASCII_C),
  11364. 1: int8(m_ASCII_D),
  11365. 2: int8(m_ASCII_A),
  11366. 3: int8(m_ASCII_T),
  11367. 4: int8(m_ASCII_A),
  11368. }
  11369. var _KW_DOCTYPE = [8]int8{
  11370. 0: int8(m_ASCII_D),
  11371. 1: int8(m_ASCII_O),
  11372. 2: int8(m_ASCII_C),
  11373. 3: int8(m_ASCII_T),
  11374. 4: int8(m_ASCII_Y),
  11375. 5: int8(m_ASCII_P1),
  11376. 6: int8(m_ASCII_E),
  11377. }
  11378. var _KW_ELEMENT = [8]int8{
  11379. 0: int8(m_ASCII_E),
  11380. 1: int8(m_ASCII_L),
  11381. 2: int8(m_ASCII_E),
  11382. 3: int8(m_ASCII_M),
  11383. 4: int8(m_ASCII_E),
  11384. 5: int8(m_ASCII_N),
  11385. 6: int8(m_ASCII_T),
  11386. }
  11387. var _KW_EMPTY = [6]int8{
  11388. 0: int8(m_ASCII_E),
  11389. 1: int8(m_ASCII_M),
  11390. 2: int8(m_ASCII_P1),
  11391. 3: int8(m_ASCII_T),
  11392. 4: int8(m_ASCII_Y),
  11393. }
  11394. var _KW_ENTITIES = [9]int8{
  11395. 0: int8(m_ASCII_E),
  11396. 1: int8(m_ASCII_N),
  11397. 2: int8(m_ASCII_T),
  11398. 3: int8(m_ASCII_I),
  11399. 4: int8(m_ASCII_T),
  11400. 5: int8(m_ASCII_I),
  11401. 6: int8(m_ASCII_E),
  11402. 7: int8(m_ASCII_S),
  11403. }
  11404. var _KW_ENTITY = [7]int8{
  11405. 0: int8(m_ASCII_E),
  11406. 1: int8(m_ASCII_N),
  11407. 2: int8(m_ASCII_T),
  11408. 3: int8(m_ASCII_I),
  11409. 4: int8(m_ASCII_T),
  11410. 5: int8(m_ASCII_Y),
  11411. }
  11412. var _KW_FIXED = [6]int8{
  11413. 0: int8(m_ASCII_F),
  11414. 1: int8(m_ASCII_I),
  11415. 2: int8(m_ASCII_X),
  11416. 3: int8(m_ASCII_E),
  11417. 4: int8(m_ASCII_D),
  11418. }
  11419. var _KW_ID = [3]int8{
  11420. 0: int8(m_ASCII_I),
  11421. 1: int8(m_ASCII_D),
  11422. }
  11423. var _KW_IDREF = [6]int8{
  11424. 0: int8(m_ASCII_I),
  11425. 1: int8(m_ASCII_D),
  11426. 2: int8(m_ASCII_R),
  11427. 3: int8(m_ASCII_E),
  11428. 4: int8(m_ASCII_F),
  11429. }
  11430. var _KW_IDREFS = [7]int8{
  11431. 0: int8(m_ASCII_I),
  11432. 1: int8(m_ASCII_D),
  11433. 2: int8(m_ASCII_R),
  11434. 3: int8(m_ASCII_E),
  11435. 4: int8(m_ASCII_F),
  11436. 5: int8(m_ASCII_S),
  11437. }
  11438. var _KW_IGNORE = [7]int8{
  11439. 0: int8(m_ASCII_I),
  11440. 1: int8(m_ASCII_G1),
  11441. 2: int8(m_ASCII_N),
  11442. 3: int8(m_ASCII_O),
  11443. 4: int8(m_ASCII_R),
  11444. 5: int8(m_ASCII_E),
  11445. }
  11446. var _KW_IMPLIED = [8]int8{
  11447. 0: int8(m_ASCII_I),
  11448. 1: int8(m_ASCII_M),
  11449. 2: int8(m_ASCII_P1),
  11450. 3: int8(m_ASCII_L),
  11451. 4: int8(m_ASCII_I),
  11452. 5: int8(m_ASCII_E),
  11453. 6: int8(m_ASCII_D),
  11454. }
  11455. var _KW_INCLUDE = [8]int8{
  11456. 0: int8(m_ASCII_I),
  11457. 1: int8(m_ASCII_N),
  11458. 2: int8(m_ASCII_C),
  11459. 3: int8(m_ASCII_L),
  11460. 4: int8(m_ASCII_U1),
  11461. 5: int8(m_ASCII_D),
  11462. 6: int8(m_ASCII_E),
  11463. }
  11464. var _KW_NDATA = [6]int8{
  11465. 0: int8(m_ASCII_N),
  11466. 1: int8(m_ASCII_D),
  11467. 2: int8(m_ASCII_A),
  11468. 3: int8(m_ASCII_T),
  11469. 4: int8(m_ASCII_A),
  11470. }
  11471. var _KW_NMTOKEN = [8]int8{
  11472. 0: int8(m_ASCII_N),
  11473. 1: int8(m_ASCII_M),
  11474. 2: int8(m_ASCII_T),
  11475. 3: int8(m_ASCII_O),
  11476. 4: int8(m_ASCII_K),
  11477. 5: int8(m_ASCII_E),
  11478. 6: int8(m_ASCII_N),
  11479. }
  11480. var _KW_NMTOKENS = [9]int8{
  11481. 0: int8(m_ASCII_N),
  11482. 1: int8(m_ASCII_M),
  11483. 2: int8(m_ASCII_T),
  11484. 3: int8(m_ASCII_O),
  11485. 4: int8(m_ASCII_K),
  11486. 5: int8(m_ASCII_E),
  11487. 6: int8(m_ASCII_N),
  11488. 7: int8(m_ASCII_S),
  11489. }
  11490. var _KW_NOTATION = [9]int8{
  11491. 0: int8(m_ASCII_N),
  11492. 1: int8(m_ASCII_O),
  11493. 2: int8(m_ASCII_T),
  11494. 3: int8(m_ASCII_A),
  11495. 4: int8(m_ASCII_T),
  11496. 5: int8(m_ASCII_I),
  11497. 6: int8(m_ASCII_O),
  11498. 7: int8(m_ASCII_N),
  11499. }
  11500. var _KW_PCDATA = [7]int8{
  11501. 0: int8(m_ASCII_P1),
  11502. 1: int8(m_ASCII_C),
  11503. 2: int8(m_ASCII_D),
  11504. 3: int8(m_ASCII_A),
  11505. 4: int8(m_ASCII_T),
  11506. 5: int8(m_ASCII_A),
  11507. }
  11508. var _KW_PUBLIC = [7]int8{
  11509. 0: int8(m_ASCII_P1),
  11510. 1: int8(m_ASCII_U1),
  11511. 2: int8(m_ASCII_B1),
  11512. 3: int8(m_ASCII_L),
  11513. 4: int8(m_ASCII_I),
  11514. 5: int8(m_ASCII_C),
  11515. }
  11516. var _KW_REQUIRED = [9]int8{
  11517. 0: int8(m_ASCII_R),
  11518. 1: int8(m_ASCII_E),
  11519. 2: int8(m_ASCII_Q1),
  11520. 3: int8(m_ASCII_U1),
  11521. 4: int8(m_ASCII_I),
  11522. 5: int8(m_ASCII_R),
  11523. 6: int8(m_ASCII_E),
  11524. 7: int8(m_ASCII_D),
  11525. }
  11526. var _KW_SYSTEM = [7]int8{
  11527. 0: int8(m_ASCII_S),
  11528. 1: int8(m_ASCII_Y),
  11529. 2: int8(m_ASCII_S),
  11530. 3: int8(m_ASCII_T),
  11531. 4: int8(m_ASCII_E),
  11532. 5: int8(m_ASCII_M),
  11533. }
  11534. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11535. switch tok {
  11536. case int32(m_XML_TOK_PROLOG_S):
  11537. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11538. return int32(_XML_ROLE_NONE)
  11539. case int32(m_XML_TOK_XML_DECL):
  11540. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11541. return int32(_XML_ROLE_XML_DECL)
  11542. case int32(m_XML_TOK_PI):
  11543. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11544. return int32(_XML_ROLE_PI)
  11545. case int32(m_XML_TOK_COMMENT):
  11546. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11547. return int32(_XML_ROLE_COMMENT)
  11548. case int32(m_XML_TOK_BOM):
  11549. return int32(_XML_ROLE_NONE)
  11550. case int32(m_XML_TOK_DECL_OPEN):
  11551. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_DOCTYPE))) != 0) {
  11552. break
  11553. }
  11554. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11555. return int32(_XML_ROLE_DOCTYPE_NONE)
  11556. case int32(m_XML_TOK_INSTANCE_START):
  11557. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11558. return int32(_XML_ROLE_INSTANCE_START)
  11559. }
  11560. return _common(tls, state, tok)
  11561. }
  11562. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11563. switch tok {
  11564. case int32(m_XML_TOK_PROLOG_S):
  11565. return int32(_XML_ROLE_NONE)
  11566. case int32(m_XML_TOK_PI):
  11567. return int32(_XML_ROLE_PI)
  11568. case int32(m_XML_TOK_COMMENT):
  11569. return int32(_XML_ROLE_COMMENT)
  11570. case int32(m_XML_TOK_BOM):
  11571. /* This case can never arise. To reach this role function, the
  11572. * parse must have passed through prolog0 and therefore have had
  11573. * some form of input, even if only a space. At that point, a
  11574. * byte order mark is no longer a valid character (though
  11575. * technically it should be interpreted as a non-breaking space),
  11576. * so will be rejected by the tokenizing stages.
  11577. */
  11578. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11579. case int32(m_XML_TOK_DECL_OPEN):
  11580. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_DOCTYPE))) != 0) {
  11581. break
  11582. }
  11583. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11584. return int32(_XML_ROLE_DOCTYPE_NONE)
  11585. case int32(m_XML_TOK_INSTANCE_START):
  11586. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11587. return int32(_XML_ROLE_INSTANCE_START)
  11588. }
  11589. return _common(tls, state, tok)
  11590. }
  11591. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11592. _ = ptr
  11593. _ = end
  11594. _ = enc
  11595. switch tok {
  11596. case int32(m_XML_TOK_PROLOG_S):
  11597. return int32(_XML_ROLE_NONE)
  11598. case int32(m_XML_TOK_PI):
  11599. return int32(_XML_ROLE_PI)
  11600. case int32(m_XML_TOK_COMMENT):
  11601. return int32(_XML_ROLE_COMMENT)
  11602. case int32(m_XML_TOK_INSTANCE_START):
  11603. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11604. return int32(_XML_ROLE_INSTANCE_START)
  11605. }
  11606. return _common(tls, state, tok)
  11607. }
  11608. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11609. _ = ptr
  11610. _ = end
  11611. _ = enc
  11612. switch tok {
  11613. case int32(m_XML_TOK_PROLOG_S):
  11614. return int32(_XML_ROLE_DOCTYPE_NONE)
  11615. case int32(m_XML_TOK_NAME):
  11616. fallthrough
  11617. case int32(m_XML_TOK_PREFIXED_NAME):
  11618. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11619. return int32(_XML_ROLE_DOCTYPE_NAME)
  11620. }
  11621. return _common(tls, state, tok)
  11622. }
  11623. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11624. switch tok {
  11625. case int32(m_XML_TOK_PROLOG_S):
  11626. return int32(_XML_ROLE_DOCTYPE_NONE)
  11627. case int32(m_XML_TOK_OPEN_BRACKET):
  11628. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11629. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11630. case int32(m_XML_TOK_DECL_CLOSE):
  11631. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11632. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11633. case int32(m_XML_TOK_NAME):
  11634. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  11635. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11636. return int32(_XML_ROLE_DOCTYPE_NONE)
  11637. }
  11638. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  11639. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11640. return int32(_XML_ROLE_DOCTYPE_NONE)
  11641. }
  11642. break
  11643. }
  11644. return _common(tls, state, tok)
  11645. }
  11646. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11647. _ = ptr
  11648. _ = end
  11649. _ = enc
  11650. switch tok {
  11651. case int32(m_XML_TOK_PROLOG_S):
  11652. return int32(_XML_ROLE_DOCTYPE_NONE)
  11653. case int32(m_XML_TOK_LITERAL):
  11654. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11655. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11656. }
  11657. return _common(tls, state, tok)
  11658. }
  11659. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11660. _ = ptr
  11661. _ = end
  11662. _ = enc
  11663. switch tok {
  11664. case int32(m_XML_TOK_PROLOG_S):
  11665. return int32(_XML_ROLE_DOCTYPE_NONE)
  11666. case int32(m_XML_TOK_LITERAL):
  11667. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11668. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11669. }
  11670. return _common(tls, state, tok)
  11671. }
  11672. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11673. _ = ptr
  11674. _ = end
  11675. _ = enc
  11676. switch tok {
  11677. case int32(m_XML_TOK_PROLOG_S):
  11678. return int32(_XML_ROLE_DOCTYPE_NONE)
  11679. case int32(m_XML_TOK_OPEN_BRACKET):
  11680. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11681. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11682. case int32(m_XML_TOK_DECL_CLOSE):
  11683. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11684. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11685. }
  11686. return _common(tls, state, tok)
  11687. }
  11688. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11689. _ = ptr
  11690. _ = end
  11691. _ = enc
  11692. switch tok {
  11693. case int32(m_XML_TOK_PROLOG_S):
  11694. return int32(_XML_ROLE_DOCTYPE_NONE)
  11695. case int32(m_XML_TOK_DECL_CLOSE):
  11696. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11697. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11698. }
  11699. return _common(tls, state, tok)
  11700. }
  11701. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11702. switch tok {
  11703. case int32(m_XML_TOK_PROLOG_S):
  11704. return int32(_XML_ROLE_NONE)
  11705. case int32(m_XML_TOK_DECL_OPEN):
  11706. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_ENTITY))) != 0 {
  11707. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11708. return int32(_XML_ROLE_ENTITY_NONE)
  11709. }
  11710. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_ATTLIST))) != 0 {
  11711. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11712. return int32(_XML_ROLE_ATTLIST_NONE)
  11713. }
  11714. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_ELEMENT))) != 0 {
  11715. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11716. return int32(_XML_ROLE_ELEMENT_NONE)
  11717. }
  11718. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr(int32(2)*(*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_NOTATION))) != 0 {
  11719. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11720. return int32(_XML_ROLE_NOTATION_NONE)
  11721. }
  11722. case int32(m_XML_TOK_PI):
  11723. return int32(_XML_ROLE_PI)
  11724. case int32(m_XML_TOK_COMMENT):
  11725. return int32(_XML_ROLE_COMMENT)
  11726. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11727. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11728. case int32(m_XML_TOK_CLOSE_BRACKET):
  11729. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11730. return int32(_XML_ROLE_DOCTYPE_NONE)
  11731. case -int32(4):
  11732. return int32(_XML_ROLE_NONE)
  11733. }
  11734. return _common(tls, state, tok)
  11735. }
  11736. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11737. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11738. if tok == int32(m_XML_TOK_XML_DECL) {
  11739. return int32(_XML_ROLE_TEXT_DECL)
  11740. }
  11741. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11742. }
  11743. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11744. switch tok {
  11745. case int32(m_XML_TOK_COND_SECT_OPEN):
  11746. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11747. return int32(_XML_ROLE_NONE)
  11748. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11749. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11750. break
  11751. }
  11752. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  11753. return int32(_XML_ROLE_NONE)
  11754. case int32(m_XML_TOK_PROLOG_S):
  11755. return int32(_XML_ROLE_NONE)
  11756. case int32(m_XML_TOK_CLOSE_BRACKET):
  11757. case -int32(4):
  11758. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11759. break
  11760. }
  11761. return int32(_XML_ROLE_NONE)
  11762. default:
  11763. return _internalSubset(tls, state, tok, ptr, end, enc)
  11764. }
  11765. return _common(tls, state, tok)
  11766. }
  11767. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11768. _ = ptr
  11769. _ = end
  11770. _ = enc
  11771. switch tok {
  11772. case int32(m_XML_TOK_PROLOG_S):
  11773. return int32(_XML_ROLE_ENTITY_NONE)
  11774. case int32(m_XML_TOK_PERCENT):
  11775. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11776. return int32(_XML_ROLE_ENTITY_NONE)
  11777. case int32(m_XML_TOK_NAME):
  11778. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11779. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11780. }
  11781. return _common(tls, state, tok)
  11782. }
  11783. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11784. _ = ptr
  11785. _ = end
  11786. _ = enc
  11787. switch tok {
  11788. case int32(m_XML_TOK_PROLOG_S):
  11789. return int32(_XML_ROLE_ENTITY_NONE)
  11790. case int32(m_XML_TOK_NAME):
  11791. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11792. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11793. }
  11794. return _common(tls, state, tok)
  11795. }
  11796. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11797. switch tok {
  11798. case int32(m_XML_TOK_PROLOG_S):
  11799. return int32(_XML_ROLE_ENTITY_NONE)
  11800. case int32(m_XML_TOK_NAME):
  11801. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  11802. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11803. return int32(_XML_ROLE_ENTITY_NONE)
  11804. }
  11805. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  11806. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11807. return int32(_XML_ROLE_ENTITY_NONE)
  11808. }
  11809. case int32(m_XML_TOK_LITERAL):
  11810. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11811. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11812. return int32(_XML_ROLE_ENTITY_VALUE)
  11813. }
  11814. return _common(tls, state, tok)
  11815. }
  11816. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11817. _ = ptr
  11818. _ = end
  11819. _ = enc
  11820. switch tok {
  11821. case int32(m_XML_TOK_PROLOG_S):
  11822. return int32(_XML_ROLE_ENTITY_NONE)
  11823. case int32(m_XML_TOK_LITERAL):
  11824. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11825. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11826. }
  11827. return _common(tls, state, tok)
  11828. }
  11829. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11830. _ = ptr
  11831. _ = end
  11832. _ = enc
  11833. switch tok {
  11834. case int32(m_XML_TOK_PROLOG_S):
  11835. return int32(_XML_ROLE_ENTITY_NONE)
  11836. case int32(m_XML_TOK_LITERAL):
  11837. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11838. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11839. }
  11840. return _common(tls, state, tok)
  11841. }
  11842. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11843. var v1 uintptr
  11844. _ = v1
  11845. switch tok {
  11846. case int32(m_XML_TOK_PROLOG_S):
  11847. return int32(_XML_ROLE_ENTITY_NONE)
  11848. case int32(m_XML_TOK_DECL_CLOSE):
  11849. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11850. v1 = __ccgo_fp(_internalSubset)
  11851. } else {
  11852. v1 = __ccgo_fp(_externalSubset1)
  11853. }
  11854. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11855. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11856. case int32(m_XML_TOK_NAME):
  11857. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_NDATA))) != 0 {
  11858. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11859. return int32(_XML_ROLE_ENTITY_NONE)
  11860. }
  11861. break
  11862. }
  11863. return _common(tls, state, tok)
  11864. }
  11865. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11866. _ = ptr
  11867. _ = end
  11868. _ = enc
  11869. switch tok {
  11870. case int32(m_XML_TOK_PROLOG_S):
  11871. return int32(_XML_ROLE_ENTITY_NONE)
  11872. case int32(m_XML_TOK_NAME):
  11873. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11874. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11875. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11876. }
  11877. return _common(tls, state, tok)
  11878. }
  11879. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11880. switch tok {
  11881. case int32(m_XML_TOK_PROLOG_S):
  11882. return int32(_XML_ROLE_ENTITY_NONE)
  11883. case int32(m_XML_TOK_NAME):
  11884. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  11885. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11886. return int32(_XML_ROLE_ENTITY_NONE)
  11887. }
  11888. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  11889. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11890. return int32(_XML_ROLE_ENTITY_NONE)
  11891. }
  11892. case int32(m_XML_TOK_LITERAL):
  11893. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11894. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11895. return int32(_XML_ROLE_ENTITY_VALUE)
  11896. }
  11897. return _common(tls, state, tok)
  11898. }
  11899. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11900. _ = ptr
  11901. _ = end
  11902. _ = enc
  11903. switch tok {
  11904. case int32(m_XML_TOK_PROLOG_S):
  11905. return int32(_XML_ROLE_ENTITY_NONE)
  11906. case int32(m_XML_TOK_LITERAL):
  11907. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11908. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11909. }
  11910. return _common(tls, state, tok)
  11911. }
  11912. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11913. _ = ptr
  11914. _ = end
  11915. _ = enc
  11916. switch tok {
  11917. case int32(m_XML_TOK_PROLOG_S):
  11918. return int32(_XML_ROLE_ENTITY_NONE)
  11919. case int32(m_XML_TOK_LITERAL):
  11920. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11921. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11922. }
  11923. return _common(tls, state, tok)
  11924. }
  11925. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11926. var v1 uintptr
  11927. _ = v1
  11928. _ = ptr
  11929. _ = end
  11930. _ = enc
  11931. switch tok {
  11932. case int32(m_XML_TOK_PROLOG_S):
  11933. return int32(_XML_ROLE_ENTITY_NONE)
  11934. case int32(m_XML_TOK_DECL_CLOSE):
  11935. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11936. v1 = __ccgo_fp(_internalSubset)
  11937. } else {
  11938. v1 = __ccgo_fp(_externalSubset1)
  11939. }
  11940. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11941. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11942. }
  11943. return _common(tls, state, tok)
  11944. }
  11945. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11946. _ = ptr
  11947. _ = end
  11948. _ = enc
  11949. switch tok {
  11950. case int32(m_XML_TOK_PROLOG_S):
  11951. return int32(_XML_ROLE_NOTATION_NONE)
  11952. case int32(m_XML_TOK_NAME):
  11953. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11954. return int32(_XML_ROLE_NOTATION_NAME)
  11955. }
  11956. return _common(tls, state, tok)
  11957. }
  11958. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11959. switch tok {
  11960. case int32(m_XML_TOK_PROLOG_S):
  11961. return int32(_XML_ROLE_NOTATION_NONE)
  11962. case int32(m_XML_TOK_NAME):
  11963. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_SYSTEM))) != 0 {
  11964. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11965. return int32(_XML_ROLE_NOTATION_NONE)
  11966. }
  11967. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_PUBLIC))) != 0 {
  11968. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11969. return int32(_XML_ROLE_NOTATION_NONE)
  11970. }
  11971. break
  11972. }
  11973. return _common(tls, state, tok)
  11974. }
  11975. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11976. _ = ptr
  11977. _ = end
  11978. _ = enc
  11979. switch tok {
  11980. case int32(m_XML_TOK_PROLOG_S):
  11981. return int32(_XML_ROLE_NOTATION_NONE)
  11982. case int32(m_XML_TOK_LITERAL):
  11983. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11984. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11985. }
  11986. return _common(tls, state, tok)
  11987. }
  11988. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11989. _ = ptr
  11990. _ = end
  11991. _ = enc
  11992. switch tok {
  11993. case int32(m_XML_TOK_PROLOG_S):
  11994. return int32(_XML_ROLE_NOTATION_NONE)
  11995. case int32(m_XML_TOK_LITERAL):
  11996. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11997. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11998. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11999. }
  12000. return _common(tls, state, tok)
  12001. }
  12002. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12003. var v1 uintptr
  12004. _ = v1
  12005. _ = ptr
  12006. _ = end
  12007. _ = enc
  12008. switch tok {
  12009. case int32(m_XML_TOK_PROLOG_S):
  12010. return int32(_XML_ROLE_NOTATION_NONE)
  12011. case int32(m_XML_TOK_LITERAL):
  12012. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12013. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  12014. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  12015. case int32(m_XML_TOK_DECL_CLOSE):
  12016. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12017. v1 = __ccgo_fp(_internalSubset)
  12018. } else {
  12019. v1 = __ccgo_fp(_externalSubset1)
  12020. }
  12021. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12022. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  12023. }
  12024. return _common(tls, state, tok)
  12025. }
  12026. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12027. _ = ptr
  12028. _ = end
  12029. _ = enc
  12030. switch tok {
  12031. case int32(m_XML_TOK_PROLOG_S):
  12032. return int32(_XML_ROLE_ATTLIST_NONE)
  12033. case int32(m_XML_TOK_NAME):
  12034. fallthrough
  12035. case int32(m_XML_TOK_PREFIXED_NAME):
  12036. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12037. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  12038. }
  12039. return _common(tls, state, tok)
  12040. }
  12041. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12042. var v1 uintptr
  12043. _ = v1
  12044. _ = ptr
  12045. _ = end
  12046. _ = enc
  12047. switch tok {
  12048. case int32(m_XML_TOK_PROLOG_S):
  12049. return int32(_XML_ROLE_ATTLIST_NONE)
  12050. case int32(m_XML_TOK_DECL_CLOSE):
  12051. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12052. v1 = __ccgo_fp(_internalSubset)
  12053. } else {
  12054. v1 = __ccgo_fp(_externalSubset1)
  12055. }
  12056. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12057. return int32(_XML_ROLE_ATTLIST_NONE)
  12058. case int32(m_XML_TOK_NAME):
  12059. fallthrough
  12060. case int32(m_XML_TOK_PREFIXED_NAME):
  12061. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  12062. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  12063. }
  12064. return _common(tls, state, tok)
  12065. }
  12066. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12067. var i int32
  12068. _ = i
  12069. switch tok {
  12070. case int32(m_XML_TOK_PROLOG_S):
  12071. return int32(_XML_ROLE_ATTLIST_NONE)
  12072. case int32(m_XML_TOK_NAME):
  12073. i = 0
  12074. for {
  12075. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  12076. break
  12077. }
  12078. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, _types[i]) != 0 {
  12079. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12080. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  12081. }
  12082. goto _1
  12083. _1:
  12084. ;
  12085. i++
  12086. }
  12087. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_NOTATION))) != 0 {
  12088. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  12089. return int32(_XML_ROLE_ATTLIST_NONE)
  12090. }
  12091. case int32(m_XML_TOK_OPEN_PAREN):
  12092. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  12093. return int32(_XML_ROLE_ATTLIST_NONE)
  12094. }
  12095. return _common(tls, state, tok)
  12096. }
  12097. var _types = [8]uintptr{
  12098. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  12099. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  12100. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  12101. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  12102. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  12103. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  12104. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  12105. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  12106. }
  12107. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12108. _ = ptr
  12109. _ = end
  12110. _ = enc
  12111. switch tok {
  12112. case int32(m_XML_TOK_PROLOG_S):
  12113. return int32(_XML_ROLE_ATTLIST_NONE)
  12114. case int32(m_XML_TOK_NMTOKEN):
  12115. fallthrough
  12116. case int32(m_XML_TOK_NAME):
  12117. fallthrough
  12118. case int32(m_XML_TOK_PREFIXED_NAME):
  12119. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  12120. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  12121. }
  12122. return _common(tls, state, tok)
  12123. }
  12124. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12125. _ = ptr
  12126. _ = end
  12127. _ = enc
  12128. switch tok {
  12129. case int32(m_XML_TOK_PROLOG_S):
  12130. return int32(_XML_ROLE_ATTLIST_NONE)
  12131. case int32(m_XML_TOK_CLOSE_PAREN):
  12132. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12133. return int32(_XML_ROLE_ATTLIST_NONE)
  12134. case int32(m_XML_TOK_OR):
  12135. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  12136. return int32(_XML_ROLE_ATTLIST_NONE)
  12137. }
  12138. return _common(tls, state, tok)
  12139. }
  12140. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12141. _ = ptr
  12142. _ = end
  12143. _ = enc
  12144. switch tok {
  12145. case int32(m_XML_TOK_PROLOG_S):
  12146. return int32(_XML_ROLE_ATTLIST_NONE)
  12147. case int32(m_XML_TOK_OPEN_PAREN):
  12148. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  12149. return int32(_XML_ROLE_ATTLIST_NONE)
  12150. }
  12151. return _common(tls, state, tok)
  12152. }
  12153. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12154. _ = ptr
  12155. _ = end
  12156. _ = enc
  12157. switch tok {
  12158. case int32(m_XML_TOK_PROLOG_S):
  12159. return int32(_XML_ROLE_ATTLIST_NONE)
  12160. case int32(m_XML_TOK_NAME):
  12161. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  12162. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  12163. }
  12164. return _common(tls, state, tok)
  12165. }
  12166. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12167. _ = ptr
  12168. _ = end
  12169. _ = enc
  12170. switch tok {
  12171. case int32(m_XML_TOK_PROLOG_S):
  12172. return int32(_XML_ROLE_ATTLIST_NONE)
  12173. case int32(m_XML_TOK_CLOSE_PAREN):
  12174. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12175. return int32(_XML_ROLE_ATTLIST_NONE)
  12176. case int32(m_XML_TOK_OR):
  12177. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  12178. return int32(_XML_ROLE_ATTLIST_NONE)
  12179. }
  12180. return _common(tls, state, tok)
  12181. }
  12182. // C documentation
  12183. //
  12184. // /* default value */
  12185. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12186. switch tok {
  12187. case int32(m_XML_TOK_PROLOG_S):
  12188. return int32(_XML_ROLE_ATTLIST_NONE)
  12189. case int32(m_XML_TOK_POUND_NAME):
  12190. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_IMPLIED))) != 0 {
  12191. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12192. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  12193. }
  12194. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_REQUIRED))) != 0 {
  12195. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12196. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  12197. }
  12198. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_FIXED))) != 0 {
  12199. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  12200. return int32(_XML_ROLE_ATTLIST_NONE)
  12201. }
  12202. case int32(m_XML_TOK_LITERAL):
  12203. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12204. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  12205. }
  12206. return _common(tls, state, tok)
  12207. }
  12208. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12209. _ = ptr
  12210. _ = end
  12211. _ = enc
  12212. switch tok {
  12213. case int32(m_XML_TOK_PROLOG_S):
  12214. return int32(_XML_ROLE_ATTLIST_NONE)
  12215. case int32(m_XML_TOK_LITERAL):
  12216. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12217. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  12218. }
  12219. return _common(tls, state, tok)
  12220. }
  12221. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12222. _ = ptr
  12223. _ = end
  12224. _ = enc
  12225. switch tok {
  12226. case int32(m_XML_TOK_PROLOG_S):
  12227. return int32(_XML_ROLE_ELEMENT_NONE)
  12228. case int32(m_XML_TOK_NAME):
  12229. fallthrough
  12230. case int32(m_XML_TOK_PREFIXED_NAME):
  12231. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12232. return int32(_XML_ROLE_ELEMENT_NAME)
  12233. }
  12234. return _common(tls, state, tok)
  12235. }
  12236. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12237. switch tok {
  12238. case int32(m_XML_TOK_PROLOG_S):
  12239. return int32(_XML_ROLE_ELEMENT_NONE)
  12240. case int32(m_XML_TOK_NAME):
  12241. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_EMPTY))) != 0 {
  12242. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12243. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12244. return int32(_XML_ROLE_CONTENT_EMPTY)
  12245. }
  12246. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_ANY))) != 0 {
  12247. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12248. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12249. return int32(_XML_ROLE_CONTENT_ANY)
  12250. }
  12251. case int32(m_XML_TOK_OPEN_PAREN):
  12252. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12253. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12254. return int32(_XML_ROLE_GROUP_OPEN)
  12255. }
  12256. return _common(tls, state, tok)
  12257. }
  12258. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12259. switch tok {
  12260. case int32(m_XML_TOK_PROLOG_S):
  12261. return int32(_XML_ROLE_ELEMENT_NONE)
  12262. case int32(m_XML_TOK_POUND_NAME):
  12263. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), end, uintptr(unsafe.Pointer(&_KW_PCDATA))) != 0 {
  12264. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12265. return int32(_XML_ROLE_CONTENT_PCDATA)
  12266. }
  12267. case int32(m_XML_TOK_OPEN_PAREN):
  12268. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12269. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12270. return int32(_XML_ROLE_GROUP_OPEN)
  12271. case int32(m_XML_TOK_NAME):
  12272. fallthrough
  12273. case int32(m_XML_TOK_PREFIXED_NAME):
  12274. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12275. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12276. case int32(m_XML_TOK_NAME_QUESTION):
  12277. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12278. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12279. case int32(m_XML_TOK_NAME_ASTERISK):
  12280. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12281. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12282. case int32(m_XML_TOK_NAME_PLUS):
  12283. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12284. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12285. }
  12286. return _common(tls, state, tok)
  12287. }
  12288. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12289. _ = ptr
  12290. _ = end
  12291. _ = enc
  12292. switch tok {
  12293. case int32(m_XML_TOK_PROLOG_S):
  12294. return int32(_XML_ROLE_ELEMENT_NONE)
  12295. case int32(m_XML_TOK_CLOSE_PAREN):
  12296. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12297. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12298. return int32(_XML_ROLE_GROUP_CLOSE)
  12299. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12300. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12301. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12302. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12303. case int32(m_XML_TOK_OR):
  12304. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12305. return int32(_XML_ROLE_ELEMENT_NONE)
  12306. }
  12307. return _common(tls, state, tok)
  12308. }
  12309. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12310. _ = ptr
  12311. _ = end
  12312. _ = enc
  12313. switch tok {
  12314. case int32(m_XML_TOK_PROLOG_S):
  12315. return int32(_XML_ROLE_ELEMENT_NONE)
  12316. case int32(m_XML_TOK_NAME):
  12317. fallthrough
  12318. case int32(m_XML_TOK_PREFIXED_NAME):
  12319. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12320. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12321. }
  12322. return _common(tls, state, tok)
  12323. }
  12324. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12325. _ = ptr
  12326. _ = end
  12327. _ = enc
  12328. switch tok {
  12329. case int32(m_XML_TOK_PROLOG_S):
  12330. return int32(_XML_ROLE_ELEMENT_NONE)
  12331. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12332. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12333. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12334. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12335. case int32(m_XML_TOK_OR):
  12336. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12337. return int32(_XML_ROLE_ELEMENT_NONE)
  12338. }
  12339. return _common(tls, state, tok)
  12340. }
  12341. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12342. _ = ptr
  12343. _ = end
  12344. _ = enc
  12345. switch tok {
  12346. case int32(m_XML_TOK_PROLOG_S):
  12347. return int32(_XML_ROLE_ELEMENT_NONE)
  12348. case int32(m_XML_TOK_OPEN_PAREN):
  12349. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  12350. return int32(_XML_ROLE_GROUP_OPEN)
  12351. case int32(m_XML_TOK_NAME):
  12352. fallthrough
  12353. case int32(m_XML_TOK_PREFIXED_NAME):
  12354. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12355. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12356. case int32(m_XML_TOK_NAME_QUESTION):
  12357. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12358. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12359. case int32(m_XML_TOK_NAME_ASTERISK):
  12360. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12361. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12362. case int32(m_XML_TOK_NAME_PLUS):
  12363. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12364. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12365. }
  12366. return _common(tls, state, tok)
  12367. }
  12368. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12369. _ = ptr
  12370. _ = end
  12371. _ = enc
  12372. switch tok {
  12373. case int32(m_XML_TOK_PROLOG_S):
  12374. return int32(_XML_ROLE_ELEMENT_NONE)
  12375. case int32(m_XML_TOK_CLOSE_PAREN):
  12376. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12377. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12378. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12379. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12380. }
  12381. return int32(_XML_ROLE_GROUP_CLOSE)
  12382. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12383. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12384. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12385. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12386. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12387. }
  12388. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12389. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12390. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12391. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12392. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12393. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12394. }
  12395. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12396. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12397. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12398. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12399. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12400. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12401. }
  12402. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12403. case int32(m_XML_TOK_COMMA):
  12404. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12405. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12406. case int32(m_XML_TOK_OR):
  12407. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12408. return int32(_XML_ROLE_GROUP_CHOICE)
  12409. }
  12410. return _common(tls, state, tok)
  12411. }
  12412. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12413. switch tok {
  12414. case int32(m_XML_TOK_PROLOG_S):
  12415. return int32(_XML_ROLE_NONE)
  12416. case int32(m_XML_TOK_NAME):
  12417. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_INCLUDE))) != 0 {
  12418. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12419. return int32(_XML_ROLE_NONE)
  12420. }
  12421. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, ptr, end, uintptr(unsafe.Pointer(&_KW_IGNORE))) != 0 {
  12422. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12423. return int32(_XML_ROLE_NONE)
  12424. }
  12425. break
  12426. }
  12427. return _common(tls, state, tok)
  12428. }
  12429. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12430. _ = ptr
  12431. _ = end
  12432. _ = enc
  12433. switch tok {
  12434. case int32(m_XML_TOK_PROLOG_S):
  12435. return int32(_XML_ROLE_NONE)
  12436. case int32(m_XML_TOK_OPEN_BRACKET):
  12437. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12438. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  12439. return int32(_XML_ROLE_NONE)
  12440. }
  12441. return _common(tls, state, tok)
  12442. }
  12443. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12444. _ = ptr
  12445. _ = end
  12446. _ = enc
  12447. switch tok {
  12448. case int32(m_XML_TOK_PROLOG_S):
  12449. return int32(_XML_ROLE_NONE)
  12450. case int32(m_XML_TOK_OPEN_BRACKET):
  12451. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12452. return int32(_XML_ROLE_IGNORE_SECT)
  12453. }
  12454. return _common(tls, state, tok)
  12455. }
  12456. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12457. var v1 uintptr
  12458. _ = v1
  12459. _ = ptr
  12460. _ = end
  12461. _ = enc
  12462. switch tok {
  12463. case int32(m_XML_TOK_PROLOG_S):
  12464. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12465. case int32(m_XML_TOK_DECL_CLOSE):
  12466. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12467. v1 = __ccgo_fp(_internalSubset)
  12468. } else {
  12469. v1 = __ccgo_fp(_externalSubset1)
  12470. }
  12471. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12472. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12473. }
  12474. return _common(tls, state, tok)
  12475. }
  12476. // C documentation
  12477. //
  12478. // /* This function will only be invoked if the internal logic of the
  12479. // * parser has broken down. It is used in two cases:
  12480. // *
  12481. // * 1: When the XML prolog has been finished. At this point the
  12482. // * processor (the parser level above these role handlers) should
  12483. // * switch from prologProcessor to contentProcessor and reinitialise
  12484. // * the handler function.
  12485. // *
  12486. // * 2: When an error has been detected (via common() below). At this
  12487. // * point again the processor should be switched to errorProcessor,
  12488. // * which will never call a handler.
  12489. // *
  12490. // * The result of this is that error() can only be called if the
  12491. // * processor switch failed to happen, which is an internal error and
  12492. // * therefore we shouldn't be able to provoke it simply by using the
  12493. // * library. It is a necessary backstop, however, so we merely exclude
  12494. // * it from the coverage statistics.
  12495. // *
  12496. // * LCOV_EXCL_START
  12497. // */
  12498. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12499. _ = state
  12500. _ = tok
  12501. _ = ptr
  12502. _ = end
  12503. _ = enc
  12504. return int32(_XML_ROLE_NONE)
  12505. }
  12506. /* LCOV_EXCL_STOP */
  12507. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12508. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12509. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12510. }
  12511. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12512. return int32(_XML_ROLE_ERROR)
  12513. }
  12514. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12515. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12516. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12517. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12518. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12519. }
  12520. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12521. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12522. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12523. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12524. }
  12525. const m_ASCII_02 = 48
  12526. const m_ASCII_12 = 49
  12527. const m_ASCII_22 = 50
  12528. const m_ASCII_32 = 51
  12529. const m_ASCII_41 = 52
  12530. const m_ASCII_51 = 53
  12531. const m_ASCII_61 = 54
  12532. const m_ASCII_71 = 55
  12533. const m_ASCII_82 = 56
  12534. const m_ASCII_92 = 57
  12535. const m_ASCII_AMP1 = 38
  12536. const m_ASCII_APOS1 = 39
  12537. const m_ASCII_COLON2 = 58
  12538. const m_ASCII_EQUALS2 = 61
  12539. const m_ASCII_EXCL2 = 33
  12540. const m_ASCII_G2 = 0x47
  12541. const m_ASCII_GT1 = 62
  12542. const m_ASCII_K1 = 0x4B
  12543. const m_ASCII_LSQB1 = 91
  12544. const m_ASCII_LT1 = 60
  12545. const m_ASCII_MINUS1 = 45
  12546. const m_ASCII_N1 = 0x4E
  12547. const m_ASCII_P2 = 0x50
  12548. const m_ASCII_PERIOD2 = 46
  12549. const m_ASCII_Q2 = 0x51
  12550. const m_ASCII_QUOT1 = 34
  12551. const m_ASCII_R1 = 0x52
  12552. const m_ASCII_RSQB1 = 93
  12553. const m_ASCII_SEMI1 = 59
  12554. const m_ASCII_SPACE1 = 32
  12555. const m_ASCII_TAB1 = 9
  12556. const m_ASCII_UNDERSCORE1 = 95
  12557. const m_ASCII_Y1 = 0x59
  12558. const m_ASCII_Z1 = 90
  12559. const m_ASCII_a2 = 97
  12560. const m_ASCII_b1 = 98
  12561. const m_ASCII_c2 = 99
  12562. const m_ASCII_d1 = 100
  12563. const m_ASCII_e2 = 101
  12564. const m_ASCII_f1 = 102
  12565. const m_ASCII_g2 = 103
  12566. const m_ASCII_i1 = 105
  12567. const m_ASCII_l2 = 108
  12568. const m_ASCII_m2 = 109
  12569. const m_ASCII_n2 = 110
  12570. const m_ASCII_o2 = 111
  12571. const m_ASCII_p2 = 112
  12572. const m_ASCII_q1 = 113
  12573. const m_ASCII_r2 = 114
  12574. const m_ASCII_s2 = 115
  12575. const m_ASCII_t2 = 116
  12576. const m_ASCII_u1 = 117
  12577. const m_ASCII_v1 = 118
  12578. const m_ASCII_x2 = 120
  12579. const m_ASCII_y1 = 121
  12580. const m_ASCII_z1 = 122
  12581. const m_ENCODING_MAX = 128
  12582. const m___bool_true_false_are_defined = 1
  12583. const m_bool = "_Bool"
  12584. const m_false = 0
  12585. const m_true = 1
  12586. const m_utf8_isName4 = "isNever"
  12587. const m_utf8_isNmstrt4 = "isNever"
  12588. var _namingBitmap = [320]uint32{
  12589. 8: uint32(0xFFFFFFFF),
  12590. 9: uint32(0xFFFFFFFF),
  12591. 10: uint32(0xFFFFFFFF),
  12592. 11: uint32(0xFFFFFFFF),
  12593. 12: uint32(0xFFFFFFFF),
  12594. 13: uint32(0xFFFFFFFF),
  12595. 14: uint32(0xFFFFFFFF),
  12596. 15: uint32(0xFFFFFFFF),
  12597. 17: uint32(0x04000000),
  12598. 18: uint32(0x87FFFFFE),
  12599. 19: uint32(0x07FFFFFE),
  12600. 22: uint32(0xFF7FFFFF),
  12601. 23: uint32(0xFF7FFFFF),
  12602. 24: uint32(0xFFFFFFFF),
  12603. 25: uint32(0x7FF3FFFF),
  12604. 26: uint32(0xFFFFFDFE),
  12605. 27: uint32(0x7FFFFFFF),
  12606. 28: uint32(0xFFFFFFFF),
  12607. 29: uint32(0xFFFFFFFF),
  12608. 30: uint32(0xFFFFE00F),
  12609. 31: uint32(0xFC31FFFF),
  12610. 32: uint32(0x00FFFFFF),
  12611. 34: uint32(0xFFFF0000),
  12612. 35: uint32(0xFFFFFFFF),
  12613. 36: uint32(0xFFFFFFFF),
  12614. 37: uint32(0xF80001FF),
  12615. 38: uint32(0x00000003),
  12616. 44: uint32(0xFFFFD740),
  12617. 45: uint32(0xFFFFFFFB),
  12618. 46: uint32(0x547F7FFF),
  12619. 47: uint32(0x000FFFFD),
  12620. 48: uint32(0xFFFFDFFE),
  12621. 49: uint32(0xFFFFFFFF),
  12622. 50: uint32(0xDFFEFFFF),
  12623. 51: uint32(0xFFFFFFFF),
  12624. 52: uint32(0xFFFF0003),
  12625. 53: uint32(0xFFFFFFFF),
  12626. 54: uint32(0xFFFF199F),
  12627. 55: uint32(0x033FCFFF),
  12628. 57: uint32(0xFFFE0000),
  12629. 58: uint32(0x027FFFFF),
  12630. 59: uint32(0xFFFFFFFE),
  12631. 60: uint32(0x0000007F),
  12632. 62: uint32(0xFFFF0000),
  12633. 63: uint32(0x000707FF),
  12634. 65: uint32(0x07FFFFFE),
  12635. 66: uint32(0x000007FE),
  12636. 67: uint32(0xFFFE0000),
  12637. 68: uint32(0xFFFFFFFF),
  12638. 69: uint32(0x7CFFFFFF),
  12639. 70: uint32(0x002F7FFF),
  12640. 71: uint32(0x00000060),
  12641. 72: uint32(0xFFFFFFE0),
  12642. 73: uint32(0x23FFFFFF),
  12643. 74: uint32(0xFF000000),
  12644. 75: uint32(0x00000003),
  12645. 76: uint32(0xFFF99FE0),
  12646. 77: uint32(0x03C5FDFF),
  12647. 78: uint32(0xB0000000),
  12648. 79: uint32(0x00030003),
  12649. 80: uint32(0xFFF987E0),
  12650. 81: uint32(0x036DFDFF),
  12651. 82: uint32(0x5E000000),
  12652. 83: uint32(0x001C0000),
  12653. 84: uint32(0xFFFBAFE0),
  12654. 85: uint32(0x23EDFDFF),
  12655. 87: uint32(0x00000001),
  12656. 88: uint32(0xFFF99FE0),
  12657. 89: uint32(0x23CDFDFF),
  12658. 90: uint32(0xB0000000),
  12659. 91: uint32(0x00000003),
  12660. 92: uint32(0xD63DC7E0),
  12661. 93: uint32(0x03BFC718),
  12662. 96: uint32(0xFFFDDFE0),
  12663. 97: uint32(0x03EFFDFF),
  12664. 99: uint32(0x00000003),
  12665. 100: uint32(0xFFFDDFE0),
  12666. 101: uint32(0x03EFFDFF),
  12667. 102: uint32(0x40000000),
  12668. 103: uint32(0x00000003),
  12669. 104: uint32(0xFFFDDFE0),
  12670. 105: uint32(0x03FFFDFF),
  12671. 107: uint32(0x00000003),
  12672. 112: uint32(0xFFFFFFFE),
  12673. 113: uint32(0x000D7FFF),
  12674. 114: uint32(0x0000003F),
  12675. 116: uint32(0xFEF02596),
  12676. 117: uint32(0x200D6CAE),
  12677. 118: uint32(0x0000001F),
  12678. 122: uint32(0xFFFFFEFF),
  12679. 123: uint32(0x000003FF),
  12680. 133: uint32(0xFFFFFFFF),
  12681. 134: uint32(0xFFFF003F),
  12682. 135: uint32(0x007FFFFF),
  12683. 136: uint32(0x0007DAED),
  12684. 137: uint32(0x50000000),
  12685. 138: uint32(0x82315001),
  12686. 139: uint32(0x002C62AB),
  12687. 140: uint32(0x40000000),
  12688. 141: uint32(0xF580C900),
  12689. 142: uint32(0x00000007),
  12690. 143: uint32(0x02010800),
  12691. 144: uint32(0xFFFFFFFF),
  12692. 145: uint32(0xFFFFFFFF),
  12693. 146: uint32(0xFFFFFFFF),
  12694. 147: uint32(0xFFFFFFFF),
  12695. 148: uint32(0x0FFFFFFF),
  12696. 149: uint32(0xFFFFFFFF),
  12697. 150: uint32(0xFFFFFFFF),
  12698. 151: uint32(0x03FFFFFF),
  12699. 152: uint32(0x3F3FFFFF),
  12700. 153: uint32(0xFFFFFFFF),
  12701. 154: uint32(0xAAFF3F3F),
  12702. 155: uint32(0x3FFFFFFF),
  12703. 156: uint32(0xFFFFFFFF),
  12704. 157: uint32(0x5FDFFFFF),
  12705. 158: uint32(0x0FCF1FDC),
  12706. 159: uint32(0x1FDC1FFF),
  12707. 161: uint32(0x00004C40),
  12708. 164: uint32(0x00000007),
  12709. 168: uint32(0x00000080),
  12710. 169: uint32(0x000003FE),
  12711. 170: uint32(0xFFFFFFFE),
  12712. 171: uint32(0xFFFFFFFF),
  12713. 172: uint32(0x001FFFFF),
  12714. 173: uint32(0xFFFFFFFE),
  12715. 174: uint32(0xFFFFFFFF),
  12716. 175: uint32(0x07FFFFFF),
  12717. 176: uint32(0xFFFFFFE0),
  12718. 177: uint32(0x00001FFF),
  12719. 184: uint32(0xFFFFFFFF),
  12720. 185: uint32(0xFFFFFFFF),
  12721. 186: uint32(0xFFFFFFFF),
  12722. 187: uint32(0xFFFFFFFF),
  12723. 188: uint32(0xFFFFFFFF),
  12724. 189: uint32(0x0000003F),
  12725. 192: uint32(0xFFFFFFFF),
  12726. 193: uint32(0xFFFFFFFF),
  12727. 194: uint32(0xFFFFFFFF),
  12728. 195: uint32(0xFFFFFFFF),
  12729. 196: uint32(0xFFFFFFFF),
  12730. 197: uint32(0x0000000F),
  12731. 201: uint32(0x07FF6000),
  12732. 202: uint32(0x87FFFFFE),
  12733. 203: uint32(0x07FFFFFE),
  12734. 205: uint32(0x00800000),
  12735. 206: uint32(0xFF7FFFFF),
  12736. 207: uint32(0xFF7FFFFF),
  12737. 208: uint32(0x00FFFFFF),
  12738. 210: uint32(0xFFFF0000),
  12739. 211: uint32(0xFFFFFFFF),
  12740. 212: uint32(0xFFFFFFFF),
  12741. 213: uint32(0xF80001FF),
  12742. 214: uint32(0x00030003),
  12743. 216: uint32(0xFFFFFFFF),
  12744. 217: uint32(0xFFFFFFFF),
  12745. 218: uint32(0x0000003F),
  12746. 219: uint32(0x00000003),
  12747. 220: uint32(0xFFFFD7C0),
  12748. 221: uint32(0xFFFFFFFB),
  12749. 222: uint32(0x547F7FFF),
  12750. 223: uint32(0x000FFFFD),
  12751. 224: uint32(0xFFFFDFFE),
  12752. 225: uint32(0xFFFFFFFF),
  12753. 226: uint32(0xDFFEFFFF),
  12754. 227: uint32(0xFFFFFFFF),
  12755. 228: uint32(0xFFFF007B),
  12756. 229: uint32(0xFFFFFFFF),
  12757. 230: uint32(0xFFFF199F),
  12758. 231: uint32(0x033FCFFF),
  12759. 233: uint32(0xFFFE0000),
  12760. 234: uint32(0x027FFFFF),
  12761. 235: uint32(0xFFFFFFFE),
  12762. 236: uint32(0xFFFE007F),
  12763. 237: uint32(0xBBFFFFFB),
  12764. 238: uint32(0xFFFF0016),
  12765. 239: uint32(0x000707FF),
  12766. 241: uint32(0x07FFFFFE),
  12767. 242: uint32(0x0007FFFF),
  12768. 243: uint32(0xFFFF03FF),
  12769. 244: uint32(0xFFFFFFFF),
  12770. 245: uint32(0x7CFFFFFF),
  12771. 246: uint32(0xFFEF7FFF),
  12772. 247: uint32(0x03FF3DFF),
  12773. 248: uint32(0xFFFFFFEE),
  12774. 249: uint32(0xF3FFFFFF),
  12775. 250: uint32(0xFF1E3FFF),
  12776. 251: uint32(0x0000FFCF),
  12777. 252: uint32(0xFFF99FEE),
  12778. 253: uint32(0xD3C5FDFF),
  12779. 254: uint32(0xB080399F),
  12780. 255: uint32(0x0003FFCF),
  12781. 256: uint32(0xFFF987E4),
  12782. 257: uint32(0xD36DFDFF),
  12783. 258: uint32(0x5E003987),
  12784. 259: uint32(0x001FFFC0),
  12785. 260: uint32(0xFFFBAFEE),
  12786. 261: uint32(0xF3EDFDFF),
  12787. 262: uint32(0x00003BBF),
  12788. 263: uint32(0x0000FFC1),
  12789. 264: uint32(0xFFF99FEE),
  12790. 265: uint32(0xF3CDFDFF),
  12791. 266: uint32(0xB0C0398F),
  12792. 267: uint32(0x0000FFC3),
  12793. 268: uint32(0xD63DC7EC),
  12794. 269: uint32(0xC3BFC718),
  12795. 270: uint32(0x00803DC7),
  12796. 271: uint32(0x0000FF80),
  12797. 272: uint32(0xFFFDDFEE),
  12798. 273: uint32(0xC3EFFDFF),
  12799. 274: uint32(0x00603DDF),
  12800. 275: uint32(0x0000FFC3),
  12801. 276: uint32(0xFFFDDFEC),
  12802. 277: uint32(0xC3EFFDFF),
  12803. 278: uint32(0x40603DDF),
  12804. 279: uint32(0x0000FFC3),
  12805. 280: uint32(0xFFFDDFEC),
  12806. 281: uint32(0xC3FFFDFF),
  12807. 282: uint32(0x00803DCF),
  12808. 283: uint32(0x0000FFC3),
  12809. 288: uint32(0xFFFFFFFE),
  12810. 289: uint32(0x07FF7FFF),
  12811. 290: uint32(0x03FF7FFF),
  12812. 292: uint32(0xFEF02596),
  12813. 293: uint32(0x3BFF6CAE),
  12814. 294: uint32(0x03FF3F5F),
  12815. 296: uint32(0x03000000),
  12816. 297: uint32(0xC2A003FF),
  12817. 298: uint32(0xFFFFFEFF),
  12818. 299: uint32(0xFFFE03FF),
  12819. 300: uint32(0xFEBF0FDF),
  12820. 301: uint32(0x02FE3FFF),
  12821. 310: uint32(0x1FFF0000),
  12822. 311: uint32(0x00000002),
  12823. 312: uint32(0x000000A0),
  12824. 313: uint32(0x003EFFFE),
  12825. 314: uint32(0xFFFFFFFE),
  12826. 315: uint32(0xFFFFFFFF),
  12827. 316: uint32(0x661FFFFF),
  12828. 317: uint32(0xFFFFFFFE),
  12829. 318: uint32(0xFFFFFFFF),
  12830. 319: uint32(0x77FFFFFF),
  12831. }
  12832. var _nmstrtPages = [256]uint8{
  12833. 0: uint8(0x02),
  12834. 1: uint8(0x03),
  12835. 2: uint8(0x04),
  12836. 3: uint8(0x05),
  12837. 4: uint8(0x06),
  12838. 5: uint8(0x07),
  12839. 6: uint8(0x08),
  12840. 9: uint8(0x09),
  12841. 10: uint8(0x0A),
  12842. 11: uint8(0x0B),
  12843. 12: uint8(0x0C),
  12844. 13: uint8(0x0D),
  12845. 14: uint8(0x0E),
  12846. 15: uint8(0x0F),
  12847. 16: uint8(0x10),
  12848. 17: uint8(0x11),
  12849. 30: uint8(0x12),
  12850. 31: uint8(0x13),
  12851. 33: uint8(0x14),
  12852. 48: uint8(0x15),
  12853. 49: uint8(0x16),
  12854. 78: uint8(0x01),
  12855. 79: uint8(0x01),
  12856. 80: uint8(0x01),
  12857. 81: uint8(0x01),
  12858. 82: uint8(0x01),
  12859. 83: uint8(0x01),
  12860. 84: uint8(0x01),
  12861. 85: uint8(0x01),
  12862. 86: uint8(0x01),
  12863. 87: uint8(0x01),
  12864. 88: uint8(0x01),
  12865. 89: uint8(0x01),
  12866. 90: uint8(0x01),
  12867. 91: uint8(0x01),
  12868. 92: uint8(0x01),
  12869. 93: uint8(0x01),
  12870. 94: uint8(0x01),
  12871. 95: uint8(0x01),
  12872. 96: uint8(0x01),
  12873. 97: uint8(0x01),
  12874. 98: uint8(0x01),
  12875. 99: uint8(0x01),
  12876. 100: uint8(0x01),
  12877. 101: uint8(0x01),
  12878. 102: uint8(0x01),
  12879. 103: uint8(0x01),
  12880. 104: uint8(0x01),
  12881. 105: uint8(0x01),
  12882. 106: uint8(0x01),
  12883. 107: uint8(0x01),
  12884. 108: uint8(0x01),
  12885. 109: uint8(0x01),
  12886. 110: uint8(0x01),
  12887. 111: uint8(0x01),
  12888. 112: uint8(0x01),
  12889. 113: uint8(0x01),
  12890. 114: uint8(0x01),
  12891. 115: uint8(0x01),
  12892. 116: uint8(0x01),
  12893. 117: uint8(0x01),
  12894. 118: uint8(0x01),
  12895. 119: uint8(0x01),
  12896. 120: uint8(0x01),
  12897. 121: uint8(0x01),
  12898. 122: uint8(0x01),
  12899. 123: uint8(0x01),
  12900. 124: uint8(0x01),
  12901. 125: uint8(0x01),
  12902. 126: uint8(0x01),
  12903. 127: uint8(0x01),
  12904. 128: uint8(0x01),
  12905. 129: uint8(0x01),
  12906. 130: uint8(0x01),
  12907. 131: uint8(0x01),
  12908. 132: uint8(0x01),
  12909. 133: uint8(0x01),
  12910. 134: uint8(0x01),
  12911. 135: uint8(0x01),
  12912. 136: uint8(0x01),
  12913. 137: uint8(0x01),
  12914. 138: uint8(0x01),
  12915. 139: uint8(0x01),
  12916. 140: uint8(0x01),
  12917. 141: uint8(0x01),
  12918. 142: uint8(0x01),
  12919. 143: uint8(0x01),
  12920. 144: uint8(0x01),
  12921. 145: uint8(0x01),
  12922. 146: uint8(0x01),
  12923. 147: uint8(0x01),
  12924. 148: uint8(0x01),
  12925. 149: uint8(0x01),
  12926. 150: uint8(0x01),
  12927. 151: uint8(0x01),
  12928. 152: uint8(0x01),
  12929. 153: uint8(0x01),
  12930. 154: uint8(0x01),
  12931. 155: uint8(0x01),
  12932. 156: uint8(0x01),
  12933. 157: uint8(0x01),
  12934. 158: uint8(0x01),
  12935. 159: uint8(0x17),
  12936. 172: uint8(0x01),
  12937. 173: uint8(0x01),
  12938. 174: uint8(0x01),
  12939. 175: uint8(0x01),
  12940. 176: uint8(0x01),
  12941. 177: uint8(0x01),
  12942. 178: uint8(0x01),
  12943. 179: uint8(0x01),
  12944. 180: uint8(0x01),
  12945. 181: uint8(0x01),
  12946. 182: uint8(0x01),
  12947. 183: uint8(0x01),
  12948. 184: uint8(0x01),
  12949. 185: uint8(0x01),
  12950. 186: uint8(0x01),
  12951. 187: uint8(0x01),
  12952. 188: uint8(0x01),
  12953. 189: uint8(0x01),
  12954. 190: uint8(0x01),
  12955. 191: uint8(0x01),
  12956. 192: uint8(0x01),
  12957. 193: uint8(0x01),
  12958. 194: uint8(0x01),
  12959. 195: uint8(0x01),
  12960. 196: uint8(0x01),
  12961. 197: uint8(0x01),
  12962. 198: uint8(0x01),
  12963. 199: uint8(0x01),
  12964. 200: uint8(0x01),
  12965. 201: uint8(0x01),
  12966. 202: uint8(0x01),
  12967. 203: uint8(0x01),
  12968. 204: uint8(0x01),
  12969. 205: uint8(0x01),
  12970. 206: uint8(0x01),
  12971. 207: uint8(0x01),
  12972. 208: uint8(0x01),
  12973. 209: uint8(0x01),
  12974. 210: uint8(0x01),
  12975. 211: uint8(0x01),
  12976. 212: uint8(0x01),
  12977. 213: uint8(0x01),
  12978. 214: uint8(0x01),
  12979. 215: uint8(0x18),
  12980. }
  12981. var _namePages = [256]uint8{
  12982. 0: uint8(0x19),
  12983. 1: uint8(0x03),
  12984. 2: uint8(0x1A),
  12985. 3: uint8(0x1B),
  12986. 4: uint8(0x1C),
  12987. 5: uint8(0x1D),
  12988. 6: uint8(0x1E),
  12989. 9: uint8(0x1F),
  12990. 10: uint8(0x20),
  12991. 11: uint8(0x21),
  12992. 12: uint8(0x22),
  12993. 13: uint8(0x23),
  12994. 14: uint8(0x24),
  12995. 15: uint8(0x25),
  12996. 16: uint8(0x10),
  12997. 17: uint8(0x11),
  12998. 30: uint8(0x12),
  12999. 31: uint8(0x13),
  13000. 32: uint8(0x26),
  13001. 33: uint8(0x14),
  13002. 48: uint8(0x27),
  13003. 49: uint8(0x16),
  13004. 78: uint8(0x01),
  13005. 79: uint8(0x01),
  13006. 80: uint8(0x01),
  13007. 81: uint8(0x01),
  13008. 82: uint8(0x01),
  13009. 83: uint8(0x01),
  13010. 84: uint8(0x01),
  13011. 85: uint8(0x01),
  13012. 86: uint8(0x01),
  13013. 87: uint8(0x01),
  13014. 88: uint8(0x01),
  13015. 89: uint8(0x01),
  13016. 90: uint8(0x01),
  13017. 91: uint8(0x01),
  13018. 92: uint8(0x01),
  13019. 93: uint8(0x01),
  13020. 94: uint8(0x01),
  13021. 95: uint8(0x01),
  13022. 96: uint8(0x01),
  13023. 97: uint8(0x01),
  13024. 98: uint8(0x01),
  13025. 99: uint8(0x01),
  13026. 100: uint8(0x01),
  13027. 101: uint8(0x01),
  13028. 102: uint8(0x01),
  13029. 103: uint8(0x01),
  13030. 104: uint8(0x01),
  13031. 105: uint8(0x01),
  13032. 106: uint8(0x01),
  13033. 107: uint8(0x01),
  13034. 108: uint8(0x01),
  13035. 109: uint8(0x01),
  13036. 110: uint8(0x01),
  13037. 111: uint8(0x01),
  13038. 112: uint8(0x01),
  13039. 113: uint8(0x01),
  13040. 114: uint8(0x01),
  13041. 115: uint8(0x01),
  13042. 116: uint8(0x01),
  13043. 117: uint8(0x01),
  13044. 118: uint8(0x01),
  13045. 119: uint8(0x01),
  13046. 120: uint8(0x01),
  13047. 121: uint8(0x01),
  13048. 122: uint8(0x01),
  13049. 123: uint8(0x01),
  13050. 124: uint8(0x01),
  13051. 125: uint8(0x01),
  13052. 126: uint8(0x01),
  13053. 127: uint8(0x01),
  13054. 128: uint8(0x01),
  13055. 129: uint8(0x01),
  13056. 130: uint8(0x01),
  13057. 131: uint8(0x01),
  13058. 132: uint8(0x01),
  13059. 133: uint8(0x01),
  13060. 134: uint8(0x01),
  13061. 135: uint8(0x01),
  13062. 136: uint8(0x01),
  13063. 137: uint8(0x01),
  13064. 138: uint8(0x01),
  13065. 139: uint8(0x01),
  13066. 140: uint8(0x01),
  13067. 141: uint8(0x01),
  13068. 142: uint8(0x01),
  13069. 143: uint8(0x01),
  13070. 144: uint8(0x01),
  13071. 145: uint8(0x01),
  13072. 146: uint8(0x01),
  13073. 147: uint8(0x01),
  13074. 148: uint8(0x01),
  13075. 149: uint8(0x01),
  13076. 150: uint8(0x01),
  13077. 151: uint8(0x01),
  13078. 152: uint8(0x01),
  13079. 153: uint8(0x01),
  13080. 154: uint8(0x01),
  13081. 155: uint8(0x01),
  13082. 156: uint8(0x01),
  13083. 157: uint8(0x01),
  13084. 158: uint8(0x01),
  13085. 159: uint8(0x17),
  13086. 172: uint8(0x01),
  13087. 173: uint8(0x01),
  13088. 174: uint8(0x01),
  13089. 175: uint8(0x01),
  13090. 176: uint8(0x01),
  13091. 177: uint8(0x01),
  13092. 178: uint8(0x01),
  13093. 179: uint8(0x01),
  13094. 180: uint8(0x01),
  13095. 181: uint8(0x01),
  13096. 182: uint8(0x01),
  13097. 183: uint8(0x01),
  13098. 184: uint8(0x01),
  13099. 185: uint8(0x01),
  13100. 186: uint8(0x01),
  13101. 187: uint8(0x01),
  13102. 188: uint8(0x01),
  13103. 189: uint8(0x01),
  13104. 190: uint8(0x01),
  13105. 191: uint8(0x01),
  13106. 192: uint8(0x01),
  13107. 193: uint8(0x01),
  13108. 194: uint8(0x01),
  13109. 195: uint8(0x01),
  13110. 196: uint8(0x01),
  13111. 197: uint8(0x01),
  13112. 198: uint8(0x01),
  13113. 199: uint8(0x01),
  13114. 200: uint8(0x01),
  13115. 201: uint8(0x01),
  13116. 202: uint8(0x01),
  13117. 203: uint8(0x01),
  13118. 204: uint8(0x01),
  13119. 205: uint8(0x01),
  13120. 206: uint8(0x01),
  13121. 207: uint8(0x01),
  13122. 208: uint8(0x01),
  13123. 209: uint8(0x01),
  13124. 210: uint8(0x01),
  13125. 211: uint8(0x01),
  13126. 212: uint8(0x01),
  13127. 213: uint8(0x01),
  13128. 214: uint8(0x01),
  13129. 215: uint8(0x18),
  13130. }
  13131. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  13132. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  13133. pages, 3 bits to add to that index and 5 bits to generate the mask.
  13134. */
  13135. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  13136. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  13137. into pages, 3 bits to add to that index and 5 bits to generate the
  13138. mask.
  13139. */
  13140. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  13141. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  13142. with the additional restriction of not allowing the Unicode
  13143. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  13144. Implementation details:
  13145. (A & 0x80) == 0 means A < 0x80
  13146. and
  13147. (A & 0xC0) == 0xC0 means A > 0xBF
  13148. */
  13149. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13150. _ = enc
  13151. _ = p
  13152. return 0
  13153. }
  13154. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13155. _ = enc
  13156. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))>>int32(2)&int32(7)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) & libc.Int32FromInt32(0x1F))))
  13157. }
  13158. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13159. _ = enc
  13160. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(0xF)<<int32(4)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(2)&int32(0xF)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) & libc.Int32FromInt32(0x1F))))
  13161. }
  13162. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13163. _ = enc
  13164. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))>>int32(2)&int32(7)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) & libc.Int32FromInt32(0x1F))))
  13165. }
  13166. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13167. _ = enc
  13168. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p)))&int32(0xF)<<int32(4)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))>>int32(2)&int32(0xF)])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(3)<<int32(1)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))>>int32(5)&int32(1)] & (libc.Uint32FromUint32(1) << (libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) & libc.Int32FromInt32(0x1F))))
  13169. }
  13170. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13171. _ = enc
  13172. return libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) < int32(0xC2) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13173. }
  13174. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13175. var v1, v3, v4 int32
  13176. var v2, v5, v6 bool
  13177. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  13178. _ = enc
  13179. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  13180. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  13181. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  13182. } else {
  13183. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  13184. }
  13185. }
  13186. if v6 = v2 || v1 != 0; !v6 {
  13187. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  13188. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13189. } else {
  13190. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  13191. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  13192. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  13193. } else {
  13194. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13195. }
  13196. }
  13197. v3 = libc.BoolInt32(v5 || v4 != 0)
  13198. }
  13199. }
  13200. return libc.BoolInt32(v6 || v3 != 0)
  13201. }
  13202. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13203. var v1, v2 int32
  13204. var v3, v4 bool
  13205. _, _, _, _ = v1, v2, v3, v4
  13206. _ = enc
  13207. if v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 3)))&int32(0x80) == 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 3)))&int32(0xC0) == int32(0xC0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0); !v4 {
  13208. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  13209. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13210. } else {
  13211. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  13212. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  13213. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  13214. } else {
  13215. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13216. }
  13217. }
  13218. v1 = libc.BoolInt32(v3 || v2 != 0)
  13219. }
  13220. }
  13221. return libc.BoolInt32(v4 || v1 != 0)
  13222. }
  13223. type Tnormal_encoding = struct {
  13224. Fenc TENCODING
  13225. Ftype1 [256]uint8
  13226. FisName2 uintptr
  13227. FisName3 uintptr
  13228. FisName4 uintptr
  13229. FisNmstrt2 uintptr
  13230. FisNmstrt3 uintptr
  13231. FisNmstrt4 uintptr
  13232. FisInvalid2 uintptr
  13233. FisInvalid3 uintptr
  13234. FisInvalid4 uintptr
  13235. }
  13236. const _BT_NONXML = 0
  13237. const _BT_MALFORM = 1
  13238. const _BT_LT = 2
  13239. const _BT_AMP = 3
  13240. const _BT_RSQB = 4
  13241. const _BT_LEAD2 = 5
  13242. const _BT_LEAD3 = 6
  13243. const _BT_LEAD4 = 7
  13244. const _BT_TRAIL = 8
  13245. const _BT_CR = 9
  13246. const _BT_LF = 10
  13247. const _BT_GT = 11
  13248. const _BT_QUOT = 12
  13249. const _BT_APOS = 13
  13250. const _BT_EQUALS = 14
  13251. const _BT_QUEST = 15
  13252. const _BT_EXCL = 16
  13253. const _BT_SOL = 17
  13254. const _BT_SEMI = 18
  13255. const _BT_NUM = 19
  13256. const _BT_LSQB = 20
  13257. const _BT_S = 21
  13258. const _BT_NMSTRT = 22
  13259. const _BT_COLON = 23
  13260. const _BT_HEX = 24
  13261. const _BT_DIGIT = 25
  13262. const _BT_NAME = 26
  13263. const _BT_MINUS = 27
  13264. const _BT_OTHER = 28
  13265. const _BT_NONASCII = 29
  13266. const _BT_PERCNT = 30
  13267. const _BT_LPAR = 31
  13268. const _BT_RPAR = 32
  13269. const _BT_AST = 33
  13270. const _BT_PLUS = 34
  13271. const _BT_COMMA = 35
  13272. const _BT_VERBAR = 36
  13273. /*-
  13274. * SPDX-License-Identifier: BSD-3-Clause
  13275. *
  13276. * Copyright (c) 1990, 1993
  13277. * The Regents of the University of California. All rights reserved.
  13278. *
  13279. * Redistribution and use in source and binary forms, with or without
  13280. * modification, are permitted provided that the following conditions
  13281. * are met:
  13282. * 1. Redistributions of source code must retain the above copyright
  13283. * notice, this list of conditions and the following disclaimer.
  13284. * 2. Redistributions in binary form must reproduce the above copyright
  13285. * notice, this list of conditions and the following disclaimer in the
  13286. * documentation and/or other materials provided with the distribution.
  13287. * 3. Neither the name of the University nor the names of its contributors
  13288. * may be used to endorse or promote products derived from this software
  13289. * without specific prior written permission.
  13290. *
  13291. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  13292. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  13293. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  13294. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  13295. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  13296. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  13297. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  13298. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  13299. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  13300. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  13301. * SUCH DAMAGE.
  13302. *
  13303. * @(#)stddef.h 8.1 (Berkeley) 6/2/93
  13304. */
  13305. /*
  13306. __ __ _
  13307. ___\ \/ /_ __ __ _| |_
  13308. / _ \\ /| '_ \ / _` | __|
  13309. | __// \| |_) | (_| | |_
  13310. \___/_/\_\ .__/ \__,_|\__|
  13311. |_| XML parser
  13312. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13313. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13314. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13315. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13316. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13317. Licensed under the MIT license:
  13318. Permission is hereby granted, free of charge, to any person obtaining
  13319. a copy of this software and associated documentation files (the
  13320. "Software"), to deal in the Software without restriction, including
  13321. without limitation the rights to use, copy, modify, merge, publish,
  13322. distribute, sublicense, and/or sell copies of the Software, and to permit
  13323. persons to whom the Software is furnished to do so, subject to the
  13324. following conditions:
  13325. The above copyright notice and this permission notice shall be included
  13326. in all copies or substantial portions of the Software.
  13327. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13328. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13329. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13330. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13331. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13332. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13333. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13334. */
  13335. /* minimum bytes per character */
  13336. /* c is an ASCII character */
  13337. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13338. __ __ _
  13339. ___\ \/ /_ __ __ _| |_
  13340. / _ \\ /| '_ \ / _` | __|
  13341. | __// \| |_) | (_| | |_
  13342. \___/_/\_\ .__/ \__,_|\__|
  13343. |_| XML parser
  13344. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13345. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13346. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13347. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13348. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13349. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13350. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13351. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13352. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13353. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13354. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13355. Licensed under the MIT license:
  13356. Permission is hereby granted, free of charge, to any person obtaining
  13357. a copy of this software and associated documentation files (the
  13358. "Software"), to deal in the Software without restriction, including
  13359. without limitation the rights to use, copy, modify, merge, publish,
  13360. distribute, sublicense, and/or sell copies of the Software, and to permit
  13361. persons to whom the Software is furnished to do so, subject to the
  13362. following conditions:
  13363. The above copyright notice and this permission notice shall be included
  13364. in all copies or substantial portions of the Software.
  13365. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13366. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13367. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13368. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13369. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13370. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13371. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13372. */
  13373. /* ptr points to character following "<!-" */
  13374. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13375. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13376. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13378. return m_XML_TOK_INVALID
  13379. }
  13380. ptr += uintptr(1)
  13381. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13382. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13383. case int32(_BT_LEAD2):
  13384. if int64(end)-int64(ptr) < int64(2) {
  13385. return -int32(2)
  13386. }
  13387. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13389. return m_XML_TOK_INVALID
  13390. }
  13391. ptr += uintptr(2)
  13392. case int32(_BT_LEAD3):
  13393. if int64(end)-int64(ptr) < int64(3) {
  13394. return -int32(2)
  13395. }
  13396. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13397. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13398. return m_XML_TOK_INVALID
  13399. }
  13400. ptr += uintptr(3)
  13401. case int32(_BT_LEAD4):
  13402. if int64(end)-int64(ptr) < int64(4) {
  13403. return -int32(2)
  13404. }
  13405. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13407. return m_XML_TOK_INVALID
  13408. }
  13409. ptr += uintptr(4)
  13410. case int32(_BT_NONXML):
  13411. fallthrough
  13412. case int32(_BT_MALFORM):
  13413. fallthrough
  13414. case int32(_BT_TRAIL):
  13415. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13416. return m_XML_TOK_INVALID
  13417. case int32(_BT_MINUS):
  13418. ptr += uintptr(1)
  13419. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13420. return -int32(1)
  13421. }
  13422. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13423. ptr += uintptr(1)
  13424. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13425. return -int32(1)
  13426. }
  13427. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13429. return m_XML_TOK_INVALID
  13430. }
  13431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13432. return int32(m_XML_TOK_COMMENT)
  13433. }
  13434. default:
  13435. ptr += uintptr(1)
  13436. break
  13437. }
  13438. }
  13439. }
  13440. return -int32(1)
  13441. }
  13442. /* ptr points to character following "<!" */
  13443. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13444. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13445. return -int32(1)
  13446. }
  13447. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13448. case int32(_BT_MINUS):
  13449. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13450. case int32(_BT_LSQB):
  13451. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13452. return int32(m_XML_TOK_COND_SECT_OPEN)
  13453. case int32(_BT_NMSTRT):
  13454. fallthrough
  13455. case int32(_BT_HEX):
  13456. ptr += uintptr(1)
  13457. default:
  13458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13459. return m_XML_TOK_INVALID
  13460. }
  13461. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13462. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13463. case int32(_BT_PERCNT):
  13464. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  13465. return -int32(1)
  13466. }
  13467. /* don't allow <!ENTITY% foo "whatever"> */
  13468. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) {
  13469. case int32(_BT_S):
  13470. fallthrough
  13471. case int32(_BT_CR):
  13472. fallthrough
  13473. case int32(_BT_LF):
  13474. fallthrough
  13475. case int32(_BT_PERCNT):
  13476. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13477. return m_XML_TOK_INVALID
  13478. }
  13479. /* fall through */
  13480. fallthrough
  13481. case int32(_BT_S):
  13482. fallthrough
  13483. case int32(_BT_CR):
  13484. fallthrough
  13485. case int32(_BT_LF):
  13486. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13487. return int32(m_XML_TOK_DECL_OPEN)
  13488. case int32(_BT_NMSTRT):
  13489. fallthrough
  13490. case int32(_BT_HEX):
  13491. ptr += uintptr(1)
  13492. default:
  13493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13494. return m_XML_TOK_INVALID
  13495. }
  13496. }
  13497. return -int32(1)
  13498. }
  13499. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13500. var upper int32
  13501. _ = upper
  13502. upper = 0
  13503. _ = enc
  13504. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13505. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  13506. return int32(1)
  13507. }
  13508. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13509. case int32(m_ASCII_x2):
  13510. case int32(m_ASCII_X):
  13511. upper = int32(1)
  13512. default:
  13513. return int32(1)
  13514. }
  13515. ptr += uintptr(1)
  13516. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13517. case int32(m_ASCII_m2):
  13518. case int32(m_ASCII_M):
  13519. upper = int32(1)
  13520. default:
  13521. return int32(1)
  13522. }
  13523. ptr += uintptr(1)
  13524. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13525. case int32(m_ASCII_l2):
  13526. case int32(m_ASCII_L):
  13527. upper = int32(1)
  13528. default:
  13529. return int32(1)
  13530. }
  13531. if upper != 0 {
  13532. return 0
  13533. }
  13534. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13535. return int32(1)
  13536. }
  13537. /* ptr points to character following "<?" */
  13538. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13539. bp := tls.Alloc(16)
  13540. defer tls.Free(16)
  13541. var target uintptr
  13542. var _ /* tok at bp+0 */ int32
  13543. _ = target
  13544. target = ptr
  13545. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13546. return -int32(1)
  13547. }
  13548. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13549. case int32(_BT_NONASCII):
  13550. if !(libc.Int32FromInt32(0) != 0) {
  13551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13552. return m_XML_TOK_INVALID
  13553. } /* fall through */
  13554. fallthrough
  13555. case int32(_BT_NMSTRT):
  13556. fallthrough
  13557. case int32(_BT_HEX):
  13558. ptr += uintptr(1)
  13559. case int32(_BT_LEAD2):
  13560. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13561. return -int32(2)
  13562. }
  13563. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  13564. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13565. return m_XML_TOK_INVALID
  13566. }
  13567. ptr += uintptr(2)
  13568. case int32(_BT_LEAD3):
  13569. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13570. return -int32(2)
  13571. }
  13572. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  13573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13574. return m_XML_TOK_INVALID
  13575. }
  13576. ptr += uintptr(3)
  13577. case int32(_BT_LEAD4):
  13578. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13579. return -int32(2)
  13580. }
  13581. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  13582. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13583. return m_XML_TOK_INVALID
  13584. }
  13585. ptr += uintptr(4)
  13586. default:
  13587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13588. return m_XML_TOK_INVALID
  13589. }
  13590. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13591. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13592. case int32(_BT_NONASCII):
  13593. if !(libc.Int32FromInt32(0) != 0) {
  13594. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13595. return m_XML_TOK_INVALID
  13596. } /* fall through */
  13597. fallthrough
  13598. case int32(_BT_NMSTRT):
  13599. fallthrough
  13600. case int32(_BT_HEX):
  13601. fallthrough
  13602. case int32(_BT_DIGIT):
  13603. fallthrough
  13604. case int32(_BT_NAME):
  13605. fallthrough
  13606. case int32(_BT_MINUS):
  13607. ptr += uintptr(1)
  13608. case int32(_BT_LEAD2):
  13609. if int64(end)-int64(ptr) < int64(2) {
  13610. return -int32(2)
  13611. }
  13612. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13614. return m_XML_TOK_INVALID
  13615. }
  13616. ptr += uintptr(2)
  13617. case int32(_BT_LEAD3):
  13618. if int64(end)-int64(ptr) < int64(3) {
  13619. return -int32(2)
  13620. }
  13621. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13623. return m_XML_TOK_INVALID
  13624. }
  13625. ptr += uintptr(3)
  13626. case int32(_BT_LEAD4):
  13627. if int64(end)-int64(ptr) < int64(4) {
  13628. return -int32(2)
  13629. }
  13630. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  13631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13632. return m_XML_TOK_INVALID
  13633. }
  13634. ptr += uintptr(4)
  13635. case int32(_BT_S):
  13636. fallthrough
  13637. case int32(_BT_CR):
  13638. fallthrough
  13639. case int32(_BT_LF):
  13640. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13642. return m_XML_TOK_INVALID
  13643. }
  13644. ptr += uintptr(1)
  13645. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13646. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13647. case int32(_BT_LEAD2):
  13648. if int64(end)-int64(ptr) < int64(2) {
  13649. return -int32(2)
  13650. }
  13651. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13653. return m_XML_TOK_INVALID
  13654. }
  13655. ptr += uintptr(2)
  13656. case int32(_BT_LEAD3):
  13657. if int64(end)-int64(ptr) < int64(3) {
  13658. return -int32(2)
  13659. }
  13660. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13661. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13662. return m_XML_TOK_INVALID
  13663. }
  13664. ptr += uintptr(3)
  13665. case int32(_BT_LEAD4):
  13666. if int64(end)-int64(ptr) < int64(4) {
  13667. return -int32(2)
  13668. }
  13669. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13671. return m_XML_TOK_INVALID
  13672. }
  13673. ptr += uintptr(4)
  13674. case int32(_BT_NONXML):
  13675. fallthrough
  13676. case int32(_BT_MALFORM):
  13677. fallthrough
  13678. case int32(_BT_TRAIL):
  13679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13680. return m_XML_TOK_INVALID
  13681. case int32(_BT_QUEST):
  13682. ptr += uintptr(1)
  13683. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13684. return -int32(1)
  13685. }
  13686. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13687. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13688. return *(*int32)(unsafe.Pointer(bp))
  13689. }
  13690. default:
  13691. ptr += uintptr(1)
  13692. break
  13693. }
  13694. }
  13695. return -int32(1)
  13696. case int32(_BT_QUEST):
  13697. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13698. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13699. return m_XML_TOK_INVALID
  13700. }
  13701. ptr += uintptr(1)
  13702. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13703. return -int32(1)
  13704. }
  13705. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13707. return *(*int32)(unsafe.Pointer(bp))
  13708. }
  13709. /* fall through */
  13710. fallthrough
  13711. default:
  13712. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13713. return m_XML_TOK_INVALID
  13714. }
  13715. }
  13716. return -int32(1)
  13717. }
  13718. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13719. var i int32
  13720. _ = i
  13721. _ = enc
  13722. /* CDATA[ */
  13723. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  13724. return -int32(1)
  13725. }
  13726. i = 0
  13727. for {
  13728. if !(i < int32(6)) {
  13729. break
  13730. }
  13731. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB[i])) {
  13732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13733. return m_XML_TOK_INVALID
  13734. }
  13735. goto _1
  13736. _1:
  13737. ;
  13738. i++
  13739. ptr += uintptr(1)
  13740. }
  13741. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13742. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13743. }
  13744. var _CDATA_LSQB = [6]int8{
  13745. 0: int8(m_ASCII_C),
  13746. 1: int8(m_ASCII_D),
  13747. 2: int8(m_ASCII_A),
  13748. 3: int8(m_ASCII_T),
  13749. 4: int8(m_ASCII_A),
  13750. 5: int8(m_ASCII_LSQB1),
  13751. }
  13752. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13753. var n Tsize_t
  13754. _ = n
  13755. if ptr >= end {
  13756. return -int32(4)
  13757. }
  13758. if int32(1) > int32(1) {
  13759. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13760. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13761. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13762. if n == uint64(0) {
  13763. return -int32(1)
  13764. }
  13765. end = ptr + uintptr(n)
  13766. }
  13767. }
  13768. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13769. case int32(_BT_RSQB):
  13770. ptr += uintptr(1)
  13771. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13772. return -int32(1)
  13773. }
  13774. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13775. break
  13776. }
  13777. ptr += uintptr(1)
  13778. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13779. return -int32(1)
  13780. }
  13781. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13782. ptr -= uintptr(1)
  13783. break
  13784. }
  13785. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13786. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13787. case int32(_BT_CR):
  13788. ptr += uintptr(1)
  13789. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13790. return -int32(1)
  13791. }
  13792. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  13793. ptr += uintptr(1)
  13794. }
  13795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13796. return int32(m_XML_TOK_DATA_NEWLINE)
  13797. case int32(_BT_LF):
  13798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13799. return int32(m_XML_TOK_DATA_NEWLINE)
  13800. case int32(_BT_LEAD2):
  13801. if int64(end)-int64(ptr) < int64(2) {
  13802. return -int32(2)
  13803. }
  13804. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13806. return m_XML_TOK_INVALID
  13807. }
  13808. ptr += uintptr(2)
  13809. case int32(_BT_LEAD3):
  13810. if int64(end)-int64(ptr) < int64(3) {
  13811. return -int32(2)
  13812. }
  13813. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13815. return m_XML_TOK_INVALID
  13816. }
  13817. ptr += uintptr(3)
  13818. case int32(_BT_LEAD4):
  13819. if int64(end)-int64(ptr) < int64(4) {
  13820. return -int32(2)
  13821. }
  13822. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13824. return m_XML_TOK_INVALID
  13825. }
  13826. ptr += uintptr(4)
  13827. case int32(_BT_NONXML):
  13828. fallthrough
  13829. case int32(_BT_MALFORM):
  13830. fallthrough
  13831. case int32(_BT_TRAIL):
  13832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13833. return m_XML_TOK_INVALID
  13834. default:
  13835. ptr += uintptr(1)
  13836. break
  13837. }
  13838. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13839. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13840. case int32(_BT_LEAD2):
  13841. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13843. return int32(m_XML_TOK_DATA_CHARS)
  13844. }
  13845. ptr += uintptr(2)
  13846. case int32(_BT_LEAD3):
  13847. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13849. return int32(m_XML_TOK_DATA_CHARS)
  13850. }
  13851. ptr += uintptr(3)
  13852. case int32(_BT_LEAD4):
  13853. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13855. return int32(m_XML_TOK_DATA_CHARS)
  13856. }
  13857. ptr += uintptr(4)
  13858. case int32(_BT_NONXML):
  13859. fallthrough
  13860. case int32(_BT_MALFORM):
  13861. fallthrough
  13862. case int32(_BT_TRAIL):
  13863. fallthrough
  13864. case int32(_BT_CR):
  13865. fallthrough
  13866. case int32(_BT_LF):
  13867. fallthrough
  13868. case int32(_BT_RSQB):
  13869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13870. return int32(m_XML_TOK_DATA_CHARS)
  13871. default:
  13872. ptr += uintptr(1)
  13873. break
  13874. }
  13875. }
  13876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13877. return int32(m_XML_TOK_DATA_CHARS)
  13878. }
  13879. /* ptr points to character following "</" */
  13880. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13881. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13882. return -int32(1)
  13883. }
  13884. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13885. case int32(_BT_NONASCII):
  13886. if !(libc.Int32FromInt32(0) != 0) {
  13887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13888. return m_XML_TOK_INVALID
  13889. } /* fall through */
  13890. fallthrough
  13891. case int32(_BT_NMSTRT):
  13892. fallthrough
  13893. case int32(_BT_HEX):
  13894. ptr += uintptr(1)
  13895. case int32(_BT_LEAD2):
  13896. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13897. return -int32(2)
  13898. }
  13899. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  13900. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13901. return m_XML_TOK_INVALID
  13902. }
  13903. ptr += uintptr(2)
  13904. case int32(_BT_LEAD3):
  13905. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13906. return -int32(2)
  13907. }
  13908. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  13909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13910. return m_XML_TOK_INVALID
  13911. }
  13912. ptr += uintptr(3)
  13913. case int32(_BT_LEAD4):
  13914. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13915. return -int32(2)
  13916. }
  13917. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  13918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13919. return m_XML_TOK_INVALID
  13920. }
  13921. ptr += uintptr(4)
  13922. default:
  13923. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13924. return m_XML_TOK_INVALID
  13925. }
  13926. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13927. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13928. case int32(_BT_NONASCII):
  13929. goto _1
  13930. case int32(_BT_MINUS):
  13931. goto _2
  13932. case int32(_BT_NAME):
  13933. goto _3
  13934. case int32(_BT_DIGIT):
  13935. goto _4
  13936. case int32(_BT_HEX):
  13937. goto _5
  13938. case int32(_BT_NMSTRT):
  13939. goto _6
  13940. case int32(_BT_LEAD2):
  13941. goto _7
  13942. case int32(_BT_LEAD3):
  13943. goto _8
  13944. case int32(_BT_LEAD4):
  13945. goto _9
  13946. case int32(_BT_LF):
  13947. goto _10
  13948. case int32(_BT_CR):
  13949. goto _11
  13950. case int32(_BT_S):
  13951. goto _12
  13952. case int32(_BT_COLON):
  13953. goto _13
  13954. case int32(_BT_GT):
  13955. goto _14
  13956. default:
  13957. goto _15
  13958. }
  13959. goto _16
  13960. _1:
  13961. ;
  13962. if !(libc.Int32FromInt32(0) != 0) {
  13963. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13964. return m_XML_TOK_INVALID
  13965. } /* fall through */
  13966. _6:
  13967. ;
  13968. _5:
  13969. ;
  13970. _4:
  13971. ;
  13972. _3:
  13973. ;
  13974. _2:
  13975. ;
  13976. ptr += uintptr(1)
  13977. goto _16
  13978. _7:
  13979. ;
  13980. if int64(end)-int64(ptr) < int64(2) {
  13981. return -int32(2)
  13982. }
  13983. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13985. return m_XML_TOK_INVALID
  13986. }
  13987. ptr += uintptr(2)
  13988. goto _16
  13989. _8:
  13990. ;
  13991. if int64(end)-int64(ptr) < int64(3) {
  13992. return -int32(2)
  13993. }
  13994. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13996. return m_XML_TOK_INVALID
  13997. }
  13998. ptr += uintptr(3)
  13999. goto _16
  14000. _9:
  14001. ;
  14002. if int64(end)-int64(ptr) < int64(4) {
  14003. return -int32(2)
  14004. }
  14005. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  14006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14007. return m_XML_TOK_INVALID
  14008. }
  14009. ptr += uintptr(4)
  14010. goto _16
  14011. _12:
  14012. ;
  14013. _11:
  14014. ;
  14015. _10:
  14016. ;
  14017. ptr += uintptr(1)
  14018. _19:
  14019. ;
  14020. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14021. goto _17
  14022. }
  14023. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14024. case int32(_BT_S):
  14025. fallthrough
  14026. case int32(_BT_CR):
  14027. fallthrough
  14028. case int32(_BT_LF):
  14029. case int32(_BT_GT):
  14030. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14031. return int32(m_XML_TOK_END_TAG)
  14032. default:
  14033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14034. return m_XML_TOK_INVALID
  14035. }
  14036. goto _18
  14037. _18:
  14038. ;
  14039. ptr += uintptr(1)
  14040. goto _19
  14041. goto _17
  14042. _17:
  14043. ;
  14044. return -int32(1)
  14045. _13:
  14046. ;
  14047. /* no need to check qname syntax here,
  14048. since end-tag must match exactly */
  14049. ptr += uintptr(1)
  14050. goto _16
  14051. _14:
  14052. ;
  14053. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14054. return int32(m_XML_TOK_END_TAG)
  14055. _15:
  14056. ;
  14057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14058. return m_XML_TOK_INVALID
  14059. _16:
  14060. }
  14061. return -int32(1)
  14062. }
  14063. /* ptr points to character following "&#X" */
  14064. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14065. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14066. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14067. case int32(_BT_DIGIT):
  14068. fallthrough
  14069. case int32(_BT_HEX):
  14070. default:
  14071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14072. return m_XML_TOK_INVALID
  14073. }
  14074. ptr += uintptr(1)
  14075. for {
  14076. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14077. break
  14078. }
  14079. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14080. case int32(_BT_DIGIT):
  14081. fallthrough
  14082. case int32(_BT_HEX):
  14083. case int32(_BT_SEMI):
  14084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14085. return int32(m_XML_TOK_CHAR_REF)
  14086. default:
  14087. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14088. return m_XML_TOK_INVALID
  14089. }
  14090. goto _1
  14091. _1:
  14092. ;
  14093. ptr += uintptr(1)
  14094. }
  14095. }
  14096. return -int32(1)
  14097. }
  14098. /* ptr points to character following "&#" */
  14099. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14100. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14101. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  14102. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14103. }
  14104. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14105. case int32(_BT_DIGIT):
  14106. default:
  14107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14108. return m_XML_TOK_INVALID
  14109. }
  14110. ptr += uintptr(1)
  14111. for {
  14112. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14113. break
  14114. }
  14115. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14116. case int32(_BT_DIGIT):
  14117. case int32(_BT_SEMI):
  14118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14119. return int32(m_XML_TOK_CHAR_REF)
  14120. default:
  14121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14122. return m_XML_TOK_INVALID
  14123. }
  14124. goto _1
  14125. _1:
  14126. ;
  14127. ptr += uintptr(1)
  14128. }
  14129. }
  14130. return -int32(1)
  14131. }
  14132. /* ptr points to character following "&" */
  14133. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14134. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14135. return -int32(1)
  14136. }
  14137. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14138. case int32(_BT_NONASCII):
  14139. if !(libc.Int32FromInt32(0) != 0) {
  14140. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14141. return m_XML_TOK_INVALID
  14142. } /* fall through */
  14143. fallthrough
  14144. case int32(_BT_NMSTRT):
  14145. fallthrough
  14146. case int32(_BT_HEX):
  14147. ptr += uintptr(1)
  14148. case int32(_BT_LEAD2):
  14149. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14150. return -int32(2)
  14151. }
  14152. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14153. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14154. return m_XML_TOK_INVALID
  14155. }
  14156. ptr += uintptr(2)
  14157. case int32(_BT_LEAD3):
  14158. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14159. return -int32(2)
  14160. }
  14161. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14162. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14163. return m_XML_TOK_INVALID
  14164. }
  14165. ptr += uintptr(3)
  14166. case int32(_BT_LEAD4):
  14167. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14168. return -int32(2)
  14169. }
  14170. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14171. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14172. return m_XML_TOK_INVALID
  14173. }
  14174. ptr += uintptr(4)
  14175. case int32(_BT_NUM):
  14176. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14177. default:
  14178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14179. return m_XML_TOK_INVALID
  14180. }
  14181. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14182. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14183. case int32(_BT_NONASCII):
  14184. if !(libc.Int32FromInt32(0) != 0) {
  14185. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14186. return m_XML_TOK_INVALID
  14187. } /* fall through */
  14188. fallthrough
  14189. case int32(_BT_NMSTRT):
  14190. fallthrough
  14191. case int32(_BT_HEX):
  14192. fallthrough
  14193. case int32(_BT_DIGIT):
  14194. fallthrough
  14195. case int32(_BT_NAME):
  14196. fallthrough
  14197. case int32(_BT_MINUS):
  14198. ptr += uintptr(1)
  14199. case int32(_BT_LEAD2):
  14200. if int64(end)-int64(ptr) < int64(2) {
  14201. return -int32(2)
  14202. }
  14203. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  14204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14205. return m_XML_TOK_INVALID
  14206. }
  14207. ptr += uintptr(2)
  14208. case int32(_BT_LEAD3):
  14209. if int64(end)-int64(ptr) < int64(3) {
  14210. return -int32(2)
  14211. }
  14212. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  14213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14214. return m_XML_TOK_INVALID
  14215. }
  14216. ptr += uintptr(3)
  14217. case int32(_BT_LEAD4):
  14218. if int64(end)-int64(ptr) < int64(4) {
  14219. return -int32(2)
  14220. }
  14221. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  14222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14223. return m_XML_TOK_INVALID
  14224. }
  14225. ptr += uintptr(4)
  14226. case int32(_BT_SEMI):
  14227. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14228. return int32(m_XML_TOK_ENTITY_REF)
  14229. default:
  14230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14231. return m_XML_TOK_INVALID
  14232. }
  14233. }
  14234. return -int32(1)
  14235. }
  14236. /* ptr points to character following first character of attribute name */
  14237. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14238. bp := tls.Alloc(16)
  14239. defer tls.Free(16)
  14240. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  14241. var hadColon, open, t, t1, tok int32
  14242. _, _, _, _, _ = hadColon, open, t, t1, tok
  14243. hadColon = 0
  14244. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14245. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14246. case int32(_BT_NONASCII):
  14247. goto _1
  14248. case int32(_BT_MINUS):
  14249. goto _2
  14250. case int32(_BT_NAME):
  14251. goto _3
  14252. case int32(_BT_DIGIT):
  14253. goto _4
  14254. case int32(_BT_HEX):
  14255. goto _5
  14256. case int32(_BT_NMSTRT):
  14257. goto _6
  14258. case int32(_BT_LEAD2):
  14259. goto _7
  14260. case int32(_BT_LEAD3):
  14261. goto _8
  14262. case int32(_BT_LEAD4):
  14263. goto _9
  14264. case int32(_BT_COLON):
  14265. goto _10
  14266. case int32(_BT_LF):
  14267. goto _11
  14268. case int32(_BT_CR):
  14269. goto _12
  14270. case int32(_BT_S):
  14271. goto _13
  14272. case int32(_BT_EQUALS):
  14273. goto _14
  14274. default:
  14275. goto _15
  14276. }
  14277. goto _16
  14278. _1:
  14279. ;
  14280. if !(libc.Int32FromInt32(0) != 0) {
  14281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14282. return m_XML_TOK_INVALID
  14283. } /* fall through */
  14284. _6:
  14285. ;
  14286. _5:
  14287. ;
  14288. _4:
  14289. ;
  14290. _3:
  14291. ;
  14292. _2:
  14293. ;
  14294. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14295. goto _16
  14296. _7:
  14297. ;
  14298. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14299. return -int32(2)
  14300. }
  14301. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14303. return m_XML_TOK_INVALID
  14304. }
  14305. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14306. goto _16
  14307. _8:
  14308. ;
  14309. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14310. return -int32(2)
  14311. }
  14312. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14313. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14314. return m_XML_TOK_INVALID
  14315. }
  14316. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14317. goto _16
  14318. _9:
  14319. ;
  14320. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14321. return -int32(2)
  14322. }
  14323. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14325. return m_XML_TOK_INVALID
  14326. }
  14327. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14328. goto _16
  14329. _10:
  14330. ;
  14331. if hadColon != 0 {
  14332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14333. return m_XML_TOK_INVALID
  14334. }
  14335. hadColon = int32(1)
  14336. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14337. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14338. return -int32(1)
  14339. }
  14340. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14341. case int32(_BT_NONASCII):
  14342. if !(libc.Int32FromInt32(0) != 0) {
  14343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14344. return m_XML_TOK_INVALID
  14345. } /* fall through */
  14346. fallthrough
  14347. case int32(_BT_NMSTRT):
  14348. fallthrough
  14349. case int32(_BT_HEX):
  14350. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14351. case int32(_BT_LEAD2):
  14352. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14353. return -int32(2)
  14354. }
  14355. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14357. return m_XML_TOK_INVALID
  14358. }
  14359. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14360. case int32(_BT_LEAD3):
  14361. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14362. return -int32(2)
  14363. }
  14364. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14365. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14366. return m_XML_TOK_INVALID
  14367. }
  14368. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14369. case int32(_BT_LEAD4):
  14370. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14371. return -int32(2)
  14372. }
  14373. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14375. return m_XML_TOK_INVALID
  14376. }
  14377. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14378. default:
  14379. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14380. return m_XML_TOK_INVALID
  14381. }
  14382. goto _16
  14383. _13:
  14384. ;
  14385. _12:
  14386. ;
  14387. _11:
  14388. ;
  14389. _19:
  14390. ;
  14391. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14392. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14393. return -int32(1)
  14394. }
  14395. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14396. if t == int32(_BT_EQUALS) {
  14397. goto _17
  14398. }
  14399. switch t {
  14400. case int32(_BT_S):
  14401. fallthrough
  14402. case int32(_BT_LF):
  14403. fallthrough
  14404. case int32(_BT_CR):
  14405. default:
  14406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14407. return m_XML_TOK_INVALID
  14408. }
  14409. goto _18
  14410. _18:
  14411. ;
  14412. goto _19
  14413. goto _17
  14414. _17:
  14415. ;
  14416. /* fall through */
  14417. _14:
  14418. ;
  14419. hadColon = 0
  14420. for {
  14421. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14422. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14423. return -int32(1)
  14424. }
  14425. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14426. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14427. break
  14428. }
  14429. switch open {
  14430. case int32(_BT_S):
  14431. fallthrough
  14432. case int32(_BT_LF):
  14433. fallthrough
  14434. case int32(_BT_CR):
  14435. default:
  14436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14437. return m_XML_TOK_INVALID
  14438. }
  14439. goto _20
  14440. _20:
  14441. }
  14442. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14443. /* in attribute value */
  14444. for {
  14445. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14446. return -int32(1)
  14447. }
  14448. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14449. if t1 == open {
  14450. break
  14451. }
  14452. switch t1 {
  14453. case int32(_BT_LEAD2):
  14454. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14455. return -int32(2)
  14456. }
  14457. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14459. return m_XML_TOK_INVALID
  14460. }
  14461. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14462. case int32(_BT_LEAD3):
  14463. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14464. return -int32(2)
  14465. }
  14466. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14468. return m_XML_TOK_INVALID
  14469. }
  14470. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14471. case int32(_BT_LEAD4):
  14472. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14473. return -int32(2)
  14474. }
  14475. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14476. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14477. return m_XML_TOK_INVALID
  14478. }
  14479. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14480. case int32(_BT_NONXML):
  14481. fallthrough
  14482. case int32(_BT_MALFORM):
  14483. fallthrough
  14484. case int32(_BT_TRAIL):
  14485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14486. return m_XML_TOK_INVALID
  14487. case int32(_BT_AMP):
  14488. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14489. if tok <= 0 {
  14490. if tok == m_XML_TOK_INVALID {
  14491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14492. }
  14493. return tok
  14494. }
  14495. case int32(_BT_LT):
  14496. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14497. return m_XML_TOK_INVALID
  14498. default:
  14499. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14500. break
  14501. }
  14502. goto _21
  14503. _21:
  14504. }
  14505. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14506. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14507. return -int32(1)
  14508. }
  14509. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14510. case int32(_BT_S):
  14511. fallthrough
  14512. case int32(_BT_CR):
  14513. fallthrough
  14514. case int32(_BT_LF):
  14515. case int32(_BT_SOL):
  14516. goto sol
  14517. case int32(_BT_GT):
  14518. goto gt
  14519. default:
  14520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14521. return m_XML_TOK_INVALID
  14522. }
  14523. /* ptr points to closing quote */
  14524. _24:
  14525. ;
  14526. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14527. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14528. return -int32(1)
  14529. }
  14530. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14531. case int32(_BT_NONASCII):
  14532. goto _25
  14533. case int32(_BT_HEX):
  14534. goto _26
  14535. case int32(_BT_NMSTRT):
  14536. goto _27
  14537. case int32(_BT_LEAD2):
  14538. goto _28
  14539. case int32(_BT_LEAD3):
  14540. goto _29
  14541. case int32(_BT_LEAD4):
  14542. goto _30
  14543. case int32(_BT_LF):
  14544. goto _31
  14545. case int32(_BT_CR):
  14546. goto _32
  14547. case int32(_BT_S):
  14548. goto _33
  14549. case int32(_BT_GT):
  14550. goto _34
  14551. case int32(_BT_SOL):
  14552. goto _35
  14553. default:
  14554. goto _36
  14555. }
  14556. goto _37
  14557. _25:
  14558. ;
  14559. if !(libc.Int32FromInt32(0) != 0) {
  14560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14561. return m_XML_TOK_INVALID
  14562. } /* fall through */
  14563. _27:
  14564. ;
  14565. _26:
  14566. ;
  14567. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14568. goto _37
  14569. _28:
  14570. ;
  14571. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14572. return -int32(2)
  14573. }
  14574. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14576. return m_XML_TOK_INVALID
  14577. }
  14578. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14579. goto _37
  14580. _29:
  14581. ;
  14582. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14583. return -int32(2)
  14584. }
  14585. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14586. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14587. return m_XML_TOK_INVALID
  14588. }
  14589. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14590. goto _37
  14591. _30:
  14592. ;
  14593. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14594. return -int32(2)
  14595. }
  14596. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  14597. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14598. return m_XML_TOK_INVALID
  14599. }
  14600. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14601. goto _37
  14602. _33:
  14603. ;
  14604. _32:
  14605. ;
  14606. _31:
  14607. ;
  14608. goto _23
  14609. _34:
  14610. ;
  14611. goto gt
  14612. gt:
  14613. ;
  14614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14615. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14616. _35:
  14617. ;
  14618. goto sol
  14619. sol:
  14620. ;
  14621. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14622. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14623. return -int32(1)
  14624. }
  14625. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14626. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14627. return m_XML_TOK_INVALID
  14628. }
  14629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14630. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14631. _36:
  14632. ;
  14633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14634. return m_XML_TOK_INVALID
  14635. _37:
  14636. ;
  14637. goto _22
  14638. goto _23
  14639. _23:
  14640. ;
  14641. goto _24
  14642. goto _22
  14643. _22:
  14644. ;
  14645. goto _16
  14646. _15:
  14647. ;
  14648. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14649. return m_XML_TOK_INVALID
  14650. _16:
  14651. }
  14652. return -int32(1)
  14653. }
  14654. /* ptr points to character following "<" */
  14655. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14656. var hadColon int32
  14657. _ = hadColon
  14658. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14659. return -int32(1)
  14660. }
  14661. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14662. case int32(_BT_NONASCII):
  14663. if !(libc.Int32FromInt32(0) != 0) {
  14664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14665. return m_XML_TOK_INVALID
  14666. } /* fall through */
  14667. fallthrough
  14668. case int32(_BT_NMSTRT):
  14669. fallthrough
  14670. case int32(_BT_HEX):
  14671. ptr += uintptr(1)
  14672. case int32(_BT_LEAD2):
  14673. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14674. return -int32(2)
  14675. }
  14676. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14678. return m_XML_TOK_INVALID
  14679. }
  14680. ptr += uintptr(2)
  14681. case int32(_BT_LEAD3):
  14682. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14683. return -int32(2)
  14684. }
  14685. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14687. return m_XML_TOK_INVALID
  14688. }
  14689. ptr += uintptr(3)
  14690. case int32(_BT_LEAD4):
  14691. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14692. return -int32(2)
  14693. }
  14694. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14696. return m_XML_TOK_INVALID
  14697. }
  14698. ptr += uintptr(4)
  14699. case int32(_BT_EXCL):
  14700. ptr += uintptr(1)
  14701. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14702. return -int32(1)
  14703. }
  14704. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14705. case int32(_BT_MINUS):
  14706. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14707. case int32(_BT_LSQB):
  14708. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14709. }
  14710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14711. return m_XML_TOK_INVALID
  14712. case int32(_BT_QUEST):
  14713. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14714. case int32(_BT_SOL):
  14715. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14716. default:
  14717. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14718. return m_XML_TOK_INVALID
  14719. }
  14720. hadColon = 0
  14721. /* we have a start-tag */
  14722. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14723. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14724. case int32(_BT_NONASCII):
  14725. goto _1
  14726. case int32(_BT_MINUS):
  14727. goto _2
  14728. case int32(_BT_NAME):
  14729. goto _3
  14730. case int32(_BT_DIGIT):
  14731. goto _4
  14732. case int32(_BT_HEX):
  14733. goto _5
  14734. case int32(_BT_NMSTRT):
  14735. goto _6
  14736. case int32(_BT_LEAD2):
  14737. goto _7
  14738. case int32(_BT_LEAD3):
  14739. goto _8
  14740. case int32(_BT_LEAD4):
  14741. goto _9
  14742. case int32(_BT_COLON):
  14743. goto _10
  14744. case int32(_BT_LF):
  14745. goto _11
  14746. case int32(_BT_CR):
  14747. goto _12
  14748. case int32(_BT_S):
  14749. goto _13
  14750. case int32(_BT_GT):
  14751. goto _14
  14752. case int32(_BT_SOL):
  14753. goto _15
  14754. default:
  14755. goto _16
  14756. }
  14757. goto _17
  14758. _1:
  14759. ;
  14760. if !(libc.Int32FromInt32(0) != 0) {
  14761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14762. return m_XML_TOK_INVALID
  14763. } /* fall through */
  14764. _6:
  14765. ;
  14766. _5:
  14767. ;
  14768. _4:
  14769. ;
  14770. _3:
  14771. ;
  14772. _2:
  14773. ;
  14774. ptr += uintptr(1)
  14775. goto _17
  14776. _7:
  14777. ;
  14778. if int64(end)-int64(ptr) < int64(2) {
  14779. return -int32(2)
  14780. }
  14781. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  14782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14783. return m_XML_TOK_INVALID
  14784. }
  14785. ptr += uintptr(2)
  14786. goto _17
  14787. _8:
  14788. ;
  14789. if int64(end)-int64(ptr) < int64(3) {
  14790. return -int32(2)
  14791. }
  14792. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  14793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14794. return m_XML_TOK_INVALID
  14795. }
  14796. ptr += uintptr(3)
  14797. goto _17
  14798. _9:
  14799. ;
  14800. if int64(end)-int64(ptr) < int64(4) {
  14801. return -int32(2)
  14802. }
  14803. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  14804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14805. return m_XML_TOK_INVALID
  14806. }
  14807. ptr += uintptr(4)
  14808. goto _17
  14809. _10:
  14810. ;
  14811. if hadColon != 0 {
  14812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14813. return m_XML_TOK_INVALID
  14814. }
  14815. hadColon = int32(1)
  14816. ptr += uintptr(1)
  14817. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14818. return -int32(1)
  14819. }
  14820. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14821. case int32(_BT_NONASCII):
  14822. if !(libc.Int32FromInt32(0) != 0) {
  14823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14824. return m_XML_TOK_INVALID
  14825. } /* fall through */
  14826. fallthrough
  14827. case int32(_BT_NMSTRT):
  14828. fallthrough
  14829. case int32(_BT_HEX):
  14830. ptr += uintptr(1)
  14831. case int32(_BT_LEAD2):
  14832. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14833. return -int32(2)
  14834. }
  14835. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14837. return m_XML_TOK_INVALID
  14838. }
  14839. ptr += uintptr(2)
  14840. case int32(_BT_LEAD3):
  14841. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14842. return -int32(2)
  14843. }
  14844. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14846. return m_XML_TOK_INVALID
  14847. }
  14848. ptr += uintptr(3)
  14849. case int32(_BT_LEAD4):
  14850. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14851. return -int32(2)
  14852. }
  14853. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14855. return m_XML_TOK_INVALID
  14856. }
  14857. ptr += uintptr(4)
  14858. default:
  14859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14860. return m_XML_TOK_INVALID
  14861. }
  14862. goto _17
  14863. _13:
  14864. ;
  14865. _12:
  14866. ;
  14867. _11:
  14868. ;
  14869. ptr += uintptr(1)
  14870. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14871. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14872. case int32(_BT_NONASCII):
  14873. if !(libc.Int32FromInt32(0) != 0) {
  14874. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14875. return m_XML_TOK_INVALID
  14876. } /* fall through */
  14877. fallthrough
  14878. case int32(_BT_NMSTRT):
  14879. fallthrough
  14880. case int32(_BT_HEX):
  14881. ptr += uintptr(1)
  14882. case int32(_BT_LEAD2):
  14883. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14884. return -int32(2)
  14885. }
  14886. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  14887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14888. return m_XML_TOK_INVALID
  14889. }
  14890. ptr += uintptr(2)
  14891. case int32(_BT_LEAD3):
  14892. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14893. return -int32(2)
  14894. }
  14895. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14897. return m_XML_TOK_INVALID
  14898. }
  14899. ptr += uintptr(3)
  14900. case int32(_BT_LEAD4):
  14901. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14902. return -int32(2)
  14903. }
  14904. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  14905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14906. return m_XML_TOK_INVALID
  14907. }
  14908. ptr += uintptr(4)
  14909. case int32(_BT_GT):
  14910. goto gt
  14911. case int32(_BT_SOL):
  14912. goto sol
  14913. case int32(_BT_S):
  14914. fallthrough
  14915. case int32(_BT_CR):
  14916. fallthrough
  14917. case int32(_BT_LF):
  14918. ptr += uintptr(1)
  14919. continue
  14920. default:
  14921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14922. return m_XML_TOK_INVALID
  14923. }
  14924. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14925. }
  14926. return -int32(1)
  14927. _14:
  14928. ;
  14929. goto gt
  14930. gt:
  14931. ;
  14932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14933. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14934. _15:
  14935. ;
  14936. goto sol
  14937. sol:
  14938. ;
  14939. ptr += uintptr(1)
  14940. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14941. return -int32(1)
  14942. }
  14943. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14944. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14945. return m_XML_TOK_INVALID
  14946. }
  14947. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14948. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14949. _16:
  14950. ;
  14951. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14952. return m_XML_TOK_INVALID
  14953. _17:
  14954. }
  14955. return -int32(1)
  14956. }
  14957. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14958. var n Tsize_t
  14959. _ = n
  14960. if ptr >= end {
  14961. return -int32(4)
  14962. }
  14963. if int32(1) > int32(1) {
  14964. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  14965. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14966. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14967. if n == uint64(0) {
  14968. return -int32(1)
  14969. }
  14970. end = ptr + uintptr(n)
  14971. }
  14972. }
  14973. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14974. case int32(_BT_LT):
  14975. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14976. case int32(_BT_AMP):
  14977. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14978. case int32(_BT_CR):
  14979. ptr += uintptr(1)
  14980. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14981. return -int32(3)
  14982. }
  14983. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  14984. ptr += uintptr(1)
  14985. }
  14986. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14987. return int32(m_XML_TOK_DATA_NEWLINE)
  14988. case int32(_BT_LF):
  14989. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14990. return int32(m_XML_TOK_DATA_NEWLINE)
  14991. case int32(_BT_RSQB):
  14992. ptr += uintptr(1)
  14993. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14994. return -int32(5)
  14995. }
  14996. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14997. break
  14998. }
  14999. ptr += uintptr(1)
  15000. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15001. return -int32(5)
  15002. }
  15003. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  15004. ptr -= uintptr(1)
  15005. break
  15006. }
  15007. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15008. return m_XML_TOK_INVALID
  15009. case int32(_BT_LEAD2):
  15010. if int64(end)-int64(ptr) < int64(2) {
  15011. return -int32(2)
  15012. }
  15013. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15014. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15015. return m_XML_TOK_INVALID
  15016. }
  15017. ptr += uintptr(2)
  15018. case int32(_BT_LEAD3):
  15019. if int64(end)-int64(ptr) < int64(3) {
  15020. return -int32(2)
  15021. }
  15022. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15024. return m_XML_TOK_INVALID
  15025. }
  15026. ptr += uintptr(3)
  15027. case int32(_BT_LEAD4):
  15028. if int64(end)-int64(ptr) < int64(4) {
  15029. return -int32(2)
  15030. }
  15031. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15032. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15033. return m_XML_TOK_INVALID
  15034. }
  15035. ptr += uintptr(4)
  15036. case int32(_BT_NONXML):
  15037. fallthrough
  15038. case int32(_BT_MALFORM):
  15039. fallthrough
  15040. case int32(_BT_TRAIL):
  15041. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15042. return m_XML_TOK_INVALID
  15043. default:
  15044. ptr += uintptr(1)
  15045. break
  15046. }
  15047. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15048. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15049. case int32(_BT_LEAD2):
  15050. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15052. return int32(m_XML_TOK_DATA_CHARS)
  15053. }
  15054. ptr += uintptr(2)
  15055. case int32(_BT_LEAD3):
  15056. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15058. return int32(m_XML_TOK_DATA_CHARS)
  15059. }
  15060. ptr += uintptr(3)
  15061. case int32(_BT_LEAD4):
  15062. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15063. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15064. return int32(m_XML_TOK_DATA_CHARS)
  15065. }
  15066. ptr += uintptr(4)
  15067. case int32(_BT_RSQB):
  15068. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  15069. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  15070. ptr += uintptr(1)
  15071. break
  15072. }
  15073. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  15074. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  15075. ptr += uintptr(1)
  15076. break
  15077. }
  15078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15079. return m_XML_TOK_INVALID
  15080. }
  15081. }
  15082. /* fall through */
  15083. fallthrough
  15084. case int32(_BT_AMP):
  15085. fallthrough
  15086. case int32(_BT_LT):
  15087. fallthrough
  15088. case int32(_BT_NONXML):
  15089. fallthrough
  15090. case int32(_BT_MALFORM):
  15091. fallthrough
  15092. case int32(_BT_TRAIL):
  15093. fallthrough
  15094. case int32(_BT_CR):
  15095. fallthrough
  15096. case int32(_BT_LF):
  15097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15098. return int32(m_XML_TOK_DATA_CHARS)
  15099. default:
  15100. ptr += uintptr(1)
  15101. break
  15102. }
  15103. }
  15104. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15105. return int32(m_XML_TOK_DATA_CHARS)
  15106. }
  15107. /* ptr points to character following "%" */
  15108. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15109. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15110. return -int32(1)
  15111. }
  15112. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15113. case int32(_BT_NONASCII):
  15114. if !(libc.Int32FromInt32(0) != 0) {
  15115. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15116. return m_XML_TOK_INVALID
  15117. } /* fall through */
  15118. fallthrough
  15119. case int32(_BT_NMSTRT):
  15120. fallthrough
  15121. case int32(_BT_HEX):
  15122. ptr += uintptr(1)
  15123. case int32(_BT_LEAD2):
  15124. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  15125. return -int32(2)
  15126. }
  15127. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  15128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15129. return m_XML_TOK_INVALID
  15130. }
  15131. ptr += uintptr(2)
  15132. case int32(_BT_LEAD3):
  15133. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15134. return -int32(2)
  15135. }
  15136. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  15137. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15138. return m_XML_TOK_INVALID
  15139. }
  15140. ptr += uintptr(3)
  15141. case int32(_BT_LEAD4):
  15142. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15143. return -int32(2)
  15144. }
  15145. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  15146. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15147. return m_XML_TOK_INVALID
  15148. }
  15149. ptr += uintptr(4)
  15150. case int32(_BT_S):
  15151. fallthrough
  15152. case int32(_BT_LF):
  15153. fallthrough
  15154. case int32(_BT_CR):
  15155. fallthrough
  15156. case int32(_BT_PERCNT):
  15157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15158. return int32(m_XML_TOK_PERCENT)
  15159. default:
  15160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15161. return m_XML_TOK_INVALID
  15162. }
  15163. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15164. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15165. case int32(_BT_NONASCII):
  15166. if !(libc.Int32FromInt32(0) != 0) {
  15167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15168. return m_XML_TOK_INVALID
  15169. } /* fall through */
  15170. fallthrough
  15171. case int32(_BT_NMSTRT):
  15172. fallthrough
  15173. case int32(_BT_HEX):
  15174. fallthrough
  15175. case int32(_BT_DIGIT):
  15176. fallthrough
  15177. case int32(_BT_NAME):
  15178. fallthrough
  15179. case int32(_BT_MINUS):
  15180. ptr += uintptr(1)
  15181. case int32(_BT_LEAD2):
  15182. if int64(end)-int64(ptr) < int64(2) {
  15183. return -int32(2)
  15184. }
  15185. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15187. return m_XML_TOK_INVALID
  15188. }
  15189. ptr += uintptr(2)
  15190. case int32(_BT_LEAD3):
  15191. if int64(end)-int64(ptr) < int64(3) {
  15192. return -int32(2)
  15193. }
  15194. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15195. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15196. return m_XML_TOK_INVALID
  15197. }
  15198. ptr += uintptr(3)
  15199. case int32(_BT_LEAD4):
  15200. if int64(end)-int64(ptr) < int64(4) {
  15201. return -int32(2)
  15202. }
  15203. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15205. return m_XML_TOK_INVALID
  15206. }
  15207. ptr += uintptr(4)
  15208. case int32(_BT_SEMI):
  15209. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15210. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  15211. default:
  15212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15213. return m_XML_TOK_INVALID
  15214. }
  15215. }
  15216. return -int32(1)
  15217. }
  15218. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15219. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15220. return -int32(1)
  15221. }
  15222. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15223. case int32(_BT_NONASCII):
  15224. if !(libc.Int32FromInt32(0) != 0) {
  15225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15226. return m_XML_TOK_INVALID
  15227. } /* fall through */
  15228. fallthrough
  15229. case int32(_BT_NMSTRT):
  15230. fallthrough
  15231. case int32(_BT_HEX):
  15232. ptr += uintptr(1)
  15233. case int32(_BT_LEAD2):
  15234. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  15235. return -int32(2)
  15236. }
  15237. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  15238. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15239. return m_XML_TOK_INVALID
  15240. }
  15241. ptr += uintptr(2)
  15242. case int32(_BT_LEAD3):
  15243. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15244. return -int32(2)
  15245. }
  15246. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  15247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15248. return m_XML_TOK_INVALID
  15249. }
  15250. ptr += uintptr(3)
  15251. case int32(_BT_LEAD4):
  15252. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15253. return -int32(2)
  15254. }
  15255. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  15256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15257. return m_XML_TOK_INVALID
  15258. }
  15259. ptr += uintptr(4)
  15260. default:
  15261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15262. return m_XML_TOK_INVALID
  15263. }
  15264. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15265. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15266. case int32(_BT_NONASCII):
  15267. if !(libc.Int32FromInt32(0) != 0) {
  15268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15269. return m_XML_TOK_INVALID
  15270. } /* fall through */
  15271. fallthrough
  15272. case int32(_BT_NMSTRT):
  15273. fallthrough
  15274. case int32(_BT_HEX):
  15275. fallthrough
  15276. case int32(_BT_DIGIT):
  15277. fallthrough
  15278. case int32(_BT_NAME):
  15279. fallthrough
  15280. case int32(_BT_MINUS):
  15281. ptr += uintptr(1)
  15282. case int32(_BT_LEAD2):
  15283. if int64(end)-int64(ptr) < int64(2) {
  15284. return -int32(2)
  15285. }
  15286. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15288. return m_XML_TOK_INVALID
  15289. }
  15290. ptr += uintptr(2)
  15291. case int32(_BT_LEAD3):
  15292. if int64(end)-int64(ptr) < int64(3) {
  15293. return -int32(2)
  15294. }
  15295. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15296. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15297. return m_XML_TOK_INVALID
  15298. }
  15299. ptr += uintptr(3)
  15300. case int32(_BT_LEAD4):
  15301. if int64(end)-int64(ptr) < int64(4) {
  15302. return -int32(2)
  15303. }
  15304. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15306. return m_XML_TOK_INVALID
  15307. }
  15308. ptr += uintptr(4)
  15309. case int32(_BT_CR):
  15310. fallthrough
  15311. case int32(_BT_LF):
  15312. fallthrough
  15313. case int32(_BT_S):
  15314. fallthrough
  15315. case int32(_BT_RPAR):
  15316. fallthrough
  15317. case int32(_BT_GT):
  15318. fallthrough
  15319. case int32(_BT_PERCNT):
  15320. fallthrough
  15321. case int32(_BT_VERBAR):
  15322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15323. return int32(m_XML_TOK_POUND_NAME)
  15324. default:
  15325. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15326. return m_XML_TOK_INVALID
  15327. }
  15328. }
  15329. return -int32(m_XML_TOK_POUND_NAME)
  15330. }
  15331. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15332. var t int32
  15333. _ = t
  15334. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15335. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  15336. switch t {
  15337. case int32(_BT_LEAD2):
  15338. if int64(end)-int64(ptr) < int64(2) {
  15339. return -int32(2)
  15340. }
  15341. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15343. return m_XML_TOK_INVALID
  15344. }
  15345. ptr += uintptr(2)
  15346. case int32(_BT_LEAD3):
  15347. if int64(end)-int64(ptr) < int64(3) {
  15348. return -int32(2)
  15349. }
  15350. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15351. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15352. return m_XML_TOK_INVALID
  15353. }
  15354. ptr += uintptr(3)
  15355. case int32(_BT_LEAD4):
  15356. if int64(end)-int64(ptr) < int64(4) {
  15357. return -int32(2)
  15358. }
  15359. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15360. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15361. return m_XML_TOK_INVALID
  15362. }
  15363. ptr += uintptr(4)
  15364. case int32(_BT_NONXML):
  15365. fallthrough
  15366. case int32(_BT_MALFORM):
  15367. fallthrough
  15368. case int32(_BT_TRAIL):
  15369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15370. return m_XML_TOK_INVALID
  15371. case int32(_BT_QUOT):
  15372. fallthrough
  15373. case int32(_BT_APOS):
  15374. ptr += uintptr(1)
  15375. if t != open {
  15376. break
  15377. }
  15378. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15379. return -int32(m_XML_TOK_LITERAL)
  15380. }
  15381. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15382. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15383. case int32(_BT_S):
  15384. fallthrough
  15385. case int32(_BT_CR):
  15386. fallthrough
  15387. case int32(_BT_LF):
  15388. fallthrough
  15389. case int32(_BT_GT):
  15390. fallthrough
  15391. case int32(_BT_PERCNT):
  15392. fallthrough
  15393. case int32(_BT_LSQB):
  15394. return int32(m_XML_TOK_LITERAL)
  15395. default:
  15396. return m_XML_TOK_INVALID
  15397. }
  15398. fallthrough
  15399. default:
  15400. ptr += uintptr(1)
  15401. break
  15402. }
  15403. }
  15404. return -int32(1)
  15405. }
  15406. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15407. var n Tsize_t
  15408. var tok int32
  15409. _, _ = n, tok
  15410. if ptr >= end {
  15411. return -int32(4)
  15412. }
  15413. if int32(1) > int32(1) {
  15414. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15415. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15416. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15417. if n == uint64(0) {
  15418. return -int32(1)
  15419. }
  15420. end = ptr + uintptr(n)
  15421. }
  15422. }
  15423. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15424. case int32(_BT_QUOT):
  15425. goto _1
  15426. case int32(_BT_APOS):
  15427. goto _2
  15428. case int32(_BT_LT):
  15429. goto _3
  15430. case int32(_BT_CR):
  15431. goto _4
  15432. case int32(_BT_LF):
  15433. goto _5
  15434. case int32(_BT_S):
  15435. goto _6
  15436. case int32(_BT_PERCNT):
  15437. goto _7
  15438. case int32(_BT_COMMA):
  15439. goto _8
  15440. case int32(_BT_LSQB):
  15441. goto _9
  15442. case int32(_BT_RSQB):
  15443. goto _10
  15444. case int32(_BT_LPAR):
  15445. goto _11
  15446. case int32(_BT_RPAR):
  15447. goto _12
  15448. case int32(_BT_VERBAR):
  15449. goto _13
  15450. case int32(_BT_GT):
  15451. goto _14
  15452. case int32(_BT_NUM):
  15453. goto _15
  15454. case int32(_BT_LEAD2):
  15455. goto _16
  15456. case int32(_BT_LEAD3):
  15457. goto _17
  15458. case int32(_BT_LEAD4):
  15459. goto _18
  15460. case int32(_BT_HEX):
  15461. goto _19
  15462. case int32(_BT_NMSTRT):
  15463. goto _20
  15464. case int32(_BT_COLON):
  15465. goto _21
  15466. case int32(_BT_MINUS):
  15467. goto _22
  15468. case int32(_BT_NAME):
  15469. goto _23
  15470. case int32(_BT_DIGIT):
  15471. goto _24
  15472. case int32(_BT_NONASCII):
  15473. goto _25
  15474. default:
  15475. goto _26
  15476. }
  15477. goto _27
  15478. _1:
  15479. ;
  15480. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15481. _2:
  15482. ;
  15483. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15484. _3:
  15485. ;
  15486. ptr += uintptr(1)
  15487. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15488. return -int32(1)
  15489. }
  15490. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15491. case int32(_BT_EXCL):
  15492. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15493. case int32(_BT_QUEST):
  15494. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15495. case int32(_BT_NMSTRT):
  15496. fallthrough
  15497. case int32(_BT_HEX):
  15498. fallthrough
  15499. case int32(_BT_NONASCII):
  15500. fallthrough
  15501. case int32(_BT_LEAD2):
  15502. fallthrough
  15503. case int32(_BT_LEAD3):
  15504. fallthrough
  15505. case int32(_BT_LEAD4):
  15506. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15507. return int32(m_XML_TOK_INSTANCE_START)
  15508. }
  15509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15510. return m_XML_TOK_INVALID
  15511. _4:
  15512. ;
  15513. if ptr+uintptr(1) == end {
  15514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15515. /* indicate that this might be part of a CR/LF pair */
  15516. return -int32(m_XML_TOK_PROLOG_S)
  15517. }
  15518. /* fall through */
  15519. _6:
  15520. ;
  15521. _5:
  15522. ;
  15523. _30:
  15524. ;
  15525. ptr += uintptr(1)
  15526. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15527. goto _28
  15528. }
  15529. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15530. case int32(_BT_S):
  15531. fallthrough
  15532. case int32(_BT_LF):
  15533. case int32(_BT_CR):
  15534. /* don't split CR/LF pair */
  15535. if ptr+uintptr(1) != end {
  15536. break
  15537. }
  15538. /* fall through */
  15539. fallthrough
  15540. default:
  15541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15542. return int32(m_XML_TOK_PROLOG_S)
  15543. }
  15544. goto _29
  15545. _29:
  15546. ;
  15547. goto _30
  15548. goto _28
  15549. _28:
  15550. ;
  15551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15552. return int32(m_XML_TOK_PROLOG_S)
  15553. _7:
  15554. ;
  15555. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15556. _8:
  15557. ;
  15558. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15559. return int32(m_XML_TOK_COMMA)
  15560. _9:
  15561. ;
  15562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15563. return int32(m_XML_TOK_OPEN_BRACKET)
  15564. _10:
  15565. ;
  15566. ptr += uintptr(1)
  15567. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15568. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15569. }
  15570. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15571. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  15572. return -int32(1)
  15573. }
  15574. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15576. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15577. }
  15578. }
  15579. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15580. return int32(m_XML_TOK_CLOSE_BRACKET)
  15581. _11:
  15582. ;
  15583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15584. return int32(m_XML_TOK_OPEN_PAREN)
  15585. _12:
  15586. ;
  15587. ptr += uintptr(1)
  15588. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15589. return -int32(m_XML_TOK_CLOSE_PAREN)
  15590. }
  15591. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15592. case int32(_BT_AST):
  15593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15594. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15595. case int32(_BT_QUEST):
  15596. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15597. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15598. case int32(_BT_PLUS):
  15599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15600. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15601. case int32(_BT_CR):
  15602. fallthrough
  15603. case int32(_BT_LF):
  15604. fallthrough
  15605. case int32(_BT_S):
  15606. fallthrough
  15607. case int32(_BT_GT):
  15608. fallthrough
  15609. case int32(_BT_COMMA):
  15610. fallthrough
  15611. case int32(_BT_VERBAR):
  15612. fallthrough
  15613. case int32(_BT_RPAR):
  15614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15615. return int32(m_XML_TOK_CLOSE_PAREN)
  15616. }
  15617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15618. return m_XML_TOK_INVALID
  15619. _13:
  15620. ;
  15621. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15622. return int32(m_XML_TOK_OR)
  15623. _14:
  15624. ;
  15625. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15626. return int32(m_XML_TOK_DECL_CLOSE)
  15627. _15:
  15628. ;
  15629. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15630. _16:
  15631. ;
  15632. if int64(end)-int64(ptr) < int64(2) {
  15633. return -int32(2)
  15634. }
  15635. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15636. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15637. return m_XML_TOK_INVALID
  15638. }
  15639. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15640. ptr += uintptr(2)
  15641. tok = int32(m_XML_TOK_NAME)
  15642. goto _27
  15643. }
  15644. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15645. ptr += uintptr(2)
  15646. tok = int32(m_XML_TOK_NMTOKEN)
  15647. goto _27
  15648. }
  15649. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15650. return m_XML_TOK_INVALID
  15651. _17:
  15652. ;
  15653. if int64(end)-int64(ptr) < int64(3) {
  15654. return -int32(2)
  15655. }
  15656. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15658. return m_XML_TOK_INVALID
  15659. }
  15660. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15661. ptr += uintptr(3)
  15662. tok = int32(m_XML_TOK_NAME)
  15663. goto _27
  15664. }
  15665. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15666. ptr += uintptr(3)
  15667. tok = int32(m_XML_TOK_NMTOKEN)
  15668. goto _27
  15669. }
  15670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15671. return m_XML_TOK_INVALID
  15672. _18:
  15673. ;
  15674. if int64(end)-int64(ptr) < int64(4) {
  15675. return -int32(2)
  15676. }
  15677. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15679. return m_XML_TOK_INVALID
  15680. }
  15681. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15682. ptr += uintptr(4)
  15683. tok = int32(m_XML_TOK_NAME)
  15684. goto _27
  15685. }
  15686. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15687. ptr += uintptr(4)
  15688. tok = int32(m_XML_TOK_NMTOKEN)
  15689. goto _27
  15690. }
  15691. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15692. return m_XML_TOK_INVALID
  15693. _20:
  15694. ;
  15695. _19:
  15696. ;
  15697. tok = int32(m_XML_TOK_NAME)
  15698. ptr += uintptr(1)
  15699. goto _27
  15700. _24:
  15701. ;
  15702. _23:
  15703. ;
  15704. _22:
  15705. ;
  15706. _21:
  15707. ;
  15708. tok = int32(m_XML_TOK_NMTOKEN)
  15709. ptr += uintptr(1)
  15710. goto _27
  15711. _25:
  15712. ;
  15713. if 0 != 0 {
  15714. ptr += uintptr(1)
  15715. tok = int32(m_XML_TOK_NAME)
  15716. goto _27
  15717. }
  15718. if 0 != 0 {
  15719. ptr += uintptr(1)
  15720. tok = int32(m_XML_TOK_NMTOKEN)
  15721. goto _27
  15722. }
  15723. /* fall through */
  15724. _26:
  15725. ;
  15726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15727. return m_XML_TOK_INVALID
  15728. _27:
  15729. ;
  15730. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15731. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15732. case int32(_BT_NONASCII):
  15733. if !(libc.Int32FromInt32(0) != 0) {
  15734. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15735. return m_XML_TOK_INVALID
  15736. } /* fall through */
  15737. fallthrough
  15738. case int32(_BT_NMSTRT):
  15739. fallthrough
  15740. case int32(_BT_HEX):
  15741. fallthrough
  15742. case int32(_BT_DIGIT):
  15743. fallthrough
  15744. case int32(_BT_NAME):
  15745. fallthrough
  15746. case int32(_BT_MINUS):
  15747. ptr += uintptr(1)
  15748. case int32(_BT_LEAD2):
  15749. if int64(end)-int64(ptr) < int64(2) {
  15750. return -int32(2)
  15751. }
  15752. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15754. return m_XML_TOK_INVALID
  15755. }
  15756. ptr += uintptr(2)
  15757. case int32(_BT_LEAD3):
  15758. if int64(end)-int64(ptr) < int64(3) {
  15759. return -int32(2)
  15760. }
  15761. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15763. return m_XML_TOK_INVALID
  15764. }
  15765. ptr += uintptr(3)
  15766. case int32(_BT_LEAD4):
  15767. if int64(end)-int64(ptr) < int64(4) {
  15768. return -int32(2)
  15769. }
  15770. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15772. return m_XML_TOK_INVALID
  15773. }
  15774. ptr += uintptr(4)
  15775. case int32(_BT_GT):
  15776. fallthrough
  15777. case int32(_BT_RPAR):
  15778. fallthrough
  15779. case int32(_BT_COMMA):
  15780. fallthrough
  15781. case int32(_BT_VERBAR):
  15782. fallthrough
  15783. case int32(_BT_LSQB):
  15784. fallthrough
  15785. case int32(_BT_PERCNT):
  15786. fallthrough
  15787. case int32(_BT_S):
  15788. fallthrough
  15789. case int32(_BT_CR):
  15790. fallthrough
  15791. case int32(_BT_LF):
  15792. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15793. return tok
  15794. case int32(_BT_COLON):
  15795. ptr += uintptr(1)
  15796. switch tok {
  15797. case int32(m_XML_TOK_NAME):
  15798. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15799. return -int32(1)
  15800. }
  15801. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15802. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15803. case int32(_BT_NONASCII):
  15804. if !(libc.Int32FromInt32(0) != 0) {
  15805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15806. return m_XML_TOK_INVALID
  15807. } /* fall through */
  15808. fallthrough
  15809. case int32(_BT_NMSTRT):
  15810. fallthrough
  15811. case int32(_BT_HEX):
  15812. fallthrough
  15813. case int32(_BT_DIGIT):
  15814. fallthrough
  15815. case int32(_BT_NAME):
  15816. fallthrough
  15817. case int32(_BT_MINUS):
  15818. ptr += uintptr(1)
  15819. case int32(_BT_LEAD2):
  15820. if int64(end)-int64(ptr) < int64(2) {
  15821. return -int32(2)
  15822. }
  15823. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  15824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15825. return m_XML_TOK_INVALID
  15826. }
  15827. ptr += uintptr(2)
  15828. case int32(_BT_LEAD3):
  15829. if int64(end)-int64(ptr) < int64(3) {
  15830. return -int32(2)
  15831. }
  15832. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  15833. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15834. return m_XML_TOK_INVALID
  15835. }
  15836. ptr += uintptr(3)
  15837. case int32(_BT_LEAD4):
  15838. if int64(end)-int64(ptr) < int64(4) {
  15839. return -int32(2)
  15840. }
  15841. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  15842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15843. return m_XML_TOK_INVALID
  15844. }
  15845. ptr += uintptr(4)
  15846. default:
  15847. tok = int32(m_XML_TOK_NMTOKEN)
  15848. break
  15849. }
  15850. case int32(m_XML_TOK_PREFIXED_NAME):
  15851. tok = int32(m_XML_TOK_NMTOKEN)
  15852. break
  15853. }
  15854. case int32(_BT_PLUS):
  15855. if tok == int32(m_XML_TOK_NMTOKEN) {
  15856. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15857. return m_XML_TOK_INVALID
  15858. }
  15859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15860. return int32(m_XML_TOK_NAME_PLUS)
  15861. case int32(_BT_AST):
  15862. if tok == int32(m_XML_TOK_NMTOKEN) {
  15863. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15864. return m_XML_TOK_INVALID
  15865. }
  15866. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15867. return int32(m_XML_TOK_NAME_ASTERISK)
  15868. case int32(_BT_QUEST):
  15869. if tok == int32(m_XML_TOK_NMTOKEN) {
  15870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15871. return m_XML_TOK_INVALID
  15872. }
  15873. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15874. return int32(m_XML_TOK_NAME_QUESTION)
  15875. default:
  15876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15877. return m_XML_TOK_INVALID
  15878. }
  15879. }
  15880. return -tok
  15881. }
  15882. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15883. var start uintptr
  15884. _ = start
  15885. if ptr >= end {
  15886. return -int32(4)
  15887. } else {
  15888. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15889. /* This line cannot be executed. The incoming data has already
  15890. * been tokenized once, so incomplete characters like this have
  15891. * already been eliminated from the input. Retaining the paranoia
  15892. * check is still valuable, however.
  15893. */
  15894. return -int32(1) /* LCOV_EXCL_LINE */
  15895. }
  15896. }
  15897. start = ptr
  15898. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15899. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15900. case int32(_BT_LEAD2):
  15901. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15902. case int32(_BT_LEAD3):
  15903. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15904. case int32(_BT_LEAD4):
  15905. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15906. case int32(_BT_AMP):
  15907. if ptr == start {
  15908. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15909. }
  15910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15911. return int32(m_XML_TOK_DATA_CHARS)
  15912. case int32(_BT_LT):
  15913. /* this is for inside entity references */
  15914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15915. return m_XML_TOK_INVALID
  15916. case int32(_BT_LF):
  15917. if ptr == start {
  15918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15919. return int32(m_XML_TOK_DATA_NEWLINE)
  15920. }
  15921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15922. return int32(m_XML_TOK_DATA_CHARS)
  15923. case int32(_BT_CR):
  15924. if ptr == start {
  15925. ptr += uintptr(1)
  15926. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15927. return -int32(3)
  15928. }
  15929. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15930. ptr += uintptr(1)
  15931. }
  15932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15933. return int32(m_XML_TOK_DATA_NEWLINE)
  15934. }
  15935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15936. return int32(m_XML_TOK_DATA_CHARS)
  15937. case int32(_BT_S):
  15938. if ptr == start {
  15939. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15940. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15941. }
  15942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15943. return int32(m_XML_TOK_DATA_CHARS)
  15944. default:
  15945. ptr += uintptr(1)
  15946. break
  15947. }
  15948. }
  15949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15950. return int32(m_XML_TOK_DATA_CHARS)
  15951. }
  15952. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15953. var start uintptr
  15954. var tok, v1 int32
  15955. _, _, _ = start, tok, v1
  15956. if ptr >= end {
  15957. return -int32(4)
  15958. } else {
  15959. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15960. /* This line cannot be executed. The incoming data has already
  15961. * been tokenized once, so incomplete characters like this have
  15962. * already been eliminated from the input. Retaining the paranoia
  15963. * check is still valuable, however.
  15964. */
  15965. return -int32(1) /* LCOV_EXCL_LINE */
  15966. }
  15967. }
  15968. start = ptr
  15969. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15970. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15971. case int32(_BT_LEAD2):
  15972. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15973. case int32(_BT_LEAD3):
  15974. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15975. case int32(_BT_LEAD4):
  15976. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15977. case int32(_BT_AMP):
  15978. if ptr == start {
  15979. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15980. }
  15981. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15982. return int32(m_XML_TOK_DATA_CHARS)
  15983. case int32(_BT_PERCNT):
  15984. if ptr == start {
  15985. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15986. if tok == int32(m_XML_TOK_PERCENT) {
  15987. v1 = m_XML_TOK_INVALID
  15988. } else {
  15989. v1 = tok
  15990. }
  15991. return v1
  15992. }
  15993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15994. return int32(m_XML_TOK_DATA_CHARS)
  15995. case int32(_BT_LF):
  15996. if ptr == start {
  15997. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15998. return int32(m_XML_TOK_DATA_NEWLINE)
  15999. }
  16000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16001. return int32(m_XML_TOK_DATA_CHARS)
  16002. case int32(_BT_CR):
  16003. if ptr == start {
  16004. ptr += uintptr(1)
  16005. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16006. return -int32(3)
  16007. }
  16008. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  16009. ptr += uintptr(1)
  16010. }
  16011. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16012. return int32(m_XML_TOK_DATA_NEWLINE)
  16013. }
  16014. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16015. return int32(m_XML_TOK_DATA_CHARS)
  16016. default:
  16017. ptr += uintptr(1)
  16018. break
  16019. }
  16020. }
  16021. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16022. return int32(m_XML_TOK_DATA_CHARS)
  16023. }
  16024. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16025. var level int32
  16026. var n Tsize_t
  16027. _, _ = level, n
  16028. level = 0
  16029. if int32(1) > int32(1) {
  16030. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  16031. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  16032. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  16033. end = ptr + uintptr(n)
  16034. }
  16035. }
  16036. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16037. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16038. case int32(_BT_LEAD2):
  16039. if int64(end)-int64(ptr) < int64(2) {
  16040. return -int32(2)
  16041. }
  16042. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  16043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16044. return m_XML_TOK_INVALID
  16045. }
  16046. ptr += uintptr(2)
  16047. case int32(_BT_LEAD3):
  16048. if int64(end)-int64(ptr) < int64(3) {
  16049. return -int32(2)
  16050. }
  16051. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  16052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16053. return m_XML_TOK_INVALID
  16054. }
  16055. ptr += uintptr(3)
  16056. case int32(_BT_LEAD4):
  16057. if int64(end)-int64(ptr) < int64(4) {
  16058. return -int32(2)
  16059. }
  16060. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  16061. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16062. return m_XML_TOK_INVALID
  16063. }
  16064. ptr += uintptr(4)
  16065. case int32(_BT_NONXML):
  16066. fallthrough
  16067. case int32(_BT_MALFORM):
  16068. fallthrough
  16069. case int32(_BT_TRAIL):
  16070. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16071. return m_XML_TOK_INVALID
  16072. case int32(_BT_LT):
  16073. ptr += uintptr(1)
  16074. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16075. return -int32(1)
  16076. }
  16077. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  16078. ptr += uintptr(1)
  16079. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16080. return -int32(1)
  16081. }
  16082. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  16083. level++
  16084. ptr += uintptr(1)
  16085. }
  16086. }
  16087. case int32(_BT_RSQB):
  16088. ptr += uintptr(1)
  16089. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16090. return -int32(1)
  16091. }
  16092. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  16093. ptr += uintptr(1)
  16094. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16095. return -int32(1)
  16096. }
  16097. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  16098. ptr += uintptr(1)
  16099. if level == 0 {
  16100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16101. return int32(m_XML_TOK_IGNORE_SECT)
  16102. }
  16103. level--
  16104. }
  16105. }
  16106. default:
  16107. ptr += uintptr(1)
  16108. break
  16109. }
  16110. }
  16111. return -int32(1)
  16112. }
  16113. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  16114. ptr += uintptr(1)
  16115. end -= uintptr(1)
  16116. for {
  16117. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  16118. break
  16119. }
  16120. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16121. case int32(_BT_DIGIT):
  16122. fallthrough
  16123. case int32(_BT_HEX):
  16124. fallthrough
  16125. case int32(_BT_MINUS):
  16126. fallthrough
  16127. case int32(_BT_APOS):
  16128. fallthrough
  16129. case int32(_BT_LPAR):
  16130. fallthrough
  16131. case int32(_BT_RPAR):
  16132. fallthrough
  16133. case int32(_BT_PLUS):
  16134. fallthrough
  16135. case int32(_BT_COMMA):
  16136. fallthrough
  16137. case int32(_BT_SOL):
  16138. fallthrough
  16139. case int32(_BT_EQUALS):
  16140. fallthrough
  16141. case int32(_BT_QUEST):
  16142. fallthrough
  16143. case int32(_BT_CR):
  16144. fallthrough
  16145. case int32(_BT_LF):
  16146. fallthrough
  16147. case int32(_BT_SEMI):
  16148. fallthrough
  16149. case int32(_BT_EXCL):
  16150. fallthrough
  16151. case int32(_BT_AST):
  16152. fallthrough
  16153. case int32(_BT_PERCNT):
  16154. fallthrough
  16155. case int32(_BT_NUM):
  16156. fallthrough
  16157. case int32(_BT_COLON):
  16158. case int32(_BT_S):
  16159. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  16160. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  16161. return 0
  16162. }
  16163. case int32(_BT_NAME):
  16164. fallthrough
  16165. case int32(_BT_NMSTRT):
  16166. if !(int32(*(*int8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  16167. break
  16168. }
  16169. /* fall through */
  16170. fallthrough
  16171. default:
  16172. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16173. case int32(0x24): /* $ */
  16174. fallthrough
  16175. case int32(0x40): /* @ */
  16176. default:
  16177. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  16178. return 0
  16179. }
  16180. break
  16181. }
  16182. goto _1
  16183. _1:
  16184. ;
  16185. ptr += uintptr(1)
  16186. }
  16187. return int32(1)
  16188. }
  16189. /* This must only be called for a well-formed start-tag or empty
  16190. element tag. Returns the number of attributes. Pointers to the
  16191. first attsMax attributes are stored in atts.
  16192. */
  16193. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  16194. var nAtts, open, state int32
  16195. _, _, _ = nAtts, open, state
  16196. state = 1
  16197. nAtts = 0
  16198. open = 0 /* defined when state == inValue;
  16199. initialization just to shut up compilers */
  16200. ptr += uintptr(1)
  16201. for {
  16202. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16203. case int32(_BT_LEAD2):
  16204. if state == 0 {
  16205. if nAtts < attsMax {
  16206. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16207. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16208. }
  16209. state = 1
  16210. }
  16211. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16212. case int32(_BT_LEAD3):
  16213. if state == 0 {
  16214. if nAtts < attsMax {
  16215. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16216. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16217. }
  16218. state = 1
  16219. }
  16220. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16221. case int32(_BT_LEAD4):
  16222. if state == 0 {
  16223. if nAtts < attsMax {
  16224. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16225. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16226. }
  16227. state = 1
  16228. }
  16229. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16230. case int32(_BT_NONASCII):
  16231. fallthrough
  16232. case int32(_BT_NMSTRT):
  16233. fallthrough
  16234. case int32(_BT_HEX):
  16235. if state == 0 {
  16236. if nAtts < attsMax {
  16237. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16238. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16239. }
  16240. state = 1
  16241. }
  16242. case int32(_BT_QUOT):
  16243. if state != 2 {
  16244. if nAtts < attsMax {
  16245. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16246. }
  16247. state = 2
  16248. open = int32(_BT_QUOT)
  16249. } else {
  16250. if open == int32(_BT_QUOT) {
  16251. state = 0
  16252. if nAtts < attsMax {
  16253. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16254. }
  16255. nAtts++
  16256. }
  16257. }
  16258. case int32(_BT_APOS):
  16259. if state != 2 {
  16260. if nAtts < attsMax {
  16261. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16262. }
  16263. state = 2
  16264. open = int32(_BT_APOS)
  16265. } else {
  16266. if open == int32(_BT_APOS) {
  16267. state = 0
  16268. if nAtts < attsMax {
  16269. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16270. }
  16271. nAtts++
  16272. }
  16273. }
  16274. case int32(_BT_AMP):
  16275. if nAtts < attsMax {
  16276. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16277. }
  16278. case int32(_BT_S):
  16279. if state == 1 {
  16280. state = 0
  16281. } else {
  16282. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr || int32(*(*int8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) == open) {
  16283. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16284. }
  16285. }
  16286. case int32(_BT_CR):
  16287. fallthrough
  16288. case int32(_BT_LF):
  16289. /* This case ensures that the first attribute name is counted
  16290. Apart from that we could just change state on the quote. */
  16291. if state == 1 {
  16292. state = 0
  16293. } else {
  16294. if state == 2 && nAtts < attsMax {
  16295. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16296. }
  16297. }
  16298. case int32(_BT_GT):
  16299. fallthrough
  16300. case int32(_BT_SOL):
  16301. if state != 2 {
  16302. return nAtts
  16303. }
  16304. default:
  16305. break
  16306. }
  16307. goto _1
  16308. _1:
  16309. ;
  16310. ptr += uintptr(1)
  16311. }
  16312. /* not reached */
  16313. return r
  16314. }
  16315. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16316. var c, c1, result int32
  16317. _, _, _ = c, c1, result
  16318. result = 0
  16319. /* skip &# */
  16320. _ = enc
  16321. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16322. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16323. ptr += uintptr(1)
  16324. for {
  16325. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16326. break
  16327. }
  16328. c = int32(*(*int8)(unsafe.Pointer(ptr)))
  16329. switch c {
  16330. case int32(m_ASCII_02):
  16331. fallthrough
  16332. case int32(m_ASCII_12):
  16333. fallthrough
  16334. case int32(m_ASCII_22):
  16335. fallthrough
  16336. case int32(m_ASCII_32):
  16337. fallthrough
  16338. case int32(m_ASCII_41):
  16339. fallthrough
  16340. case int32(m_ASCII_51):
  16341. fallthrough
  16342. case int32(m_ASCII_61):
  16343. fallthrough
  16344. case int32(m_ASCII_71):
  16345. fallthrough
  16346. case int32(m_ASCII_82):
  16347. fallthrough
  16348. case int32(m_ASCII_92):
  16349. result <<= int32(4)
  16350. result |= c - int32(m_ASCII_02)
  16351. case int32(m_ASCII_A):
  16352. fallthrough
  16353. case int32(m_ASCII_B1):
  16354. fallthrough
  16355. case int32(m_ASCII_C):
  16356. fallthrough
  16357. case int32(m_ASCII_D):
  16358. fallthrough
  16359. case int32(m_ASCII_E):
  16360. fallthrough
  16361. case int32(m_ASCII_F):
  16362. result <<= int32(4)
  16363. result += int32(10) + (c - int32(m_ASCII_A))
  16364. case int32(m_ASCII_a2):
  16365. fallthrough
  16366. case int32(m_ASCII_b1):
  16367. fallthrough
  16368. case int32(m_ASCII_c2):
  16369. fallthrough
  16370. case int32(m_ASCII_d1):
  16371. fallthrough
  16372. case int32(m_ASCII_e2):
  16373. fallthrough
  16374. case int32(m_ASCII_f1):
  16375. result <<= int32(4)
  16376. result += int32(10) + (c - int32(m_ASCII_a2))
  16377. break
  16378. }
  16379. if result >= int32(0x110000) {
  16380. return -int32(1)
  16381. }
  16382. goto _1
  16383. _1:
  16384. ;
  16385. ptr += uintptr(1)
  16386. }
  16387. } else {
  16388. for {
  16389. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16390. break
  16391. }
  16392. c1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  16393. result *= int32(10)
  16394. result += c1 - int32(m_ASCII_02)
  16395. if result >= int32(0x110000) {
  16396. return -int32(1)
  16397. }
  16398. goto _2
  16399. _2:
  16400. ;
  16401. ptr += uintptr(1)
  16402. }
  16403. }
  16404. return _checkCharRefNumber(tls, result)
  16405. }
  16406. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16407. _ = enc
  16408. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  16409. case int64(2):
  16410. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16411. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16412. case int32(m_ASCII_l2):
  16413. return int32(m_ASCII_LT1)
  16414. case int32(m_ASCII_g2):
  16415. return int32(m_ASCII_GT1)
  16416. }
  16417. }
  16418. case int64(3):
  16419. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16420. ptr += uintptr(1)
  16421. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16422. ptr += uintptr(1)
  16423. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16424. return int32(m_ASCII_AMP1)
  16425. }
  16426. }
  16427. }
  16428. case int64(4):
  16429. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16430. case int32(m_ASCII_q1):
  16431. ptr += uintptr(1)
  16432. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16433. ptr += uintptr(1)
  16434. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16435. ptr += uintptr(1)
  16436. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16437. return int32(m_ASCII_QUOT1)
  16438. }
  16439. }
  16440. }
  16441. case int32(m_ASCII_a2):
  16442. ptr += uintptr(1)
  16443. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16444. ptr += uintptr(1)
  16445. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16446. ptr += uintptr(1)
  16447. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16448. return int32(m_ASCII_APOS1)
  16449. }
  16450. }
  16451. }
  16452. break
  16453. }
  16454. }
  16455. return 0
  16456. }
  16457. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16458. _ = enc
  16459. for {
  16460. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  16461. break
  16462. }
  16463. if int64(end1)-int64(ptr1) < int64(1) {
  16464. /* This line cannot be executed. The incoming data has already
  16465. * been tokenized once, so incomplete characters like this have
  16466. * already been eliminated from the input. Retaining the
  16467. * paranoia check is still valuable, however.
  16468. */
  16469. return 0 /* LCOV_EXCL_LINE */
  16470. }
  16471. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  16472. return 0
  16473. }
  16474. goto _1
  16475. _1:
  16476. ;
  16477. ptr1 += uintptr(1)
  16478. ptr2++
  16479. }
  16480. return libc.BoolInt32(ptr1 == end1)
  16481. }
  16482. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16483. var start uintptr
  16484. _ = start
  16485. start = ptr
  16486. for {
  16487. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16488. case int32(_BT_LEAD2):
  16489. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16490. case int32(_BT_LEAD3):
  16491. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16492. case int32(_BT_LEAD4):
  16493. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16494. case int32(_BT_NONASCII):
  16495. fallthrough
  16496. case int32(_BT_NMSTRT):
  16497. fallthrough
  16498. case int32(_BT_COLON):
  16499. fallthrough
  16500. case int32(_BT_HEX):
  16501. fallthrough
  16502. case int32(_BT_DIGIT):
  16503. fallthrough
  16504. case int32(_BT_NAME):
  16505. fallthrough
  16506. case int32(_BT_MINUS):
  16507. ptr += uintptr(1)
  16508. default:
  16509. return int32(int64(ptr) - int64(start))
  16510. }
  16511. goto _1
  16512. _1:
  16513. }
  16514. return r
  16515. }
  16516. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16517. for {
  16518. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16519. case int32(_BT_LF):
  16520. fallthrough
  16521. case int32(_BT_CR):
  16522. fallthrough
  16523. case int32(_BT_S):
  16524. ptr += uintptr(1)
  16525. default:
  16526. return ptr
  16527. }
  16528. goto _1
  16529. _1:
  16530. }
  16531. return r
  16532. }
  16533. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16534. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16535. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16536. case int32(_BT_LEAD2):
  16537. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16538. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16539. case int32(_BT_LEAD3):
  16540. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16541. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16542. case int32(_BT_LEAD4):
  16543. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16544. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16545. case int32(_BT_LF):
  16546. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16547. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16548. ptr += uintptr(1)
  16549. case int32(_BT_CR):
  16550. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16551. ptr += uintptr(1)
  16552. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  16553. ptr += uintptr(1)
  16554. }
  16555. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16556. default:
  16557. ptr += uintptr(1)
  16558. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16559. break
  16560. }
  16561. }
  16562. }
  16563. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16564. _UTF8_cval1 = 0
  16565. const _UTF8_cval2 = 192
  16566. const _UTF8_cval3 = 224
  16567. const _UTF8_cval4 = 240
  16568. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16569. var fromLim uintptr
  16570. var prev uint8
  16571. var walked Tsize_t
  16572. _, _, _ = fromLim, prev, walked
  16573. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16574. walked = uint64(0)
  16575. for {
  16576. if !(fromLim > from) {
  16577. break
  16578. }
  16579. prev = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1)))))
  16580. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16581. if walked+uint64(1) >= uint64(4) {
  16582. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16583. break
  16584. } else {
  16585. walked = uint64(0)
  16586. }
  16587. } else {
  16588. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16589. if walked+uint64(1) >= uint64(3) {
  16590. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16591. break
  16592. } else {
  16593. walked = uint64(0)
  16594. }
  16595. } else {
  16596. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16597. if walked+uint64(1) >= uint64(2) {
  16598. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16599. break
  16600. } else {
  16601. walked = uint64(0)
  16602. }
  16603. } else {
  16604. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16605. break
  16606. }
  16607. }
  16608. }
  16609. }
  16610. goto _1
  16611. _1:
  16612. ;
  16613. fromLim--
  16614. walked++
  16615. }
  16616. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16617. }
  16618. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16619. bp := tls.Alloc(16)
  16620. defer tls.Free(16)
  16621. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16622. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16623. var fromLimBefore uintptr
  16624. var input_incomplete, output_exhausted uint8
  16625. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16626. input_incomplete = uint8(m_false)
  16627. output_exhausted = uint8(m_false)
  16628. /* Avoid copying partial characters (due to limited space). */
  16629. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16630. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  16631. _ = enc
  16632. if bytesAvailable > bytesStorable {
  16633. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16634. output_exhausted = uint8(m_true)
  16635. }
  16636. /* Avoid copying partial characters (from incomplete input). */
  16637. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16638. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16639. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16640. input_incomplete = uint8(m_true)
  16641. }
  16642. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16643. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  16644. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16645. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16646. if output_exhausted != 0 { /* needs to go first */
  16647. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16648. } else {
  16649. if input_incomplete != 0 {
  16650. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16651. } else {
  16652. return int32(_XML_CONVERT_COMPLETED)
  16653. }
  16654. }
  16655. return r
  16656. }
  16657. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16658. var from, to, v1, v2, v3, v4 uintptr
  16659. var n uint64
  16660. var res _XML_Convert_Result
  16661. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16662. res = int32(_XML_CONVERT_COMPLETED)
  16663. to = *(*uintptr)(unsafe.Pointer(toP))
  16664. from = *(*uintptr)(unsafe.Pointer(fromP))
  16665. for from < fromLim && to < toLim {
  16666. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))))) {
  16667. case int32(_BT_LEAD2):
  16668. if int64(fromLim)-int64(from) < int64(2) {
  16669. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16670. goto after
  16671. }
  16672. v1 = to
  16673. to += 2
  16674. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  16675. from += uintptr(2)
  16676. case int32(_BT_LEAD3):
  16677. if int64(fromLim)-int64(from) < int64(3) {
  16678. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16679. goto after
  16680. }
  16681. v2 = to
  16682. to += 2
  16683. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  16684. from += uintptr(3)
  16685. case int32(_BT_LEAD4):
  16686. if (int64(toLim)-int64(to))/2 < int64(2) {
  16687. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16688. goto after
  16689. }
  16690. if int64(fromLim)-int64(from) < int64(4) {
  16691. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16692. goto after
  16693. }
  16694. n = libc.Uint64FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | int32(*(*int8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | int32(*(*int8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | int32(*(*int8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  16695. n -= uint64(0x10000)
  16696. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  16697. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  16698. to += uintptr(2) * 2
  16699. from += uintptr(4)
  16700. default:
  16701. v3 = to
  16702. to += 2
  16703. v4 = from
  16704. from++
  16705. *(*uint16)(unsafe.Pointer(v3)) = libc.Uint16FromInt8(*(*int8)(unsafe.Pointer(v4)))
  16706. break
  16707. }
  16708. }
  16709. if from < fromLim {
  16710. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16711. }
  16712. goto after
  16713. after:
  16714. ;
  16715. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16716. *(*uintptr)(unsafe.Pointer(toP)) = to
  16717. return res
  16718. }
  16719. var _utf8_encoding_ns = Tnormal_encoding{
  16720. Fenc: TENCODING{
  16721. Fscanners: [4]TSCANNER{},
  16722. FliteralScanners: [2]TSCANNER{},
  16723. FminBytesPerChar: int32(1),
  16724. FisUtf8: int8(1),
  16725. },
  16726. Ftype1: [256]uint8{
  16727. 9: uint8(_BT_S),
  16728. 10: uint8(_BT_LF),
  16729. 13: uint8(_BT_CR),
  16730. 32: uint8(_BT_S),
  16731. 33: uint8(_BT_EXCL),
  16732. 34: uint8(_BT_QUOT),
  16733. 35: uint8(_BT_NUM),
  16734. 36: uint8(_BT_OTHER),
  16735. 37: uint8(_BT_PERCNT),
  16736. 38: uint8(_BT_AMP),
  16737. 39: uint8(_BT_APOS),
  16738. 40: uint8(_BT_LPAR),
  16739. 41: uint8(_BT_RPAR),
  16740. 42: uint8(_BT_AST),
  16741. 43: uint8(_BT_PLUS),
  16742. 44: uint8(_BT_COMMA),
  16743. 45: uint8(_BT_MINUS),
  16744. 46: uint8(_BT_NAME),
  16745. 47: uint8(_BT_SOL),
  16746. 48: uint8(_BT_DIGIT),
  16747. 49: uint8(_BT_DIGIT),
  16748. 50: uint8(_BT_DIGIT),
  16749. 51: uint8(_BT_DIGIT),
  16750. 52: uint8(_BT_DIGIT),
  16751. 53: uint8(_BT_DIGIT),
  16752. 54: uint8(_BT_DIGIT),
  16753. 55: uint8(_BT_DIGIT),
  16754. 56: uint8(_BT_DIGIT),
  16755. 57: uint8(_BT_DIGIT),
  16756. 58: uint8(_BT_COLON),
  16757. 59: uint8(_BT_SEMI),
  16758. 60: uint8(_BT_LT),
  16759. 61: uint8(_BT_EQUALS),
  16760. 62: uint8(_BT_GT),
  16761. 63: uint8(_BT_QUEST),
  16762. 64: uint8(_BT_OTHER),
  16763. 65: uint8(_BT_HEX),
  16764. 66: uint8(_BT_HEX),
  16765. 67: uint8(_BT_HEX),
  16766. 68: uint8(_BT_HEX),
  16767. 69: uint8(_BT_HEX),
  16768. 70: uint8(_BT_HEX),
  16769. 71: uint8(_BT_NMSTRT),
  16770. 72: uint8(_BT_NMSTRT),
  16771. 73: uint8(_BT_NMSTRT),
  16772. 74: uint8(_BT_NMSTRT),
  16773. 75: uint8(_BT_NMSTRT),
  16774. 76: uint8(_BT_NMSTRT),
  16775. 77: uint8(_BT_NMSTRT),
  16776. 78: uint8(_BT_NMSTRT),
  16777. 79: uint8(_BT_NMSTRT),
  16778. 80: uint8(_BT_NMSTRT),
  16779. 81: uint8(_BT_NMSTRT),
  16780. 82: uint8(_BT_NMSTRT),
  16781. 83: uint8(_BT_NMSTRT),
  16782. 84: uint8(_BT_NMSTRT),
  16783. 85: uint8(_BT_NMSTRT),
  16784. 86: uint8(_BT_NMSTRT),
  16785. 87: uint8(_BT_NMSTRT),
  16786. 88: uint8(_BT_NMSTRT),
  16787. 89: uint8(_BT_NMSTRT),
  16788. 90: uint8(_BT_NMSTRT),
  16789. 91: uint8(_BT_LSQB),
  16790. 92: uint8(_BT_OTHER),
  16791. 93: uint8(_BT_RSQB),
  16792. 94: uint8(_BT_OTHER),
  16793. 95: uint8(_BT_NMSTRT),
  16794. 96: uint8(_BT_OTHER),
  16795. 97: uint8(_BT_HEX),
  16796. 98: uint8(_BT_HEX),
  16797. 99: uint8(_BT_HEX),
  16798. 100: uint8(_BT_HEX),
  16799. 101: uint8(_BT_HEX),
  16800. 102: uint8(_BT_HEX),
  16801. 103: uint8(_BT_NMSTRT),
  16802. 104: uint8(_BT_NMSTRT),
  16803. 105: uint8(_BT_NMSTRT),
  16804. 106: uint8(_BT_NMSTRT),
  16805. 107: uint8(_BT_NMSTRT),
  16806. 108: uint8(_BT_NMSTRT),
  16807. 109: uint8(_BT_NMSTRT),
  16808. 110: uint8(_BT_NMSTRT),
  16809. 111: uint8(_BT_NMSTRT),
  16810. 112: uint8(_BT_NMSTRT),
  16811. 113: uint8(_BT_NMSTRT),
  16812. 114: uint8(_BT_NMSTRT),
  16813. 115: uint8(_BT_NMSTRT),
  16814. 116: uint8(_BT_NMSTRT),
  16815. 117: uint8(_BT_NMSTRT),
  16816. 118: uint8(_BT_NMSTRT),
  16817. 119: uint8(_BT_NMSTRT),
  16818. 120: uint8(_BT_NMSTRT),
  16819. 121: uint8(_BT_NMSTRT),
  16820. 122: uint8(_BT_NMSTRT),
  16821. 123: uint8(_BT_OTHER),
  16822. 124: uint8(_BT_VERBAR),
  16823. 125: uint8(_BT_OTHER),
  16824. 126: uint8(_BT_OTHER),
  16825. 127: uint8(_BT_OTHER),
  16826. 128: uint8(_BT_TRAIL),
  16827. 129: uint8(_BT_TRAIL),
  16828. 130: uint8(_BT_TRAIL),
  16829. 131: uint8(_BT_TRAIL),
  16830. 132: uint8(_BT_TRAIL),
  16831. 133: uint8(_BT_TRAIL),
  16832. 134: uint8(_BT_TRAIL),
  16833. 135: uint8(_BT_TRAIL),
  16834. 136: uint8(_BT_TRAIL),
  16835. 137: uint8(_BT_TRAIL),
  16836. 138: uint8(_BT_TRAIL),
  16837. 139: uint8(_BT_TRAIL),
  16838. 140: uint8(_BT_TRAIL),
  16839. 141: uint8(_BT_TRAIL),
  16840. 142: uint8(_BT_TRAIL),
  16841. 143: uint8(_BT_TRAIL),
  16842. 144: uint8(_BT_TRAIL),
  16843. 145: uint8(_BT_TRAIL),
  16844. 146: uint8(_BT_TRAIL),
  16845. 147: uint8(_BT_TRAIL),
  16846. 148: uint8(_BT_TRAIL),
  16847. 149: uint8(_BT_TRAIL),
  16848. 150: uint8(_BT_TRAIL),
  16849. 151: uint8(_BT_TRAIL),
  16850. 152: uint8(_BT_TRAIL),
  16851. 153: uint8(_BT_TRAIL),
  16852. 154: uint8(_BT_TRAIL),
  16853. 155: uint8(_BT_TRAIL),
  16854. 156: uint8(_BT_TRAIL),
  16855. 157: uint8(_BT_TRAIL),
  16856. 158: uint8(_BT_TRAIL),
  16857. 159: uint8(_BT_TRAIL),
  16858. 160: uint8(_BT_TRAIL),
  16859. 161: uint8(_BT_TRAIL),
  16860. 162: uint8(_BT_TRAIL),
  16861. 163: uint8(_BT_TRAIL),
  16862. 164: uint8(_BT_TRAIL),
  16863. 165: uint8(_BT_TRAIL),
  16864. 166: uint8(_BT_TRAIL),
  16865. 167: uint8(_BT_TRAIL),
  16866. 168: uint8(_BT_TRAIL),
  16867. 169: uint8(_BT_TRAIL),
  16868. 170: uint8(_BT_TRAIL),
  16869. 171: uint8(_BT_TRAIL),
  16870. 172: uint8(_BT_TRAIL),
  16871. 173: uint8(_BT_TRAIL),
  16872. 174: uint8(_BT_TRAIL),
  16873. 175: uint8(_BT_TRAIL),
  16874. 176: uint8(_BT_TRAIL),
  16875. 177: uint8(_BT_TRAIL),
  16876. 178: uint8(_BT_TRAIL),
  16877. 179: uint8(_BT_TRAIL),
  16878. 180: uint8(_BT_TRAIL),
  16879. 181: uint8(_BT_TRAIL),
  16880. 182: uint8(_BT_TRAIL),
  16881. 183: uint8(_BT_TRAIL),
  16882. 184: uint8(_BT_TRAIL),
  16883. 185: uint8(_BT_TRAIL),
  16884. 186: uint8(_BT_TRAIL),
  16885. 187: uint8(_BT_TRAIL),
  16886. 188: uint8(_BT_TRAIL),
  16887. 189: uint8(_BT_TRAIL),
  16888. 190: uint8(_BT_TRAIL),
  16889. 191: uint8(_BT_TRAIL),
  16890. 192: uint8(_BT_LEAD2),
  16891. 193: uint8(_BT_LEAD2),
  16892. 194: uint8(_BT_LEAD2),
  16893. 195: uint8(_BT_LEAD2),
  16894. 196: uint8(_BT_LEAD2),
  16895. 197: uint8(_BT_LEAD2),
  16896. 198: uint8(_BT_LEAD2),
  16897. 199: uint8(_BT_LEAD2),
  16898. 200: uint8(_BT_LEAD2),
  16899. 201: uint8(_BT_LEAD2),
  16900. 202: uint8(_BT_LEAD2),
  16901. 203: uint8(_BT_LEAD2),
  16902. 204: uint8(_BT_LEAD2),
  16903. 205: uint8(_BT_LEAD2),
  16904. 206: uint8(_BT_LEAD2),
  16905. 207: uint8(_BT_LEAD2),
  16906. 208: uint8(_BT_LEAD2),
  16907. 209: uint8(_BT_LEAD2),
  16908. 210: uint8(_BT_LEAD2),
  16909. 211: uint8(_BT_LEAD2),
  16910. 212: uint8(_BT_LEAD2),
  16911. 213: uint8(_BT_LEAD2),
  16912. 214: uint8(_BT_LEAD2),
  16913. 215: uint8(_BT_LEAD2),
  16914. 216: uint8(_BT_LEAD2),
  16915. 217: uint8(_BT_LEAD2),
  16916. 218: uint8(_BT_LEAD2),
  16917. 219: uint8(_BT_LEAD2),
  16918. 220: uint8(_BT_LEAD2),
  16919. 221: uint8(_BT_LEAD2),
  16920. 222: uint8(_BT_LEAD2),
  16921. 223: uint8(_BT_LEAD2),
  16922. 224: uint8(_BT_LEAD3),
  16923. 225: uint8(_BT_LEAD3),
  16924. 226: uint8(_BT_LEAD3),
  16925. 227: uint8(_BT_LEAD3),
  16926. 228: uint8(_BT_LEAD3),
  16927. 229: uint8(_BT_LEAD3),
  16928. 230: uint8(_BT_LEAD3),
  16929. 231: uint8(_BT_LEAD3),
  16930. 232: uint8(_BT_LEAD3),
  16931. 233: uint8(_BT_LEAD3),
  16932. 234: uint8(_BT_LEAD3),
  16933. 235: uint8(_BT_LEAD3),
  16934. 236: uint8(_BT_LEAD3),
  16935. 237: uint8(_BT_LEAD3),
  16936. 238: uint8(_BT_LEAD3),
  16937. 239: uint8(_BT_LEAD3),
  16938. 240: uint8(_BT_LEAD4),
  16939. 241: uint8(_BT_LEAD4),
  16940. 242: uint8(_BT_LEAD4),
  16941. 243: uint8(_BT_LEAD4),
  16942. 244: uint8(_BT_LEAD4),
  16943. 254: uint8(_BT_MALFORM),
  16944. 255: uint8(_BT_MALFORM),
  16945. },
  16946. }
  16947. func init() {
  16948. p := unsafe.Pointer(&_utf8_encoding_ns)
  16949. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16950. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16951. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16952. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16953. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16954. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16955. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16956. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16957. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16958. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16959. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16960. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16961. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16962. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16963. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16964. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16965. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16966. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16967. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16968. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16969. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16970. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16971. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16972. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16973. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16974. }
  16975. var _utf8_encoding = Tnormal_encoding{
  16976. Fenc: TENCODING{
  16977. Fscanners: [4]TSCANNER{},
  16978. FliteralScanners: [2]TSCANNER{},
  16979. FminBytesPerChar: int32(1),
  16980. FisUtf8: int8(1),
  16981. },
  16982. Ftype1: [256]uint8{
  16983. 9: uint8(_BT_S),
  16984. 10: uint8(_BT_LF),
  16985. 13: uint8(_BT_CR),
  16986. 32: uint8(_BT_S),
  16987. 33: uint8(_BT_EXCL),
  16988. 34: uint8(_BT_QUOT),
  16989. 35: uint8(_BT_NUM),
  16990. 36: uint8(_BT_OTHER),
  16991. 37: uint8(_BT_PERCNT),
  16992. 38: uint8(_BT_AMP),
  16993. 39: uint8(_BT_APOS),
  16994. 40: uint8(_BT_LPAR),
  16995. 41: uint8(_BT_RPAR),
  16996. 42: uint8(_BT_AST),
  16997. 43: uint8(_BT_PLUS),
  16998. 44: uint8(_BT_COMMA),
  16999. 45: uint8(_BT_MINUS),
  17000. 46: uint8(_BT_NAME),
  17001. 47: uint8(_BT_SOL),
  17002. 48: uint8(_BT_DIGIT),
  17003. 49: uint8(_BT_DIGIT),
  17004. 50: uint8(_BT_DIGIT),
  17005. 51: uint8(_BT_DIGIT),
  17006. 52: uint8(_BT_DIGIT),
  17007. 53: uint8(_BT_DIGIT),
  17008. 54: uint8(_BT_DIGIT),
  17009. 55: uint8(_BT_DIGIT),
  17010. 56: uint8(_BT_DIGIT),
  17011. 57: uint8(_BT_DIGIT),
  17012. 58: uint8(_BT_NMSTRT),
  17013. 59: uint8(_BT_SEMI),
  17014. 60: uint8(_BT_LT),
  17015. 61: uint8(_BT_EQUALS),
  17016. 62: uint8(_BT_GT),
  17017. 63: uint8(_BT_QUEST),
  17018. 64: uint8(_BT_OTHER),
  17019. 65: uint8(_BT_HEX),
  17020. 66: uint8(_BT_HEX),
  17021. 67: uint8(_BT_HEX),
  17022. 68: uint8(_BT_HEX),
  17023. 69: uint8(_BT_HEX),
  17024. 70: uint8(_BT_HEX),
  17025. 71: uint8(_BT_NMSTRT),
  17026. 72: uint8(_BT_NMSTRT),
  17027. 73: uint8(_BT_NMSTRT),
  17028. 74: uint8(_BT_NMSTRT),
  17029. 75: uint8(_BT_NMSTRT),
  17030. 76: uint8(_BT_NMSTRT),
  17031. 77: uint8(_BT_NMSTRT),
  17032. 78: uint8(_BT_NMSTRT),
  17033. 79: uint8(_BT_NMSTRT),
  17034. 80: uint8(_BT_NMSTRT),
  17035. 81: uint8(_BT_NMSTRT),
  17036. 82: uint8(_BT_NMSTRT),
  17037. 83: uint8(_BT_NMSTRT),
  17038. 84: uint8(_BT_NMSTRT),
  17039. 85: uint8(_BT_NMSTRT),
  17040. 86: uint8(_BT_NMSTRT),
  17041. 87: uint8(_BT_NMSTRT),
  17042. 88: uint8(_BT_NMSTRT),
  17043. 89: uint8(_BT_NMSTRT),
  17044. 90: uint8(_BT_NMSTRT),
  17045. 91: uint8(_BT_LSQB),
  17046. 92: uint8(_BT_OTHER),
  17047. 93: uint8(_BT_RSQB),
  17048. 94: uint8(_BT_OTHER),
  17049. 95: uint8(_BT_NMSTRT),
  17050. 96: uint8(_BT_OTHER),
  17051. 97: uint8(_BT_HEX),
  17052. 98: uint8(_BT_HEX),
  17053. 99: uint8(_BT_HEX),
  17054. 100: uint8(_BT_HEX),
  17055. 101: uint8(_BT_HEX),
  17056. 102: uint8(_BT_HEX),
  17057. 103: uint8(_BT_NMSTRT),
  17058. 104: uint8(_BT_NMSTRT),
  17059. 105: uint8(_BT_NMSTRT),
  17060. 106: uint8(_BT_NMSTRT),
  17061. 107: uint8(_BT_NMSTRT),
  17062. 108: uint8(_BT_NMSTRT),
  17063. 109: uint8(_BT_NMSTRT),
  17064. 110: uint8(_BT_NMSTRT),
  17065. 111: uint8(_BT_NMSTRT),
  17066. 112: uint8(_BT_NMSTRT),
  17067. 113: uint8(_BT_NMSTRT),
  17068. 114: uint8(_BT_NMSTRT),
  17069. 115: uint8(_BT_NMSTRT),
  17070. 116: uint8(_BT_NMSTRT),
  17071. 117: uint8(_BT_NMSTRT),
  17072. 118: uint8(_BT_NMSTRT),
  17073. 119: uint8(_BT_NMSTRT),
  17074. 120: uint8(_BT_NMSTRT),
  17075. 121: uint8(_BT_NMSTRT),
  17076. 122: uint8(_BT_NMSTRT),
  17077. 123: uint8(_BT_OTHER),
  17078. 124: uint8(_BT_VERBAR),
  17079. 125: uint8(_BT_OTHER),
  17080. 126: uint8(_BT_OTHER),
  17081. 127: uint8(_BT_OTHER),
  17082. 128: uint8(_BT_TRAIL),
  17083. 129: uint8(_BT_TRAIL),
  17084. 130: uint8(_BT_TRAIL),
  17085. 131: uint8(_BT_TRAIL),
  17086. 132: uint8(_BT_TRAIL),
  17087. 133: uint8(_BT_TRAIL),
  17088. 134: uint8(_BT_TRAIL),
  17089. 135: uint8(_BT_TRAIL),
  17090. 136: uint8(_BT_TRAIL),
  17091. 137: uint8(_BT_TRAIL),
  17092. 138: uint8(_BT_TRAIL),
  17093. 139: uint8(_BT_TRAIL),
  17094. 140: uint8(_BT_TRAIL),
  17095. 141: uint8(_BT_TRAIL),
  17096. 142: uint8(_BT_TRAIL),
  17097. 143: uint8(_BT_TRAIL),
  17098. 144: uint8(_BT_TRAIL),
  17099. 145: uint8(_BT_TRAIL),
  17100. 146: uint8(_BT_TRAIL),
  17101. 147: uint8(_BT_TRAIL),
  17102. 148: uint8(_BT_TRAIL),
  17103. 149: uint8(_BT_TRAIL),
  17104. 150: uint8(_BT_TRAIL),
  17105. 151: uint8(_BT_TRAIL),
  17106. 152: uint8(_BT_TRAIL),
  17107. 153: uint8(_BT_TRAIL),
  17108. 154: uint8(_BT_TRAIL),
  17109. 155: uint8(_BT_TRAIL),
  17110. 156: uint8(_BT_TRAIL),
  17111. 157: uint8(_BT_TRAIL),
  17112. 158: uint8(_BT_TRAIL),
  17113. 159: uint8(_BT_TRAIL),
  17114. 160: uint8(_BT_TRAIL),
  17115. 161: uint8(_BT_TRAIL),
  17116. 162: uint8(_BT_TRAIL),
  17117. 163: uint8(_BT_TRAIL),
  17118. 164: uint8(_BT_TRAIL),
  17119. 165: uint8(_BT_TRAIL),
  17120. 166: uint8(_BT_TRAIL),
  17121. 167: uint8(_BT_TRAIL),
  17122. 168: uint8(_BT_TRAIL),
  17123. 169: uint8(_BT_TRAIL),
  17124. 170: uint8(_BT_TRAIL),
  17125. 171: uint8(_BT_TRAIL),
  17126. 172: uint8(_BT_TRAIL),
  17127. 173: uint8(_BT_TRAIL),
  17128. 174: uint8(_BT_TRAIL),
  17129. 175: uint8(_BT_TRAIL),
  17130. 176: uint8(_BT_TRAIL),
  17131. 177: uint8(_BT_TRAIL),
  17132. 178: uint8(_BT_TRAIL),
  17133. 179: uint8(_BT_TRAIL),
  17134. 180: uint8(_BT_TRAIL),
  17135. 181: uint8(_BT_TRAIL),
  17136. 182: uint8(_BT_TRAIL),
  17137. 183: uint8(_BT_TRAIL),
  17138. 184: uint8(_BT_TRAIL),
  17139. 185: uint8(_BT_TRAIL),
  17140. 186: uint8(_BT_TRAIL),
  17141. 187: uint8(_BT_TRAIL),
  17142. 188: uint8(_BT_TRAIL),
  17143. 189: uint8(_BT_TRAIL),
  17144. 190: uint8(_BT_TRAIL),
  17145. 191: uint8(_BT_TRAIL),
  17146. 192: uint8(_BT_LEAD2),
  17147. 193: uint8(_BT_LEAD2),
  17148. 194: uint8(_BT_LEAD2),
  17149. 195: uint8(_BT_LEAD2),
  17150. 196: uint8(_BT_LEAD2),
  17151. 197: uint8(_BT_LEAD2),
  17152. 198: uint8(_BT_LEAD2),
  17153. 199: uint8(_BT_LEAD2),
  17154. 200: uint8(_BT_LEAD2),
  17155. 201: uint8(_BT_LEAD2),
  17156. 202: uint8(_BT_LEAD2),
  17157. 203: uint8(_BT_LEAD2),
  17158. 204: uint8(_BT_LEAD2),
  17159. 205: uint8(_BT_LEAD2),
  17160. 206: uint8(_BT_LEAD2),
  17161. 207: uint8(_BT_LEAD2),
  17162. 208: uint8(_BT_LEAD2),
  17163. 209: uint8(_BT_LEAD2),
  17164. 210: uint8(_BT_LEAD2),
  17165. 211: uint8(_BT_LEAD2),
  17166. 212: uint8(_BT_LEAD2),
  17167. 213: uint8(_BT_LEAD2),
  17168. 214: uint8(_BT_LEAD2),
  17169. 215: uint8(_BT_LEAD2),
  17170. 216: uint8(_BT_LEAD2),
  17171. 217: uint8(_BT_LEAD2),
  17172. 218: uint8(_BT_LEAD2),
  17173. 219: uint8(_BT_LEAD2),
  17174. 220: uint8(_BT_LEAD2),
  17175. 221: uint8(_BT_LEAD2),
  17176. 222: uint8(_BT_LEAD2),
  17177. 223: uint8(_BT_LEAD2),
  17178. 224: uint8(_BT_LEAD3),
  17179. 225: uint8(_BT_LEAD3),
  17180. 226: uint8(_BT_LEAD3),
  17181. 227: uint8(_BT_LEAD3),
  17182. 228: uint8(_BT_LEAD3),
  17183. 229: uint8(_BT_LEAD3),
  17184. 230: uint8(_BT_LEAD3),
  17185. 231: uint8(_BT_LEAD3),
  17186. 232: uint8(_BT_LEAD3),
  17187. 233: uint8(_BT_LEAD3),
  17188. 234: uint8(_BT_LEAD3),
  17189. 235: uint8(_BT_LEAD3),
  17190. 236: uint8(_BT_LEAD3),
  17191. 237: uint8(_BT_LEAD3),
  17192. 238: uint8(_BT_LEAD3),
  17193. 239: uint8(_BT_LEAD3),
  17194. 240: uint8(_BT_LEAD4),
  17195. 241: uint8(_BT_LEAD4),
  17196. 242: uint8(_BT_LEAD4),
  17197. 243: uint8(_BT_LEAD4),
  17198. 244: uint8(_BT_LEAD4),
  17199. 254: uint8(_BT_MALFORM),
  17200. 255: uint8(_BT_MALFORM),
  17201. },
  17202. }
  17203. func init() {
  17204. p := unsafe.Pointer(&_utf8_encoding)
  17205. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17206. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17207. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17208. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17209. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17210. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17211. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17212. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17213. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17214. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17215. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17216. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17217. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17218. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17219. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17220. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17221. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17222. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17223. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17224. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17225. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17226. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17227. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17228. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17229. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17230. }
  17231. var _internal_utf8_encoding_ns = Tnormal_encoding{
  17232. Fenc: TENCODING{
  17233. Fscanners: [4]TSCANNER{},
  17234. FliteralScanners: [2]TSCANNER{},
  17235. FminBytesPerChar: int32(1),
  17236. FisUtf8: int8(1),
  17237. },
  17238. Ftype1: [256]uint8{
  17239. 9: uint8(_BT_S),
  17240. 10: uint8(_BT_LF),
  17241. 13: uint8(_BT_S),
  17242. 32: uint8(_BT_S),
  17243. 33: uint8(_BT_EXCL),
  17244. 34: uint8(_BT_QUOT),
  17245. 35: uint8(_BT_NUM),
  17246. 36: uint8(_BT_OTHER),
  17247. 37: uint8(_BT_PERCNT),
  17248. 38: uint8(_BT_AMP),
  17249. 39: uint8(_BT_APOS),
  17250. 40: uint8(_BT_LPAR),
  17251. 41: uint8(_BT_RPAR),
  17252. 42: uint8(_BT_AST),
  17253. 43: uint8(_BT_PLUS),
  17254. 44: uint8(_BT_COMMA),
  17255. 45: uint8(_BT_MINUS),
  17256. 46: uint8(_BT_NAME),
  17257. 47: uint8(_BT_SOL),
  17258. 48: uint8(_BT_DIGIT),
  17259. 49: uint8(_BT_DIGIT),
  17260. 50: uint8(_BT_DIGIT),
  17261. 51: uint8(_BT_DIGIT),
  17262. 52: uint8(_BT_DIGIT),
  17263. 53: uint8(_BT_DIGIT),
  17264. 54: uint8(_BT_DIGIT),
  17265. 55: uint8(_BT_DIGIT),
  17266. 56: uint8(_BT_DIGIT),
  17267. 57: uint8(_BT_DIGIT),
  17268. 58: uint8(_BT_COLON),
  17269. 59: uint8(_BT_SEMI),
  17270. 60: uint8(_BT_LT),
  17271. 61: uint8(_BT_EQUALS),
  17272. 62: uint8(_BT_GT),
  17273. 63: uint8(_BT_QUEST),
  17274. 64: uint8(_BT_OTHER),
  17275. 65: uint8(_BT_HEX),
  17276. 66: uint8(_BT_HEX),
  17277. 67: uint8(_BT_HEX),
  17278. 68: uint8(_BT_HEX),
  17279. 69: uint8(_BT_HEX),
  17280. 70: uint8(_BT_HEX),
  17281. 71: uint8(_BT_NMSTRT),
  17282. 72: uint8(_BT_NMSTRT),
  17283. 73: uint8(_BT_NMSTRT),
  17284. 74: uint8(_BT_NMSTRT),
  17285. 75: uint8(_BT_NMSTRT),
  17286. 76: uint8(_BT_NMSTRT),
  17287. 77: uint8(_BT_NMSTRT),
  17288. 78: uint8(_BT_NMSTRT),
  17289. 79: uint8(_BT_NMSTRT),
  17290. 80: uint8(_BT_NMSTRT),
  17291. 81: uint8(_BT_NMSTRT),
  17292. 82: uint8(_BT_NMSTRT),
  17293. 83: uint8(_BT_NMSTRT),
  17294. 84: uint8(_BT_NMSTRT),
  17295. 85: uint8(_BT_NMSTRT),
  17296. 86: uint8(_BT_NMSTRT),
  17297. 87: uint8(_BT_NMSTRT),
  17298. 88: uint8(_BT_NMSTRT),
  17299. 89: uint8(_BT_NMSTRT),
  17300. 90: uint8(_BT_NMSTRT),
  17301. 91: uint8(_BT_LSQB),
  17302. 92: uint8(_BT_OTHER),
  17303. 93: uint8(_BT_RSQB),
  17304. 94: uint8(_BT_OTHER),
  17305. 95: uint8(_BT_NMSTRT),
  17306. 96: uint8(_BT_OTHER),
  17307. 97: uint8(_BT_HEX),
  17308. 98: uint8(_BT_HEX),
  17309. 99: uint8(_BT_HEX),
  17310. 100: uint8(_BT_HEX),
  17311. 101: uint8(_BT_HEX),
  17312. 102: uint8(_BT_HEX),
  17313. 103: uint8(_BT_NMSTRT),
  17314. 104: uint8(_BT_NMSTRT),
  17315. 105: uint8(_BT_NMSTRT),
  17316. 106: uint8(_BT_NMSTRT),
  17317. 107: uint8(_BT_NMSTRT),
  17318. 108: uint8(_BT_NMSTRT),
  17319. 109: uint8(_BT_NMSTRT),
  17320. 110: uint8(_BT_NMSTRT),
  17321. 111: uint8(_BT_NMSTRT),
  17322. 112: uint8(_BT_NMSTRT),
  17323. 113: uint8(_BT_NMSTRT),
  17324. 114: uint8(_BT_NMSTRT),
  17325. 115: uint8(_BT_NMSTRT),
  17326. 116: uint8(_BT_NMSTRT),
  17327. 117: uint8(_BT_NMSTRT),
  17328. 118: uint8(_BT_NMSTRT),
  17329. 119: uint8(_BT_NMSTRT),
  17330. 120: uint8(_BT_NMSTRT),
  17331. 121: uint8(_BT_NMSTRT),
  17332. 122: uint8(_BT_NMSTRT),
  17333. 123: uint8(_BT_OTHER),
  17334. 124: uint8(_BT_VERBAR),
  17335. 125: uint8(_BT_OTHER),
  17336. 126: uint8(_BT_OTHER),
  17337. 127: uint8(_BT_OTHER),
  17338. 128: uint8(_BT_TRAIL),
  17339. 129: uint8(_BT_TRAIL),
  17340. 130: uint8(_BT_TRAIL),
  17341. 131: uint8(_BT_TRAIL),
  17342. 132: uint8(_BT_TRAIL),
  17343. 133: uint8(_BT_TRAIL),
  17344. 134: uint8(_BT_TRAIL),
  17345. 135: uint8(_BT_TRAIL),
  17346. 136: uint8(_BT_TRAIL),
  17347. 137: uint8(_BT_TRAIL),
  17348. 138: uint8(_BT_TRAIL),
  17349. 139: uint8(_BT_TRAIL),
  17350. 140: uint8(_BT_TRAIL),
  17351. 141: uint8(_BT_TRAIL),
  17352. 142: uint8(_BT_TRAIL),
  17353. 143: uint8(_BT_TRAIL),
  17354. 144: uint8(_BT_TRAIL),
  17355. 145: uint8(_BT_TRAIL),
  17356. 146: uint8(_BT_TRAIL),
  17357. 147: uint8(_BT_TRAIL),
  17358. 148: uint8(_BT_TRAIL),
  17359. 149: uint8(_BT_TRAIL),
  17360. 150: uint8(_BT_TRAIL),
  17361. 151: uint8(_BT_TRAIL),
  17362. 152: uint8(_BT_TRAIL),
  17363. 153: uint8(_BT_TRAIL),
  17364. 154: uint8(_BT_TRAIL),
  17365. 155: uint8(_BT_TRAIL),
  17366. 156: uint8(_BT_TRAIL),
  17367. 157: uint8(_BT_TRAIL),
  17368. 158: uint8(_BT_TRAIL),
  17369. 159: uint8(_BT_TRAIL),
  17370. 160: uint8(_BT_TRAIL),
  17371. 161: uint8(_BT_TRAIL),
  17372. 162: uint8(_BT_TRAIL),
  17373. 163: uint8(_BT_TRAIL),
  17374. 164: uint8(_BT_TRAIL),
  17375. 165: uint8(_BT_TRAIL),
  17376. 166: uint8(_BT_TRAIL),
  17377. 167: uint8(_BT_TRAIL),
  17378. 168: uint8(_BT_TRAIL),
  17379. 169: uint8(_BT_TRAIL),
  17380. 170: uint8(_BT_TRAIL),
  17381. 171: uint8(_BT_TRAIL),
  17382. 172: uint8(_BT_TRAIL),
  17383. 173: uint8(_BT_TRAIL),
  17384. 174: uint8(_BT_TRAIL),
  17385. 175: uint8(_BT_TRAIL),
  17386. 176: uint8(_BT_TRAIL),
  17387. 177: uint8(_BT_TRAIL),
  17388. 178: uint8(_BT_TRAIL),
  17389. 179: uint8(_BT_TRAIL),
  17390. 180: uint8(_BT_TRAIL),
  17391. 181: uint8(_BT_TRAIL),
  17392. 182: uint8(_BT_TRAIL),
  17393. 183: uint8(_BT_TRAIL),
  17394. 184: uint8(_BT_TRAIL),
  17395. 185: uint8(_BT_TRAIL),
  17396. 186: uint8(_BT_TRAIL),
  17397. 187: uint8(_BT_TRAIL),
  17398. 188: uint8(_BT_TRAIL),
  17399. 189: uint8(_BT_TRAIL),
  17400. 190: uint8(_BT_TRAIL),
  17401. 191: uint8(_BT_TRAIL),
  17402. 192: uint8(_BT_LEAD2),
  17403. 193: uint8(_BT_LEAD2),
  17404. 194: uint8(_BT_LEAD2),
  17405. 195: uint8(_BT_LEAD2),
  17406. 196: uint8(_BT_LEAD2),
  17407. 197: uint8(_BT_LEAD2),
  17408. 198: uint8(_BT_LEAD2),
  17409. 199: uint8(_BT_LEAD2),
  17410. 200: uint8(_BT_LEAD2),
  17411. 201: uint8(_BT_LEAD2),
  17412. 202: uint8(_BT_LEAD2),
  17413. 203: uint8(_BT_LEAD2),
  17414. 204: uint8(_BT_LEAD2),
  17415. 205: uint8(_BT_LEAD2),
  17416. 206: uint8(_BT_LEAD2),
  17417. 207: uint8(_BT_LEAD2),
  17418. 208: uint8(_BT_LEAD2),
  17419. 209: uint8(_BT_LEAD2),
  17420. 210: uint8(_BT_LEAD2),
  17421. 211: uint8(_BT_LEAD2),
  17422. 212: uint8(_BT_LEAD2),
  17423. 213: uint8(_BT_LEAD2),
  17424. 214: uint8(_BT_LEAD2),
  17425. 215: uint8(_BT_LEAD2),
  17426. 216: uint8(_BT_LEAD2),
  17427. 217: uint8(_BT_LEAD2),
  17428. 218: uint8(_BT_LEAD2),
  17429. 219: uint8(_BT_LEAD2),
  17430. 220: uint8(_BT_LEAD2),
  17431. 221: uint8(_BT_LEAD2),
  17432. 222: uint8(_BT_LEAD2),
  17433. 223: uint8(_BT_LEAD2),
  17434. 224: uint8(_BT_LEAD3),
  17435. 225: uint8(_BT_LEAD3),
  17436. 226: uint8(_BT_LEAD3),
  17437. 227: uint8(_BT_LEAD3),
  17438. 228: uint8(_BT_LEAD3),
  17439. 229: uint8(_BT_LEAD3),
  17440. 230: uint8(_BT_LEAD3),
  17441. 231: uint8(_BT_LEAD3),
  17442. 232: uint8(_BT_LEAD3),
  17443. 233: uint8(_BT_LEAD3),
  17444. 234: uint8(_BT_LEAD3),
  17445. 235: uint8(_BT_LEAD3),
  17446. 236: uint8(_BT_LEAD3),
  17447. 237: uint8(_BT_LEAD3),
  17448. 238: uint8(_BT_LEAD3),
  17449. 239: uint8(_BT_LEAD3),
  17450. 240: uint8(_BT_LEAD4),
  17451. 241: uint8(_BT_LEAD4),
  17452. 242: uint8(_BT_LEAD4),
  17453. 243: uint8(_BT_LEAD4),
  17454. 244: uint8(_BT_LEAD4),
  17455. 254: uint8(_BT_MALFORM),
  17456. 255: uint8(_BT_MALFORM),
  17457. },
  17458. }
  17459. func init() {
  17460. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17461. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17462. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17463. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17464. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17465. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17466. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17467. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17468. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17469. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17470. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17471. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17472. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17473. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17474. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17475. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17476. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17477. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17478. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17479. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17480. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17481. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17482. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17483. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17484. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17485. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17486. }
  17487. var _internal_utf8_encoding = Tnormal_encoding{
  17488. Fenc: TENCODING{
  17489. Fscanners: [4]TSCANNER{},
  17490. FliteralScanners: [2]TSCANNER{},
  17491. FminBytesPerChar: int32(1),
  17492. FisUtf8: int8(1),
  17493. },
  17494. Ftype1: [256]uint8{
  17495. 9: uint8(_BT_S),
  17496. 10: uint8(_BT_LF),
  17497. 13: uint8(_BT_S),
  17498. 32: uint8(_BT_S),
  17499. 33: uint8(_BT_EXCL),
  17500. 34: uint8(_BT_QUOT),
  17501. 35: uint8(_BT_NUM),
  17502. 36: uint8(_BT_OTHER),
  17503. 37: uint8(_BT_PERCNT),
  17504. 38: uint8(_BT_AMP),
  17505. 39: uint8(_BT_APOS),
  17506. 40: uint8(_BT_LPAR),
  17507. 41: uint8(_BT_RPAR),
  17508. 42: uint8(_BT_AST),
  17509. 43: uint8(_BT_PLUS),
  17510. 44: uint8(_BT_COMMA),
  17511. 45: uint8(_BT_MINUS),
  17512. 46: uint8(_BT_NAME),
  17513. 47: uint8(_BT_SOL),
  17514. 48: uint8(_BT_DIGIT),
  17515. 49: uint8(_BT_DIGIT),
  17516. 50: uint8(_BT_DIGIT),
  17517. 51: uint8(_BT_DIGIT),
  17518. 52: uint8(_BT_DIGIT),
  17519. 53: uint8(_BT_DIGIT),
  17520. 54: uint8(_BT_DIGIT),
  17521. 55: uint8(_BT_DIGIT),
  17522. 56: uint8(_BT_DIGIT),
  17523. 57: uint8(_BT_DIGIT),
  17524. 58: uint8(_BT_NMSTRT),
  17525. 59: uint8(_BT_SEMI),
  17526. 60: uint8(_BT_LT),
  17527. 61: uint8(_BT_EQUALS),
  17528. 62: uint8(_BT_GT),
  17529. 63: uint8(_BT_QUEST),
  17530. 64: uint8(_BT_OTHER),
  17531. 65: uint8(_BT_HEX),
  17532. 66: uint8(_BT_HEX),
  17533. 67: uint8(_BT_HEX),
  17534. 68: uint8(_BT_HEX),
  17535. 69: uint8(_BT_HEX),
  17536. 70: uint8(_BT_HEX),
  17537. 71: uint8(_BT_NMSTRT),
  17538. 72: uint8(_BT_NMSTRT),
  17539. 73: uint8(_BT_NMSTRT),
  17540. 74: uint8(_BT_NMSTRT),
  17541. 75: uint8(_BT_NMSTRT),
  17542. 76: uint8(_BT_NMSTRT),
  17543. 77: uint8(_BT_NMSTRT),
  17544. 78: uint8(_BT_NMSTRT),
  17545. 79: uint8(_BT_NMSTRT),
  17546. 80: uint8(_BT_NMSTRT),
  17547. 81: uint8(_BT_NMSTRT),
  17548. 82: uint8(_BT_NMSTRT),
  17549. 83: uint8(_BT_NMSTRT),
  17550. 84: uint8(_BT_NMSTRT),
  17551. 85: uint8(_BT_NMSTRT),
  17552. 86: uint8(_BT_NMSTRT),
  17553. 87: uint8(_BT_NMSTRT),
  17554. 88: uint8(_BT_NMSTRT),
  17555. 89: uint8(_BT_NMSTRT),
  17556. 90: uint8(_BT_NMSTRT),
  17557. 91: uint8(_BT_LSQB),
  17558. 92: uint8(_BT_OTHER),
  17559. 93: uint8(_BT_RSQB),
  17560. 94: uint8(_BT_OTHER),
  17561. 95: uint8(_BT_NMSTRT),
  17562. 96: uint8(_BT_OTHER),
  17563. 97: uint8(_BT_HEX),
  17564. 98: uint8(_BT_HEX),
  17565. 99: uint8(_BT_HEX),
  17566. 100: uint8(_BT_HEX),
  17567. 101: uint8(_BT_HEX),
  17568. 102: uint8(_BT_HEX),
  17569. 103: uint8(_BT_NMSTRT),
  17570. 104: uint8(_BT_NMSTRT),
  17571. 105: uint8(_BT_NMSTRT),
  17572. 106: uint8(_BT_NMSTRT),
  17573. 107: uint8(_BT_NMSTRT),
  17574. 108: uint8(_BT_NMSTRT),
  17575. 109: uint8(_BT_NMSTRT),
  17576. 110: uint8(_BT_NMSTRT),
  17577. 111: uint8(_BT_NMSTRT),
  17578. 112: uint8(_BT_NMSTRT),
  17579. 113: uint8(_BT_NMSTRT),
  17580. 114: uint8(_BT_NMSTRT),
  17581. 115: uint8(_BT_NMSTRT),
  17582. 116: uint8(_BT_NMSTRT),
  17583. 117: uint8(_BT_NMSTRT),
  17584. 118: uint8(_BT_NMSTRT),
  17585. 119: uint8(_BT_NMSTRT),
  17586. 120: uint8(_BT_NMSTRT),
  17587. 121: uint8(_BT_NMSTRT),
  17588. 122: uint8(_BT_NMSTRT),
  17589. 123: uint8(_BT_OTHER),
  17590. 124: uint8(_BT_VERBAR),
  17591. 125: uint8(_BT_OTHER),
  17592. 126: uint8(_BT_OTHER),
  17593. 127: uint8(_BT_OTHER),
  17594. 128: uint8(_BT_TRAIL),
  17595. 129: uint8(_BT_TRAIL),
  17596. 130: uint8(_BT_TRAIL),
  17597. 131: uint8(_BT_TRAIL),
  17598. 132: uint8(_BT_TRAIL),
  17599. 133: uint8(_BT_TRAIL),
  17600. 134: uint8(_BT_TRAIL),
  17601. 135: uint8(_BT_TRAIL),
  17602. 136: uint8(_BT_TRAIL),
  17603. 137: uint8(_BT_TRAIL),
  17604. 138: uint8(_BT_TRAIL),
  17605. 139: uint8(_BT_TRAIL),
  17606. 140: uint8(_BT_TRAIL),
  17607. 141: uint8(_BT_TRAIL),
  17608. 142: uint8(_BT_TRAIL),
  17609. 143: uint8(_BT_TRAIL),
  17610. 144: uint8(_BT_TRAIL),
  17611. 145: uint8(_BT_TRAIL),
  17612. 146: uint8(_BT_TRAIL),
  17613. 147: uint8(_BT_TRAIL),
  17614. 148: uint8(_BT_TRAIL),
  17615. 149: uint8(_BT_TRAIL),
  17616. 150: uint8(_BT_TRAIL),
  17617. 151: uint8(_BT_TRAIL),
  17618. 152: uint8(_BT_TRAIL),
  17619. 153: uint8(_BT_TRAIL),
  17620. 154: uint8(_BT_TRAIL),
  17621. 155: uint8(_BT_TRAIL),
  17622. 156: uint8(_BT_TRAIL),
  17623. 157: uint8(_BT_TRAIL),
  17624. 158: uint8(_BT_TRAIL),
  17625. 159: uint8(_BT_TRAIL),
  17626. 160: uint8(_BT_TRAIL),
  17627. 161: uint8(_BT_TRAIL),
  17628. 162: uint8(_BT_TRAIL),
  17629. 163: uint8(_BT_TRAIL),
  17630. 164: uint8(_BT_TRAIL),
  17631. 165: uint8(_BT_TRAIL),
  17632. 166: uint8(_BT_TRAIL),
  17633. 167: uint8(_BT_TRAIL),
  17634. 168: uint8(_BT_TRAIL),
  17635. 169: uint8(_BT_TRAIL),
  17636. 170: uint8(_BT_TRAIL),
  17637. 171: uint8(_BT_TRAIL),
  17638. 172: uint8(_BT_TRAIL),
  17639. 173: uint8(_BT_TRAIL),
  17640. 174: uint8(_BT_TRAIL),
  17641. 175: uint8(_BT_TRAIL),
  17642. 176: uint8(_BT_TRAIL),
  17643. 177: uint8(_BT_TRAIL),
  17644. 178: uint8(_BT_TRAIL),
  17645. 179: uint8(_BT_TRAIL),
  17646. 180: uint8(_BT_TRAIL),
  17647. 181: uint8(_BT_TRAIL),
  17648. 182: uint8(_BT_TRAIL),
  17649. 183: uint8(_BT_TRAIL),
  17650. 184: uint8(_BT_TRAIL),
  17651. 185: uint8(_BT_TRAIL),
  17652. 186: uint8(_BT_TRAIL),
  17653. 187: uint8(_BT_TRAIL),
  17654. 188: uint8(_BT_TRAIL),
  17655. 189: uint8(_BT_TRAIL),
  17656. 190: uint8(_BT_TRAIL),
  17657. 191: uint8(_BT_TRAIL),
  17658. 192: uint8(_BT_LEAD2),
  17659. 193: uint8(_BT_LEAD2),
  17660. 194: uint8(_BT_LEAD2),
  17661. 195: uint8(_BT_LEAD2),
  17662. 196: uint8(_BT_LEAD2),
  17663. 197: uint8(_BT_LEAD2),
  17664. 198: uint8(_BT_LEAD2),
  17665. 199: uint8(_BT_LEAD2),
  17666. 200: uint8(_BT_LEAD2),
  17667. 201: uint8(_BT_LEAD2),
  17668. 202: uint8(_BT_LEAD2),
  17669. 203: uint8(_BT_LEAD2),
  17670. 204: uint8(_BT_LEAD2),
  17671. 205: uint8(_BT_LEAD2),
  17672. 206: uint8(_BT_LEAD2),
  17673. 207: uint8(_BT_LEAD2),
  17674. 208: uint8(_BT_LEAD2),
  17675. 209: uint8(_BT_LEAD2),
  17676. 210: uint8(_BT_LEAD2),
  17677. 211: uint8(_BT_LEAD2),
  17678. 212: uint8(_BT_LEAD2),
  17679. 213: uint8(_BT_LEAD2),
  17680. 214: uint8(_BT_LEAD2),
  17681. 215: uint8(_BT_LEAD2),
  17682. 216: uint8(_BT_LEAD2),
  17683. 217: uint8(_BT_LEAD2),
  17684. 218: uint8(_BT_LEAD2),
  17685. 219: uint8(_BT_LEAD2),
  17686. 220: uint8(_BT_LEAD2),
  17687. 221: uint8(_BT_LEAD2),
  17688. 222: uint8(_BT_LEAD2),
  17689. 223: uint8(_BT_LEAD2),
  17690. 224: uint8(_BT_LEAD3),
  17691. 225: uint8(_BT_LEAD3),
  17692. 226: uint8(_BT_LEAD3),
  17693. 227: uint8(_BT_LEAD3),
  17694. 228: uint8(_BT_LEAD3),
  17695. 229: uint8(_BT_LEAD3),
  17696. 230: uint8(_BT_LEAD3),
  17697. 231: uint8(_BT_LEAD3),
  17698. 232: uint8(_BT_LEAD3),
  17699. 233: uint8(_BT_LEAD3),
  17700. 234: uint8(_BT_LEAD3),
  17701. 235: uint8(_BT_LEAD3),
  17702. 236: uint8(_BT_LEAD3),
  17703. 237: uint8(_BT_LEAD3),
  17704. 238: uint8(_BT_LEAD3),
  17705. 239: uint8(_BT_LEAD3),
  17706. 240: uint8(_BT_LEAD4),
  17707. 241: uint8(_BT_LEAD4),
  17708. 242: uint8(_BT_LEAD4),
  17709. 243: uint8(_BT_LEAD4),
  17710. 244: uint8(_BT_LEAD4),
  17711. 254: uint8(_BT_MALFORM),
  17712. 255: uint8(_BT_MALFORM),
  17713. },
  17714. }
  17715. func init() {
  17716. p := unsafe.Pointer(&_internal_utf8_encoding)
  17717. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17718. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17719. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17720. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17721. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17722. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17723. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17724. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17725. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17726. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17727. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17728. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17729. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17730. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17731. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17732. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17733. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17734. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17735. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17736. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17737. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17738. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17739. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17740. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17741. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17742. }
  17743. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17744. var c uint8
  17745. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17746. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17747. _ = enc
  17748. for {
  17749. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17750. return int32(_XML_CONVERT_COMPLETED)
  17751. }
  17752. c = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))
  17753. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17754. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  17755. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17756. }
  17757. v3 = toP
  17758. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17759. *(*uintptr)(unsafe.Pointer(v3))++
  17760. *(*int8)(unsafe.Pointer(v2)) = int8(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17761. v5 = toP
  17762. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17763. *(*uintptr)(unsafe.Pointer(v5))++
  17764. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17765. *(*uintptr)(unsafe.Pointer(fromP))++
  17766. } else {
  17767. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17768. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17769. }
  17770. v7 = toP
  17771. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17772. *(*uintptr)(unsafe.Pointer(v7))++
  17773. v9 = fromP
  17774. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17775. *(*uintptr)(unsafe.Pointer(v9))++
  17776. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(v8))
  17777. }
  17778. goto _1
  17779. _1:
  17780. }
  17781. return r
  17782. }
  17783. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17784. var v1, v2, v3, v4 uintptr
  17785. _, _, _, _ = v1, v2, v3, v4
  17786. _ = enc
  17787. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17788. v2 = toP
  17789. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17790. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17791. v4 = fromP
  17792. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17793. *(*uintptr)(unsafe.Pointer(v4))++
  17794. *(*uint16)(unsafe.Pointer(v1)) = uint16(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(v3))))
  17795. }
  17796. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17797. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17798. } else {
  17799. return int32(_XML_CONVERT_COMPLETED)
  17800. }
  17801. return r
  17802. }
  17803. var _latin1_encoding_ns = Tnormal_encoding{
  17804. Fenc: TENCODING{
  17805. Fscanners: [4]TSCANNER{},
  17806. FliteralScanners: [2]TSCANNER{},
  17807. FminBytesPerChar: int32(1),
  17808. },
  17809. Ftype1: [256]uint8{
  17810. 9: uint8(_BT_S),
  17811. 10: uint8(_BT_LF),
  17812. 13: uint8(_BT_CR),
  17813. 32: uint8(_BT_S),
  17814. 33: uint8(_BT_EXCL),
  17815. 34: uint8(_BT_QUOT),
  17816. 35: uint8(_BT_NUM),
  17817. 36: uint8(_BT_OTHER),
  17818. 37: uint8(_BT_PERCNT),
  17819. 38: uint8(_BT_AMP),
  17820. 39: uint8(_BT_APOS),
  17821. 40: uint8(_BT_LPAR),
  17822. 41: uint8(_BT_RPAR),
  17823. 42: uint8(_BT_AST),
  17824. 43: uint8(_BT_PLUS),
  17825. 44: uint8(_BT_COMMA),
  17826. 45: uint8(_BT_MINUS),
  17827. 46: uint8(_BT_NAME),
  17828. 47: uint8(_BT_SOL),
  17829. 48: uint8(_BT_DIGIT),
  17830. 49: uint8(_BT_DIGIT),
  17831. 50: uint8(_BT_DIGIT),
  17832. 51: uint8(_BT_DIGIT),
  17833. 52: uint8(_BT_DIGIT),
  17834. 53: uint8(_BT_DIGIT),
  17835. 54: uint8(_BT_DIGIT),
  17836. 55: uint8(_BT_DIGIT),
  17837. 56: uint8(_BT_DIGIT),
  17838. 57: uint8(_BT_DIGIT),
  17839. 58: uint8(_BT_COLON),
  17840. 59: uint8(_BT_SEMI),
  17841. 60: uint8(_BT_LT),
  17842. 61: uint8(_BT_EQUALS),
  17843. 62: uint8(_BT_GT),
  17844. 63: uint8(_BT_QUEST),
  17845. 64: uint8(_BT_OTHER),
  17846. 65: uint8(_BT_HEX),
  17847. 66: uint8(_BT_HEX),
  17848. 67: uint8(_BT_HEX),
  17849. 68: uint8(_BT_HEX),
  17850. 69: uint8(_BT_HEX),
  17851. 70: uint8(_BT_HEX),
  17852. 71: uint8(_BT_NMSTRT),
  17853. 72: uint8(_BT_NMSTRT),
  17854. 73: uint8(_BT_NMSTRT),
  17855. 74: uint8(_BT_NMSTRT),
  17856. 75: uint8(_BT_NMSTRT),
  17857. 76: uint8(_BT_NMSTRT),
  17858. 77: uint8(_BT_NMSTRT),
  17859. 78: uint8(_BT_NMSTRT),
  17860. 79: uint8(_BT_NMSTRT),
  17861. 80: uint8(_BT_NMSTRT),
  17862. 81: uint8(_BT_NMSTRT),
  17863. 82: uint8(_BT_NMSTRT),
  17864. 83: uint8(_BT_NMSTRT),
  17865. 84: uint8(_BT_NMSTRT),
  17866. 85: uint8(_BT_NMSTRT),
  17867. 86: uint8(_BT_NMSTRT),
  17868. 87: uint8(_BT_NMSTRT),
  17869. 88: uint8(_BT_NMSTRT),
  17870. 89: uint8(_BT_NMSTRT),
  17871. 90: uint8(_BT_NMSTRT),
  17872. 91: uint8(_BT_LSQB),
  17873. 92: uint8(_BT_OTHER),
  17874. 93: uint8(_BT_RSQB),
  17875. 94: uint8(_BT_OTHER),
  17876. 95: uint8(_BT_NMSTRT),
  17877. 96: uint8(_BT_OTHER),
  17878. 97: uint8(_BT_HEX),
  17879. 98: uint8(_BT_HEX),
  17880. 99: uint8(_BT_HEX),
  17881. 100: uint8(_BT_HEX),
  17882. 101: uint8(_BT_HEX),
  17883. 102: uint8(_BT_HEX),
  17884. 103: uint8(_BT_NMSTRT),
  17885. 104: uint8(_BT_NMSTRT),
  17886. 105: uint8(_BT_NMSTRT),
  17887. 106: uint8(_BT_NMSTRT),
  17888. 107: uint8(_BT_NMSTRT),
  17889. 108: uint8(_BT_NMSTRT),
  17890. 109: uint8(_BT_NMSTRT),
  17891. 110: uint8(_BT_NMSTRT),
  17892. 111: uint8(_BT_NMSTRT),
  17893. 112: uint8(_BT_NMSTRT),
  17894. 113: uint8(_BT_NMSTRT),
  17895. 114: uint8(_BT_NMSTRT),
  17896. 115: uint8(_BT_NMSTRT),
  17897. 116: uint8(_BT_NMSTRT),
  17898. 117: uint8(_BT_NMSTRT),
  17899. 118: uint8(_BT_NMSTRT),
  17900. 119: uint8(_BT_NMSTRT),
  17901. 120: uint8(_BT_NMSTRT),
  17902. 121: uint8(_BT_NMSTRT),
  17903. 122: uint8(_BT_NMSTRT),
  17904. 123: uint8(_BT_OTHER),
  17905. 124: uint8(_BT_VERBAR),
  17906. 125: uint8(_BT_OTHER),
  17907. 126: uint8(_BT_OTHER),
  17908. 127: uint8(_BT_OTHER),
  17909. 128: uint8(_BT_OTHER),
  17910. 129: uint8(_BT_OTHER),
  17911. 130: uint8(_BT_OTHER),
  17912. 131: uint8(_BT_OTHER),
  17913. 132: uint8(_BT_OTHER),
  17914. 133: uint8(_BT_OTHER),
  17915. 134: uint8(_BT_OTHER),
  17916. 135: uint8(_BT_OTHER),
  17917. 136: uint8(_BT_OTHER),
  17918. 137: uint8(_BT_OTHER),
  17919. 138: uint8(_BT_OTHER),
  17920. 139: uint8(_BT_OTHER),
  17921. 140: uint8(_BT_OTHER),
  17922. 141: uint8(_BT_OTHER),
  17923. 142: uint8(_BT_OTHER),
  17924. 143: uint8(_BT_OTHER),
  17925. 144: uint8(_BT_OTHER),
  17926. 145: uint8(_BT_OTHER),
  17927. 146: uint8(_BT_OTHER),
  17928. 147: uint8(_BT_OTHER),
  17929. 148: uint8(_BT_OTHER),
  17930. 149: uint8(_BT_OTHER),
  17931. 150: uint8(_BT_OTHER),
  17932. 151: uint8(_BT_OTHER),
  17933. 152: uint8(_BT_OTHER),
  17934. 153: uint8(_BT_OTHER),
  17935. 154: uint8(_BT_OTHER),
  17936. 155: uint8(_BT_OTHER),
  17937. 156: uint8(_BT_OTHER),
  17938. 157: uint8(_BT_OTHER),
  17939. 158: uint8(_BT_OTHER),
  17940. 159: uint8(_BT_OTHER),
  17941. 160: uint8(_BT_OTHER),
  17942. 161: uint8(_BT_OTHER),
  17943. 162: uint8(_BT_OTHER),
  17944. 163: uint8(_BT_OTHER),
  17945. 164: uint8(_BT_OTHER),
  17946. 165: uint8(_BT_OTHER),
  17947. 166: uint8(_BT_OTHER),
  17948. 167: uint8(_BT_OTHER),
  17949. 168: uint8(_BT_OTHER),
  17950. 169: uint8(_BT_OTHER),
  17951. 170: uint8(_BT_NMSTRT),
  17952. 171: uint8(_BT_OTHER),
  17953. 172: uint8(_BT_OTHER),
  17954. 173: uint8(_BT_OTHER),
  17955. 174: uint8(_BT_OTHER),
  17956. 175: uint8(_BT_OTHER),
  17957. 176: uint8(_BT_OTHER),
  17958. 177: uint8(_BT_OTHER),
  17959. 178: uint8(_BT_OTHER),
  17960. 179: uint8(_BT_OTHER),
  17961. 180: uint8(_BT_OTHER),
  17962. 181: uint8(_BT_NMSTRT),
  17963. 182: uint8(_BT_OTHER),
  17964. 183: uint8(_BT_NAME),
  17965. 184: uint8(_BT_OTHER),
  17966. 185: uint8(_BT_OTHER),
  17967. 186: uint8(_BT_NMSTRT),
  17968. 187: uint8(_BT_OTHER),
  17969. 188: uint8(_BT_OTHER),
  17970. 189: uint8(_BT_OTHER),
  17971. 190: uint8(_BT_OTHER),
  17972. 191: uint8(_BT_OTHER),
  17973. 192: uint8(_BT_NMSTRT),
  17974. 193: uint8(_BT_NMSTRT),
  17975. 194: uint8(_BT_NMSTRT),
  17976. 195: uint8(_BT_NMSTRT),
  17977. 196: uint8(_BT_NMSTRT),
  17978. 197: uint8(_BT_NMSTRT),
  17979. 198: uint8(_BT_NMSTRT),
  17980. 199: uint8(_BT_NMSTRT),
  17981. 200: uint8(_BT_NMSTRT),
  17982. 201: uint8(_BT_NMSTRT),
  17983. 202: uint8(_BT_NMSTRT),
  17984. 203: uint8(_BT_NMSTRT),
  17985. 204: uint8(_BT_NMSTRT),
  17986. 205: uint8(_BT_NMSTRT),
  17987. 206: uint8(_BT_NMSTRT),
  17988. 207: uint8(_BT_NMSTRT),
  17989. 208: uint8(_BT_NMSTRT),
  17990. 209: uint8(_BT_NMSTRT),
  17991. 210: uint8(_BT_NMSTRT),
  17992. 211: uint8(_BT_NMSTRT),
  17993. 212: uint8(_BT_NMSTRT),
  17994. 213: uint8(_BT_NMSTRT),
  17995. 214: uint8(_BT_NMSTRT),
  17996. 215: uint8(_BT_OTHER),
  17997. 216: uint8(_BT_NMSTRT),
  17998. 217: uint8(_BT_NMSTRT),
  17999. 218: uint8(_BT_NMSTRT),
  18000. 219: uint8(_BT_NMSTRT),
  18001. 220: uint8(_BT_NMSTRT),
  18002. 221: uint8(_BT_NMSTRT),
  18003. 222: uint8(_BT_NMSTRT),
  18004. 223: uint8(_BT_NMSTRT),
  18005. 224: uint8(_BT_NMSTRT),
  18006. 225: uint8(_BT_NMSTRT),
  18007. 226: uint8(_BT_NMSTRT),
  18008. 227: uint8(_BT_NMSTRT),
  18009. 228: uint8(_BT_NMSTRT),
  18010. 229: uint8(_BT_NMSTRT),
  18011. 230: uint8(_BT_NMSTRT),
  18012. 231: uint8(_BT_NMSTRT),
  18013. 232: uint8(_BT_NMSTRT),
  18014. 233: uint8(_BT_NMSTRT),
  18015. 234: uint8(_BT_NMSTRT),
  18016. 235: uint8(_BT_NMSTRT),
  18017. 236: uint8(_BT_NMSTRT),
  18018. 237: uint8(_BT_NMSTRT),
  18019. 238: uint8(_BT_NMSTRT),
  18020. 239: uint8(_BT_NMSTRT),
  18021. 240: uint8(_BT_NMSTRT),
  18022. 241: uint8(_BT_NMSTRT),
  18023. 242: uint8(_BT_NMSTRT),
  18024. 243: uint8(_BT_NMSTRT),
  18025. 244: uint8(_BT_NMSTRT),
  18026. 245: uint8(_BT_NMSTRT),
  18027. 246: uint8(_BT_NMSTRT),
  18028. 247: uint8(_BT_OTHER),
  18029. 248: uint8(_BT_NMSTRT),
  18030. 249: uint8(_BT_NMSTRT),
  18031. 250: uint8(_BT_NMSTRT),
  18032. 251: uint8(_BT_NMSTRT),
  18033. 252: uint8(_BT_NMSTRT),
  18034. 253: uint8(_BT_NMSTRT),
  18035. 254: uint8(_BT_NMSTRT),
  18036. 255: uint8(_BT_NMSTRT),
  18037. },
  18038. }
  18039. func init() {
  18040. p := unsafe.Pointer(&_latin1_encoding_ns)
  18041. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18042. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18043. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18044. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18045. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18046. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18047. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18048. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18049. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18050. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18051. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18052. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18053. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18054. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18055. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  18056. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18057. }
  18058. var _latin1_encoding = Tnormal_encoding{
  18059. Fenc: TENCODING{
  18060. Fscanners: [4]TSCANNER{},
  18061. FliteralScanners: [2]TSCANNER{},
  18062. FminBytesPerChar: int32(1),
  18063. },
  18064. Ftype1: [256]uint8{
  18065. 9: uint8(_BT_S),
  18066. 10: uint8(_BT_LF),
  18067. 13: uint8(_BT_CR),
  18068. 32: uint8(_BT_S),
  18069. 33: uint8(_BT_EXCL),
  18070. 34: uint8(_BT_QUOT),
  18071. 35: uint8(_BT_NUM),
  18072. 36: uint8(_BT_OTHER),
  18073. 37: uint8(_BT_PERCNT),
  18074. 38: uint8(_BT_AMP),
  18075. 39: uint8(_BT_APOS),
  18076. 40: uint8(_BT_LPAR),
  18077. 41: uint8(_BT_RPAR),
  18078. 42: uint8(_BT_AST),
  18079. 43: uint8(_BT_PLUS),
  18080. 44: uint8(_BT_COMMA),
  18081. 45: uint8(_BT_MINUS),
  18082. 46: uint8(_BT_NAME),
  18083. 47: uint8(_BT_SOL),
  18084. 48: uint8(_BT_DIGIT),
  18085. 49: uint8(_BT_DIGIT),
  18086. 50: uint8(_BT_DIGIT),
  18087. 51: uint8(_BT_DIGIT),
  18088. 52: uint8(_BT_DIGIT),
  18089. 53: uint8(_BT_DIGIT),
  18090. 54: uint8(_BT_DIGIT),
  18091. 55: uint8(_BT_DIGIT),
  18092. 56: uint8(_BT_DIGIT),
  18093. 57: uint8(_BT_DIGIT),
  18094. 58: uint8(_BT_NMSTRT),
  18095. 59: uint8(_BT_SEMI),
  18096. 60: uint8(_BT_LT),
  18097. 61: uint8(_BT_EQUALS),
  18098. 62: uint8(_BT_GT),
  18099. 63: uint8(_BT_QUEST),
  18100. 64: uint8(_BT_OTHER),
  18101. 65: uint8(_BT_HEX),
  18102. 66: uint8(_BT_HEX),
  18103. 67: uint8(_BT_HEX),
  18104. 68: uint8(_BT_HEX),
  18105. 69: uint8(_BT_HEX),
  18106. 70: uint8(_BT_HEX),
  18107. 71: uint8(_BT_NMSTRT),
  18108. 72: uint8(_BT_NMSTRT),
  18109. 73: uint8(_BT_NMSTRT),
  18110. 74: uint8(_BT_NMSTRT),
  18111. 75: uint8(_BT_NMSTRT),
  18112. 76: uint8(_BT_NMSTRT),
  18113. 77: uint8(_BT_NMSTRT),
  18114. 78: uint8(_BT_NMSTRT),
  18115. 79: uint8(_BT_NMSTRT),
  18116. 80: uint8(_BT_NMSTRT),
  18117. 81: uint8(_BT_NMSTRT),
  18118. 82: uint8(_BT_NMSTRT),
  18119. 83: uint8(_BT_NMSTRT),
  18120. 84: uint8(_BT_NMSTRT),
  18121. 85: uint8(_BT_NMSTRT),
  18122. 86: uint8(_BT_NMSTRT),
  18123. 87: uint8(_BT_NMSTRT),
  18124. 88: uint8(_BT_NMSTRT),
  18125. 89: uint8(_BT_NMSTRT),
  18126. 90: uint8(_BT_NMSTRT),
  18127. 91: uint8(_BT_LSQB),
  18128. 92: uint8(_BT_OTHER),
  18129. 93: uint8(_BT_RSQB),
  18130. 94: uint8(_BT_OTHER),
  18131. 95: uint8(_BT_NMSTRT),
  18132. 96: uint8(_BT_OTHER),
  18133. 97: uint8(_BT_HEX),
  18134. 98: uint8(_BT_HEX),
  18135. 99: uint8(_BT_HEX),
  18136. 100: uint8(_BT_HEX),
  18137. 101: uint8(_BT_HEX),
  18138. 102: uint8(_BT_HEX),
  18139. 103: uint8(_BT_NMSTRT),
  18140. 104: uint8(_BT_NMSTRT),
  18141. 105: uint8(_BT_NMSTRT),
  18142. 106: uint8(_BT_NMSTRT),
  18143. 107: uint8(_BT_NMSTRT),
  18144. 108: uint8(_BT_NMSTRT),
  18145. 109: uint8(_BT_NMSTRT),
  18146. 110: uint8(_BT_NMSTRT),
  18147. 111: uint8(_BT_NMSTRT),
  18148. 112: uint8(_BT_NMSTRT),
  18149. 113: uint8(_BT_NMSTRT),
  18150. 114: uint8(_BT_NMSTRT),
  18151. 115: uint8(_BT_NMSTRT),
  18152. 116: uint8(_BT_NMSTRT),
  18153. 117: uint8(_BT_NMSTRT),
  18154. 118: uint8(_BT_NMSTRT),
  18155. 119: uint8(_BT_NMSTRT),
  18156. 120: uint8(_BT_NMSTRT),
  18157. 121: uint8(_BT_NMSTRT),
  18158. 122: uint8(_BT_NMSTRT),
  18159. 123: uint8(_BT_OTHER),
  18160. 124: uint8(_BT_VERBAR),
  18161. 125: uint8(_BT_OTHER),
  18162. 126: uint8(_BT_OTHER),
  18163. 127: uint8(_BT_OTHER),
  18164. 128: uint8(_BT_OTHER),
  18165. 129: uint8(_BT_OTHER),
  18166. 130: uint8(_BT_OTHER),
  18167. 131: uint8(_BT_OTHER),
  18168. 132: uint8(_BT_OTHER),
  18169. 133: uint8(_BT_OTHER),
  18170. 134: uint8(_BT_OTHER),
  18171. 135: uint8(_BT_OTHER),
  18172. 136: uint8(_BT_OTHER),
  18173. 137: uint8(_BT_OTHER),
  18174. 138: uint8(_BT_OTHER),
  18175. 139: uint8(_BT_OTHER),
  18176. 140: uint8(_BT_OTHER),
  18177. 141: uint8(_BT_OTHER),
  18178. 142: uint8(_BT_OTHER),
  18179. 143: uint8(_BT_OTHER),
  18180. 144: uint8(_BT_OTHER),
  18181. 145: uint8(_BT_OTHER),
  18182. 146: uint8(_BT_OTHER),
  18183. 147: uint8(_BT_OTHER),
  18184. 148: uint8(_BT_OTHER),
  18185. 149: uint8(_BT_OTHER),
  18186. 150: uint8(_BT_OTHER),
  18187. 151: uint8(_BT_OTHER),
  18188. 152: uint8(_BT_OTHER),
  18189. 153: uint8(_BT_OTHER),
  18190. 154: uint8(_BT_OTHER),
  18191. 155: uint8(_BT_OTHER),
  18192. 156: uint8(_BT_OTHER),
  18193. 157: uint8(_BT_OTHER),
  18194. 158: uint8(_BT_OTHER),
  18195. 159: uint8(_BT_OTHER),
  18196. 160: uint8(_BT_OTHER),
  18197. 161: uint8(_BT_OTHER),
  18198. 162: uint8(_BT_OTHER),
  18199. 163: uint8(_BT_OTHER),
  18200. 164: uint8(_BT_OTHER),
  18201. 165: uint8(_BT_OTHER),
  18202. 166: uint8(_BT_OTHER),
  18203. 167: uint8(_BT_OTHER),
  18204. 168: uint8(_BT_OTHER),
  18205. 169: uint8(_BT_OTHER),
  18206. 170: uint8(_BT_NMSTRT),
  18207. 171: uint8(_BT_OTHER),
  18208. 172: uint8(_BT_OTHER),
  18209. 173: uint8(_BT_OTHER),
  18210. 174: uint8(_BT_OTHER),
  18211. 175: uint8(_BT_OTHER),
  18212. 176: uint8(_BT_OTHER),
  18213. 177: uint8(_BT_OTHER),
  18214. 178: uint8(_BT_OTHER),
  18215. 179: uint8(_BT_OTHER),
  18216. 180: uint8(_BT_OTHER),
  18217. 181: uint8(_BT_NMSTRT),
  18218. 182: uint8(_BT_OTHER),
  18219. 183: uint8(_BT_NAME),
  18220. 184: uint8(_BT_OTHER),
  18221. 185: uint8(_BT_OTHER),
  18222. 186: uint8(_BT_NMSTRT),
  18223. 187: uint8(_BT_OTHER),
  18224. 188: uint8(_BT_OTHER),
  18225. 189: uint8(_BT_OTHER),
  18226. 190: uint8(_BT_OTHER),
  18227. 191: uint8(_BT_OTHER),
  18228. 192: uint8(_BT_NMSTRT),
  18229. 193: uint8(_BT_NMSTRT),
  18230. 194: uint8(_BT_NMSTRT),
  18231. 195: uint8(_BT_NMSTRT),
  18232. 196: uint8(_BT_NMSTRT),
  18233. 197: uint8(_BT_NMSTRT),
  18234. 198: uint8(_BT_NMSTRT),
  18235. 199: uint8(_BT_NMSTRT),
  18236. 200: uint8(_BT_NMSTRT),
  18237. 201: uint8(_BT_NMSTRT),
  18238. 202: uint8(_BT_NMSTRT),
  18239. 203: uint8(_BT_NMSTRT),
  18240. 204: uint8(_BT_NMSTRT),
  18241. 205: uint8(_BT_NMSTRT),
  18242. 206: uint8(_BT_NMSTRT),
  18243. 207: uint8(_BT_NMSTRT),
  18244. 208: uint8(_BT_NMSTRT),
  18245. 209: uint8(_BT_NMSTRT),
  18246. 210: uint8(_BT_NMSTRT),
  18247. 211: uint8(_BT_NMSTRT),
  18248. 212: uint8(_BT_NMSTRT),
  18249. 213: uint8(_BT_NMSTRT),
  18250. 214: uint8(_BT_NMSTRT),
  18251. 215: uint8(_BT_OTHER),
  18252. 216: uint8(_BT_NMSTRT),
  18253. 217: uint8(_BT_NMSTRT),
  18254. 218: uint8(_BT_NMSTRT),
  18255. 219: uint8(_BT_NMSTRT),
  18256. 220: uint8(_BT_NMSTRT),
  18257. 221: uint8(_BT_NMSTRT),
  18258. 222: uint8(_BT_NMSTRT),
  18259. 223: uint8(_BT_NMSTRT),
  18260. 224: uint8(_BT_NMSTRT),
  18261. 225: uint8(_BT_NMSTRT),
  18262. 226: uint8(_BT_NMSTRT),
  18263. 227: uint8(_BT_NMSTRT),
  18264. 228: uint8(_BT_NMSTRT),
  18265. 229: uint8(_BT_NMSTRT),
  18266. 230: uint8(_BT_NMSTRT),
  18267. 231: uint8(_BT_NMSTRT),
  18268. 232: uint8(_BT_NMSTRT),
  18269. 233: uint8(_BT_NMSTRT),
  18270. 234: uint8(_BT_NMSTRT),
  18271. 235: uint8(_BT_NMSTRT),
  18272. 236: uint8(_BT_NMSTRT),
  18273. 237: uint8(_BT_NMSTRT),
  18274. 238: uint8(_BT_NMSTRT),
  18275. 239: uint8(_BT_NMSTRT),
  18276. 240: uint8(_BT_NMSTRT),
  18277. 241: uint8(_BT_NMSTRT),
  18278. 242: uint8(_BT_NMSTRT),
  18279. 243: uint8(_BT_NMSTRT),
  18280. 244: uint8(_BT_NMSTRT),
  18281. 245: uint8(_BT_NMSTRT),
  18282. 246: uint8(_BT_NMSTRT),
  18283. 247: uint8(_BT_OTHER),
  18284. 248: uint8(_BT_NMSTRT),
  18285. 249: uint8(_BT_NMSTRT),
  18286. 250: uint8(_BT_NMSTRT),
  18287. 251: uint8(_BT_NMSTRT),
  18288. 252: uint8(_BT_NMSTRT),
  18289. 253: uint8(_BT_NMSTRT),
  18290. 254: uint8(_BT_NMSTRT),
  18291. 255: uint8(_BT_NMSTRT),
  18292. },
  18293. }
  18294. func init() {
  18295. p := unsafe.Pointer(&_latin1_encoding)
  18296. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18297. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18298. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18299. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18300. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18301. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18302. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18303. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18304. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18305. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18306. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18307. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18308. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18309. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18310. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  18311. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18312. }
  18313. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18314. var v1, v2, v3, v4 uintptr
  18315. _, _, _, _ = v1, v2, v3, v4
  18316. _ = enc
  18317. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18318. v2 = toP
  18319. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18320. *(*uintptr)(unsafe.Pointer(v2))++
  18321. v4 = fromP
  18322. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18323. *(*uintptr)(unsafe.Pointer(v4))++
  18324. *(*int8)(unsafe.Pointer(v1)) = *(*int8)(unsafe.Pointer(v3))
  18325. }
  18326. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18327. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18328. } else {
  18329. return int32(_XML_CONVERT_COMPLETED)
  18330. }
  18331. return r
  18332. }
  18333. var _ascii_encoding_ns = Tnormal_encoding{
  18334. Fenc: TENCODING{
  18335. Fscanners: [4]TSCANNER{},
  18336. FliteralScanners: [2]TSCANNER{},
  18337. FminBytesPerChar: int32(1),
  18338. FisUtf8: int8(1),
  18339. },
  18340. Ftype1: [256]uint8{
  18341. 9: uint8(_BT_S),
  18342. 10: uint8(_BT_LF),
  18343. 13: uint8(_BT_CR),
  18344. 32: uint8(_BT_S),
  18345. 33: uint8(_BT_EXCL),
  18346. 34: uint8(_BT_QUOT),
  18347. 35: uint8(_BT_NUM),
  18348. 36: uint8(_BT_OTHER),
  18349. 37: uint8(_BT_PERCNT),
  18350. 38: uint8(_BT_AMP),
  18351. 39: uint8(_BT_APOS),
  18352. 40: uint8(_BT_LPAR),
  18353. 41: uint8(_BT_RPAR),
  18354. 42: uint8(_BT_AST),
  18355. 43: uint8(_BT_PLUS),
  18356. 44: uint8(_BT_COMMA),
  18357. 45: uint8(_BT_MINUS),
  18358. 46: uint8(_BT_NAME),
  18359. 47: uint8(_BT_SOL),
  18360. 48: uint8(_BT_DIGIT),
  18361. 49: uint8(_BT_DIGIT),
  18362. 50: uint8(_BT_DIGIT),
  18363. 51: uint8(_BT_DIGIT),
  18364. 52: uint8(_BT_DIGIT),
  18365. 53: uint8(_BT_DIGIT),
  18366. 54: uint8(_BT_DIGIT),
  18367. 55: uint8(_BT_DIGIT),
  18368. 56: uint8(_BT_DIGIT),
  18369. 57: uint8(_BT_DIGIT),
  18370. 58: uint8(_BT_COLON),
  18371. 59: uint8(_BT_SEMI),
  18372. 60: uint8(_BT_LT),
  18373. 61: uint8(_BT_EQUALS),
  18374. 62: uint8(_BT_GT),
  18375. 63: uint8(_BT_QUEST),
  18376. 64: uint8(_BT_OTHER),
  18377. 65: uint8(_BT_HEX),
  18378. 66: uint8(_BT_HEX),
  18379. 67: uint8(_BT_HEX),
  18380. 68: uint8(_BT_HEX),
  18381. 69: uint8(_BT_HEX),
  18382. 70: uint8(_BT_HEX),
  18383. 71: uint8(_BT_NMSTRT),
  18384. 72: uint8(_BT_NMSTRT),
  18385. 73: uint8(_BT_NMSTRT),
  18386. 74: uint8(_BT_NMSTRT),
  18387. 75: uint8(_BT_NMSTRT),
  18388. 76: uint8(_BT_NMSTRT),
  18389. 77: uint8(_BT_NMSTRT),
  18390. 78: uint8(_BT_NMSTRT),
  18391. 79: uint8(_BT_NMSTRT),
  18392. 80: uint8(_BT_NMSTRT),
  18393. 81: uint8(_BT_NMSTRT),
  18394. 82: uint8(_BT_NMSTRT),
  18395. 83: uint8(_BT_NMSTRT),
  18396. 84: uint8(_BT_NMSTRT),
  18397. 85: uint8(_BT_NMSTRT),
  18398. 86: uint8(_BT_NMSTRT),
  18399. 87: uint8(_BT_NMSTRT),
  18400. 88: uint8(_BT_NMSTRT),
  18401. 89: uint8(_BT_NMSTRT),
  18402. 90: uint8(_BT_NMSTRT),
  18403. 91: uint8(_BT_LSQB),
  18404. 92: uint8(_BT_OTHER),
  18405. 93: uint8(_BT_RSQB),
  18406. 94: uint8(_BT_OTHER),
  18407. 95: uint8(_BT_NMSTRT),
  18408. 96: uint8(_BT_OTHER),
  18409. 97: uint8(_BT_HEX),
  18410. 98: uint8(_BT_HEX),
  18411. 99: uint8(_BT_HEX),
  18412. 100: uint8(_BT_HEX),
  18413. 101: uint8(_BT_HEX),
  18414. 102: uint8(_BT_HEX),
  18415. 103: uint8(_BT_NMSTRT),
  18416. 104: uint8(_BT_NMSTRT),
  18417. 105: uint8(_BT_NMSTRT),
  18418. 106: uint8(_BT_NMSTRT),
  18419. 107: uint8(_BT_NMSTRT),
  18420. 108: uint8(_BT_NMSTRT),
  18421. 109: uint8(_BT_NMSTRT),
  18422. 110: uint8(_BT_NMSTRT),
  18423. 111: uint8(_BT_NMSTRT),
  18424. 112: uint8(_BT_NMSTRT),
  18425. 113: uint8(_BT_NMSTRT),
  18426. 114: uint8(_BT_NMSTRT),
  18427. 115: uint8(_BT_NMSTRT),
  18428. 116: uint8(_BT_NMSTRT),
  18429. 117: uint8(_BT_NMSTRT),
  18430. 118: uint8(_BT_NMSTRT),
  18431. 119: uint8(_BT_NMSTRT),
  18432. 120: uint8(_BT_NMSTRT),
  18433. 121: uint8(_BT_NMSTRT),
  18434. 122: uint8(_BT_NMSTRT),
  18435. 123: uint8(_BT_OTHER),
  18436. 124: uint8(_BT_VERBAR),
  18437. 125: uint8(_BT_OTHER),
  18438. 126: uint8(_BT_OTHER),
  18439. 127: uint8(_BT_OTHER),
  18440. },
  18441. }
  18442. func init() {
  18443. p := unsafe.Pointer(&_ascii_encoding_ns)
  18444. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18445. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18446. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18447. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18448. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18449. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18450. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18451. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18452. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18453. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18454. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18455. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18456. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18457. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18458. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18459. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18460. }
  18461. var _ascii_encoding = Tnormal_encoding{
  18462. Fenc: TENCODING{
  18463. Fscanners: [4]TSCANNER{},
  18464. FliteralScanners: [2]TSCANNER{},
  18465. FminBytesPerChar: int32(1),
  18466. FisUtf8: int8(1),
  18467. },
  18468. Ftype1: [256]uint8{
  18469. 9: uint8(_BT_S),
  18470. 10: uint8(_BT_LF),
  18471. 13: uint8(_BT_CR),
  18472. 32: uint8(_BT_S),
  18473. 33: uint8(_BT_EXCL),
  18474. 34: uint8(_BT_QUOT),
  18475. 35: uint8(_BT_NUM),
  18476. 36: uint8(_BT_OTHER),
  18477. 37: uint8(_BT_PERCNT),
  18478. 38: uint8(_BT_AMP),
  18479. 39: uint8(_BT_APOS),
  18480. 40: uint8(_BT_LPAR),
  18481. 41: uint8(_BT_RPAR),
  18482. 42: uint8(_BT_AST),
  18483. 43: uint8(_BT_PLUS),
  18484. 44: uint8(_BT_COMMA),
  18485. 45: uint8(_BT_MINUS),
  18486. 46: uint8(_BT_NAME),
  18487. 47: uint8(_BT_SOL),
  18488. 48: uint8(_BT_DIGIT),
  18489. 49: uint8(_BT_DIGIT),
  18490. 50: uint8(_BT_DIGIT),
  18491. 51: uint8(_BT_DIGIT),
  18492. 52: uint8(_BT_DIGIT),
  18493. 53: uint8(_BT_DIGIT),
  18494. 54: uint8(_BT_DIGIT),
  18495. 55: uint8(_BT_DIGIT),
  18496. 56: uint8(_BT_DIGIT),
  18497. 57: uint8(_BT_DIGIT),
  18498. 58: uint8(_BT_NMSTRT),
  18499. 59: uint8(_BT_SEMI),
  18500. 60: uint8(_BT_LT),
  18501. 61: uint8(_BT_EQUALS),
  18502. 62: uint8(_BT_GT),
  18503. 63: uint8(_BT_QUEST),
  18504. 64: uint8(_BT_OTHER),
  18505. 65: uint8(_BT_HEX),
  18506. 66: uint8(_BT_HEX),
  18507. 67: uint8(_BT_HEX),
  18508. 68: uint8(_BT_HEX),
  18509. 69: uint8(_BT_HEX),
  18510. 70: uint8(_BT_HEX),
  18511. 71: uint8(_BT_NMSTRT),
  18512. 72: uint8(_BT_NMSTRT),
  18513. 73: uint8(_BT_NMSTRT),
  18514. 74: uint8(_BT_NMSTRT),
  18515. 75: uint8(_BT_NMSTRT),
  18516. 76: uint8(_BT_NMSTRT),
  18517. 77: uint8(_BT_NMSTRT),
  18518. 78: uint8(_BT_NMSTRT),
  18519. 79: uint8(_BT_NMSTRT),
  18520. 80: uint8(_BT_NMSTRT),
  18521. 81: uint8(_BT_NMSTRT),
  18522. 82: uint8(_BT_NMSTRT),
  18523. 83: uint8(_BT_NMSTRT),
  18524. 84: uint8(_BT_NMSTRT),
  18525. 85: uint8(_BT_NMSTRT),
  18526. 86: uint8(_BT_NMSTRT),
  18527. 87: uint8(_BT_NMSTRT),
  18528. 88: uint8(_BT_NMSTRT),
  18529. 89: uint8(_BT_NMSTRT),
  18530. 90: uint8(_BT_NMSTRT),
  18531. 91: uint8(_BT_LSQB),
  18532. 92: uint8(_BT_OTHER),
  18533. 93: uint8(_BT_RSQB),
  18534. 94: uint8(_BT_OTHER),
  18535. 95: uint8(_BT_NMSTRT),
  18536. 96: uint8(_BT_OTHER),
  18537. 97: uint8(_BT_HEX),
  18538. 98: uint8(_BT_HEX),
  18539. 99: uint8(_BT_HEX),
  18540. 100: uint8(_BT_HEX),
  18541. 101: uint8(_BT_HEX),
  18542. 102: uint8(_BT_HEX),
  18543. 103: uint8(_BT_NMSTRT),
  18544. 104: uint8(_BT_NMSTRT),
  18545. 105: uint8(_BT_NMSTRT),
  18546. 106: uint8(_BT_NMSTRT),
  18547. 107: uint8(_BT_NMSTRT),
  18548. 108: uint8(_BT_NMSTRT),
  18549. 109: uint8(_BT_NMSTRT),
  18550. 110: uint8(_BT_NMSTRT),
  18551. 111: uint8(_BT_NMSTRT),
  18552. 112: uint8(_BT_NMSTRT),
  18553. 113: uint8(_BT_NMSTRT),
  18554. 114: uint8(_BT_NMSTRT),
  18555. 115: uint8(_BT_NMSTRT),
  18556. 116: uint8(_BT_NMSTRT),
  18557. 117: uint8(_BT_NMSTRT),
  18558. 118: uint8(_BT_NMSTRT),
  18559. 119: uint8(_BT_NMSTRT),
  18560. 120: uint8(_BT_NMSTRT),
  18561. 121: uint8(_BT_NMSTRT),
  18562. 122: uint8(_BT_NMSTRT),
  18563. 123: uint8(_BT_OTHER),
  18564. 124: uint8(_BT_VERBAR),
  18565. 125: uint8(_BT_OTHER),
  18566. 126: uint8(_BT_OTHER),
  18567. 127: uint8(_BT_OTHER),
  18568. },
  18569. }
  18570. func init() {
  18571. p := unsafe.Pointer(&_ascii_encoding)
  18572. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18573. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18574. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18575. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18576. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18577. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18578. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18579. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18580. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18581. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18582. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18583. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18584. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18585. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18586. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18587. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18588. }
  18589. func _unicode_byte_type(tls *libc.TLS, hi int8, lo int8) (r int32) {
  18590. switch libc.Int32FromUint8(libc.Uint8FromInt8(hi)) {
  18591. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18592. case int32(0xD8):
  18593. fallthrough
  18594. case int32(0xD9):
  18595. fallthrough
  18596. case int32(0xDA):
  18597. fallthrough
  18598. case int32(0xDB):
  18599. return int32(_BT_LEAD4)
  18600. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18601. fallthrough
  18602. case int32(0xDC):
  18603. fallthrough
  18604. case int32(0xDD):
  18605. fallthrough
  18606. case int32(0xDE):
  18607. fallthrough
  18608. case int32(0xDF):
  18609. return int32(_BT_TRAIL)
  18610. case int32(0xFF):
  18611. switch libc.Int32FromUint8(libc.Uint8FromInt8(lo)) {
  18612. case int32(0xFF): /* noncharacter-FFFF */
  18613. fallthrough
  18614. case int32(0xFE): /* noncharacter-FFFE */
  18615. return int32(_BT_NONXML)
  18616. }
  18617. break
  18618. }
  18619. return int32(_BT_NONASCII)
  18620. }
  18621. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18622. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18623. var hi, lo, lo2 uint8
  18624. var plane int32
  18625. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = from, hi, lo, lo2, plane, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9
  18626. from = *(*uintptr)(unsafe.Pointer(fromP))
  18627. _ = enc
  18628. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18629. for {
  18630. if !(from < fromLim) {
  18631. break
  18632. }
  18633. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18634. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18635. switch libc.Int32FromUint8(hi) {
  18636. case 0:
  18637. if libc.Int32FromUint8(lo) < int32(0x80) {
  18638. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18639. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18640. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18641. }
  18642. v3 = toP
  18643. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18644. *(*uintptr)(unsafe.Pointer(v3))++
  18645. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18646. break
  18647. } /* fall through */
  18648. fallthrough
  18649. case int32(0x1):
  18650. fallthrough
  18651. case int32(0x2):
  18652. fallthrough
  18653. case int32(0x3):
  18654. fallthrough
  18655. case int32(0x4):
  18656. fallthrough
  18657. case int32(0x5):
  18658. fallthrough
  18659. case int32(0x6):
  18660. fallthrough
  18661. case int32(0x7):
  18662. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18663. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18664. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18665. }
  18666. v5 = toP
  18667. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18668. *(*uintptr)(unsafe.Pointer(v5))++
  18669. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18670. v7 = toP
  18671. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18672. *(*uintptr)(unsafe.Pointer(v7))++
  18673. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18674. default:
  18675. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18676. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18677. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18678. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18679. v9 = toP
  18680. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18681. *(*uintptr)(unsafe.Pointer(v9))++
  18682. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18683. v11 = toP
  18684. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18685. *(*uintptr)(unsafe.Pointer(v11))++
  18686. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18687. v13 = toP
  18688. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18689. *(*uintptr)(unsafe.Pointer(v13))++
  18690. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18691. case int32(0xD8):
  18692. fallthrough
  18693. case int32(0xD9):
  18694. fallthrough
  18695. case int32(0xDA):
  18696. fallthrough
  18697. case int32(0xDB):
  18698. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18699. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18700. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18701. }
  18702. if int64(fromLim)-int64(from) < int64(4) {
  18703. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18704. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18705. }
  18706. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18707. v15 = toP
  18708. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18709. *(*uintptr)(unsafe.Pointer(v15))++
  18710. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18711. v17 = toP
  18712. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18713. *(*uintptr)(unsafe.Pointer(v17))++
  18714. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18715. from += uintptr(2)
  18716. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18717. v19 = toP
  18718. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18719. *(*uintptr)(unsafe.Pointer(v19))++
  18720. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18721. v21 = toP
  18722. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18723. *(*uintptr)(unsafe.Pointer(v21))++
  18724. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18725. break
  18726. }
  18727. goto _1
  18728. _1:
  18729. ;
  18730. from += uintptr(2)
  18731. }
  18732. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18733. if from < fromLim {
  18734. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18735. } else {
  18736. return int32(_XML_CONVERT_COMPLETED)
  18737. }
  18738. return r
  18739. }
  18740. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18741. var res _XML_Convert_Result
  18742. var v2, v3 uintptr
  18743. _, _, _ = res, v2, v3
  18744. res = int32(_XML_CONVERT_COMPLETED)
  18745. _ = enc
  18746. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  18747. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1))))&int32(0xF8) == int32(0xD8) {
  18748. fromLim -= uintptr(2)
  18749. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18750. }
  18751. for {
  18752. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18753. break
  18754. }
  18755. v3 = toP
  18756. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18757. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18758. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))
  18759. goto _1
  18760. _1:
  18761. ;
  18762. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18763. }
  18764. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18765. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18766. } else {
  18767. return res
  18768. }
  18769. return r
  18770. }
  18771. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18772. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18773. var hi, lo, lo2 uint8
  18774. var plane int32
  18775. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = from, hi, lo, lo2, plane, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9
  18776. from = *(*uintptr)(unsafe.Pointer(fromP))
  18777. _ = enc
  18778. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18779. for {
  18780. if !(from < fromLim) {
  18781. break
  18782. }
  18783. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18784. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18785. switch libc.Int32FromUint8(hi) {
  18786. case 0:
  18787. if libc.Int32FromUint8(lo) < int32(0x80) {
  18788. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18789. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18790. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18791. }
  18792. v3 = toP
  18793. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18794. *(*uintptr)(unsafe.Pointer(v3))++
  18795. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18796. break
  18797. } /* fall through */
  18798. fallthrough
  18799. case int32(0x1):
  18800. fallthrough
  18801. case int32(0x2):
  18802. fallthrough
  18803. case int32(0x3):
  18804. fallthrough
  18805. case int32(0x4):
  18806. fallthrough
  18807. case int32(0x5):
  18808. fallthrough
  18809. case int32(0x6):
  18810. fallthrough
  18811. case int32(0x7):
  18812. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18813. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18814. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18815. }
  18816. v5 = toP
  18817. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18818. *(*uintptr)(unsafe.Pointer(v5))++
  18819. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18820. v7 = toP
  18821. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18822. *(*uintptr)(unsafe.Pointer(v7))++
  18823. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18824. default:
  18825. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18826. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18827. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18828. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18829. v9 = toP
  18830. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18831. *(*uintptr)(unsafe.Pointer(v9))++
  18832. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18833. v11 = toP
  18834. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18835. *(*uintptr)(unsafe.Pointer(v11))++
  18836. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18837. v13 = toP
  18838. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18839. *(*uintptr)(unsafe.Pointer(v13))++
  18840. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18841. case int32(0xD8):
  18842. fallthrough
  18843. case int32(0xD9):
  18844. fallthrough
  18845. case int32(0xDA):
  18846. fallthrough
  18847. case int32(0xDB):
  18848. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18849. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18850. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18851. }
  18852. if int64(fromLim)-int64(from) < int64(4) {
  18853. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18854. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18855. }
  18856. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18857. v15 = toP
  18858. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18859. *(*uintptr)(unsafe.Pointer(v15))++
  18860. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18861. v17 = toP
  18862. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18863. *(*uintptr)(unsafe.Pointer(v17))++
  18864. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18865. from += uintptr(2)
  18866. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18867. v19 = toP
  18868. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18869. *(*uintptr)(unsafe.Pointer(v19))++
  18870. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18871. v21 = toP
  18872. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18873. *(*uintptr)(unsafe.Pointer(v21))++
  18874. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18875. break
  18876. }
  18877. goto _1
  18878. _1:
  18879. ;
  18880. from += uintptr(2)
  18881. }
  18882. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18883. if from < fromLim {
  18884. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18885. } else {
  18886. return int32(_XML_CONVERT_COMPLETED)
  18887. }
  18888. return r
  18889. }
  18890. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18891. var res _XML_Convert_Result
  18892. var v2, v3 uintptr
  18893. _, _, _ = res, v2, v3
  18894. res = int32(_XML_CONVERT_COMPLETED)
  18895. _ = enc
  18896. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  18897. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2)))))&int32(0xF8) == int32(0xD8) {
  18898. fromLim -= uintptr(2)
  18899. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18900. }
  18901. for {
  18902. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18903. break
  18904. }
  18905. v3 = toP
  18906. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18907. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18908. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))))
  18909. goto _1
  18910. _1:
  18911. ;
  18912. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18913. }
  18914. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18915. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18916. } else {
  18917. return res
  18918. }
  18919. return r
  18920. }
  18921. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18922. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18923. __ __ _
  18924. ___\ \/ /_ __ __ _| |_
  18925. / _ \\ /| '_ \ / _` | __|
  18926. | __// \| |_) | (_| | |_
  18927. \___/_/\_\ .__/ \__,_|\__|
  18928. |_| XML parser
  18929. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18930. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18931. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18932. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18933. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18934. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18935. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18936. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18937. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18938. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18939. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18940. Licensed under the MIT license:
  18941. Permission is hereby granted, free of charge, to any person obtaining
  18942. a copy of this software and associated documentation files (the
  18943. "Software"), to deal in the Software without restriction, including
  18944. without limitation the rights to use, copy, modify, merge, publish,
  18945. distribute, sublicense, and/or sell copies of the Software, and to permit
  18946. persons to whom the Software is furnished to do so, subject to the
  18947. following conditions:
  18948. The above copyright notice and this permission notice shall be included
  18949. in all copies or substantial portions of the Software.
  18950. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18951. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18952. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18953. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18954. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18955. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18956. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18957. */
  18958. /* ptr points to character following "<!-" */
  18959. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18960. var v1 int32
  18961. _ = v1
  18962. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18963. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18965. return m_XML_TOK_INVALID
  18966. }
  18967. ptr += uintptr(2)
  18968. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18969. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18970. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18971. } else {
  18972. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18973. }
  18974. switch v1 {
  18975. case int32(_BT_LEAD2):
  18976. if int64(end)-int64(ptr) < int64(2) {
  18977. return -int32(2)
  18978. }
  18979. if 0 != 0 {
  18980. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18981. return m_XML_TOK_INVALID
  18982. }
  18983. ptr += uintptr(2)
  18984. case int32(_BT_LEAD3):
  18985. if int64(end)-int64(ptr) < int64(3) {
  18986. return -int32(2)
  18987. }
  18988. if 0 != 0 {
  18989. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18990. return m_XML_TOK_INVALID
  18991. }
  18992. ptr += uintptr(3)
  18993. case int32(_BT_LEAD4):
  18994. if int64(end)-int64(ptr) < int64(4) {
  18995. return -int32(2)
  18996. }
  18997. if 0 != 0 {
  18998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18999. return m_XML_TOK_INVALID
  19000. }
  19001. ptr += uintptr(4)
  19002. case int32(_BT_NONXML):
  19003. fallthrough
  19004. case int32(_BT_MALFORM):
  19005. fallthrough
  19006. case int32(_BT_TRAIL):
  19007. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19008. return m_XML_TOK_INVALID
  19009. case int32(_BT_MINUS):
  19010. ptr += uintptr(2)
  19011. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19012. return -int32(1)
  19013. }
  19014. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  19015. ptr += uintptr(2)
  19016. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19017. return -int32(1)
  19018. }
  19019. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19020. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19021. return m_XML_TOK_INVALID
  19022. }
  19023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19024. return int32(m_XML_TOK_COMMENT)
  19025. }
  19026. default:
  19027. ptr += uintptr(2)
  19028. break
  19029. }
  19030. }
  19031. }
  19032. return -int32(1)
  19033. }
  19034. /* ptr points to character following "<!" */
  19035. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19036. var v1, v2, v3 int32
  19037. _, _, _ = v1, v2, v3
  19038. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19039. return -int32(1)
  19040. }
  19041. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19042. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19043. } else {
  19044. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19045. }
  19046. switch v1 {
  19047. case int32(_BT_MINUS):
  19048. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19049. case int32(_BT_LSQB):
  19050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19051. return int32(m_XML_TOK_COND_SECT_OPEN)
  19052. case int32(_BT_NMSTRT):
  19053. fallthrough
  19054. case int32(_BT_HEX):
  19055. ptr += uintptr(2)
  19056. default:
  19057. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19058. return m_XML_TOK_INVALID
  19059. }
  19060. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19061. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19062. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19063. } else {
  19064. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19065. }
  19066. switch v2 {
  19067. case int32(_BT_PERCNT):
  19068. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  19069. return -int32(1)
  19070. }
  19071. /* don't allow <!ENTITY% foo "whatever"> */
  19072. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  19073. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  19074. } else {
  19075. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  19076. }
  19077. switch v3 {
  19078. case int32(_BT_S):
  19079. fallthrough
  19080. case int32(_BT_CR):
  19081. fallthrough
  19082. case int32(_BT_LF):
  19083. fallthrough
  19084. case int32(_BT_PERCNT):
  19085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19086. return m_XML_TOK_INVALID
  19087. }
  19088. /* fall through */
  19089. fallthrough
  19090. case int32(_BT_S):
  19091. fallthrough
  19092. case int32(_BT_CR):
  19093. fallthrough
  19094. case int32(_BT_LF):
  19095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19096. return int32(m_XML_TOK_DECL_OPEN)
  19097. case int32(_BT_NMSTRT):
  19098. fallthrough
  19099. case int32(_BT_HEX):
  19100. ptr += uintptr(2)
  19101. default:
  19102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19103. return m_XML_TOK_INVALID
  19104. }
  19105. }
  19106. return -int32(1)
  19107. }
  19108. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  19109. var upper, v1, v2, v3 int32
  19110. _, _, _, _ = upper, v1, v2, v3
  19111. upper = 0
  19112. _ = enc
  19113. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  19114. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  19115. return int32(1)
  19116. }
  19117. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19118. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  19119. } else {
  19120. v1 = -int32(1)
  19121. }
  19122. switch v1 {
  19123. case int32(m_ASCII_x2):
  19124. case int32(m_ASCII_X):
  19125. upper = int32(1)
  19126. default:
  19127. return int32(1)
  19128. }
  19129. ptr += uintptr(2)
  19130. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19131. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  19132. } else {
  19133. v2 = -int32(1)
  19134. }
  19135. switch v2 {
  19136. case int32(m_ASCII_m2):
  19137. case int32(m_ASCII_M):
  19138. upper = int32(1)
  19139. default:
  19140. return int32(1)
  19141. }
  19142. ptr += uintptr(2)
  19143. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19144. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  19145. } else {
  19146. v3 = -int32(1)
  19147. }
  19148. switch v3 {
  19149. case int32(m_ASCII_l2):
  19150. case int32(m_ASCII_L):
  19151. upper = int32(1)
  19152. default:
  19153. return int32(1)
  19154. }
  19155. if upper != 0 {
  19156. return 0
  19157. }
  19158. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  19159. return int32(1)
  19160. }
  19161. /* ptr points to character following "<?" */
  19162. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19163. bp := tls.Alloc(16)
  19164. defer tls.Free(16)
  19165. var target uintptr
  19166. var v1, v2, v3 int32
  19167. var _ /* tok at bp+0 */ int32
  19168. _, _, _, _ = target, v1, v2, v3
  19169. target = ptr
  19170. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19171. return -int32(1)
  19172. }
  19173. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19174. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19175. } else {
  19176. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19177. }
  19178. switch v1 {
  19179. case int32(_BT_NONASCII):
  19180. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19182. return m_XML_TOK_INVALID
  19183. } /* fall through */
  19184. fallthrough
  19185. case int32(_BT_NMSTRT):
  19186. fallthrough
  19187. case int32(_BT_HEX):
  19188. ptr += uintptr(2)
  19189. case int32(_BT_LEAD2):
  19190. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19191. return -int32(2)
  19192. }
  19193. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19195. return m_XML_TOK_INVALID
  19196. }
  19197. ptr += uintptr(2)
  19198. case int32(_BT_LEAD3):
  19199. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19200. return -int32(2)
  19201. }
  19202. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19204. return m_XML_TOK_INVALID
  19205. }
  19206. ptr += uintptr(3)
  19207. case int32(_BT_LEAD4):
  19208. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19209. return -int32(2)
  19210. }
  19211. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19213. return m_XML_TOK_INVALID
  19214. }
  19215. ptr += uintptr(4)
  19216. default:
  19217. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19218. return m_XML_TOK_INVALID
  19219. }
  19220. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19221. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19222. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19223. } else {
  19224. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19225. }
  19226. switch v2 {
  19227. case int32(_BT_NONASCII):
  19228. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19229. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19230. return m_XML_TOK_INVALID
  19231. } /* fall through */
  19232. fallthrough
  19233. case int32(_BT_NMSTRT):
  19234. fallthrough
  19235. case int32(_BT_HEX):
  19236. fallthrough
  19237. case int32(_BT_DIGIT):
  19238. fallthrough
  19239. case int32(_BT_NAME):
  19240. fallthrough
  19241. case int32(_BT_MINUS):
  19242. ptr += uintptr(2)
  19243. case int32(_BT_LEAD2):
  19244. if int64(end)-int64(ptr) < int64(2) {
  19245. return -int32(2)
  19246. }
  19247. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19248. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19249. return m_XML_TOK_INVALID
  19250. }
  19251. ptr += uintptr(2)
  19252. case int32(_BT_LEAD3):
  19253. if int64(end)-int64(ptr) < int64(3) {
  19254. return -int32(2)
  19255. }
  19256. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19258. return m_XML_TOK_INVALID
  19259. }
  19260. ptr += uintptr(3)
  19261. case int32(_BT_LEAD4):
  19262. if int64(end)-int64(ptr) < int64(4) {
  19263. return -int32(2)
  19264. }
  19265. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19267. return m_XML_TOK_INVALID
  19268. }
  19269. ptr += uintptr(4)
  19270. case int32(_BT_S):
  19271. fallthrough
  19272. case int32(_BT_CR):
  19273. fallthrough
  19274. case int32(_BT_LF):
  19275. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19277. return m_XML_TOK_INVALID
  19278. }
  19279. ptr += uintptr(2)
  19280. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19281. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19282. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19283. } else {
  19284. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19285. }
  19286. switch v3 {
  19287. case int32(_BT_LEAD2):
  19288. if int64(end)-int64(ptr) < int64(2) {
  19289. return -int32(2)
  19290. }
  19291. if 0 != 0 {
  19292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19293. return m_XML_TOK_INVALID
  19294. }
  19295. ptr += uintptr(2)
  19296. case int32(_BT_LEAD3):
  19297. if int64(end)-int64(ptr) < int64(3) {
  19298. return -int32(2)
  19299. }
  19300. if 0 != 0 {
  19301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19302. return m_XML_TOK_INVALID
  19303. }
  19304. ptr += uintptr(3)
  19305. case int32(_BT_LEAD4):
  19306. if int64(end)-int64(ptr) < int64(4) {
  19307. return -int32(2)
  19308. }
  19309. if 0 != 0 {
  19310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19311. return m_XML_TOK_INVALID
  19312. }
  19313. ptr += uintptr(4)
  19314. case int32(_BT_NONXML):
  19315. fallthrough
  19316. case int32(_BT_MALFORM):
  19317. fallthrough
  19318. case int32(_BT_TRAIL):
  19319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19320. return m_XML_TOK_INVALID
  19321. case int32(_BT_QUEST):
  19322. ptr += uintptr(2)
  19323. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19324. return -int32(1)
  19325. }
  19326. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19328. return *(*int32)(unsafe.Pointer(bp))
  19329. }
  19330. default:
  19331. ptr += uintptr(2)
  19332. break
  19333. }
  19334. }
  19335. return -int32(1)
  19336. case int32(_BT_QUEST):
  19337. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19339. return m_XML_TOK_INVALID
  19340. }
  19341. ptr += uintptr(2)
  19342. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19343. return -int32(1)
  19344. }
  19345. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19347. return *(*int32)(unsafe.Pointer(bp))
  19348. }
  19349. /* fall through */
  19350. fallthrough
  19351. default:
  19352. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19353. return m_XML_TOK_INVALID
  19354. }
  19355. }
  19356. return -int32(1)
  19357. }
  19358. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19359. var i int32
  19360. _ = i
  19361. _ = enc
  19362. /* CDATA[ */
  19363. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  19364. return -int32(1)
  19365. }
  19366. i = 0
  19367. for {
  19368. if !(i < int32(6)) {
  19369. break
  19370. }
  19371. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB1[i])) {
  19372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19373. return m_XML_TOK_INVALID
  19374. }
  19375. goto _1
  19376. _1:
  19377. ;
  19378. i++
  19379. ptr += uintptr(2)
  19380. }
  19381. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19382. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19383. }
  19384. var _CDATA_LSQB1 = [6]int8{
  19385. 0: int8(m_ASCII_C),
  19386. 1: int8(m_ASCII_D),
  19387. 2: int8(m_ASCII_A),
  19388. 3: int8(m_ASCII_T),
  19389. 4: int8(m_ASCII_A),
  19390. 5: int8(m_ASCII_LSQB1),
  19391. }
  19392. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19393. var n Tsize_t
  19394. var v1, v2, v3 int32
  19395. _, _, _, _ = n, v1, v2, v3
  19396. if ptr >= end {
  19397. return -int32(4)
  19398. }
  19399. if int32(2) > int32(1) {
  19400. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19401. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19402. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19403. if n == uint64(0) {
  19404. return -int32(1)
  19405. }
  19406. end = ptr + uintptr(n)
  19407. }
  19408. }
  19409. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19410. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19411. } else {
  19412. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19413. }
  19414. switch v1 {
  19415. case int32(_BT_RSQB):
  19416. ptr += uintptr(2)
  19417. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19418. return -int32(1)
  19419. }
  19420. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19421. break
  19422. }
  19423. ptr += uintptr(2)
  19424. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19425. return -int32(1)
  19426. }
  19427. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19428. ptr -= uintptr(2)
  19429. break
  19430. }
  19431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19432. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19433. case int32(_BT_CR):
  19434. ptr += uintptr(2)
  19435. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19436. return -int32(1)
  19437. }
  19438. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19439. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19440. } else {
  19441. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19442. }
  19443. if v2 == int32(_BT_LF) {
  19444. ptr += uintptr(2)
  19445. }
  19446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19447. return int32(m_XML_TOK_DATA_NEWLINE)
  19448. case int32(_BT_LF):
  19449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19450. return int32(m_XML_TOK_DATA_NEWLINE)
  19451. case int32(_BT_LEAD2):
  19452. if int64(end)-int64(ptr) < int64(2) {
  19453. return -int32(2)
  19454. }
  19455. if 0 != 0 {
  19456. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19457. return m_XML_TOK_INVALID
  19458. }
  19459. ptr += uintptr(2)
  19460. case int32(_BT_LEAD3):
  19461. if int64(end)-int64(ptr) < int64(3) {
  19462. return -int32(2)
  19463. }
  19464. if 0 != 0 {
  19465. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19466. return m_XML_TOK_INVALID
  19467. }
  19468. ptr += uintptr(3)
  19469. case int32(_BT_LEAD4):
  19470. if int64(end)-int64(ptr) < int64(4) {
  19471. return -int32(2)
  19472. }
  19473. if 0 != 0 {
  19474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19475. return m_XML_TOK_INVALID
  19476. }
  19477. ptr += uintptr(4)
  19478. case int32(_BT_NONXML):
  19479. fallthrough
  19480. case int32(_BT_MALFORM):
  19481. fallthrough
  19482. case int32(_BT_TRAIL):
  19483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19484. return m_XML_TOK_INVALID
  19485. default:
  19486. ptr += uintptr(2)
  19487. break
  19488. }
  19489. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19490. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19491. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19492. } else {
  19493. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19494. }
  19495. switch v3 {
  19496. case int32(_BT_LEAD2):
  19497. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  19498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19499. return int32(m_XML_TOK_DATA_CHARS)
  19500. }
  19501. ptr += uintptr(2)
  19502. case int32(_BT_LEAD3):
  19503. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  19504. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19505. return int32(m_XML_TOK_DATA_CHARS)
  19506. }
  19507. ptr += uintptr(3)
  19508. case int32(_BT_LEAD4):
  19509. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  19510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19511. return int32(m_XML_TOK_DATA_CHARS)
  19512. }
  19513. ptr += uintptr(4)
  19514. case int32(_BT_NONXML):
  19515. fallthrough
  19516. case int32(_BT_MALFORM):
  19517. fallthrough
  19518. case int32(_BT_TRAIL):
  19519. fallthrough
  19520. case int32(_BT_CR):
  19521. fallthrough
  19522. case int32(_BT_LF):
  19523. fallthrough
  19524. case int32(_BT_RSQB):
  19525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19526. return int32(m_XML_TOK_DATA_CHARS)
  19527. default:
  19528. ptr += uintptr(2)
  19529. break
  19530. }
  19531. }
  19532. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19533. return int32(m_XML_TOK_DATA_CHARS)
  19534. }
  19535. /* ptr points to character following "</" */
  19536. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19537. var v1, v2, v22 int32
  19538. _, _, _ = v1, v2, v22
  19539. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19540. return -int32(1)
  19541. }
  19542. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19543. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19544. } else {
  19545. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19546. }
  19547. switch v1 {
  19548. case int32(_BT_NONASCII):
  19549. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19551. return m_XML_TOK_INVALID
  19552. } /* fall through */
  19553. fallthrough
  19554. case int32(_BT_NMSTRT):
  19555. fallthrough
  19556. case int32(_BT_HEX):
  19557. ptr += uintptr(2)
  19558. case int32(_BT_LEAD2):
  19559. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19560. return -int32(2)
  19561. }
  19562. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19563. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19564. return m_XML_TOK_INVALID
  19565. }
  19566. ptr += uintptr(2)
  19567. case int32(_BT_LEAD3):
  19568. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19569. return -int32(2)
  19570. }
  19571. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19572. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19573. return m_XML_TOK_INVALID
  19574. }
  19575. ptr += uintptr(3)
  19576. case int32(_BT_LEAD4):
  19577. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19578. return -int32(2)
  19579. }
  19580. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19581. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19582. return m_XML_TOK_INVALID
  19583. }
  19584. ptr += uintptr(4)
  19585. default:
  19586. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19587. return m_XML_TOK_INVALID
  19588. }
  19589. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19590. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19591. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19592. } else {
  19593. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19594. }
  19595. switch v2 {
  19596. case int32(_BT_NONASCII):
  19597. goto _3
  19598. case int32(_BT_MINUS):
  19599. goto _4
  19600. case int32(_BT_NAME):
  19601. goto _5
  19602. case int32(_BT_DIGIT):
  19603. goto _6
  19604. case int32(_BT_HEX):
  19605. goto _7
  19606. case int32(_BT_NMSTRT):
  19607. goto _8
  19608. case int32(_BT_LEAD2):
  19609. goto _9
  19610. case int32(_BT_LEAD3):
  19611. goto _10
  19612. case int32(_BT_LEAD4):
  19613. goto _11
  19614. case int32(_BT_LF):
  19615. goto _12
  19616. case int32(_BT_CR):
  19617. goto _13
  19618. case int32(_BT_S):
  19619. goto _14
  19620. case int32(_BT_COLON):
  19621. goto _15
  19622. case int32(_BT_GT):
  19623. goto _16
  19624. default:
  19625. goto _17
  19626. }
  19627. goto _18
  19628. _3:
  19629. ;
  19630. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19632. return m_XML_TOK_INVALID
  19633. } /* fall through */
  19634. _8:
  19635. ;
  19636. _7:
  19637. ;
  19638. _6:
  19639. ;
  19640. _5:
  19641. ;
  19642. _4:
  19643. ;
  19644. ptr += uintptr(2)
  19645. goto _18
  19646. _9:
  19647. ;
  19648. if int64(end)-int64(ptr) < int64(2) {
  19649. return -int32(2)
  19650. }
  19651. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19653. return m_XML_TOK_INVALID
  19654. }
  19655. ptr += uintptr(2)
  19656. goto _18
  19657. _10:
  19658. ;
  19659. if int64(end)-int64(ptr) < int64(3) {
  19660. return -int32(2)
  19661. }
  19662. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19663. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19664. return m_XML_TOK_INVALID
  19665. }
  19666. ptr += uintptr(3)
  19667. goto _18
  19668. _11:
  19669. ;
  19670. if int64(end)-int64(ptr) < int64(4) {
  19671. return -int32(2)
  19672. }
  19673. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19675. return m_XML_TOK_INVALID
  19676. }
  19677. ptr += uintptr(4)
  19678. goto _18
  19679. _14:
  19680. ;
  19681. _13:
  19682. ;
  19683. _12:
  19684. ;
  19685. ptr += uintptr(2)
  19686. _21:
  19687. ;
  19688. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19689. goto _19
  19690. }
  19691. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19692. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19693. } else {
  19694. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19695. }
  19696. switch v22 {
  19697. case int32(_BT_S):
  19698. fallthrough
  19699. case int32(_BT_CR):
  19700. fallthrough
  19701. case int32(_BT_LF):
  19702. case int32(_BT_GT):
  19703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19704. return int32(m_XML_TOK_END_TAG)
  19705. default:
  19706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19707. return m_XML_TOK_INVALID
  19708. }
  19709. goto _20
  19710. _20:
  19711. ;
  19712. ptr += uintptr(2)
  19713. goto _21
  19714. goto _19
  19715. _19:
  19716. ;
  19717. return -int32(1)
  19718. _15:
  19719. ;
  19720. /* no need to check qname syntax here,
  19721. since end-tag must match exactly */
  19722. ptr += uintptr(2)
  19723. goto _18
  19724. _16:
  19725. ;
  19726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19727. return int32(m_XML_TOK_END_TAG)
  19728. _17:
  19729. ;
  19730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19731. return m_XML_TOK_INVALID
  19732. _18:
  19733. }
  19734. return -int32(1)
  19735. }
  19736. /* ptr points to character following "&#X" */
  19737. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19738. var v1, v3 int32
  19739. _, _ = v1, v3
  19740. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19741. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19742. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19743. } else {
  19744. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19745. }
  19746. switch v1 {
  19747. case int32(_BT_DIGIT):
  19748. fallthrough
  19749. case int32(_BT_HEX):
  19750. default:
  19751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19752. return m_XML_TOK_INVALID
  19753. }
  19754. ptr += uintptr(2)
  19755. for {
  19756. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19757. break
  19758. }
  19759. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19760. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19761. } else {
  19762. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19763. }
  19764. switch v3 {
  19765. case int32(_BT_DIGIT):
  19766. fallthrough
  19767. case int32(_BT_HEX):
  19768. case int32(_BT_SEMI):
  19769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19770. return int32(m_XML_TOK_CHAR_REF)
  19771. default:
  19772. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19773. return m_XML_TOK_INVALID
  19774. }
  19775. goto _2
  19776. _2:
  19777. ;
  19778. ptr += uintptr(2)
  19779. }
  19780. }
  19781. return -int32(1)
  19782. }
  19783. /* ptr points to character following "&#" */
  19784. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19785. var v1, v3 int32
  19786. _, _ = v1, v3
  19787. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19788. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19789. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19790. }
  19791. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19792. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19793. } else {
  19794. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19795. }
  19796. switch v1 {
  19797. case int32(_BT_DIGIT):
  19798. default:
  19799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19800. return m_XML_TOK_INVALID
  19801. }
  19802. ptr += uintptr(2)
  19803. for {
  19804. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19805. break
  19806. }
  19807. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19808. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19809. } else {
  19810. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19811. }
  19812. switch v3 {
  19813. case int32(_BT_DIGIT):
  19814. case int32(_BT_SEMI):
  19815. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19816. return int32(m_XML_TOK_CHAR_REF)
  19817. default:
  19818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19819. return m_XML_TOK_INVALID
  19820. }
  19821. goto _2
  19822. _2:
  19823. ;
  19824. ptr += uintptr(2)
  19825. }
  19826. }
  19827. return -int32(1)
  19828. }
  19829. /* ptr points to character following "&" */
  19830. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19831. var v1, v2 int32
  19832. _, _ = v1, v2
  19833. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19834. return -int32(1)
  19835. }
  19836. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19837. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19838. } else {
  19839. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19840. }
  19841. switch v1 {
  19842. case int32(_BT_NONASCII):
  19843. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19844. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19845. return m_XML_TOK_INVALID
  19846. } /* fall through */
  19847. fallthrough
  19848. case int32(_BT_NMSTRT):
  19849. fallthrough
  19850. case int32(_BT_HEX):
  19851. ptr += uintptr(2)
  19852. case int32(_BT_LEAD2):
  19853. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19854. return -int32(2)
  19855. }
  19856. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19858. return m_XML_TOK_INVALID
  19859. }
  19860. ptr += uintptr(2)
  19861. case int32(_BT_LEAD3):
  19862. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19863. return -int32(2)
  19864. }
  19865. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19866. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19867. return m_XML_TOK_INVALID
  19868. }
  19869. ptr += uintptr(3)
  19870. case int32(_BT_LEAD4):
  19871. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19872. return -int32(2)
  19873. }
  19874. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19875. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19876. return m_XML_TOK_INVALID
  19877. }
  19878. ptr += uintptr(4)
  19879. case int32(_BT_NUM):
  19880. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19881. default:
  19882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19883. return m_XML_TOK_INVALID
  19884. }
  19885. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19886. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19887. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19888. } else {
  19889. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19890. }
  19891. switch v2 {
  19892. case int32(_BT_NONASCII):
  19893. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19895. return m_XML_TOK_INVALID
  19896. } /* fall through */
  19897. fallthrough
  19898. case int32(_BT_NMSTRT):
  19899. fallthrough
  19900. case int32(_BT_HEX):
  19901. fallthrough
  19902. case int32(_BT_DIGIT):
  19903. fallthrough
  19904. case int32(_BT_NAME):
  19905. fallthrough
  19906. case int32(_BT_MINUS):
  19907. ptr += uintptr(2)
  19908. case int32(_BT_LEAD2):
  19909. if int64(end)-int64(ptr) < int64(2) {
  19910. return -int32(2)
  19911. }
  19912. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19914. return m_XML_TOK_INVALID
  19915. }
  19916. ptr += uintptr(2)
  19917. case int32(_BT_LEAD3):
  19918. if int64(end)-int64(ptr) < int64(3) {
  19919. return -int32(2)
  19920. }
  19921. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19923. return m_XML_TOK_INVALID
  19924. }
  19925. ptr += uintptr(3)
  19926. case int32(_BT_LEAD4):
  19927. if int64(end)-int64(ptr) < int64(4) {
  19928. return -int32(2)
  19929. }
  19930. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19932. return m_XML_TOK_INVALID
  19933. }
  19934. ptr += uintptr(4)
  19935. case int32(_BT_SEMI):
  19936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19937. return int32(m_XML_TOK_ENTITY_REF)
  19938. default:
  19939. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19940. return m_XML_TOK_INVALID
  19941. }
  19942. }
  19943. return -int32(1)
  19944. }
  19945. /* ptr points to character following first character of attribute name */
  19946. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19947. bp := tls.Alloc(16)
  19948. defer tls.Free(16)
  19949. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19950. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19951. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19952. hadColon = 0
  19953. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19954. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19955. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19956. } else {
  19957. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19958. }
  19959. switch v1 {
  19960. case int32(_BT_NONASCII):
  19961. goto _2
  19962. case int32(_BT_MINUS):
  19963. goto _3
  19964. case int32(_BT_NAME):
  19965. goto _4
  19966. case int32(_BT_DIGIT):
  19967. goto _5
  19968. case int32(_BT_HEX):
  19969. goto _6
  19970. case int32(_BT_NMSTRT):
  19971. goto _7
  19972. case int32(_BT_LEAD2):
  19973. goto _8
  19974. case int32(_BT_LEAD3):
  19975. goto _9
  19976. case int32(_BT_LEAD4):
  19977. goto _10
  19978. case int32(_BT_COLON):
  19979. goto _11
  19980. case int32(_BT_LF):
  19981. goto _12
  19982. case int32(_BT_CR):
  19983. goto _13
  19984. case int32(_BT_S):
  19985. goto _14
  19986. case int32(_BT_EQUALS):
  19987. goto _15
  19988. default:
  19989. goto _16
  19990. }
  19991. goto _17
  19992. _2:
  19993. ;
  19994. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  19995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19996. return m_XML_TOK_INVALID
  19997. } /* fall through */
  19998. _7:
  19999. ;
  20000. _6:
  20001. ;
  20002. _5:
  20003. ;
  20004. _4:
  20005. ;
  20006. _3:
  20007. ;
  20008. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20009. goto _17
  20010. _8:
  20011. ;
  20012. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  20013. return -int32(2)
  20014. }
  20015. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20016. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20017. return m_XML_TOK_INVALID
  20018. }
  20019. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20020. goto _17
  20021. _9:
  20022. ;
  20023. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  20024. return -int32(2)
  20025. }
  20026. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20027. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20028. return m_XML_TOK_INVALID
  20029. }
  20030. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20031. goto _17
  20032. _10:
  20033. ;
  20034. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  20035. return -int32(2)
  20036. }
  20037. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20039. return m_XML_TOK_INVALID
  20040. }
  20041. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20042. goto _17
  20043. _11:
  20044. ;
  20045. if hadColon != 0 {
  20046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20047. return m_XML_TOK_INVALID
  20048. }
  20049. hadColon = int32(1)
  20050. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20051. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20052. return -int32(1)
  20053. }
  20054. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20055. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20056. } else {
  20057. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20058. }
  20059. switch v18 {
  20060. case int32(_BT_NONASCII):
  20061. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  20062. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20063. return m_XML_TOK_INVALID
  20064. } /* fall through */
  20065. fallthrough
  20066. case int32(_BT_NMSTRT):
  20067. fallthrough
  20068. case int32(_BT_HEX):
  20069. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20070. case int32(_BT_LEAD2):
  20071. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  20072. return -int32(2)
  20073. }
  20074. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20076. return m_XML_TOK_INVALID
  20077. }
  20078. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20079. case int32(_BT_LEAD3):
  20080. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  20081. return -int32(2)
  20082. }
  20083. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20085. return m_XML_TOK_INVALID
  20086. }
  20087. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20088. case int32(_BT_LEAD4):
  20089. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  20090. return -int32(2)
  20091. }
  20092. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20094. return m_XML_TOK_INVALID
  20095. }
  20096. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20097. default:
  20098. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20099. return m_XML_TOK_INVALID
  20100. }
  20101. goto _17
  20102. _14:
  20103. ;
  20104. _13:
  20105. ;
  20106. _12:
  20107. ;
  20108. _21:
  20109. ;
  20110. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20111. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20112. return -int32(1)
  20113. }
  20114. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20115. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20116. } else {
  20117. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20118. }
  20119. t = v22
  20120. if t == int32(_BT_EQUALS) {
  20121. goto _19
  20122. }
  20123. switch t {
  20124. case int32(_BT_S):
  20125. fallthrough
  20126. case int32(_BT_LF):
  20127. fallthrough
  20128. case int32(_BT_CR):
  20129. default:
  20130. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20131. return m_XML_TOK_INVALID
  20132. }
  20133. goto _20
  20134. _20:
  20135. ;
  20136. goto _21
  20137. goto _19
  20138. _19:
  20139. ;
  20140. /* fall through */
  20141. _15:
  20142. ;
  20143. hadColon = 0
  20144. for {
  20145. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20146. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20147. return -int32(1)
  20148. }
  20149. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20150. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20151. } else {
  20152. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20153. }
  20154. open = v24
  20155. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  20156. break
  20157. }
  20158. switch open {
  20159. case int32(_BT_S):
  20160. fallthrough
  20161. case int32(_BT_LF):
  20162. fallthrough
  20163. case int32(_BT_CR):
  20164. default:
  20165. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20166. return m_XML_TOK_INVALID
  20167. }
  20168. goto _23
  20169. _23:
  20170. }
  20171. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20172. /* in attribute value */
  20173. for {
  20174. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20175. return -int32(1)
  20176. }
  20177. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20178. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20179. } else {
  20180. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20181. }
  20182. t1 = v26
  20183. if t1 == open {
  20184. break
  20185. }
  20186. switch t1 {
  20187. case int32(_BT_LEAD2):
  20188. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  20189. return -int32(2)
  20190. }
  20191. if 0 != 0 {
  20192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20193. return m_XML_TOK_INVALID
  20194. }
  20195. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20196. case int32(_BT_LEAD3):
  20197. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  20198. return -int32(2)
  20199. }
  20200. if 0 != 0 {
  20201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20202. return m_XML_TOK_INVALID
  20203. }
  20204. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20205. case int32(_BT_LEAD4):
  20206. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  20207. return -int32(2)
  20208. }
  20209. if 0 != 0 {
  20210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20211. return m_XML_TOK_INVALID
  20212. }
  20213. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20214. case int32(_BT_NONXML):
  20215. fallthrough
  20216. case int32(_BT_MALFORM):
  20217. fallthrough
  20218. case int32(_BT_TRAIL):
  20219. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20220. return m_XML_TOK_INVALID
  20221. case int32(_BT_AMP):
  20222. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  20223. if tok <= 0 {
  20224. if tok == m_XML_TOK_INVALID {
  20225. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20226. }
  20227. return tok
  20228. }
  20229. case int32(_BT_LT):
  20230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20231. return m_XML_TOK_INVALID
  20232. default:
  20233. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20234. break
  20235. }
  20236. goto _25
  20237. _25:
  20238. }
  20239. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20240. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20241. return -int32(1)
  20242. }
  20243. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20244. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20245. } else {
  20246. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20247. }
  20248. switch v27 {
  20249. case int32(_BT_S):
  20250. fallthrough
  20251. case int32(_BT_CR):
  20252. fallthrough
  20253. case int32(_BT_LF):
  20254. case int32(_BT_SOL):
  20255. goto sol
  20256. case int32(_BT_GT):
  20257. goto gt
  20258. default:
  20259. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20260. return m_XML_TOK_INVALID
  20261. }
  20262. /* ptr points to closing quote */
  20263. _30:
  20264. ;
  20265. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20266. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20267. return -int32(1)
  20268. }
  20269. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20270. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20271. } else {
  20272. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20273. }
  20274. switch v31 {
  20275. case int32(_BT_NONASCII):
  20276. goto _32
  20277. case int32(_BT_HEX):
  20278. goto _33
  20279. case int32(_BT_NMSTRT):
  20280. goto _34
  20281. case int32(_BT_LEAD2):
  20282. goto _35
  20283. case int32(_BT_LEAD3):
  20284. goto _36
  20285. case int32(_BT_LEAD4):
  20286. goto _37
  20287. case int32(_BT_LF):
  20288. goto _38
  20289. case int32(_BT_CR):
  20290. goto _39
  20291. case int32(_BT_S):
  20292. goto _40
  20293. case int32(_BT_GT):
  20294. goto _41
  20295. case int32(_BT_SOL):
  20296. goto _42
  20297. default:
  20298. goto _43
  20299. }
  20300. goto _44
  20301. _32:
  20302. ;
  20303. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  20304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20305. return m_XML_TOK_INVALID
  20306. } /* fall through */
  20307. _34:
  20308. ;
  20309. _33:
  20310. ;
  20311. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20312. goto _44
  20313. _35:
  20314. ;
  20315. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  20316. return -int32(2)
  20317. }
  20318. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20320. return m_XML_TOK_INVALID
  20321. }
  20322. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20323. goto _44
  20324. _36:
  20325. ;
  20326. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  20327. return -int32(2)
  20328. }
  20329. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20331. return m_XML_TOK_INVALID
  20332. }
  20333. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20334. goto _44
  20335. _37:
  20336. ;
  20337. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  20338. return -int32(2)
  20339. }
  20340. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20342. return m_XML_TOK_INVALID
  20343. }
  20344. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20345. goto _44
  20346. _40:
  20347. ;
  20348. _39:
  20349. ;
  20350. _38:
  20351. ;
  20352. goto _29
  20353. _41:
  20354. ;
  20355. goto gt
  20356. gt:
  20357. ;
  20358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20359. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20360. _42:
  20361. ;
  20362. goto sol
  20363. sol:
  20364. ;
  20365. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20366. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20367. return -int32(1)
  20368. }
  20369. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  20370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20371. return m_XML_TOK_INVALID
  20372. }
  20373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20374. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20375. _43:
  20376. ;
  20377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20378. return m_XML_TOK_INVALID
  20379. _44:
  20380. ;
  20381. goto _28
  20382. goto _29
  20383. _29:
  20384. ;
  20385. goto _30
  20386. goto _28
  20387. _28:
  20388. ;
  20389. goto _17
  20390. _16:
  20391. ;
  20392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20393. return m_XML_TOK_INVALID
  20394. _17:
  20395. }
  20396. return -int32(1)
  20397. }
  20398. /* ptr points to character following "<" */
  20399. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20400. var hadColon, v1, v2, v21, v22, v3 int32
  20401. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20402. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20403. return -int32(1)
  20404. }
  20405. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20406. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20407. } else {
  20408. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20409. }
  20410. switch v1 {
  20411. case int32(_BT_NONASCII):
  20412. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20414. return m_XML_TOK_INVALID
  20415. } /* fall through */
  20416. fallthrough
  20417. case int32(_BT_NMSTRT):
  20418. fallthrough
  20419. case int32(_BT_HEX):
  20420. ptr += uintptr(2)
  20421. case int32(_BT_LEAD2):
  20422. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20423. return -int32(2)
  20424. }
  20425. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20426. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20427. return m_XML_TOK_INVALID
  20428. }
  20429. ptr += uintptr(2)
  20430. case int32(_BT_LEAD3):
  20431. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20432. return -int32(2)
  20433. }
  20434. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20436. return m_XML_TOK_INVALID
  20437. }
  20438. ptr += uintptr(3)
  20439. case int32(_BT_LEAD4):
  20440. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20441. return -int32(2)
  20442. }
  20443. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20445. return m_XML_TOK_INVALID
  20446. }
  20447. ptr += uintptr(4)
  20448. case int32(_BT_EXCL):
  20449. ptr += uintptr(2)
  20450. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20451. return -int32(1)
  20452. }
  20453. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20454. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20455. } else {
  20456. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20457. }
  20458. switch v2 {
  20459. case int32(_BT_MINUS):
  20460. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20461. case int32(_BT_LSQB):
  20462. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20463. }
  20464. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20465. return m_XML_TOK_INVALID
  20466. case int32(_BT_QUEST):
  20467. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20468. case int32(_BT_SOL):
  20469. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20470. default:
  20471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20472. return m_XML_TOK_INVALID
  20473. }
  20474. hadColon = 0
  20475. /* we have a start-tag */
  20476. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20477. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20478. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20479. } else {
  20480. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20481. }
  20482. switch v3 {
  20483. case int32(_BT_NONASCII):
  20484. goto _4
  20485. case int32(_BT_MINUS):
  20486. goto _5
  20487. case int32(_BT_NAME):
  20488. goto _6
  20489. case int32(_BT_DIGIT):
  20490. goto _7
  20491. case int32(_BT_HEX):
  20492. goto _8
  20493. case int32(_BT_NMSTRT):
  20494. goto _9
  20495. case int32(_BT_LEAD2):
  20496. goto _10
  20497. case int32(_BT_LEAD3):
  20498. goto _11
  20499. case int32(_BT_LEAD4):
  20500. goto _12
  20501. case int32(_BT_COLON):
  20502. goto _13
  20503. case int32(_BT_LF):
  20504. goto _14
  20505. case int32(_BT_CR):
  20506. goto _15
  20507. case int32(_BT_S):
  20508. goto _16
  20509. case int32(_BT_GT):
  20510. goto _17
  20511. case int32(_BT_SOL):
  20512. goto _18
  20513. default:
  20514. goto _19
  20515. }
  20516. goto _20
  20517. _4:
  20518. ;
  20519. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20521. return m_XML_TOK_INVALID
  20522. } /* fall through */
  20523. _9:
  20524. ;
  20525. _8:
  20526. ;
  20527. _7:
  20528. ;
  20529. _6:
  20530. ;
  20531. _5:
  20532. ;
  20533. ptr += uintptr(2)
  20534. goto _20
  20535. _10:
  20536. ;
  20537. if int64(end)-int64(ptr) < int64(2) {
  20538. return -int32(2)
  20539. }
  20540. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20542. return m_XML_TOK_INVALID
  20543. }
  20544. ptr += uintptr(2)
  20545. goto _20
  20546. _11:
  20547. ;
  20548. if int64(end)-int64(ptr) < int64(3) {
  20549. return -int32(2)
  20550. }
  20551. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20553. return m_XML_TOK_INVALID
  20554. }
  20555. ptr += uintptr(3)
  20556. goto _20
  20557. _12:
  20558. ;
  20559. if int64(end)-int64(ptr) < int64(4) {
  20560. return -int32(2)
  20561. }
  20562. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20563. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20564. return m_XML_TOK_INVALID
  20565. }
  20566. ptr += uintptr(4)
  20567. goto _20
  20568. _13:
  20569. ;
  20570. if hadColon != 0 {
  20571. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20572. return m_XML_TOK_INVALID
  20573. }
  20574. hadColon = int32(1)
  20575. ptr += uintptr(2)
  20576. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20577. return -int32(1)
  20578. }
  20579. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20580. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20581. } else {
  20582. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20583. }
  20584. switch v21 {
  20585. case int32(_BT_NONASCII):
  20586. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20588. return m_XML_TOK_INVALID
  20589. } /* fall through */
  20590. fallthrough
  20591. case int32(_BT_NMSTRT):
  20592. fallthrough
  20593. case int32(_BT_HEX):
  20594. ptr += uintptr(2)
  20595. case int32(_BT_LEAD2):
  20596. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20597. return -int32(2)
  20598. }
  20599. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20600. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20601. return m_XML_TOK_INVALID
  20602. }
  20603. ptr += uintptr(2)
  20604. case int32(_BT_LEAD3):
  20605. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20606. return -int32(2)
  20607. }
  20608. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20610. return m_XML_TOK_INVALID
  20611. }
  20612. ptr += uintptr(3)
  20613. case int32(_BT_LEAD4):
  20614. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20615. return -int32(2)
  20616. }
  20617. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20618. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20619. return m_XML_TOK_INVALID
  20620. }
  20621. ptr += uintptr(4)
  20622. default:
  20623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20624. return m_XML_TOK_INVALID
  20625. }
  20626. goto _20
  20627. _16:
  20628. ;
  20629. _15:
  20630. ;
  20631. _14:
  20632. ;
  20633. ptr += uintptr(2)
  20634. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20635. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20636. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20637. } else {
  20638. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20639. }
  20640. switch v22 {
  20641. case int32(_BT_NONASCII):
  20642. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20644. return m_XML_TOK_INVALID
  20645. } /* fall through */
  20646. fallthrough
  20647. case int32(_BT_NMSTRT):
  20648. fallthrough
  20649. case int32(_BT_HEX):
  20650. ptr += uintptr(2)
  20651. case int32(_BT_LEAD2):
  20652. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20653. return -int32(2)
  20654. }
  20655. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20657. return m_XML_TOK_INVALID
  20658. }
  20659. ptr += uintptr(2)
  20660. case int32(_BT_LEAD3):
  20661. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20662. return -int32(2)
  20663. }
  20664. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20666. return m_XML_TOK_INVALID
  20667. }
  20668. ptr += uintptr(3)
  20669. case int32(_BT_LEAD4):
  20670. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20671. return -int32(2)
  20672. }
  20673. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20675. return m_XML_TOK_INVALID
  20676. }
  20677. ptr += uintptr(4)
  20678. case int32(_BT_GT):
  20679. goto gt
  20680. case int32(_BT_SOL):
  20681. goto sol
  20682. case int32(_BT_S):
  20683. fallthrough
  20684. case int32(_BT_CR):
  20685. fallthrough
  20686. case int32(_BT_LF):
  20687. ptr += uintptr(2)
  20688. continue
  20689. default:
  20690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20691. return m_XML_TOK_INVALID
  20692. }
  20693. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20694. }
  20695. return -int32(1)
  20696. _17:
  20697. ;
  20698. goto gt
  20699. gt:
  20700. ;
  20701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20702. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20703. _18:
  20704. ;
  20705. goto sol
  20706. sol:
  20707. ;
  20708. ptr += uintptr(2)
  20709. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20710. return -int32(1)
  20711. }
  20712. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20714. return m_XML_TOK_INVALID
  20715. }
  20716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20717. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20718. _19:
  20719. ;
  20720. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20721. return m_XML_TOK_INVALID
  20722. _20:
  20723. }
  20724. return -int32(1)
  20725. }
  20726. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20727. var n Tsize_t
  20728. var v1, v2, v3 int32
  20729. _, _, _, _ = n, v1, v2, v3
  20730. if ptr >= end {
  20731. return -int32(4)
  20732. }
  20733. if int32(2) > int32(1) {
  20734. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20735. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20736. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20737. if n == uint64(0) {
  20738. return -int32(1)
  20739. }
  20740. end = ptr + uintptr(n)
  20741. }
  20742. }
  20743. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20744. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20745. } else {
  20746. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20747. }
  20748. switch v1 {
  20749. case int32(_BT_LT):
  20750. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20751. case int32(_BT_AMP):
  20752. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20753. case int32(_BT_CR):
  20754. ptr += uintptr(2)
  20755. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20756. return -int32(3)
  20757. }
  20758. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20759. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20760. } else {
  20761. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20762. }
  20763. if v2 == int32(_BT_LF) {
  20764. ptr += uintptr(2)
  20765. }
  20766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20767. return int32(m_XML_TOK_DATA_NEWLINE)
  20768. case int32(_BT_LF):
  20769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20770. return int32(m_XML_TOK_DATA_NEWLINE)
  20771. case int32(_BT_RSQB):
  20772. ptr += uintptr(2)
  20773. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20774. return -int32(5)
  20775. }
  20776. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20777. break
  20778. }
  20779. ptr += uintptr(2)
  20780. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20781. return -int32(5)
  20782. }
  20783. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20784. ptr -= uintptr(2)
  20785. break
  20786. }
  20787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20788. return m_XML_TOK_INVALID
  20789. case int32(_BT_LEAD2):
  20790. if int64(end)-int64(ptr) < int64(2) {
  20791. return -int32(2)
  20792. }
  20793. if 0 != 0 {
  20794. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20795. return m_XML_TOK_INVALID
  20796. }
  20797. ptr += uintptr(2)
  20798. case int32(_BT_LEAD3):
  20799. if int64(end)-int64(ptr) < int64(3) {
  20800. return -int32(2)
  20801. }
  20802. if 0 != 0 {
  20803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20804. return m_XML_TOK_INVALID
  20805. }
  20806. ptr += uintptr(3)
  20807. case int32(_BT_LEAD4):
  20808. if int64(end)-int64(ptr) < int64(4) {
  20809. return -int32(2)
  20810. }
  20811. if 0 != 0 {
  20812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20813. return m_XML_TOK_INVALID
  20814. }
  20815. ptr += uintptr(4)
  20816. case int32(_BT_NONXML):
  20817. fallthrough
  20818. case int32(_BT_MALFORM):
  20819. fallthrough
  20820. case int32(_BT_TRAIL):
  20821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20822. return m_XML_TOK_INVALID
  20823. default:
  20824. ptr += uintptr(2)
  20825. break
  20826. }
  20827. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20828. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20829. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20830. } else {
  20831. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20832. }
  20833. switch v3 {
  20834. case int32(_BT_LEAD2):
  20835. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  20836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20837. return int32(m_XML_TOK_DATA_CHARS)
  20838. }
  20839. ptr += uintptr(2)
  20840. case int32(_BT_LEAD3):
  20841. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  20842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20843. return int32(m_XML_TOK_DATA_CHARS)
  20844. }
  20845. ptr += uintptr(3)
  20846. case int32(_BT_LEAD4):
  20847. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  20848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20849. return int32(m_XML_TOK_DATA_CHARS)
  20850. }
  20851. ptr += uintptr(4)
  20852. case int32(_BT_RSQB):
  20853. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  20854. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  20855. ptr += uintptr(2)
  20856. break
  20857. }
  20858. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  20859. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  20860. ptr += uintptr(2)
  20861. break
  20862. }
  20863. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20864. return m_XML_TOK_INVALID
  20865. }
  20866. }
  20867. /* fall through */
  20868. fallthrough
  20869. case int32(_BT_AMP):
  20870. fallthrough
  20871. case int32(_BT_LT):
  20872. fallthrough
  20873. case int32(_BT_NONXML):
  20874. fallthrough
  20875. case int32(_BT_MALFORM):
  20876. fallthrough
  20877. case int32(_BT_TRAIL):
  20878. fallthrough
  20879. case int32(_BT_CR):
  20880. fallthrough
  20881. case int32(_BT_LF):
  20882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20883. return int32(m_XML_TOK_DATA_CHARS)
  20884. default:
  20885. ptr += uintptr(2)
  20886. break
  20887. }
  20888. }
  20889. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20890. return int32(m_XML_TOK_DATA_CHARS)
  20891. }
  20892. /* ptr points to character following "%" */
  20893. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20894. var v1, v2 int32
  20895. _, _ = v1, v2
  20896. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20897. return -int32(1)
  20898. }
  20899. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20900. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20901. } else {
  20902. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20903. }
  20904. switch v1 {
  20905. case int32(_BT_NONASCII):
  20906. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20907. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20908. return m_XML_TOK_INVALID
  20909. } /* fall through */
  20910. fallthrough
  20911. case int32(_BT_NMSTRT):
  20912. fallthrough
  20913. case int32(_BT_HEX):
  20914. ptr += uintptr(2)
  20915. case int32(_BT_LEAD2):
  20916. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20917. return -int32(2)
  20918. }
  20919. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20920. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20921. return m_XML_TOK_INVALID
  20922. }
  20923. ptr += uintptr(2)
  20924. case int32(_BT_LEAD3):
  20925. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20926. return -int32(2)
  20927. }
  20928. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20929. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20930. return m_XML_TOK_INVALID
  20931. }
  20932. ptr += uintptr(3)
  20933. case int32(_BT_LEAD4):
  20934. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20935. return -int32(2)
  20936. }
  20937. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20939. return m_XML_TOK_INVALID
  20940. }
  20941. ptr += uintptr(4)
  20942. case int32(_BT_S):
  20943. fallthrough
  20944. case int32(_BT_LF):
  20945. fallthrough
  20946. case int32(_BT_CR):
  20947. fallthrough
  20948. case int32(_BT_PERCNT):
  20949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20950. return int32(m_XML_TOK_PERCENT)
  20951. default:
  20952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20953. return m_XML_TOK_INVALID
  20954. }
  20955. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20956. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20957. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20958. } else {
  20959. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20960. }
  20961. switch v2 {
  20962. case int32(_BT_NONASCII):
  20963. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20965. return m_XML_TOK_INVALID
  20966. } /* fall through */
  20967. fallthrough
  20968. case int32(_BT_NMSTRT):
  20969. fallthrough
  20970. case int32(_BT_HEX):
  20971. fallthrough
  20972. case int32(_BT_DIGIT):
  20973. fallthrough
  20974. case int32(_BT_NAME):
  20975. fallthrough
  20976. case int32(_BT_MINUS):
  20977. ptr += uintptr(2)
  20978. case int32(_BT_LEAD2):
  20979. if int64(end)-int64(ptr) < int64(2) {
  20980. return -int32(2)
  20981. }
  20982. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20983. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20984. return m_XML_TOK_INVALID
  20985. }
  20986. ptr += uintptr(2)
  20987. case int32(_BT_LEAD3):
  20988. if int64(end)-int64(ptr) < int64(3) {
  20989. return -int32(2)
  20990. }
  20991. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20992. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20993. return m_XML_TOK_INVALID
  20994. }
  20995. ptr += uintptr(3)
  20996. case int32(_BT_LEAD4):
  20997. if int64(end)-int64(ptr) < int64(4) {
  20998. return -int32(2)
  20999. }
  21000. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21001. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21002. return m_XML_TOK_INVALID
  21003. }
  21004. ptr += uintptr(4)
  21005. case int32(_BT_SEMI):
  21006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21007. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  21008. default:
  21009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21010. return m_XML_TOK_INVALID
  21011. }
  21012. }
  21013. return -int32(1)
  21014. }
  21015. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21016. var v1, v2 int32
  21017. _, _ = v1, v2
  21018. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21019. return -int32(1)
  21020. }
  21021. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21022. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21023. } else {
  21024. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21025. }
  21026. switch v1 {
  21027. case int32(_BT_NONASCII):
  21028. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21030. return m_XML_TOK_INVALID
  21031. } /* fall through */
  21032. fallthrough
  21033. case int32(_BT_NMSTRT):
  21034. fallthrough
  21035. case int32(_BT_HEX):
  21036. ptr += uintptr(2)
  21037. case int32(_BT_LEAD2):
  21038. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  21039. return -int32(2)
  21040. }
  21041. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21042. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21043. return m_XML_TOK_INVALID
  21044. }
  21045. ptr += uintptr(2)
  21046. case int32(_BT_LEAD3):
  21047. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  21048. return -int32(2)
  21049. }
  21050. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21052. return m_XML_TOK_INVALID
  21053. }
  21054. ptr += uintptr(3)
  21055. case int32(_BT_LEAD4):
  21056. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  21057. return -int32(2)
  21058. }
  21059. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21061. return m_XML_TOK_INVALID
  21062. }
  21063. ptr += uintptr(4)
  21064. default:
  21065. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21066. return m_XML_TOK_INVALID
  21067. }
  21068. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21069. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21070. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21071. } else {
  21072. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21073. }
  21074. switch v2 {
  21075. case int32(_BT_NONASCII):
  21076. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21077. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21078. return m_XML_TOK_INVALID
  21079. } /* fall through */
  21080. fallthrough
  21081. case int32(_BT_NMSTRT):
  21082. fallthrough
  21083. case int32(_BT_HEX):
  21084. fallthrough
  21085. case int32(_BT_DIGIT):
  21086. fallthrough
  21087. case int32(_BT_NAME):
  21088. fallthrough
  21089. case int32(_BT_MINUS):
  21090. ptr += uintptr(2)
  21091. case int32(_BT_LEAD2):
  21092. if int64(end)-int64(ptr) < int64(2) {
  21093. return -int32(2)
  21094. }
  21095. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21096. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21097. return m_XML_TOK_INVALID
  21098. }
  21099. ptr += uintptr(2)
  21100. case int32(_BT_LEAD3):
  21101. if int64(end)-int64(ptr) < int64(3) {
  21102. return -int32(2)
  21103. }
  21104. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21105. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21106. return m_XML_TOK_INVALID
  21107. }
  21108. ptr += uintptr(3)
  21109. case int32(_BT_LEAD4):
  21110. if int64(end)-int64(ptr) < int64(4) {
  21111. return -int32(2)
  21112. }
  21113. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21115. return m_XML_TOK_INVALID
  21116. }
  21117. ptr += uintptr(4)
  21118. case int32(_BT_CR):
  21119. fallthrough
  21120. case int32(_BT_LF):
  21121. fallthrough
  21122. case int32(_BT_S):
  21123. fallthrough
  21124. case int32(_BT_RPAR):
  21125. fallthrough
  21126. case int32(_BT_GT):
  21127. fallthrough
  21128. case int32(_BT_PERCNT):
  21129. fallthrough
  21130. case int32(_BT_VERBAR):
  21131. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21132. return int32(m_XML_TOK_POUND_NAME)
  21133. default:
  21134. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21135. return m_XML_TOK_INVALID
  21136. }
  21137. }
  21138. return -int32(m_XML_TOK_POUND_NAME)
  21139. }
  21140. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21141. var t, v1, v2 int32
  21142. _, _, _ = t, v1, v2
  21143. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21144. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21145. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21146. } else {
  21147. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21148. }
  21149. t = v1
  21150. switch t {
  21151. case int32(_BT_LEAD2):
  21152. if int64(end)-int64(ptr) < int64(2) {
  21153. return -int32(2)
  21154. }
  21155. if 0 != 0 {
  21156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21157. return m_XML_TOK_INVALID
  21158. }
  21159. ptr += uintptr(2)
  21160. case int32(_BT_LEAD3):
  21161. if int64(end)-int64(ptr) < int64(3) {
  21162. return -int32(2)
  21163. }
  21164. if 0 != 0 {
  21165. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21166. return m_XML_TOK_INVALID
  21167. }
  21168. ptr += uintptr(3)
  21169. case int32(_BT_LEAD4):
  21170. if int64(end)-int64(ptr) < int64(4) {
  21171. return -int32(2)
  21172. }
  21173. if 0 != 0 {
  21174. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21175. return m_XML_TOK_INVALID
  21176. }
  21177. ptr += uintptr(4)
  21178. case int32(_BT_NONXML):
  21179. fallthrough
  21180. case int32(_BT_MALFORM):
  21181. fallthrough
  21182. case int32(_BT_TRAIL):
  21183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21184. return m_XML_TOK_INVALID
  21185. case int32(_BT_QUOT):
  21186. fallthrough
  21187. case int32(_BT_APOS):
  21188. ptr += uintptr(2)
  21189. if t != open {
  21190. break
  21191. }
  21192. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21193. return -int32(m_XML_TOK_LITERAL)
  21194. }
  21195. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21196. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21197. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21198. } else {
  21199. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21200. }
  21201. switch v2 {
  21202. case int32(_BT_S):
  21203. fallthrough
  21204. case int32(_BT_CR):
  21205. fallthrough
  21206. case int32(_BT_LF):
  21207. fallthrough
  21208. case int32(_BT_GT):
  21209. fallthrough
  21210. case int32(_BT_PERCNT):
  21211. fallthrough
  21212. case int32(_BT_LSQB):
  21213. return int32(m_XML_TOK_LITERAL)
  21214. default:
  21215. return m_XML_TOK_INVALID
  21216. }
  21217. fallthrough
  21218. default:
  21219. ptr += uintptr(2)
  21220. break
  21221. }
  21222. }
  21223. return -int32(1)
  21224. }
  21225. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21226. var n Tsize_t
  21227. var tok, v1, v29, v33, v34, v35, v36 int32
  21228. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  21229. if ptr >= end {
  21230. return -int32(4)
  21231. }
  21232. if int32(2) > int32(1) {
  21233. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21234. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21235. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21236. if n == uint64(0) {
  21237. return -int32(1)
  21238. }
  21239. end = ptr + uintptr(n)
  21240. }
  21241. }
  21242. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21243. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21244. } else {
  21245. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21246. }
  21247. switch v1 {
  21248. case int32(_BT_QUOT):
  21249. goto _2
  21250. case int32(_BT_APOS):
  21251. goto _3
  21252. case int32(_BT_LT):
  21253. goto _4
  21254. case int32(_BT_CR):
  21255. goto _5
  21256. case int32(_BT_LF):
  21257. goto _6
  21258. case int32(_BT_S):
  21259. goto _7
  21260. case int32(_BT_PERCNT):
  21261. goto _8
  21262. case int32(_BT_COMMA):
  21263. goto _9
  21264. case int32(_BT_LSQB):
  21265. goto _10
  21266. case int32(_BT_RSQB):
  21267. goto _11
  21268. case int32(_BT_LPAR):
  21269. goto _12
  21270. case int32(_BT_RPAR):
  21271. goto _13
  21272. case int32(_BT_VERBAR):
  21273. goto _14
  21274. case int32(_BT_GT):
  21275. goto _15
  21276. case int32(_BT_NUM):
  21277. goto _16
  21278. case int32(_BT_LEAD2):
  21279. goto _17
  21280. case int32(_BT_LEAD3):
  21281. goto _18
  21282. case int32(_BT_LEAD4):
  21283. goto _19
  21284. case int32(_BT_HEX):
  21285. goto _20
  21286. case int32(_BT_NMSTRT):
  21287. goto _21
  21288. case int32(_BT_COLON):
  21289. goto _22
  21290. case int32(_BT_MINUS):
  21291. goto _23
  21292. case int32(_BT_NAME):
  21293. goto _24
  21294. case int32(_BT_DIGIT):
  21295. goto _25
  21296. case int32(_BT_NONASCII):
  21297. goto _26
  21298. default:
  21299. goto _27
  21300. }
  21301. goto _28
  21302. _2:
  21303. ;
  21304. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21305. _3:
  21306. ;
  21307. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21308. _4:
  21309. ;
  21310. ptr += uintptr(2)
  21311. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21312. return -int32(1)
  21313. }
  21314. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21315. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21316. } else {
  21317. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21318. }
  21319. switch v29 {
  21320. case int32(_BT_EXCL):
  21321. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21322. case int32(_BT_QUEST):
  21323. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21324. case int32(_BT_NMSTRT):
  21325. fallthrough
  21326. case int32(_BT_HEX):
  21327. fallthrough
  21328. case int32(_BT_NONASCII):
  21329. fallthrough
  21330. case int32(_BT_LEAD2):
  21331. fallthrough
  21332. case int32(_BT_LEAD3):
  21333. fallthrough
  21334. case int32(_BT_LEAD4):
  21335. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21336. return int32(m_XML_TOK_INSTANCE_START)
  21337. }
  21338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21339. return m_XML_TOK_INVALID
  21340. _5:
  21341. ;
  21342. if ptr+uintptr(2) == end {
  21343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21344. /* indicate that this might be part of a CR/LF pair */
  21345. return -int32(m_XML_TOK_PROLOG_S)
  21346. }
  21347. /* fall through */
  21348. _7:
  21349. ;
  21350. _6:
  21351. ;
  21352. _32:
  21353. ;
  21354. ptr += uintptr(2)
  21355. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21356. goto _30
  21357. }
  21358. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21359. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21360. } else {
  21361. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21362. }
  21363. switch v33 {
  21364. case int32(_BT_S):
  21365. fallthrough
  21366. case int32(_BT_LF):
  21367. case int32(_BT_CR):
  21368. /* don't split CR/LF pair */
  21369. if ptr+uintptr(2) != end {
  21370. break
  21371. }
  21372. /* fall through */
  21373. fallthrough
  21374. default:
  21375. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21376. return int32(m_XML_TOK_PROLOG_S)
  21377. }
  21378. goto _31
  21379. _31:
  21380. ;
  21381. goto _32
  21382. goto _30
  21383. _30:
  21384. ;
  21385. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21386. return int32(m_XML_TOK_PROLOG_S)
  21387. _8:
  21388. ;
  21389. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21390. _9:
  21391. ;
  21392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21393. return int32(m_XML_TOK_COMMA)
  21394. _10:
  21395. ;
  21396. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21397. return int32(m_XML_TOK_OPEN_BRACKET)
  21398. _11:
  21399. ;
  21400. ptr += uintptr(2)
  21401. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21402. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21403. }
  21404. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21405. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  21406. return -int32(1)
  21407. }
  21408. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  21409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21410. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21411. }
  21412. }
  21413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21414. return int32(m_XML_TOK_CLOSE_BRACKET)
  21415. _12:
  21416. ;
  21417. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21418. return int32(m_XML_TOK_OPEN_PAREN)
  21419. _13:
  21420. ;
  21421. ptr += uintptr(2)
  21422. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21423. return -int32(m_XML_TOK_CLOSE_PAREN)
  21424. }
  21425. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21426. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21427. } else {
  21428. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21429. }
  21430. switch v34 {
  21431. case int32(_BT_AST):
  21432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21433. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21434. case int32(_BT_QUEST):
  21435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21436. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21437. case int32(_BT_PLUS):
  21438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21439. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21440. case int32(_BT_CR):
  21441. fallthrough
  21442. case int32(_BT_LF):
  21443. fallthrough
  21444. case int32(_BT_S):
  21445. fallthrough
  21446. case int32(_BT_GT):
  21447. fallthrough
  21448. case int32(_BT_COMMA):
  21449. fallthrough
  21450. case int32(_BT_VERBAR):
  21451. fallthrough
  21452. case int32(_BT_RPAR):
  21453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21454. return int32(m_XML_TOK_CLOSE_PAREN)
  21455. }
  21456. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21457. return m_XML_TOK_INVALID
  21458. _14:
  21459. ;
  21460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21461. return int32(m_XML_TOK_OR)
  21462. _15:
  21463. ;
  21464. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21465. return int32(m_XML_TOK_DECL_CLOSE)
  21466. _16:
  21467. ;
  21468. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21469. _17:
  21470. ;
  21471. if int64(end)-int64(ptr) < int64(2) {
  21472. return -int32(2)
  21473. }
  21474. if 0 != 0 {
  21475. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21476. return m_XML_TOK_INVALID
  21477. }
  21478. if 0 != 0 {
  21479. ptr += uintptr(2)
  21480. tok = int32(m_XML_TOK_NAME)
  21481. goto _28
  21482. }
  21483. if 0 != 0 {
  21484. ptr += uintptr(2)
  21485. tok = int32(m_XML_TOK_NMTOKEN)
  21486. goto _28
  21487. }
  21488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21489. return m_XML_TOK_INVALID
  21490. _18:
  21491. ;
  21492. if int64(end)-int64(ptr) < int64(3) {
  21493. return -int32(2)
  21494. }
  21495. if 0 != 0 {
  21496. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21497. return m_XML_TOK_INVALID
  21498. }
  21499. if 0 != 0 {
  21500. ptr += uintptr(3)
  21501. tok = int32(m_XML_TOK_NAME)
  21502. goto _28
  21503. }
  21504. if 0 != 0 {
  21505. ptr += uintptr(3)
  21506. tok = int32(m_XML_TOK_NMTOKEN)
  21507. goto _28
  21508. }
  21509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21510. return m_XML_TOK_INVALID
  21511. _19:
  21512. ;
  21513. if int64(end)-int64(ptr) < int64(4) {
  21514. return -int32(2)
  21515. }
  21516. if 0 != 0 {
  21517. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21518. return m_XML_TOK_INVALID
  21519. }
  21520. if 0 != 0 {
  21521. ptr += uintptr(4)
  21522. tok = int32(m_XML_TOK_NAME)
  21523. goto _28
  21524. }
  21525. if 0 != 0 {
  21526. ptr += uintptr(4)
  21527. tok = int32(m_XML_TOK_NMTOKEN)
  21528. goto _28
  21529. }
  21530. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21531. return m_XML_TOK_INVALID
  21532. _21:
  21533. ;
  21534. _20:
  21535. ;
  21536. tok = int32(m_XML_TOK_NAME)
  21537. ptr += uintptr(2)
  21538. goto _28
  21539. _25:
  21540. ;
  21541. _24:
  21542. ;
  21543. _23:
  21544. ;
  21545. _22:
  21546. ;
  21547. tok = int32(m_XML_TOK_NMTOKEN)
  21548. ptr += uintptr(2)
  21549. goto _28
  21550. _26:
  21551. ;
  21552. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  21553. ptr += uintptr(2)
  21554. tok = int32(m_XML_TOK_NAME)
  21555. goto _28
  21556. }
  21557. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  21558. ptr += uintptr(2)
  21559. tok = int32(m_XML_TOK_NMTOKEN)
  21560. goto _28
  21561. }
  21562. /* fall through */
  21563. _27:
  21564. ;
  21565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21566. return m_XML_TOK_INVALID
  21567. _28:
  21568. ;
  21569. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21570. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21571. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21572. } else {
  21573. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21574. }
  21575. switch v35 {
  21576. case int32(_BT_NONASCII):
  21577. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21579. return m_XML_TOK_INVALID
  21580. } /* fall through */
  21581. fallthrough
  21582. case int32(_BT_NMSTRT):
  21583. fallthrough
  21584. case int32(_BT_HEX):
  21585. fallthrough
  21586. case int32(_BT_DIGIT):
  21587. fallthrough
  21588. case int32(_BT_NAME):
  21589. fallthrough
  21590. case int32(_BT_MINUS):
  21591. ptr += uintptr(2)
  21592. case int32(_BT_LEAD2):
  21593. if int64(end)-int64(ptr) < int64(2) {
  21594. return -int32(2)
  21595. }
  21596. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21597. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21598. return m_XML_TOK_INVALID
  21599. }
  21600. ptr += uintptr(2)
  21601. case int32(_BT_LEAD3):
  21602. if int64(end)-int64(ptr) < int64(3) {
  21603. return -int32(2)
  21604. }
  21605. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21607. return m_XML_TOK_INVALID
  21608. }
  21609. ptr += uintptr(3)
  21610. case int32(_BT_LEAD4):
  21611. if int64(end)-int64(ptr) < int64(4) {
  21612. return -int32(2)
  21613. }
  21614. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21615. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21616. return m_XML_TOK_INVALID
  21617. }
  21618. ptr += uintptr(4)
  21619. case int32(_BT_GT):
  21620. fallthrough
  21621. case int32(_BT_RPAR):
  21622. fallthrough
  21623. case int32(_BT_COMMA):
  21624. fallthrough
  21625. case int32(_BT_VERBAR):
  21626. fallthrough
  21627. case int32(_BT_LSQB):
  21628. fallthrough
  21629. case int32(_BT_PERCNT):
  21630. fallthrough
  21631. case int32(_BT_S):
  21632. fallthrough
  21633. case int32(_BT_CR):
  21634. fallthrough
  21635. case int32(_BT_LF):
  21636. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21637. return tok
  21638. case int32(_BT_COLON):
  21639. ptr += uintptr(2)
  21640. switch tok {
  21641. case int32(m_XML_TOK_NAME):
  21642. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21643. return -int32(1)
  21644. }
  21645. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21646. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21647. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21648. } else {
  21649. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21650. }
  21651. switch v36 {
  21652. case int32(_BT_NONASCII):
  21653. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21654. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21655. return m_XML_TOK_INVALID
  21656. } /* fall through */
  21657. fallthrough
  21658. case int32(_BT_NMSTRT):
  21659. fallthrough
  21660. case int32(_BT_HEX):
  21661. fallthrough
  21662. case int32(_BT_DIGIT):
  21663. fallthrough
  21664. case int32(_BT_NAME):
  21665. fallthrough
  21666. case int32(_BT_MINUS):
  21667. ptr += uintptr(2)
  21668. case int32(_BT_LEAD2):
  21669. if int64(end)-int64(ptr) < int64(2) {
  21670. return -int32(2)
  21671. }
  21672. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21674. return m_XML_TOK_INVALID
  21675. }
  21676. ptr += uintptr(2)
  21677. case int32(_BT_LEAD3):
  21678. if int64(end)-int64(ptr) < int64(3) {
  21679. return -int32(2)
  21680. }
  21681. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21683. return m_XML_TOK_INVALID
  21684. }
  21685. ptr += uintptr(3)
  21686. case int32(_BT_LEAD4):
  21687. if int64(end)-int64(ptr) < int64(4) {
  21688. return -int32(2)
  21689. }
  21690. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21691. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21692. return m_XML_TOK_INVALID
  21693. }
  21694. ptr += uintptr(4)
  21695. default:
  21696. tok = int32(m_XML_TOK_NMTOKEN)
  21697. break
  21698. }
  21699. case int32(m_XML_TOK_PREFIXED_NAME):
  21700. tok = int32(m_XML_TOK_NMTOKEN)
  21701. break
  21702. }
  21703. case int32(_BT_PLUS):
  21704. if tok == int32(m_XML_TOK_NMTOKEN) {
  21705. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21706. return m_XML_TOK_INVALID
  21707. }
  21708. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21709. return int32(m_XML_TOK_NAME_PLUS)
  21710. case int32(_BT_AST):
  21711. if tok == int32(m_XML_TOK_NMTOKEN) {
  21712. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21713. return m_XML_TOK_INVALID
  21714. }
  21715. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21716. return int32(m_XML_TOK_NAME_ASTERISK)
  21717. case int32(_BT_QUEST):
  21718. if tok == int32(m_XML_TOK_NMTOKEN) {
  21719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21720. return m_XML_TOK_INVALID
  21721. }
  21722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21723. return int32(m_XML_TOK_NAME_QUESTION)
  21724. default:
  21725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21726. return m_XML_TOK_INVALID
  21727. }
  21728. }
  21729. return -tok
  21730. }
  21731. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21732. var start uintptr
  21733. var v1, v2 int32
  21734. _, _, _ = start, v1, v2
  21735. if ptr >= end {
  21736. return -int32(4)
  21737. } else {
  21738. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21739. /* This line cannot be executed. The incoming data has already
  21740. * been tokenized once, so incomplete characters like this have
  21741. * already been eliminated from the input. Retaining the paranoia
  21742. * check is still valuable, however.
  21743. */
  21744. return -int32(1) /* LCOV_EXCL_LINE */
  21745. }
  21746. }
  21747. start = ptr
  21748. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21749. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21750. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21751. } else {
  21752. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21753. }
  21754. switch v1 {
  21755. case int32(_BT_LEAD2):
  21756. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21757. case int32(_BT_LEAD3):
  21758. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21759. case int32(_BT_LEAD4):
  21760. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21761. case int32(_BT_AMP):
  21762. if ptr == start {
  21763. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21764. }
  21765. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21766. return int32(m_XML_TOK_DATA_CHARS)
  21767. case int32(_BT_LT):
  21768. /* this is for inside entity references */
  21769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21770. return m_XML_TOK_INVALID
  21771. case int32(_BT_LF):
  21772. if ptr == start {
  21773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21774. return int32(m_XML_TOK_DATA_NEWLINE)
  21775. }
  21776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21777. return int32(m_XML_TOK_DATA_CHARS)
  21778. case int32(_BT_CR):
  21779. if ptr == start {
  21780. ptr += uintptr(2)
  21781. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21782. return -int32(3)
  21783. }
  21784. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21785. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21786. } else {
  21787. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21788. }
  21789. if v2 == int32(_BT_LF) {
  21790. ptr += uintptr(2)
  21791. }
  21792. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21793. return int32(m_XML_TOK_DATA_NEWLINE)
  21794. }
  21795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21796. return int32(m_XML_TOK_DATA_CHARS)
  21797. case int32(_BT_S):
  21798. if ptr == start {
  21799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21800. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21801. }
  21802. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21803. return int32(m_XML_TOK_DATA_CHARS)
  21804. default:
  21805. ptr += uintptr(2)
  21806. break
  21807. }
  21808. }
  21809. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21810. return int32(m_XML_TOK_DATA_CHARS)
  21811. }
  21812. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21813. var start uintptr
  21814. var tok, v1, v2, v3 int32
  21815. _, _, _, _, _ = start, tok, v1, v2, v3
  21816. if ptr >= end {
  21817. return -int32(4)
  21818. } else {
  21819. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21820. /* This line cannot be executed. The incoming data has already
  21821. * been tokenized once, so incomplete characters like this have
  21822. * already been eliminated from the input. Retaining the paranoia
  21823. * check is still valuable, however.
  21824. */
  21825. return -int32(1) /* LCOV_EXCL_LINE */
  21826. }
  21827. }
  21828. start = ptr
  21829. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21830. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21831. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21832. } else {
  21833. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21834. }
  21835. switch v1 {
  21836. case int32(_BT_LEAD2):
  21837. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21838. case int32(_BT_LEAD3):
  21839. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21840. case int32(_BT_LEAD4):
  21841. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21842. case int32(_BT_AMP):
  21843. if ptr == start {
  21844. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21845. }
  21846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21847. return int32(m_XML_TOK_DATA_CHARS)
  21848. case int32(_BT_PERCNT):
  21849. if ptr == start {
  21850. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21851. if tok == int32(m_XML_TOK_PERCENT) {
  21852. v2 = m_XML_TOK_INVALID
  21853. } else {
  21854. v2 = tok
  21855. }
  21856. return v2
  21857. }
  21858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21859. return int32(m_XML_TOK_DATA_CHARS)
  21860. case int32(_BT_LF):
  21861. if ptr == start {
  21862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21863. return int32(m_XML_TOK_DATA_NEWLINE)
  21864. }
  21865. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21866. return int32(m_XML_TOK_DATA_CHARS)
  21867. case int32(_BT_CR):
  21868. if ptr == start {
  21869. ptr += uintptr(2)
  21870. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21871. return -int32(3)
  21872. }
  21873. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21874. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21875. } else {
  21876. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21877. }
  21878. if v3 == int32(_BT_LF) {
  21879. ptr += uintptr(2)
  21880. }
  21881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21882. return int32(m_XML_TOK_DATA_NEWLINE)
  21883. }
  21884. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21885. return int32(m_XML_TOK_DATA_CHARS)
  21886. default:
  21887. ptr += uintptr(2)
  21888. break
  21889. }
  21890. }
  21891. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21892. return int32(m_XML_TOK_DATA_CHARS)
  21893. }
  21894. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21895. var level, v1 int32
  21896. var n Tsize_t
  21897. _, _, _ = level, n, v1
  21898. level = 0
  21899. if int32(2) > int32(1) {
  21900. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21901. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21902. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21903. end = ptr + uintptr(n)
  21904. }
  21905. }
  21906. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21907. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21908. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21909. } else {
  21910. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21911. }
  21912. switch v1 {
  21913. case int32(_BT_LEAD2):
  21914. if int64(end)-int64(ptr) < int64(2) {
  21915. return -int32(2)
  21916. }
  21917. if 0 != 0 {
  21918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21919. return m_XML_TOK_INVALID
  21920. }
  21921. ptr += uintptr(2)
  21922. case int32(_BT_LEAD3):
  21923. if int64(end)-int64(ptr) < int64(3) {
  21924. return -int32(2)
  21925. }
  21926. if 0 != 0 {
  21927. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21928. return m_XML_TOK_INVALID
  21929. }
  21930. ptr += uintptr(3)
  21931. case int32(_BT_LEAD4):
  21932. if int64(end)-int64(ptr) < int64(4) {
  21933. return -int32(2)
  21934. }
  21935. if 0 != 0 {
  21936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21937. return m_XML_TOK_INVALID
  21938. }
  21939. ptr += uintptr(4)
  21940. case int32(_BT_NONXML):
  21941. fallthrough
  21942. case int32(_BT_MALFORM):
  21943. fallthrough
  21944. case int32(_BT_TRAIL):
  21945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21946. return m_XML_TOK_INVALID
  21947. case int32(_BT_LT):
  21948. ptr += uintptr(2)
  21949. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21950. return -int32(1)
  21951. }
  21952. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21953. ptr += uintptr(2)
  21954. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21955. return -int32(1)
  21956. }
  21957. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21958. level++
  21959. ptr += uintptr(2)
  21960. }
  21961. }
  21962. case int32(_BT_RSQB):
  21963. ptr += uintptr(2)
  21964. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21965. return -int32(1)
  21966. }
  21967. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21968. ptr += uintptr(2)
  21969. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21970. return -int32(1)
  21971. }
  21972. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21973. ptr += uintptr(2)
  21974. if level == 0 {
  21975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21976. return int32(m_XML_TOK_IGNORE_SECT)
  21977. }
  21978. level--
  21979. }
  21980. }
  21981. default:
  21982. ptr += uintptr(2)
  21983. break
  21984. }
  21985. }
  21986. return -int32(1)
  21987. }
  21988. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21989. var v2, v3, v4 int32
  21990. _, _, _ = v2, v3, v4
  21991. ptr += uintptr(2)
  21992. end -= uintptr(2)
  21993. for {
  21994. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21995. break
  21996. }
  21997. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21998. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21999. } else {
  22000. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22001. }
  22002. switch v2 {
  22003. case int32(_BT_DIGIT):
  22004. fallthrough
  22005. case int32(_BT_HEX):
  22006. fallthrough
  22007. case int32(_BT_MINUS):
  22008. fallthrough
  22009. case int32(_BT_APOS):
  22010. fallthrough
  22011. case int32(_BT_LPAR):
  22012. fallthrough
  22013. case int32(_BT_RPAR):
  22014. fallthrough
  22015. case int32(_BT_PLUS):
  22016. fallthrough
  22017. case int32(_BT_COMMA):
  22018. fallthrough
  22019. case int32(_BT_SOL):
  22020. fallthrough
  22021. case int32(_BT_EQUALS):
  22022. fallthrough
  22023. case int32(_BT_QUEST):
  22024. fallthrough
  22025. case int32(_BT_CR):
  22026. fallthrough
  22027. case int32(_BT_LF):
  22028. fallthrough
  22029. case int32(_BT_SEMI):
  22030. fallthrough
  22031. case int32(_BT_EXCL):
  22032. fallthrough
  22033. case int32(_BT_AST):
  22034. fallthrough
  22035. case int32(_BT_PERCNT):
  22036. fallthrough
  22037. case int32(_BT_NUM):
  22038. fallthrough
  22039. case int32(_BT_COLON):
  22040. case int32(_BT_S):
  22041. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  22042. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  22043. return 0
  22044. }
  22045. case int32(_BT_NAME):
  22046. fallthrough
  22047. case int32(_BT_NMSTRT):
  22048. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22049. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22050. } else {
  22051. v3 = -int32(1)
  22052. }
  22053. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  22054. break
  22055. }
  22056. /* fall through */
  22057. fallthrough
  22058. default:
  22059. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22060. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22061. } else {
  22062. v4 = -int32(1)
  22063. }
  22064. switch v4 {
  22065. case int32(0x24): /* $ */
  22066. fallthrough
  22067. case int32(0x40): /* @ */
  22068. default:
  22069. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  22070. return 0
  22071. }
  22072. break
  22073. }
  22074. goto _1
  22075. _1:
  22076. ;
  22077. ptr += uintptr(2)
  22078. }
  22079. return int32(1)
  22080. }
  22081. /* This must only be called for a well-formed start-tag or empty
  22082. element tag. Returns the number of attributes. Pointers to the
  22083. first attsMax attributes are stored in atts.
  22084. */
  22085. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  22086. var nAtts, open, state, v2, v3, v5, v7 int32
  22087. var v4, v6, v8, v9 bool
  22088. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  22089. state = 1
  22090. nAtts = 0
  22091. open = 0 /* defined when state == inValue;
  22092. initialization just to shut up compilers */
  22093. ptr += uintptr(2)
  22094. for {
  22095. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22096. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22097. } else {
  22098. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22099. }
  22100. switch v2 {
  22101. case int32(_BT_LEAD2):
  22102. if state == 0 {
  22103. if nAtts < attsMax {
  22104. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  22105. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  22106. }
  22107. state = 1
  22108. }
  22109. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  22110. case int32(_BT_LEAD3):
  22111. if state == 0 {
  22112. if nAtts < attsMax {
  22113. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  22114. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  22115. }
  22116. state = 1
  22117. }
  22118. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  22119. case int32(_BT_LEAD4):
  22120. if state == 0 {
  22121. if nAtts < attsMax {
  22122. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  22123. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  22124. }
  22125. state = 1
  22126. }
  22127. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  22128. case int32(_BT_NONASCII):
  22129. fallthrough
  22130. case int32(_BT_NMSTRT):
  22131. fallthrough
  22132. case int32(_BT_HEX):
  22133. if state == 0 {
  22134. if nAtts < attsMax {
  22135. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  22136. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  22137. }
  22138. state = 1
  22139. }
  22140. case int32(_BT_QUOT):
  22141. if state != 2 {
  22142. if nAtts < attsMax {
  22143. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  22144. }
  22145. state = 2
  22146. open = int32(_BT_QUOT)
  22147. } else {
  22148. if open == int32(_BT_QUOT) {
  22149. state = 0
  22150. if nAtts < attsMax {
  22151. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  22152. }
  22153. nAtts++
  22154. }
  22155. }
  22156. case int32(_BT_APOS):
  22157. if state != 2 {
  22158. if nAtts < attsMax {
  22159. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  22160. }
  22161. state = 2
  22162. open = int32(_BT_APOS)
  22163. } else {
  22164. if open == int32(_BT_APOS) {
  22165. state = 0
  22166. if nAtts < attsMax {
  22167. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  22168. }
  22169. nAtts++
  22170. }
  22171. }
  22172. case int32(_BT_AMP):
  22173. if nAtts < attsMax {
  22174. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  22175. }
  22176. case int32(_BT_S):
  22177. if state == 1 {
  22178. state = 0
  22179. } else {
  22180. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  22181. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  22182. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22183. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22184. } else {
  22185. v3 = -int32(1)
  22186. }
  22187. }
  22188. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  22189. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  22190. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  22191. } else {
  22192. v5 = -int32(1)
  22193. }
  22194. }
  22195. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  22196. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  22197. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  22198. } else {
  22199. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  22200. }
  22201. }
  22202. }
  22203. if v9 && (v8 || v7 == open) {
  22204. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  22205. }
  22206. }
  22207. case int32(_BT_CR):
  22208. fallthrough
  22209. case int32(_BT_LF):
  22210. /* This case ensures that the first attribute name is counted
  22211. Apart from that we could just change state on the quote. */
  22212. if state == 1 {
  22213. state = 0
  22214. } else {
  22215. if state == 2 && nAtts < attsMax {
  22216. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  22217. }
  22218. }
  22219. case int32(_BT_GT):
  22220. fallthrough
  22221. case int32(_BT_SOL):
  22222. if state != 2 {
  22223. return nAtts
  22224. }
  22225. default:
  22226. break
  22227. }
  22228. goto _1
  22229. _1:
  22230. ;
  22231. ptr += uintptr(2)
  22232. }
  22233. /* not reached */
  22234. return r
  22235. }
  22236. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22237. var c, c1, result, v2, v4 int32
  22238. _, _, _, _, _ = c, c1, result, v2, v4
  22239. result = 0
  22240. /* skip &# */
  22241. _ = enc
  22242. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  22243. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  22244. ptr += uintptr(2)
  22245. for {
  22246. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22247. break
  22248. }
  22249. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22250. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22251. } else {
  22252. v2 = -int32(1)
  22253. }
  22254. c = v2
  22255. switch c {
  22256. case int32(m_ASCII_02):
  22257. fallthrough
  22258. case int32(m_ASCII_12):
  22259. fallthrough
  22260. case int32(m_ASCII_22):
  22261. fallthrough
  22262. case int32(m_ASCII_32):
  22263. fallthrough
  22264. case int32(m_ASCII_41):
  22265. fallthrough
  22266. case int32(m_ASCII_51):
  22267. fallthrough
  22268. case int32(m_ASCII_61):
  22269. fallthrough
  22270. case int32(m_ASCII_71):
  22271. fallthrough
  22272. case int32(m_ASCII_82):
  22273. fallthrough
  22274. case int32(m_ASCII_92):
  22275. result <<= int32(4)
  22276. result |= c - int32(m_ASCII_02)
  22277. case int32(m_ASCII_A):
  22278. fallthrough
  22279. case int32(m_ASCII_B1):
  22280. fallthrough
  22281. case int32(m_ASCII_C):
  22282. fallthrough
  22283. case int32(m_ASCII_D):
  22284. fallthrough
  22285. case int32(m_ASCII_E):
  22286. fallthrough
  22287. case int32(m_ASCII_F):
  22288. result <<= int32(4)
  22289. result += int32(10) + (c - int32(m_ASCII_A))
  22290. case int32(m_ASCII_a2):
  22291. fallthrough
  22292. case int32(m_ASCII_b1):
  22293. fallthrough
  22294. case int32(m_ASCII_c2):
  22295. fallthrough
  22296. case int32(m_ASCII_d1):
  22297. fallthrough
  22298. case int32(m_ASCII_e2):
  22299. fallthrough
  22300. case int32(m_ASCII_f1):
  22301. result <<= int32(4)
  22302. result += int32(10) + (c - int32(m_ASCII_a2))
  22303. break
  22304. }
  22305. if result >= int32(0x110000) {
  22306. return -int32(1)
  22307. }
  22308. goto _1
  22309. _1:
  22310. ;
  22311. ptr += uintptr(2)
  22312. }
  22313. } else {
  22314. for {
  22315. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22316. break
  22317. }
  22318. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22319. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22320. } else {
  22321. v4 = -int32(1)
  22322. }
  22323. c1 = v4
  22324. result *= int32(10)
  22325. result += c1 - int32(m_ASCII_02)
  22326. if result >= int32(0x110000) {
  22327. return -int32(1)
  22328. }
  22329. goto _3
  22330. _3:
  22331. ;
  22332. ptr += uintptr(2)
  22333. }
  22334. }
  22335. return _checkCharRefNumber(tls, result)
  22336. }
  22337. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22338. var v1, v2 int32
  22339. _, _ = v1, v2
  22340. _ = enc
  22341. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  22342. case int64(2):
  22343. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22344. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22345. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22346. } else {
  22347. v1 = -int32(1)
  22348. }
  22349. switch v1 {
  22350. case int32(m_ASCII_l2):
  22351. return int32(m_ASCII_LT1)
  22352. case int32(m_ASCII_g2):
  22353. return int32(m_ASCII_GT1)
  22354. }
  22355. }
  22356. case int64(3):
  22357. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22358. ptr += uintptr(2)
  22359. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22360. ptr += uintptr(2)
  22361. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22362. return int32(m_ASCII_AMP1)
  22363. }
  22364. }
  22365. }
  22366. case int64(4):
  22367. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22368. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22369. } else {
  22370. v2 = -int32(1)
  22371. }
  22372. switch v2 {
  22373. case int32(m_ASCII_q1):
  22374. ptr += uintptr(2)
  22375. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22376. ptr += uintptr(2)
  22377. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22378. ptr += uintptr(2)
  22379. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22380. return int32(m_ASCII_QUOT1)
  22381. }
  22382. }
  22383. }
  22384. case int32(m_ASCII_a2):
  22385. ptr += uintptr(2)
  22386. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22387. ptr += uintptr(2)
  22388. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22389. ptr += uintptr(2)
  22390. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22391. return int32(m_ASCII_APOS1)
  22392. }
  22393. }
  22394. }
  22395. break
  22396. }
  22397. }
  22398. return 0
  22399. }
  22400. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22401. _ = enc
  22402. for {
  22403. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  22404. break
  22405. }
  22406. if int64(end1)-int64(ptr1) < int64(2) {
  22407. /* This line cannot be executed. The incoming data has already
  22408. * been tokenized once, so incomplete characters like this have
  22409. * already been eliminated from the input. Retaining the
  22410. * paranoia check is still valuable, however.
  22411. */
  22412. return 0 /* LCOV_EXCL_LINE */
  22413. }
  22414. if !(int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  22415. return 0
  22416. }
  22417. goto _1
  22418. _1:
  22419. ;
  22420. ptr1 += uintptr(2)
  22421. ptr2++
  22422. }
  22423. return libc.BoolInt32(ptr1 == end1)
  22424. }
  22425. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22426. var start uintptr
  22427. var v2 int32
  22428. _, _ = start, v2
  22429. start = ptr
  22430. for {
  22431. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22432. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22433. } else {
  22434. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22435. }
  22436. switch v2 {
  22437. case int32(_BT_LEAD2):
  22438. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22439. case int32(_BT_LEAD3):
  22440. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22441. case int32(_BT_LEAD4):
  22442. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22443. case int32(_BT_NONASCII):
  22444. fallthrough
  22445. case int32(_BT_NMSTRT):
  22446. fallthrough
  22447. case int32(_BT_COLON):
  22448. fallthrough
  22449. case int32(_BT_HEX):
  22450. fallthrough
  22451. case int32(_BT_DIGIT):
  22452. fallthrough
  22453. case int32(_BT_NAME):
  22454. fallthrough
  22455. case int32(_BT_MINUS):
  22456. ptr += uintptr(2)
  22457. default:
  22458. return int32(int64(ptr) - int64(start))
  22459. }
  22460. goto _1
  22461. _1:
  22462. }
  22463. return r
  22464. }
  22465. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22466. var v2 int32
  22467. _ = v2
  22468. for {
  22469. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22470. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22471. } else {
  22472. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22473. }
  22474. switch v2 {
  22475. case int32(_BT_LF):
  22476. fallthrough
  22477. case int32(_BT_CR):
  22478. fallthrough
  22479. case int32(_BT_S):
  22480. ptr += uintptr(2)
  22481. default:
  22482. return ptr
  22483. }
  22484. goto _1
  22485. _1:
  22486. }
  22487. return r
  22488. }
  22489. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22490. var v1, v2 int32
  22491. var v3 bool
  22492. _, _, _ = v1, v2, v3
  22493. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22494. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22495. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22496. } else {
  22497. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22498. }
  22499. switch v1 {
  22500. case int32(_BT_LEAD2):
  22501. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22502. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22503. case int32(_BT_LEAD3):
  22504. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22505. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22506. case int32(_BT_LEAD4):
  22507. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22508. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22509. case int32(_BT_LF):
  22510. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22511. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22512. ptr += uintptr(2)
  22513. case int32(_BT_CR):
  22514. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22515. ptr += uintptr(2)
  22516. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  22517. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22518. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22519. } else {
  22520. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22521. }
  22522. }
  22523. if v3 && v2 == int32(_BT_LF) {
  22524. ptr += uintptr(2)
  22525. }
  22526. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22527. default:
  22528. ptr += uintptr(2)
  22529. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22530. break
  22531. }
  22532. }
  22533. }
  22534. var _little2_encoding_ns = Tnormal_encoding{
  22535. Fenc: TENCODING{
  22536. Fscanners: [4]TSCANNER{},
  22537. FliteralScanners: [2]TSCANNER{},
  22538. FminBytesPerChar: int32(2),
  22539. FisUtf16: int8(1),
  22540. },
  22541. Ftype1: [256]uint8{
  22542. 9: uint8(_BT_S),
  22543. 10: uint8(_BT_LF),
  22544. 13: uint8(_BT_CR),
  22545. 32: uint8(_BT_S),
  22546. 33: uint8(_BT_EXCL),
  22547. 34: uint8(_BT_QUOT),
  22548. 35: uint8(_BT_NUM),
  22549. 36: uint8(_BT_OTHER),
  22550. 37: uint8(_BT_PERCNT),
  22551. 38: uint8(_BT_AMP),
  22552. 39: uint8(_BT_APOS),
  22553. 40: uint8(_BT_LPAR),
  22554. 41: uint8(_BT_RPAR),
  22555. 42: uint8(_BT_AST),
  22556. 43: uint8(_BT_PLUS),
  22557. 44: uint8(_BT_COMMA),
  22558. 45: uint8(_BT_MINUS),
  22559. 46: uint8(_BT_NAME),
  22560. 47: uint8(_BT_SOL),
  22561. 48: uint8(_BT_DIGIT),
  22562. 49: uint8(_BT_DIGIT),
  22563. 50: uint8(_BT_DIGIT),
  22564. 51: uint8(_BT_DIGIT),
  22565. 52: uint8(_BT_DIGIT),
  22566. 53: uint8(_BT_DIGIT),
  22567. 54: uint8(_BT_DIGIT),
  22568. 55: uint8(_BT_DIGIT),
  22569. 56: uint8(_BT_DIGIT),
  22570. 57: uint8(_BT_DIGIT),
  22571. 58: uint8(_BT_COLON),
  22572. 59: uint8(_BT_SEMI),
  22573. 60: uint8(_BT_LT),
  22574. 61: uint8(_BT_EQUALS),
  22575. 62: uint8(_BT_GT),
  22576. 63: uint8(_BT_QUEST),
  22577. 64: uint8(_BT_OTHER),
  22578. 65: uint8(_BT_HEX),
  22579. 66: uint8(_BT_HEX),
  22580. 67: uint8(_BT_HEX),
  22581. 68: uint8(_BT_HEX),
  22582. 69: uint8(_BT_HEX),
  22583. 70: uint8(_BT_HEX),
  22584. 71: uint8(_BT_NMSTRT),
  22585. 72: uint8(_BT_NMSTRT),
  22586. 73: uint8(_BT_NMSTRT),
  22587. 74: uint8(_BT_NMSTRT),
  22588. 75: uint8(_BT_NMSTRT),
  22589. 76: uint8(_BT_NMSTRT),
  22590. 77: uint8(_BT_NMSTRT),
  22591. 78: uint8(_BT_NMSTRT),
  22592. 79: uint8(_BT_NMSTRT),
  22593. 80: uint8(_BT_NMSTRT),
  22594. 81: uint8(_BT_NMSTRT),
  22595. 82: uint8(_BT_NMSTRT),
  22596. 83: uint8(_BT_NMSTRT),
  22597. 84: uint8(_BT_NMSTRT),
  22598. 85: uint8(_BT_NMSTRT),
  22599. 86: uint8(_BT_NMSTRT),
  22600. 87: uint8(_BT_NMSTRT),
  22601. 88: uint8(_BT_NMSTRT),
  22602. 89: uint8(_BT_NMSTRT),
  22603. 90: uint8(_BT_NMSTRT),
  22604. 91: uint8(_BT_LSQB),
  22605. 92: uint8(_BT_OTHER),
  22606. 93: uint8(_BT_RSQB),
  22607. 94: uint8(_BT_OTHER),
  22608. 95: uint8(_BT_NMSTRT),
  22609. 96: uint8(_BT_OTHER),
  22610. 97: uint8(_BT_HEX),
  22611. 98: uint8(_BT_HEX),
  22612. 99: uint8(_BT_HEX),
  22613. 100: uint8(_BT_HEX),
  22614. 101: uint8(_BT_HEX),
  22615. 102: uint8(_BT_HEX),
  22616. 103: uint8(_BT_NMSTRT),
  22617. 104: uint8(_BT_NMSTRT),
  22618. 105: uint8(_BT_NMSTRT),
  22619. 106: uint8(_BT_NMSTRT),
  22620. 107: uint8(_BT_NMSTRT),
  22621. 108: uint8(_BT_NMSTRT),
  22622. 109: uint8(_BT_NMSTRT),
  22623. 110: uint8(_BT_NMSTRT),
  22624. 111: uint8(_BT_NMSTRT),
  22625. 112: uint8(_BT_NMSTRT),
  22626. 113: uint8(_BT_NMSTRT),
  22627. 114: uint8(_BT_NMSTRT),
  22628. 115: uint8(_BT_NMSTRT),
  22629. 116: uint8(_BT_NMSTRT),
  22630. 117: uint8(_BT_NMSTRT),
  22631. 118: uint8(_BT_NMSTRT),
  22632. 119: uint8(_BT_NMSTRT),
  22633. 120: uint8(_BT_NMSTRT),
  22634. 121: uint8(_BT_NMSTRT),
  22635. 122: uint8(_BT_NMSTRT),
  22636. 123: uint8(_BT_OTHER),
  22637. 124: uint8(_BT_VERBAR),
  22638. 125: uint8(_BT_OTHER),
  22639. 126: uint8(_BT_OTHER),
  22640. 127: uint8(_BT_OTHER),
  22641. 128: uint8(_BT_OTHER),
  22642. 129: uint8(_BT_OTHER),
  22643. 130: uint8(_BT_OTHER),
  22644. 131: uint8(_BT_OTHER),
  22645. 132: uint8(_BT_OTHER),
  22646. 133: uint8(_BT_OTHER),
  22647. 134: uint8(_BT_OTHER),
  22648. 135: uint8(_BT_OTHER),
  22649. 136: uint8(_BT_OTHER),
  22650. 137: uint8(_BT_OTHER),
  22651. 138: uint8(_BT_OTHER),
  22652. 139: uint8(_BT_OTHER),
  22653. 140: uint8(_BT_OTHER),
  22654. 141: uint8(_BT_OTHER),
  22655. 142: uint8(_BT_OTHER),
  22656. 143: uint8(_BT_OTHER),
  22657. 144: uint8(_BT_OTHER),
  22658. 145: uint8(_BT_OTHER),
  22659. 146: uint8(_BT_OTHER),
  22660. 147: uint8(_BT_OTHER),
  22661. 148: uint8(_BT_OTHER),
  22662. 149: uint8(_BT_OTHER),
  22663. 150: uint8(_BT_OTHER),
  22664. 151: uint8(_BT_OTHER),
  22665. 152: uint8(_BT_OTHER),
  22666. 153: uint8(_BT_OTHER),
  22667. 154: uint8(_BT_OTHER),
  22668. 155: uint8(_BT_OTHER),
  22669. 156: uint8(_BT_OTHER),
  22670. 157: uint8(_BT_OTHER),
  22671. 158: uint8(_BT_OTHER),
  22672. 159: uint8(_BT_OTHER),
  22673. 160: uint8(_BT_OTHER),
  22674. 161: uint8(_BT_OTHER),
  22675. 162: uint8(_BT_OTHER),
  22676. 163: uint8(_BT_OTHER),
  22677. 164: uint8(_BT_OTHER),
  22678. 165: uint8(_BT_OTHER),
  22679. 166: uint8(_BT_OTHER),
  22680. 167: uint8(_BT_OTHER),
  22681. 168: uint8(_BT_OTHER),
  22682. 169: uint8(_BT_OTHER),
  22683. 170: uint8(_BT_NMSTRT),
  22684. 171: uint8(_BT_OTHER),
  22685. 172: uint8(_BT_OTHER),
  22686. 173: uint8(_BT_OTHER),
  22687. 174: uint8(_BT_OTHER),
  22688. 175: uint8(_BT_OTHER),
  22689. 176: uint8(_BT_OTHER),
  22690. 177: uint8(_BT_OTHER),
  22691. 178: uint8(_BT_OTHER),
  22692. 179: uint8(_BT_OTHER),
  22693. 180: uint8(_BT_OTHER),
  22694. 181: uint8(_BT_NMSTRT),
  22695. 182: uint8(_BT_OTHER),
  22696. 183: uint8(_BT_NAME),
  22697. 184: uint8(_BT_OTHER),
  22698. 185: uint8(_BT_OTHER),
  22699. 186: uint8(_BT_NMSTRT),
  22700. 187: uint8(_BT_OTHER),
  22701. 188: uint8(_BT_OTHER),
  22702. 189: uint8(_BT_OTHER),
  22703. 190: uint8(_BT_OTHER),
  22704. 191: uint8(_BT_OTHER),
  22705. 192: uint8(_BT_NMSTRT),
  22706. 193: uint8(_BT_NMSTRT),
  22707. 194: uint8(_BT_NMSTRT),
  22708. 195: uint8(_BT_NMSTRT),
  22709. 196: uint8(_BT_NMSTRT),
  22710. 197: uint8(_BT_NMSTRT),
  22711. 198: uint8(_BT_NMSTRT),
  22712. 199: uint8(_BT_NMSTRT),
  22713. 200: uint8(_BT_NMSTRT),
  22714. 201: uint8(_BT_NMSTRT),
  22715. 202: uint8(_BT_NMSTRT),
  22716. 203: uint8(_BT_NMSTRT),
  22717. 204: uint8(_BT_NMSTRT),
  22718. 205: uint8(_BT_NMSTRT),
  22719. 206: uint8(_BT_NMSTRT),
  22720. 207: uint8(_BT_NMSTRT),
  22721. 208: uint8(_BT_NMSTRT),
  22722. 209: uint8(_BT_NMSTRT),
  22723. 210: uint8(_BT_NMSTRT),
  22724. 211: uint8(_BT_NMSTRT),
  22725. 212: uint8(_BT_NMSTRT),
  22726. 213: uint8(_BT_NMSTRT),
  22727. 214: uint8(_BT_NMSTRT),
  22728. 215: uint8(_BT_OTHER),
  22729. 216: uint8(_BT_NMSTRT),
  22730. 217: uint8(_BT_NMSTRT),
  22731. 218: uint8(_BT_NMSTRT),
  22732. 219: uint8(_BT_NMSTRT),
  22733. 220: uint8(_BT_NMSTRT),
  22734. 221: uint8(_BT_NMSTRT),
  22735. 222: uint8(_BT_NMSTRT),
  22736. 223: uint8(_BT_NMSTRT),
  22737. 224: uint8(_BT_NMSTRT),
  22738. 225: uint8(_BT_NMSTRT),
  22739. 226: uint8(_BT_NMSTRT),
  22740. 227: uint8(_BT_NMSTRT),
  22741. 228: uint8(_BT_NMSTRT),
  22742. 229: uint8(_BT_NMSTRT),
  22743. 230: uint8(_BT_NMSTRT),
  22744. 231: uint8(_BT_NMSTRT),
  22745. 232: uint8(_BT_NMSTRT),
  22746. 233: uint8(_BT_NMSTRT),
  22747. 234: uint8(_BT_NMSTRT),
  22748. 235: uint8(_BT_NMSTRT),
  22749. 236: uint8(_BT_NMSTRT),
  22750. 237: uint8(_BT_NMSTRT),
  22751. 238: uint8(_BT_NMSTRT),
  22752. 239: uint8(_BT_NMSTRT),
  22753. 240: uint8(_BT_NMSTRT),
  22754. 241: uint8(_BT_NMSTRT),
  22755. 242: uint8(_BT_NMSTRT),
  22756. 243: uint8(_BT_NMSTRT),
  22757. 244: uint8(_BT_NMSTRT),
  22758. 245: uint8(_BT_NMSTRT),
  22759. 246: uint8(_BT_NMSTRT),
  22760. 247: uint8(_BT_OTHER),
  22761. 248: uint8(_BT_NMSTRT),
  22762. 249: uint8(_BT_NMSTRT),
  22763. 250: uint8(_BT_NMSTRT),
  22764. 251: uint8(_BT_NMSTRT),
  22765. 252: uint8(_BT_NMSTRT),
  22766. 253: uint8(_BT_NMSTRT),
  22767. 254: uint8(_BT_NMSTRT),
  22768. 255: uint8(_BT_NMSTRT),
  22769. },
  22770. }
  22771. func init() {
  22772. p := unsafe.Pointer(&_little2_encoding_ns)
  22773. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22774. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22775. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22776. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22777. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22778. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22779. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22780. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22781. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22782. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22783. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22784. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22785. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22786. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22787. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22788. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22789. }
  22790. var _little2_encoding = Tnormal_encoding{
  22791. Fenc: TENCODING{
  22792. Fscanners: [4]TSCANNER{},
  22793. FliteralScanners: [2]TSCANNER{},
  22794. FminBytesPerChar: int32(2),
  22795. FisUtf16: int8(1),
  22796. },
  22797. Ftype1: [256]uint8{
  22798. 9: uint8(_BT_S),
  22799. 10: uint8(_BT_LF),
  22800. 13: uint8(_BT_CR),
  22801. 32: uint8(_BT_S),
  22802. 33: uint8(_BT_EXCL),
  22803. 34: uint8(_BT_QUOT),
  22804. 35: uint8(_BT_NUM),
  22805. 36: uint8(_BT_OTHER),
  22806. 37: uint8(_BT_PERCNT),
  22807. 38: uint8(_BT_AMP),
  22808. 39: uint8(_BT_APOS),
  22809. 40: uint8(_BT_LPAR),
  22810. 41: uint8(_BT_RPAR),
  22811. 42: uint8(_BT_AST),
  22812. 43: uint8(_BT_PLUS),
  22813. 44: uint8(_BT_COMMA),
  22814. 45: uint8(_BT_MINUS),
  22815. 46: uint8(_BT_NAME),
  22816. 47: uint8(_BT_SOL),
  22817. 48: uint8(_BT_DIGIT),
  22818. 49: uint8(_BT_DIGIT),
  22819. 50: uint8(_BT_DIGIT),
  22820. 51: uint8(_BT_DIGIT),
  22821. 52: uint8(_BT_DIGIT),
  22822. 53: uint8(_BT_DIGIT),
  22823. 54: uint8(_BT_DIGIT),
  22824. 55: uint8(_BT_DIGIT),
  22825. 56: uint8(_BT_DIGIT),
  22826. 57: uint8(_BT_DIGIT),
  22827. 58: uint8(_BT_NMSTRT),
  22828. 59: uint8(_BT_SEMI),
  22829. 60: uint8(_BT_LT),
  22830. 61: uint8(_BT_EQUALS),
  22831. 62: uint8(_BT_GT),
  22832. 63: uint8(_BT_QUEST),
  22833. 64: uint8(_BT_OTHER),
  22834. 65: uint8(_BT_HEX),
  22835. 66: uint8(_BT_HEX),
  22836. 67: uint8(_BT_HEX),
  22837. 68: uint8(_BT_HEX),
  22838. 69: uint8(_BT_HEX),
  22839. 70: uint8(_BT_HEX),
  22840. 71: uint8(_BT_NMSTRT),
  22841. 72: uint8(_BT_NMSTRT),
  22842. 73: uint8(_BT_NMSTRT),
  22843. 74: uint8(_BT_NMSTRT),
  22844. 75: uint8(_BT_NMSTRT),
  22845. 76: uint8(_BT_NMSTRT),
  22846. 77: uint8(_BT_NMSTRT),
  22847. 78: uint8(_BT_NMSTRT),
  22848. 79: uint8(_BT_NMSTRT),
  22849. 80: uint8(_BT_NMSTRT),
  22850. 81: uint8(_BT_NMSTRT),
  22851. 82: uint8(_BT_NMSTRT),
  22852. 83: uint8(_BT_NMSTRT),
  22853. 84: uint8(_BT_NMSTRT),
  22854. 85: uint8(_BT_NMSTRT),
  22855. 86: uint8(_BT_NMSTRT),
  22856. 87: uint8(_BT_NMSTRT),
  22857. 88: uint8(_BT_NMSTRT),
  22858. 89: uint8(_BT_NMSTRT),
  22859. 90: uint8(_BT_NMSTRT),
  22860. 91: uint8(_BT_LSQB),
  22861. 92: uint8(_BT_OTHER),
  22862. 93: uint8(_BT_RSQB),
  22863. 94: uint8(_BT_OTHER),
  22864. 95: uint8(_BT_NMSTRT),
  22865. 96: uint8(_BT_OTHER),
  22866. 97: uint8(_BT_HEX),
  22867. 98: uint8(_BT_HEX),
  22868. 99: uint8(_BT_HEX),
  22869. 100: uint8(_BT_HEX),
  22870. 101: uint8(_BT_HEX),
  22871. 102: uint8(_BT_HEX),
  22872. 103: uint8(_BT_NMSTRT),
  22873. 104: uint8(_BT_NMSTRT),
  22874. 105: uint8(_BT_NMSTRT),
  22875. 106: uint8(_BT_NMSTRT),
  22876. 107: uint8(_BT_NMSTRT),
  22877. 108: uint8(_BT_NMSTRT),
  22878. 109: uint8(_BT_NMSTRT),
  22879. 110: uint8(_BT_NMSTRT),
  22880. 111: uint8(_BT_NMSTRT),
  22881. 112: uint8(_BT_NMSTRT),
  22882. 113: uint8(_BT_NMSTRT),
  22883. 114: uint8(_BT_NMSTRT),
  22884. 115: uint8(_BT_NMSTRT),
  22885. 116: uint8(_BT_NMSTRT),
  22886. 117: uint8(_BT_NMSTRT),
  22887. 118: uint8(_BT_NMSTRT),
  22888. 119: uint8(_BT_NMSTRT),
  22889. 120: uint8(_BT_NMSTRT),
  22890. 121: uint8(_BT_NMSTRT),
  22891. 122: uint8(_BT_NMSTRT),
  22892. 123: uint8(_BT_OTHER),
  22893. 124: uint8(_BT_VERBAR),
  22894. 125: uint8(_BT_OTHER),
  22895. 126: uint8(_BT_OTHER),
  22896. 127: uint8(_BT_OTHER),
  22897. 128: uint8(_BT_OTHER),
  22898. 129: uint8(_BT_OTHER),
  22899. 130: uint8(_BT_OTHER),
  22900. 131: uint8(_BT_OTHER),
  22901. 132: uint8(_BT_OTHER),
  22902. 133: uint8(_BT_OTHER),
  22903. 134: uint8(_BT_OTHER),
  22904. 135: uint8(_BT_OTHER),
  22905. 136: uint8(_BT_OTHER),
  22906. 137: uint8(_BT_OTHER),
  22907. 138: uint8(_BT_OTHER),
  22908. 139: uint8(_BT_OTHER),
  22909. 140: uint8(_BT_OTHER),
  22910. 141: uint8(_BT_OTHER),
  22911. 142: uint8(_BT_OTHER),
  22912. 143: uint8(_BT_OTHER),
  22913. 144: uint8(_BT_OTHER),
  22914. 145: uint8(_BT_OTHER),
  22915. 146: uint8(_BT_OTHER),
  22916. 147: uint8(_BT_OTHER),
  22917. 148: uint8(_BT_OTHER),
  22918. 149: uint8(_BT_OTHER),
  22919. 150: uint8(_BT_OTHER),
  22920. 151: uint8(_BT_OTHER),
  22921. 152: uint8(_BT_OTHER),
  22922. 153: uint8(_BT_OTHER),
  22923. 154: uint8(_BT_OTHER),
  22924. 155: uint8(_BT_OTHER),
  22925. 156: uint8(_BT_OTHER),
  22926. 157: uint8(_BT_OTHER),
  22927. 158: uint8(_BT_OTHER),
  22928. 159: uint8(_BT_OTHER),
  22929. 160: uint8(_BT_OTHER),
  22930. 161: uint8(_BT_OTHER),
  22931. 162: uint8(_BT_OTHER),
  22932. 163: uint8(_BT_OTHER),
  22933. 164: uint8(_BT_OTHER),
  22934. 165: uint8(_BT_OTHER),
  22935. 166: uint8(_BT_OTHER),
  22936. 167: uint8(_BT_OTHER),
  22937. 168: uint8(_BT_OTHER),
  22938. 169: uint8(_BT_OTHER),
  22939. 170: uint8(_BT_NMSTRT),
  22940. 171: uint8(_BT_OTHER),
  22941. 172: uint8(_BT_OTHER),
  22942. 173: uint8(_BT_OTHER),
  22943. 174: uint8(_BT_OTHER),
  22944. 175: uint8(_BT_OTHER),
  22945. 176: uint8(_BT_OTHER),
  22946. 177: uint8(_BT_OTHER),
  22947. 178: uint8(_BT_OTHER),
  22948. 179: uint8(_BT_OTHER),
  22949. 180: uint8(_BT_OTHER),
  22950. 181: uint8(_BT_NMSTRT),
  22951. 182: uint8(_BT_OTHER),
  22952. 183: uint8(_BT_NAME),
  22953. 184: uint8(_BT_OTHER),
  22954. 185: uint8(_BT_OTHER),
  22955. 186: uint8(_BT_NMSTRT),
  22956. 187: uint8(_BT_OTHER),
  22957. 188: uint8(_BT_OTHER),
  22958. 189: uint8(_BT_OTHER),
  22959. 190: uint8(_BT_OTHER),
  22960. 191: uint8(_BT_OTHER),
  22961. 192: uint8(_BT_NMSTRT),
  22962. 193: uint8(_BT_NMSTRT),
  22963. 194: uint8(_BT_NMSTRT),
  22964. 195: uint8(_BT_NMSTRT),
  22965. 196: uint8(_BT_NMSTRT),
  22966. 197: uint8(_BT_NMSTRT),
  22967. 198: uint8(_BT_NMSTRT),
  22968. 199: uint8(_BT_NMSTRT),
  22969. 200: uint8(_BT_NMSTRT),
  22970. 201: uint8(_BT_NMSTRT),
  22971. 202: uint8(_BT_NMSTRT),
  22972. 203: uint8(_BT_NMSTRT),
  22973. 204: uint8(_BT_NMSTRT),
  22974. 205: uint8(_BT_NMSTRT),
  22975. 206: uint8(_BT_NMSTRT),
  22976. 207: uint8(_BT_NMSTRT),
  22977. 208: uint8(_BT_NMSTRT),
  22978. 209: uint8(_BT_NMSTRT),
  22979. 210: uint8(_BT_NMSTRT),
  22980. 211: uint8(_BT_NMSTRT),
  22981. 212: uint8(_BT_NMSTRT),
  22982. 213: uint8(_BT_NMSTRT),
  22983. 214: uint8(_BT_NMSTRT),
  22984. 215: uint8(_BT_OTHER),
  22985. 216: uint8(_BT_NMSTRT),
  22986. 217: uint8(_BT_NMSTRT),
  22987. 218: uint8(_BT_NMSTRT),
  22988. 219: uint8(_BT_NMSTRT),
  22989. 220: uint8(_BT_NMSTRT),
  22990. 221: uint8(_BT_NMSTRT),
  22991. 222: uint8(_BT_NMSTRT),
  22992. 223: uint8(_BT_NMSTRT),
  22993. 224: uint8(_BT_NMSTRT),
  22994. 225: uint8(_BT_NMSTRT),
  22995. 226: uint8(_BT_NMSTRT),
  22996. 227: uint8(_BT_NMSTRT),
  22997. 228: uint8(_BT_NMSTRT),
  22998. 229: uint8(_BT_NMSTRT),
  22999. 230: uint8(_BT_NMSTRT),
  23000. 231: uint8(_BT_NMSTRT),
  23001. 232: uint8(_BT_NMSTRT),
  23002. 233: uint8(_BT_NMSTRT),
  23003. 234: uint8(_BT_NMSTRT),
  23004. 235: uint8(_BT_NMSTRT),
  23005. 236: uint8(_BT_NMSTRT),
  23006. 237: uint8(_BT_NMSTRT),
  23007. 238: uint8(_BT_NMSTRT),
  23008. 239: uint8(_BT_NMSTRT),
  23009. 240: uint8(_BT_NMSTRT),
  23010. 241: uint8(_BT_NMSTRT),
  23011. 242: uint8(_BT_NMSTRT),
  23012. 243: uint8(_BT_NMSTRT),
  23013. 244: uint8(_BT_NMSTRT),
  23014. 245: uint8(_BT_NMSTRT),
  23015. 246: uint8(_BT_NMSTRT),
  23016. 247: uint8(_BT_OTHER),
  23017. 248: uint8(_BT_NMSTRT),
  23018. 249: uint8(_BT_NMSTRT),
  23019. 250: uint8(_BT_NMSTRT),
  23020. 251: uint8(_BT_NMSTRT),
  23021. 252: uint8(_BT_NMSTRT),
  23022. 253: uint8(_BT_NMSTRT),
  23023. 254: uint8(_BT_NMSTRT),
  23024. 255: uint8(_BT_NMSTRT),
  23025. },
  23026. }
  23027. func init() {
  23028. p := unsafe.Pointer(&_little2_encoding)
  23029. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23030. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23031. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23032. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23033. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23034. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23035. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23036. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23037. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23038. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23039. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23040. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23041. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23042. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23043. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23044. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23045. }
  23046. var _internal_little2_encoding_ns = Tnormal_encoding{
  23047. Fenc: TENCODING{
  23048. Fscanners: [4]TSCANNER{},
  23049. FliteralScanners: [2]TSCANNER{},
  23050. FminBytesPerChar: int32(2),
  23051. FisUtf16: int8(1),
  23052. },
  23053. Ftype1: [256]uint8{
  23054. 9: uint8(_BT_S),
  23055. 10: uint8(_BT_LF),
  23056. 13: uint8(_BT_S),
  23057. 32: uint8(_BT_S),
  23058. 33: uint8(_BT_EXCL),
  23059. 34: uint8(_BT_QUOT),
  23060. 35: uint8(_BT_NUM),
  23061. 36: uint8(_BT_OTHER),
  23062. 37: uint8(_BT_PERCNT),
  23063. 38: uint8(_BT_AMP),
  23064. 39: uint8(_BT_APOS),
  23065. 40: uint8(_BT_LPAR),
  23066. 41: uint8(_BT_RPAR),
  23067. 42: uint8(_BT_AST),
  23068. 43: uint8(_BT_PLUS),
  23069. 44: uint8(_BT_COMMA),
  23070. 45: uint8(_BT_MINUS),
  23071. 46: uint8(_BT_NAME),
  23072. 47: uint8(_BT_SOL),
  23073. 48: uint8(_BT_DIGIT),
  23074. 49: uint8(_BT_DIGIT),
  23075. 50: uint8(_BT_DIGIT),
  23076. 51: uint8(_BT_DIGIT),
  23077. 52: uint8(_BT_DIGIT),
  23078. 53: uint8(_BT_DIGIT),
  23079. 54: uint8(_BT_DIGIT),
  23080. 55: uint8(_BT_DIGIT),
  23081. 56: uint8(_BT_DIGIT),
  23082. 57: uint8(_BT_DIGIT),
  23083. 58: uint8(_BT_COLON),
  23084. 59: uint8(_BT_SEMI),
  23085. 60: uint8(_BT_LT),
  23086. 61: uint8(_BT_EQUALS),
  23087. 62: uint8(_BT_GT),
  23088. 63: uint8(_BT_QUEST),
  23089. 64: uint8(_BT_OTHER),
  23090. 65: uint8(_BT_HEX),
  23091. 66: uint8(_BT_HEX),
  23092. 67: uint8(_BT_HEX),
  23093. 68: uint8(_BT_HEX),
  23094. 69: uint8(_BT_HEX),
  23095. 70: uint8(_BT_HEX),
  23096. 71: uint8(_BT_NMSTRT),
  23097. 72: uint8(_BT_NMSTRT),
  23098. 73: uint8(_BT_NMSTRT),
  23099. 74: uint8(_BT_NMSTRT),
  23100. 75: uint8(_BT_NMSTRT),
  23101. 76: uint8(_BT_NMSTRT),
  23102. 77: uint8(_BT_NMSTRT),
  23103. 78: uint8(_BT_NMSTRT),
  23104. 79: uint8(_BT_NMSTRT),
  23105. 80: uint8(_BT_NMSTRT),
  23106. 81: uint8(_BT_NMSTRT),
  23107. 82: uint8(_BT_NMSTRT),
  23108. 83: uint8(_BT_NMSTRT),
  23109. 84: uint8(_BT_NMSTRT),
  23110. 85: uint8(_BT_NMSTRT),
  23111. 86: uint8(_BT_NMSTRT),
  23112. 87: uint8(_BT_NMSTRT),
  23113. 88: uint8(_BT_NMSTRT),
  23114. 89: uint8(_BT_NMSTRT),
  23115. 90: uint8(_BT_NMSTRT),
  23116. 91: uint8(_BT_LSQB),
  23117. 92: uint8(_BT_OTHER),
  23118. 93: uint8(_BT_RSQB),
  23119. 94: uint8(_BT_OTHER),
  23120. 95: uint8(_BT_NMSTRT),
  23121. 96: uint8(_BT_OTHER),
  23122. 97: uint8(_BT_HEX),
  23123. 98: uint8(_BT_HEX),
  23124. 99: uint8(_BT_HEX),
  23125. 100: uint8(_BT_HEX),
  23126. 101: uint8(_BT_HEX),
  23127. 102: uint8(_BT_HEX),
  23128. 103: uint8(_BT_NMSTRT),
  23129. 104: uint8(_BT_NMSTRT),
  23130. 105: uint8(_BT_NMSTRT),
  23131. 106: uint8(_BT_NMSTRT),
  23132. 107: uint8(_BT_NMSTRT),
  23133. 108: uint8(_BT_NMSTRT),
  23134. 109: uint8(_BT_NMSTRT),
  23135. 110: uint8(_BT_NMSTRT),
  23136. 111: uint8(_BT_NMSTRT),
  23137. 112: uint8(_BT_NMSTRT),
  23138. 113: uint8(_BT_NMSTRT),
  23139. 114: uint8(_BT_NMSTRT),
  23140. 115: uint8(_BT_NMSTRT),
  23141. 116: uint8(_BT_NMSTRT),
  23142. 117: uint8(_BT_NMSTRT),
  23143. 118: uint8(_BT_NMSTRT),
  23144. 119: uint8(_BT_NMSTRT),
  23145. 120: uint8(_BT_NMSTRT),
  23146. 121: uint8(_BT_NMSTRT),
  23147. 122: uint8(_BT_NMSTRT),
  23148. 123: uint8(_BT_OTHER),
  23149. 124: uint8(_BT_VERBAR),
  23150. 125: uint8(_BT_OTHER),
  23151. 126: uint8(_BT_OTHER),
  23152. 127: uint8(_BT_OTHER),
  23153. 128: uint8(_BT_OTHER),
  23154. 129: uint8(_BT_OTHER),
  23155. 130: uint8(_BT_OTHER),
  23156. 131: uint8(_BT_OTHER),
  23157. 132: uint8(_BT_OTHER),
  23158. 133: uint8(_BT_OTHER),
  23159. 134: uint8(_BT_OTHER),
  23160. 135: uint8(_BT_OTHER),
  23161. 136: uint8(_BT_OTHER),
  23162. 137: uint8(_BT_OTHER),
  23163. 138: uint8(_BT_OTHER),
  23164. 139: uint8(_BT_OTHER),
  23165. 140: uint8(_BT_OTHER),
  23166. 141: uint8(_BT_OTHER),
  23167. 142: uint8(_BT_OTHER),
  23168. 143: uint8(_BT_OTHER),
  23169. 144: uint8(_BT_OTHER),
  23170. 145: uint8(_BT_OTHER),
  23171. 146: uint8(_BT_OTHER),
  23172. 147: uint8(_BT_OTHER),
  23173. 148: uint8(_BT_OTHER),
  23174. 149: uint8(_BT_OTHER),
  23175. 150: uint8(_BT_OTHER),
  23176. 151: uint8(_BT_OTHER),
  23177. 152: uint8(_BT_OTHER),
  23178. 153: uint8(_BT_OTHER),
  23179. 154: uint8(_BT_OTHER),
  23180. 155: uint8(_BT_OTHER),
  23181. 156: uint8(_BT_OTHER),
  23182. 157: uint8(_BT_OTHER),
  23183. 158: uint8(_BT_OTHER),
  23184. 159: uint8(_BT_OTHER),
  23185. 160: uint8(_BT_OTHER),
  23186. 161: uint8(_BT_OTHER),
  23187. 162: uint8(_BT_OTHER),
  23188. 163: uint8(_BT_OTHER),
  23189. 164: uint8(_BT_OTHER),
  23190. 165: uint8(_BT_OTHER),
  23191. 166: uint8(_BT_OTHER),
  23192. 167: uint8(_BT_OTHER),
  23193. 168: uint8(_BT_OTHER),
  23194. 169: uint8(_BT_OTHER),
  23195. 170: uint8(_BT_NMSTRT),
  23196. 171: uint8(_BT_OTHER),
  23197. 172: uint8(_BT_OTHER),
  23198. 173: uint8(_BT_OTHER),
  23199. 174: uint8(_BT_OTHER),
  23200. 175: uint8(_BT_OTHER),
  23201. 176: uint8(_BT_OTHER),
  23202. 177: uint8(_BT_OTHER),
  23203. 178: uint8(_BT_OTHER),
  23204. 179: uint8(_BT_OTHER),
  23205. 180: uint8(_BT_OTHER),
  23206. 181: uint8(_BT_NMSTRT),
  23207. 182: uint8(_BT_OTHER),
  23208. 183: uint8(_BT_NAME),
  23209. 184: uint8(_BT_OTHER),
  23210. 185: uint8(_BT_OTHER),
  23211. 186: uint8(_BT_NMSTRT),
  23212. 187: uint8(_BT_OTHER),
  23213. 188: uint8(_BT_OTHER),
  23214. 189: uint8(_BT_OTHER),
  23215. 190: uint8(_BT_OTHER),
  23216. 191: uint8(_BT_OTHER),
  23217. 192: uint8(_BT_NMSTRT),
  23218. 193: uint8(_BT_NMSTRT),
  23219. 194: uint8(_BT_NMSTRT),
  23220. 195: uint8(_BT_NMSTRT),
  23221. 196: uint8(_BT_NMSTRT),
  23222. 197: uint8(_BT_NMSTRT),
  23223. 198: uint8(_BT_NMSTRT),
  23224. 199: uint8(_BT_NMSTRT),
  23225. 200: uint8(_BT_NMSTRT),
  23226. 201: uint8(_BT_NMSTRT),
  23227. 202: uint8(_BT_NMSTRT),
  23228. 203: uint8(_BT_NMSTRT),
  23229. 204: uint8(_BT_NMSTRT),
  23230. 205: uint8(_BT_NMSTRT),
  23231. 206: uint8(_BT_NMSTRT),
  23232. 207: uint8(_BT_NMSTRT),
  23233. 208: uint8(_BT_NMSTRT),
  23234. 209: uint8(_BT_NMSTRT),
  23235. 210: uint8(_BT_NMSTRT),
  23236. 211: uint8(_BT_NMSTRT),
  23237. 212: uint8(_BT_NMSTRT),
  23238. 213: uint8(_BT_NMSTRT),
  23239. 214: uint8(_BT_NMSTRT),
  23240. 215: uint8(_BT_OTHER),
  23241. 216: uint8(_BT_NMSTRT),
  23242. 217: uint8(_BT_NMSTRT),
  23243. 218: uint8(_BT_NMSTRT),
  23244. 219: uint8(_BT_NMSTRT),
  23245. 220: uint8(_BT_NMSTRT),
  23246. 221: uint8(_BT_NMSTRT),
  23247. 222: uint8(_BT_NMSTRT),
  23248. 223: uint8(_BT_NMSTRT),
  23249. 224: uint8(_BT_NMSTRT),
  23250. 225: uint8(_BT_NMSTRT),
  23251. 226: uint8(_BT_NMSTRT),
  23252. 227: uint8(_BT_NMSTRT),
  23253. 228: uint8(_BT_NMSTRT),
  23254. 229: uint8(_BT_NMSTRT),
  23255. 230: uint8(_BT_NMSTRT),
  23256. 231: uint8(_BT_NMSTRT),
  23257. 232: uint8(_BT_NMSTRT),
  23258. 233: uint8(_BT_NMSTRT),
  23259. 234: uint8(_BT_NMSTRT),
  23260. 235: uint8(_BT_NMSTRT),
  23261. 236: uint8(_BT_NMSTRT),
  23262. 237: uint8(_BT_NMSTRT),
  23263. 238: uint8(_BT_NMSTRT),
  23264. 239: uint8(_BT_NMSTRT),
  23265. 240: uint8(_BT_NMSTRT),
  23266. 241: uint8(_BT_NMSTRT),
  23267. 242: uint8(_BT_NMSTRT),
  23268. 243: uint8(_BT_NMSTRT),
  23269. 244: uint8(_BT_NMSTRT),
  23270. 245: uint8(_BT_NMSTRT),
  23271. 246: uint8(_BT_NMSTRT),
  23272. 247: uint8(_BT_OTHER),
  23273. 248: uint8(_BT_NMSTRT),
  23274. 249: uint8(_BT_NMSTRT),
  23275. 250: uint8(_BT_NMSTRT),
  23276. 251: uint8(_BT_NMSTRT),
  23277. 252: uint8(_BT_NMSTRT),
  23278. 253: uint8(_BT_NMSTRT),
  23279. 254: uint8(_BT_NMSTRT),
  23280. 255: uint8(_BT_NMSTRT),
  23281. },
  23282. }
  23283. func init() {
  23284. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23285. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23286. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23287. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23288. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23289. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23290. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23291. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23292. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23293. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23294. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23295. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23296. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23297. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23298. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23299. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23300. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23301. }
  23302. var _internal_little2_encoding = Tnormal_encoding{
  23303. Fenc: TENCODING{
  23304. Fscanners: [4]TSCANNER{},
  23305. FliteralScanners: [2]TSCANNER{},
  23306. FminBytesPerChar: int32(2),
  23307. FisUtf16: int8(1),
  23308. },
  23309. Ftype1: [256]uint8{
  23310. 9: uint8(_BT_S),
  23311. 10: uint8(_BT_LF),
  23312. 13: uint8(_BT_S),
  23313. 32: uint8(_BT_S),
  23314. 33: uint8(_BT_EXCL),
  23315. 34: uint8(_BT_QUOT),
  23316. 35: uint8(_BT_NUM),
  23317. 36: uint8(_BT_OTHER),
  23318. 37: uint8(_BT_PERCNT),
  23319. 38: uint8(_BT_AMP),
  23320. 39: uint8(_BT_APOS),
  23321. 40: uint8(_BT_LPAR),
  23322. 41: uint8(_BT_RPAR),
  23323. 42: uint8(_BT_AST),
  23324. 43: uint8(_BT_PLUS),
  23325. 44: uint8(_BT_COMMA),
  23326. 45: uint8(_BT_MINUS),
  23327. 46: uint8(_BT_NAME),
  23328. 47: uint8(_BT_SOL),
  23329. 48: uint8(_BT_DIGIT),
  23330. 49: uint8(_BT_DIGIT),
  23331. 50: uint8(_BT_DIGIT),
  23332. 51: uint8(_BT_DIGIT),
  23333. 52: uint8(_BT_DIGIT),
  23334. 53: uint8(_BT_DIGIT),
  23335. 54: uint8(_BT_DIGIT),
  23336. 55: uint8(_BT_DIGIT),
  23337. 56: uint8(_BT_DIGIT),
  23338. 57: uint8(_BT_DIGIT),
  23339. 58: uint8(_BT_NMSTRT),
  23340. 59: uint8(_BT_SEMI),
  23341. 60: uint8(_BT_LT),
  23342. 61: uint8(_BT_EQUALS),
  23343. 62: uint8(_BT_GT),
  23344. 63: uint8(_BT_QUEST),
  23345. 64: uint8(_BT_OTHER),
  23346. 65: uint8(_BT_HEX),
  23347. 66: uint8(_BT_HEX),
  23348. 67: uint8(_BT_HEX),
  23349. 68: uint8(_BT_HEX),
  23350. 69: uint8(_BT_HEX),
  23351. 70: uint8(_BT_HEX),
  23352. 71: uint8(_BT_NMSTRT),
  23353. 72: uint8(_BT_NMSTRT),
  23354. 73: uint8(_BT_NMSTRT),
  23355. 74: uint8(_BT_NMSTRT),
  23356. 75: uint8(_BT_NMSTRT),
  23357. 76: uint8(_BT_NMSTRT),
  23358. 77: uint8(_BT_NMSTRT),
  23359. 78: uint8(_BT_NMSTRT),
  23360. 79: uint8(_BT_NMSTRT),
  23361. 80: uint8(_BT_NMSTRT),
  23362. 81: uint8(_BT_NMSTRT),
  23363. 82: uint8(_BT_NMSTRT),
  23364. 83: uint8(_BT_NMSTRT),
  23365. 84: uint8(_BT_NMSTRT),
  23366. 85: uint8(_BT_NMSTRT),
  23367. 86: uint8(_BT_NMSTRT),
  23368. 87: uint8(_BT_NMSTRT),
  23369. 88: uint8(_BT_NMSTRT),
  23370. 89: uint8(_BT_NMSTRT),
  23371. 90: uint8(_BT_NMSTRT),
  23372. 91: uint8(_BT_LSQB),
  23373. 92: uint8(_BT_OTHER),
  23374. 93: uint8(_BT_RSQB),
  23375. 94: uint8(_BT_OTHER),
  23376. 95: uint8(_BT_NMSTRT),
  23377. 96: uint8(_BT_OTHER),
  23378. 97: uint8(_BT_HEX),
  23379. 98: uint8(_BT_HEX),
  23380. 99: uint8(_BT_HEX),
  23381. 100: uint8(_BT_HEX),
  23382. 101: uint8(_BT_HEX),
  23383. 102: uint8(_BT_HEX),
  23384. 103: uint8(_BT_NMSTRT),
  23385. 104: uint8(_BT_NMSTRT),
  23386. 105: uint8(_BT_NMSTRT),
  23387. 106: uint8(_BT_NMSTRT),
  23388. 107: uint8(_BT_NMSTRT),
  23389. 108: uint8(_BT_NMSTRT),
  23390. 109: uint8(_BT_NMSTRT),
  23391. 110: uint8(_BT_NMSTRT),
  23392. 111: uint8(_BT_NMSTRT),
  23393. 112: uint8(_BT_NMSTRT),
  23394. 113: uint8(_BT_NMSTRT),
  23395. 114: uint8(_BT_NMSTRT),
  23396. 115: uint8(_BT_NMSTRT),
  23397. 116: uint8(_BT_NMSTRT),
  23398. 117: uint8(_BT_NMSTRT),
  23399. 118: uint8(_BT_NMSTRT),
  23400. 119: uint8(_BT_NMSTRT),
  23401. 120: uint8(_BT_NMSTRT),
  23402. 121: uint8(_BT_NMSTRT),
  23403. 122: uint8(_BT_NMSTRT),
  23404. 123: uint8(_BT_OTHER),
  23405. 124: uint8(_BT_VERBAR),
  23406. 125: uint8(_BT_OTHER),
  23407. 126: uint8(_BT_OTHER),
  23408. 127: uint8(_BT_OTHER),
  23409. 128: uint8(_BT_OTHER),
  23410. 129: uint8(_BT_OTHER),
  23411. 130: uint8(_BT_OTHER),
  23412. 131: uint8(_BT_OTHER),
  23413. 132: uint8(_BT_OTHER),
  23414. 133: uint8(_BT_OTHER),
  23415. 134: uint8(_BT_OTHER),
  23416. 135: uint8(_BT_OTHER),
  23417. 136: uint8(_BT_OTHER),
  23418. 137: uint8(_BT_OTHER),
  23419. 138: uint8(_BT_OTHER),
  23420. 139: uint8(_BT_OTHER),
  23421. 140: uint8(_BT_OTHER),
  23422. 141: uint8(_BT_OTHER),
  23423. 142: uint8(_BT_OTHER),
  23424. 143: uint8(_BT_OTHER),
  23425. 144: uint8(_BT_OTHER),
  23426. 145: uint8(_BT_OTHER),
  23427. 146: uint8(_BT_OTHER),
  23428. 147: uint8(_BT_OTHER),
  23429. 148: uint8(_BT_OTHER),
  23430. 149: uint8(_BT_OTHER),
  23431. 150: uint8(_BT_OTHER),
  23432. 151: uint8(_BT_OTHER),
  23433. 152: uint8(_BT_OTHER),
  23434. 153: uint8(_BT_OTHER),
  23435. 154: uint8(_BT_OTHER),
  23436. 155: uint8(_BT_OTHER),
  23437. 156: uint8(_BT_OTHER),
  23438. 157: uint8(_BT_OTHER),
  23439. 158: uint8(_BT_OTHER),
  23440. 159: uint8(_BT_OTHER),
  23441. 160: uint8(_BT_OTHER),
  23442. 161: uint8(_BT_OTHER),
  23443. 162: uint8(_BT_OTHER),
  23444. 163: uint8(_BT_OTHER),
  23445. 164: uint8(_BT_OTHER),
  23446. 165: uint8(_BT_OTHER),
  23447. 166: uint8(_BT_OTHER),
  23448. 167: uint8(_BT_OTHER),
  23449. 168: uint8(_BT_OTHER),
  23450. 169: uint8(_BT_OTHER),
  23451. 170: uint8(_BT_NMSTRT),
  23452. 171: uint8(_BT_OTHER),
  23453. 172: uint8(_BT_OTHER),
  23454. 173: uint8(_BT_OTHER),
  23455. 174: uint8(_BT_OTHER),
  23456. 175: uint8(_BT_OTHER),
  23457. 176: uint8(_BT_OTHER),
  23458. 177: uint8(_BT_OTHER),
  23459. 178: uint8(_BT_OTHER),
  23460. 179: uint8(_BT_OTHER),
  23461. 180: uint8(_BT_OTHER),
  23462. 181: uint8(_BT_NMSTRT),
  23463. 182: uint8(_BT_OTHER),
  23464. 183: uint8(_BT_NAME),
  23465. 184: uint8(_BT_OTHER),
  23466. 185: uint8(_BT_OTHER),
  23467. 186: uint8(_BT_NMSTRT),
  23468. 187: uint8(_BT_OTHER),
  23469. 188: uint8(_BT_OTHER),
  23470. 189: uint8(_BT_OTHER),
  23471. 190: uint8(_BT_OTHER),
  23472. 191: uint8(_BT_OTHER),
  23473. 192: uint8(_BT_NMSTRT),
  23474. 193: uint8(_BT_NMSTRT),
  23475. 194: uint8(_BT_NMSTRT),
  23476. 195: uint8(_BT_NMSTRT),
  23477. 196: uint8(_BT_NMSTRT),
  23478. 197: uint8(_BT_NMSTRT),
  23479. 198: uint8(_BT_NMSTRT),
  23480. 199: uint8(_BT_NMSTRT),
  23481. 200: uint8(_BT_NMSTRT),
  23482. 201: uint8(_BT_NMSTRT),
  23483. 202: uint8(_BT_NMSTRT),
  23484. 203: uint8(_BT_NMSTRT),
  23485. 204: uint8(_BT_NMSTRT),
  23486. 205: uint8(_BT_NMSTRT),
  23487. 206: uint8(_BT_NMSTRT),
  23488. 207: uint8(_BT_NMSTRT),
  23489. 208: uint8(_BT_NMSTRT),
  23490. 209: uint8(_BT_NMSTRT),
  23491. 210: uint8(_BT_NMSTRT),
  23492. 211: uint8(_BT_NMSTRT),
  23493. 212: uint8(_BT_NMSTRT),
  23494. 213: uint8(_BT_NMSTRT),
  23495. 214: uint8(_BT_NMSTRT),
  23496. 215: uint8(_BT_OTHER),
  23497. 216: uint8(_BT_NMSTRT),
  23498. 217: uint8(_BT_NMSTRT),
  23499. 218: uint8(_BT_NMSTRT),
  23500. 219: uint8(_BT_NMSTRT),
  23501. 220: uint8(_BT_NMSTRT),
  23502. 221: uint8(_BT_NMSTRT),
  23503. 222: uint8(_BT_NMSTRT),
  23504. 223: uint8(_BT_NMSTRT),
  23505. 224: uint8(_BT_NMSTRT),
  23506. 225: uint8(_BT_NMSTRT),
  23507. 226: uint8(_BT_NMSTRT),
  23508. 227: uint8(_BT_NMSTRT),
  23509. 228: uint8(_BT_NMSTRT),
  23510. 229: uint8(_BT_NMSTRT),
  23511. 230: uint8(_BT_NMSTRT),
  23512. 231: uint8(_BT_NMSTRT),
  23513. 232: uint8(_BT_NMSTRT),
  23514. 233: uint8(_BT_NMSTRT),
  23515. 234: uint8(_BT_NMSTRT),
  23516. 235: uint8(_BT_NMSTRT),
  23517. 236: uint8(_BT_NMSTRT),
  23518. 237: uint8(_BT_NMSTRT),
  23519. 238: uint8(_BT_NMSTRT),
  23520. 239: uint8(_BT_NMSTRT),
  23521. 240: uint8(_BT_NMSTRT),
  23522. 241: uint8(_BT_NMSTRT),
  23523. 242: uint8(_BT_NMSTRT),
  23524. 243: uint8(_BT_NMSTRT),
  23525. 244: uint8(_BT_NMSTRT),
  23526. 245: uint8(_BT_NMSTRT),
  23527. 246: uint8(_BT_NMSTRT),
  23528. 247: uint8(_BT_OTHER),
  23529. 248: uint8(_BT_NMSTRT),
  23530. 249: uint8(_BT_NMSTRT),
  23531. 250: uint8(_BT_NMSTRT),
  23532. 251: uint8(_BT_NMSTRT),
  23533. 252: uint8(_BT_NMSTRT),
  23534. 253: uint8(_BT_NMSTRT),
  23535. 254: uint8(_BT_NMSTRT),
  23536. 255: uint8(_BT_NMSTRT),
  23537. },
  23538. }
  23539. func init() {
  23540. p := unsafe.Pointer(&_internal_little2_encoding)
  23541. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23542. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23543. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23544. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23545. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23546. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23547. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23548. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23549. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23550. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23551. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23552. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23553. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23554. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23555. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23556. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23557. }
  23558. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23559. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23560. __ __ _
  23561. ___\ \/ /_ __ __ _| |_
  23562. / _ \\ /| '_ \ / _` | __|
  23563. | __// \| |_) | (_| | |_
  23564. \___/_/\_\ .__/ \__,_|\__|
  23565. |_| XML parser
  23566. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23567. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23568. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23569. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23570. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23571. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23572. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23573. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23574. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23575. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23576. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23577. Licensed under the MIT license:
  23578. Permission is hereby granted, free of charge, to any person obtaining
  23579. a copy of this software and associated documentation files (the
  23580. "Software"), to deal in the Software without restriction, including
  23581. without limitation the rights to use, copy, modify, merge, publish,
  23582. distribute, sublicense, and/or sell copies of the Software, and to permit
  23583. persons to whom the Software is furnished to do so, subject to the
  23584. following conditions:
  23585. The above copyright notice and this permission notice shall be included
  23586. in all copies or substantial portions of the Software.
  23587. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23588. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23589. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23590. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23591. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23592. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23593. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23594. */
  23595. /* ptr points to character following "<!-" */
  23596. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23597. var v1 int32
  23598. _ = v1
  23599. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23600. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23602. return m_XML_TOK_INVALID
  23603. }
  23604. ptr += uintptr(2)
  23605. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23606. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23607. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23608. } else {
  23609. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23610. }
  23611. switch v1 {
  23612. case int32(_BT_LEAD2):
  23613. if int64(end)-int64(ptr) < int64(2) {
  23614. return -int32(2)
  23615. }
  23616. if 0 != 0 {
  23617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23618. return m_XML_TOK_INVALID
  23619. }
  23620. ptr += uintptr(2)
  23621. case int32(_BT_LEAD3):
  23622. if int64(end)-int64(ptr) < int64(3) {
  23623. return -int32(2)
  23624. }
  23625. if 0 != 0 {
  23626. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23627. return m_XML_TOK_INVALID
  23628. }
  23629. ptr += uintptr(3)
  23630. case int32(_BT_LEAD4):
  23631. if int64(end)-int64(ptr) < int64(4) {
  23632. return -int32(2)
  23633. }
  23634. if 0 != 0 {
  23635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23636. return m_XML_TOK_INVALID
  23637. }
  23638. ptr += uintptr(4)
  23639. case int32(_BT_NONXML):
  23640. fallthrough
  23641. case int32(_BT_MALFORM):
  23642. fallthrough
  23643. case int32(_BT_TRAIL):
  23644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23645. return m_XML_TOK_INVALID
  23646. case int32(_BT_MINUS):
  23647. ptr += uintptr(2)
  23648. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23649. return -int32(1)
  23650. }
  23651. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23652. ptr += uintptr(2)
  23653. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23654. return -int32(1)
  23655. }
  23656. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23658. return m_XML_TOK_INVALID
  23659. }
  23660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23661. return int32(m_XML_TOK_COMMENT)
  23662. }
  23663. default:
  23664. ptr += uintptr(2)
  23665. break
  23666. }
  23667. }
  23668. }
  23669. return -int32(1)
  23670. }
  23671. /* ptr points to character following "<!" */
  23672. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23673. var v1, v2, v3 int32
  23674. _, _, _ = v1, v2, v3
  23675. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23676. return -int32(1)
  23677. }
  23678. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23679. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23680. } else {
  23681. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23682. }
  23683. switch v1 {
  23684. case int32(_BT_MINUS):
  23685. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23686. case int32(_BT_LSQB):
  23687. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23688. return int32(m_XML_TOK_COND_SECT_OPEN)
  23689. case int32(_BT_NMSTRT):
  23690. fallthrough
  23691. case int32(_BT_HEX):
  23692. ptr += uintptr(2)
  23693. default:
  23694. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23695. return m_XML_TOK_INVALID
  23696. }
  23697. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23698. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23699. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23700. } else {
  23701. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23702. }
  23703. switch v2 {
  23704. case int32(_BT_PERCNT):
  23705. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23706. return -int32(1)
  23707. }
  23708. /* don't allow <!ENTITY% foo "whatever"> */
  23709. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23710. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  23711. } else {
  23712. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23713. }
  23714. switch v3 {
  23715. case int32(_BT_S):
  23716. fallthrough
  23717. case int32(_BT_CR):
  23718. fallthrough
  23719. case int32(_BT_LF):
  23720. fallthrough
  23721. case int32(_BT_PERCNT):
  23722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23723. return m_XML_TOK_INVALID
  23724. }
  23725. /* fall through */
  23726. fallthrough
  23727. case int32(_BT_S):
  23728. fallthrough
  23729. case int32(_BT_CR):
  23730. fallthrough
  23731. case int32(_BT_LF):
  23732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23733. return int32(m_XML_TOK_DECL_OPEN)
  23734. case int32(_BT_NMSTRT):
  23735. fallthrough
  23736. case int32(_BT_HEX):
  23737. ptr += uintptr(2)
  23738. default:
  23739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23740. return m_XML_TOK_INVALID
  23741. }
  23742. }
  23743. return -int32(1)
  23744. }
  23745. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23746. var upper, v1, v2, v3 int32
  23747. _, _, _, _ = upper, v1, v2, v3
  23748. upper = 0
  23749. _ = enc
  23750. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23751. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  23752. return int32(1)
  23753. }
  23754. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23755. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23756. } else {
  23757. v1 = -int32(1)
  23758. }
  23759. switch v1 {
  23760. case int32(m_ASCII_x2):
  23761. case int32(m_ASCII_X):
  23762. upper = int32(1)
  23763. default:
  23764. return int32(1)
  23765. }
  23766. ptr += uintptr(2)
  23767. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23768. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23769. } else {
  23770. v2 = -int32(1)
  23771. }
  23772. switch v2 {
  23773. case int32(m_ASCII_m2):
  23774. case int32(m_ASCII_M):
  23775. upper = int32(1)
  23776. default:
  23777. return int32(1)
  23778. }
  23779. ptr += uintptr(2)
  23780. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23781. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23782. } else {
  23783. v3 = -int32(1)
  23784. }
  23785. switch v3 {
  23786. case int32(m_ASCII_l2):
  23787. case int32(m_ASCII_L):
  23788. upper = int32(1)
  23789. default:
  23790. return int32(1)
  23791. }
  23792. if upper != 0 {
  23793. return 0
  23794. }
  23795. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23796. return int32(1)
  23797. }
  23798. /* ptr points to character following "<?" */
  23799. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23800. bp := tls.Alloc(16)
  23801. defer tls.Free(16)
  23802. var target uintptr
  23803. var v1, v2, v3 int32
  23804. var _ /* tok at bp+0 */ int32
  23805. _, _, _, _ = target, v1, v2, v3
  23806. target = ptr
  23807. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23808. return -int32(1)
  23809. }
  23810. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23811. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23812. } else {
  23813. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23814. }
  23815. switch v1 {
  23816. case int32(_BT_NONASCII):
  23817. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23819. return m_XML_TOK_INVALID
  23820. } /* fall through */
  23821. fallthrough
  23822. case int32(_BT_NMSTRT):
  23823. fallthrough
  23824. case int32(_BT_HEX):
  23825. ptr += uintptr(2)
  23826. case int32(_BT_LEAD2):
  23827. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23828. return -int32(2)
  23829. }
  23830. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23831. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23832. return m_XML_TOK_INVALID
  23833. }
  23834. ptr += uintptr(2)
  23835. case int32(_BT_LEAD3):
  23836. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23837. return -int32(2)
  23838. }
  23839. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23841. return m_XML_TOK_INVALID
  23842. }
  23843. ptr += uintptr(3)
  23844. case int32(_BT_LEAD4):
  23845. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23846. return -int32(2)
  23847. }
  23848. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23850. return m_XML_TOK_INVALID
  23851. }
  23852. ptr += uintptr(4)
  23853. default:
  23854. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23855. return m_XML_TOK_INVALID
  23856. }
  23857. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23858. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23859. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23860. } else {
  23861. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23862. }
  23863. switch v2 {
  23864. case int32(_BT_NONASCII):
  23865. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23866. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23867. return m_XML_TOK_INVALID
  23868. } /* fall through */
  23869. fallthrough
  23870. case int32(_BT_NMSTRT):
  23871. fallthrough
  23872. case int32(_BT_HEX):
  23873. fallthrough
  23874. case int32(_BT_DIGIT):
  23875. fallthrough
  23876. case int32(_BT_NAME):
  23877. fallthrough
  23878. case int32(_BT_MINUS):
  23879. ptr += uintptr(2)
  23880. case int32(_BT_LEAD2):
  23881. if int64(end)-int64(ptr) < int64(2) {
  23882. return -int32(2)
  23883. }
  23884. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23885. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23886. return m_XML_TOK_INVALID
  23887. }
  23888. ptr += uintptr(2)
  23889. case int32(_BT_LEAD3):
  23890. if int64(end)-int64(ptr) < int64(3) {
  23891. return -int32(2)
  23892. }
  23893. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23895. return m_XML_TOK_INVALID
  23896. }
  23897. ptr += uintptr(3)
  23898. case int32(_BT_LEAD4):
  23899. if int64(end)-int64(ptr) < int64(4) {
  23900. return -int32(2)
  23901. }
  23902. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23904. return m_XML_TOK_INVALID
  23905. }
  23906. ptr += uintptr(4)
  23907. case int32(_BT_S):
  23908. fallthrough
  23909. case int32(_BT_CR):
  23910. fallthrough
  23911. case int32(_BT_LF):
  23912. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23914. return m_XML_TOK_INVALID
  23915. }
  23916. ptr += uintptr(2)
  23917. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23918. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23919. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23920. } else {
  23921. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23922. }
  23923. switch v3 {
  23924. case int32(_BT_LEAD2):
  23925. if int64(end)-int64(ptr) < int64(2) {
  23926. return -int32(2)
  23927. }
  23928. if 0 != 0 {
  23929. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23930. return m_XML_TOK_INVALID
  23931. }
  23932. ptr += uintptr(2)
  23933. case int32(_BT_LEAD3):
  23934. if int64(end)-int64(ptr) < int64(3) {
  23935. return -int32(2)
  23936. }
  23937. if 0 != 0 {
  23938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23939. return m_XML_TOK_INVALID
  23940. }
  23941. ptr += uintptr(3)
  23942. case int32(_BT_LEAD4):
  23943. if int64(end)-int64(ptr) < int64(4) {
  23944. return -int32(2)
  23945. }
  23946. if 0 != 0 {
  23947. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23948. return m_XML_TOK_INVALID
  23949. }
  23950. ptr += uintptr(4)
  23951. case int32(_BT_NONXML):
  23952. fallthrough
  23953. case int32(_BT_MALFORM):
  23954. fallthrough
  23955. case int32(_BT_TRAIL):
  23956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23957. return m_XML_TOK_INVALID
  23958. case int32(_BT_QUEST):
  23959. ptr += uintptr(2)
  23960. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23961. return -int32(1)
  23962. }
  23963. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23965. return *(*int32)(unsafe.Pointer(bp))
  23966. }
  23967. default:
  23968. ptr += uintptr(2)
  23969. break
  23970. }
  23971. }
  23972. return -int32(1)
  23973. case int32(_BT_QUEST):
  23974. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23976. return m_XML_TOK_INVALID
  23977. }
  23978. ptr += uintptr(2)
  23979. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23980. return -int32(1)
  23981. }
  23982. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23983. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23984. return *(*int32)(unsafe.Pointer(bp))
  23985. }
  23986. /* fall through */
  23987. fallthrough
  23988. default:
  23989. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23990. return m_XML_TOK_INVALID
  23991. }
  23992. }
  23993. return -int32(1)
  23994. }
  23995. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23996. var i int32
  23997. _ = i
  23998. _ = enc
  23999. /* CDATA[ */
  24000. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  24001. return -int32(1)
  24002. }
  24003. i = 0
  24004. for {
  24005. if !(i < int32(6)) {
  24006. break
  24007. }
  24008. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(_CDATA_LSQB2[i])) {
  24009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24010. return m_XML_TOK_INVALID
  24011. }
  24012. goto _1
  24013. _1:
  24014. ;
  24015. i++
  24016. ptr += uintptr(2)
  24017. }
  24018. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24019. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  24020. }
  24021. var _CDATA_LSQB2 = [6]int8{
  24022. 0: int8(m_ASCII_C),
  24023. 1: int8(m_ASCII_D),
  24024. 2: int8(m_ASCII_A),
  24025. 3: int8(m_ASCII_T),
  24026. 4: int8(m_ASCII_A),
  24027. 5: int8(m_ASCII_LSQB1),
  24028. }
  24029. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24030. var n Tsize_t
  24031. var v1, v2, v3 int32
  24032. _, _, _, _ = n, v1, v2, v3
  24033. if ptr >= end {
  24034. return -int32(4)
  24035. }
  24036. if int32(2) > int32(1) {
  24037. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  24038. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  24039. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  24040. if n == uint64(0) {
  24041. return -int32(1)
  24042. }
  24043. end = ptr + uintptr(n)
  24044. }
  24045. }
  24046. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24047. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24048. } else {
  24049. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24050. }
  24051. switch v1 {
  24052. case int32(_BT_RSQB):
  24053. ptr += uintptr(2)
  24054. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24055. return -int32(1)
  24056. }
  24057. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  24058. break
  24059. }
  24060. ptr += uintptr(2)
  24061. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24062. return -int32(1)
  24063. }
  24064. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  24065. ptr -= uintptr(2)
  24066. break
  24067. }
  24068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24069. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  24070. case int32(_BT_CR):
  24071. ptr += uintptr(2)
  24072. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24073. return -int32(1)
  24074. }
  24075. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24076. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24077. } else {
  24078. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24079. }
  24080. if v2 == int32(_BT_LF) {
  24081. ptr += uintptr(2)
  24082. }
  24083. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24084. return int32(m_XML_TOK_DATA_NEWLINE)
  24085. case int32(_BT_LF):
  24086. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24087. return int32(m_XML_TOK_DATA_NEWLINE)
  24088. case int32(_BT_LEAD2):
  24089. if int64(end)-int64(ptr) < int64(2) {
  24090. return -int32(2)
  24091. }
  24092. if 0 != 0 {
  24093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24094. return m_XML_TOK_INVALID
  24095. }
  24096. ptr += uintptr(2)
  24097. case int32(_BT_LEAD3):
  24098. if int64(end)-int64(ptr) < int64(3) {
  24099. return -int32(2)
  24100. }
  24101. if 0 != 0 {
  24102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24103. return m_XML_TOK_INVALID
  24104. }
  24105. ptr += uintptr(3)
  24106. case int32(_BT_LEAD4):
  24107. if int64(end)-int64(ptr) < int64(4) {
  24108. return -int32(2)
  24109. }
  24110. if 0 != 0 {
  24111. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24112. return m_XML_TOK_INVALID
  24113. }
  24114. ptr += uintptr(4)
  24115. case int32(_BT_NONXML):
  24116. fallthrough
  24117. case int32(_BT_MALFORM):
  24118. fallthrough
  24119. case int32(_BT_TRAIL):
  24120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24121. return m_XML_TOK_INVALID
  24122. default:
  24123. ptr += uintptr(2)
  24124. break
  24125. }
  24126. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24127. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24128. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24129. } else {
  24130. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24131. }
  24132. switch v3 {
  24133. case int32(_BT_LEAD2):
  24134. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  24135. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24136. return int32(m_XML_TOK_DATA_CHARS)
  24137. }
  24138. ptr += uintptr(2)
  24139. case int32(_BT_LEAD3):
  24140. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  24141. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24142. return int32(m_XML_TOK_DATA_CHARS)
  24143. }
  24144. ptr += uintptr(3)
  24145. case int32(_BT_LEAD4):
  24146. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  24147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24148. return int32(m_XML_TOK_DATA_CHARS)
  24149. }
  24150. ptr += uintptr(4)
  24151. case int32(_BT_NONXML):
  24152. fallthrough
  24153. case int32(_BT_MALFORM):
  24154. fallthrough
  24155. case int32(_BT_TRAIL):
  24156. fallthrough
  24157. case int32(_BT_CR):
  24158. fallthrough
  24159. case int32(_BT_LF):
  24160. fallthrough
  24161. case int32(_BT_RSQB):
  24162. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24163. return int32(m_XML_TOK_DATA_CHARS)
  24164. default:
  24165. ptr += uintptr(2)
  24166. break
  24167. }
  24168. }
  24169. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24170. return int32(m_XML_TOK_DATA_CHARS)
  24171. }
  24172. /* ptr points to character following "</" */
  24173. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24174. var v1, v2, v22 int32
  24175. _, _, _ = v1, v2, v22
  24176. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24177. return -int32(1)
  24178. }
  24179. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24180. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24181. } else {
  24182. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24183. }
  24184. switch v1 {
  24185. case int32(_BT_NONASCII):
  24186. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24188. return m_XML_TOK_INVALID
  24189. } /* fall through */
  24190. fallthrough
  24191. case int32(_BT_NMSTRT):
  24192. fallthrough
  24193. case int32(_BT_HEX):
  24194. ptr += uintptr(2)
  24195. case int32(_BT_LEAD2):
  24196. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24197. return -int32(2)
  24198. }
  24199. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24201. return m_XML_TOK_INVALID
  24202. }
  24203. ptr += uintptr(2)
  24204. case int32(_BT_LEAD3):
  24205. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24206. return -int32(2)
  24207. }
  24208. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24209. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24210. return m_XML_TOK_INVALID
  24211. }
  24212. ptr += uintptr(3)
  24213. case int32(_BT_LEAD4):
  24214. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24215. return -int32(2)
  24216. }
  24217. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24219. return m_XML_TOK_INVALID
  24220. }
  24221. ptr += uintptr(4)
  24222. default:
  24223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24224. return m_XML_TOK_INVALID
  24225. }
  24226. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24227. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24228. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24229. } else {
  24230. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24231. }
  24232. switch v2 {
  24233. case int32(_BT_NONASCII):
  24234. goto _3
  24235. case int32(_BT_MINUS):
  24236. goto _4
  24237. case int32(_BT_NAME):
  24238. goto _5
  24239. case int32(_BT_DIGIT):
  24240. goto _6
  24241. case int32(_BT_HEX):
  24242. goto _7
  24243. case int32(_BT_NMSTRT):
  24244. goto _8
  24245. case int32(_BT_LEAD2):
  24246. goto _9
  24247. case int32(_BT_LEAD3):
  24248. goto _10
  24249. case int32(_BT_LEAD4):
  24250. goto _11
  24251. case int32(_BT_LF):
  24252. goto _12
  24253. case int32(_BT_CR):
  24254. goto _13
  24255. case int32(_BT_S):
  24256. goto _14
  24257. case int32(_BT_COLON):
  24258. goto _15
  24259. case int32(_BT_GT):
  24260. goto _16
  24261. default:
  24262. goto _17
  24263. }
  24264. goto _18
  24265. _3:
  24266. ;
  24267. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24269. return m_XML_TOK_INVALID
  24270. } /* fall through */
  24271. _8:
  24272. ;
  24273. _7:
  24274. ;
  24275. _6:
  24276. ;
  24277. _5:
  24278. ;
  24279. _4:
  24280. ;
  24281. ptr += uintptr(2)
  24282. goto _18
  24283. _9:
  24284. ;
  24285. if int64(end)-int64(ptr) < int64(2) {
  24286. return -int32(2)
  24287. }
  24288. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24289. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24290. return m_XML_TOK_INVALID
  24291. }
  24292. ptr += uintptr(2)
  24293. goto _18
  24294. _10:
  24295. ;
  24296. if int64(end)-int64(ptr) < int64(3) {
  24297. return -int32(2)
  24298. }
  24299. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24300. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24301. return m_XML_TOK_INVALID
  24302. }
  24303. ptr += uintptr(3)
  24304. goto _18
  24305. _11:
  24306. ;
  24307. if int64(end)-int64(ptr) < int64(4) {
  24308. return -int32(2)
  24309. }
  24310. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24312. return m_XML_TOK_INVALID
  24313. }
  24314. ptr += uintptr(4)
  24315. goto _18
  24316. _14:
  24317. ;
  24318. _13:
  24319. ;
  24320. _12:
  24321. ;
  24322. ptr += uintptr(2)
  24323. _21:
  24324. ;
  24325. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24326. goto _19
  24327. }
  24328. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24329. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24330. } else {
  24331. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24332. }
  24333. switch v22 {
  24334. case int32(_BT_S):
  24335. fallthrough
  24336. case int32(_BT_CR):
  24337. fallthrough
  24338. case int32(_BT_LF):
  24339. case int32(_BT_GT):
  24340. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24341. return int32(m_XML_TOK_END_TAG)
  24342. default:
  24343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24344. return m_XML_TOK_INVALID
  24345. }
  24346. goto _20
  24347. _20:
  24348. ;
  24349. ptr += uintptr(2)
  24350. goto _21
  24351. goto _19
  24352. _19:
  24353. ;
  24354. return -int32(1)
  24355. _15:
  24356. ;
  24357. /* no need to check qname syntax here,
  24358. since end-tag must match exactly */
  24359. ptr += uintptr(2)
  24360. goto _18
  24361. _16:
  24362. ;
  24363. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24364. return int32(m_XML_TOK_END_TAG)
  24365. _17:
  24366. ;
  24367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24368. return m_XML_TOK_INVALID
  24369. _18:
  24370. }
  24371. return -int32(1)
  24372. }
  24373. /* ptr points to character following "&#X" */
  24374. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24375. var v1, v3 int32
  24376. _, _ = v1, v3
  24377. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24378. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24379. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24380. } else {
  24381. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24382. }
  24383. switch v1 {
  24384. case int32(_BT_DIGIT):
  24385. fallthrough
  24386. case int32(_BT_HEX):
  24387. default:
  24388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24389. return m_XML_TOK_INVALID
  24390. }
  24391. ptr += uintptr(2)
  24392. for {
  24393. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24394. break
  24395. }
  24396. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24397. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24398. } else {
  24399. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24400. }
  24401. switch v3 {
  24402. case int32(_BT_DIGIT):
  24403. fallthrough
  24404. case int32(_BT_HEX):
  24405. case int32(_BT_SEMI):
  24406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24407. return int32(m_XML_TOK_CHAR_REF)
  24408. default:
  24409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24410. return m_XML_TOK_INVALID
  24411. }
  24412. goto _2
  24413. _2:
  24414. ;
  24415. ptr += uintptr(2)
  24416. }
  24417. }
  24418. return -int32(1)
  24419. }
  24420. /* ptr points to character following "&#" */
  24421. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24422. var v1, v3 int32
  24423. _, _ = v1, v3
  24424. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24425. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24426. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24427. }
  24428. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24429. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24430. } else {
  24431. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24432. }
  24433. switch v1 {
  24434. case int32(_BT_DIGIT):
  24435. default:
  24436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24437. return m_XML_TOK_INVALID
  24438. }
  24439. ptr += uintptr(2)
  24440. for {
  24441. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24442. break
  24443. }
  24444. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24445. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24446. } else {
  24447. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24448. }
  24449. switch v3 {
  24450. case int32(_BT_DIGIT):
  24451. case int32(_BT_SEMI):
  24452. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24453. return int32(m_XML_TOK_CHAR_REF)
  24454. default:
  24455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24456. return m_XML_TOK_INVALID
  24457. }
  24458. goto _2
  24459. _2:
  24460. ;
  24461. ptr += uintptr(2)
  24462. }
  24463. }
  24464. return -int32(1)
  24465. }
  24466. /* ptr points to character following "&" */
  24467. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24468. var v1, v2 int32
  24469. _, _ = v1, v2
  24470. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24471. return -int32(1)
  24472. }
  24473. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24474. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24475. } else {
  24476. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24477. }
  24478. switch v1 {
  24479. case int32(_BT_NONASCII):
  24480. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24481. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24482. return m_XML_TOK_INVALID
  24483. } /* fall through */
  24484. fallthrough
  24485. case int32(_BT_NMSTRT):
  24486. fallthrough
  24487. case int32(_BT_HEX):
  24488. ptr += uintptr(2)
  24489. case int32(_BT_LEAD2):
  24490. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24491. return -int32(2)
  24492. }
  24493. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24494. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24495. return m_XML_TOK_INVALID
  24496. }
  24497. ptr += uintptr(2)
  24498. case int32(_BT_LEAD3):
  24499. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24500. return -int32(2)
  24501. }
  24502. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24503. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24504. return m_XML_TOK_INVALID
  24505. }
  24506. ptr += uintptr(3)
  24507. case int32(_BT_LEAD4):
  24508. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24509. return -int32(2)
  24510. }
  24511. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24513. return m_XML_TOK_INVALID
  24514. }
  24515. ptr += uintptr(4)
  24516. case int32(_BT_NUM):
  24517. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24518. default:
  24519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24520. return m_XML_TOK_INVALID
  24521. }
  24522. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24523. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24524. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24525. } else {
  24526. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24527. }
  24528. switch v2 {
  24529. case int32(_BT_NONASCII):
  24530. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24531. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24532. return m_XML_TOK_INVALID
  24533. } /* fall through */
  24534. fallthrough
  24535. case int32(_BT_NMSTRT):
  24536. fallthrough
  24537. case int32(_BT_HEX):
  24538. fallthrough
  24539. case int32(_BT_DIGIT):
  24540. fallthrough
  24541. case int32(_BT_NAME):
  24542. fallthrough
  24543. case int32(_BT_MINUS):
  24544. ptr += uintptr(2)
  24545. case int32(_BT_LEAD2):
  24546. if int64(end)-int64(ptr) < int64(2) {
  24547. return -int32(2)
  24548. }
  24549. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24551. return m_XML_TOK_INVALID
  24552. }
  24553. ptr += uintptr(2)
  24554. case int32(_BT_LEAD3):
  24555. if int64(end)-int64(ptr) < int64(3) {
  24556. return -int32(2)
  24557. }
  24558. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24560. return m_XML_TOK_INVALID
  24561. }
  24562. ptr += uintptr(3)
  24563. case int32(_BT_LEAD4):
  24564. if int64(end)-int64(ptr) < int64(4) {
  24565. return -int32(2)
  24566. }
  24567. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24569. return m_XML_TOK_INVALID
  24570. }
  24571. ptr += uintptr(4)
  24572. case int32(_BT_SEMI):
  24573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24574. return int32(m_XML_TOK_ENTITY_REF)
  24575. default:
  24576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24577. return m_XML_TOK_INVALID
  24578. }
  24579. }
  24580. return -int32(1)
  24581. }
  24582. /* ptr points to character following first character of attribute name */
  24583. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24584. bp := tls.Alloc(16)
  24585. defer tls.Free(16)
  24586. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24587. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24588. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24589. hadColon = 0
  24590. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24591. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24592. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24593. } else {
  24594. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24595. }
  24596. switch v1 {
  24597. case int32(_BT_NONASCII):
  24598. goto _2
  24599. case int32(_BT_MINUS):
  24600. goto _3
  24601. case int32(_BT_NAME):
  24602. goto _4
  24603. case int32(_BT_DIGIT):
  24604. goto _5
  24605. case int32(_BT_HEX):
  24606. goto _6
  24607. case int32(_BT_NMSTRT):
  24608. goto _7
  24609. case int32(_BT_LEAD2):
  24610. goto _8
  24611. case int32(_BT_LEAD3):
  24612. goto _9
  24613. case int32(_BT_LEAD4):
  24614. goto _10
  24615. case int32(_BT_COLON):
  24616. goto _11
  24617. case int32(_BT_LF):
  24618. goto _12
  24619. case int32(_BT_CR):
  24620. goto _13
  24621. case int32(_BT_S):
  24622. goto _14
  24623. case int32(_BT_EQUALS):
  24624. goto _15
  24625. default:
  24626. goto _16
  24627. }
  24628. goto _17
  24629. _2:
  24630. ;
  24631. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24633. return m_XML_TOK_INVALID
  24634. } /* fall through */
  24635. _7:
  24636. ;
  24637. _6:
  24638. ;
  24639. _5:
  24640. ;
  24641. _4:
  24642. ;
  24643. _3:
  24644. ;
  24645. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24646. goto _17
  24647. _8:
  24648. ;
  24649. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24650. return -int32(2)
  24651. }
  24652. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24654. return m_XML_TOK_INVALID
  24655. }
  24656. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24657. goto _17
  24658. _9:
  24659. ;
  24660. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24661. return -int32(2)
  24662. }
  24663. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24665. return m_XML_TOK_INVALID
  24666. }
  24667. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24668. goto _17
  24669. _10:
  24670. ;
  24671. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24672. return -int32(2)
  24673. }
  24674. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24676. return m_XML_TOK_INVALID
  24677. }
  24678. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24679. goto _17
  24680. _11:
  24681. ;
  24682. if hadColon != 0 {
  24683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24684. return m_XML_TOK_INVALID
  24685. }
  24686. hadColon = int32(1)
  24687. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24688. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24689. return -int32(1)
  24690. }
  24691. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24692. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24693. } else {
  24694. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24695. }
  24696. switch v18 {
  24697. case int32(_BT_NONASCII):
  24698. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24700. return m_XML_TOK_INVALID
  24701. } /* fall through */
  24702. fallthrough
  24703. case int32(_BT_NMSTRT):
  24704. fallthrough
  24705. case int32(_BT_HEX):
  24706. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24707. case int32(_BT_LEAD2):
  24708. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24709. return -int32(2)
  24710. }
  24711. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24712. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24713. return m_XML_TOK_INVALID
  24714. }
  24715. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24716. case int32(_BT_LEAD3):
  24717. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24718. return -int32(2)
  24719. }
  24720. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24722. return m_XML_TOK_INVALID
  24723. }
  24724. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24725. case int32(_BT_LEAD4):
  24726. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24727. return -int32(2)
  24728. }
  24729. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24731. return m_XML_TOK_INVALID
  24732. }
  24733. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24734. default:
  24735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24736. return m_XML_TOK_INVALID
  24737. }
  24738. goto _17
  24739. _14:
  24740. ;
  24741. _13:
  24742. ;
  24743. _12:
  24744. ;
  24745. _21:
  24746. ;
  24747. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24748. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24749. return -int32(1)
  24750. }
  24751. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24752. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24753. } else {
  24754. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24755. }
  24756. t = v22
  24757. if t == int32(_BT_EQUALS) {
  24758. goto _19
  24759. }
  24760. switch t {
  24761. case int32(_BT_S):
  24762. fallthrough
  24763. case int32(_BT_LF):
  24764. fallthrough
  24765. case int32(_BT_CR):
  24766. default:
  24767. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24768. return m_XML_TOK_INVALID
  24769. }
  24770. goto _20
  24771. _20:
  24772. ;
  24773. goto _21
  24774. goto _19
  24775. _19:
  24776. ;
  24777. /* fall through */
  24778. _15:
  24779. ;
  24780. hadColon = 0
  24781. for {
  24782. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24783. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24784. return -int32(1)
  24785. }
  24786. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24787. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24788. } else {
  24789. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24790. }
  24791. open = v24
  24792. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24793. break
  24794. }
  24795. switch open {
  24796. case int32(_BT_S):
  24797. fallthrough
  24798. case int32(_BT_LF):
  24799. fallthrough
  24800. case int32(_BT_CR):
  24801. default:
  24802. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24803. return m_XML_TOK_INVALID
  24804. }
  24805. goto _23
  24806. _23:
  24807. }
  24808. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24809. /* in attribute value */
  24810. for {
  24811. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24812. return -int32(1)
  24813. }
  24814. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24815. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24816. } else {
  24817. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24818. }
  24819. t1 = v26
  24820. if t1 == open {
  24821. break
  24822. }
  24823. switch t1 {
  24824. case int32(_BT_LEAD2):
  24825. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24826. return -int32(2)
  24827. }
  24828. if 0 != 0 {
  24829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24830. return m_XML_TOK_INVALID
  24831. }
  24832. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24833. case int32(_BT_LEAD3):
  24834. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24835. return -int32(2)
  24836. }
  24837. if 0 != 0 {
  24838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24839. return m_XML_TOK_INVALID
  24840. }
  24841. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24842. case int32(_BT_LEAD4):
  24843. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24844. return -int32(2)
  24845. }
  24846. if 0 != 0 {
  24847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24848. return m_XML_TOK_INVALID
  24849. }
  24850. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24851. case int32(_BT_NONXML):
  24852. fallthrough
  24853. case int32(_BT_MALFORM):
  24854. fallthrough
  24855. case int32(_BT_TRAIL):
  24856. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24857. return m_XML_TOK_INVALID
  24858. case int32(_BT_AMP):
  24859. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24860. if tok <= 0 {
  24861. if tok == m_XML_TOK_INVALID {
  24862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24863. }
  24864. return tok
  24865. }
  24866. case int32(_BT_LT):
  24867. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24868. return m_XML_TOK_INVALID
  24869. default:
  24870. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24871. break
  24872. }
  24873. goto _25
  24874. _25:
  24875. }
  24876. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24877. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24878. return -int32(1)
  24879. }
  24880. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24881. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24882. } else {
  24883. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24884. }
  24885. switch v27 {
  24886. case int32(_BT_S):
  24887. fallthrough
  24888. case int32(_BT_CR):
  24889. fallthrough
  24890. case int32(_BT_LF):
  24891. case int32(_BT_SOL):
  24892. goto sol
  24893. case int32(_BT_GT):
  24894. goto gt
  24895. default:
  24896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24897. return m_XML_TOK_INVALID
  24898. }
  24899. /* ptr points to closing quote */
  24900. _30:
  24901. ;
  24902. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24903. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24904. return -int32(1)
  24905. }
  24906. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24907. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24908. } else {
  24909. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24910. }
  24911. switch v31 {
  24912. case int32(_BT_NONASCII):
  24913. goto _32
  24914. case int32(_BT_HEX):
  24915. goto _33
  24916. case int32(_BT_NMSTRT):
  24917. goto _34
  24918. case int32(_BT_LEAD2):
  24919. goto _35
  24920. case int32(_BT_LEAD3):
  24921. goto _36
  24922. case int32(_BT_LEAD4):
  24923. goto _37
  24924. case int32(_BT_LF):
  24925. goto _38
  24926. case int32(_BT_CR):
  24927. goto _39
  24928. case int32(_BT_S):
  24929. goto _40
  24930. case int32(_BT_GT):
  24931. goto _41
  24932. case int32(_BT_SOL):
  24933. goto _42
  24934. default:
  24935. goto _43
  24936. }
  24937. goto _44
  24938. _32:
  24939. ;
  24940. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24942. return m_XML_TOK_INVALID
  24943. } /* fall through */
  24944. _34:
  24945. ;
  24946. _33:
  24947. ;
  24948. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24949. goto _44
  24950. _35:
  24951. ;
  24952. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24953. return -int32(2)
  24954. }
  24955. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24957. return m_XML_TOK_INVALID
  24958. }
  24959. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24960. goto _44
  24961. _36:
  24962. ;
  24963. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24964. return -int32(2)
  24965. }
  24966. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24967. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24968. return m_XML_TOK_INVALID
  24969. }
  24970. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24971. goto _44
  24972. _37:
  24973. ;
  24974. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24975. return -int32(2)
  24976. }
  24977. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24978. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24979. return m_XML_TOK_INVALID
  24980. }
  24981. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24982. goto _44
  24983. _40:
  24984. ;
  24985. _39:
  24986. ;
  24987. _38:
  24988. ;
  24989. goto _29
  24990. _41:
  24991. ;
  24992. goto gt
  24993. gt:
  24994. ;
  24995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24996. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24997. _42:
  24998. ;
  24999. goto sol
  25000. sol:
  25001. ;
  25002. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  25003. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25004. return -int32(1)
  25005. }
  25006. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  25007. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25008. return m_XML_TOK_INVALID
  25009. }
  25010. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  25011. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  25012. _43:
  25013. ;
  25014. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25015. return m_XML_TOK_INVALID
  25016. _44:
  25017. ;
  25018. goto _28
  25019. goto _29
  25020. _29:
  25021. ;
  25022. goto _30
  25023. goto _28
  25024. _28:
  25025. ;
  25026. goto _17
  25027. _16:
  25028. ;
  25029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25030. return m_XML_TOK_INVALID
  25031. _17:
  25032. }
  25033. return -int32(1)
  25034. }
  25035. /* ptr points to character following "<" */
  25036. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25037. var hadColon, v1, v2, v21, v22, v3 int32
  25038. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  25039. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25040. return -int32(1)
  25041. }
  25042. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25043. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25044. } else {
  25045. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25046. }
  25047. switch v1 {
  25048. case int32(_BT_NONASCII):
  25049. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25051. return m_XML_TOK_INVALID
  25052. } /* fall through */
  25053. fallthrough
  25054. case int32(_BT_NMSTRT):
  25055. fallthrough
  25056. case int32(_BT_HEX):
  25057. ptr += uintptr(2)
  25058. case int32(_BT_LEAD2):
  25059. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25060. return -int32(2)
  25061. }
  25062. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25063. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25064. return m_XML_TOK_INVALID
  25065. }
  25066. ptr += uintptr(2)
  25067. case int32(_BT_LEAD3):
  25068. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25069. return -int32(2)
  25070. }
  25071. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25073. return m_XML_TOK_INVALID
  25074. }
  25075. ptr += uintptr(3)
  25076. case int32(_BT_LEAD4):
  25077. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25078. return -int32(2)
  25079. }
  25080. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25082. return m_XML_TOK_INVALID
  25083. }
  25084. ptr += uintptr(4)
  25085. case int32(_BT_EXCL):
  25086. ptr += uintptr(2)
  25087. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25088. return -int32(1)
  25089. }
  25090. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25091. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25092. } else {
  25093. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25094. }
  25095. switch v2 {
  25096. case int32(_BT_MINUS):
  25097. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25098. case int32(_BT_LSQB):
  25099. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25100. }
  25101. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25102. return m_XML_TOK_INVALID
  25103. case int32(_BT_QUEST):
  25104. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25105. case int32(_BT_SOL):
  25106. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25107. default:
  25108. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25109. return m_XML_TOK_INVALID
  25110. }
  25111. hadColon = 0
  25112. /* we have a start-tag */
  25113. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25114. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25115. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25116. } else {
  25117. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25118. }
  25119. switch v3 {
  25120. case int32(_BT_NONASCII):
  25121. goto _4
  25122. case int32(_BT_MINUS):
  25123. goto _5
  25124. case int32(_BT_NAME):
  25125. goto _6
  25126. case int32(_BT_DIGIT):
  25127. goto _7
  25128. case int32(_BT_HEX):
  25129. goto _8
  25130. case int32(_BT_NMSTRT):
  25131. goto _9
  25132. case int32(_BT_LEAD2):
  25133. goto _10
  25134. case int32(_BT_LEAD3):
  25135. goto _11
  25136. case int32(_BT_LEAD4):
  25137. goto _12
  25138. case int32(_BT_COLON):
  25139. goto _13
  25140. case int32(_BT_LF):
  25141. goto _14
  25142. case int32(_BT_CR):
  25143. goto _15
  25144. case int32(_BT_S):
  25145. goto _16
  25146. case int32(_BT_GT):
  25147. goto _17
  25148. case int32(_BT_SOL):
  25149. goto _18
  25150. default:
  25151. goto _19
  25152. }
  25153. goto _20
  25154. _4:
  25155. ;
  25156. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25158. return m_XML_TOK_INVALID
  25159. } /* fall through */
  25160. _9:
  25161. ;
  25162. _8:
  25163. ;
  25164. _7:
  25165. ;
  25166. _6:
  25167. ;
  25168. _5:
  25169. ;
  25170. ptr += uintptr(2)
  25171. goto _20
  25172. _10:
  25173. ;
  25174. if int64(end)-int64(ptr) < int64(2) {
  25175. return -int32(2)
  25176. }
  25177. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25179. return m_XML_TOK_INVALID
  25180. }
  25181. ptr += uintptr(2)
  25182. goto _20
  25183. _11:
  25184. ;
  25185. if int64(end)-int64(ptr) < int64(3) {
  25186. return -int32(2)
  25187. }
  25188. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25190. return m_XML_TOK_INVALID
  25191. }
  25192. ptr += uintptr(3)
  25193. goto _20
  25194. _12:
  25195. ;
  25196. if int64(end)-int64(ptr) < int64(4) {
  25197. return -int32(2)
  25198. }
  25199. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25201. return m_XML_TOK_INVALID
  25202. }
  25203. ptr += uintptr(4)
  25204. goto _20
  25205. _13:
  25206. ;
  25207. if hadColon != 0 {
  25208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25209. return m_XML_TOK_INVALID
  25210. }
  25211. hadColon = int32(1)
  25212. ptr += uintptr(2)
  25213. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25214. return -int32(1)
  25215. }
  25216. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25217. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25218. } else {
  25219. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25220. }
  25221. switch v21 {
  25222. case int32(_BT_NONASCII):
  25223. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25225. return m_XML_TOK_INVALID
  25226. } /* fall through */
  25227. fallthrough
  25228. case int32(_BT_NMSTRT):
  25229. fallthrough
  25230. case int32(_BT_HEX):
  25231. ptr += uintptr(2)
  25232. case int32(_BT_LEAD2):
  25233. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25234. return -int32(2)
  25235. }
  25236. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25237. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25238. return m_XML_TOK_INVALID
  25239. }
  25240. ptr += uintptr(2)
  25241. case int32(_BT_LEAD3):
  25242. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25243. return -int32(2)
  25244. }
  25245. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25246. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25247. return m_XML_TOK_INVALID
  25248. }
  25249. ptr += uintptr(3)
  25250. case int32(_BT_LEAD4):
  25251. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25252. return -int32(2)
  25253. }
  25254. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25255. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25256. return m_XML_TOK_INVALID
  25257. }
  25258. ptr += uintptr(4)
  25259. default:
  25260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25261. return m_XML_TOK_INVALID
  25262. }
  25263. goto _20
  25264. _16:
  25265. ;
  25266. _15:
  25267. ;
  25268. _14:
  25269. ;
  25270. ptr += uintptr(2)
  25271. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25272. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25273. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25274. } else {
  25275. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25276. }
  25277. switch v22 {
  25278. case int32(_BT_NONASCII):
  25279. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25281. return m_XML_TOK_INVALID
  25282. } /* fall through */
  25283. fallthrough
  25284. case int32(_BT_NMSTRT):
  25285. fallthrough
  25286. case int32(_BT_HEX):
  25287. ptr += uintptr(2)
  25288. case int32(_BT_LEAD2):
  25289. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25290. return -int32(2)
  25291. }
  25292. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25294. return m_XML_TOK_INVALID
  25295. }
  25296. ptr += uintptr(2)
  25297. case int32(_BT_LEAD3):
  25298. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25299. return -int32(2)
  25300. }
  25301. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25303. return m_XML_TOK_INVALID
  25304. }
  25305. ptr += uintptr(3)
  25306. case int32(_BT_LEAD4):
  25307. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25308. return -int32(2)
  25309. }
  25310. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25312. return m_XML_TOK_INVALID
  25313. }
  25314. ptr += uintptr(4)
  25315. case int32(_BT_GT):
  25316. goto gt
  25317. case int32(_BT_SOL):
  25318. goto sol
  25319. case int32(_BT_S):
  25320. fallthrough
  25321. case int32(_BT_CR):
  25322. fallthrough
  25323. case int32(_BT_LF):
  25324. ptr += uintptr(2)
  25325. continue
  25326. default:
  25327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25328. return m_XML_TOK_INVALID
  25329. }
  25330. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25331. }
  25332. return -int32(1)
  25333. _17:
  25334. ;
  25335. goto gt
  25336. gt:
  25337. ;
  25338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25339. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25340. _18:
  25341. ;
  25342. goto sol
  25343. sol:
  25344. ;
  25345. ptr += uintptr(2)
  25346. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25347. return -int32(1)
  25348. }
  25349. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25351. return m_XML_TOK_INVALID
  25352. }
  25353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25354. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25355. _19:
  25356. ;
  25357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25358. return m_XML_TOK_INVALID
  25359. _20:
  25360. }
  25361. return -int32(1)
  25362. }
  25363. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25364. var n Tsize_t
  25365. var v1, v2, v3 int32
  25366. _, _, _, _ = n, v1, v2, v3
  25367. if ptr >= end {
  25368. return -int32(4)
  25369. }
  25370. if int32(2) > int32(1) {
  25371. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25372. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25373. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25374. if n == uint64(0) {
  25375. return -int32(1)
  25376. }
  25377. end = ptr + uintptr(n)
  25378. }
  25379. }
  25380. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25381. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25382. } else {
  25383. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25384. }
  25385. switch v1 {
  25386. case int32(_BT_LT):
  25387. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25388. case int32(_BT_AMP):
  25389. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25390. case int32(_BT_CR):
  25391. ptr += uintptr(2)
  25392. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25393. return -int32(3)
  25394. }
  25395. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25396. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25397. } else {
  25398. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25399. }
  25400. if v2 == int32(_BT_LF) {
  25401. ptr += uintptr(2)
  25402. }
  25403. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25404. return int32(m_XML_TOK_DATA_NEWLINE)
  25405. case int32(_BT_LF):
  25406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25407. return int32(m_XML_TOK_DATA_NEWLINE)
  25408. case int32(_BT_RSQB):
  25409. ptr += uintptr(2)
  25410. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25411. return -int32(5)
  25412. }
  25413. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25414. break
  25415. }
  25416. ptr += uintptr(2)
  25417. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25418. return -int32(5)
  25419. }
  25420. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25421. ptr -= uintptr(2)
  25422. break
  25423. }
  25424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25425. return m_XML_TOK_INVALID
  25426. case int32(_BT_LEAD2):
  25427. if int64(end)-int64(ptr) < int64(2) {
  25428. return -int32(2)
  25429. }
  25430. if 0 != 0 {
  25431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25432. return m_XML_TOK_INVALID
  25433. }
  25434. ptr += uintptr(2)
  25435. case int32(_BT_LEAD3):
  25436. if int64(end)-int64(ptr) < int64(3) {
  25437. return -int32(2)
  25438. }
  25439. if 0 != 0 {
  25440. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25441. return m_XML_TOK_INVALID
  25442. }
  25443. ptr += uintptr(3)
  25444. case int32(_BT_LEAD4):
  25445. if int64(end)-int64(ptr) < int64(4) {
  25446. return -int32(2)
  25447. }
  25448. if 0 != 0 {
  25449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25450. return m_XML_TOK_INVALID
  25451. }
  25452. ptr += uintptr(4)
  25453. case int32(_BT_NONXML):
  25454. fallthrough
  25455. case int32(_BT_MALFORM):
  25456. fallthrough
  25457. case int32(_BT_TRAIL):
  25458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25459. return m_XML_TOK_INVALID
  25460. default:
  25461. ptr += uintptr(2)
  25462. break
  25463. }
  25464. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25465. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25466. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25467. } else {
  25468. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25469. }
  25470. switch v3 {
  25471. case int32(_BT_LEAD2):
  25472. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  25473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25474. return int32(m_XML_TOK_DATA_CHARS)
  25475. }
  25476. ptr += uintptr(2)
  25477. case int32(_BT_LEAD3):
  25478. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  25479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25480. return int32(m_XML_TOK_DATA_CHARS)
  25481. }
  25482. ptr += uintptr(3)
  25483. case int32(_BT_LEAD4):
  25484. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  25485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25486. return int32(m_XML_TOK_DATA_CHARS)
  25487. }
  25488. ptr += uintptr(4)
  25489. case int32(_BT_RSQB):
  25490. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25491. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  25492. ptr += uintptr(2)
  25493. break
  25494. }
  25495. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  25496. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  25497. ptr += uintptr(2)
  25498. break
  25499. }
  25500. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25501. return m_XML_TOK_INVALID
  25502. }
  25503. }
  25504. /* fall through */
  25505. fallthrough
  25506. case int32(_BT_AMP):
  25507. fallthrough
  25508. case int32(_BT_LT):
  25509. fallthrough
  25510. case int32(_BT_NONXML):
  25511. fallthrough
  25512. case int32(_BT_MALFORM):
  25513. fallthrough
  25514. case int32(_BT_TRAIL):
  25515. fallthrough
  25516. case int32(_BT_CR):
  25517. fallthrough
  25518. case int32(_BT_LF):
  25519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25520. return int32(m_XML_TOK_DATA_CHARS)
  25521. default:
  25522. ptr += uintptr(2)
  25523. break
  25524. }
  25525. }
  25526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25527. return int32(m_XML_TOK_DATA_CHARS)
  25528. }
  25529. /* ptr points to character following "%" */
  25530. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25531. var v1, v2 int32
  25532. _, _ = v1, v2
  25533. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25534. return -int32(1)
  25535. }
  25536. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25537. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25538. } else {
  25539. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25540. }
  25541. switch v1 {
  25542. case int32(_BT_NONASCII):
  25543. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25545. return m_XML_TOK_INVALID
  25546. } /* fall through */
  25547. fallthrough
  25548. case int32(_BT_NMSTRT):
  25549. fallthrough
  25550. case int32(_BT_HEX):
  25551. ptr += uintptr(2)
  25552. case int32(_BT_LEAD2):
  25553. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25554. return -int32(2)
  25555. }
  25556. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25557. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25558. return m_XML_TOK_INVALID
  25559. }
  25560. ptr += uintptr(2)
  25561. case int32(_BT_LEAD3):
  25562. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25563. return -int32(2)
  25564. }
  25565. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25566. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25567. return m_XML_TOK_INVALID
  25568. }
  25569. ptr += uintptr(3)
  25570. case int32(_BT_LEAD4):
  25571. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25572. return -int32(2)
  25573. }
  25574. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25576. return m_XML_TOK_INVALID
  25577. }
  25578. ptr += uintptr(4)
  25579. case int32(_BT_S):
  25580. fallthrough
  25581. case int32(_BT_LF):
  25582. fallthrough
  25583. case int32(_BT_CR):
  25584. fallthrough
  25585. case int32(_BT_PERCNT):
  25586. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25587. return int32(m_XML_TOK_PERCENT)
  25588. default:
  25589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25590. return m_XML_TOK_INVALID
  25591. }
  25592. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25593. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25594. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25595. } else {
  25596. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25597. }
  25598. switch v2 {
  25599. case int32(_BT_NONASCII):
  25600. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25602. return m_XML_TOK_INVALID
  25603. } /* fall through */
  25604. fallthrough
  25605. case int32(_BT_NMSTRT):
  25606. fallthrough
  25607. case int32(_BT_HEX):
  25608. fallthrough
  25609. case int32(_BT_DIGIT):
  25610. fallthrough
  25611. case int32(_BT_NAME):
  25612. fallthrough
  25613. case int32(_BT_MINUS):
  25614. ptr += uintptr(2)
  25615. case int32(_BT_LEAD2):
  25616. if int64(end)-int64(ptr) < int64(2) {
  25617. return -int32(2)
  25618. }
  25619. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25621. return m_XML_TOK_INVALID
  25622. }
  25623. ptr += uintptr(2)
  25624. case int32(_BT_LEAD3):
  25625. if int64(end)-int64(ptr) < int64(3) {
  25626. return -int32(2)
  25627. }
  25628. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25630. return m_XML_TOK_INVALID
  25631. }
  25632. ptr += uintptr(3)
  25633. case int32(_BT_LEAD4):
  25634. if int64(end)-int64(ptr) < int64(4) {
  25635. return -int32(2)
  25636. }
  25637. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25639. return m_XML_TOK_INVALID
  25640. }
  25641. ptr += uintptr(4)
  25642. case int32(_BT_SEMI):
  25643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25644. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25645. default:
  25646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25647. return m_XML_TOK_INVALID
  25648. }
  25649. }
  25650. return -int32(1)
  25651. }
  25652. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25653. var v1, v2 int32
  25654. _, _ = v1, v2
  25655. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25656. return -int32(1)
  25657. }
  25658. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25659. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25660. } else {
  25661. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25662. }
  25663. switch v1 {
  25664. case int32(_BT_NONASCII):
  25665. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25666. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25667. return m_XML_TOK_INVALID
  25668. } /* fall through */
  25669. fallthrough
  25670. case int32(_BT_NMSTRT):
  25671. fallthrough
  25672. case int32(_BT_HEX):
  25673. ptr += uintptr(2)
  25674. case int32(_BT_LEAD2):
  25675. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25676. return -int32(2)
  25677. }
  25678. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25680. return m_XML_TOK_INVALID
  25681. }
  25682. ptr += uintptr(2)
  25683. case int32(_BT_LEAD3):
  25684. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25685. return -int32(2)
  25686. }
  25687. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25689. return m_XML_TOK_INVALID
  25690. }
  25691. ptr += uintptr(3)
  25692. case int32(_BT_LEAD4):
  25693. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25694. return -int32(2)
  25695. }
  25696. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25698. return m_XML_TOK_INVALID
  25699. }
  25700. ptr += uintptr(4)
  25701. default:
  25702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25703. return m_XML_TOK_INVALID
  25704. }
  25705. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25706. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25707. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25708. } else {
  25709. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25710. }
  25711. switch v2 {
  25712. case int32(_BT_NONASCII):
  25713. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25715. return m_XML_TOK_INVALID
  25716. } /* fall through */
  25717. fallthrough
  25718. case int32(_BT_NMSTRT):
  25719. fallthrough
  25720. case int32(_BT_HEX):
  25721. fallthrough
  25722. case int32(_BT_DIGIT):
  25723. fallthrough
  25724. case int32(_BT_NAME):
  25725. fallthrough
  25726. case int32(_BT_MINUS):
  25727. ptr += uintptr(2)
  25728. case int32(_BT_LEAD2):
  25729. if int64(end)-int64(ptr) < int64(2) {
  25730. return -int32(2)
  25731. }
  25732. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25733. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25734. return m_XML_TOK_INVALID
  25735. }
  25736. ptr += uintptr(2)
  25737. case int32(_BT_LEAD3):
  25738. if int64(end)-int64(ptr) < int64(3) {
  25739. return -int32(2)
  25740. }
  25741. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25743. return m_XML_TOK_INVALID
  25744. }
  25745. ptr += uintptr(3)
  25746. case int32(_BT_LEAD4):
  25747. if int64(end)-int64(ptr) < int64(4) {
  25748. return -int32(2)
  25749. }
  25750. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25752. return m_XML_TOK_INVALID
  25753. }
  25754. ptr += uintptr(4)
  25755. case int32(_BT_CR):
  25756. fallthrough
  25757. case int32(_BT_LF):
  25758. fallthrough
  25759. case int32(_BT_S):
  25760. fallthrough
  25761. case int32(_BT_RPAR):
  25762. fallthrough
  25763. case int32(_BT_GT):
  25764. fallthrough
  25765. case int32(_BT_PERCNT):
  25766. fallthrough
  25767. case int32(_BT_VERBAR):
  25768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25769. return int32(m_XML_TOK_POUND_NAME)
  25770. default:
  25771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25772. return m_XML_TOK_INVALID
  25773. }
  25774. }
  25775. return -int32(m_XML_TOK_POUND_NAME)
  25776. }
  25777. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25778. var t, v1, v2 int32
  25779. _, _, _ = t, v1, v2
  25780. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25781. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25782. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25783. } else {
  25784. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25785. }
  25786. t = v1
  25787. switch t {
  25788. case int32(_BT_LEAD2):
  25789. if int64(end)-int64(ptr) < int64(2) {
  25790. return -int32(2)
  25791. }
  25792. if 0 != 0 {
  25793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25794. return m_XML_TOK_INVALID
  25795. }
  25796. ptr += uintptr(2)
  25797. case int32(_BT_LEAD3):
  25798. if int64(end)-int64(ptr) < int64(3) {
  25799. return -int32(2)
  25800. }
  25801. if 0 != 0 {
  25802. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25803. return m_XML_TOK_INVALID
  25804. }
  25805. ptr += uintptr(3)
  25806. case int32(_BT_LEAD4):
  25807. if int64(end)-int64(ptr) < int64(4) {
  25808. return -int32(2)
  25809. }
  25810. if 0 != 0 {
  25811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25812. return m_XML_TOK_INVALID
  25813. }
  25814. ptr += uintptr(4)
  25815. case int32(_BT_NONXML):
  25816. fallthrough
  25817. case int32(_BT_MALFORM):
  25818. fallthrough
  25819. case int32(_BT_TRAIL):
  25820. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25821. return m_XML_TOK_INVALID
  25822. case int32(_BT_QUOT):
  25823. fallthrough
  25824. case int32(_BT_APOS):
  25825. ptr += uintptr(2)
  25826. if t != open {
  25827. break
  25828. }
  25829. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25830. return -int32(m_XML_TOK_LITERAL)
  25831. }
  25832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25833. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25834. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25835. } else {
  25836. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25837. }
  25838. switch v2 {
  25839. case int32(_BT_S):
  25840. fallthrough
  25841. case int32(_BT_CR):
  25842. fallthrough
  25843. case int32(_BT_LF):
  25844. fallthrough
  25845. case int32(_BT_GT):
  25846. fallthrough
  25847. case int32(_BT_PERCNT):
  25848. fallthrough
  25849. case int32(_BT_LSQB):
  25850. return int32(m_XML_TOK_LITERAL)
  25851. default:
  25852. return m_XML_TOK_INVALID
  25853. }
  25854. fallthrough
  25855. default:
  25856. ptr += uintptr(2)
  25857. break
  25858. }
  25859. }
  25860. return -int32(1)
  25861. }
  25862. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25863. var n Tsize_t
  25864. var tok, v1, v29, v33, v34, v35, v36 int32
  25865. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25866. if ptr >= end {
  25867. return -int32(4)
  25868. }
  25869. if int32(2) > int32(1) {
  25870. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25871. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25872. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25873. if n == uint64(0) {
  25874. return -int32(1)
  25875. }
  25876. end = ptr + uintptr(n)
  25877. }
  25878. }
  25879. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25880. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25881. } else {
  25882. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25883. }
  25884. switch v1 {
  25885. case int32(_BT_QUOT):
  25886. goto _2
  25887. case int32(_BT_APOS):
  25888. goto _3
  25889. case int32(_BT_LT):
  25890. goto _4
  25891. case int32(_BT_CR):
  25892. goto _5
  25893. case int32(_BT_LF):
  25894. goto _6
  25895. case int32(_BT_S):
  25896. goto _7
  25897. case int32(_BT_PERCNT):
  25898. goto _8
  25899. case int32(_BT_COMMA):
  25900. goto _9
  25901. case int32(_BT_LSQB):
  25902. goto _10
  25903. case int32(_BT_RSQB):
  25904. goto _11
  25905. case int32(_BT_LPAR):
  25906. goto _12
  25907. case int32(_BT_RPAR):
  25908. goto _13
  25909. case int32(_BT_VERBAR):
  25910. goto _14
  25911. case int32(_BT_GT):
  25912. goto _15
  25913. case int32(_BT_NUM):
  25914. goto _16
  25915. case int32(_BT_LEAD2):
  25916. goto _17
  25917. case int32(_BT_LEAD3):
  25918. goto _18
  25919. case int32(_BT_LEAD4):
  25920. goto _19
  25921. case int32(_BT_HEX):
  25922. goto _20
  25923. case int32(_BT_NMSTRT):
  25924. goto _21
  25925. case int32(_BT_COLON):
  25926. goto _22
  25927. case int32(_BT_MINUS):
  25928. goto _23
  25929. case int32(_BT_NAME):
  25930. goto _24
  25931. case int32(_BT_DIGIT):
  25932. goto _25
  25933. case int32(_BT_NONASCII):
  25934. goto _26
  25935. default:
  25936. goto _27
  25937. }
  25938. goto _28
  25939. _2:
  25940. ;
  25941. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25942. _3:
  25943. ;
  25944. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25945. _4:
  25946. ;
  25947. ptr += uintptr(2)
  25948. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25949. return -int32(1)
  25950. }
  25951. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25952. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25953. } else {
  25954. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25955. }
  25956. switch v29 {
  25957. case int32(_BT_EXCL):
  25958. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25959. case int32(_BT_QUEST):
  25960. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25961. case int32(_BT_NMSTRT):
  25962. fallthrough
  25963. case int32(_BT_HEX):
  25964. fallthrough
  25965. case int32(_BT_NONASCII):
  25966. fallthrough
  25967. case int32(_BT_LEAD2):
  25968. fallthrough
  25969. case int32(_BT_LEAD3):
  25970. fallthrough
  25971. case int32(_BT_LEAD4):
  25972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25973. return int32(m_XML_TOK_INSTANCE_START)
  25974. }
  25975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25976. return m_XML_TOK_INVALID
  25977. _5:
  25978. ;
  25979. if ptr+uintptr(2) == end {
  25980. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25981. /* indicate that this might be part of a CR/LF pair */
  25982. return -int32(m_XML_TOK_PROLOG_S)
  25983. }
  25984. /* fall through */
  25985. _7:
  25986. ;
  25987. _6:
  25988. ;
  25989. _32:
  25990. ;
  25991. ptr += uintptr(2)
  25992. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25993. goto _30
  25994. }
  25995. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25996. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25997. } else {
  25998. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25999. }
  26000. switch v33 {
  26001. case int32(_BT_S):
  26002. fallthrough
  26003. case int32(_BT_LF):
  26004. case int32(_BT_CR):
  26005. /* don't split CR/LF pair */
  26006. if ptr+uintptr(2) != end {
  26007. break
  26008. }
  26009. /* fall through */
  26010. fallthrough
  26011. default:
  26012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26013. return int32(m_XML_TOK_PROLOG_S)
  26014. }
  26015. goto _31
  26016. _31:
  26017. ;
  26018. goto _32
  26019. goto _30
  26020. _30:
  26021. ;
  26022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26023. return int32(m_XML_TOK_PROLOG_S)
  26024. _8:
  26025. ;
  26026. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26027. _9:
  26028. ;
  26029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26030. return int32(m_XML_TOK_COMMA)
  26031. _10:
  26032. ;
  26033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26034. return int32(m_XML_TOK_OPEN_BRACKET)
  26035. _11:
  26036. ;
  26037. ptr += uintptr(2)
  26038. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26039. return -int32(m_XML_TOK_CLOSE_BRACKET)
  26040. }
  26041. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26042. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  26043. return -int32(1)
  26044. }
  26045. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  26046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  26047. return int32(m_XML_TOK_COND_SECT_CLOSE)
  26048. }
  26049. }
  26050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26051. return int32(m_XML_TOK_CLOSE_BRACKET)
  26052. _12:
  26053. ;
  26054. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26055. return int32(m_XML_TOK_OPEN_PAREN)
  26056. _13:
  26057. ;
  26058. ptr += uintptr(2)
  26059. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26060. return -int32(m_XML_TOK_CLOSE_PAREN)
  26061. }
  26062. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26063. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26064. } else {
  26065. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26066. }
  26067. switch v34 {
  26068. case int32(_BT_AST):
  26069. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26070. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  26071. case int32(_BT_QUEST):
  26072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26073. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  26074. case int32(_BT_PLUS):
  26075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26076. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  26077. case int32(_BT_CR):
  26078. fallthrough
  26079. case int32(_BT_LF):
  26080. fallthrough
  26081. case int32(_BT_S):
  26082. fallthrough
  26083. case int32(_BT_GT):
  26084. fallthrough
  26085. case int32(_BT_COMMA):
  26086. fallthrough
  26087. case int32(_BT_VERBAR):
  26088. fallthrough
  26089. case int32(_BT_RPAR):
  26090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26091. return int32(m_XML_TOK_CLOSE_PAREN)
  26092. }
  26093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26094. return m_XML_TOK_INVALID
  26095. _14:
  26096. ;
  26097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26098. return int32(m_XML_TOK_OR)
  26099. _15:
  26100. ;
  26101. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26102. return int32(m_XML_TOK_DECL_CLOSE)
  26103. _16:
  26104. ;
  26105. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26106. _17:
  26107. ;
  26108. if int64(end)-int64(ptr) < int64(2) {
  26109. return -int32(2)
  26110. }
  26111. if 0 != 0 {
  26112. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26113. return m_XML_TOK_INVALID
  26114. }
  26115. if 0 != 0 {
  26116. ptr += uintptr(2)
  26117. tok = int32(m_XML_TOK_NAME)
  26118. goto _28
  26119. }
  26120. if 0 != 0 {
  26121. ptr += uintptr(2)
  26122. tok = int32(m_XML_TOK_NMTOKEN)
  26123. goto _28
  26124. }
  26125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26126. return m_XML_TOK_INVALID
  26127. _18:
  26128. ;
  26129. if int64(end)-int64(ptr) < int64(3) {
  26130. return -int32(2)
  26131. }
  26132. if 0 != 0 {
  26133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26134. return m_XML_TOK_INVALID
  26135. }
  26136. if 0 != 0 {
  26137. ptr += uintptr(3)
  26138. tok = int32(m_XML_TOK_NAME)
  26139. goto _28
  26140. }
  26141. if 0 != 0 {
  26142. ptr += uintptr(3)
  26143. tok = int32(m_XML_TOK_NMTOKEN)
  26144. goto _28
  26145. }
  26146. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26147. return m_XML_TOK_INVALID
  26148. _19:
  26149. ;
  26150. if int64(end)-int64(ptr) < int64(4) {
  26151. return -int32(2)
  26152. }
  26153. if 0 != 0 {
  26154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26155. return m_XML_TOK_INVALID
  26156. }
  26157. if 0 != 0 {
  26158. ptr += uintptr(4)
  26159. tok = int32(m_XML_TOK_NAME)
  26160. goto _28
  26161. }
  26162. if 0 != 0 {
  26163. ptr += uintptr(4)
  26164. tok = int32(m_XML_TOK_NMTOKEN)
  26165. goto _28
  26166. }
  26167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26168. return m_XML_TOK_INVALID
  26169. _21:
  26170. ;
  26171. _20:
  26172. ;
  26173. tok = int32(m_XML_TOK_NAME)
  26174. ptr += uintptr(2)
  26175. goto _28
  26176. _25:
  26177. ;
  26178. _24:
  26179. ;
  26180. _23:
  26181. ;
  26182. _22:
  26183. ;
  26184. tok = int32(m_XML_TOK_NMTOKEN)
  26185. ptr += uintptr(2)
  26186. goto _28
  26187. _26:
  26188. ;
  26189. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  26190. ptr += uintptr(2)
  26191. tok = int32(m_XML_TOK_NAME)
  26192. goto _28
  26193. }
  26194. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  26195. ptr += uintptr(2)
  26196. tok = int32(m_XML_TOK_NMTOKEN)
  26197. goto _28
  26198. }
  26199. /* fall through */
  26200. _27:
  26201. ;
  26202. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26203. return m_XML_TOK_INVALID
  26204. _28:
  26205. ;
  26206. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26207. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26208. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26209. } else {
  26210. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26211. }
  26212. switch v35 {
  26213. case int32(_BT_NONASCII):
  26214. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26216. return m_XML_TOK_INVALID
  26217. } /* fall through */
  26218. fallthrough
  26219. case int32(_BT_NMSTRT):
  26220. fallthrough
  26221. case int32(_BT_HEX):
  26222. fallthrough
  26223. case int32(_BT_DIGIT):
  26224. fallthrough
  26225. case int32(_BT_NAME):
  26226. fallthrough
  26227. case int32(_BT_MINUS):
  26228. ptr += uintptr(2)
  26229. case int32(_BT_LEAD2):
  26230. if int64(end)-int64(ptr) < int64(2) {
  26231. return -int32(2)
  26232. }
  26233. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26234. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26235. return m_XML_TOK_INVALID
  26236. }
  26237. ptr += uintptr(2)
  26238. case int32(_BT_LEAD3):
  26239. if int64(end)-int64(ptr) < int64(3) {
  26240. return -int32(2)
  26241. }
  26242. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26244. return m_XML_TOK_INVALID
  26245. }
  26246. ptr += uintptr(3)
  26247. case int32(_BT_LEAD4):
  26248. if int64(end)-int64(ptr) < int64(4) {
  26249. return -int32(2)
  26250. }
  26251. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26252. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26253. return m_XML_TOK_INVALID
  26254. }
  26255. ptr += uintptr(4)
  26256. case int32(_BT_GT):
  26257. fallthrough
  26258. case int32(_BT_RPAR):
  26259. fallthrough
  26260. case int32(_BT_COMMA):
  26261. fallthrough
  26262. case int32(_BT_VERBAR):
  26263. fallthrough
  26264. case int32(_BT_LSQB):
  26265. fallthrough
  26266. case int32(_BT_PERCNT):
  26267. fallthrough
  26268. case int32(_BT_S):
  26269. fallthrough
  26270. case int32(_BT_CR):
  26271. fallthrough
  26272. case int32(_BT_LF):
  26273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26274. return tok
  26275. case int32(_BT_COLON):
  26276. ptr += uintptr(2)
  26277. switch tok {
  26278. case int32(m_XML_TOK_NAME):
  26279. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26280. return -int32(1)
  26281. }
  26282. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26283. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26284. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26285. } else {
  26286. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26287. }
  26288. switch v36 {
  26289. case int32(_BT_NONASCII):
  26290. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26291. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26292. return m_XML_TOK_INVALID
  26293. } /* fall through */
  26294. fallthrough
  26295. case int32(_BT_NMSTRT):
  26296. fallthrough
  26297. case int32(_BT_HEX):
  26298. fallthrough
  26299. case int32(_BT_DIGIT):
  26300. fallthrough
  26301. case int32(_BT_NAME):
  26302. fallthrough
  26303. case int32(_BT_MINUS):
  26304. ptr += uintptr(2)
  26305. case int32(_BT_LEAD2):
  26306. if int64(end)-int64(ptr) < int64(2) {
  26307. return -int32(2)
  26308. }
  26309. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26310. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26311. return m_XML_TOK_INVALID
  26312. }
  26313. ptr += uintptr(2)
  26314. case int32(_BT_LEAD3):
  26315. if int64(end)-int64(ptr) < int64(3) {
  26316. return -int32(2)
  26317. }
  26318. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26320. return m_XML_TOK_INVALID
  26321. }
  26322. ptr += uintptr(3)
  26323. case int32(_BT_LEAD4):
  26324. if int64(end)-int64(ptr) < int64(4) {
  26325. return -int32(2)
  26326. }
  26327. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26329. return m_XML_TOK_INVALID
  26330. }
  26331. ptr += uintptr(4)
  26332. default:
  26333. tok = int32(m_XML_TOK_NMTOKEN)
  26334. break
  26335. }
  26336. case int32(m_XML_TOK_PREFIXED_NAME):
  26337. tok = int32(m_XML_TOK_NMTOKEN)
  26338. break
  26339. }
  26340. case int32(_BT_PLUS):
  26341. if tok == int32(m_XML_TOK_NMTOKEN) {
  26342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26343. return m_XML_TOK_INVALID
  26344. }
  26345. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26346. return int32(m_XML_TOK_NAME_PLUS)
  26347. case int32(_BT_AST):
  26348. if tok == int32(m_XML_TOK_NMTOKEN) {
  26349. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26350. return m_XML_TOK_INVALID
  26351. }
  26352. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26353. return int32(m_XML_TOK_NAME_ASTERISK)
  26354. case int32(_BT_QUEST):
  26355. if tok == int32(m_XML_TOK_NMTOKEN) {
  26356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26357. return m_XML_TOK_INVALID
  26358. }
  26359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26360. return int32(m_XML_TOK_NAME_QUESTION)
  26361. default:
  26362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26363. return m_XML_TOK_INVALID
  26364. }
  26365. }
  26366. return -tok
  26367. }
  26368. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26369. var start uintptr
  26370. var v1, v2 int32
  26371. _, _, _ = start, v1, v2
  26372. if ptr >= end {
  26373. return -int32(4)
  26374. } else {
  26375. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26376. /* This line cannot be executed. The incoming data has already
  26377. * been tokenized once, so incomplete characters like this have
  26378. * already been eliminated from the input. Retaining the paranoia
  26379. * check is still valuable, however.
  26380. */
  26381. return -int32(1) /* LCOV_EXCL_LINE */
  26382. }
  26383. }
  26384. start = ptr
  26385. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26386. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26387. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26388. } else {
  26389. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26390. }
  26391. switch v1 {
  26392. case int32(_BT_LEAD2):
  26393. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26394. case int32(_BT_LEAD3):
  26395. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26396. case int32(_BT_LEAD4):
  26397. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26398. case int32(_BT_AMP):
  26399. if ptr == start {
  26400. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26401. }
  26402. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26403. return int32(m_XML_TOK_DATA_CHARS)
  26404. case int32(_BT_LT):
  26405. /* this is for inside entity references */
  26406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26407. return m_XML_TOK_INVALID
  26408. case int32(_BT_LF):
  26409. if ptr == start {
  26410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26411. return int32(m_XML_TOK_DATA_NEWLINE)
  26412. }
  26413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26414. return int32(m_XML_TOK_DATA_CHARS)
  26415. case int32(_BT_CR):
  26416. if ptr == start {
  26417. ptr += uintptr(2)
  26418. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26419. return -int32(3)
  26420. }
  26421. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26422. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26423. } else {
  26424. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26425. }
  26426. if v2 == int32(_BT_LF) {
  26427. ptr += uintptr(2)
  26428. }
  26429. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26430. return int32(m_XML_TOK_DATA_NEWLINE)
  26431. }
  26432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26433. return int32(m_XML_TOK_DATA_CHARS)
  26434. case int32(_BT_S):
  26435. if ptr == start {
  26436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26437. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26438. }
  26439. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26440. return int32(m_XML_TOK_DATA_CHARS)
  26441. default:
  26442. ptr += uintptr(2)
  26443. break
  26444. }
  26445. }
  26446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26447. return int32(m_XML_TOK_DATA_CHARS)
  26448. }
  26449. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26450. var start uintptr
  26451. var tok, v1, v2, v3 int32
  26452. _, _, _, _, _ = start, tok, v1, v2, v3
  26453. if ptr >= end {
  26454. return -int32(4)
  26455. } else {
  26456. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26457. /* This line cannot be executed. The incoming data has already
  26458. * been tokenized once, so incomplete characters like this have
  26459. * already been eliminated from the input. Retaining the paranoia
  26460. * check is still valuable, however.
  26461. */
  26462. return -int32(1) /* LCOV_EXCL_LINE */
  26463. }
  26464. }
  26465. start = ptr
  26466. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26467. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26468. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26469. } else {
  26470. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26471. }
  26472. switch v1 {
  26473. case int32(_BT_LEAD2):
  26474. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26475. case int32(_BT_LEAD3):
  26476. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26477. case int32(_BT_LEAD4):
  26478. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26479. case int32(_BT_AMP):
  26480. if ptr == start {
  26481. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26482. }
  26483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26484. return int32(m_XML_TOK_DATA_CHARS)
  26485. case int32(_BT_PERCNT):
  26486. if ptr == start {
  26487. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26488. if tok == int32(m_XML_TOK_PERCENT) {
  26489. v2 = m_XML_TOK_INVALID
  26490. } else {
  26491. v2 = tok
  26492. }
  26493. return v2
  26494. }
  26495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26496. return int32(m_XML_TOK_DATA_CHARS)
  26497. case int32(_BT_LF):
  26498. if ptr == start {
  26499. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26500. return int32(m_XML_TOK_DATA_NEWLINE)
  26501. }
  26502. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26503. return int32(m_XML_TOK_DATA_CHARS)
  26504. case int32(_BT_CR):
  26505. if ptr == start {
  26506. ptr += uintptr(2)
  26507. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26508. return -int32(3)
  26509. }
  26510. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26511. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26512. } else {
  26513. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26514. }
  26515. if v3 == int32(_BT_LF) {
  26516. ptr += uintptr(2)
  26517. }
  26518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26519. return int32(m_XML_TOK_DATA_NEWLINE)
  26520. }
  26521. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26522. return int32(m_XML_TOK_DATA_CHARS)
  26523. default:
  26524. ptr += uintptr(2)
  26525. break
  26526. }
  26527. }
  26528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26529. return int32(m_XML_TOK_DATA_CHARS)
  26530. }
  26531. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26532. var level, v1 int32
  26533. var n Tsize_t
  26534. _, _, _ = level, n, v1
  26535. level = 0
  26536. if int32(2) > int32(1) {
  26537. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  26538. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26539. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26540. end = ptr + uintptr(n)
  26541. }
  26542. }
  26543. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26544. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26545. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26546. } else {
  26547. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26548. }
  26549. switch v1 {
  26550. case int32(_BT_LEAD2):
  26551. if int64(end)-int64(ptr) < int64(2) {
  26552. return -int32(2)
  26553. }
  26554. if 0 != 0 {
  26555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26556. return m_XML_TOK_INVALID
  26557. }
  26558. ptr += uintptr(2)
  26559. case int32(_BT_LEAD3):
  26560. if int64(end)-int64(ptr) < int64(3) {
  26561. return -int32(2)
  26562. }
  26563. if 0 != 0 {
  26564. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26565. return m_XML_TOK_INVALID
  26566. }
  26567. ptr += uintptr(3)
  26568. case int32(_BT_LEAD4):
  26569. if int64(end)-int64(ptr) < int64(4) {
  26570. return -int32(2)
  26571. }
  26572. if 0 != 0 {
  26573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26574. return m_XML_TOK_INVALID
  26575. }
  26576. ptr += uintptr(4)
  26577. case int32(_BT_NONXML):
  26578. fallthrough
  26579. case int32(_BT_MALFORM):
  26580. fallthrough
  26581. case int32(_BT_TRAIL):
  26582. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26583. return m_XML_TOK_INVALID
  26584. case int32(_BT_LT):
  26585. ptr += uintptr(2)
  26586. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26587. return -int32(1)
  26588. }
  26589. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26590. ptr += uintptr(2)
  26591. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26592. return -int32(1)
  26593. }
  26594. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26595. level++
  26596. ptr += uintptr(2)
  26597. }
  26598. }
  26599. case int32(_BT_RSQB):
  26600. ptr += uintptr(2)
  26601. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26602. return -int32(1)
  26603. }
  26604. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26605. ptr += uintptr(2)
  26606. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26607. return -int32(1)
  26608. }
  26609. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26610. ptr += uintptr(2)
  26611. if level == 0 {
  26612. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26613. return int32(m_XML_TOK_IGNORE_SECT)
  26614. }
  26615. level--
  26616. }
  26617. }
  26618. default:
  26619. ptr += uintptr(2)
  26620. break
  26621. }
  26622. }
  26623. return -int32(1)
  26624. }
  26625. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26626. var v2, v3, v4 int32
  26627. _, _, _ = v2, v3, v4
  26628. ptr += uintptr(2)
  26629. end -= uintptr(2)
  26630. for {
  26631. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26632. break
  26633. }
  26634. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26635. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26636. } else {
  26637. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26638. }
  26639. switch v2 {
  26640. case int32(_BT_DIGIT):
  26641. fallthrough
  26642. case int32(_BT_HEX):
  26643. fallthrough
  26644. case int32(_BT_MINUS):
  26645. fallthrough
  26646. case int32(_BT_APOS):
  26647. fallthrough
  26648. case int32(_BT_LPAR):
  26649. fallthrough
  26650. case int32(_BT_RPAR):
  26651. fallthrough
  26652. case int32(_BT_PLUS):
  26653. fallthrough
  26654. case int32(_BT_COMMA):
  26655. fallthrough
  26656. case int32(_BT_SOL):
  26657. fallthrough
  26658. case int32(_BT_EQUALS):
  26659. fallthrough
  26660. case int32(_BT_QUEST):
  26661. fallthrough
  26662. case int32(_BT_CR):
  26663. fallthrough
  26664. case int32(_BT_LF):
  26665. fallthrough
  26666. case int32(_BT_SEMI):
  26667. fallthrough
  26668. case int32(_BT_EXCL):
  26669. fallthrough
  26670. case int32(_BT_AST):
  26671. fallthrough
  26672. case int32(_BT_PERCNT):
  26673. fallthrough
  26674. case int32(_BT_NUM):
  26675. fallthrough
  26676. case int32(_BT_COLON):
  26677. case int32(_BT_S):
  26678. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26679. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26680. return 0
  26681. }
  26682. case int32(_BT_NAME):
  26683. fallthrough
  26684. case int32(_BT_NMSTRT):
  26685. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26686. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26687. } else {
  26688. v3 = -int32(1)
  26689. }
  26690. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26691. break
  26692. }
  26693. /* fall through */
  26694. fallthrough
  26695. default:
  26696. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26697. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26698. } else {
  26699. v4 = -int32(1)
  26700. }
  26701. switch v4 {
  26702. case int32(0x24): /* $ */
  26703. fallthrough
  26704. case int32(0x40): /* @ */
  26705. default:
  26706. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26707. return 0
  26708. }
  26709. break
  26710. }
  26711. goto _1
  26712. _1:
  26713. ;
  26714. ptr += uintptr(2)
  26715. }
  26716. return int32(1)
  26717. }
  26718. /* This must only be called for a well-formed start-tag or empty
  26719. element tag. Returns the number of attributes. Pointers to the
  26720. first attsMax attributes are stored in atts.
  26721. */
  26722. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26723. var nAtts, open, state, v2, v3, v5, v7 int32
  26724. var v4, v6, v8, v9 bool
  26725. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26726. state = 1
  26727. nAtts = 0
  26728. open = 0 /* defined when state == inValue;
  26729. initialization just to shut up compilers */
  26730. ptr += uintptr(2)
  26731. for {
  26732. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26733. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26734. } else {
  26735. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26736. }
  26737. switch v2 {
  26738. case int32(_BT_LEAD2):
  26739. if state == 0 {
  26740. if nAtts < attsMax {
  26741. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26742. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26743. }
  26744. state = 1
  26745. }
  26746. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26747. case int32(_BT_LEAD3):
  26748. if state == 0 {
  26749. if nAtts < attsMax {
  26750. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26751. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26752. }
  26753. state = 1
  26754. }
  26755. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26756. case int32(_BT_LEAD4):
  26757. if state == 0 {
  26758. if nAtts < attsMax {
  26759. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26760. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26761. }
  26762. state = 1
  26763. }
  26764. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26765. case int32(_BT_NONASCII):
  26766. fallthrough
  26767. case int32(_BT_NMSTRT):
  26768. fallthrough
  26769. case int32(_BT_HEX):
  26770. if state == 0 {
  26771. if nAtts < attsMax {
  26772. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26773. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26774. }
  26775. state = 1
  26776. }
  26777. case int32(_BT_QUOT):
  26778. if state != 2 {
  26779. if nAtts < attsMax {
  26780. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26781. }
  26782. state = 2
  26783. open = int32(_BT_QUOT)
  26784. } else {
  26785. if open == int32(_BT_QUOT) {
  26786. state = 0
  26787. if nAtts < attsMax {
  26788. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26789. }
  26790. nAtts++
  26791. }
  26792. }
  26793. case int32(_BT_APOS):
  26794. if state != 2 {
  26795. if nAtts < attsMax {
  26796. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26797. }
  26798. state = 2
  26799. open = int32(_BT_APOS)
  26800. } else {
  26801. if open == int32(_BT_APOS) {
  26802. state = 0
  26803. if nAtts < attsMax {
  26804. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26805. }
  26806. nAtts++
  26807. }
  26808. }
  26809. case int32(_BT_AMP):
  26810. if nAtts < attsMax {
  26811. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26812. }
  26813. case int32(_BT_S):
  26814. if state == 1 {
  26815. state = 0
  26816. } else {
  26817. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  26818. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  26819. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26820. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26821. } else {
  26822. v3 = -int32(1)
  26823. }
  26824. }
  26825. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26826. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26827. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26828. } else {
  26829. v5 = -int32(1)
  26830. }
  26831. }
  26832. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26833. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26834. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  26835. } else {
  26836. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26837. }
  26838. }
  26839. }
  26840. if v9 && (v8 || v7 == open) {
  26841. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26842. }
  26843. }
  26844. case int32(_BT_CR):
  26845. fallthrough
  26846. case int32(_BT_LF):
  26847. /* This case ensures that the first attribute name is counted
  26848. Apart from that we could just change state on the quote. */
  26849. if state == 1 {
  26850. state = 0
  26851. } else {
  26852. if state == 2 && nAtts < attsMax {
  26853. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26854. }
  26855. }
  26856. case int32(_BT_GT):
  26857. fallthrough
  26858. case int32(_BT_SOL):
  26859. if state != 2 {
  26860. return nAtts
  26861. }
  26862. default:
  26863. break
  26864. }
  26865. goto _1
  26866. _1:
  26867. ;
  26868. ptr += uintptr(2)
  26869. }
  26870. /* not reached */
  26871. return r
  26872. }
  26873. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26874. var c, c1, result, v2, v4 int32
  26875. _, _, _, _, _ = c, c1, result, v2, v4
  26876. result = 0
  26877. /* skip &# */
  26878. _ = enc
  26879. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26880. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26881. ptr += uintptr(2)
  26882. for {
  26883. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26884. break
  26885. }
  26886. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26887. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26888. } else {
  26889. v2 = -int32(1)
  26890. }
  26891. c = v2
  26892. switch c {
  26893. case int32(m_ASCII_02):
  26894. fallthrough
  26895. case int32(m_ASCII_12):
  26896. fallthrough
  26897. case int32(m_ASCII_22):
  26898. fallthrough
  26899. case int32(m_ASCII_32):
  26900. fallthrough
  26901. case int32(m_ASCII_41):
  26902. fallthrough
  26903. case int32(m_ASCII_51):
  26904. fallthrough
  26905. case int32(m_ASCII_61):
  26906. fallthrough
  26907. case int32(m_ASCII_71):
  26908. fallthrough
  26909. case int32(m_ASCII_82):
  26910. fallthrough
  26911. case int32(m_ASCII_92):
  26912. result <<= int32(4)
  26913. result |= c - int32(m_ASCII_02)
  26914. case int32(m_ASCII_A):
  26915. fallthrough
  26916. case int32(m_ASCII_B1):
  26917. fallthrough
  26918. case int32(m_ASCII_C):
  26919. fallthrough
  26920. case int32(m_ASCII_D):
  26921. fallthrough
  26922. case int32(m_ASCII_E):
  26923. fallthrough
  26924. case int32(m_ASCII_F):
  26925. result <<= int32(4)
  26926. result += int32(10) + (c - int32(m_ASCII_A))
  26927. case int32(m_ASCII_a2):
  26928. fallthrough
  26929. case int32(m_ASCII_b1):
  26930. fallthrough
  26931. case int32(m_ASCII_c2):
  26932. fallthrough
  26933. case int32(m_ASCII_d1):
  26934. fallthrough
  26935. case int32(m_ASCII_e2):
  26936. fallthrough
  26937. case int32(m_ASCII_f1):
  26938. result <<= int32(4)
  26939. result += int32(10) + (c - int32(m_ASCII_a2))
  26940. break
  26941. }
  26942. if result >= int32(0x110000) {
  26943. return -int32(1)
  26944. }
  26945. goto _1
  26946. _1:
  26947. ;
  26948. ptr += uintptr(2)
  26949. }
  26950. } else {
  26951. for {
  26952. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26953. break
  26954. }
  26955. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26956. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26957. } else {
  26958. v4 = -int32(1)
  26959. }
  26960. c1 = v4
  26961. result *= int32(10)
  26962. result += c1 - int32(m_ASCII_02)
  26963. if result >= int32(0x110000) {
  26964. return -int32(1)
  26965. }
  26966. goto _3
  26967. _3:
  26968. ;
  26969. ptr += uintptr(2)
  26970. }
  26971. }
  26972. return _checkCharRefNumber(tls, result)
  26973. }
  26974. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26975. var v1, v2 int32
  26976. _, _ = v1, v2
  26977. _ = enc
  26978. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  26979. case int64(2):
  26980. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26981. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26982. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26983. } else {
  26984. v1 = -int32(1)
  26985. }
  26986. switch v1 {
  26987. case int32(m_ASCII_l2):
  26988. return int32(m_ASCII_LT1)
  26989. case int32(m_ASCII_g2):
  26990. return int32(m_ASCII_GT1)
  26991. }
  26992. }
  26993. case int64(3):
  26994. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26995. ptr += uintptr(2)
  26996. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26997. ptr += uintptr(2)
  26998. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26999. return int32(m_ASCII_AMP1)
  27000. }
  27001. }
  27002. }
  27003. case int64(4):
  27004. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27005. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  27006. } else {
  27007. v2 = -int32(1)
  27008. }
  27009. switch v2 {
  27010. case int32(m_ASCII_q1):
  27011. ptr += uintptr(2)
  27012. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  27013. ptr += uintptr(2)
  27014. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  27015. ptr += uintptr(2)
  27016. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  27017. return int32(m_ASCII_QUOT1)
  27018. }
  27019. }
  27020. }
  27021. case int32(m_ASCII_a2):
  27022. ptr += uintptr(2)
  27023. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  27024. ptr += uintptr(2)
  27025. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  27026. ptr += uintptr(2)
  27027. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  27028. return int32(m_ASCII_APOS1)
  27029. }
  27030. }
  27031. }
  27032. break
  27033. }
  27034. }
  27035. return 0
  27036. }
  27037. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  27038. _ = enc
  27039. for {
  27040. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  27041. break
  27042. }
  27043. if int64(end1)-int64(ptr1) < int64(2) {
  27044. /* This line cannot be executed. The incoming data has already
  27045. * been tokenized once, so incomplete characters like this have
  27046. * already been eliminated from the input. Retaining the
  27047. * paranoia check is still valuable, however.
  27048. */
  27049. return 0 /* LCOV_EXCL_LINE */
  27050. }
  27051. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  27052. return 0
  27053. }
  27054. goto _1
  27055. _1:
  27056. ;
  27057. ptr1 += uintptr(2)
  27058. ptr2++
  27059. }
  27060. return libc.BoolInt32(ptr1 == end1)
  27061. }
  27062. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  27063. var start uintptr
  27064. var v2 int32
  27065. _, _ = start, v2
  27066. start = ptr
  27067. for {
  27068. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27069. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27070. } else {
  27071. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27072. }
  27073. switch v2 {
  27074. case int32(_BT_LEAD2):
  27075. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  27076. case int32(_BT_LEAD3):
  27077. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  27078. case int32(_BT_LEAD4):
  27079. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  27080. case int32(_BT_NONASCII):
  27081. fallthrough
  27082. case int32(_BT_NMSTRT):
  27083. fallthrough
  27084. case int32(_BT_COLON):
  27085. fallthrough
  27086. case int32(_BT_HEX):
  27087. fallthrough
  27088. case int32(_BT_DIGIT):
  27089. fallthrough
  27090. case int32(_BT_NAME):
  27091. fallthrough
  27092. case int32(_BT_MINUS):
  27093. ptr += uintptr(2)
  27094. default:
  27095. return int32(int64(ptr) - int64(start))
  27096. }
  27097. goto _1
  27098. _1:
  27099. }
  27100. return r
  27101. }
  27102. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  27103. var v2 int32
  27104. _ = v2
  27105. for {
  27106. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27107. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27108. } else {
  27109. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27110. }
  27111. switch v2 {
  27112. case int32(_BT_LF):
  27113. fallthrough
  27114. case int32(_BT_CR):
  27115. fallthrough
  27116. case int32(_BT_S):
  27117. ptr += uintptr(2)
  27118. default:
  27119. return ptr
  27120. }
  27121. goto _1
  27122. _1:
  27123. }
  27124. return r
  27125. }
  27126. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27127. var v1, v2 int32
  27128. var v3 bool
  27129. _, _, _ = v1, v2, v3
  27130. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  27131. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27132. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27133. } else {
  27134. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27135. }
  27136. switch v1 {
  27137. case int32(_BT_LEAD2):
  27138. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  27139. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  27140. case int32(_BT_LEAD3):
  27141. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  27142. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  27143. case int32(_BT_LEAD4):
  27144. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  27145. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  27146. case int32(_BT_LF):
  27147. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  27148. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  27149. ptr += uintptr(2)
  27150. case int32(_BT_CR):
  27151. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  27152. ptr += uintptr(2)
  27153. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  27154. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  27155. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  27156. } else {
  27157. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  27158. }
  27159. }
  27160. if v3 && v2 == int32(_BT_LF) {
  27161. ptr += uintptr(2)
  27162. }
  27163. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  27164. default:
  27165. ptr += uintptr(2)
  27166. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  27167. break
  27168. }
  27169. }
  27170. }
  27171. var _big2_encoding_ns = Tnormal_encoding{
  27172. Fenc: TENCODING{
  27173. Fscanners: [4]TSCANNER{},
  27174. FliteralScanners: [2]TSCANNER{},
  27175. FminBytesPerChar: int32(2),
  27176. },
  27177. Ftype1: [256]uint8{
  27178. 9: uint8(_BT_S),
  27179. 10: uint8(_BT_LF),
  27180. 13: uint8(_BT_CR),
  27181. 32: uint8(_BT_S),
  27182. 33: uint8(_BT_EXCL),
  27183. 34: uint8(_BT_QUOT),
  27184. 35: uint8(_BT_NUM),
  27185. 36: uint8(_BT_OTHER),
  27186. 37: uint8(_BT_PERCNT),
  27187. 38: uint8(_BT_AMP),
  27188. 39: uint8(_BT_APOS),
  27189. 40: uint8(_BT_LPAR),
  27190. 41: uint8(_BT_RPAR),
  27191. 42: uint8(_BT_AST),
  27192. 43: uint8(_BT_PLUS),
  27193. 44: uint8(_BT_COMMA),
  27194. 45: uint8(_BT_MINUS),
  27195. 46: uint8(_BT_NAME),
  27196. 47: uint8(_BT_SOL),
  27197. 48: uint8(_BT_DIGIT),
  27198. 49: uint8(_BT_DIGIT),
  27199. 50: uint8(_BT_DIGIT),
  27200. 51: uint8(_BT_DIGIT),
  27201. 52: uint8(_BT_DIGIT),
  27202. 53: uint8(_BT_DIGIT),
  27203. 54: uint8(_BT_DIGIT),
  27204. 55: uint8(_BT_DIGIT),
  27205. 56: uint8(_BT_DIGIT),
  27206. 57: uint8(_BT_DIGIT),
  27207. 58: uint8(_BT_COLON),
  27208. 59: uint8(_BT_SEMI),
  27209. 60: uint8(_BT_LT),
  27210. 61: uint8(_BT_EQUALS),
  27211. 62: uint8(_BT_GT),
  27212. 63: uint8(_BT_QUEST),
  27213. 64: uint8(_BT_OTHER),
  27214. 65: uint8(_BT_HEX),
  27215. 66: uint8(_BT_HEX),
  27216. 67: uint8(_BT_HEX),
  27217. 68: uint8(_BT_HEX),
  27218. 69: uint8(_BT_HEX),
  27219. 70: uint8(_BT_HEX),
  27220. 71: uint8(_BT_NMSTRT),
  27221. 72: uint8(_BT_NMSTRT),
  27222. 73: uint8(_BT_NMSTRT),
  27223. 74: uint8(_BT_NMSTRT),
  27224. 75: uint8(_BT_NMSTRT),
  27225. 76: uint8(_BT_NMSTRT),
  27226. 77: uint8(_BT_NMSTRT),
  27227. 78: uint8(_BT_NMSTRT),
  27228. 79: uint8(_BT_NMSTRT),
  27229. 80: uint8(_BT_NMSTRT),
  27230. 81: uint8(_BT_NMSTRT),
  27231. 82: uint8(_BT_NMSTRT),
  27232. 83: uint8(_BT_NMSTRT),
  27233. 84: uint8(_BT_NMSTRT),
  27234. 85: uint8(_BT_NMSTRT),
  27235. 86: uint8(_BT_NMSTRT),
  27236. 87: uint8(_BT_NMSTRT),
  27237. 88: uint8(_BT_NMSTRT),
  27238. 89: uint8(_BT_NMSTRT),
  27239. 90: uint8(_BT_NMSTRT),
  27240. 91: uint8(_BT_LSQB),
  27241. 92: uint8(_BT_OTHER),
  27242. 93: uint8(_BT_RSQB),
  27243. 94: uint8(_BT_OTHER),
  27244. 95: uint8(_BT_NMSTRT),
  27245. 96: uint8(_BT_OTHER),
  27246. 97: uint8(_BT_HEX),
  27247. 98: uint8(_BT_HEX),
  27248. 99: uint8(_BT_HEX),
  27249. 100: uint8(_BT_HEX),
  27250. 101: uint8(_BT_HEX),
  27251. 102: uint8(_BT_HEX),
  27252. 103: uint8(_BT_NMSTRT),
  27253. 104: uint8(_BT_NMSTRT),
  27254. 105: uint8(_BT_NMSTRT),
  27255. 106: uint8(_BT_NMSTRT),
  27256. 107: uint8(_BT_NMSTRT),
  27257. 108: uint8(_BT_NMSTRT),
  27258. 109: uint8(_BT_NMSTRT),
  27259. 110: uint8(_BT_NMSTRT),
  27260. 111: uint8(_BT_NMSTRT),
  27261. 112: uint8(_BT_NMSTRT),
  27262. 113: uint8(_BT_NMSTRT),
  27263. 114: uint8(_BT_NMSTRT),
  27264. 115: uint8(_BT_NMSTRT),
  27265. 116: uint8(_BT_NMSTRT),
  27266. 117: uint8(_BT_NMSTRT),
  27267. 118: uint8(_BT_NMSTRT),
  27268. 119: uint8(_BT_NMSTRT),
  27269. 120: uint8(_BT_NMSTRT),
  27270. 121: uint8(_BT_NMSTRT),
  27271. 122: uint8(_BT_NMSTRT),
  27272. 123: uint8(_BT_OTHER),
  27273. 124: uint8(_BT_VERBAR),
  27274. 125: uint8(_BT_OTHER),
  27275. 126: uint8(_BT_OTHER),
  27276. 127: uint8(_BT_OTHER),
  27277. 128: uint8(_BT_OTHER),
  27278. 129: uint8(_BT_OTHER),
  27279. 130: uint8(_BT_OTHER),
  27280. 131: uint8(_BT_OTHER),
  27281. 132: uint8(_BT_OTHER),
  27282. 133: uint8(_BT_OTHER),
  27283. 134: uint8(_BT_OTHER),
  27284. 135: uint8(_BT_OTHER),
  27285. 136: uint8(_BT_OTHER),
  27286. 137: uint8(_BT_OTHER),
  27287. 138: uint8(_BT_OTHER),
  27288. 139: uint8(_BT_OTHER),
  27289. 140: uint8(_BT_OTHER),
  27290. 141: uint8(_BT_OTHER),
  27291. 142: uint8(_BT_OTHER),
  27292. 143: uint8(_BT_OTHER),
  27293. 144: uint8(_BT_OTHER),
  27294. 145: uint8(_BT_OTHER),
  27295. 146: uint8(_BT_OTHER),
  27296. 147: uint8(_BT_OTHER),
  27297. 148: uint8(_BT_OTHER),
  27298. 149: uint8(_BT_OTHER),
  27299. 150: uint8(_BT_OTHER),
  27300. 151: uint8(_BT_OTHER),
  27301. 152: uint8(_BT_OTHER),
  27302. 153: uint8(_BT_OTHER),
  27303. 154: uint8(_BT_OTHER),
  27304. 155: uint8(_BT_OTHER),
  27305. 156: uint8(_BT_OTHER),
  27306. 157: uint8(_BT_OTHER),
  27307. 158: uint8(_BT_OTHER),
  27308. 159: uint8(_BT_OTHER),
  27309. 160: uint8(_BT_OTHER),
  27310. 161: uint8(_BT_OTHER),
  27311. 162: uint8(_BT_OTHER),
  27312. 163: uint8(_BT_OTHER),
  27313. 164: uint8(_BT_OTHER),
  27314. 165: uint8(_BT_OTHER),
  27315. 166: uint8(_BT_OTHER),
  27316. 167: uint8(_BT_OTHER),
  27317. 168: uint8(_BT_OTHER),
  27318. 169: uint8(_BT_OTHER),
  27319. 170: uint8(_BT_NMSTRT),
  27320. 171: uint8(_BT_OTHER),
  27321. 172: uint8(_BT_OTHER),
  27322. 173: uint8(_BT_OTHER),
  27323. 174: uint8(_BT_OTHER),
  27324. 175: uint8(_BT_OTHER),
  27325. 176: uint8(_BT_OTHER),
  27326. 177: uint8(_BT_OTHER),
  27327. 178: uint8(_BT_OTHER),
  27328. 179: uint8(_BT_OTHER),
  27329. 180: uint8(_BT_OTHER),
  27330. 181: uint8(_BT_NMSTRT),
  27331. 182: uint8(_BT_OTHER),
  27332. 183: uint8(_BT_NAME),
  27333. 184: uint8(_BT_OTHER),
  27334. 185: uint8(_BT_OTHER),
  27335. 186: uint8(_BT_NMSTRT),
  27336. 187: uint8(_BT_OTHER),
  27337. 188: uint8(_BT_OTHER),
  27338. 189: uint8(_BT_OTHER),
  27339. 190: uint8(_BT_OTHER),
  27340. 191: uint8(_BT_OTHER),
  27341. 192: uint8(_BT_NMSTRT),
  27342. 193: uint8(_BT_NMSTRT),
  27343. 194: uint8(_BT_NMSTRT),
  27344. 195: uint8(_BT_NMSTRT),
  27345. 196: uint8(_BT_NMSTRT),
  27346. 197: uint8(_BT_NMSTRT),
  27347. 198: uint8(_BT_NMSTRT),
  27348. 199: uint8(_BT_NMSTRT),
  27349. 200: uint8(_BT_NMSTRT),
  27350. 201: uint8(_BT_NMSTRT),
  27351. 202: uint8(_BT_NMSTRT),
  27352. 203: uint8(_BT_NMSTRT),
  27353. 204: uint8(_BT_NMSTRT),
  27354. 205: uint8(_BT_NMSTRT),
  27355. 206: uint8(_BT_NMSTRT),
  27356. 207: uint8(_BT_NMSTRT),
  27357. 208: uint8(_BT_NMSTRT),
  27358. 209: uint8(_BT_NMSTRT),
  27359. 210: uint8(_BT_NMSTRT),
  27360. 211: uint8(_BT_NMSTRT),
  27361. 212: uint8(_BT_NMSTRT),
  27362. 213: uint8(_BT_NMSTRT),
  27363. 214: uint8(_BT_NMSTRT),
  27364. 215: uint8(_BT_OTHER),
  27365. 216: uint8(_BT_NMSTRT),
  27366. 217: uint8(_BT_NMSTRT),
  27367. 218: uint8(_BT_NMSTRT),
  27368. 219: uint8(_BT_NMSTRT),
  27369. 220: uint8(_BT_NMSTRT),
  27370. 221: uint8(_BT_NMSTRT),
  27371. 222: uint8(_BT_NMSTRT),
  27372. 223: uint8(_BT_NMSTRT),
  27373. 224: uint8(_BT_NMSTRT),
  27374. 225: uint8(_BT_NMSTRT),
  27375. 226: uint8(_BT_NMSTRT),
  27376. 227: uint8(_BT_NMSTRT),
  27377. 228: uint8(_BT_NMSTRT),
  27378. 229: uint8(_BT_NMSTRT),
  27379. 230: uint8(_BT_NMSTRT),
  27380. 231: uint8(_BT_NMSTRT),
  27381. 232: uint8(_BT_NMSTRT),
  27382. 233: uint8(_BT_NMSTRT),
  27383. 234: uint8(_BT_NMSTRT),
  27384. 235: uint8(_BT_NMSTRT),
  27385. 236: uint8(_BT_NMSTRT),
  27386. 237: uint8(_BT_NMSTRT),
  27387. 238: uint8(_BT_NMSTRT),
  27388. 239: uint8(_BT_NMSTRT),
  27389. 240: uint8(_BT_NMSTRT),
  27390. 241: uint8(_BT_NMSTRT),
  27391. 242: uint8(_BT_NMSTRT),
  27392. 243: uint8(_BT_NMSTRT),
  27393. 244: uint8(_BT_NMSTRT),
  27394. 245: uint8(_BT_NMSTRT),
  27395. 246: uint8(_BT_NMSTRT),
  27396. 247: uint8(_BT_OTHER),
  27397. 248: uint8(_BT_NMSTRT),
  27398. 249: uint8(_BT_NMSTRT),
  27399. 250: uint8(_BT_NMSTRT),
  27400. 251: uint8(_BT_NMSTRT),
  27401. 252: uint8(_BT_NMSTRT),
  27402. 253: uint8(_BT_NMSTRT),
  27403. 254: uint8(_BT_NMSTRT),
  27404. 255: uint8(_BT_NMSTRT),
  27405. },
  27406. }
  27407. func init() {
  27408. p := unsafe.Pointer(&_big2_encoding_ns)
  27409. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27410. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27411. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27412. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27413. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27414. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27415. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27416. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27417. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27418. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27419. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27420. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27421. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27422. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27423. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27424. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27425. }
  27426. var _big2_encoding = Tnormal_encoding{
  27427. Fenc: TENCODING{
  27428. Fscanners: [4]TSCANNER{},
  27429. FliteralScanners: [2]TSCANNER{},
  27430. FminBytesPerChar: int32(2),
  27431. },
  27432. Ftype1: [256]uint8{
  27433. 9: uint8(_BT_S),
  27434. 10: uint8(_BT_LF),
  27435. 13: uint8(_BT_CR),
  27436. 32: uint8(_BT_S),
  27437. 33: uint8(_BT_EXCL),
  27438. 34: uint8(_BT_QUOT),
  27439. 35: uint8(_BT_NUM),
  27440. 36: uint8(_BT_OTHER),
  27441. 37: uint8(_BT_PERCNT),
  27442. 38: uint8(_BT_AMP),
  27443. 39: uint8(_BT_APOS),
  27444. 40: uint8(_BT_LPAR),
  27445. 41: uint8(_BT_RPAR),
  27446. 42: uint8(_BT_AST),
  27447. 43: uint8(_BT_PLUS),
  27448. 44: uint8(_BT_COMMA),
  27449. 45: uint8(_BT_MINUS),
  27450. 46: uint8(_BT_NAME),
  27451. 47: uint8(_BT_SOL),
  27452. 48: uint8(_BT_DIGIT),
  27453. 49: uint8(_BT_DIGIT),
  27454. 50: uint8(_BT_DIGIT),
  27455. 51: uint8(_BT_DIGIT),
  27456. 52: uint8(_BT_DIGIT),
  27457. 53: uint8(_BT_DIGIT),
  27458. 54: uint8(_BT_DIGIT),
  27459. 55: uint8(_BT_DIGIT),
  27460. 56: uint8(_BT_DIGIT),
  27461. 57: uint8(_BT_DIGIT),
  27462. 58: uint8(_BT_NMSTRT),
  27463. 59: uint8(_BT_SEMI),
  27464. 60: uint8(_BT_LT),
  27465. 61: uint8(_BT_EQUALS),
  27466. 62: uint8(_BT_GT),
  27467. 63: uint8(_BT_QUEST),
  27468. 64: uint8(_BT_OTHER),
  27469. 65: uint8(_BT_HEX),
  27470. 66: uint8(_BT_HEX),
  27471. 67: uint8(_BT_HEX),
  27472. 68: uint8(_BT_HEX),
  27473. 69: uint8(_BT_HEX),
  27474. 70: uint8(_BT_HEX),
  27475. 71: uint8(_BT_NMSTRT),
  27476. 72: uint8(_BT_NMSTRT),
  27477. 73: uint8(_BT_NMSTRT),
  27478. 74: uint8(_BT_NMSTRT),
  27479. 75: uint8(_BT_NMSTRT),
  27480. 76: uint8(_BT_NMSTRT),
  27481. 77: uint8(_BT_NMSTRT),
  27482. 78: uint8(_BT_NMSTRT),
  27483. 79: uint8(_BT_NMSTRT),
  27484. 80: uint8(_BT_NMSTRT),
  27485. 81: uint8(_BT_NMSTRT),
  27486. 82: uint8(_BT_NMSTRT),
  27487. 83: uint8(_BT_NMSTRT),
  27488. 84: uint8(_BT_NMSTRT),
  27489. 85: uint8(_BT_NMSTRT),
  27490. 86: uint8(_BT_NMSTRT),
  27491. 87: uint8(_BT_NMSTRT),
  27492. 88: uint8(_BT_NMSTRT),
  27493. 89: uint8(_BT_NMSTRT),
  27494. 90: uint8(_BT_NMSTRT),
  27495. 91: uint8(_BT_LSQB),
  27496. 92: uint8(_BT_OTHER),
  27497. 93: uint8(_BT_RSQB),
  27498. 94: uint8(_BT_OTHER),
  27499. 95: uint8(_BT_NMSTRT),
  27500. 96: uint8(_BT_OTHER),
  27501. 97: uint8(_BT_HEX),
  27502. 98: uint8(_BT_HEX),
  27503. 99: uint8(_BT_HEX),
  27504. 100: uint8(_BT_HEX),
  27505. 101: uint8(_BT_HEX),
  27506. 102: uint8(_BT_HEX),
  27507. 103: uint8(_BT_NMSTRT),
  27508. 104: uint8(_BT_NMSTRT),
  27509. 105: uint8(_BT_NMSTRT),
  27510. 106: uint8(_BT_NMSTRT),
  27511. 107: uint8(_BT_NMSTRT),
  27512. 108: uint8(_BT_NMSTRT),
  27513. 109: uint8(_BT_NMSTRT),
  27514. 110: uint8(_BT_NMSTRT),
  27515. 111: uint8(_BT_NMSTRT),
  27516. 112: uint8(_BT_NMSTRT),
  27517. 113: uint8(_BT_NMSTRT),
  27518. 114: uint8(_BT_NMSTRT),
  27519. 115: uint8(_BT_NMSTRT),
  27520. 116: uint8(_BT_NMSTRT),
  27521. 117: uint8(_BT_NMSTRT),
  27522. 118: uint8(_BT_NMSTRT),
  27523. 119: uint8(_BT_NMSTRT),
  27524. 120: uint8(_BT_NMSTRT),
  27525. 121: uint8(_BT_NMSTRT),
  27526. 122: uint8(_BT_NMSTRT),
  27527. 123: uint8(_BT_OTHER),
  27528. 124: uint8(_BT_VERBAR),
  27529. 125: uint8(_BT_OTHER),
  27530. 126: uint8(_BT_OTHER),
  27531. 127: uint8(_BT_OTHER),
  27532. 128: uint8(_BT_OTHER),
  27533. 129: uint8(_BT_OTHER),
  27534. 130: uint8(_BT_OTHER),
  27535. 131: uint8(_BT_OTHER),
  27536. 132: uint8(_BT_OTHER),
  27537. 133: uint8(_BT_OTHER),
  27538. 134: uint8(_BT_OTHER),
  27539. 135: uint8(_BT_OTHER),
  27540. 136: uint8(_BT_OTHER),
  27541. 137: uint8(_BT_OTHER),
  27542. 138: uint8(_BT_OTHER),
  27543. 139: uint8(_BT_OTHER),
  27544. 140: uint8(_BT_OTHER),
  27545. 141: uint8(_BT_OTHER),
  27546. 142: uint8(_BT_OTHER),
  27547. 143: uint8(_BT_OTHER),
  27548. 144: uint8(_BT_OTHER),
  27549. 145: uint8(_BT_OTHER),
  27550. 146: uint8(_BT_OTHER),
  27551. 147: uint8(_BT_OTHER),
  27552. 148: uint8(_BT_OTHER),
  27553. 149: uint8(_BT_OTHER),
  27554. 150: uint8(_BT_OTHER),
  27555. 151: uint8(_BT_OTHER),
  27556. 152: uint8(_BT_OTHER),
  27557. 153: uint8(_BT_OTHER),
  27558. 154: uint8(_BT_OTHER),
  27559. 155: uint8(_BT_OTHER),
  27560. 156: uint8(_BT_OTHER),
  27561. 157: uint8(_BT_OTHER),
  27562. 158: uint8(_BT_OTHER),
  27563. 159: uint8(_BT_OTHER),
  27564. 160: uint8(_BT_OTHER),
  27565. 161: uint8(_BT_OTHER),
  27566. 162: uint8(_BT_OTHER),
  27567. 163: uint8(_BT_OTHER),
  27568. 164: uint8(_BT_OTHER),
  27569. 165: uint8(_BT_OTHER),
  27570. 166: uint8(_BT_OTHER),
  27571. 167: uint8(_BT_OTHER),
  27572. 168: uint8(_BT_OTHER),
  27573. 169: uint8(_BT_OTHER),
  27574. 170: uint8(_BT_NMSTRT),
  27575. 171: uint8(_BT_OTHER),
  27576. 172: uint8(_BT_OTHER),
  27577. 173: uint8(_BT_OTHER),
  27578. 174: uint8(_BT_OTHER),
  27579. 175: uint8(_BT_OTHER),
  27580. 176: uint8(_BT_OTHER),
  27581. 177: uint8(_BT_OTHER),
  27582. 178: uint8(_BT_OTHER),
  27583. 179: uint8(_BT_OTHER),
  27584. 180: uint8(_BT_OTHER),
  27585. 181: uint8(_BT_NMSTRT),
  27586. 182: uint8(_BT_OTHER),
  27587. 183: uint8(_BT_NAME),
  27588. 184: uint8(_BT_OTHER),
  27589. 185: uint8(_BT_OTHER),
  27590. 186: uint8(_BT_NMSTRT),
  27591. 187: uint8(_BT_OTHER),
  27592. 188: uint8(_BT_OTHER),
  27593. 189: uint8(_BT_OTHER),
  27594. 190: uint8(_BT_OTHER),
  27595. 191: uint8(_BT_OTHER),
  27596. 192: uint8(_BT_NMSTRT),
  27597. 193: uint8(_BT_NMSTRT),
  27598. 194: uint8(_BT_NMSTRT),
  27599. 195: uint8(_BT_NMSTRT),
  27600. 196: uint8(_BT_NMSTRT),
  27601. 197: uint8(_BT_NMSTRT),
  27602. 198: uint8(_BT_NMSTRT),
  27603. 199: uint8(_BT_NMSTRT),
  27604. 200: uint8(_BT_NMSTRT),
  27605. 201: uint8(_BT_NMSTRT),
  27606. 202: uint8(_BT_NMSTRT),
  27607. 203: uint8(_BT_NMSTRT),
  27608. 204: uint8(_BT_NMSTRT),
  27609. 205: uint8(_BT_NMSTRT),
  27610. 206: uint8(_BT_NMSTRT),
  27611. 207: uint8(_BT_NMSTRT),
  27612. 208: uint8(_BT_NMSTRT),
  27613. 209: uint8(_BT_NMSTRT),
  27614. 210: uint8(_BT_NMSTRT),
  27615. 211: uint8(_BT_NMSTRT),
  27616. 212: uint8(_BT_NMSTRT),
  27617. 213: uint8(_BT_NMSTRT),
  27618. 214: uint8(_BT_NMSTRT),
  27619. 215: uint8(_BT_OTHER),
  27620. 216: uint8(_BT_NMSTRT),
  27621. 217: uint8(_BT_NMSTRT),
  27622. 218: uint8(_BT_NMSTRT),
  27623. 219: uint8(_BT_NMSTRT),
  27624. 220: uint8(_BT_NMSTRT),
  27625. 221: uint8(_BT_NMSTRT),
  27626. 222: uint8(_BT_NMSTRT),
  27627. 223: uint8(_BT_NMSTRT),
  27628. 224: uint8(_BT_NMSTRT),
  27629. 225: uint8(_BT_NMSTRT),
  27630. 226: uint8(_BT_NMSTRT),
  27631. 227: uint8(_BT_NMSTRT),
  27632. 228: uint8(_BT_NMSTRT),
  27633. 229: uint8(_BT_NMSTRT),
  27634. 230: uint8(_BT_NMSTRT),
  27635. 231: uint8(_BT_NMSTRT),
  27636. 232: uint8(_BT_NMSTRT),
  27637. 233: uint8(_BT_NMSTRT),
  27638. 234: uint8(_BT_NMSTRT),
  27639. 235: uint8(_BT_NMSTRT),
  27640. 236: uint8(_BT_NMSTRT),
  27641. 237: uint8(_BT_NMSTRT),
  27642. 238: uint8(_BT_NMSTRT),
  27643. 239: uint8(_BT_NMSTRT),
  27644. 240: uint8(_BT_NMSTRT),
  27645. 241: uint8(_BT_NMSTRT),
  27646. 242: uint8(_BT_NMSTRT),
  27647. 243: uint8(_BT_NMSTRT),
  27648. 244: uint8(_BT_NMSTRT),
  27649. 245: uint8(_BT_NMSTRT),
  27650. 246: uint8(_BT_NMSTRT),
  27651. 247: uint8(_BT_OTHER),
  27652. 248: uint8(_BT_NMSTRT),
  27653. 249: uint8(_BT_NMSTRT),
  27654. 250: uint8(_BT_NMSTRT),
  27655. 251: uint8(_BT_NMSTRT),
  27656. 252: uint8(_BT_NMSTRT),
  27657. 253: uint8(_BT_NMSTRT),
  27658. 254: uint8(_BT_NMSTRT),
  27659. 255: uint8(_BT_NMSTRT),
  27660. },
  27661. }
  27662. func init() {
  27663. p := unsafe.Pointer(&_big2_encoding)
  27664. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27665. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27666. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27667. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27668. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27669. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27670. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27671. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27672. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27673. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27674. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27675. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27676. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27677. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27678. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27679. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27680. }
  27681. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27682. var c1, c2 int8
  27683. var v2, v3 uintptr
  27684. _, _, _, _ = c1, c2, v2, v3
  27685. for {
  27686. v2 = s1
  27687. s1++
  27688. c1 = *(*int8)(unsafe.Pointer(v2))
  27689. v3 = s2
  27690. s2++
  27691. c2 = *(*int8)(unsafe.Pointer(v3))
  27692. if int32(m_ASCII_a2) <= int32(c1) && int32(c1) <= int32(m_ASCII_z1) {
  27693. c1 = int8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27694. }
  27695. if int32(m_ASCII_a2) <= int32(c2) && int32(c2) <= int32(m_ASCII_z1) {
  27696. /* The following line will never get executed. streqci() is
  27697. * only called from two places, both of which guarantee to put
  27698. * upper-case strings into s2.
  27699. */
  27700. c2 = int8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27701. } /* LCOV_EXCL_LINE */
  27702. if int32(c1) != int32(c2) {
  27703. return 0
  27704. }
  27705. if !(c1 != 0) {
  27706. break
  27707. }
  27708. goto _1
  27709. _1:
  27710. }
  27711. return int32(1)
  27712. }
  27713. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27714. _ = enc
  27715. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27716. }
  27717. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27718. bp := tls.Alloc(32)
  27719. defer tls.Free(32)
  27720. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27721. var _ /* buf at bp+8 */ [1]int8
  27722. var _ /* p at bp+16 */ uintptr
  27723. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  27724. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+16, *(*uintptr)(unsafe.Pointer(bp + 16))+uintptr(1))
  27725. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  27726. return -int32(1)
  27727. } else {
  27728. return int32((*(*[1]int8)(unsafe.Pointer(bp + 8)))[0])
  27729. }
  27730. return r
  27731. }
  27732. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27733. switch c {
  27734. case int32(0x20):
  27735. fallthrough
  27736. case int32(0xD):
  27737. fallthrough
  27738. case int32(0xA):
  27739. fallthrough
  27740. case int32(0x9):
  27741. return int32(1)
  27742. }
  27743. return 0
  27744. }
  27745. // C documentation
  27746. //
  27747. // /* Return 1 if there's just optional white space or there's an S
  27748. // followed by name=val.
  27749. // */
  27750. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27751. var c, v2 int32
  27752. var open int8
  27753. _, _, _ = c, open, v2
  27754. if ptr == end {
  27755. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27756. return int32(1)
  27757. }
  27758. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27760. return 0
  27761. }
  27762. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27763. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27764. }
  27765. if ptr == end {
  27766. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27767. return int32(1)
  27768. }
  27769. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27770. for {
  27771. c = _toAscii(tls, enc, ptr, end)
  27772. if c == -int32(1) {
  27773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27774. return 0
  27775. }
  27776. if c == int32(m_ASCII_EQUALS2) {
  27777. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27778. break
  27779. }
  27780. if _isSpace(tls, c) != 0 {
  27781. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27782. for {
  27783. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27784. goto _3
  27785. _3:
  27786. ;
  27787. v2 = _toAscii(tls, enc, ptr, end)
  27788. c = v2
  27789. if !(_isSpace(tls, v2) != 0) {
  27790. break
  27791. }
  27792. }
  27793. if c != int32(m_ASCII_EQUALS2) {
  27794. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27795. return 0
  27796. }
  27797. break
  27798. }
  27799. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27800. goto _1
  27801. _1:
  27802. }
  27803. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27805. return 0
  27806. }
  27807. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27808. c = _toAscii(tls, enc, ptr, end)
  27809. for _isSpace(tls, c) != 0 {
  27810. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27811. c = _toAscii(tls, enc, ptr, end)
  27812. }
  27813. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27815. return 0
  27816. }
  27817. open = int8(c)
  27818. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27819. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27820. for {
  27821. c = _toAscii(tls, enc, ptr, end)
  27822. if c == int32(open) {
  27823. break
  27824. }
  27825. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) && !(int32(m_ASCII_02) <= c && c <= int32(m_ASCII_92)) && c != int32(m_ASCII_PERIOD2) && c != int32(m_ASCII_MINUS1) && c != int32(m_ASCII_UNDERSCORE1) {
  27826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27827. return 0
  27828. }
  27829. goto _4
  27830. _4:
  27831. ;
  27832. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27833. }
  27834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27835. return int32(1)
  27836. }
  27837. var _KW_version = [8]int8{
  27838. 0: int8(m_ASCII_v1),
  27839. 1: int8(m_ASCII_e2),
  27840. 2: int8(m_ASCII_r2),
  27841. 3: int8(m_ASCII_s2),
  27842. 4: int8(m_ASCII_i1),
  27843. 5: int8(m_ASCII_o2),
  27844. 6: int8(m_ASCII_n2),
  27845. }
  27846. var _KW_encoding = [9]int8{
  27847. 0: int8(m_ASCII_e2),
  27848. 1: int8(m_ASCII_n2),
  27849. 2: int8(m_ASCII_c2),
  27850. 3: int8(m_ASCII_o2),
  27851. 4: int8(m_ASCII_d1),
  27852. 5: int8(m_ASCII_i1),
  27853. 6: int8(m_ASCII_n2),
  27854. 7: int8(m_ASCII_g2),
  27855. }
  27856. var _KW_standalone = [11]int8{
  27857. 0: int8(m_ASCII_s2),
  27858. 1: int8(m_ASCII_t2),
  27859. 2: int8(m_ASCII_a2),
  27860. 3: int8(m_ASCII_n2),
  27861. 4: int8(m_ASCII_d1),
  27862. 5: int8(m_ASCII_a2),
  27863. 6: int8(m_ASCII_l2),
  27864. 7: int8(m_ASCII_o2),
  27865. 8: int8(m_ASCII_n2),
  27866. 9: int8(m_ASCII_e2),
  27867. }
  27868. var _KW_yes = [4]int8{
  27869. 0: int8(m_ASCII_y1),
  27870. 1: int8(m_ASCII_e2),
  27871. 2: int8(m_ASCII_s2),
  27872. }
  27873. var _KW_no = [3]int8{
  27874. 0: int8(m_ASCII_n2),
  27875. 1: int8(m_ASCII_o2),
  27876. }
  27877. func _doParseXmlDecl(tls *libc.TLS, encodingFinder uintptr, isGeneralTextEntity int32, enc uintptr, _ptr uintptr, end uintptr, badPtr uintptr, versionPtr uintptr, versionEndPtr uintptr, encodingName uintptr, encoding uintptr, standalone uintptr) (r int32) {
  27878. bp := tls.Alloc(32)
  27879. defer tls.Free(32)
  27880. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27881. var c int32
  27882. var _ /* name at bp+16 */ uintptr
  27883. var _ /* nameEnd at bp+24 */ uintptr
  27884. var _ /* val at bp+8 */ uintptr
  27885. _ = c
  27886. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27887. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  27888. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  27889. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27890. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27891. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27892. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27893. return 0
  27894. }
  27895. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_version))) != 0) {
  27896. if !(isGeneralTextEntity != 0) {
  27897. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27898. return 0
  27899. }
  27900. } else {
  27901. if versionPtr != 0 {
  27902. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27903. }
  27904. if versionEndPtr != 0 {
  27905. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27906. }
  27907. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27908. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27909. return 0
  27910. }
  27911. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27912. if isGeneralTextEntity != 0 {
  27913. /* a TextDecl must have an EncodingDecl */
  27914. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27915. return 0
  27916. }
  27917. return int32(1)
  27918. }
  27919. }
  27920. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_encoding))) != 0 {
  27921. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  27922. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27923. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27924. return 0
  27925. }
  27926. if encodingName != 0 {
  27927. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27928. }
  27929. if encoding != 0 {
  27930. *(*uintptr)(unsafe.Pointer(encoding)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{encodingFinder})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  27931. }
  27932. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27933. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27934. return 0
  27935. }
  27936. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27937. return int32(1)
  27938. }
  27939. }
  27940. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_standalone))) != 0) || isGeneralTextEntity != 0 {
  27941. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27942. return 0
  27943. }
  27944. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_yes))) != 0 {
  27945. if standalone != 0 {
  27946. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27947. }
  27948. } else {
  27949. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_no))) != 0 {
  27950. if standalone != 0 {
  27951. *(*int32)(unsafe.Pointer(standalone)) = 0
  27952. }
  27953. } else {
  27954. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27955. return 0
  27956. }
  27957. }
  27958. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27959. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27960. }
  27961. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27962. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27963. return 0
  27964. }
  27965. return int32(1)
  27966. }
  27967. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27968. switch result >> libc.Int32FromInt32(8) {
  27969. case int32(0xD8):
  27970. fallthrough
  27971. case int32(0xD9):
  27972. fallthrough
  27973. case int32(0xDA):
  27974. fallthrough
  27975. case int32(0xDB):
  27976. fallthrough
  27977. case int32(0xDC):
  27978. fallthrough
  27979. case int32(0xDD):
  27980. fallthrough
  27981. case int32(0xDE):
  27982. fallthrough
  27983. case int32(0xDF):
  27984. return -int32(1)
  27985. case 0:
  27986. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  27987. return -int32(1)
  27988. }
  27989. case int32(0xFF):
  27990. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27991. return -int32(1)
  27992. }
  27993. break
  27994. }
  27995. return result
  27996. }
  27997. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27998. if c < 0 {
  27999. return 0
  28000. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  28001. if c < 128 {
  28002. *(*int8)(unsafe.Pointer(buf)) = int8(c | int32(_UTF8_cval1))
  28003. return int32(1)
  28004. }
  28005. if c < 2048 {
  28006. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  28007. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  28008. return int32(2)
  28009. }
  28010. if c < 65536 {
  28011. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  28012. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  28013. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  28014. return int32(3)
  28015. }
  28016. if c < int32(0x110000) {
  28017. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  28018. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  28019. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  28020. *(*int8)(unsafe.Pointer(buf + 3)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  28021. return int32(4)
  28022. }
  28023. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  28024. }
  28025. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  28026. if charNum < 0 {
  28027. return 0
  28028. }
  28029. if charNum < int32(0x10000) {
  28030. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  28031. return int32(1)
  28032. }
  28033. if charNum < int32(0x110000) {
  28034. charNum -= int32(0x10000)
  28035. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  28036. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  28037. return int32(2)
  28038. }
  28039. return 0
  28040. }
  28041. type Tunknown_encoding = struct {
  28042. Fnormal Tnormal_encoding
  28043. Fconvert TCONVERTER
  28044. FuserData uintptr
  28045. Futf16 [256]uint16
  28046. Futf8 [256][4]int8
  28047. }
  28048. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  28049. return int32(2016)
  28050. }
  28051. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  28052. var c int32
  28053. var uenc uintptr
  28054. _, _ = c, uenc
  28055. uenc = enc
  28056. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, p)
  28057. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  28058. return 0
  28059. }
  28060. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xFF)>>int32(5)] & (libc.Uint32FromUint32(1) << (c & libc.Int32FromInt32(0xFF) & libc.Int32FromInt32(0x1F))))
  28061. }
  28062. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  28063. var c int32
  28064. var uenc uintptr
  28065. _, _ = c, uenc
  28066. uenc = enc
  28067. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, p)
  28068. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  28069. return 0
  28070. }
  28071. return libc.Int32FromUint32(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xFF)>>int32(5)] & (libc.Uint32FromUint32(1) << (c & libc.Int32FromInt32(0xFF) & libc.Int32FromInt32(0x1F))))
  28072. }
  28073. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  28074. var c int32
  28075. var uenc uintptr
  28076. _, _ = c, uenc
  28077. uenc = enc
  28078. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, p)
  28079. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  28080. }
  28081. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  28082. bp := tls.Alloc(16)
  28083. defer tls.Free(16)
  28084. var c, n int32
  28085. var uenc, utf8, v2 uintptr
  28086. var _ /* buf at bp+0 */ [4]int8
  28087. _, _, _, _, _ = c, n, uenc, utf8, v2
  28088. uenc = enc
  28089. for {
  28090. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  28091. return int32(_XML_CONVERT_COMPLETED)
  28092. }
  28093. utf8 = uenc + 992 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*4
  28094. v2 = utf8
  28095. utf8++
  28096. n = int32(*(*int8)(unsafe.Pointer(v2)))
  28097. if n == 0 {
  28098. c = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, *(*uintptr)(unsafe.Pointer(fromP)))
  28099. n = XXmlUtf8Encode(tls, c, bp)
  28100. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  28101. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  28102. }
  28103. utf8 = bp
  28104. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  28105. } else {
  28106. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  28107. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  28108. }
  28109. *(*uintptr)(unsafe.Pointer(fromP))++
  28110. }
  28111. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  28112. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  28113. goto _1
  28114. _1:
  28115. }
  28116. return r
  28117. }
  28118. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  28119. var c uint16
  28120. var uenc, v1, v2 uintptr
  28121. _, _, _, _ = c, uenc, v1, v2
  28122. uenc = enc
  28123. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  28124. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*2))
  28125. if libc.Int32FromUint16(c) == 0 {
  28126. c = libc.Uint16FromInt32((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tunknown_encoding)(unsafe.Pointer(uenc)).Fconvert})))(tls, (*Tunknown_encoding)(unsafe.Pointer(uenc)).FuserData, *(*uintptr)(unsafe.Pointer(fromP))))
  28127. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  28128. } else {
  28129. *(*uintptr)(unsafe.Pointer(fromP))++
  28130. }
  28131. v2 = toP
  28132. v1 = *(*uintptr)(unsafe.Pointer(v2))
  28133. *(*uintptr)(unsafe.Pointer(v2)) += 2
  28134. *(*uint16)(unsafe.Pointer(v1)) = c
  28135. }
  28136. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  28137. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  28138. } else {
  28139. return int32(_XML_CONVERT_COMPLETED)
  28140. }
  28141. return r
  28142. }
  28143. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28144. var c, i, v3 int32
  28145. var e uintptr
  28146. _, _, _, _ = c, e, i, v3
  28147. e = mem
  28148. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  28149. i = 0
  28150. for {
  28151. if !(i < int32(128)) {
  28152. break
  28153. }
  28154. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_NONXML) && *(*int32)(unsafe.Pointer(table + uintptr(i)*4)) != i {
  28155. return uintptr(0)
  28156. }
  28157. goto _1
  28158. _1:
  28159. ;
  28160. i++
  28161. }
  28162. i = 0
  28163. for {
  28164. if !(i < int32(256)) {
  28165. break
  28166. }
  28167. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  28168. if c == -int32(1) {
  28169. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  28170. /* This shouldn't really get used. */
  28171. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  28172. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  28173. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  28174. } else {
  28175. if c < 0 {
  28176. if c < -int32(4) {
  28177. return uintptr(0)
  28178. }
  28179. /* Multi-byte sequences need a converter function */
  28180. if !(convert != 0) {
  28181. return uintptr(0)
  28182. }
  28183. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  28184. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = 0
  28185. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  28186. } else {
  28187. if c < int32(0x80) {
  28188. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_NONXML) && c != i {
  28189. return uintptr(0)
  28190. }
  28191. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  28192. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  28193. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = int8(c)
  28194. if c == 0 {
  28195. v3 = int32(0xFFFF)
  28196. } else {
  28197. v3 = c
  28198. }
  28199. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  28200. } else {
  28201. if _checkCharRefNumber(tls, c) < 0 {
  28202. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  28203. /* This shouldn't really get used. */
  28204. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  28205. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  28206. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  28207. } else {
  28208. if c > int32(0xFFFF) {
  28209. return uintptr(0)
  28210. }
  28211. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  28212. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  28213. } else {
  28214. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  28215. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  28216. } else {
  28217. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  28218. }
  28219. }
  28220. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  28221. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  28222. }
  28223. }
  28224. }
  28225. }
  28226. goto _2
  28227. _2:
  28228. ;
  28229. i++
  28230. }
  28231. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  28232. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  28233. if convert != 0 {
  28234. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  28235. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  28236. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  28237. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  28238. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  28239. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  28240. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  28241. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  28242. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  28243. }
  28244. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  28245. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  28246. return e
  28247. }
  28248. const _UNKNOWN_ENC = -1
  28249. const _ISO_8859_1_ENC = 0
  28250. const _US_ASCII_ENC = 1
  28251. const _UTF_8_ENC = 2
  28252. const _UTF_16_ENC = 3
  28253. const _UTF_16BE_ENC = 4
  28254. const _UTF_16LE_ENC = 5
  28255. const
  28256. /* must match encodingNames up to here */
  28257. _NO_ENC = 6
  28258. var _KW_ISO_8859_1 = [11]int8{
  28259. 0: int8(m_ASCII_I),
  28260. 1: int8(m_ASCII_S),
  28261. 2: int8(m_ASCII_O),
  28262. 3: int8(m_ASCII_MINUS1),
  28263. 4: int8(m_ASCII_82),
  28264. 5: int8(m_ASCII_82),
  28265. 6: int8(m_ASCII_51),
  28266. 7: int8(m_ASCII_92),
  28267. 8: int8(m_ASCII_MINUS1),
  28268. 9: int8(m_ASCII_12),
  28269. }
  28270. var _KW_US_ASCII = [9]int8{
  28271. 0: int8(m_ASCII_U1),
  28272. 1: int8(m_ASCII_S),
  28273. 2: int8(m_ASCII_MINUS1),
  28274. 3: int8(m_ASCII_A),
  28275. 4: int8(m_ASCII_S),
  28276. 5: int8(m_ASCII_C),
  28277. 6: int8(m_ASCII_I),
  28278. 7: int8(m_ASCII_I),
  28279. }
  28280. var _KW_UTF_8 = [6]int8{
  28281. 0: int8(m_ASCII_U1),
  28282. 1: int8(m_ASCII_T),
  28283. 2: int8(m_ASCII_F),
  28284. 3: int8(m_ASCII_MINUS1),
  28285. 4: int8(m_ASCII_82),
  28286. }
  28287. var _KW_UTF_16 = [7]int8{
  28288. 0: int8(m_ASCII_U1),
  28289. 1: int8(m_ASCII_T),
  28290. 2: int8(m_ASCII_F),
  28291. 3: int8(m_ASCII_MINUS1),
  28292. 4: int8(m_ASCII_12),
  28293. 5: int8(m_ASCII_61),
  28294. }
  28295. var _KW_UTF_16BE = [9]int8{
  28296. 0: int8(m_ASCII_U1),
  28297. 1: int8(m_ASCII_T),
  28298. 2: int8(m_ASCII_F),
  28299. 3: int8(m_ASCII_MINUS1),
  28300. 4: int8(m_ASCII_12),
  28301. 5: int8(m_ASCII_61),
  28302. 6: int8(m_ASCII_B1),
  28303. 7: int8(m_ASCII_E),
  28304. }
  28305. var _KW_UTF_16LE = [9]int8{
  28306. 0: int8(m_ASCII_U1),
  28307. 1: int8(m_ASCII_T),
  28308. 2: int8(m_ASCII_F),
  28309. 3: int8(m_ASCII_MINUS1),
  28310. 4: int8(m_ASCII_12),
  28311. 5: int8(m_ASCII_61),
  28312. 6: int8(m_ASCII_L),
  28313. 7: int8(m_ASCII_E),
  28314. }
  28315. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28316. var i int32
  28317. _ = i
  28318. if name == libc.UintptrFromInt32(0) {
  28319. return int32(_NO_ENC)
  28320. }
  28321. i = 0
  28322. for {
  28323. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  28324. break
  28325. }
  28326. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28327. return i
  28328. }
  28329. goto _1
  28330. _1:
  28331. ;
  28332. i++
  28333. }
  28334. return int32(_UNKNOWN_ENC)
  28335. }
  28336. var _encodingNames = [6]uintptr{
  28337. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28338. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28339. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28340. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28341. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28342. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28343. }
  28344. /* For binary compatibility, we store the index of the encoding
  28345. specified at initialization in the isUtf16 member.
  28346. */
  28347. /* This is what detects the encoding. encodingTable maps from
  28348. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28349. the external (protocol) specified encoding; state is
  28350. XML_CONTENT_STATE if we're parsing an external text entity, and
  28351. XML_PROLOG_STATE otherwise.
  28352. */
  28353. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28354. var e int32
  28355. var encPtr uintptr
  28356. _, _ = e, encPtr
  28357. if ptr >= end {
  28358. return -int32(4)
  28359. }
  28360. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28361. if ptr+uintptr(1) == end {
  28362. /* only a single byte available for auto-detection */
  28363. /* so we're parsing an external text entity... */
  28364. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28365. switch int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28366. case int32(_UTF_16_ENC):
  28367. fallthrough
  28368. case int32(_UTF_16LE_ENC):
  28369. fallthrough
  28370. case int32(_UTF_16BE_ENC):
  28371. return -int32(1)
  28372. }
  28373. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))) {
  28374. case int32(0xFE):
  28375. fallthrough
  28376. case int32(0xFF):
  28377. fallthrough
  28378. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28379. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28380. break
  28381. }
  28382. /* fall through */
  28383. fallthrough
  28384. case 0x00:
  28385. fallthrough
  28386. case int32(0x3C):
  28387. return -int32(1)
  28388. }
  28389. } else {
  28390. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))) {
  28391. case int32(0xFEFF):
  28392. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28393. break
  28394. }
  28395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28396. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28397. return int32(m_XML_TOK_BOM)
  28398. /* 00 3C is handled in the default case */
  28399. fallthrough
  28400. case int32(0x3C00):
  28401. if (int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  28402. break
  28403. }
  28404. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28405. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28406. case int32(0xFFFE):
  28407. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28408. break
  28409. }
  28410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28411. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28412. return int32(m_XML_TOK_BOM)
  28413. case int32(0xEFBB):
  28414. /* Maybe a UTF-8 BOM (EF BB BF) */
  28415. /* If there's an explicitly specified (external) encoding
  28416. of ISO-8859-1 or some flavour of UTF-16
  28417. and this is an external text entity,
  28418. don't look for the BOM,
  28419. because it might be a legal data.
  28420. */
  28421. if state == int32(m_XML_CONTENT_STATE) {
  28422. e = int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28423. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28424. break
  28425. }
  28426. }
  28427. if ptr+uintptr(2) == end {
  28428. return -int32(1)
  28429. }
  28430. if libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 2)))) == int32(0xBF) {
  28431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28432. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  28433. return int32(m_XML_TOK_BOM)
  28434. }
  28435. default:
  28436. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32('\000') {
  28437. /* 0 isn't a legal data character. Furthermore a document
  28438. entity can only start with ASCII characters. So the only
  28439. way this can fail to be big-endian UTF-16 if it it's an
  28440. external parsed general entity that's labelled as
  28441. UTF-16LE.
  28442. */
  28443. if state == int32(m_XML_CONTENT_STATE) && int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28444. break
  28445. }
  28446. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28447. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28448. } else {
  28449. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28450. /* We could recover here in the case:
  28451. - parsing an external entity
  28452. - second byte is 0
  28453. - no externally specified encoding
  28454. - no encoding declaration
  28455. by assuming UTF-16LE. But we don't, because this would mean when
  28456. presented just with a single byte, we couldn't reliably determine
  28457. whether we needed further bytes.
  28458. */
  28459. if state == int32(m_XML_CONTENT_STATE) {
  28460. break
  28461. }
  28462. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28463. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28464. }
  28465. }
  28466. break
  28467. }
  28468. }
  28469. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  28470. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28471. }
  28472. /* This file is included!
  28473. __ __ _
  28474. ___\ \/ /_ __ __ _| |_
  28475. / _ \\ /| '_ \ / _` | __|
  28476. | __// \| |_) | (_| | |_
  28477. \___/_/\_\ .__/ \__,_|\__|
  28478. |_| XML parser
  28479. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28480. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28481. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28482. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28483. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28484. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28485. Licensed under the MIT license:
  28486. Permission is hereby granted, free of charge, to any person obtaining
  28487. a copy of this software and associated documentation files (the
  28488. "Software"), to deal in the Software without restriction, including
  28489. without limitation the rights to use, copy, modify, merge, publish,
  28490. distribute, sublicense, and/or sell copies of the Software, and to permit
  28491. persons to whom the Software is furnished to do so, subject to the
  28492. following conditions:
  28493. The above copyright notice and this permission notice shall be included
  28494. in all copies or substantial portions of the Software.
  28495. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28496. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28497. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28498. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28499. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28500. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28501. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28502. */
  28503. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28504. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28505. }
  28506. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28507. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28508. }
  28509. var _encodings = [7]uintptr{
  28510. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28511. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28512. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28513. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28514. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28515. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28516. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28517. }
  28518. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28519. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28520. }
  28521. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28522. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28523. }
  28524. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28525. var i int32
  28526. _ = i
  28527. i = _getEncodingIndex(tls, name)
  28528. if i == int32(_UNKNOWN_ENC) {
  28529. return 0
  28530. }
  28531. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28532. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28533. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  28534. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28535. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28536. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28537. return int32(1)
  28538. }
  28539. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28540. bp := tls.Alloc(144)
  28541. defer tls.Free(144)
  28542. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28543. var i int32
  28544. var _ /* buf at bp+8 */ [128]int8
  28545. var _ /* p at bp+136 */ uintptr
  28546. _ = i
  28547. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  28548. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28549. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  28550. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28551. return uintptr(0)
  28552. }
  28553. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  28554. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28555. return enc
  28556. }
  28557. i = _getEncodingIndex(tls, bp+8)
  28558. if i == int32(_UNKNOWN_ENC) {
  28559. return uintptr(0)
  28560. }
  28561. return _encodings[i]
  28562. }
  28563. func XXmlParseXmlDecl(tls *libc.TLS, isGeneralTextEntity int32, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr, versionPtr uintptr, versionEndPtr uintptr, encodingName uintptr, encoding uintptr, standalone uintptr) (r int32) {
  28564. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28565. }
  28566. /* This file is included!
  28567. __ __ _
  28568. ___\ \/ /_ __ __ _| |_
  28569. / _ \\ /| '_ \ / _` | __|
  28570. | __// \| |_) | (_| | |_
  28571. \___/_/\_\ .__/ \__,_|\__|
  28572. |_| XML parser
  28573. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28574. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28575. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28576. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28577. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28578. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28579. Licensed under the MIT license:
  28580. Permission is hereby granted, free of charge, to any person obtaining
  28581. a copy of this software and associated documentation files (the
  28582. "Software"), to deal in the Software without restriction, including
  28583. without limitation the rights to use, copy, modify, merge, publish,
  28584. distribute, sublicense, and/or sell copies of the Software, and to permit
  28585. persons to whom the Software is furnished to do so, subject to the
  28586. following conditions:
  28587. The above copyright notice and this permission notice shall be included
  28588. in all copies or substantial portions of the Software.
  28589. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28590. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28591. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28592. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28593. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28594. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28595. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28596. */
  28597. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28598. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28599. }
  28600. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28601. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28602. }
  28603. var _encodingsNS = [7]uintptr{
  28604. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28605. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28606. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28607. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28608. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28609. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28610. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28611. }
  28612. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28613. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28614. }
  28615. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28616. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28617. }
  28618. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28619. var i int32
  28620. _ = i
  28621. i = _getEncodingIndex(tls, name)
  28622. if i == int32(_UNKNOWN_ENC) {
  28623. return 0
  28624. }
  28625. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28626. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28627. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  28628. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28629. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28630. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28631. return int32(1)
  28632. }
  28633. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28634. bp := tls.Alloc(144)
  28635. defer tls.Free(144)
  28636. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28637. var i int32
  28638. var _ /* buf at bp+8 */ [128]int8
  28639. var _ /* p at bp+136 */ uintptr
  28640. _ = i
  28641. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  28642. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28643. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  28644. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28645. return uintptr(0)
  28646. }
  28647. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  28648. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28649. return enc
  28650. }
  28651. i = _getEncodingIndex(tls, bp+8)
  28652. if i == int32(_UNKNOWN_ENC) {
  28653. return uintptr(0)
  28654. }
  28655. return _encodingsNS[i]
  28656. }
  28657. func XXmlParseXmlDeclNS(tls *libc.TLS, isGeneralTextEntity int32, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr, versionPtr uintptr, versionEndPtr uintptr, encodingName uintptr, encoding uintptr, standalone uintptr) (r int32) {
  28658. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28659. }
  28660. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28661. var enc uintptr
  28662. _ = enc
  28663. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28664. if enc != 0 {
  28665. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  28666. }
  28667. return enc
  28668. }
  28669. func __ccgo_fp(f interface{}) uintptr {
  28670. type iface [2]uintptr
  28671. return (*iface)(unsafe.Pointer(&f))[1]
  28672. }
  28673. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28674. var __ccgo_ts1 = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x00EXPAT_ENTROPY_DEBUG\x00expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n\x00arc4random_buf\x00EXPAT_ACCOUNTING_DEBUG\x00EXPAT_ENTITY_DEBUG\x00out of memory\x00syntax error\x00no element found\x00not well-formed (invalid token)\x00unclosed token\x00partial character\x00mismatched tag\x00duplicate attribute\x00junk after document element\x00illegal parameter entity reference\x00undefined entity\x00recursive entity reference\x00asynchronous entity\x00reference to invalid character number\x00reference to binary entity\x00reference to external entity in attribute\x00XML or text declaration not at start of entity\x00unknown encoding\x00encoding specified in XML declaration is incorrect\x00unclosed CDATA section\x00error in processing external entity reference\x00document is not standalone\x00unexpected parser state - please send a bug report\x00entity declared in parameter entity\x00requested feature requires XML_DTD support in Expat\x00cannot change setting once parsing has begun\x00unbound prefix\x00must not undeclare prefix\x00incomplete markup in parameter entity\x00XML declaration not well-formed\x00text declaration not well-formed\x00illegal character(s) in public id\x00parser suspended\x00parser not suspended\x00parsing aborted\x00parsing finished\x00cannot suspend in external parameter entity\x00reserved prefix (xml) must not be undeclared or bound to another namespace name\x00reserved prefix (xmlns) must not be declared or undeclared\x00prefix must not be bound to one of the reserved namespace names\x00invalid argument\x00a successful prior call to function XML_GetBuffer is required\x00limit on input amplification factor (from DTD and entities) breached\x00expat_2.5.0\x00sizeof(XML_Char)\x00sizeof(XML_LChar)\x00XML_DTD\x00XML_CONTEXT_BYTES\x00XML_NS\x00XML_BLAP_MAX_AMP\x00XML_BLAP_ACT_THRES\x00expat: Accounting(%p): Direct %10llu, indirect %10llu, amplification %8.2f%s\x00 ABORTING\n\x00DIR\x00EXP\x00 (+%6ld bytes %s|%d, xmlparse.c:%d) %*s\"\x00\x00%s\x00\"\n\x00%\x00&\x00expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n\x00OPEN \x00CLOSE\x00\\0\x00\\x1\x00\\x2\x00\\x3\x00\\x4\x00\\x5\x00\\x6\x00\\x7\x00\\x8\x00\\t\x00\\n\x00\\xB\x00\\xC\x00\\r\x00\\xE\x00\\xF\x00\\x10\x00\\x11\x00\\x12\x00\\x13\x00\\x14\x00\\x15\x00\\x16\x00\\x17\x00\\x18\x00\\x19\x00\\x1A\x00\\x1B\x00\\x1C\x00\\x1D\x00\\x1E\x00\\x1F\x00 \x00!\x00\\\"\x00#\x00$\x00'\x00(\x00)\x00*\x00+\x00,\x00-\x00.\x00/\x000\x001\x002\x003\x004\x005\x006\x007\x008\x009\x00:\x00;\x00<\x00=\x00>\x00?\x00@\x00A\x00B\x00C\x00D\x00E\x00F\x00G\x00H\x00I\x00J\x00K\x00L\x00M\x00N\x00O\x00P\x00Q\x00R\x00S\x00T\x00U\x00V\x00W\x00X\x00Y\x00Z\x00[\x00\\\\\x00]\x00^\x00_\x00`\x00a\x00b\x00c\x00d\x00e\x00f\x00g\x00h\x00i\x00j\x00k\x00l\x00m\x00n\x00o\x00p\x00q\x00r\x00s\x00t\x00u\x00v\x00w\x00x\x00y\x00z\x00{\x00|\x00}\x00~\x00\\x7F\x00\\x80\x00\\x81\x00\\x82\x00\\x83\x00\\x84\x00\\x85\x00\\x86\x00\\x87\x00\\x88\x00\\x89\x00\\x8A\x00\\x8B\x00\\x8C\x00\\x8D\x00\\x8E\x00\\x8F\x00\\x90\x00\\x91\x00\\x92\x00\\x93\x00\\x94\x00\\x95\x00\\x96\x00\\x97\x00\\x98\x00\\x99\x00\\x9A\x00\\x9B\x00\\x9C\x00\\x9D\x00\\x9E\x00\\x9F\x00\\xA0\x00\\xA1\x00\\xA2\x00\\xA3\x00\\xA4\x00\\xA5\x00\\xA6\x00\\xA7\x00\\xA8\x00\\xA9\x00\\xAA\x00\\xAB\x00\\xAC\x00\\xAD\x00\\xAE\x00\\xAF\x00\\xB0\x00\\xB1\x00\\xB2\x00\\xB3\x00\\xB4\x00\\xB5\x00\\xB6\x00\\xB7\x00\\xB8\x00\\xB9\x00\\xBA\x00\\xBB\x00\\xBC\x00\\xBD\x00\\xBE\x00\\xBF\x00\\xC0\x00\\xC1\x00\\xC2\x00\\xC3\x00\\xC4\x00\\xC5\x00\\xC6\x00\\xC7\x00\\xC8\x00\\xC9\x00\\xCA\x00\\xCB\x00\\xCC\x00\\xCD\x00\\xCE\x00\\xCF\x00\\xD0\x00\\xD1\x00\\xD2\x00\\xD3\x00\\xD4\x00\\xD5\x00\\xD6\x00\\xD7\x00\\xD8\x00\\xD9\x00\\xDA\x00\\xDB\x00\\xDC\x00\\xDD\x00\\xDE\x00\\xDF\x00\\xE0\x00\\xE1\x00\\xE2\x00\\xE3\x00\\xE4\x00\\xE5\x00\\xE6\x00\\xE7\x00\\xE8\x00\\xE9\x00\\xEA\x00\\xEB\x00\\xEC\x00\\xED\x00\\xEE\x00\\xEF\x00\\xF0\x00\\xF1\x00\\xF2\x00\\xF3\x00\\xF4\x00\\xF5\x00\\xF6\x00\\xF7\x00\\xF8\x00\\xF9\x00\\xFA\x00\\xFB\x00\\xFC\x00\\xFD\x00\\xFE\x00\\xFF\x00dead code\x00"