ccgo_linux_loong64.go 1.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240
  1. // Code generated for linux/loong64 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/cznic/src/modernc.org/builder/.exclude/modernc.org/libbsd/include/linux/loong64 -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 linux && loong64
  3. package libexpat
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libbsd"
  8. "modernc.org/libc"
  9. )
  10. var _ reflect.Type
  11. var _ unsafe.Pointer
  12. const m_ARG_MAX = 131072
  13. const m_ASCII_0 = 48
  14. const m_ASCII_1 = 49
  15. const m_ASCII_2 = 50
  16. const m_ASCII_3 = 51
  17. const m_ASCII_4 = 0x34
  18. const m_ASCII_5 = 0x35
  19. const m_ASCII_6 = 0x36
  20. const m_ASCII_7 = 0x37
  21. const m_ASCII_8 = 56
  22. const m_ASCII_9 = 57
  23. const m_ASCII_A = 65
  24. const m_ASCII_AMP = 0x26
  25. const m_ASCII_APOS = 0x27
  26. const m_ASCII_B = 0x42
  27. const m_ASCII_C = 67
  28. const m_ASCII_COLON = 58
  29. const m_ASCII_COMMA = 44
  30. const m_ASCII_D = 68
  31. const m_ASCII_E = 69
  32. const m_ASCII_EQUALS = 61
  33. const m_ASCII_EXCL = 33
  34. const m_ASCII_F = 70
  35. const m_ASCII_FF = 12
  36. const m_ASCII_G = 0x47
  37. const m_ASCII_GT = 0x3E
  38. const m_ASCII_H = 0x48
  39. const m_ASCII_HASH = 35
  40. const m_ASCII_I = 73
  41. const m_ASCII_J = 0x4A
  42. const m_ASCII_K = 75
  43. const m_ASCII_L = 76
  44. const m_ASCII_LPAREN = 40
  45. const m_ASCII_LSQB = 0x5B
  46. const m_ASCII_LT = 0x3C
  47. const m_ASCII_M = 77
  48. const m_ASCII_MINUS = 0x2D
  49. const m_ASCII_N = 78
  50. const m_ASCII_O = 79
  51. const m_ASCII_P = 0x50
  52. const m_ASCII_PERIOD = 46
  53. const m_ASCII_PIPE = 124
  54. const m_ASCII_Q = 0x51
  55. const m_ASCII_QUOT = 0x22
  56. const m_ASCII_R = 82
  57. const m_ASCII_RPAREN = 41
  58. const m_ASCII_RSQB = 0x5D
  59. const m_ASCII_S = 83
  60. const m_ASCII_SEMI = 0x3B
  61. const m_ASCII_SLASH = 47
  62. const m_ASCII_SPACE = 0x20
  63. const m_ASCII_T = 84
  64. const m_ASCII_TAB = 0x09
  65. const m_ASCII_U = 0x55
  66. const m_ASCII_UNDERSCORE = 0x5F
  67. const m_ASCII_V = 0x56
  68. const m_ASCII_W = 0x57
  69. const m_ASCII_X = 88
  70. const m_ASCII_Y = 89
  71. const m_ASCII_Z = 0x5A
  72. const m_ASCII_a = 97
  73. const m_ASCII_b = 0x62
  74. const m_ASCII_c = 99
  75. const m_ASCII_d = 0x64
  76. const m_ASCII_e = 101
  77. const m_ASCII_f = 0x66
  78. const m_ASCII_g = 103
  79. const m_ASCII_h = 104
  80. const m_ASCII_i = 0x69
  81. const m_ASCII_j = 0x6A
  82. const m_ASCII_k = 0x6B
  83. const m_ASCII_l = 108
  84. const m_ASCII_m = 109
  85. const m_ASCII_n = 110
  86. const m_ASCII_o = 111
  87. const m_ASCII_p = 112
  88. const m_ASCII_q = 0x71
  89. const m_ASCII_r = 114
  90. const m_ASCII_s = 115
  91. const m_ASCII_t = 116
  92. const m_ASCII_u = 0x75
  93. const m_ASCII_v = 0x76
  94. const m_ASCII_w = 119
  95. const m_ASCII_x = 120
  96. const m_ASCII_y = 0x79
  97. const m_ASCII_z = 0x7A
  98. const m_AT_EACCESS = 0x200
  99. const m_AT_EMPTY_PATH = 0x1000
  100. const m_AT_NO_AUTOMOUNT = 0x800
  101. const m_AT_RECURSIVE = 0x8000
  102. const m_AT_REMOVEDIR = 0x200
  103. const m_AT_STATX_DONT_SYNC = 0x4000
  104. const m_AT_STATX_FORCE_SYNC = 0x2000
  105. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  106. const m_AT_STATX_SYNC_TYPE = 0x6000
  107. const m_AT_SYMLINK_FOLLOW = 0x400
  108. const m_AT_SYMLINK_NOFOLLOW = 0x100
  109. const m_BC_BASE_MAX = 99
  110. const m_BC_DIM_MAX = 2048
  111. const m_BC_SCALE_MAX = 99
  112. const m_BC_STRING_MAX = 1000
  113. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  114. const m_BUFSIZ = 1024
  115. const m_BYTEORDER = 1234
  116. const m_BYTE_ORDER = "__BYTE_ORDER"
  117. const m_CHARCLASS_NAME_MAX = 14
  118. const m_CHAR_BIT = 8
  119. const m_CHAR_MAX = 255
  120. const m_CHAR_MIN = 0
  121. const m_COLL_WEIGHTS_MAX = 2
  122. const m_DELAYTIMER_MAX = 0x7fffffff
  123. const m_DN_ACCESS = 0x00000001
  124. const m_DN_ATTRIB = 0x00000020
  125. const m_DN_CREATE = 0x00000004
  126. const m_DN_DELETE = 0x00000008
  127. const m_DN_MODIFY = 0x00000002
  128. const m_DN_MULTISHOT = 0x80000000
  129. const m_DN_RENAME = 0x00000010
  130. const m_E2BIG = 7
  131. const m_EACCES = 13
  132. const m_EADDRINUSE = 98
  133. const m_EADDRNOTAVAIL = 99
  134. const m_EADV = 68
  135. const m_EAFNOSUPPORT = 97
  136. const m_EAGAIN = 11
  137. const m_EALREADY = 114
  138. const m_EBADE = 52
  139. const m_EBADF = 9
  140. const m_EBADFD = 77
  141. const m_EBADMSG = 74
  142. const m_EBADR = 53
  143. const m_EBADRQC = 56
  144. const m_EBADSLT = 57
  145. const m_EBFONT = 59
  146. const m_EBUSY = 16
  147. const m_ECANCELED = 125
  148. const m_ECHILD = 10
  149. const m_ECHRNG = 44
  150. const m_ECOMM = 70
  151. const m_ECONNABORTED = 103
  152. const m_ECONNREFUSED = 111
  153. const m_ECONNRESET = 104
  154. const m_EDEADLK = 35
  155. const m_EDEADLOCK = "EDEADLK"
  156. const m_EDESTADDRREQ = 89
  157. const m_EDOM = 33
  158. const m_EDOTDOT = 73
  159. const m_EDQUOT = 122
  160. const m_EEXIST = 17
  161. const m_EFAULT = 14
  162. const m_EFBIG = 27
  163. const m_EHOSTDOWN = 112
  164. const m_EHOSTUNREACH = 113
  165. const m_EHWPOISON = 133
  166. const m_EIDRM = 43
  167. const m_EILSEQ = 84
  168. const m_EINPROGRESS = 115
  169. const m_EINTR = 4
  170. const m_EINVAL = 22
  171. const m_EIO = 5
  172. const m_EISCONN = 106
  173. const m_EISDIR = 21
  174. const m_EISNAM = 120
  175. const m_EKEYEXPIRED = 127
  176. const m_EKEYREJECTED = 129
  177. const m_EKEYREVOKED = 128
  178. const m_EL2HLT = 51
  179. const m_EL2NSYNC = 45
  180. const m_EL3HLT = 46
  181. const m_EL3RST = 47
  182. const m_ELIBACC = 79
  183. const m_ELIBBAD = 80
  184. const m_ELIBEXEC = 83
  185. const m_ELIBMAX = 82
  186. const m_ELIBSCN = 81
  187. const m_ELNRNG = 48
  188. const m_ELOOP = 40
  189. const m_EMEDIUMTYPE = 124
  190. const m_EMFILE = 24
  191. const m_EMLINK = 31
  192. const m_EMSGSIZE = 90
  193. const m_EMULTIHOP = 72
  194. const m_ENAMETOOLONG = 36
  195. const m_ENAVAIL = 119
  196. const m_ENETDOWN = 100
  197. const m_ENETRESET = 102
  198. const m_ENETUNREACH = 101
  199. const m_ENFILE = 23
  200. const m_ENOANO = 55
  201. const m_ENOBUFS = 105
  202. const m_ENOCSI = 50
  203. const m_ENODATA = 61
  204. const m_ENODEV = 19
  205. const m_ENOENT = 2
  206. const m_ENOEXEC = 8
  207. const m_ENOKEY = 126
  208. const m_ENOLCK = 37
  209. const m_ENOLINK = 67
  210. const m_ENOMEDIUM = 123
  211. const m_ENOMEM = 12
  212. const m_ENOMSG = 42
  213. const m_ENONET = 64
  214. const m_ENOPKG = 65
  215. const m_ENOPROTOOPT = 92
  216. const m_ENOSPC = 28
  217. const m_ENOSR = 63
  218. const m_ENOSTR = 60
  219. const m_ENOSYS = 38
  220. const m_ENOTBLK = 15
  221. const m_ENOTCONN = 107
  222. const m_ENOTDIR = 20
  223. const m_ENOTEMPTY = 39
  224. const m_ENOTNAM = 118
  225. const m_ENOTRECOVERABLE = 131
  226. const m_ENOTSOCK = 88
  227. const m_ENOTSUP = "EOPNOTSUPP"
  228. const m_ENOTTY = 25
  229. const m_ENOTUNIQ = 76
  230. const m_ENXIO = 6
  231. const m_EOPNOTSUPP = 95
  232. const m_EOVERFLOW = 75
  233. const m_EOWNERDEAD = 130
  234. const m_EPERM = 1
  235. const m_EPFNOSUPPORT = 96
  236. const m_EPIPE = 32
  237. const m_EPROTO = 71
  238. const m_EPROTONOSUPPORT = 93
  239. const m_EPROTOTYPE = 91
  240. const m_ERANGE = 34
  241. const m_EREMCHG = 78
  242. const m_EREMOTE = 66
  243. const m_EREMOTEIO = 121
  244. const m_ERESTART = 85
  245. const m_ERFKILL = 132
  246. const m_EROFS = 30
  247. const m_ESHUTDOWN = 108
  248. const m_ESOCKTNOSUPPORT = 94
  249. const m_ESPIPE = 29
  250. const m_ESRCH = 3
  251. const m_ESRMNT = 69
  252. const m_ESTALE = 116
  253. const m_ESTRPIPE = 86
  254. const m_ETIME = 62
  255. const m_ETIMEDOUT = 110
  256. const m_ETOOMANYREFS = 109
  257. const m_ETXTBSY = 26
  258. const m_EUCLEAN = 117
  259. const m_EUNATCH = 49
  260. const m_EUSERS = 87
  261. const m_EWOULDBLOCK = "EAGAIN"
  262. const m_EXDEV = 18
  263. const m_EXFULL = 54
  264. const m_EXIT_FAILURE = 1
  265. const m_EXIT_SUCCESS = 0
  266. const m_EXPAND_SPARE = 24
  267. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 8388608
  268. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 100
  269. const m_EXPAT_CONFIG_H = 1
  270. const m_EXPR_NEST_MAX = 32
  271. const m_Expat_External_INCLUDED = 1
  272. const m_Expat_INCLUDED = 1
  273. const m_FALLOC_FL_KEEP_SIZE = 1
  274. const m_FALLOC_FL_PUNCH_HOLE = 2
  275. const m_FAPPEND = "O_APPEND"
  276. const m_FASYNC = "O_ASYNC"
  277. const m_FD_CLOEXEC = 1
  278. const m_FD_SETSIZE = 1024
  279. const m_FFSYNC = "O_SYNC"
  280. const m_FILENAME_MAX = 4096
  281. const m_FILESIZEBITS = 64
  282. const m_FNDELAY = "O_NDELAY"
  283. const m_FNONBLOCK = "O_NONBLOCK"
  284. const m_FOPEN_MAX = 1000
  285. const m_FP_FAST_FMA = 1
  286. const m_FP_FAST_FMAF = 1
  287. const m_FP_ILOGB0 = "FP_ILOGBNAN"
  288. const m_FP_INFINITE = 1
  289. const m_FP_NAN = 0
  290. const m_FP_NORMAL = 4
  291. const m_FP_SUBNORMAL = 3
  292. const m_FP_ZERO = 2
  293. const m_F_ADD_SEALS = 1033
  294. const m_F_CANCELLK = 1029
  295. const m_F_DUPFD = 0
  296. const m_F_DUPFD_CLOEXEC = 1030
  297. const m_F_GETFD = 1
  298. const m_F_GETFL = 3
  299. const m_F_GETLEASE = 1025
  300. const m_F_GETLK = 5
  301. const m_F_GETOWN = 9
  302. const m_F_GETOWNER_UIDS = 17
  303. const m_F_GETOWN_EX = 16
  304. const m_F_GETPIPE_SZ = 1032
  305. const m_F_GETSIG = 11
  306. const m_F_GET_FILE_RW_HINT = 1037
  307. const m_F_GET_RW_HINT = 1035
  308. const m_F_GET_SEALS = 1034
  309. const m_F_LOCK = 1
  310. const m_F_NOTIFY = 1026
  311. const m_F_OFD_GETLK = 36
  312. const m_F_OFD_SETLK = 37
  313. const m_F_OFD_SETLKW = 38
  314. const m_F_OK = 0
  315. const m_F_OWNER_GID = 2
  316. const m_F_OWNER_PGRP = 2
  317. const m_F_OWNER_PID = 1
  318. const m_F_OWNER_TID = 0
  319. const m_F_RDLCK = 0
  320. const m_F_SEAL_FUTURE_WRITE = 0x0010
  321. const m_F_SEAL_GROW = 0x0004
  322. const m_F_SEAL_SEAL = 0x0001
  323. const m_F_SEAL_SHRINK = 0x0002
  324. const m_F_SEAL_WRITE = 0x0008
  325. const m_F_SETFD = 2
  326. const m_F_SETFL = 4
  327. const m_F_SETLEASE = 1024
  328. const m_F_SETLK = 6
  329. const m_F_SETLKW = 7
  330. const m_F_SETOWN = 8
  331. const m_F_SETOWN_EX = 15
  332. const m_F_SETPIPE_SZ = 1031
  333. const m_F_SETSIG = 10
  334. const m_F_SET_FILE_RW_HINT = 1038
  335. const m_F_SET_RW_HINT = 1036
  336. const m_F_TEST = 3
  337. const m_F_TLOCK = 2
  338. const m_F_ULOCK = 0
  339. const m_F_UNLCK = 2
  340. const m_F_WRLCK = 1
  341. const m_GRND_INSECURE = 0x0004
  342. const m_GRND_NONBLOCK = 0x0001
  343. const m_GRND_RANDOM = 0x0002
  344. const m_HAVE_ARC4RANDOM_BUF = 1
  345. const m_HAVE_CONFIG_H = 1
  346. const m_HAVE_DLFCN_H = 1
  347. const m_HAVE_FCNTL_H = 1
  348. const m_HAVE_GETPAGESIZE = 1
  349. const m_HAVE_GETRANDOM = 1
  350. const m_HAVE_INTTYPES_H = 1
  351. const m_HAVE_MMAP = 1
  352. const m_HAVE_STDINT_H = 1
  353. const m_HAVE_STDIO_H = 1
  354. const m_HAVE_STDLIB_H = 1
  355. const m_HAVE_STRINGS_H = 1
  356. const m_HAVE_STRING_H = 1
  357. const m_HAVE_SYSCALL_GETRANDOM = 1
  358. const m_HAVE_SYS_PARAM_H = 1
  359. const m_HAVE_SYS_STAT_H = 1
  360. const m_HAVE_SYS_TYPES_H = 1
  361. const m_HAVE_UNISTD_H = 1
  362. const m_HOST_NAME_MAX = 255
  363. const m_HUGE = 3.40282346638528859812e+38
  364. const m_HUGE_VALF = "INFINITY"
  365. const m_INIT_ATTS_SIZE = 16
  366. const m_INIT_ATTS_VERSION = 4294967295
  367. const m_INIT_BLOCK_SIZE = 1024
  368. const m_INIT_BUFFER_SIZE = 1024
  369. const m_INIT_DATA_BUF_SIZE = 1024
  370. const m_INIT_POWER = 6
  371. const m_INIT_SCAFFOLD_ELEMENTS = 32
  372. const m_INIT_TAG_BUF_SIZE = 32
  373. const m_INT16_MAX = 0x7fff
  374. const m_INT32_MAX = 0x7fffffff
  375. const m_INT64_MAX = 0x7fffffffffffffff
  376. const m_INT8_MAX = 0x7f
  377. const m_INTMAX_MAX = "INT64_MAX"
  378. const m_INTMAX_MIN = "INT64_MIN"
  379. const m_INTPTR_MAX = "INT64_MAX"
  380. const m_INTPTR_MIN = "INT64_MIN"
  381. const m_INT_FAST16_MAX = "INT32_MAX"
  382. const m_INT_FAST16_MIN = "INT32_MIN"
  383. const m_INT_FAST32_MAX = "INT32_MAX"
  384. const m_INT_FAST32_MIN = "INT32_MIN"
  385. const m_INT_FAST64_MAX = "INT64_MAX"
  386. const m_INT_FAST64_MIN = "INT64_MIN"
  387. const m_INT_FAST8_MAX = "INT8_MAX"
  388. const m_INT_FAST8_MIN = "INT8_MIN"
  389. const m_INT_LEAST16_MAX = "INT16_MAX"
  390. const m_INT_LEAST16_MIN = "INT16_MIN"
  391. const m_INT_LEAST32_MAX = "INT32_MAX"
  392. const m_INT_LEAST32_MIN = "INT32_MIN"
  393. const m_INT_LEAST64_MAX = "INT64_MAX"
  394. const m_INT_LEAST64_MIN = "INT64_MIN"
  395. const m_INT_LEAST8_MAX = "INT8_MAX"
  396. const m_INT_LEAST8_MIN = "INT8_MIN"
  397. const m_INT_MAX = 2147483647
  398. const m_IOV_MAX = 1024
  399. const m_ITIMER_PROF = 2
  400. const m_ITIMER_REAL = 0
  401. const m_ITIMER_VIRTUAL = 1
  402. const m_LINE_MAX = 4096
  403. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  404. const m_LLONG_MAX = 0x7fffffffffffffff
  405. const m_LOGIN_NAME_MAX = 256
  406. const m_LONG_BIT = 64
  407. const m_LONG_MAX = "__LONG_MAX"
  408. const m_LT_OBJDIR = ".libs/"
  409. const m_L_INCR = 1
  410. const m_L_SET = 0
  411. const m_L_XTND = 2
  412. const m_L_ctermid = 20
  413. const m_L_cuserid = 20
  414. const m_L_tmpnam = 20
  415. const m_MATH_ERREXCEPT = 2
  416. const m_MATH_ERRNO = 1
  417. const m_MAX_HANDLE_SZ = 128
  418. const m_MB_LEN_MAX = 4
  419. const m_MQ_PRIO_MAX = 32768
  420. const m_M_1_PI = 0.31830988618379067154
  421. const m_M_2_PI = 0.63661977236758134308
  422. const m_M_2_SQRTPI = 1.12837916709551257390
  423. const m_M_E = 2.7182818284590452354
  424. const m_M_LN10 = 2.30258509299404568402
  425. const m_M_LN2 = 0.69314718055994530942
  426. const m_M_LOG10E = 0.43429448190325182765
  427. const m_M_LOG2E = 1.4426950408889634074
  428. const m_M_PI = 3.14159265358979323846
  429. const m_M_PI_2 = 1.57079632679489661923
  430. const m_M_PI_4 = 0.78539816339744830962
  431. const m_M_SQRT1_2 = 0.70710678118654752440
  432. const m_M_SQRT2 = 1.41421356237309504880
  433. const m_NAME_MAX = 255
  434. const m_NDEBUG = 1
  435. const m_NGROUPS_MAX = 32
  436. const m_NL_ARGMAX = 9
  437. const m_NL_LANGMAX = 32
  438. const m_NL_MSGMAX = 32767
  439. const m_NL_NMAX = 16
  440. const m_NL_SETMAX = 255
  441. const m_NL_TEXTMAX = 2048
  442. const m_NZERO = 20
  443. const m_O_APPEND = 02000
  444. const m_O_ASYNC = 020000
  445. const m_O_CLOEXEC = 02000000
  446. const m_O_CREAT = 0100
  447. const m_O_DIRECT = 040000
  448. const m_O_DIRECTORY = 0200000
  449. const m_O_DSYNC = 010000
  450. const m_O_EXCL = 0200
  451. const m_O_EXEC = "O_PATH"
  452. const m_O_LARGEFILE = 0100000
  453. const m_O_NDELAY = "O_NONBLOCK"
  454. const m_O_NOATIME = 01000000
  455. const m_O_NOCTTY = 0400
  456. const m_O_NOFOLLOW = 0400000
  457. const m_O_NONBLOCK = 04000
  458. const m_O_PATH = 010000000
  459. const m_O_RDONLY = 00
  460. const m_O_RDWR = 02
  461. const m_O_RSYNC = 04010000
  462. const m_O_SEARCH = "O_PATH"
  463. const m_O_SYNC = 04010000
  464. const m_O_TMPFILE = 020200000
  465. const m_O_TRUNC = 01000
  466. const m_O_TTY_INIT = 0
  467. const m_O_WRONLY = 01
  468. const m_PACKAGE = "expat"
  469. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  470. const m_PACKAGE_NAME = "expat"
  471. const m_PACKAGE_STRING = "expat 2.5.0"
  472. const m_PACKAGE_TARNAME = "expat"
  473. const m_PACKAGE_URL = ""
  474. const m_PACKAGE_VERSION = "2.5.0"
  475. const m_PATH_MAX = 4096
  476. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  477. const m_PIPE_BUF = 4096
  478. const m_POSIX_CLOSE_RESTART = 0
  479. const m_POSIX_FADV_DONTNEED = 4
  480. const m_POSIX_FADV_NOREUSE = 5
  481. const m_POSIX_FADV_NORMAL = 0
  482. const m_POSIX_FADV_RANDOM = 1
  483. const m_POSIX_FADV_SEQUENTIAL = 2
  484. const m_POSIX_FADV_WILLNEED = 3
  485. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  486. const m_PTHREAD_KEYS_MAX = 128
  487. const m_PTHREAD_STACK_MIN = 2048
  488. const m_PTRDIFF_MAX = "INT64_MAX"
  489. const m_PTRDIFF_MIN = "INT64_MIN"
  490. const m_P_tmpdir = "/tmp"
  491. const m_RAND_MAX = 0x7fffffff
  492. const m_RE_DUP_MAX = 255
  493. const m_RWF_WRITE_LIFE_NOT_SET = 0
  494. const m_RWH_WRITE_LIFE_EXTREME = 5
  495. const m_RWH_WRITE_LIFE_LONG = 4
  496. const m_RWH_WRITE_LIFE_MEDIUM = 3
  497. const m_RWH_WRITE_LIFE_NONE = 1
  498. const m_RWH_WRITE_LIFE_SHORT = 2
  499. const m_R_OK = 4
  500. const m_SCHAR_MAX = 127
  501. const m_SEEK_DATA = 3
  502. const m_SEEK_HOLE = 4
  503. const m_SEM_NSEMS_MAX = 256
  504. const m_SEM_VALUE_MAX = 0x7fffffff
  505. const m_SHRT_MAX = 0x7fff
  506. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  507. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  508. const m_SIP_KEYLEN = 16
  509. const m_SIZE_MAX = "UINT64_MAX"
  510. const m_SPLICE_F_GIFT = 8
  511. const m_SPLICE_F_MORE = 4
  512. const m_SPLICE_F_MOVE = 1
  513. const m_SPLICE_F_NONBLOCK = 2
  514. const m_SSIZE_MAX = "LONG_MAX"
  515. const m_STDC_HEADERS = 1
  516. const m_STDERR_FILENO = 2
  517. const m_STDIN_FILENO = 0
  518. const m_STDOUT_FILENO = 1
  519. const m_SYMLOOP_MAX = 40
  520. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  521. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  522. const m_SYNC_FILE_RANGE_WRITE = 2
  523. const m_S_IRGRP = 0040
  524. const m_S_IROTH = 0004
  525. const m_S_IRUSR = 0400
  526. const m_S_IRWXG = 0070
  527. const m_S_IRWXO = 0007
  528. const m_S_IRWXU = 0700
  529. const m_S_ISGID = 02000
  530. const m_S_ISUID = 04000
  531. const m_S_ISVTX = 01000
  532. const m_S_IWGRP = 0020
  533. const m_S_IWOTH = 0002
  534. const m_S_IWUSR = 0200
  535. const m_S_IXGRP = 0010
  536. const m_S_IXOTH = 0001
  537. const m_S_IXUSR = 0100
  538. const m_TMP_MAX = 10000
  539. const m_TTY_NAME_MAX = 32
  540. const m_TZNAME_MAX = 6
  541. const m_UCHAR_MAX = 255
  542. const m_UINT16_MAX = 0xffff
  543. const m_UINT32_MAX = "0xffffffffu"
  544. const m_UINT64_MAX = "0xffffffffffffffffu"
  545. const m_UINT8_MAX = 0xff
  546. const m_UINTMAX_MAX = "UINT64_MAX"
  547. const m_UINTPTR_MAX = "UINT64_MAX"
  548. const m_UINT_FAST16_MAX = "UINT32_MAX"
  549. const m_UINT_FAST32_MAX = "UINT32_MAX"
  550. const m_UINT_FAST64_MAX = "UINT64_MAX"
  551. const m_UINT_FAST8_MAX = "UINT8_MAX"
  552. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  553. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  554. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  555. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  556. const m_UINT_MAX = 4294967295
  557. const m_USHRT_MAX = 0xffff
  558. const m_VERSION = "2.5.0"
  559. const m_WINT_MAX = "UINT32_MAX"
  560. const m_WINT_MIN = 0
  561. const m_WNOHANG = 1
  562. const m_WORD_BIT = 32
  563. const m_WUNTRACED = 2
  564. const m_W_OK = 2
  565. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  566. const m_XML_BUILDING_EXPAT = 1
  567. const m_XML_CDATA_SECTION_STATE = 2
  568. const m_XML_CONTENT_STATE = 1
  569. const m_XML_CONTEXT_BYTES = 1024
  570. const m_XML_DEV_URANDOM = 1
  571. const m_XML_DTD = 1
  572. const m_XML_ENABLE_VISIBILITY = 0
  573. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  574. const m_XML_ENTITY_VALUE_LITERAL = 1
  575. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  576. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  577. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  578. const m_XML_IGNORE_SECTION_STATE = 3
  579. const m_XML_MAJOR_VERSION = 2
  580. const m_XML_MICRO_VERSION = 0
  581. const m_XML_MINOR_VERSION = 5
  582. const m_XML_NS = 1
  583. const m_XML_N_LITERAL_TYPES = 2
  584. const m_XML_N_STATES = 4
  585. const m_XML_PROLOG_STATE = 0
  586. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  587. const m_XML_TOK_BOM = 14
  588. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  589. const m_XML_TOK_CDATA_SECT_OPEN = 8
  590. const m_XML_TOK_CHAR_REF = 10
  591. const m_XML_TOK_CLOSE_BRACKET = 26
  592. const m_XML_TOK_CLOSE_PAREN = 24
  593. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  594. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  595. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  596. const m_XML_TOK_COMMA = 38
  597. const m_XML_TOK_COMMENT = 13
  598. const m_XML_TOK_COND_SECT_CLOSE = 34
  599. const m_XML_TOK_COND_SECT_OPEN = 33
  600. const m_XML_TOK_DATA_CHARS = 6
  601. const m_XML_TOK_DATA_NEWLINE = 7
  602. const m_XML_TOK_DECL_CLOSE = 17
  603. const m_XML_TOK_DECL_OPEN = 16
  604. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  605. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  606. const m_XML_TOK_END_TAG = 5
  607. const m_XML_TOK_ENTITY_REF = 9
  608. const m_XML_TOK_IGNORE_SECT = 42
  609. const m_XML_TOK_INSTANCE_START = 29
  610. const m_XML_TOK_INVALID = 0
  611. const m_XML_TOK_LITERAL = 27
  612. const m_XML_TOK_NAME = 18
  613. const m_XML_TOK_NAME_ASTERISK = 31
  614. const m_XML_TOK_NAME_PLUS = 32
  615. const m_XML_TOK_NAME_QUESTION = 30
  616. const m_XML_TOK_NMTOKEN = 19
  617. const m_XML_TOK_OPEN_BRACKET = 25
  618. const m_XML_TOK_OPEN_PAREN = 23
  619. const m_XML_TOK_OR = 21
  620. const m_XML_TOK_PARAM_ENTITY_REF = 28
  621. const m_XML_TOK_PERCENT = 22
  622. const m_XML_TOK_PI = 11
  623. const m_XML_TOK_POUND_NAME = 20
  624. const m_XML_TOK_PREFIXED_NAME = 41
  625. const m_XML_TOK_PROLOG_S = 15
  626. const m_XML_TOK_START_TAG_NO_ATTS = 2
  627. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  628. const m_XML_TOK_XML_DECL = 12
  629. const m_XML_UTF16_ENCODE_MAX = 2
  630. const m_XML_UTF8_ENCODE_MAX = 4
  631. const m_X_OK = 1
  632. const m_XmlConvert = "XmlUtf8Convert"
  633. const m_XmlEncode = "XmlUtf8Encode"
  634. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  635. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  636. const m_XmlRole_INCLUDED = 1
  637. const m_XmlTok_INCLUDED = 1
  638. const m__ABILP64 = 3
  639. const m__CS_GNU_LIBC_VERSION = 2
  640. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  641. const m__CS_PATH = 0
  642. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  643. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  644. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  645. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  646. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  647. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  648. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  649. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  650. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  651. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  652. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  653. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  654. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  655. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  656. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  657. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  658. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  659. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  660. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  661. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  662. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  663. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  664. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  665. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  666. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  667. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  668. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  669. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  670. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  671. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  672. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  673. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  674. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  675. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  676. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  677. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  678. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  679. const m__CS_V6_ENV = 1148
  680. const m__CS_V7_ENV = 1149
  681. const m__GNU_SOURCE = 1
  682. const m__IOFBF = 0
  683. const m__IOLBF = 1
  684. const m__IONBF = 2
  685. const m__LOONGARCH_ARCH = "la64v1.0"
  686. const m__LOONGARCH_FPSET = 32
  687. const m__LOONGARCH_SIM = "_ABILP64"
  688. const m__LOONGARCH_SPFPSET = 32
  689. const m__LOONGARCH_SZINT = 32
  690. const m__LOONGARCH_SZLONG = 64
  691. const m__LOONGARCH_SZPTR = 64
  692. const m__LOONGARCH_TUNE = "generic"
  693. const m__LP64 = 1
  694. const m__PC_2_SYMLINKS = 20
  695. const m__PC_ALLOC_SIZE_MIN = 18
  696. const m__PC_ASYNC_IO = 10
  697. const m__PC_CHOWN_RESTRICTED = 6
  698. const m__PC_FILESIZEBITS = 13
  699. const m__PC_LINK_MAX = 0
  700. const m__PC_MAX_CANON = 1
  701. const m__PC_MAX_INPUT = 2
  702. const m__PC_NAME_MAX = 3
  703. const m__PC_NO_TRUNC = 7
  704. const m__PC_PATH_MAX = 4
  705. const m__PC_PIPE_BUF = 5
  706. const m__PC_PRIO_IO = 11
  707. const m__PC_REC_INCR_XFER_SIZE = 14
  708. const m__PC_REC_MAX_XFER_SIZE = 15
  709. const m__PC_REC_MIN_XFER_SIZE = 16
  710. const m__PC_REC_XFER_ALIGN = 17
  711. const m__PC_SOCK_MAXBUF = 12
  712. const m__PC_SYMLINK_MAX = 19
  713. const m__PC_SYNC_IO = 9
  714. const m__PC_VDISABLE = 8
  715. const m__POSIX2_BC_BASE_MAX = 99
  716. const m__POSIX2_BC_DIM_MAX = 2048
  717. const m__POSIX2_BC_SCALE_MAX = 99
  718. const m__POSIX2_BC_STRING_MAX = 1000
  719. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  720. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  721. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  722. const m__POSIX2_EXPR_NEST_MAX = 32
  723. const m__POSIX2_LINE_MAX = 2048
  724. const m__POSIX2_RE_DUP_MAX = 255
  725. const m__POSIX2_VERSION = "_POSIX_VERSION"
  726. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  727. const m__POSIX_AIO_LISTIO_MAX = 2
  728. const m__POSIX_AIO_MAX = 1
  729. const m__POSIX_ARG_MAX = 4096
  730. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  731. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  732. const m__POSIX_CHILD_MAX = 25
  733. const m__POSIX_CHOWN_RESTRICTED = 1
  734. const m__POSIX_CLOCKRES_MIN = 20000000
  735. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  736. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  737. const m__POSIX_DELAYTIMER_MAX = 32
  738. const m__POSIX_FSYNC = "_POSIX_VERSION"
  739. const m__POSIX_HOST_NAME_MAX = 255
  740. const m__POSIX_IPV6 = "_POSIX_VERSION"
  741. const m__POSIX_JOB_CONTROL = 1
  742. const m__POSIX_LINK_MAX = 8
  743. const m__POSIX_LOGIN_NAME_MAX = 9
  744. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  745. const m__POSIX_MAX_CANON = 255
  746. const m__POSIX_MAX_INPUT = 255
  747. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  748. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  749. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  750. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  751. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  752. const m__POSIX_MQ_OPEN_MAX = 8
  753. const m__POSIX_MQ_PRIO_MAX = 32
  754. const m__POSIX_NAME_MAX = 14
  755. const m__POSIX_NGROUPS_MAX = 8
  756. const m__POSIX_NO_TRUNC = 1
  757. const m__POSIX_OPEN_MAX = 20
  758. const m__POSIX_PATH_MAX = 256
  759. const m__POSIX_PIPE_BUF = 512
  760. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  761. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  762. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  763. const m__POSIX_REGEXP = 1
  764. const m__POSIX_RE_DUP_MAX = 255
  765. const m__POSIX_RTSIG_MAX = 8
  766. const m__POSIX_SAVED_IDS = 1
  767. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  768. const m__POSIX_SEM_NSEMS_MAX = 256
  769. const m__POSIX_SEM_VALUE_MAX = 32767
  770. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  771. const m__POSIX_SHELL = 1
  772. const m__POSIX_SIGQUEUE_MAX = 32
  773. const m__POSIX_SPAWN = "_POSIX_VERSION"
  774. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  775. const m__POSIX_SSIZE_MAX = 32767
  776. const m__POSIX_SS_REPL_MAX = 4
  777. const m__POSIX_STREAM_MAX = 8
  778. const m__POSIX_SYMLINK_MAX = 255
  779. const m__POSIX_SYMLOOP_MAX = 8
  780. const m__POSIX_THREADS = "_POSIX_VERSION"
  781. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  782. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  783. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  784. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  785. const m__POSIX_THREAD_KEYS_MAX = 128
  786. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  787. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  788. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  789. const m__POSIX_THREAD_THREADS_MAX = 64
  790. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  791. const m__POSIX_TIMERS = "_POSIX_VERSION"
  792. const m__POSIX_TIMER_MAX = 32
  793. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  794. const m__POSIX_TRACE_NAME_MAX = 8
  795. const m__POSIX_TRACE_SYS_MAX = 8
  796. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  797. const m__POSIX_TTY_NAME_MAX = 9
  798. const m__POSIX_TZNAME_MAX = 6
  799. const m__POSIX_V6_LP64_OFF64 = 1
  800. const m__POSIX_V7_LP64_OFF64 = 1
  801. const m__POSIX_VDISABLE = 0
  802. const m__POSIX_VERSION = 200809
  803. const m__SC_2_CHAR_TERM = 95
  804. const m__SC_2_C_BIND = 47
  805. const m__SC_2_C_DEV = 48
  806. const m__SC_2_FORT_DEV = 49
  807. const m__SC_2_FORT_RUN = 50
  808. const m__SC_2_LOCALEDEF = 52
  809. const m__SC_2_PBS = 168
  810. const m__SC_2_PBS_ACCOUNTING = 169
  811. const m__SC_2_PBS_CHECKPOINT = 175
  812. const m__SC_2_PBS_LOCATE = 170
  813. const m__SC_2_PBS_MESSAGE = 171
  814. const m__SC_2_PBS_TRACK = 172
  815. const m__SC_2_SW_DEV = 51
  816. const m__SC_2_UPE = 97
  817. const m__SC_2_VERSION = 46
  818. const m__SC_ADVISORY_INFO = 132
  819. const m__SC_AIO_LISTIO_MAX = 23
  820. const m__SC_AIO_MAX = 24
  821. const m__SC_AIO_PRIO_DELTA_MAX = 25
  822. const m__SC_ARG_MAX = 0
  823. const m__SC_ASYNCHRONOUS_IO = 12
  824. const m__SC_ATEXIT_MAX = 87
  825. const m__SC_AVPHYS_PAGES = 86
  826. const m__SC_BARRIERS = 133
  827. const m__SC_BC_BASE_MAX = 36
  828. const m__SC_BC_DIM_MAX = 37
  829. const m__SC_BC_SCALE_MAX = 38
  830. const m__SC_BC_STRING_MAX = 39
  831. const m__SC_CHILD_MAX = 1
  832. const m__SC_CLK_TCK = 2
  833. const m__SC_CLOCK_SELECTION = 137
  834. const m__SC_COLL_WEIGHTS_MAX = 40
  835. const m__SC_CPUTIME = 138
  836. const m__SC_DELAYTIMER_MAX = 26
  837. const m__SC_EXPR_NEST_MAX = 42
  838. const m__SC_FSYNC = 15
  839. const m__SC_GETGR_R_SIZE_MAX = 69
  840. const m__SC_GETPW_R_SIZE_MAX = 70
  841. const m__SC_HOST_NAME_MAX = 180
  842. const m__SC_IOV_MAX = 60
  843. const m__SC_IPV6 = 235
  844. const m__SC_JOB_CONTROL = 7
  845. const m__SC_LINE_MAX = 43
  846. const m__SC_LOGIN_NAME_MAX = 71
  847. const m__SC_MAPPED_FILES = 16
  848. const m__SC_MEMLOCK = 17
  849. const m__SC_MEMLOCK_RANGE = 18
  850. const m__SC_MEMORY_PROTECTION = 19
  851. const m__SC_MESSAGE_PASSING = 20
  852. const m__SC_MINSIGSTKSZ = 249
  853. const m__SC_MONOTONIC_CLOCK = 149
  854. const m__SC_MQ_OPEN_MAX = 27
  855. const m__SC_MQ_PRIO_MAX = 28
  856. const m__SC_NGROUPS_MAX = 3
  857. const m__SC_NPROCESSORS_CONF = 83
  858. const m__SC_NPROCESSORS_ONLN = 84
  859. const m__SC_NZERO = 109
  860. const m__SC_OPEN_MAX = 4
  861. const m__SC_PAGESIZE = 30
  862. const m__SC_PAGE_SIZE = 30
  863. const m__SC_PASS_MAX = 88
  864. const m__SC_PHYS_PAGES = 85
  865. const m__SC_PRIORITIZED_IO = 13
  866. const m__SC_PRIORITY_SCHEDULING = 10
  867. const m__SC_RAW_SOCKETS = 236
  868. const m__SC_READER_WRITER_LOCKS = 153
  869. const m__SC_REALTIME_SIGNALS = 9
  870. const m__SC_REGEXP = 155
  871. const m__SC_RE_DUP_MAX = 44
  872. const m__SC_RTSIG_MAX = 31
  873. const m__SC_SAVED_IDS = 8
  874. const m__SC_SEMAPHORES = 21
  875. const m__SC_SEM_NSEMS_MAX = 32
  876. const m__SC_SEM_VALUE_MAX = 33
  877. const m__SC_SHARED_MEMORY_OBJECTS = 22
  878. const m__SC_SHELL = 157
  879. const m__SC_SIGQUEUE_MAX = 34
  880. const m__SC_SIGSTKSZ = 250
  881. const m__SC_SPAWN = 159
  882. const m__SC_SPIN_LOCKS = 154
  883. const m__SC_SPORADIC_SERVER = 160
  884. const m__SC_SS_REPL_MAX = 241
  885. const m__SC_STREAMS = 174
  886. const m__SC_STREAM_MAX = 5
  887. const m__SC_SYMLOOP_MAX = 173
  888. const m__SC_SYNCHRONIZED_IO = 14
  889. const m__SC_THREADS = 67
  890. const m__SC_THREAD_ATTR_STACKADDR = 77
  891. const m__SC_THREAD_ATTR_STACKSIZE = 78
  892. const m__SC_THREAD_CPUTIME = 139
  893. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  894. const m__SC_THREAD_KEYS_MAX = 74
  895. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  896. const m__SC_THREAD_PRIO_INHERIT = 80
  897. const m__SC_THREAD_PRIO_PROTECT = 81
  898. const m__SC_THREAD_PROCESS_SHARED = 82
  899. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  900. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  901. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  902. const m__SC_THREAD_SPORADIC_SERVER = 161
  903. const m__SC_THREAD_STACK_MIN = 75
  904. const m__SC_THREAD_THREADS_MAX = 76
  905. const m__SC_TIMEOUTS = 164
  906. const m__SC_TIMERS = 11
  907. const m__SC_TIMER_MAX = 35
  908. const m__SC_TRACE = 181
  909. const m__SC_TRACE_EVENT_FILTER = 182
  910. const m__SC_TRACE_EVENT_NAME_MAX = 242
  911. const m__SC_TRACE_INHERIT = 183
  912. const m__SC_TRACE_LOG = 184
  913. const m__SC_TRACE_NAME_MAX = 243
  914. const m__SC_TRACE_SYS_MAX = 244
  915. const m__SC_TRACE_USER_EVENT_MAX = 245
  916. const m__SC_TTY_NAME_MAX = 72
  917. const m__SC_TYPED_MEMORY_OBJECTS = 165
  918. const m__SC_TZNAME_MAX = 6
  919. const m__SC_UIO_MAXIOV = 60
  920. const m__SC_V6_ILP32_OFF32 = 176
  921. const m__SC_V6_ILP32_OFFBIG = 177
  922. const m__SC_V6_LP64_OFF64 = 178
  923. const m__SC_V6_LPBIG_OFFBIG = 179
  924. const m__SC_V7_ILP32_OFF32 = 237
  925. const m__SC_V7_ILP32_OFFBIG = 238
  926. const m__SC_V7_LP64_OFF64 = 239
  927. const m__SC_V7_LPBIG_OFFBIG = 240
  928. const m__SC_VERSION = 29
  929. const m__SC_XBS5_ILP32_OFF32 = 125
  930. const m__SC_XBS5_ILP32_OFFBIG = 126
  931. const m__SC_XBS5_LP64_OFF64 = 127
  932. const m__SC_XBS5_LPBIG_OFFBIG = 128
  933. const m__SC_XOPEN_CRYPT = 92
  934. const m__SC_XOPEN_ENH_I18N = 93
  935. const m__SC_XOPEN_LEGACY = 129
  936. const m__SC_XOPEN_REALTIME = 130
  937. const m__SC_XOPEN_REALTIME_THREADS = 131
  938. const m__SC_XOPEN_SHM = 94
  939. const m__SC_XOPEN_STREAMS = 246
  940. const m__SC_XOPEN_UNIX = 91
  941. const m__SC_XOPEN_VERSION = 89
  942. const m__SC_XOPEN_XCU_VERSION = 90
  943. const m__SC_XOPEN_XPG2 = 98
  944. const m__SC_XOPEN_XPG3 = 99
  945. const m__SC_XOPEN_XPG4 = 100
  946. const m__STDC_PREDEF_H = 1
  947. const m__XOPEN_ENH_I18N = 1
  948. const m__XOPEN_IOV_MAX = 16
  949. const m__XOPEN_NAME_MAX = 255
  950. const m__XOPEN_PATH_MAX = 1024
  951. const m__XOPEN_UNIX = 1
  952. const m__XOPEN_VERSION = 700
  953. const m___ACCUM_EPSILON__ = "0x1P-15K"
  954. const m___ACCUM_FBIT__ = 15
  955. const m___ACCUM_IBIT__ = 16
  956. const m___ACCUM_MAX__ = "0X7FFFFFFFP-15K"
  957. const m___ATOMIC_ACQUIRE = 2
  958. const m___ATOMIC_ACQ_REL = 4
  959. const m___ATOMIC_CONSUME = 1
  960. const m___ATOMIC_RELAXED = 0
  961. const m___ATOMIC_RELEASE = 3
  962. const m___ATOMIC_SEQ_CST = 5
  963. const m___BIGGEST_ALIGNMENT__ = 16
  964. const m___BIG_ENDIAN = 4321
  965. const m___BYTE_ORDER = 1234
  966. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  967. const m___CCGO__ = 1
  968. const m___CHAR_BIT__ = 8
  969. const m___DA_FBIT__ = 31
  970. const m___DA_IBIT__ = 32
  971. const m___DBL_DECIMAL_DIG__ = 17
  972. const m___DBL_DIG__ = 15
  973. const m___DBL_HAS_DENORM__ = 1
  974. const m___DBL_HAS_INFINITY__ = 1
  975. const m___DBL_HAS_QUIET_NAN__ = 1
  976. const m___DBL_IS_IEC_60559__ = 1
  977. const m___DBL_MANT_DIG__ = 53
  978. const m___DBL_MAX_10_EXP__ = 308
  979. const m___DBL_MAX_EXP__ = 1024
  980. const m___DECIMAL_DIG__ = 36
  981. const m___DEC_EVAL_METHOD__ = 2
  982. const m___DQ_FBIT__ = 63
  983. const m___DQ_IBIT__ = 0
  984. const m___ELF__ = 1
  985. const m___FINITE_MATH_ONLY__ = 0
  986. const m___FLOAT128_TYPE__ = 1
  987. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  988. const m___FLT128_DECIMAL_DIG__ = 36
  989. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  990. const m___FLT128_DIG__ = 33
  991. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  992. const m___FLT128_HAS_DENORM__ = 1
  993. const m___FLT128_HAS_INFINITY__ = 1
  994. const m___FLT128_HAS_QUIET_NAN__ = 1
  995. const m___FLT128_IS_IEC_60559__ = 1
  996. const m___FLT128_MANT_DIG__ = 113
  997. const m___FLT128_MAX_10_EXP__ = 4932
  998. const m___FLT128_MAX_EXP__ = 16384
  999. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1000. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  1001. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1002. const m___FLT32X_DECIMAL_DIG__ = 17
  1003. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1004. const m___FLT32X_DIG__ = 15
  1005. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1006. const m___FLT32X_HAS_DENORM__ = 1
  1007. const m___FLT32X_HAS_INFINITY__ = 1
  1008. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1009. const m___FLT32X_IS_IEC_60559__ = 1
  1010. const m___FLT32X_MANT_DIG__ = 53
  1011. const m___FLT32X_MAX_10_EXP__ = 308
  1012. const m___FLT32X_MAX_EXP__ = 1024
  1013. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1014. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1015. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1016. const m___FLT32_DECIMAL_DIG__ = 9
  1017. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1018. const m___FLT32_DIG__ = 6
  1019. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1020. const m___FLT32_HAS_DENORM__ = 1
  1021. const m___FLT32_HAS_INFINITY__ = 1
  1022. const m___FLT32_HAS_QUIET_NAN__ = 1
  1023. const m___FLT32_IS_IEC_60559__ = 1
  1024. const m___FLT32_MANT_DIG__ = 24
  1025. const m___FLT32_MAX_10_EXP__ = 38
  1026. const m___FLT32_MAX_EXP__ = 128
  1027. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1028. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1029. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1030. const m___FLT64X_DECIMAL_DIG__ = 36
  1031. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1032. const m___FLT64X_DIG__ = 33
  1033. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1034. const m___FLT64X_HAS_DENORM__ = 1
  1035. const m___FLT64X_HAS_INFINITY__ = 1
  1036. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1037. const m___FLT64X_IS_IEC_60559__ = 1
  1038. const m___FLT64X_MANT_DIG__ = 113
  1039. const m___FLT64X_MAX_10_EXP__ = 4932
  1040. const m___FLT64X_MAX_EXP__ = 16384
  1041. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1042. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1043. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1044. const m___FLT64_DECIMAL_DIG__ = 17
  1045. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1046. const m___FLT64_DIG__ = 15
  1047. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1048. const m___FLT64_HAS_DENORM__ = 1
  1049. const m___FLT64_HAS_INFINITY__ = 1
  1050. const m___FLT64_HAS_QUIET_NAN__ = 1
  1051. const m___FLT64_IS_IEC_60559__ = 1
  1052. const m___FLT64_MANT_DIG__ = 53
  1053. const m___FLT64_MAX_10_EXP__ = 308
  1054. const m___FLT64_MAX_EXP__ = 1024
  1055. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1056. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1057. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1058. const m___FLT_DECIMAL_DIG__ = 9
  1059. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1060. const m___FLT_DIG__ = 6
  1061. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1062. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1063. const m___FLT_EVAL_METHOD__ = 0
  1064. const m___FLT_HAS_DENORM__ = 1
  1065. const m___FLT_HAS_INFINITY__ = 1
  1066. const m___FLT_HAS_QUIET_NAN__ = 1
  1067. const m___FLT_IS_IEC_60559__ = 1
  1068. const m___FLT_MANT_DIG__ = 24
  1069. const m___FLT_MAX_10_EXP__ = 38
  1070. const m___FLT_MAX_EXP__ = 128
  1071. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1072. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1073. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1074. const m___FLT_RADIX__ = 2
  1075. const m___FP_FAST_FMA = 1
  1076. const m___FP_FAST_FMAF = 1
  1077. const m___FP_FAST_FMAF32 = 1
  1078. const m___FP_FAST_FMAF32x = 1
  1079. const m___FP_FAST_FMAF64 = 1
  1080. const m___FRACT_EPSILON__ = "0x1P-15R"
  1081. const m___FRACT_FBIT__ = 15
  1082. const m___FRACT_IBIT__ = 0
  1083. const m___FRACT_MAX__ = "0X7FFFP-15R"
  1084. const m___FUNCTION__ = "__func__"
  1085. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1086. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1087. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1088. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1089. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1090. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1091. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1092. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1093. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1094. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1095. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1096. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1097. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1098. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1099. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1100. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1101. const m___GCC_IEC_559 = 2
  1102. const m___GCC_IEC_559_COMPLEX = 2
  1103. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1104. const m___GNUC_MINOR__ = 2
  1105. const m___GNUC_PATCHLEVEL__ = 1
  1106. const m___GNUC_RH_RELEASE__ = 6
  1107. const m___GNUC_STDC_INLINE__ = 1
  1108. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1109. const m___GNUC__ = 14
  1110. const m___GXX_ABI_VERSION = 1019
  1111. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1112. const m___HA_FBIT__ = 7
  1113. const m___HA_IBIT__ = 8
  1114. const m___HQ_FBIT__ = 15
  1115. const m___HQ_IBIT__ = 0
  1116. const m___INT16_MAX__ = 0x7fff
  1117. const m___INT32_MAX__ = 0x7fffffff
  1118. const m___INT32_TYPE__ = "int"
  1119. const m___INT64_MAX__ = 0x7fffffffffffffff
  1120. const m___INT8_MAX__ = 0x7f
  1121. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1122. const m___INTMAX_WIDTH__ = 64
  1123. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1124. const m___INTPTR_WIDTH__ = 64
  1125. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1126. const m___INT_FAST16_WIDTH__ = 64
  1127. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1128. const m___INT_FAST32_WIDTH__ = 64
  1129. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1130. const m___INT_FAST64_WIDTH__ = 64
  1131. const m___INT_FAST8_MAX__ = 0x7f
  1132. const m___INT_FAST8_WIDTH__ = 8
  1133. const m___INT_LEAST16_MAX__ = 0x7fff
  1134. const m___INT_LEAST16_WIDTH__ = 16
  1135. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1136. const m___INT_LEAST32_TYPE__ = "int"
  1137. const m___INT_LEAST32_WIDTH__ = 32
  1138. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1139. const m___INT_LEAST64_WIDTH__ = 64
  1140. const m___INT_LEAST8_MAX__ = 0x7f
  1141. const m___INT_LEAST8_WIDTH__ = 8
  1142. const m___INT_MAX__ = 0x7fffffff
  1143. const m___INT_WIDTH__ = 32
  1144. const m___LACCUM_EPSILON__ = "0x1P-31LK"
  1145. const m___LACCUM_FBIT__ = 31
  1146. const m___LACCUM_IBIT__ = 32
  1147. const m___LACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFP-31LK"
  1148. const m___LDBL_DECIMAL_DIG__ = 36
  1149. const m___LDBL_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1150. const m___LDBL_DIG__ = 33
  1151. const m___LDBL_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1152. const m___LDBL_HAS_DENORM__ = 1
  1153. const m___LDBL_HAS_INFINITY__ = 1
  1154. const m___LDBL_HAS_QUIET_NAN__ = 1
  1155. const m___LDBL_IS_IEC_60559__ = 1
  1156. const m___LDBL_MANT_DIG__ = 113
  1157. const m___LDBL_MAX_10_EXP__ = 4932
  1158. const m___LDBL_MAX_EXP__ = 16384
  1159. const m___LDBL_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1160. const m___LDBL_MIN__ = 3.36210314311209350626267781732175260e-4932
  1161. const m___LDBL_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1162. const m___LFRACT_EPSILON__ = "0x1P-31LR"
  1163. const m___LFRACT_FBIT__ = 31
  1164. const m___LFRACT_IBIT__ = 0
  1165. const m___LFRACT_MAX__ = "0X7FFFFFFFP-31LR"
  1166. const m___LITTLE_ENDIAN = 1234
  1167. const m___LLACCUM_EPSILON__ = "0x1P-63LLK"
  1168. const m___LLACCUM_FBIT__ = 63
  1169. const m___LLACCUM_IBIT__ = 64
  1170. const m___LLACCUM_MAX__ = "0X7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFP-63LLK"
  1171. const m___LLFRACT_EPSILON__ = "0x1P-63LLR"
  1172. const m___LLFRACT_FBIT__ = 63
  1173. const m___LLFRACT_IBIT__ = 0
  1174. const m___LLFRACT_MAX__ = "0X7FFFFFFFFFFFFFFFP-63LLR"
  1175. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1176. const m___LONG_LONG_WIDTH__ = 64
  1177. const m___LONG_MAX = 0x7fffffffffffffff
  1178. const m___LONG_MAX__ = 0x7fffffffffffffff
  1179. const m___LONG_WIDTH__ = 64
  1180. const m___LP64__ = 1
  1181. const m___NO_INLINE__ = 1
  1182. const m___ORDER_BIG_ENDIAN__ = 4321
  1183. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1184. const m___ORDER_PDP_ENDIAN__ = 3412
  1185. const m___PDP_ENDIAN = 3412
  1186. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1187. const m___PRETTY_FUNCTION__ = "__func__"
  1188. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1189. const m___PTRDIFF_WIDTH__ = 64
  1190. const m___QQ_FBIT__ = 7
  1191. const m___QQ_IBIT__ = 0
  1192. const m___REGISTER_PREFIX__ = "$"
  1193. const m___SACCUM_EPSILON__ = "0x1P-7HK"
  1194. const m___SACCUM_FBIT__ = 7
  1195. const m___SACCUM_IBIT__ = 8
  1196. const m___SACCUM_MAX__ = "0X7FFFP-7HK"
  1197. const m___SA_FBIT__ = 15
  1198. const m___SA_IBIT__ = 16
  1199. const m___SCHAR_MAX__ = 0x7f
  1200. const m___SCHAR_WIDTH__ = 8
  1201. const m___SFRACT_EPSILON__ = "0x1P-7HR"
  1202. const m___SFRACT_FBIT__ = 7
  1203. const m___SFRACT_IBIT__ = 0
  1204. const m___SFRACT_MAX__ = "0X7FP-7HR"
  1205. const m___SHRT_MAX__ = 0x7fff
  1206. const m___SHRT_WIDTH__ = 16
  1207. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1208. const m___SIG_ATOMIC_TYPE__ = "int"
  1209. const m___SIG_ATOMIC_WIDTH__ = 32
  1210. const m___SIZEOF_DOUBLE__ = 8
  1211. const m___SIZEOF_FLOAT__ = 4
  1212. const m___SIZEOF_INT128__ = 16
  1213. const m___SIZEOF_INT__ = 4
  1214. const m___SIZEOF_LONG_DOUBLE__ = 8
  1215. const m___SIZEOF_LONG_LONG__ = 8
  1216. const m___SIZEOF_LONG__ = 8
  1217. const m___SIZEOF_POINTER__ = 8
  1218. const m___SIZEOF_PTRDIFF_T__ = 8
  1219. const m___SIZEOF_SHORT__ = 2
  1220. const m___SIZEOF_SIZE_T__ = 8
  1221. const m___SIZEOF_WCHAR_T__ = 4
  1222. const m___SIZEOF_WINT_T__ = 4
  1223. const m___SIZE_MAX__ = 0xffffffffffffffff
  1224. const m___SIZE_WIDTH__ = 64
  1225. const m___SQ_FBIT__ = 31
  1226. const m___SQ_IBIT__ = 0
  1227. const m___STDC_HOSTED__ = 1
  1228. const m___STDC_IEC_559_COMPLEX__ = 1
  1229. const m___STDC_IEC_559__ = 1
  1230. const m___STDC_IEC_60559_BFP__ = 201404
  1231. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1232. const m___STDC_ISO_10646__ = 201706
  1233. const m___STDC_UTF_16__ = 1
  1234. const m___STDC_UTF_32__ = 1
  1235. const m___STDC_VERSION__ = 201710
  1236. const m___STDC__ = 1
  1237. const m___TA_FBIT__ = 63
  1238. const m___TA_IBIT__ = 64
  1239. const m___TQ_FBIT__ = 127
  1240. const m___TQ_IBIT__ = 0
  1241. const m___UACCUM_EPSILON__ = "0x1P-16UK"
  1242. const m___UACCUM_FBIT__ = 16
  1243. const m___UACCUM_IBIT__ = 16
  1244. const m___UACCUM_MAX__ = "0XFFFFFFFFP-16UK"
  1245. const m___UACCUM_MIN__ = "0.0UK"
  1246. const m___UDA_FBIT__ = 32
  1247. const m___UDA_IBIT__ = 32
  1248. const m___UDQ_FBIT__ = 64
  1249. const m___UDQ_IBIT__ = 0
  1250. const m___UFRACT_EPSILON__ = "0x1P-16UR"
  1251. const m___UFRACT_FBIT__ = 16
  1252. const m___UFRACT_IBIT__ = 0
  1253. const m___UFRACT_MAX__ = "0XFFFFP-16UR"
  1254. const m___UFRACT_MIN__ = "0.0UR"
  1255. const m___UHA_FBIT__ = 8
  1256. const m___UHA_IBIT__ = 8
  1257. const m___UHQ_FBIT__ = 16
  1258. const m___UHQ_IBIT__ = 0
  1259. const m___UINT16_MAX__ = 0xffff
  1260. const m___UINT32_MAX__ = 0xffffffff
  1261. const m___UINT64_MAX__ = 0xffffffffffffffff
  1262. const m___UINT8_MAX__ = 0xff
  1263. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1264. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1265. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1266. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1267. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1268. const m___UINT_FAST8_MAX__ = 0xff
  1269. const m___UINT_LEAST16_MAX__ = 0xffff
  1270. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1271. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1272. const m___UINT_LEAST8_MAX__ = 0xff
  1273. const m___ULACCUM_EPSILON__ = "0x1P-32ULK"
  1274. const m___ULACCUM_FBIT__ = 32
  1275. const m___ULACCUM_IBIT__ = 32
  1276. const m___ULACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFP-32ULK"
  1277. const m___ULACCUM_MIN__ = "0.0ULK"
  1278. const m___ULFRACT_EPSILON__ = "0x1P-32ULR"
  1279. const m___ULFRACT_FBIT__ = 32
  1280. const m___ULFRACT_IBIT__ = 0
  1281. const m___ULFRACT_MAX__ = "0XFFFFFFFFP-32ULR"
  1282. const m___ULFRACT_MIN__ = "0.0ULR"
  1283. const m___ULLACCUM_EPSILON__ = "0x1P-64ULLK"
  1284. const m___ULLACCUM_FBIT__ = 64
  1285. const m___ULLACCUM_IBIT__ = 64
  1286. const m___ULLACCUM_MAX__ = "0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFP-64ULLK"
  1287. const m___ULLACCUM_MIN__ = "0.0ULLK"
  1288. const m___ULLFRACT_EPSILON__ = "0x1P-64ULLR"
  1289. const m___ULLFRACT_FBIT__ = 64
  1290. const m___ULLFRACT_IBIT__ = 0
  1291. const m___ULLFRACT_MAX__ = "0XFFFFFFFFFFFFFFFFP-64ULLR"
  1292. const m___ULLFRACT_MIN__ = "0.0ULLR"
  1293. const m___UQQ_FBIT__ = 8
  1294. const m___UQQ_IBIT__ = 0
  1295. const m___USACCUM_EPSILON__ = "0x1P-8UHK"
  1296. const m___USACCUM_FBIT__ = 8
  1297. const m___USACCUM_IBIT__ = 8
  1298. const m___USACCUM_MAX__ = "0XFFFFP-8UHK"
  1299. const m___USACCUM_MIN__ = "0.0UHK"
  1300. const m___USA_FBIT__ = 16
  1301. const m___USA_IBIT__ = 16
  1302. const m___USE_TIME_BITS64 = 1
  1303. const m___USFRACT_EPSILON__ = "0x1P-8UHR"
  1304. const m___USFRACT_FBIT__ = 8
  1305. const m___USFRACT_IBIT__ = 0
  1306. const m___USFRACT_MAX__ = "0XFFP-8UHR"
  1307. const m___USFRACT_MIN__ = "0.0UHR"
  1308. const m___USQ_FBIT__ = 32
  1309. const m___USQ_IBIT__ = 0
  1310. const m___UTA_FBIT__ = 64
  1311. const m___UTA_IBIT__ = 64
  1312. const m___UTQ_FBIT__ = 128
  1313. const m___UTQ_IBIT__ = 0
  1314. const m___VERSION__ = "14.2.1 20241104 (Red Hat 14.2.1-6)"
  1315. const m___WCHAR_MAX__ = 0x7fffffff
  1316. const m___WCHAR_TYPE__ = "int"
  1317. const m___WCHAR_WIDTH__ = 32
  1318. const m___WINT_MAX__ = 0xffffffff
  1319. const m___WINT_MIN__ = 0
  1320. const m___WINT_WIDTH__ = 32
  1321. const m___builtin_copysignq = "__builtin_copysignf128"
  1322. const m___builtin_fabsq = "__builtin_fabsf128"
  1323. const m___builtin_huge_valq = "__builtin_huge_valf128"
  1324. const m___builtin_infq = "__builtin_inff128"
  1325. const m___builtin_nanq = "__builtin_nanf128"
  1326. const m___builtin_nansq = "__builtin_nansf128"
  1327. const m___gnu_linux__ = 1
  1328. const m___inline = "inline"
  1329. const m___linux = 1
  1330. const m___linux__ = 1
  1331. const m___loongarch64 = 1
  1332. const m___loongarch__ = 1
  1333. const m___loongarch_arch = "la64v1.0"
  1334. const m___loongarch_double_float = 1
  1335. const m___loongarch_frlen = 64
  1336. const m___loongarch_grlen = 64
  1337. const m___loongarch_hard_float = 1
  1338. const m___loongarch_lp64 = 1
  1339. const m___loongarch_simd = 1
  1340. const m___loongarch_simd_width = 128
  1341. const m___loongarch_sx = 1
  1342. const m___loongarch_tune = "generic"
  1343. const m___loongarch_version_major = 1
  1344. const m___loongarch_version_minor = 0
  1345. const m___restrict = "restrict"
  1346. const m___restrict_arr = "restrict"
  1347. const m___unix = 1
  1348. const m___unix__ = 1
  1349. const m_alloca = "__builtin_alloca"
  1350. const m_inline = "__inline"
  1351. const m_linux = 1
  1352. const m_loff_t = "off_t"
  1353. const m_math_errhandling = 2
  1354. const m_static_assert = "_Static_assert"
  1355. const m_unix = 1
  1356. type t__builtin_va_list = uintptr
  1357. type t__predefined_size_t = uint64
  1358. type t__predefined_wchar_t = int32
  1359. type t__predefined_ptrdiff_t = int64
  1360. type Twchar_t = int32
  1361. type Tmax_align_t = struct {
  1362. F__ll int64
  1363. F__ld float64
  1364. }
  1365. type Tsize_t = uint64
  1366. type Tptrdiff_t = int64
  1367. type Tlocale_t = uintptr
  1368. type Tssize_t = int64
  1369. type Toff_t = int64
  1370. type Tva_list = uintptr
  1371. type t__isoc_va_list = uintptr
  1372. type Tfpos_t = struct {
  1373. F__lldata [0]int64
  1374. F__align [0]float64
  1375. F__opaque [16]int8
  1376. }
  1377. type T_G_fpos64_t = Tfpos_t
  1378. type Tcookie_io_functions_t = struct {
  1379. Fread uintptr
  1380. Fwrite uintptr
  1381. Fseek uintptr
  1382. Fclose1 uintptr
  1383. }
  1384. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1385. type Tdiv_t = struct {
  1386. Fquot int32
  1387. Frem int32
  1388. }
  1389. type Tldiv_t = struct {
  1390. Fquot int64
  1391. Frem int64
  1392. }
  1393. type Tlldiv_t = struct {
  1394. Fquot int64
  1395. Frem int64
  1396. }
  1397. type Tuintptr_t = uint64
  1398. type Tintptr_t = int64
  1399. type Tint8_t = int8
  1400. type Tint16_t = int16
  1401. type Tint32_t = int32
  1402. type Tint64_t = int64
  1403. type Tintmax_t = int64
  1404. type Tuint8_t = uint8
  1405. type Tuint16_t = uint16
  1406. type Tuint32_t = uint32
  1407. type Tuint64_t = uint64
  1408. type Tuintmax_t = uint64
  1409. type Tint_fast8_t = int8
  1410. type Tint_fast64_t = int64
  1411. type Tint_least8_t = int8
  1412. type Tint_least16_t = int16
  1413. type Tint_least32_t = int32
  1414. type Tint_least64_t = int64
  1415. type Tuint_fast8_t = uint8
  1416. type Tuint_fast64_t = uint64
  1417. type Tuint_least8_t = uint8
  1418. type Tuint_least16_t = uint16
  1419. type Tuint_least32_t = uint32
  1420. type Tuint_least64_t = uint64
  1421. type Tint_fast16_t = int32
  1422. type Tint_fast32_t = int32
  1423. type Tuint_fast16_t = uint32
  1424. type Tuint_fast32_t = uint32
  1425. type Tfloat_t = float32
  1426. type Tdouble_t = float64
  1427. type Ttime_t = int64
  1428. type Tsuseconds_t = int64
  1429. type Ttimeval = struct {
  1430. Ftv_sec Ttime_t
  1431. Ftv_usec Tsuseconds_t
  1432. }
  1433. type Ttimespec = struct {
  1434. Ftv_sec Ttime_t
  1435. Ftv_nsec int64
  1436. }
  1437. type Tsigset_t = struct {
  1438. F__bits [16]uint64
  1439. }
  1440. type t__sigset_t = Tsigset_t
  1441. type Tfd_mask = uint64
  1442. type Tfd_set = struct {
  1443. Ffds_bits [16]uint64
  1444. }
  1445. type Titimerval = struct {
  1446. Fit_interval Ttimeval
  1447. Fit_value Ttimeval
  1448. }
  1449. type Ttimezone = struct {
  1450. Ftz_minuteswest int32
  1451. Ftz_dsttime int32
  1452. }
  1453. type Tnlink_t = uint32
  1454. type Tblksize_t = int32
  1455. type Tregister_t = int64
  1456. type Tu_int64_t = uint64
  1457. type Tmode_t = uint32
  1458. type Tino_t = uint64
  1459. type Tdev_t = uint64
  1460. type Tblkcnt_t = int64
  1461. type Tfsblkcnt_t = uint64
  1462. type Tfsfilcnt_t = uint64
  1463. type Ttimer_t = uintptr
  1464. type Tclockid_t = int32
  1465. type Tclock_t = int64
  1466. type Tpid_t = int32
  1467. type Tid_t = uint32
  1468. type Tuid_t = uint32
  1469. type Tgid_t = uint32
  1470. type Tkey_t = int32
  1471. type Tuseconds_t = uint32
  1472. type Tpthread_t = uintptr
  1473. type Tpthread_once_t = int32
  1474. type Tpthread_key_t = uint32
  1475. type Tpthread_spinlock_t = int32
  1476. type Tpthread_mutexattr_t = struct {
  1477. F__attr uint32
  1478. }
  1479. type Tpthread_condattr_t = struct {
  1480. F__attr uint32
  1481. }
  1482. type Tpthread_barrierattr_t = struct {
  1483. F__attr uint32
  1484. }
  1485. type Tpthread_rwlockattr_t = struct {
  1486. F__attr [2]uint32
  1487. }
  1488. type Tpthread_attr_t = struct {
  1489. F__u struct {
  1490. F__vi [0][14]int32
  1491. F__s [0][7]uint64
  1492. F__i [14]int32
  1493. }
  1494. }
  1495. type Tpthread_mutex_t = struct {
  1496. F__u struct {
  1497. F__vi [0][10]int32
  1498. F__p [0][5]uintptr
  1499. F__i [10]int32
  1500. }
  1501. }
  1502. type Tpthread_cond_t = struct {
  1503. F__u struct {
  1504. F__vi [0][12]int32
  1505. F__p [0][6]uintptr
  1506. F__i [12]int32
  1507. }
  1508. }
  1509. type Tpthread_rwlock_t = struct {
  1510. F__u struct {
  1511. F__vi [0][14]int32
  1512. F__p [0][7]uintptr
  1513. F__i [14]int32
  1514. }
  1515. }
  1516. type Tpthread_barrier_t = struct {
  1517. F__u struct {
  1518. F__vi [0][8]int32
  1519. F__p [0][4]uintptr
  1520. F__i [8]int32
  1521. }
  1522. }
  1523. type Tu_int8_t = uint8
  1524. type Tu_int16_t = uint16
  1525. type Tu_int32_t = uint32
  1526. type Tcaddr_t = uintptr
  1527. type Tu_char = uint8
  1528. type Tu_short = uint16
  1529. type Tushort = uint16
  1530. type Tu_int = uint32
  1531. type Tuint = uint32
  1532. type Tu_long = uint64
  1533. type Tulong = uint64
  1534. type Tquad_t = int64
  1535. type Tu_quad_t = uint64
  1536. type Tiovec = struct {
  1537. Fiov_base uintptr
  1538. Fiov_len Tsize_t
  1539. }
  1540. type Tflock = struct {
  1541. Fl_type int16
  1542. Fl_whence int16
  1543. Fl_start Toff_t
  1544. Fl_len Toff_t
  1545. Fl_pid Tpid_t
  1546. }
  1547. type Tfile_handle = struct {
  1548. Fhandle_bytes uint32
  1549. Fhandle_type int32
  1550. }
  1551. type Tf_owner_ex = struct {
  1552. Ftype1 int32
  1553. Fpid Tpid_t
  1554. }
  1555. type TXML_Char = int8
  1556. type TXML_LChar = int8
  1557. type TXML_Index = int64
  1558. type TXML_Size = uint64
  1559. type TXML_ParserStruct = struct {
  1560. Fm_userData uintptr
  1561. Fm_handlerArg uintptr
  1562. Fm_buffer uintptr
  1563. Fm_mem TXML_Memory_Handling_Suite
  1564. Fm_bufferPtr uintptr
  1565. Fm_bufferEnd uintptr
  1566. Fm_bufferLim uintptr
  1567. Fm_parseEndByteIndex TXML_Index
  1568. Fm_parseEndPtr uintptr
  1569. Fm_dataBuf uintptr
  1570. Fm_dataBufEnd uintptr
  1571. Fm_startElementHandler TXML_StartElementHandler
  1572. Fm_endElementHandler TXML_EndElementHandler
  1573. Fm_characterDataHandler TXML_CharacterDataHandler
  1574. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1575. Fm_commentHandler TXML_CommentHandler
  1576. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1577. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1578. Fm_defaultHandler TXML_DefaultHandler
  1579. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1580. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1581. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1582. Fm_notationDeclHandler TXML_NotationDeclHandler
  1583. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1584. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1585. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1586. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1587. Fm_externalEntityRefHandlerArg TXML_Parser
  1588. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1589. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1590. Fm_elementDeclHandler TXML_ElementDeclHandler
  1591. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1592. Fm_entityDeclHandler TXML_EntityDeclHandler
  1593. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1594. Fm_encoding uintptr
  1595. Fm_initEncoding TINIT_ENCODING
  1596. Fm_internalEncoding uintptr
  1597. Fm_protocolEncodingName uintptr
  1598. Fm_ns TXML_Bool
  1599. Fm_ns_triplets TXML_Bool
  1600. Fm_unknownEncodingMem uintptr
  1601. Fm_unknownEncodingData uintptr
  1602. Fm_unknownEncodingHandlerData uintptr
  1603. Fm_unknownEncodingRelease uintptr
  1604. Fm_prologState TPROLOG_STATE
  1605. Fm_processor uintptr
  1606. Fm_errorCode _XML_Error
  1607. Fm_eventPtr uintptr
  1608. Fm_eventEndPtr uintptr
  1609. Fm_positionPtr uintptr
  1610. Fm_openInternalEntities uintptr
  1611. Fm_freeInternalEntities uintptr
  1612. Fm_defaultExpandInternalEntities TXML_Bool
  1613. Fm_tagLevel int32
  1614. Fm_declEntity uintptr
  1615. Fm_doctypeName uintptr
  1616. Fm_doctypeSysid uintptr
  1617. Fm_doctypePubid uintptr
  1618. Fm_declAttributeType uintptr
  1619. Fm_declNotationName uintptr
  1620. Fm_declNotationPublicId uintptr
  1621. Fm_declElementType uintptr
  1622. Fm_declAttributeId uintptr
  1623. Fm_declAttributeIsCdata TXML_Bool
  1624. Fm_declAttributeIsId TXML_Bool
  1625. Fm_dtd uintptr
  1626. Fm_curBase uintptr
  1627. Fm_tagStack uintptr
  1628. Fm_freeTagList uintptr
  1629. Fm_inheritedBindings uintptr
  1630. Fm_freeBindingList uintptr
  1631. Fm_attsSize int32
  1632. Fm_nSpecifiedAtts int32
  1633. Fm_idAttIndex int32
  1634. Fm_atts uintptr
  1635. Fm_nsAtts uintptr
  1636. Fm_nsAttsVersion uint64
  1637. Fm_nsAttsPower uint8
  1638. Fm_position TPOSITION
  1639. Fm_tempPool TSTRING_POOL
  1640. Fm_temp2Pool TSTRING_POOL
  1641. Fm_groupConnector uintptr
  1642. Fm_groupSize uint32
  1643. Fm_namespaceSeparator TXML_Char
  1644. Fm_parentParser TXML_Parser
  1645. Fm_parsingStatus TXML_ParsingStatus
  1646. Fm_isParamEntity TXML_Bool
  1647. Fm_useForeignDTD TXML_Bool
  1648. Fm_paramEntityParsing _XML_ParamEntityParsing
  1649. Fm_hash_secret_salt uint64
  1650. Fm_accounting TACCOUNTING
  1651. Fm_entity_stats TENTITY_STATS
  1652. }
  1653. type _XML_Error = int32
  1654. const _XML_ERROR_NONE = 0
  1655. const _XML_ERROR_NO_MEMORY = 1
  1656. const _XML_ERROR_SYNTAX = 2
  1657. const _XML_ERROR_NO_ELEMENTS = 3
  1658. const _XML_ERROR_INVALID_TOKEN = 4
  1659. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1660. const _XML_ERROR_PARTIAL_CHAR = 6
  1661. const _XML_ERROR_TAG_MISMATCH = 7
  1662. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1663. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1664. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1665. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1666. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1667. const _XML_ERROR_ASYNC_ENTITY = 13
  1668. const _XML_ERROR_BAD_CHAR_REF = 14
  1669. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1670. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1671. const _XML_ERROR_MISPLACED_XML_PI = 17
  1672. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1673. const _XML_ERROR_INCORRECT_ENCODING = 19
  1674. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1675. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1676. const _XML_ERROR_NOT_STANDALONE = 22
  1677. const _XML_ERROR_UNEXPECTED_STATE = 23
  1678. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1679. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1680. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1681. const _XML_ERROR_UNBOUND_PREFIX = 27
  1682. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1683. const _XML_ERROR_INCOMPLETE_PE = 29
  1684. const _XML_ERROR_XML_DECL = 30
  1685. const _XML_ERROR_TEXT_DECL = 31
  1686. const _XML_ERROR_PUBLICID = 32
  1687. const _XML_ERROR_SUSPENDED = 33
  1688. const _XML_ERROR_NOT_SUSPENDED = 34
  1689. const _XML_ERROR_ABORTED = 35
  1690. const _XML_ERROR_FINISHED = 36
  1691. const _XML_ERROR_SUSPEND_PE = 37
  1692. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1693. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1694. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1695. const _XML_ERROR_INVALID_ARGUMENT = 41
  1696. const _XML_ERROR_NO_BUFFER = 42
  1697. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1698. type _XML_ParamEntityParsing = int32
  1699. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1700. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1701. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1702. type TXML_Parser = uintptr
  1703. type TXML_Bool = uint8
  1704. type _XML_Status = int32
  1705. const _XML_STATUS_ERROR = 0
  1706. const _XML_STATUS_OK = 1
  1707. const _XML_STATUS_SUSPENDED = 2
  1708. type _XML_Content_Type = int32
  1709. const _XML_CTYPE_EMPTY = 1
  1710. const _XML_CTYPE_ANY = 2
  1711. const _XML_CTYPE_MIXED = 3
  1712. const _XML_CTYPE_NAME = 4
  1713. const _XML_CTYPE_CHOICE = 5
  1714. const _XML_CTYPE_SEQ = 6
  1715. type _XML_Content_Quant = int32
  1716. const _XML_CQUANT_NONE = 0
  1717. const _XML_CQUANT_OPT = 1
  1718. const _XML_CQUANT_REP = 2
  1719. const _XML_CQUANT_PLUS = 3
  1720. type TXML_Content = struct {
  1721. Ftype1 _XML_Content_Type
  1722. Fquant _XML_Content_Quant
  1723. Fname uintptr
  1724. Fnumchildren uint32
  1725. Fchildren uintptr
  1726. }
  1727. type TXML_cp = TXML_Content
  1728. type TXML_ElementDeclHandler = uintptr
  1729. type TXML_AttlistDeclHandler = uintptr
  1730. type TXML_XmlDeclHandler = uintptr
  1731. type TXML_Memory_Handling_Suite = struct {
  1732. Fmalloc_fcn uintptr
  1733. Frealloc_fcn uintptr
  1734. Ffree_fcn uintptr
  1735. }
  1736. type TXML_StartElementHandler = uintptr
  1737. type TXML_EndElementHandler = uintptr
  1738. type TXML_CharacterDataHandler = uintptr
  1739. type TXML_ProcessingInstructionHandler = uintptr
  1740. type TXML_CommentHandler = uintptr
  1741. type TXML_StartCdataSectionHandler = uintptr
  1742. type TXML_EndCdataSectionHandler = uintptr
  1743. type TXML_DefaultHandler = uintptr
  1744. type TXML_StartDoctypeDeclHandler = uintptr
  1745. type TXML_EndDoctypeDeclHandler = uintptr
  1746. type TXML_EntityDeclHandler = uintptr
  1747. type TXML_UnparsedEntityDeclHandler = uintptr
  1748. type TXML_NotationDeclHandler = uintptr
  1749. type TXML_StartNamespaceDeclHandler = uintptr
  1750. type TXML_EndNamespaceDeclHandler = uintptr
  1751. type TXML_NotStandaloneHandler = uintptr
  1752. type TXML_ExternalEntityRefHandler = uintptr
  1753. type TXML_SkippedEntityHandler = uintptr
  1754. type TXML_Encoding = struct {
  1755. Fmap1 [256]int32
  1756. Fdata uintptr
  1757. Fconvert uintptr
  1758. Frelease uintptr
  1759. }
  1760. type TXML_UnknownEncodingHandler = uintptr
  1761. type _XML_Parsing = int32
  1762. const _XML_INITIALIZED = 0
  1763. const _XML_PARSING = 1
  1764. const _XML_FINISHED = 2
  1765. const _XML_SUSPENDED = 3
  1766. type TXML_ParsingStatus = struct {
  1767. Fparsing _XML_Parsing
  1768. FfinalBuffer TXML_Bool
  1769. }
  1770. type TXML_Expat_Version = struct {
  1771. Fmajor int32
  1772. Fminor int32
  1773. Fmicro int32
  1774. }
  1775. type _XML_FeatureEnum = int32
  1776. const _XML_FEATURE_END = 0
  1777. const _XML_FEATURE_UNICODE = 1
  1778. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1779. const _XML_FEATURE_DTD = 3
  1780. const _XML_FEATURE_CONTEXT_BYTES = 4
  1781. const _XML_FEATURE_MIN_SIZE = 5
  1782. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1783. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1784. const _XML_FEATURE_NS = 8
  1785. const _XML_FEATURE_LARGE_SIZE = 9
  1786. const _XML_FEATURE_ATTR_INFO = 10
  1787. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1788. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1789. type TXML_Feature = struct {
  1790. Ffeature _XML_FeatureEnum
  1791. Fname uintptr
  1792. Fvalue int64
  1793. }
  1794. type Tsiphash = struct {
  1795. Fv0 Tuint64_t
  1796. Fv1 Tuint64_t
  1797. Fv2 Tuint64_t
  1798. Fv3 Tuint64_t
  1799. Fbuf [8]uint8
  1800. Fp uintptr
  1801. Fc Tuint64_t
  1802. }
  1803. type Tsipkey = struct {
  1804. Fk [2]Tuint64_t
  1805. }
  1806. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1807. *(*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)
  1808. *(*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)
  1809. return key
  1810. }
  1811. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1812. var i int32
  1813. _ = i
  1814. i = 0
  1815. for {
  1816. if !(i < rounds) {
  1817. break
  1818. }
  1819. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1820. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1821. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1822. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1823. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1824. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1825. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1826. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1827. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1828. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1829. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1830. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1831. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1832. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1833. goto _1
  1834. _1:
  1835. ;
  1836. i++
  1837. }
  1838. }
  1839. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1840. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1841. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1842. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1843. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1844. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1845. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1846. return H
  1847. }
  1848. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1849. var m Tuint64_t
  1850. var p, pe, v1, v2, v3 uintptr
  1851. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1852. p = src
  1853. pe = p + uintptr(len1)
  1854. for cond := true; cond; cond = p < pe {
  1855. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1856. v2 = H + 40
  1857. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1858. *(*uintptr)(unsafe.Pointer(v2))++
  1859. v3 = p
  1860. p++
  1861. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1862. }
  1863. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1864. break
  1865. }
  1866. 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)
  1867. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1868. _sip_round(tls, H, int32(2))
  1869. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1870. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1871. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1872. }
  1873. return H
  1874. }
  1875. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1876. var b Tuint64_t
  1877. var left int8
  1878. _, _ = b, left
  1879. left = int8(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1880. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + libc.Uint64FromInt8(left)) << int32(56)
  1881. switch int32(left) {
  1882. case int32(7):
  1883. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1884. fallthrough
  1885. case int32(6):
  1886. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1887. fallthrough
  1888. case int32(5):
  1889. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1890. fallthrough
  1891. case int32(4):
  1892. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1893. fallthrough
  1894. case int32(3):
  1895. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1896. fallthrough
  1897. case int32(2):
  1898. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1899. fallthrough
  1900. case int32(1):
  1901. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1902. fallthrough
  1903. case 0:
  1904. break
  1905. }
  1906. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1907. _sip_round(tls, H, int32(2))
  1908. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1909. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1910. _sip_round(tls, H, int32(4))
  1911. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1912. }
  1913. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1914. bp := tls.Alloc(64)
  1915. defer tls.Free(64)
  1916. var _ /* state at bp+0 */ Tsiphash
  1917. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1918. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1919. }
  1920. func _sip24_valid(tls *libc.TLS) (r int32) {
  1921. bp := tls.Alloc(80)
  1922. defer tls.Free(80)
  1923. var i Tsize_t
  1924. var _ /* in at bp+0 */ [64]uint8
  1925. var _ /* k at bp+64 */ Tsipkey
  1926. _ = i
  1927. _sip_tokey(tls, bp+64, __ccgo_ts)
  1928. i = uint64(0)
  1929. for {
  1930. if !(i < uint64(64)) {
  1931. break
  1932. }
  1933. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1934. 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) {
  1935. return 0
  1936. }
  1937. goto _1
  1938. _1:
  1939. ;
  1940. i++
  1941. }
  1942. return int32(1)
  1943. }
  1944. var _vectors = [64][8]uint8{
  1945. 0: {
  1946. 0: uint8(0x31),
  1947. 1: uint8(0x0e),
  1948. 2: uint8(0x0e),
  1949. 3: uint8(0xdd),
  1950. 4: uint8(0x47),
  1951. 5: uint8(0xdb),
  1952. 6: uint8(0x6f),
  1953. 7: uint8(0x72),
  1954. },
  1955. 1: {
  1956. 0: uint8(0xfd),
  1957. 1: uint8(0x67),
  1958. 2: uint8(0xdc),
  1959. 3: uint8(0x93),
  1960. 4: uint8(0xc5),
  1961. 5: uint8(0x39),
  1962. 6: uint8(0xf8),
  1963. 7: uint8(0x74),
  1964. },
  1965. 2: {
  1966. 0: uint8(0x5a),
  1967. 1: uint8(0x4f),
  1968. 2: uint8(0xa9),
  1969. 3: uint8(0xd9),
  1970. 4: uint8(0x09),
  1971. 5: uint8(0x80),
  1972. 6: uint8(0x6c),
  1973. 7: uint8(0x0d),
  1974. },
  1975. 3: {
  1976. 0: uint8(0x2d),
  1977. 1: uint8(0x7e),
  1978. 2: uint8(0xfb),
  1979. 3: uint8(0xd7),
  1980. 4: uint8(0x96),
  1981. 5: uint8(0x66),
  1982. 6: uint8(0x67),
  1983. 7: uint8(0x85),
  1984. },
  1985. 4: {
  1986. 0: uint8(0xb7),
  1987. 1: uint8(0x87),
  1988. 2: uint8(0x71),
  1989. 3: uint8(0x27),
  1990. 4: uint8(0xe0),
  1991. 5: uint8(0x94),
  1992. 6: uint8(0x27),
  1993. 7: uint8(0xcf),
  1994. },
  1995. 5: {
  1996. 0: uint8(0x8d),
  1997. 1: uint8(0xa6),
  1998. 2: uint8(0x99),
  1999. 3: uint8(0xcd),
  2000. 4: uint8(0x64),
  2001. 5: uint8(0x55),
  2002. 6: uint8(0x76),
  2003. 7: uint8(0x18),
  2004. },
  2005. 6: {
  2006. 0: uint8(0xce),
  2007. 1: uint8(0xe3),
  2008. 2: uint8(0xfe),
  2009. 3: uint8(0x58),
  2010. 4: uint8(0x6e),
  2011. 5: uint8(0x46),
  2012. 6: uint8(0xc9),
  2013. 7: uint8(0xcb),
  2014. },
  2015. 7: {
  2016. 0: uint8(0x37),
  2017. 1: uint8(0xd1),
  2018. 2: uint8(0x01),
  2019. 3: uint8(0x8b),
  2020. 4: uint8(0xf5),
  2021. 6: uint8(0x02),
  2022. 7: uint8(0xab),
  2023. },
  2024. 8: {
  2025. 0: uint8(0x62),
  2026. 1: uint8(0x24),
  2027. 2: uint8(0x93),
  2028. 3: uint8(0x9a),
  2029. 4: uint8(0x79),
  2030. 5: uint8(0xf5),
  2031. 6: uint8(0xf5),
  2032. 7: uint8(0x93),
  2033. },
  2034. 9: {
  2035. 0: uint8(0xb0),
  2036. 1: uint8(0xe4),
  2037. 2: uint8(0xa9),
  2038. 3: uint8(0x0b),
  2039. 4: uint8(0xdf),
  2040. 5: uint8(0x82),
  2041. 7: uint8(0x9e),
  2042. },
  2043. 10: {
  2044. 0: uint8(0xf3),
  2045. 1: uint8(0xb9),
  2046. 2: uint8(0xdd),
  2047. 3: uint8(0x94),
  2048. 4: uint8(0xc5),
  2049. 5: uint8(0xbb),
  2050. 6: uint8(0x5d),
  2051. 7: uint8(0x7a),
  2052. },
  2053. 11: {
  2054. 0: uint8(0xa7),
  2055. 1: uint8(0xad),
  2056. 2: uint8(0x6b),
  2057. 3: uint8(0x22),
  2058. 4: uint8(0x46),
  2059. 5: uint8(0x2f),
  2060. 6: uint8(0xb3),
  2061. 7: uint8(0xf4),
  2062. },
  2063. 12: {
  2064. 0: uint8(0xfb),
  2065. 1: uint8(0xe5),
  2066. 2: uint8(0x0e),
  2067. 3: uint8(0x86),
  2068. 4: uint8(0xbc),
  2069. 5: uint8(0x8f),
  2070. 6: uint8(0x1e),
  2071. 7: uint8(0x75),
  2072. },
  2073. 13: {
  2074. 0: uint8(0x90),
  2075. 1: uint8(0x3d),
  2076. 2: uint8(0x84),
  2077. 3: uint8(0xc0),
  2078. 4: uint8(0x27),
  2079. 5: uint8(0x56),
  2080. 6: uint8(0xea),
  2081. 7: uint8(0x14),
  2082. },
  2083. 14: {
  2084. 0: uint8(0xee),
  2085. 1: uint8(0xf2),
  2086. 2: uint8(0x7a),
  2087. 3: uint8(0x8e),
  2088. 4: uint8(0x90),
  2089. 5: uint8(0xca),
  2090. 6: uint8(0x23),
  2091. 7: uint8(0xf7),
  2092. },
  2093. 15: {
  2094. 0: uint8(0xe5),
  2095. 1: uint8(0x45),
  2096. 2: uint8(0xbe),
  2097. 3: uint8(0x49),
  2098. 4: uint8(0x61),
  2099. 5: uint8(0xca),
  2100. 6: uint8(0x29),
  2101. 7: uint8(0xa1),
  2102. },
  2103. 16: {
  2104. 0: uint8(0xdb),
  2105. 1: uint8(0x9b),
  2106. 2: uint8(0xc2),
  2107. 3: uint8(0x57),
  2108. 4: uint8(0x7f),
  2109. 5: uint8(0xcc),
  2110. 6: uint8(0x2a),
  2111. 7: uint8(0x3f),
  2112. },
  2113. 17: {
  2114. 0: uint8(0x94),
  2115. 1: uint8(0x47),
  2116. 2: uint8(0xbe),
  2117. 3: uint8(0x2c),
  2118. 4: uint8(0xf5),
  2119. 5: uint8(0xe9),
  2120. 6: uint8(0x9a),
  2121. 7: uint8(0x69),
  2122. },
  2123. 18: {
  2124. 0: uint8(0x9c),
  2125. 1: uint8(0xd3),
  2126. 2: uint8(0x8d),
  2127. 3: uint8(0x96),
  2128. 4: uint8(0xf0),
  2129. 5: uint8(0xb3),
  2130. 6: uint8(0xc1),
  2131. 7: uint8(0x4b),
  2132. },
  2133. 19: {
  2134. 0: uint8(0xbd),
  2135. 1: uint8(0x61),
  2136. 2: uint8(0x79),
  2137. 3: uint8(0xa7),
  2138. 4: uint8(0x1d),
  2139. 5: uint8(0xc9),
  2140. 6: uint8(0x6d),
  2141. 7: uint8(0xbb),
  2142. },
  2143. 20: {
  2144. 0: uint8(0x98),
  2145. 1: uint8(0xee),
  2146. 2: uint8(0xa2),
  2147. 3: uint8(0x1a),
  2148. 4: uint8(0xf2),
  2149. 5: uint8(0x5c),
  2150. 6: uint8(0xd6),
  2151. 7: uint8(0xbe),
  2152. },
  2153. 21: {
  2154. 0: uint8(0xc7),
  2155. 1: uint8(0x67),
  2156. 2: uint8(0x3b),
  2157. 3: uint8(0x2e),
  2158. 4: uint8(0xb0),
  2159. 5: uint8(0xcb),
  2160. 6: uint8(0xf2),
  2161. 7: uint8(0xd0),
  2162. },
  2163. 22: {
  2164. 0: uint8(0x88),
  2165. 1: uint8(0x3e),
  2166. 2: uint8(0xa3),
  2167. 3: uint8(0xe3),
  2168. 4: uint8(0x95),
  2169. 5: uint8(0x67),
  2170. 6: uint8(0x53),
  2171. 7: uint8(0x93),
  2172. },
  2173. 23: {
  2174. 0: uint8(0xc8),
  2175. 1: uint8(0xce),
  2176. 2: uint8(0x5c),
  2177. 3: uint8(0xcd),
  2178. 4: uint8(0x8c),
  2179. 5: uint8(0x03),
  2180. 6: uint8(0x0c),
  2181. 7: uint8(0xa8),
  2182. },
  2183. 24: {
  2184. 0: uint8(0x94),
  2185. 1: uint8(0xaf),
  2186. 2: uint8(0x49),
  2187. 3: uint8(0xf6),
  2188. 4: uint8(0xc6),
  2189. 5: uint8(0x50),
  2190. 6: uint8(0xad),
  2191. 7: uint8(0xb8),
  2192. },
  2193. 25: {
  2194. 0: uint8(0xea),
  2195. 1: uint8(0xb8),
  2196. 2: uint8(0x85),
  2197. 3: uint8(0x8a),
  2198. 4: uint8(0xde),
  2199. 5: uint8(0x92),
  2200. 6: uint8(0xe1),
  2201. 7: uint8(0xbc),
  2202. },
  2203. 26: {
  2204. 0: uint8(0xf3),
  2205. 1: uint8(0x15),
  2206. 2: uint8(0xbb),
  2207. 3: uint8(0x5b),
  2208. 4: uint8(0xb8),
  2209. 5: uint8(0x35),
  2210. 6: uint8(0xd8),
  2211. 7: uint8(0x17),
  2212. },
  2213. 27: {
  2214. 0: uint8(0xad),
  2215. 1: uint8(0xcf),
  2216. 2: uint8(0x6b),
  2217. 3: uint8(0x07),
  2218. 4: uint8(0x63),
  2219. 5: uint8(0x61),
  2220. 6: uint8(0x2e),
  2221. 7: uint8(0x2f),
  2222. },
  2223. 28: {
  2224. 0: uint8(0xa5),
  2225. 1: uint8(0xc9),
  2226. 2: uint8(0x1d),
  2227. 3: uint8(0xa7),
  2228. 4: uint8(0xac),
  2229. 5: uint8(0xaa),
  2230. 6: uint8(0x4d),
  2231. 7: uint8(0xde),
  2232. },
  2233. 29: {
  2234. 0: uint8(0x71),
  2235. 1: uint8(0x65),
  2236. 2: uint8(0x95),
  2237. 3: uint8(0x87),
  2238. 4: uint8(0x66),
  2239. 5: uint8(0x50),
  2240. 6: uint8(0xa2),
  2241. 7: uint8(0xa6),
  2242. },
  2243. 30: {
  2244. 0: uint8(0x28),
  2245. 1: uint8(0xef),
  2246. 2: uint8(0x49),
  2247. 3: uint8(0x5c),
  2248. 4: uint8(0x53),
  2249. 5: uint8(0xa3),
  2250. 6: uint8(0x87),
  2251. 7: uint8(0xad),
  2252. },
  2253. 31: {
  2254. 0: uint8(0x42),
  2255. 1: uint8(0xc3),
  2256. 2: uint8(0x41),
  2257. 3: uint8(0xd8),
  2258. 4: uint8(0xfa),
  2259. 5: uint8(0x92),
  2260. 6: uint8(0xd8),
  2261. 7: uint8(0x32),
  2262. },
  2263. 32: {
  2264. 0: uint8(0xce),
  2265. 1: uint8(0x7c),
  2266. 2: uint8(0xf2),
  2267. 3: uint8(0x72),
  2268. 4: uint8(0x2f),
  2269. 5: uint8(0x51),
  2270. 6: uint8(0x27),
  2271. 7: uint8(0x71),
  2272. },
  2273. 33: {
  2274. 0: uint8(0xe3),
  2275. 1: uint8(0x78),
  2276. 2: uint8(0x59),
  2277. 3: uint8(0xf9),
  2278. 4: uint8(0x46),
  2279. 5: uint8(0x23),
  2280. 6: uint8(0xf3),
  2281. 7: uint8(0xa7),
  2282. },
  2283. 34: {
  2284. 0: uint8(0x38),
  2285. 1: uint8(0x12),
  2286. 2: uint8(0x05),
  2287. 3: uint8(0xbb),
  2288. 4: uint8(0x1a),
  2289. 5: uint8(0xb0),
  2290. 6: uint8(0xe0),
  2291. 7: uint8(0x12),
  2292. },
  2293. 35: {
  2294. 0: uint8(0xae),
  2295. 1: uint8(0x97),
  2296. 2: uint8(0xa1),
  2297. 3: uint8(0x0f),
  2298. 4: uint8(0xd4),
  2299. 5: uint8(0x34),
  2300. 6: uint8(0xe0),
  2301. 7: uint8(0x15),
  2302. },
  2303. 36: {
  2304. 0: uint8(0xb4),
  2305. 1: uint8(0xa3),
  2306. 2: uint8(0x15),
  2307. 3: uint8(0x08),
  2308. 4: uint8(0xbe),
  2309. 5: uint8(0xff),
  2310. 6: uint8(0x4d),
  2311. 7: uint8(0x31),
  2312. },
  2313. 37: {
  2314. 0: uint8(0x81),
  2315. 1: uint8(0x39),
  2316. 2: uint8(0x62),
  2317. 3: uint8(0x29),
  2318. 4: uint8(0xf0),
  2319. 5: uint8(0x90),
  2320. 6: uint8(0x79),
  2321. 7: uint8(0x02),
  2322. },
  2323. 38: {
  2324. 0: uint8(0x4d),
  2325. 1: uint8(0x0c),
  2326. 2: uint8(0xf4),
  2327. 3: uint8(0x9e),
  2328. 4: uint8(0xe5),
  2329. 5: uint8(0xd4),
  2330. 6: uint8(0xdc),
  2331. 7: uint8(0xca),
  2332. },
  2333. 39: {
  2334. 0: uint8(0x5c),
  2335. 1: uint8(0x73),
  2336. 2: uint8(0x33),
  2337. 3: uint8(0x6a),
  2338. 4: uint8(0x76),
  2339. 5: uint8(0xd8),
  2340. 6: uint8(0xbf),
  2341. 7: uint8(0x9a),
  2342. },
  2343. 40: {
  2344. 0: uint8(0xd0),
  2345. 1: uint8(0xa7),
  2346. 2: uint8(0x04),
  2347. 3: uint8(0x53),
  2348. 4: uint8(0x6b),
  2349. 5: uint8(0xa9),
  2350. 6: uint8(0x3e),
  2351. 7: uint8(0x0e),
  2352. },
  2353. 41: {
  2354. 0: uint8(0x92),
  2355. 1: uint8(0x59),
  2356. 2: uint8(0x58),
  2357. 3: uint8(0xfc),
  2358. 4: uint8(0xd6),
  2359. 5: uint8(0x42),
  2360. 6: uint8(0x0c),
  2361. 7: uint8(0xad),
  2362. },
  2363. 42: {
  2364. 0: uint8(0xa9),
  2365. 1: uint8(0x15),
  2366. 2: uint8(0xc2),
  2367. 3: uint8(0x9b),
  2368. 4: uint8(0xc8),
  2369. 5: uint8(0x06),
  2370. 6: uint8(0x73),
  2371. 7: uint8(0x18),
  2372. },
  2373. 43: {
  2374. 0: uint8(0x95),
  2375. 1: uint8(0x2b),
  2376. 2: uint8(0x79),
  2377. 3: uint8(0xf3),
  2378. 4: uint8(0xbc),
  2379. 5: uint8(0x0a),
  2380. 6: uint8(0xa6),
  2381. 7: uint8(0xd4),
  2382. },
  2383. 44: {
  2384. 0: uint8(0xf2),
  2385. 1: uint8(0x1d),
  2386. 2: uint8(0xf2),
  2387. 3: uint8(0xe4),
  2388. 4: uint8(0x1d),
  2389. 5: uint8(0x45),
  2390. 6: uint8(0x35),
  2391. 7: uint8(0xf9),
  2392. },
  2393. 45: {
  2394. 0: uint8(0x87),
  2395. 1: uint8(0x57),
  2396. 2: uint8(0x75),
  2397. 3: uint8(0x19),
  2398. 4: uint8(0x04),
  2399. 5: uint8(0x8f),
  2400. 6: uint8(0x53),
  2401. 7: uint8(0xa9),
  2402. },
  2403. 46: {
  2404. 0: uint8(0x10),
  2405. 1: uint8(0xa5),
  2406. 2: uint8(0x6c),
  2407. 3: uint8(0xf5),
  2408. 4: uint8(0xdf),
  2409. 5: uint8(0xcd),
  2410. 6: uint8(0x9a),
  2411. 7: uint8(0xdb),
  2412. },
  2413. 47: {
  2414. 0: uint8(0xeb),
  2415. 1: uint8(0x75),
  2416. 2: uint8(0x09),
  2417. 3: uint8(0x5c),
  2418. 4: uint8(0xcd),
  2419. 5: uint8(0x98),
  2420. 6: uint8(0x6c),
  2421. 7: uint8(0xd0),
  2422. },
  2423. 48: {
  2424. 0: uint8(0x51),
  2425. 1: uint8(0xa9),
  2426. 2: uint8(0xcb),
  2427. 3: uint8(0x9e),
  2428. 4: uint8(0xcb),
  2429. 5: uint8(0xa3),
  2430. 6: uint8(0x12),
  2431. 7: uint8(0xe6),
  2432. },
  2433. 49: {
  2434. 0: uint8(0x96),
  2435. 1: uint8(0xaf),
  2436. 2: uint8(0xad),
  2437. 3: uint8(0xfc),
  2438. 4: uint8(0x2c),
  2439. 5: uint8(0xe6),
  2440. 6: uint8(0x66),
  2441. 7: uint8(0xc7),
  2442. },
  2443. 50: {
  2444. 0: uint8(0x72),
  2445. 1: uint8(0xfe),
  2446. 2: uint8(0x52),
  2447. 3: uint8(0x97),
  2448. 4: uint8(0x5a),
  2449. 5: uint8(0x43),
  2450. 6: uint8(0x64),
  2451. 7: uint8(0xee),
  2452. },
  2453. 51: {
  2454. 0: uint8(0x5a),
  2455. 1: uint8(0x16),
  2456. 2: uint8(0x45),
  2457. 3: uint8(0xb2),
  2458. 4: uint8(0x76),
  2459. 5: uint8(0xd5),
  2460. 6: uint8(0x92),
  2461. 7: uint8(0xa1),
  2462. },
  2463. 52: {
  2464. 0: uint8(0xb2),
  2465. 1: uint8(0x74),
  2466. 2: uint8(0xcb),
  2467. 3: uint8(0x8e),
  2468. 4: uint8(0xbf),
  2469. 5: uint8(0x87),
  2470. 6: uint8(0x87),
  2471. 7: uint8(0x0a),
  2472. },
  2473. 53: {
  2474. 0: uint8(0x6f),
  2475. 1: uint8(0x9b),
  2476. 2: uint8(0xb4),
  2477. 3: uint8(0x20),
  2478. 4: uint8(0x3d),
  2479. 5: uint8(0xe7),
  2480. 6: uint8(0xb3),
  2481. 7: uint8(0x81),
  2482. },
  2483. 54: {
  2484. 0: uint8(0xea),
  2485. 1: uint8(0xec),
  2486. 2: uint8(0xb2),
  2487. 3: uint8(0xa3),
  2488. 4: uint8(0x0b),
  2489. 5: uint8(0x22),
  2490. 6: uint8(0xa8),
  2491. 7: uint8(0x7f),
  2492. },
  2493. 55: {
  2494. 0: uint8(0x99),
  2495. 1: uint8(0x24),
  2496. 2: uint8(0xa4),
  2497. 3: uint8(0x3c),
  2498. 4: uint8(0xc1),
  2499. 5: uint8(0x31),
  2500. 6: uint8(0x57),
  2501. 7: uint8(0x24),
  2502. },
  2503. 56: {
  2504. 0: uint8(0xbd),
  2505. 1: uint8(0x83),
  2506. 2: uint8(0x8d),
  2507. 3: uint8(0x3a),
  2508. 4: uint8(0xaf),
  2509. 5: uint8(0xbf),
  2510. 6: uint8(0x8d),
  2511. 7: uint8(0xb7),
  2512. },
  2513. 57: {
  2514. 0: uint8(0x0b),
  2515. 1: uint8(0x1a),
  2516. 2: uint8(0x2a),
  2517. 3: uint8(0x32),
  2518. 4: uint8(0x65),
  2519. 5: uint8(0xd5),
  2520. 6: uint8(0x1a),
  2521. 7: uint8(0xea),
  2522. },
  2523. 58: {
  2524. 0: uint8(0x13),
  2525. 1: uint8(0x50),
  2526. 2: uint8(0x79),
  2527. 3: uint8(0xa3),
  2528. 4: uint8(0x23),
  2529. 5: uint8(0x1c),
  2530. 6: uint8(0xe6),
  2531. 7: uint8(0x60),
  2532. },
  2533. 59: {
  2534. 0: uint8(0x93),
  2535. 1: uint8(0x2b),
  2536. 2: uint8(0x28),
  2537. 3: uint8(0x46),
  2538. 4: uint8(0xe4),
  2539. 5: uint8(0xd7),
  2540. 6: uint8(0x06),
  2541. 7: uint8(0x66),
  2542. },
  2543. 60: {
  2544. 0: uint8(0xe1),
  2545. 1: uint8(0x91),
  2546. 2: uint8(0x5f),
  2547. 3: uint8(0x5c),
  2548. 4: uint8(0xb1),
  2549. 5: uint8(0xec),
  2550. 6: uint8(0xa4),
  2551. 7: uint8(0x6c),
  2552. },
  2553. 61: {
  2554. 0: uint8(0xf3),
  2555. 1: uint8(0x25),
  2556. 2: uint8(0x96),
  2557. 3: uint8(0x5c),
  2558. 4: uint8(0xa1),
  2559. 5: uint8(0x6d),
  2560. 6: uint8(0x62),
  2561. 7: uint8(0x9f),
  2562. },
  2563. 62: {
  2564. 0: uint8(0x57),
  2565. 1: uint8(0x5f),
  2566. 2: uint8(0xf2),
  2567. 3: uint8(0x8e),
  2568. 4: uint8(0x60),
  2569. 5: uint8(0x38),
  2570. 6: uint8(0x1b),
  2571. 7: uint8(0xe5),
  2572. },
  2573. 63: {
  2574. 0: uint8(0x72),
  2575. 1: uint8(0x45),
  2576. 2: uint8(0x06),
  2577. 3: uint8(0xeb),
  2578. 4: uint8(0x4c),
  2579. 5: uint8(0x32),
  2580. 6: uint8(0x8a),
  2581. 7: uint8(0x95),
  2582. },
  2583. }
  2584. type TICHAR = int8
  2585. type TPOSITION = struct {
  2586. FlineNumber TXML_Size
  2587. FcolumnNumber TXML_Size
  2588. }
  2589. type Tposition = TPOSITION
  2590. type TATTRIBUTE = struct {
  2591. Fname uintptr
  2592. FvaluePtr uintptr
  2593. FvalueEnd uintptr
  2594. Fnormalized int8
  2595. }
  2596. type Tencoding = struct {
  2597. Fscanners [4]TSCANNER
  2598. FliteralScanners [2]TSCANNER
  2599. FnameMatchesAscii uintptr
  2600. FnameLength uintptr
  2601. FskipS uintptr
  2602. FgetAtts uintptr
  2603. FcharRefNumber uintptr
  2604. FpredefinedEntityName uintptr
  2605. FupdatePosition uintptr
  2606. FisPublicId uintptr
  2607. Futf8Convert uintptr
  2608. Futf16Convert uintptr
  2609. FminBytesPerChar int32
  2610. FisUtf8 int8
  2611. FisUtf16 int8
  2612. }
  2613. type TENCODING = struct {
  2614. Fscanners [4]TSCANNER
  2615. FliteralScanners [2]TSCANNER
  2616. FnameMatchesAscii uintptr
  2617. FnameLength uintptr
  2618. FskipS uintptr
  2619. FgetAtts uintptr
  2620. FcharRefNumber uintptr
  2621. FpredefinedEntityName uintptr
  2622. FupdatePosition uintptr
  2623. FisPublicId uintptr
  2624. Futf8Convert uintptr
  2625. Futf16Convert uintptr
  2626. FminBytesPerChar int32
  2627. FisUtf8 int8
  2628. FisUtf16 int8
  2629. }
  2630. type TSCANNER = uintptr
  2631. type _XML_Convert_Result = int32
  2632. const _XML_CONVERT_COMPLETED = 0
  2633. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2634. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2635. type TINIT_ENCODING = struct {
  2636. FinitEnc TENCODING
  2637. FencPtr uintptr
  2638. }
  2639. type TCONVERTER = uintptr
  2640. const _XML_ROLE_ERROR = -1
  2641. const _XML_ROLE_NONE = 0
  2642. const _XML_ROLE_XML_DECL = 1
  2643. const _XML_ROLE_INSTANCE_START = 2
  2644. const _XML_ROLE_DOCTYPE_NONE = 3
  2645. const _XML_ROLE_DOCTYPE_NAME = 4
  2646. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2647. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2648. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2649. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2650. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2651. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2652. const _XML_ROLE_ENTITY_NONE = 11
  2653. const _XML_ROLE_ENTITY_VALUE = 12
  2654. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2655. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2656. const _XML_ROLE_ENTITY_COMPLETE = 15
  2657. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2658. const _XML_ROLE_NOTATION_NONE = 17
  2659. const _XML_ROLE_NOTATION_NAME = 18
  2660. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2661. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2662. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2663. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2664. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2665. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2666. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2667. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2668. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2669. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2670. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2671. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2672. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2673. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2674. const _XML_ROLE_ATTLIST_NONE = 33
  2675. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2676. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2677. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2678. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2679. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2680. const _XML_ROLE_ELEMENT_NONE = 39
  2681. const _XML_ROLE_ELEMENT_NAME = 40
  2682. const _XML_ROLE_CONTENT_ANY = 41
  2683. const _XML_ROLE_CONTENT_EMPTY = 42
  2684. const _XML_ROLE_CONTENT_PCDATA = 43
  2685. const _XML_ROLE_GROUP_OPEN = 44
  2686. const _XML_ROLE_GROUP_CLOSE = 45
  2687. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2688. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2689. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2690. const _XML_ROLE_GROUP_CHOICE = 49
  2691. const _XML_ROLE_GROUP_SEQUENCE = 50
  2692. const _XML_ROLE_CONTENT_ELEMENT = 51
  2693. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2694. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2695. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2696. const _XML_ROLE_PI = 55
  2697. const _XML_ROLE_COMMENT = 56
  2698. const _XML_ROLE_TEXT_DECL = 57
  2699. const _XML_ROLE_IGNORE_SECT = 58
  2700. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2701. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2702. type TPROLOG_STATE = struct {
  2703. Fhandler uintptr
  2704. Flevel uint32
  2705. Frole_none int32
  2706. FincludeLevel uint32
  2707. FdocumentEntity int32
  2708. FinEntityValue int32
  2709. }
  2710. type Tprolog_state = TPROLOG_STATE
  2711. type TKEY = uintptr
  2712. type TNAMED = struct {
  2713. Fname TKEY
  2714. }
  2715. type THASH_TABLE = struct {
  2716. Fv uintptr
  2717. Fpower uint8
  2718. Fsize Tsize_t
  2719. Fused Tsize_t
  2720. Fmem uintptr
  2721. }
  2722. /* For probing (after a collision) we need a step size relative prime
  2723. to the hash table size, which is a power of 2. We use double-hashing,
  2724. since we can calculate a second hash value cheaply by taking those bits
  2725. of the first hash value that were discarded (masked out) when the table
  2726. index was calculated: index = hash & mask, where mask = table->size - 1.
  2727. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2728. it odd, since odd numbers are always relative prime to a power of 2.
  2729. */
  2730. type THASH_TABLE_ITER = struct {
  2731. Fp uintptr
  2732. Fend uintptr
  2733. }
  2734. type TBINDING = struct {
  2735. Fprefix uintptr
  2736. FnextTagBinding uintptr
  2737. FprevPrefixBinding uintptr
  2738. FattId uintptr
  2739. Furi uintptr
  2740. FuriLen int32
  2741. FuriAlloc int32
  2742. }
  2743. type Tbinding = TBINDING
  2744. type TPREFIX = struct {
  2745. Fname uintptr
  2746. Fbinding uintptr
  2747. }
  2748. type Tprefix = TPREFIX
  2749. type TTAG_NAME = struct {
  2750. Fstr uintptr
  2751. FlocalPart uintptr
  2752. Fprefix uintptr
  2753. FstrLen int32
  2754. FuriLen int32
  2755. FprefixLen int32
  2756. }
  2757. // C documentation
  2758. //
  2759. // /* TAG represents an open element.
  2760. // The name of the element is stored in both the document and API
  2761. // encodings. The memory buffer 'buf' is a separately-allocated
  2762. // memory area which stores the name. During the XML_Parse()/
  2763. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2764. // version of the name (in the document encoding) is shared with the
  2765. // document buffer. If the element is open across calls to
  2766. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2767. // contain the 'raw' name as well.
  2768. //
  2769. // A parser re-uses these structures, maintaining a list of allocated
  2770. // TAG objects in a free list.
  2771. // */
  2772. type TTAG = struct {
  2773. Fparent uintptr
  2774. FrawName uintptr
  2775. FrawNameLength int32
  2776. Fname TTAG_NAME
  2777. Fbuf uintptr
  2778. FbufEnd uintptr
  2779. Fbindings uintptr
  2780. }
  2781. // C documentation
  2782. //
  2783. // /* TAG represents an open element.
  2784. // The name of the element is stored in both the document and API
  2785. // encodings. The memory buffer 'buf' is a separately-allocated
  2786. // memory area which stores the name. During the XML_Parse()/
  2787. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2788. // version of the name (in the document encoding) is shared with the
  2789. // document buffer. If the element is open across calls to
  2790. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2791. // contain the 'raw' name as well.
  2792. //
  2793. // A parser re-uses these structures, maintaining a list of allocated
  2794. // TAG objects in a free list.
  2795. // */
  2796. type Ttag = TTAG
  2797. type TENTITY = struct {
  2798. Fname uintptr
  2799. FtextPtr uintptr
  2800. FtextLen int32
  2801. Fprocessed int32
  2802. FsystemId uintptr
  2803. Fbase uintptr
  2804. FpublicId uintptr
  2805. Fnotation uintptr
  2806. Fopen TXML_Bool
  2807. Fis_param TXML_Bool
  2808. Fis_internal TXML_Bool
  2809. }
  2810. type TCONTENT_SCAFFOLD = struct {
  2811. Ftype1 _XML_Content_Type
  2812. Fquant _XML_Content_Quant
  2813. Fname uintptr
  2814. Ffirstchild int32
  2815. Flastchild int32
  2816. Fchildcnt int32
  2817. Fnextsib int32
  2818. }
  2819. type TBLOCK = struct {
  2820. Fnext uintptr
  2821. Fsize int32
  2822. Fs [1]TXML_Char
  2823. }
  2824. type Tblock = TBLOCK
  2825. type TSTRING_POOL = struct {
  2826. Fblocks uintptr
  2827. FfreeBlocks uintptr
  2828. Fend uintptr
  2829. Fptr uintptr
  2830. Fstart uintptr
  2831. Fmem uintptr
  2832. }
  2833. // C documentation
  2834. //
  2835. // /* The XML_Char before the name is used to determine whether
  2836. // an attribute has been specified. */
  2837. type TATTRIBUTE_ID = struct {
  2838. Fname uintptr
  2839. Fprefix uintptr
  2840. FmaybeTokenized TXML_Bool
  2841. Fxmlns TXML_Bool
  2842. }
  2843. // C documentation
  2844. //
  2845. // /* The XML_Char before the name is used to determine whether
  2846. // an attribute has been specified. */
  2847. type Tattribute_id = TATTRIBUTE_ID
  2848. type TDEFAULT_ATTRIBUTE = struct {
  2849. Fid uintptr
  2850. FisCdata TXML_Bool
  2851. Fvalue uintptr
  2852. }
  2853. type TNS_ATT = struct {
  2854. Fversion uint64
  2855. Fhash uint64
  2856. FuriName uintptr
  2857. }
  2858. type TELEMENT_TYPE = struct {
  2859. Fname uintptr
  2860. Fprefix uintptr
  2861. FidAtt uintptr
  2862. FnDefaultAtts int32
  2863. FallocDefaultAtts int32
  2864. FdefaultAtts uintptr
  2865. }
  2866. type TDTD = struct {
  2867. FgeneralEntities THASH_TABLE
  2868. FelementTypes THASH_TABLE
  2869. FattributeIds THASH_TABLE
  2870. Fprefixes THASH_TABLE
  2871. Fpool TSTRING_POOL
  2872. FentityValuePool TSTRING_POOL
  2873. FkeepProcessing TXML_Bool
  2874. FhasParamEntityRefs TXML_Bool
  2875. Fstandalone TXML_Bool
  2876. FparamEntityRead TXML_Bool
  2877. FparamEntities THASH_TABLE
  2878. FdefaultPrefix TPREFIX
  2879. Fin_eldecl TXML_Bool
  2880. Fscaffold uintptr
  2881. FcontentStringLen uint32
  2882. FscaffSize uint32
  2883. FscaffCount uint32
  2884. FscaffLevel int32
  2885. FscaffIndex uintptr
  2886. }
  2887. type TOPEN_INTERNAL_ENTITY = struct {
  2888. FinternalEventPtr uintptr
  2889. FinternalEventEndPtr uintptr
  2890. Fnext uintptr
  2891. Fentity uintptr
  2892. FstartTagLevel int32
  2893. FbetweenDecl TXML_Bool
  2894. }
  2895. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2896. type _XML_Account = int32
  2897. const _XML_ACCOUNT_DIRECT = 0
  2898. const /* bytes directly passed to the Expat parser */
  2899. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  2900. const /* intermediate bytes produced during entity
  2901. expansion */
  2902. _XML_ACCOUNT_NONE = 2
  2903. type TXmlBigCount = uint64
  2904. type TACCOUNTING = struct {
  2905. FcountBytesDirect TXmlBigCount
  2906. FcountBytesIndirect TXmlBigCount
  2907. FdebugLevel int32
  2908. FmaximumAmplificationFactor float32
  2909. FactivationThresholdBytes uint64
  2910. }
  2911. type Taccounting = TACCOUNTING
  2912. type TENTITY_STATS = struct {
  2913. FcountEverOpened uint32
  2914. FcurrentDepth uint32
  2915. FmaximumDepthSeen uint32
  2916. FdebugLevel int32
  2917. }
  2918. type Tentity_stats = TENTITY_STATS
  2919. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2920. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2921. }
  2922. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2923. bp := tls.Alloc(16)
  2924. defer tls.Free(16)
  2925. var _ /* tmp at bp+0 */ [2]TXML_Char
  2926. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  2927. 0: nsSep,
  2928. }
  2929. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2930. }
  2931. // C documentation
  2932. //
  2933. // // "xml=http://www.w3.org/XML/1998/namespace"
  2934. var _implicitContext = [41]TXML_Char{
  2935. 0: int8(m_ASCII_x),
  2936. 1: int8(m_ASCII_m),
  2937. 2: int8(m_ASCII_l),
  2938. 3: int8(m_ASCII_EQUALS),
  2939. 4: int8(m_ASCII_h),
  2940. 5: int8(m_ASCII_t),
  2941. 6: int8(m_ASCII_t),
  2942. 7: int8(m_ASCII_p),
  2943. 8: int8(m_ASCII_COLON),
  2944. 9: int8(m_ASCII_SLASH),
  2945. 10: int8(m_ASCII_SLASH),
  2946. 11: int8(m_ASCII_w),
  2947. 12: int8(m_ASCII_w),
  2948. 13: int8(m_ASCII_w),
  2949. 14: int8(m_ASCII_PERIOD),
  2950. 15: int8(m_ASCII_w),
  2951. 16: int8(m_ASCII_3),
  2952. 17: int8(m_ASCII_PERIOD),
  2953. 18: int8(m_ASCII_o),
  2954. 19: int8(m_ASCII_r),
  2955. 20: int8(m_ASCII_g),
  2956. 21: int8(m_ASCII_SLASH),
  2957. 22: int8(m_ASCII_X),
  2958. 23: int8(m_ASCII_M),
  2959. 24: int8(m_ASCII_L),
  2960. 25: int8(m_ASCII_SLASH),
  2961. 26: int8(m_ASCII_1),
  2962. 27: int8(m_ASCII_9),
  2963. 28: int8(m_ASCII_9),
  2964. 29: int8(m_ASCII_8),
  2965. 30: int8(m_ASCII_SLASH),
  2966. 31: int8(m_ASCII_n),
  2967. 32: int8(m_ASCII_a),
  2968. 33: int8(m_ASCII_m),
  2969. 34: int8(m_ASCII_e),
  2970. 35: int8(m_ASCII_s),
  2971. 36: int8(m_ASCII_p),
  2972. 37: int8(m_ASCII_a),
  2973. 38: int8(m_ASCII_c),
  2974. 39: int8(m_ASCII_e),
  2975. }
  2976. /* To avoid warnings about unused functions: */
  2977. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  2978. bp := tls.Alloc(48)
  2979. defer tls.Free(48)
  2980. if _getDebugLevel(tls, __ccgo_ts+17, uint64(0)) >= uint64(1) {
  2981. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  2982. }
  2983. return entropy
  2984. }
  2985. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2986. bp := tls.Alloc(16)
  2987. defer tls.Free(16)
  2988. var _ /* entropy at bp+0 */ uint64
  2989. _ = parser
  2990. /* "Failproof" high quality providers: */
  2991. libbsd.Xarc4random_buf(tls, bp, uint64(8))
  2992. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint64)(unsafe.Pointer(bp)))
  2993. }
  2994. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2995. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2996. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2997. }
  2998. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2999. }
  3000. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  3001. /* hash functions must be initialized before setContext() is called */
  3002. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  3003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  3004. }
  3005. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3006. /* implicit context only set for root parser, since child
  3007. parsers (i.e. external entity parsers) will inherit it
  3008. */
  3009. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  3010. }
  3011. return libc.Uint8FromInt32(1)
  3012. }
  3013. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  3014. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  3015. }
  3016. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  3017. var mtemp, mtemp1 uintptr
  3018. var parser TXML_Parser
  3019. _, _, _ = mtemp, mtemp1, parser
  3020. if memsuite != 0 {
  3021. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(976))
  3022. if parser != libc.UintptrFromInt32(0) {
  3023. mtemp = parser + 24
  3024. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  3025. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  3026. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  3027. }
  3028. } else {
  3029. parser = libc.Xmalloc(tls, uint64(976))
  3030. if parser != libc.UintptrFromInt32(0) {
  3031. mtemp1 = parser + 24
  3032. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  3033. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  3034. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  3035. }
  3036. }
  3037. if !(parser != 0) {
  3038. return parser
  3039. }
  3040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  3041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  3042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  3043. (*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))
  3044. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  3045. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3046. return libc.UintptrFromInt32(0)
  3047. }
  3048. (*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))
  3049. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  3050. (*(*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)
  3051. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3052. return libc.UintptrFromInt32(0)
  3053. }
  3054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  3055. if dtd != 0 {
  3056. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  3057. } else {
  3058. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  3059. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  3060. (*(*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)
  3061. (*(*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)
  3062. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3063. return libc.UintptrFromInt32(0)
  3064. }
  3065. }
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  3067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  3070. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  3071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = int8(m_ASCII_EXCL)
  3074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  3075. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  3077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  3078. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  3079. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3080. _poolInit(tls, parser+784, parser+24)
  3081. _poolInit(tls, parser+832, parser+24)
  3082. _parserInit(tls, parser, encodingName)
  3083. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3084. if dtd != 0 {
  3085. // We need to stop the upcoming call to XML_ParserFree from happily
  3086. // destroying parser->m_dtd because the DTD is shared with the parent
  3087. // parser and the only guard that keeps XML_ParserFree from destroying
  3088. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  3089. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  3090. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  3091. }
  3092. XXML_ParserFree(tls, parser)
  3093. return libc.UintptrFromInt32(0)
  3094. }
  3095. if nameSep != 0 {
  3096. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3097. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3098. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3099. } else {
  3100. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3101. }
  3102. return parser
  3103. }
  3104. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3105. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3106. XXmlPrologStateInit(tls, parser+496)
  3107. if encodingName != libc.UintptrFromInt32(0) {
  3108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3109. }
  3110. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3111. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  3112. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3113. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3115. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3117. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3120. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3123. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3124. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3125. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3126. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3127. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3128. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3129. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3130. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3131. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3132. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3133. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3134. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3136. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3137. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3138. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3139. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3140. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3141. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3142. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3143. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3144. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3145. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3146. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3147. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3148. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3149. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3150. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3151. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3152. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3153. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3154. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3155. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3156. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3157. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3158. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3159. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3160. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3161. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3162. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3163. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3164. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3165. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3166. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3167. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3168. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3169. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3170. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3171. libc.Xmemset(tls, parser+928, 0, uint64(32))
  3172. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3173. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3174. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3175. libc.Xmemset(tls, parser+960, 0, uint64(16))
  3176. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3177. }
  3178. // C documentation
  3179. //
  3180. // /* moves list of bindings to m_freeBindingList */
  3181. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3182. var b uintptr
  3183. _ = b
  3184. for bindings != 0 {
  3185. b = bindings
  3186. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3187. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3188. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3189. }
  3190. }
  3191. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3192. var openEntity, openEntityList, tStk, tag uintptr
  3193. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3194. if parser == libc.UintptrFromInt32(0) {
  3195. return libc.Uint8FromInt32(0)
  3196. }
  3197. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3198. return libc.Uint8FromInt32(0)
  3199. }
  3200. /* move m_tagStack to m_freeTagList */
  3201. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3202. for tStk != 0 {
  3203. tag = tStk
  3204. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3205. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3206. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3207. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3208. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3209. }
  3210. /* move m_openInternalEntities to m_freeInternalEntities */
  3211. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3212. for openEntityList != 0 {
  3213. openEntity = openEntityList
  3214. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3215. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3216. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3217. }
  3218. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3219. (*(*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)
  3220. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3221. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3222. }
  3223. _poolClear(tls, parser+784)
  3224. _poolClear(tls, parser+832)
  3225. (*(*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)
  3226. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3227. _parserInit(tls, parser, encodingName)
  3228. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3229. return libc.Uint8FromInt32(1)
  3230. }
  3231. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3232. if parser == libc.UintptrFromInt32(0) {
  3233. return int32(_XML_STATUS_ERROR)
  3234. }
  3235. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3236. XXX There's no way for the caller to determine which of the
  3237. XXX possible error cases caused the XML_STATUS_ERROR return.
  3238. */
  3239. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3240. return int32(_XML_STATUS_ERROR)
  3241. }
  3242. /* Get rid of any previous encoding name */
  3243. (*(*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)
  3244. if encodingName == libc.UintptrFromInt32(0) {
  3245. /* No new encoding name */
  3246. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3247. } else {
  3248. /* Copy the new encoding name into allocated memory */
  3249. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3250. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3251. return int32(_XML_STATUS_ERROR)
  3252. }
  3253. }
  3254. return int32(_XML_STATUS_OK)
  3255. }
  3256. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3257. bp := tls.Alloc(16)
  3258. defer tls.Free(16)
  3259. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3260. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3261. var oldCharacterDataHandler TXML_CharacterDataHandler
  3262. var oldCommentHandler TXML_CommentHandler
  3263. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3264. var oldDefaultHandler TXML_DefaultHandler
  3265. var oldElementDeclHandler TXML_ElementDeclHandler
  3266. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3267. var oldEndElementHandler TXML_EndElementHandler
  3268. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3269. var oldEntityDeclHandler TXML_EntityDeclHandler
  3270. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3271. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3272. var oldInEntityValue int32
  3273. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3274. var oldNotationDeclHandler TXML_NotationDeclHandler
  3275. var oldParamEntityParsing _XML_ParamEntityParsing
  3276. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3277. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3278. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3279. var oldStartElementHandler TXML_StartElementHandler
  3280. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3281. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3282. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3283. var oldXmlDeclHandler TXML_XmlDeclHandler
  3284. var oldhash_secret_salt uint64
  3285. var _ /* tmp at bp+0 */ [2]TXML_Char
  3286. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3287. parser = oldParser
  3288. newDtd = libc.UintptrFromInt32(0)
  3289. /* Validate the oldParser parameter before we pull everything out of it */
  3290. if oldParser == libc.UintptrFromInt32(0) {
  3291. return libc.UintptrFromInt32(0)
  3292. }
  3293. /* Stash the original parser contents on the stack */
  3294. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3295. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3296. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3297. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3298. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3299. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3300. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3301. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3302. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3303. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3304. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3305. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3306. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3307. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3308. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3309. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3310. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3311. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3312. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3313. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3314. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3315. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3316. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3317. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3318. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3319. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3320. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3321. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3322. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3323. /* Note that the new parser shares the same hash secret as the old
  3324. parser, so that dtdCopy and copyEntityTable can lookup values
  3325. from hash tables associated with either parser without us having
  3326. to worry which hash secrets each table has.
  3327. */
  3328. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3329. if !(context != 0) {
  3330. newDtd = oldDtd
  3331. }
  3332. /* Note that the magical uses of the pre-processor to make field
  3333. access look more like C++ require that `parser' be overwritten
  3334. here. This makes this function more painful to follow than it
  3335. would be otherwise.
  3336. */
  3337. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3338. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3339. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3340. }
  3341. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3342. } else {
  3343. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3344. }
  3345. if !(parser != 0) {
  3346. return libc.UintptrFromInt32(0)
  3347. }
  3348. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3349. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3350. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3351. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3352. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3353. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3354. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3355. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3356. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3357. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3358. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3359. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3360. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3361. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3362. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3363. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3364. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3365. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3366. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3367. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3368. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3369. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3370. if oldUserData == oldHandlerArg {
  3371. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3372. } else {
  3373. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3374. }
  3375. if oldExternalEntityRefHandlerArg != oldParser {
  3376. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3377. }
  3378. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3379. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3380. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3381. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3382. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3383. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3384. if context != 0 {
  3385. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3386. XXML_ParserFree(tls, parser)
  3387. return libc.UintptrFromInt32(0)
  3388. }
  3389. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3390. } else {
  3391. /* The DTD instance referenced by parser->m_dtd is shared between the
  3392. document's root parser and external PE parsers, therefore one does not
  3393. need to call setContext. In addition, one also *must* not call
  3394. setContext, because this would overwrite existing prefix->binding
  3395. pointers in parser->m_dtd with ones that get destroyed with the external
  3396. PE parser. This would leave those prefixes with dangling pointers.
  3397. */
  3398. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3399. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3400. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3401. }
  3402. return parser
  3403. }
  3404. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3405. var b uintptr
  3406. _ = b
  3407. for {
  3408. b = bindings
  3409. if !(b != 0) {
  3410. break
  3411. }
  3412. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3413. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3414. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3415. goto _1
  3416. _1:
  3417. }
  3418. }
  3419. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3420. var entityList, openEntity, p, tagList uintptr
  3421. _, _, _, _ = entityList, openEntity, p, tagList
  3422. if parser == libc.UintptrFromInt32(0) {
  3423. return
  3424. }
  3425. /* free m_tagStack and m_freeTagList */
  3426. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3427. for {
  3428. if tagList == libc.UintptrFromInt32(0) {
  3429. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3430. break
  3431. }
  3432. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3433. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3434. }
  3435. p = tagList
  3436. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3437. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3438. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3439. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3440. goto _1
  3441. _1:
  3442. }
  3443. /* free m_openInternalEntities and m_freeInternalEntities */
  3444. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3445. for {
  3446. if entityList == libc.UintptrFromInt32(0) {
  3447. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3448. break
  3449. }
  3450. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3451. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3452. }
  3453. openEntity = entityList
  3454. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3455. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3456. goto _2
  3457. _2:
  3458. }
  3459. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3460. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3461. _poolDestroy(tls, parser+784)
  3462. _poolDestroy(tls, parser+832)
  3463. (*(*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)
  3464. /* external parameter entity parsers share the DTD structure
  3465. parser->m_dtd with the root parser, so we must not destroy it
  3466. */
  3467. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3468. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3469. }
  3470. (*(*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)
  3471. (*(*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)
  3472. (*(*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)
  3473. (*(*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)
  3474. (*(*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)
  3475. (*(*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)
  3476. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3477. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3478. }
  3479. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3480. }
  3481. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3482. if parser != libc.UintptrFromInt32(0) {
  3483. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3484. }
  3485. }
  3486. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3487. if parser == libc.UintptrFromInt32(0) {
  3488. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3489. }
  3490. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3491. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3492. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3493. }
  3494. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3495. return int32(_XML_ERROR_NONE)
  3496. }
  3497. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3498. var v1 int32
  3499. _ = v1
  3500. if parser == libc.UintptrFromInt32(0) {
  3501. return
  3502. }
  3503. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3504. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3505. return
  3506. }
  3507. if do_nst != 0 {
  3508. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3509. } else {
  3510. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3511. }
  3512. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3513. }
  3514. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3515. var v1 uintptr
  3516. _ = v1
  3517. if parser == libc.UintptrFromInt32(0) {
  3518. return
  3519. }
  3520. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3521. v1 = p
  3522. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3523. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3524. } else {
  3525. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3526. }
  3527. }
  3528. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3529. if parser == libc.UintptrFromInt32(0) {
  3530. return int32(_XML_STATUS_ERROR)
  3531. }
  3532. if p != 0 {
  3533. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3534. if !(p != 0) {
  3535. return int32(_XML_STATUS_ERROR)
  3536. }
  3537. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3538. } else {
  3539. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3540. }
  3541. return int32(_XML_STATUS_OK)
  3542. }
  3543. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3544. if parser == libc.UintptrFromInt32(0) {
  3545. return libc.UintptrFromInt32(0)
  3546. }
  3547. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3548. }
  3549. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3550. if parser == libc.UintptrFromInt32(0) {
  3551. return -int32(1)
  3552. }
  3553. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3554. }
  3555. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3556. if parser == libc.UintptrFromInt32(0) {
  3557. return -int32(1)
  3558. }
  3559. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3560. }
  3561. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3562. if parser == libc.UintptrFromInt32(0) {
  3563. return
  3564. }
  3565. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3566. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3567. }
  3568. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3569. if parser != libc.UintptrFromInt32(0) {
  3570. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3571. }
  3572. }
  3573. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3574. if parser != libc.UintptrFromInt32(0) {
  3575. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3576. }
  3577. }
  3578. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3579. if parser != libc.UintptrFromInt32(0) {
  3580. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3581. }
  3582. }
  3583. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3584. if parser != libc.UintptrFromInt32(0) {
  3585. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3586. }
  3587. }
  3588. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3589. if parser != libc.UintptrFromInt32(0) {
  3590. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3591. }
  3592. }
  3593. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3594. if parser == libc.UintptrFromInt32(0) {
  3595. return
  3596. }
  3597. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3599. }
  3600. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3601. if parser != libc.UintptrFromInt32(0) {
  3602. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3603. }
  3604. }
  3605. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3606. if parser != libc.UintptrFromInt32(0) {
  3607. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3608. }
  3609. }
  3610. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3611. if parser == libc.UintptrFromInt32(0) {
  3612. return
  3613. }
  3614. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3615. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3616. }
  3617. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3618. if parser == libc.UintptrFromInt32(0) {
  3619. return
  3620. }
  3621. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3622. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3623. }
  3624. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3625. if parser == libc.UintptrFromInt32(0) {
  3626. return
  3627. }
  3628. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3629. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3630. }
  3631. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3632. if parser != libc.UintptrFromInt32(0) {
  3633. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3634. }
  3635. }
  3636. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3637. if parser != libc.UintptrFromInt32(0) {
  3638. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3639. }
  3640. }
  3641. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3642. if parser != libc.UintptrFromInt32(0) {
  3643. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3644. }
  3645. }
  3646. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3647. if parser != libc.UintptrFromInt32(0) {
  3648. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3649. }
  3650. }
  3651. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3652. if parser == libc.UintptrFromInt32(0) {
  3653. return
  3654. }
  3655. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3656. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3657. }
  3658. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3659. if parser != libc.UintptrFromInt32(0) {
  3660. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3661. }
  3662. }
  3663. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3664. if parser != libc.UintptrFromInt32(0) {
  3665. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3666. }
  3667. }
  3668. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3669. if parser != libc.UintptrFromInt32(0) {
  3670. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3671. }
  3672. }
  3673. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3674. if parser != libc.UintptrFromInt32(0) {
  3675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3676. }
  3677. }
  3678. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3679. if parser == libc.UintptrFromInt32(0) {
  3680. return
  3681. }
  3682. if arg != 0 {
  3683. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3684. } else {
  3685. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3686. }
  3687. }
  3688. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3689. if parser != libc.UintptrFromInt32(0) {
  3690. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3691. }
  3692. }
  3693. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3694. if parser == libc.UintptrFromInt32(0) {
  3695. return
  3696. }
  3697. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3698. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3699. }
  3700. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3701. if parser != libc.UintptrFromInt32(0) {
  3702. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3703. }
  3704. }
  3705. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3706. if parser != libc.UintptrFromInt32(0) {
  3707. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3708. }
  3709. }
  3710. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3711. if parser != libc.UintptrFromInt32(0) {
  3712. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3713. }
  3714. }
  3715. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3716. if parser != libc.UintptrFromInt32(0) {
  3717. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3718. }
  3719. }
  3720. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3721. if parser == libc.UintptrFromInt32(0) {
  3722. return 0
  3723. }
  3724. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3725. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3726. return 0
  3727. }
  3728. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3729. return int32(1)
  3730. }
  3731. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3732. if parser == libc.UintptrFromInt32(0) {
  3733. return 0
  3734. }
  3735. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3736. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3737. }
  3738. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3739. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3740. return 0
  3741. }
  3742. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3743. return int32(1)
  3744. }
  3745. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3746. var buff uintptr
  3747. _ = buff
  3748. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3749. if parser != libc.UintptrFromInt32(0) {
  3750. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3751. }
  3752. return int32(_XML_STATUS_ERROR)
  3753. }
  3754. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3755. case int32(_XML_SUSPENDED):
  3756. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3757. return int32(_XML_STATUS_ERROR)
  3758. case int32(_XML_FINISHED):
  3759. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3760. return int32(_XML_STATUS_ERROR)
  3761. case int32(_XML_INITIALIZED):
  3762. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3763. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3764. return int32(_XML_STATUS_ERROR)
  3765. }
  3766. /* fall through */
  3767. fallthrough
  3768. default:
  3769. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3770. }
  3771. if len1 == 0 {
  3772. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3773. if !(isFinal != 0) {
  3774. return int32(_XML_STATUS_OK)
  3775. }
  3776. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3777. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3778. /* If data are left over from last buffer, and we now know that these
  3779. data are the final chunk of input, then we have to check them again
  3780. to detect errors based on that fact.
  3781. */
  3782. (*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)
  3783. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3784. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3785. case int32(_XML_SUSPENDED):
  3786. /* It is hard to be certain, but it seems that this case
  3787. * cannot occur. This code is cleaning up a previous parse
  3788. * with no new data (since len == 0). Changing the parsing
  3789. * state requires getting to execute a handler function, and
  3790. * there doesn't seem to be an opportunity for that while in
  3791. * this circumstance.
  3792. *
  3793. * Given the uncertainty, we retain the code but exclude it
  3794. * from coverage tests.
  3795. *
  3796. * LCOV_EXCL_START
  3797. */
  3798. (*(*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)
  3799. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3800. return int32(_XML_STATUS_SUSPENDED)
  3801. /* LCOV_EXCL_STOP */
  3802. fallthrough
  3803. case int32(_XML_INITIALIZED):
  3804. fallthrough
  3805. case int32(_XML_PARSING):
  3806. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3807. /* fall through */
  3808. fallthrough
  3809. default:
  3810. return int32(_XML_STATUS_OK)
  3811. }
  3812. }
  3813. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3814. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3815. return int32(_XML_STATUS_ERROR)
  3816. } else {
  3817. buff = XXML_GetBuffer(tls, parser, len1)
  3818. if buff == libc.UintptrFromInt32(0) {
  3819. return int32(_XML_STATUS_ERROR)
  3820. } else {
  3821. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3822. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3823. }
  3824. }
  3825. return r
  3826. }
  3827. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3828. var result _XML_Status
  3829. var start uintptr
  3830. _, _ = result, start
  3831. result = int32(_XML_STATUS_OK)
  3832. if parser == libc.UintptrFromInt32(0) {
  3833. return int32(_XML_STATUS_ERROR)
  3834. }
  3835. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3836. case int32(_XML_SUSPENDED):
  3837. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3838. return int32(_XML_STATUS_ERROR)
  3839. case int32(_XML_FINISHED):
  3840. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3841. return int32(_XML_STATUS_ERROR)
  3842. case int32(_XML_INITIALIZED):
  3843. /* Has someone called XML_GetBuffer successfully before? */
  3844. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3845. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3846. return int32(_XML_STATUS_ERROR)
  3847. }
  3848. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3849. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3850. return int32(_XML_STATUS_ERROR)
  3851. }
  3852. /* fall through */
  3853. fallthrough
  3854. default:
  3855. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3856. }
  3857. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3858. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3859. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3860. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3861. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3862. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3863. (*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)
  3864. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3865. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3866. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3867. return int32(_XML_STATUS_ERROR)
  3868. } else {
  3869. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3870. case int32(_XML_SUSPENDED):
  3871. result = int32(_XML_STATUS_SUSPENDED)
  3872. case int32(_XML_INITIALIZED):
  3873. fallthrough
  3874. case int32(_XML_PARSING):
  3875. if isFinal != 0 {
  3876. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3877. return result
  3878. }
  3879. fallthrough
  3880. default: /* should not happen */
  3881. }
  3882. }
  3883. (*(*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)
  3884. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3885. return result
  3886. }
  3887. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3888. var bufferSize, keep, neededSize, offset int32
  3889. var newBuf, v10, v11 uintptr
  3890. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  3891. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3892. if parser == libc.UintptrFromInt32(0) {
  3893. return libc.UintptrFromInt32(0)
  3894. }
  3895. if len1 < 0 {
  3896. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3897. return libc.UintptrFromInt32(0)
  3898. }
  3899. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3900. case int32(_XML_SUSPENDED):
  3901. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3902. return libc.UintptrFromInt32(0)
  3903. case int32(_XML_FINISHED):
  3904. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3905. return libc.UintptrFromInt32(0)
  3906. default:
  3907. }
  3908. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3909. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3910. } else {
  3911. v1 = 0
  3912. }
  3913. if int64(len1) > v1 {
  3914. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3915. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3916. } else {
  3917. v2 = 0
  3918. }
  3919. /* Do not invoke signed arithmetic overflow: */
  3920. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  3921. if neededSize < 0 {
  3922. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3923. return libc.UintptrFromInt32(0)
  3924. }
  3925. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3926. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3927. } else {
  3928. v3 = 0
  3929. }
  3930. keep = int32(v3)
  3931. if keep > int32(m_XML_CONTEXT_BYTES) {
  3932. keep = int32(m_XML_CONTEXT_BYTES)
  3933. }
  3934. /* Detect and prevent integer overflow */
  3935. if keep > int32(m_INT_MAX)-neededSize {
  3936. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3937. return libc.UintptrFromInt32(0)
  3938. }
  3939. neededSize += keep
  3940. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3941. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3942. } else {
  3943. v4 = 0
  3944. }
  3945. if int64(neededSize) <= v4 {
  3946. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3947. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3948. } else {
  3949. v5 = 0
  3950. }
  3951. if int64(keep) < v5 {
  3952. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3953. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3954. } else {
  3955. v6 = 0
  3956. }
  3957. offset = int32(v6) - keep
  3958. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3959. * in the buffer */
  3960. 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)))
  3961. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  3962. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  3963. }
  3964. } else {
  3965. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3966. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3967. } else {
  3968. v7 = 0
  3969. }
  3970. bufferSize = int32(v7)
  3971. if bufferSize == 0 {
  3972. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3973. }
  3974. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3975. /* Do not invoke signed arithmetic overflow: */
  3976. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3977. }
  3978. if bufferSize <= 0 {
  3979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3980. return libc.UintptrFromInt32(0)
  3981. }
  3982. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  3983. if newBuf == uintptr(0) {
  3984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3985. return libc.UintptrFromInt32(0)
  3986. }
  3987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3988. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3989. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3990. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3991. } else {
  3992. v8 = 0
  3993. }
  3994. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  3995. (*(*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)
  3996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3997. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3998. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3999. } else {
  4000. v9 = 0
  4001. }
  4002. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  4003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  4004. } else {
  4005. /* This must be a brand new buffer with no data in it yet */
  4006. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  4007. v10 = newBuf
  4008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  4009. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  4010. }
  4011. }
  4012. v11 = libc.UintptrFromInt32(0)
  4013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  4014. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  4015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  4016. }
  4017. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  4018. }
  4019. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  4020. if parser == libc.UintptrFromInt32(0) {
  4021. return int32(_XML_STATUS_ERROR)
  4022. }
  4023. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4024. case int32(_XML_SUSPENDED):
  4025. if resumable != 0 {
  4026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  4027. return int32(_XML_STATUS_ERROR)
  4028. }
  4029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4030. case int32(_XML_FINISHED):
  4031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  4032. return int32(_XML_STATUS_ERROR)
  4033. default:
  4034. if resumable != 0 {
  4035. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  4036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  4037. return int32(_XML_STATUS_ERROR)
  4038. }
  4039. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  4040. } else {
  4041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4042. }
  4043. }
  4044. return int32(_XML_STATUS_OK)
  4045. }
  4046. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  4047. var result _XML_Status
  4048. _ = result
  4049. result = int32(_XML_STATUS_OK)
  4050. if parser == libc.UintptrFromInt32(0) {
  4051. return int32(_XML_STATUS_ERROR)
  4052. }
  4053. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  4054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  4055. return int32(_XML_STATUS_ERROR)
  4056. }
  4057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  4058. (*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)
  4059. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  4060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  4062. return int32(_XML_STATUS_ERROR)
  4063. } else {
  4064. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4065. case int32(_XML_SUSPENDED):
  4066. result = int32(_XML_STATUS_SUSPENDED)
  4067. case int32(_XML_INITIALIZED):
  4068. fallthrough
  4069. case int32(_XML_PARSING):
  4070. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  4071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4072. return result
  4073. }
  4074. fallthrough
  4075. default:
  4076. }
  4077. }
  4078. (*(*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)
  4079. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  4080. return result
  4081. }
  4082. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  4083. if parser == libc.UintptrFromInt32(0) {
  4084. return
  4085. }
  4086. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  4087. }
  4088. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  4089. if parser == libc.UintptrFromInt32(0) {
  4090. return int32(_XML_ERROR_INVALID_ARGUMENT)
  4091. }
  4092. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  4093. }
  4094. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  4095. if parser == libc.UintptrFromInt32(0) {
  4096. return int64(-int32(1))
  4097. }
  4098. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4099. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4100. }
  4101. return int64(-int32(1))
  4102. }
  4103. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4104. if parser == libc.UintptrFromInt32(0) {
  4105. return 0
  4106. }
  4107. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4108. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4109. }
  4110. return 0
  4111. }
  4112. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4113. if parser == libc.UintptrFromInt32(0) {
  4114. return libc.UintptrFromInt32(0)
  4115. }
  4116. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4117. if offset != libc.UintptrFromInt32(0) {
  4118. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4119. }
  4120. if size != libc.UintptrFromInt32(0) {
  4121. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4122. }
  4123. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4124. }
  4125. return libc.UintptrFromInt32(0)
  4126. }
  4127. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4128. if parser == libc.UintptrFromInt32(0) {
  4129. return uint64(0)
  4130. }
  4131. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4132. (*(*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)
  4133. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4134. }
  4135. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  4136. }
  4137. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4138. if parser == libc.UintptrFromInt32(0) {
  4139. return uint64(0)
  4140. }
  4141. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4142. (*(*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)
  4143. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4144. }
  4145. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4146. }
  4147. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4148. if parser != libc.UintptrFromInt32(0) {
  4149. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4150. }
  4151. }
  4152. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4153. if parser == libc.UintptrFromInt32(0) {
  4154. return libc.UintptrFromInt32(0)
  4155. }
  4156. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4157. }
  4158. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4159. if parser == libc.UintptrFromInt32(0) {
  4160. return libc.UintptrFromInt32(0)
  4161. }
  4162. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4163. }
  4164. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4165. if parser != libc.UintptrFromInt32(0) {
  4166. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4167. }
  4168. }
  4169. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4170. if parser == libc.UintptrFromInt32(0) {
  4171. return
  4172. }
  4173. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4174. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4175. _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)
  4176. } else {
  4177. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4178. }
  4179. }
  4180. }
  4181. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4182. switch code {
  4183. case int32(_XML_ERROR_NONE):
  4184. return libc.UintptrFromInt32(0)
  4185. case int32(_XML_ERROR_NO_MEMORY):
  4186. return __ccgo_ts + 138
  4187. case int32(_XML_ERROR_SYNTAX):
  4188. return __ccgo_ts + 152
  4189. case int32(_XML_ERROR_NO_ELEMENTS):
  4190. return __ccgo_ts + 165
  4191. case int32(_XML_ERROR_INVALID_TOKEN):
  4192. return __ccgo_ts + 182
  4193. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4194. return __ccgo_ts + 214
  4195. case int32(_XML_ERROR_PARTIAL_CHAR):
  4196. return __ccgo_ts + 229
  4197. case int32(_XML_ERROR_TAG_MISMATCH):
  4198. return __ccgo_ts + 247
  4199. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4200. return __ccgo_ts + 262
  4201. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4202. return __ccgo_ts + 282
  4203. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4204. return __ccgo_ts + 310
  4205. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4206. return __ccgo_ts + 345
  4207. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4208. return __ccgo_ts + 362
  4209. case int32(_XML_ERROR_ASYNC_ENTITY):
  4210. return __ccgo_ts + 389
  4211. case int32(_XML_ERROR_BAD_CHAR_REF):
  4212. return __ccgo_ts + 409
  4213. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4214. return __ccgo_ts + 447
  4215. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4216. return __ccgo_ts + 474
  4217. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4218. return __ccgo_ts + 516
  4219. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4220. return __ccgo_ts + 563
  4221. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4222. return __ccgo_ts + 580
  4223. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4224. return __ccgo_ts + 631
  4225. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4226. return __ccgo_ts + 654
  4227. case int32(_XML_ERROR_NOT_STANDALONE):
  4228. return __ccgo_ts + 700
  4229. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4230. return __ccgo_ts + 727
  4231. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4232. return __ccgo_ts + 778
  4233. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4234. return __ccgo_ts + 814
  4235. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4236. return __ccgo_ts + 866
  4237. /* Added in 1.95.7. */
  4238. fallthrough
  4239. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4240. return __ccgo_ts + 911
  4241. /* Added in 1.95.8. */
  4242. fallthrough
  4243. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4244. return __ccgo_ts + 926
  4245. case int32(_XML_ERROR_INCOMPLETE_PE):
  4246. return __ccgo_ts + 952
  4247. case int32(_XML_ERROR_XML_DECL):
  4248. return __ccgo_ts + 990
  4249. case int32(_XML_ERROR_TEXT_DECL):
  4250. return __ccgo_ts + 1022
  4251. case int32(_XML_ERROR_PUBLICID):
  4252. return __ccgo_ts + 1055
  4253. case int32(_XML_ERROR_SUSPENDED):
  4254. return __ccgo_ts + 1089
  4255. case int32(_XML_ERROR_NOT_SUSPENDED):
  4256. return __ccgo_ts + 1106
  4257. case int32(_XML_ERROR_ABORTED):
  4258. return __ccgo_ts + 1127
  4259. case int32(_XML_ERROR_FINISHED):
  4260. return __ccgo_ts + 1143
  4261. case int32(_XML_ERROR_SUSPEND_PE):
  4262. return __ccgo_ts + 1160
  4263. /* Added in 2.0.0. */
  4264. fallthrough
  4265. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4266. return __ccgo_ts + 1204
  4267. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4268. return __ccgo_ts + 1284
  4269. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4270. return __ccgo_ts + 1343
  4271. /* Added in 2.2.5. */
  4272. fallthrough
  4273. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4274. return __ccgo_ts + 1407
  4275. /* Added in 2.3.0. */
  4276. fallthrough
  4277. case int32(_XML_ERROR_NO_BUFFER):
  4278. return __ccgo_ts + 1424
  4279. /* Added in 2.4.0. */
  4280. fallthrough
  4281. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4282. return __ccgo_ts + 1486
  4283. }
  4284. return libc.UintptrFromInt32(0)
  4285. }
  4286. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4287. /* V1 is used to string-ize the version number. However, it would
  4288. string-ize the actual version macro *names* unless we get them
  4289. substituted before being passed to V1. CPP is defined to expand
  4290. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4291. the version macros, then CPP will expand the resulting V1() macro
  4292. with the correct numerals. */
  4293. /* ### I'm assuming cpp is portable in this respect... */
  4294. return __ccgo_ts + 1555
  4295. }
  4296. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4297. var version TXML_Expat_Version
  4298. _ = version
  4299. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4300. version.Fminor = int32(m_XML_MINOR_VERSION)
  4301. version.Fmicro = m_XML_MICRO_VERSION
  4302. return version
  4303. }
  4304. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4305. return uintptr(unsafe.Pointer(&_features))
  4306. }
  4307. var _features = [8]TXML_Feature{
  4308. 0: {
  4309. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4310. Fname: __ccgo_ts + 1567,
  4311. Fvalue: int64(1),
  4312. },
  4313. 1: {
  4314. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4315. Fname: __ccgo_ts + 1584,
  4316. Fvalue: int64(1),
  4317. },
  4318. 2: {
  4319. Ffeature: int32(_XML_FEATURE_DTD),
  4320. Fname: __ccgo_ts + 1602,
  4321. },
  4322. 3: {
  4323. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4324. Fname: __ccgo_ts + 1610,
  4325. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4326. },
  4327. 4: {
  4328. Ffeature: int32(_XML_FEATURE_NS),
  4329. Fname: __ccgo_ts + 1628,
  4330. },
  4331. 5: {
  4332. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4333. Fname: __ccgo_ts + 1635,
  4334. Fvalue: libc.Int64FromFloat32(100),
  4335. },
  4336. 6: {
  4337. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4338. Fname: __ccgo_ts + 1652,
  4339. Fvalue: int64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4340. },
  4341. 7: {},
  4342. }
  4343. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4344. bp := tls.Alloc(16)
  4345. defer tls.Free(16)
  4346. var v1 uint32
  4347. var v3 bool
  4348. var _ /* __u at bp+0 */ struct {
  4349. F__i [0]uint32
  4350. F__f float32
  4351. }
  4352. _, _ = v1, v3
  4353. if v3 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v3 {
  4354. *(*float32)(unsafe.Pointer(bp)) = maximumAmplificationFactor
  4355. v1 = *(*uint32)(unsafe.Pointer(bp))
  4356. goto _2
  4357. _2:
  4358. }
  4359. if v3 || libc.BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4360. return libc.Uint8FromInt32(0)
  4361. }
  4362. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4363. return libc.Uint8FromInt32(1)
  4364. }
  4365. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4366. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4367. return libc.Uint8FromInt32(0)
  4368. }
  4369. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4370. return libc.Uint8FromInt32(1)
  4371. }
  4372. // C documentation
  4373. //
  4374. // /* Initially tag->rawName always points into the parse buffer;
  4375. // for those TAG instances opened while the current parse buffer was
  4376. // processed, and not yet closed, we need to store tag->rawName in a more
  4377. // permanent location, since the parse buffer is about to be discarded.
  4378. // */
  4379. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4380. var bufSize, nameLen int32
  4381. var rawNameBuf, tag, temp uintptr
  4382. var rawNameLen Tsize_t
  4383. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4384. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4385. for tag != 0 {
  4386. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4387. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4388. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4389. at the first entry that has already been copied; everything
  4390. below it in the stack is already been accounted for in a
  4391. previous call to this function.
  4392. */
  4393. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4394. break
  4395. }
  4396. /* For re-use purposes we need to ensure that the
  4397. size of tag->buf is a multiple of sizeof(XML_Char).
  4398. */
  4399. rawNameLen = (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  4400. /* Detect and prevent integer overflow. */
  4401. if rawNameLen > libc.Uint64FromInt32(m_INT_MAX)-libc.Uint64FromInt32(nameLen) {
  4402. return libc.Uint8FromInt32(0)
  4403. }
  4404. bufSize = nameLen + libc.Int32FromUint64(rawNameLen)
  4405. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4406. 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))
  4407. if temp == libc.UintptrFromInt32(0) {
  4408. return libc.Uint8FromInt32(0)
  4409. }
  4410. /* if tag->name.str points to tag->buf (only when namespace
  4411. processing is off) then we have to update it
  4412. */
  4413. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4414. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4415. }
  4416. /* if tag->name.localPart is set (when namespace processing is on)
  4417. then update it as well, since it will always point into tag->buf
  4418. */
  4419. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4420. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4421. }
  4422. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4423. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4424. rawNameBuf = temp + uintptr(nameLen)
  4425. }
  4426. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4427. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4428. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4429. }
  4430. return libc.Uint8FromInt32(1)
  4431. }
  4432. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4433. var result _XML_Error
  4434. _ = result
  4435. 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))
  4436. if result == int32(_XML_ERROR_NONE) {
  4437. if !(_storeRawNames(tls, parser) != 0) {
  4438. return int32(_XML_ERROR_NO_MEMORY)
  4439. }
  4440. }
  4441. return result
  4442. }
  4443. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4444. var result _XML_Error
  4445. _ = result
  4446. result = _initializeEncoding(tls, parser)
  4447. if result != int32(_XML_ERROR_NONE) {
  4448. return result
  4449. }
  4450. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4451. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4452. }
  4453. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4454. bp := tls.Alloc(16)
  4455. defer tls.Free(16)
  4456. var tok int32
  4457. var _ /* next at bp+0 */ uintptr
  4458. _ = tok
  4459. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4460. 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)
  4461. switch tok {
  4462. case int32(m_XML_TOK_BOM):
  4463. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4464. _accountingOnAbort(tls, parser)
  4465. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4466. }
  4467. /* If we are at the end of the buffer, this would cause the next stage,
  4468. i.e. externalEntityInitProcessor3, to pass control directly to
  4469. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4470. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4471. */
  4472. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4473. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4474. return int32(_XML_ERROR_NONE)
  4475. }
  4476. start = *(*uintptr)(unsafe.Pointer(bp))
  4477. case -int32(1):
  4478. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4479. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4480. return int32(_XML_ERROR_NONE)
  4481. }
  4482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4483. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4484. case -int32(2):
  4485. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4486. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4487. return int32(_XML_ERROR_NONE)
  4488. }
  4489. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4490. return int32(_XML_ERROR_PARTIAL_CHAR)
  4491. }
  4492. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4493. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4494. }
  4495. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4496. bp := tls.Alloc(16)
  4497. defer tls.Free(16)
  4498. var result _XML_Error
  4499. var tok int32
  4500. var _ /* next at bp+0 */ uintptr
  4501. _, _ = result, tok
  4502. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4503. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4504. 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)
  4505. /* Note: These bytes are accounted later in:
  4506. - processXmlDecl
  4507. - externalEntityContentProcessor
  4508. */
  4509. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4510. switch tok {
  4511. case int32(m_XML_TOK_XML_DECL):
  4512. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4513. if result != int32(_XML_ERROR_NONE) {
  4514. return result
  4515. }
  4516. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4517. case int32(_XML_SUSPENDED):
  4518. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4519. return int32(_XML_ERROR_NONE)
  4520. case int32(_XML_FINISHED):
  4521. return int32(_XML_ERROR_ABORTED)
  4522. default:
  4523. start = *(*uintptr)(unsafe.Pointer(bp))
  4524. }
  4525. case -int32(1):
  4526. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4527. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4528. return int32(_XML_ERROR_NONE)
  4529. }
  4530. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4531. case -int32(2):
  4532. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4533. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4534. return int32(_XML_ERROR_NONE)
  4535. }
  4536. return int32(_XML_ERROR_PARTIAL_CHAR)
  4537. }
  4538. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4539. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4540. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4541. }
  4542. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4543. var result _XML_Error
  4544. _ = result
  4545. 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))
  4546. if result == int32(_XML_ERROR_NONE) {
  4547. if !(_storeRawNames(tls, parser) != 0) {
  4548. return int32(_XML_ERROR_NO_MEMORY)
  4549. }
  4550. }
  4551. return result
  4552. }
  4553. 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) {
  4554. bp := tls.Alloc(112)
  4555. defer tls.Free(112)
  4556. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4557. 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
  4558. var bufSize, convLen, len1, n, tok int32
  4559. var charDataHandler TXML_CharacterDataHandler
  4560. var convert_res, convert_res1 _XML_Convert_Result
  4561. var noElmHandlers TXML_Bool
  4562. var result, result1, result2, result3 _XML_Error
  4563. var _ /* bindings at bp+40 */ uintptr
  4564. var _ /* buf at bp+88 */ [4]TXML_Char
  4565. var _ /* c at bp+16 */ TXML_Char
  4566. var _ /* c at bp+92 */ TXML_Char
  4567. var _ /* ch at bp+17 */ TXML_Char
  4568. var _ /* dataPtr at bp+104 */ uintptr
  4569. var _ /* dataPtr at bp+96 */ uintptr
  4570. var _ /* fromPtr at bp+32 */ uintptr
  4571. var _ /* name at bp+48 */ TTAG_NAME
  4572. var _ /* next at bp+8 */ uintptr
  4573. var _ /* toPtr at bp+24 */ uintptr
  4574. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4575. /* save one level of indirection */
  4576. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4577. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4578. eventPP = parser + 544
  4579. eventEndPP = parser + 552
  4580. } else {
  4581. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4582. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4583. }
  4584. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4585. for {
  4586. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* 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(enc + 1*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  4588. if tok == -int32(5) || tok == -int32(3) {
  4589. if haveMore != 0 {
  4590. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4591. } else {
  4592. v3 = end
  4593. }
  4594. v2 = v3
  4595. } else {
  4596. v2 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4597. }
  4598. accountAfter = v2
  4599. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4600. _accountingOnAbort(tls, parser)
  4601. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4602. }
  4603. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4604. switch tok {
  4605. case -int32(3):
  4606. if haveMore != 0 {
  4607. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4608. return int32(_XML_ERROR_NONE)
  4609. }
  4610. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4611. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4612. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  4613. (*(*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))
  4614. } else {
  4615. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4616. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4617. }
  4618. }
  4619. /* We are at the end of the final buffer, should we check for
  4620. XML_SUSPENDED, XML_FINISHED?
  4621. */
  4622. if startTagLevel == 0 {
  4623. return int32(_XML_ERROR_NO_ELEMENTS)
  4624. }
  4625. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4626. return int32(_XML_ERROR_ASYNC_ENTITY)
  4627. }
  4628. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4629. return int32(_XML_ERROR_NONE)
  4630. case -int32(4):
  4631. if haveMore != 0 {
  4632. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4633. return int32(_XML_ERROR_NONE)
  4634. }
  4635. if startTagLevel > 0 {
  4636. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4637. return int32(_XML_ERROR_ASYNC_ENTITY)
  4638. }
  4639. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4640. return int32(_XML_ERROR_NONE)
  4641. }
  4642. return int32(_XML_ERROR_NO_ELEMENTS)
  4643. case m_XML_TOK_INVALID:
  4644. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4645. return int32(_XML_ERROR_INVALID_TOKEN)
  4646. case -int32(1):
  4647. if haveMore != 0 {
  4648. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4649. return int32(_XML_ERROR_NONE)
  4650. }
  4651. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4652. case -int32(2):
  4653. if haveMore != 0 {
  4654. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4655. return int32(_XML_ERROR_NONE)
  4656. }
  4657. return int32(_XML_ERROR_PARTIAL_CHAR)
  4658. case int32(m_XML_TOK_ENTITY_REF):
  4659. *(*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)))
  4660. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4661. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4662. * so there is no amplification and hence recording without
  4663. * protection. */
  4664. _accountingDiffTolerated(tls, parser, tok, bp+17, bp+17+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4665. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4666. (*(*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))
  4667. } else {
  4668. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4669. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4670. }
  4671. }
  4672. break
  4673. }
  4674. 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))
  4675. if !(name != 0) {
  4676. return int32(_XML_ERROR_NO_MEMORY)
  4677. }
  4678. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4679. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4680. /* First, determine if a check for an existing declaration is needed;
  4681. if yes, check that the entity exists, and that it is internal,
  4682. otherwise call the skipped entity or default handler.
  4683. */
  4684. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4685. if !(entity != 0) {
  4686. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4687. } else {
  4688. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4689. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4690. }
  4691. }
  4692. } else {
  4693. if !(entity != 0) {
  4694. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4695. (*(*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)
  4696. } else {
  4697. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4698. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4699. }
  4700. }
  4701. break
  4702. }
  4703. }
  4704. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4705. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4706. }
  4707. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4708. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4709. }
  4710. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4711. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4712. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4713. (*(*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)
  4714. } else {
  4715. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4716. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4717. }
  4718. }
  4719. break
  4720. }
  4721. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4722. if result != int32(_XML_ERROR_NONE) {
  4723. return result
  4724. }
  4725. } else {
  4726. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4727. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4728. context = _getContext(tls, parser)
  4729. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4730. if !(context != 0) {
  4731. return int32(_XML_ERROR_NO_MEMORY)
  4732. }
  4733. 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) {
  4734. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4735. }
  4736. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4737. } else {
  4738. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4739. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4740. }
  4741. }
  4742. }
  4743. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4744. /* fall through */
  4745. fallthrough
  4746. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4747. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4748. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4749. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4750. } else {
  4751. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4752. if !(tag != 0) {
  4753. return int32(_XML_ERROR_NO_MEMORY)
  4754. }
  4755. (*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)))
  4756. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4757. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4758. return int32(_XML_ERROR_NO_MEMORY)
  4759. }
  4760. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4761. }
  4762. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4763. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4764. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4765. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4766. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4767. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4768. (*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)
  4769. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4770. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4771. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4772. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4773. for {
  4774. 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))
  4775. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4776. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4777. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4778. break
  4779. }
  4780. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4781. 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))
  4782. if temp == libc.UintptrFromInt32(0) {
  4783. return int32(_XML_ERROR_NO_MEMORY)
  4784. }
  4785. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4786. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4787. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4788. goto _4
  4789. _4:
  4790. }
  4791. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4792. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = int8('\000')
  4793. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80, account)
  4794. if result1 != 0 {
  4795. return result1
  4796. }
  4797. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4798. (*(*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)
  4799. } else {
  4800. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4801. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4802. }
  4803. }
  4804. _poolClear(tls, parser+784)
  4805. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4806. /* fall through */
  4807. fallthrough
  4808. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4809. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4810. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4811. noElmHandlers = libc.Uint8FromInt32(1)
  4812. (*(*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)))
  4813. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4814. return int32(_XML_ERROR_NO_MEMORY)
  4815. }
  4816. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4817. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40, int32(_XML_ACCOUNT_NONE))
  4818. if result2 != int32(_XML_ERROR_NONE) {
  4819. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4820. return result2
  4821. }
  4822. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4823. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4824. (*(*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)
  4825. noElmHandlers = libc.Uint8FromInt32(0)
  4826. }
  4827. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4828. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4829. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4830. }
  4831. (*(*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)
  4832. noElmHandlers = libc.Uint8FromInt32(0)
  4833. }
  4834. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4835. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4836. }
  4837. _poolClear(tls, parser+784)
  4838. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4839. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4840. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4841. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4842. } else {
  4843. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4844. }
  4845. }
  4846. case int32(m_XML_TOK_END_TAG):
  4847. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4848. return int32(_XML_ERROR_ASYNC_ENTITY)
  4849. } else {
  4850. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4851. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4852. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4853. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4854. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4855. return int32(_XML_ERROR_TAG_MISMATCH)
  4856. }
  4857. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4858. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4859. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4860. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4861. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4862. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4863. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4864. /* localPart and prefix may have been overwritten in
  4865. tag->name.str, since this points to the binding->uri
  4866. buffer which gets re-used; so we have to add them again
  4867. */
  4868. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4869. /* don't need to check for space - already done in storeAtts() */
  4870. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4871. v5 = uri
  4872. uri++
  4873. v6 = localPart
  4874. localPart++
  4875. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  4876. }
  4877. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4878. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4879. v7 = uri
  4880. uri++
  4881. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4882. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4883. v8 = uri
  4884. uri++
  4885. v9 = prefix
  4886. prefix++
  4887. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  4888. }
  4889. }
  4890. *(*TXML_Char)(unsafe.Pointer(uri)) = int8('\000')
  4891. }
  4892. (*(*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)
  4893. } else {
  4894. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4895. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4896. }
  4897. }
  4898. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4899. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4900. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4901. (*(*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)
  4902. }
  4903. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4904. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4905. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4906. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4907. }
  4908. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4909. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4910. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4911. } else {
  4912. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4913. }
  4914. }
  4915. }
  4916. case int32(m_XML_TOK_CHAR_REF):
  4917. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4918. if n < 0 {
  4919. return int32(_XML_ERROR_BAD_CHAR_REF)
  4920. }
  4921. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4922. (*(*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))
  4923. } else {
  4924. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4925. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4926. }
  4927. }
  4928. case int32(m_XML_TOK_XML_DECL):
  4929. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4930. case int32(m_XML_TOK_DATA_NEWLINE):
  4931. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4932. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = int8(0xA)
  4933. (*(*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))
  4934. } else {
  4935. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4936. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4937. }
  4938. }
  4939. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4940. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4941. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4942. } else {
  4943. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4944. (*(*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)
  4945. } else {
  4946. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4947. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4948. }
  4949. }
  4950. }
  4951. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore, account)
  4952. if result3 != int32(_XML_ERROR_NONE) {
  4953. return result3
  4954. } else {
  4955. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  4956. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4957. return result3
  4958. }
  4959. }
  4960. case -int32(5):
  4961. if haveMore != 0 {
  4962. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4963. return int32(_XML_ERROR_NONE)
  4964. }
  4965. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4966. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4967. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4968. (*(*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)
  4969. (*(*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)))
  4970. } else {
  4971. (*(*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)))))
  4972. }
  4973. } else {
  4974. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4975. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4976. }
  4977. }
  4978. /* We are at the end of the final buffer, should we check for
  4979. XML_SUSPENDED, XML_FINISHED?
  4980. */
  4981. if startTagLevel == 0 {
  4982. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4983. return int32(_XML_ERROR_NO_ELEMENTS)
  4984. }
  4985. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4986. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4987. return int32(_XML_ERROR_ASYNC_ENTITY)
  4988. }
  4989. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4990. return int32(_XML_ERROR_NONE)
  4991. case int32(m_XML_TOK_DATA_CHARS):
  4992. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4993. if charDataHandler != 0 {
  4994. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4995. for {
  4996. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4997. 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)
  4998. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4999. (*(*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)))
  5000. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  5001. break
  5002. }
  5003. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5004. goto _10
  5005. _10:
  5006. }
  5007. } else {
  5008. (*(*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)))))
  5009. }
  5010. } else {
  5011. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5012. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5013. }
  5014. }
  5015. case int32(m_XML_TOK_PI):
  5016. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  5017. return int32(_XML_ERROR_NO_MEMORY)
  5018. }
  5019. case int32(m_XML_TOK_COMMENT):
  5020. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  5021. return int32(_XML_ERROR_NO_MEMORY)
  5022. }
  5023. default:
  5024. /* All of the tokens produced by XmlContentTok() have their own
  5025. * explicit cases, so this default is not strictly necessary.
  5026. * However it is a useful safety net, so we retain the code and
  5027. * simply exclude it from the coverage tests.
  5028. *
  5029. * LCOV_EXCL_START
  5030. */
  5031. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5032. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5033. }
  5034. break
  5035. /* LCOV_EXCL_STOP */
  5036. }
  5037. v11 = *(*uintptr)(unsafe.Pointer(bp + 8))
  5038. *(*uintptr)(unsafe.Pointer(bp)) = v11
  5039. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  5040. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5041. case int32(_XML_SUSPENDED):
  5042. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5043. return int32(_XML_ERROR_NONE)
  5044. case int32(_XML_FINISHED):
  5045. return int32(_XML_ERROR_ABORTED)
  5046. default:
  5047. }
  5048. goto _1
  5049. _1:
  5050. }
  5051. /* not reached */
  5052. return r
  5053. }
  5054. // C documentation
  5055. //
  5056. // /* This function does not call free() on the allocated memory, merely
  5057. // * moving it to the parser's m_freeBindingList where it can be freed or
  5058. // * reused as appropriate.
  5059. // */
  5060. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  5061. var b uintptr
  5062. _ = b
  5063. for bindings != 0 {
  5064. b = bindings
  5065. /* m_startNamespaceDeclHandler will have been called for this
  5066. * binding in addBindings(), so call the end handler now.
  5067. */
  5068. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  5069. (*(*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)
  5070. }
  5071. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  5072. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  5074. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  5075. }
  5076. }
  5077. // C documentation
  5078. //
  5079. // /* Precondition: all arguments must be non-NULL;
  5080. // Purpose:
  5081. // - normalize attributes
  5082. // - check attributes for well-formedness
  5083. // - generate namespace aware attribute names (URI, prefix)
  5084. // - build list of attributes for startElementHandler
  5085. // - default attributes
  5086. // - process namespace declarations (check and report them)
  5087. // - generate namespace aware element name (URI, prefix)
  5088. // */
  5089. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  5090. bp := tls.Alloc(80)
  5091. defer tls.Free(80)
  5092. 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
  5093. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  5094. var c TXML_Char
  5095. var isCdata TXML_Bool
  5096. var mask, uriHash, version, v14 uint64
  5097. var nsAttsSize uint32
  5098. var oldNsAttsPower, step, v10 uint8
  5099. var result, result1, result2 _XML_Error
  5100. var _ /* sip_key at bp+56 */ Tsipkey
  5101. var _ /* sip_state at bp+0 */ Tsiphash
  5102. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5103. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5104. attIndex = 0
  5105. nPrefixes = 0
  5106. /* lookup the element type name */
  5107. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  5108. if !(elementType != 0) {
  5109. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5110. if !(name != 0) {
  5111. return int32(_XML_ERROR_NO_MEMORY)
  5112. }
  5113. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  5114. if !(elementType != 0) {
  5115. return int32(_XML_ERROR_NO_MEMORY)
  5116. }
  5117. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5118. return int32(_XML_ERROR_NO_MEMORY)
  5119. }
  5120. }
  5121. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5122. /* get the attributes from the tokenizer */
  5123. 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)
  5124. /* Detect and prevent integer overflow */
  5125. if n > int32(m_INT_MAX)-nDefaultAtts {
  5126. return int32(_XML_ERROR_NO_MEMORY)
  5127. }
  5128. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5129. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5130. /* Detect and prevent integer overflow */
  5131. if nDefaultAtts > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m_INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5132. return int32(_XML_ERROR_NO_MEMORY)
  5133. }
  5134. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5135. /* Detect and prevent integer overflow.
  5136. * The preprocessor guard addresses the "always false" warning
  5137. * from -Wtype-limits on platforms where
  5138. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5139. 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))
  5140. if temp == libc.UintptrFromInt32(0) {
  5141. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5142. return int32(_XML_ERROR_NO_MEMORY)
  5143. }
  5144. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5145. if n > oldAttsSize {
  5146. (*(*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)
  5147. }
  5148. }
  5149. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5150. i = 0
  5151. for {
  5152. if !(i < n) {
  5153. break
  5154. }
  5155. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  5156. /* add the name and value to the attribute list */
  5157. 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)))
  5158. if !(attId != 0) {
  5159. return int32(_XML_ERROR_NO_MEMORY)
  5160. }
  5161. /* Detect duplicate attributes by their QNames. This does not work when
  5162. namespace processing is turned on and different prefixes for the same
  5163. namespace are used. For this case we have a check further down.
  5164. */
  5165. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5166. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5167. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  5168. }
  5169. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5170. }
  5171. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5172. v2 = attIndex
  5173. attIndex++
  5174. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5175. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  5176. isCdata = libc.Uint8FromInt32(1)
  5177. /* figure out whether declared as other than CDATA */
  5178. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5179. j = 0
  5180. for {
  5181. if !(j < nDefaultAtts) {
  5182. break
  5183. }
  5184. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  5185. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  5186. break
  5187. }
  5188. goto _3
  5189. _3:
  5190. ;
  5191. j++
  5192. }
  5193. }
  5194. /* normalize the attribute value */
  5195. 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)
  5196. if result != 0 {
  5197. return result
  5198. }
  5199. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5200. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5201. } else {
  5202. /* the value did not need normalizing */
  5203. *(*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)
  5204. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  5205. return int32(_XML_ERROR_NO_MEMORY)
  5206. }
  5207. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5208. }
  5209. /* handle prefixed attribute names */
  5210. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5211. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5212. /* deal with namespace declarations here */
  5213. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  5214. if result1 != 0 {
  5215. return result1
  5216. }
  5217. attIndex--
  5218. } else {
  5219. /* deal with other prefixed names later */
  5220. attIndex++
  5221. nPrefixes++
  5222. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5223. }
  5224. } else {
  5225. attIndex++
  5226. }
  5227. goto _1
  5228. _1:
  5229. ;
  5230. i++
  5231. }
  5232. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5233. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5234. 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 {
  5235. i = 0
  5236. for {
  5237. if !(i < attIndex) {
  5238. break
  5239. }
  5240. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5241. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5242. break
  5243. }
  5244. goto _4
  5245. _4:
  5246. ;
  5247. i += int32(2)
  5248. }
  5249. } else {
  5250. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5251. }
  5252. /* do attribute defaulting */
  5253. i = 0
  5254. for {
  5255. if !(i < nDefaultAtts) {
  5256. break
  5257. }
  5258. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5259. 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 {
  5260. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5261. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5262. 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)
  5263. if result2 != 0 {
  5264. return result2
  5265. }
  5266. } else {
  5267. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5268. nPrefixes++
  5269. v6 = attIndex
  5270. attIndex++
  5271. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5272. v7 = attIndex
  5273. attIndex++
  5274. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5275. }
  5276. } else {
  5277. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5278. v8 = attIndex
  5279. attIndex++
  5280. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5281. v9 = attIndex
  5282. attIndex++
  5283. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5284. }
  5285. }
  5286. goto _5
  5287. _5:
  5288. ;
  5289. i++
  5290. }
  5291. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5292. /* expand prefixed attribute names, check for duplicates,
  5293. and clear flags that say whether attributes were specified */
  5294. i = 0
  5295. if nPrefixes != 0 { /* hash table index */
  5296. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5297. /* Detect and prevent invalid shift */
  5298. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5299. return int32(_XML_ERROR_NO_MEMORY)
  5300. }
  5301. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5302. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5303. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5304. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5305. /* hash table size must also be a power of 2 and >= 8 */
  5306. for {
  5307. v11 = parser + 760
  5308. v10 = *(*uint8)(unsafe.Pointer(v11))
  5309. *(*uint8)(unsafe.Pointer(v11))++
  5310. if !(nPrefixes>>v10 != 0) {
  5311. break
  5312. }
  5313. }
  5314. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5315. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5316. }
  5317. /* Detect and prevent invalid shift */
  5318. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5319. /* Restore actual size of memory in m_nsAtts */
  5320. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5321. return int32(_XML_ERROR_NO_MEMORY)
  5322. }
  5323. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5324. /* Detect and prevent integer overflow.
  5325. * The preprocessor guard addresses the "always false" warning
  5326. * from -Wtype-limits on platforms where
  5327. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5328. 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))
  5329. if !(temp1 != 0) {
  5330. /* Restore actual size of memory in m_nsAtts */
  5331. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5332. return int32(_XML_ERROR_NO_MEMORY)
  5333. }
  5334. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5335. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5336. }
  5337. /* using a version flag saves us from initializing m_nsAtts every time */
  5338. if !(version != 0) { /* initialize version flags when version wraps around */
  5339. version = uint64(m_INIT_ATTS_VERSION)
  5340. j1 = libc.Int32FromUint32(nsAttsSize)
  5341. for {
  5342. if !(j1 != 0) {
  5343. break
  5344. }
  5345. j1--
  5346. v13 = j1
  5347. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5348. goto _12
  5349. _12:
  5350. }
  5351. }
  5352. version--
  5353. v14 = version
  5354. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5355. /* expand prefixed names and check for duplicates */
  5356. for {
  5357. if !(i < attIndex) {
  5358. break
  5359. }
  5360. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5361. if int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5362. _copy_salt_to_sipkey(tls, parser, bp+56)
  5363. _sip24_init(tls, bp, bp+56)
  5364. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0 /* clear flag */
  5365. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5366. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5367. /* This code is walking through the appAtts array, dealing
  5368. * with (in this case) a prefixed attribute name. To be in
  5369. * the array, the attribute must have already been bound, so
  5370. * has to have passed through the hash table lookup once
  5371. * already. That implies that an entry for it already
  5372. * exists, so the lookup above will return a pointer to
  5373. * already allocated memory. There is no opportunaity for
  5374. * the allocator to fail, so the condition above cannot be
  5375. * fulfilled.
  5376. *
  5377. * Since it is difficult to be certain that the above
  5378. * analysis is complete, we retain the test and merely
  5379. * remove the code from coverage tests.
  5380. */
  5381. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5382. }
  5383. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5384. if !(b != 0) {
  5385. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5386. }
  5387. j1 = 0
  5388. for {
  5389. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5390. break
  5391. }
  5392. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5393. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5394. v17 = 0
  5395. } else {
  5396. v19 = parser + 784 + 24
  5397. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5398. *(*uintptr)(unsafe.Pointer(v19))++
  5399. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5400. v17 = libc.Int32FromInt32(1)
  5401. }
  5402. if !(v17 != 0) {
  5403. return int32(_XML_ERROR_NO_MEMORY)
  5404. }
  5405. goto _16
  5406. _16:
  5407. ;
  5408. j1++
  5409. }
  5410. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5411. for {
  5412. v20 = s
  5413. s++
  5414. if !(int32(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5415. break
  5416. }
  5417. }
  5418. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5419. for { /* copies null terminator */
  5420. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5421. v23 = 0
  5422. } else {
  5423. v25 = parser + 784 + 24
  5424. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5425. *(*uintptr)(unsafe.Pointer(v25))++
  5426. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5427. v23 = libc.Int32FromInt32(1)
  5428. }
  5429. if !(v23 != 0) {
  5430. return int32(_XML_ERROR_NO_MEMORY)
  5431. }
  5432. goto _22
  5433. _22:
  5434. ;
  5435. v21 = s
  5436. s++
  5437. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5438. break
  5439. }
  5440. }
  5441. uriHash = _sip24_final(tls, bp)
  5442. /* Check hash table for duplicate of expanded name (uriName).
  5443. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5444. */
  5445. step = uint8(0)
  5446. mask = uint64(nsAttsSize - uint32(1))
  5447. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5448. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5449. /* for speed we compare stored hash values first */
  5450. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5451. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5452. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5453. /* s1 is null terminated, but not s2 */
  5454. for {
  5455. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2))) && int32(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5456. break
  5457. }
  5458. goto _26
  5459. _26:
  5460. ;
  5461. s1++
  5462. s2++
  5463. }
  5464. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5465. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5466. }
  5467. }
  5468. if !(step != 0) {
  5469. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5470. }
  5471. if j1 < libc.Int32FromUint8(step) {
  5472. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5473. } else {
  5474. j1 -= libc.Int32FromUint8(step)
  5475. }
  5476. }
  5477. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5478. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5479. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5480. for {
  5481. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5482. v30 = 0
  5483. } else {
  5484. v32 = parser + 784 + 24
  5485. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5486. *(*uintptr)(unsafe.Pointer(v32))++
  5487. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5488. v30 = libc.Int32FromInt32(1)
  5489. }
  5490. if !(v30 != 0) {
  5491. return int32(_XML_ERROR_NO_MEMORY)
  5492. }
  5493. goto _29
  5494. _29:
  5495. ;
  5496. v28 = s
  5497. s++
  5498. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5499. break
  5500. }
  5501. }
  5502. }
  5503. /* store expanded name in attribute list */
  5504. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5505. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5506. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5507. /* fill empty slot with new version, uriName and hash value */
  5508. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5509. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5510. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5511. nPrefixes--
  5512. v33 = nPrefixes
  5513. if !(v33 != 0) {
  5514. i += int32(2)
  5515. break
  5516. }
  5517. } else { /* not prefixed */
  5518. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0
  5519. } /* clear flag */
  5520. goto _15
  5521. _15:
  5522. ;
  5523. i += int32(2)
  5524. }
  5525. }
  5526. /* clear flags for the remaining attributes */
  5527. for {
  5528. if !(i < attIndex) {
  5529. break
  5530. }
  5531. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = 0
  5532. goto _34
  5533. _34:
  5534. ;
  5535. i += int32(2)
  5536. }
  5537. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5538. for {
  5539. if !(binding != 0) {
  5540. break
  5541. }
  5542. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = 0
  5543. goto _35
  5544. _35:
  5545. ;
  5546. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5547. }
  5548. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5549. return int32(_XML_ERROR_NONE)
  5550. }
  5551. /* expand the element type name */
  5552. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5553. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5554. if !(binding != 0) {
  5555. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5556. }
  5557. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5558. for {
  5559. v36 = localPart
  5560. localPart++
  5561. if !(int32(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5562. break
  5563. }
  5564. }
  5565. } else {
  5566. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5567. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5568. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5569. } else {
  5570. return int32(_XML_ERROR_NONE)
  5571. }
  5572. }
  5573. prefixLen = 0
  5574. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5575. for {
  5576. v38 = prefixLen
  5577. prefixLen++
  5578. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5579. break
  5580. }
  5581. goto _37
  5582. _37:
  5583. } /* prefixLen includes null terminator */
  5584. }
  5585. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5586. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5587. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5588. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5589. i = 0
  5590. for {
  5591. v40 = i
  5592. i++
  5593. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5594. break
  5595. }
  5596. goto _39
  5597. _39:
  5598. } /* i includes null terminator */
  5599. /* Detect and prevent integer overflow */
  5600. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m_INT_MAX)-prefixLen || i > int32(m_INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5601. return int32(_XML_ERROR_NO_MEMORY)
  5602. }
  5603. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5604. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5605. /* Detect and prevent integer overflow */
  5606. if n > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5607. return int32(_XML_ERROR_NO_MEMORY)
  5608. }
  5609. /* Detect and prevent integer overflow.
  5610. * The preprocessor guard addresses the "always false" warning
  5611. * from -Wtype-limits on platforms where
  5612. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5613. 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))
  5614. if !(uri != 0) {
  5615. return int32(_XML_ERROR_NO_MEMORY)
  5616. }
  5617. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5618. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5619. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5620. for {
  5621. if !(p != 0) {
  5622. break
  5623. }
  5624. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5625. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5626. }
  5627. goto _41
  5628. _41:
  5629. ;
  5630. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5631. }
  5632. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5633. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5634. }
  5635. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5636. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5637. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5638. /* we always have a namespace separator between localPart and prefix */
  5639. if prefixLen != 0 {
  5640. uri += uintptr(i - int32(1))
  5641. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5642. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5643. }
  5644. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5645. return int32(_XML_ERROR_NONE)
  5646. }
  5647. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5648. // For the RFC 3986 ANBF grammar see
  5649. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5650. switch int32(candidate) {
  5651. // From rule "ALPHA" (uppercase half)
  5652. case int32('A'):
  5653. fallthrough
  5654. case int32('B'):
  5655. fallthrough
  5656. case int32('C'):
  5657. fallthrough
  5658. case int32('D'):
  5659. fallthrough
  5660. case int32('E'):
  5661. fallthrough
  5662. case int32('F'):
  5663. fallthrough
  5664. case int32('G'):
  5665. fallthrough
  5666. case int32('H'):
  5667. fallthrough
  5668. case int32('I'):
  5669. fallthrough
  5670. case int32('J'):
  5671. fallthrough
  5672. case int32('K'):
  5673. fallthrough
  5674. case int32('L'):
  5675. fallthrough
  5676. case int32('M'):
  5677. fallthrough
  5678. case int32('N'):
  5679. fallthrough
  5680. case int32('O'):
  5681. fallthrough
  5682. case int32('P'):
  5683. fallthrough
  5684. case int32('Q'):
  5685. fallthrough
  5686. case int32('R'):
  5687. fallthrough
  5688. case int32('S'):
  5689. fallthrough
  5690. case int32('T'):
  5691. fallthrough
  5692. case int32('U'):
  5693. fallthrough
  5694. case int32('V'):
  5695. fallthrough
  5696. case int32('W'):
  5697. fallthrough
  5698. case int32('X'):
  5699. fallthrough
  5700. case int32('Y'):
  5701. fallthrough
  5702. case int32('Z'):
  5703. // From rule "ALPHA" (lowercase half)
  5704. fallthrough
  5705. case int32('a'):
  5706. fallthrough
  5707. case int32('b'):
  5708. fallthrough
  5709. case int32('c'):
  5710. fallthrough
  5711. case int32('d'):
  5712. fallthrough
  5713. case int32('e'):
  5714. fallthrough
  5715. case int32('f'):
  5716. fallthrough
  5717. case int32('g'):
  5718. fallthrough
  5719. case int32('h'):
  5720. fallthrough
  5721. case int32('i'):
  5722. fallthrough
  5723. case int32('j'):
  5724. fallthrough
  5725. case int32('k'):
  5726. fallthrough
  5727. case int32('l'):
  5728. fallthrough
  5729. case int32('m'):
  5730. fallthrough
  5731. case int32('n'):
  5732. fallthrough
  5733. case int32('o'):
  5734. fallthrough
  5735. case int32('p'):
  5736. fallthrough
  5737. case int32('q'):
  5738. fallthrough
  5739. case int32('r'):
  5740. fallthrough
  5741. case int32('s'):
  5742. fallthrough
  5743. case int32('t'):
  5744. fallthrough
  5745. case int32('u'):
  5746. fallthrough
  5747. case int32('v'):
  5748. fallthrough
  5749. case int32('w'):
  5750. fallthrough
  5751. case int32('x'):
  5752. fallthrough
  5753. case int32('y'):
  5754. fallthrough
  5755. case int32('z'):
  5756. // From rule "DIGIT"
  5757. fallthrough
  5758. case int32('0'):
  5759. fallthrough
  5760. case int32('1'):
  5761. fallthrough
  5762. case int32('2'):
  5763. fallthrough
  5764. case int32('3'):
  5765. fallthrough
  5766. case int32('4'):
  5767. fallthrough
  5768. case int32('5'):
  5769. fallthrough
  5770. case int32('6'):
  5771. fallthrough
  5772. case int32('7'):
  5773. fallthrough
  5774. case int32('8'):
  5775. fallthrough
  5776. case int32('9'):
  5777. // From rule "pct-encoded"
  5778. fallthrough
  5779. case int32('%'):
  5780. // From rule "unreserved"
  5781. fallthrough
  5782. case int32('-'):
  5783. fallthrough
  5784. case int32('.'):
  5785. fallthrough
  5786. case int32('_'):
  5787. fallthrough
  5788. case int32('~'):
  5789. // From rule "gen-delims"
  5790. fallthrough
  5791. case int32(':'):
  5792. fallthrough
  5793. case int32('/'):
  5794. fallthrough
  5795. case int32('?'):
  5796. fallthrough
  5797. case int32('#'):
  5798. fallthrough
  5799. case int32('['):
  5800. fallthrough
  5801. case int32(']'):
  5802. fallthrough
  5803. case int32('@'):
  5804. // From rule "sub-delims"
  5805. fallthrough
  5806. case int32('!'):
  5807. fallthrough
  5808. case int32('$'):
  5809. fallthrough
  5810. case int32('&'):
  5811. fallthrough
  5812. case int32('\''):
  5813. fallthrough
  5814. case int32('('):
  5815. fallthrough
  5816. case int32(')'):
  5817. fallthrough
  5818. case int32('*'):
  5819. fallthrough
  5820. case int32('+'):
  5821. fallthrough
  5822. case int32(','):
  5823. fallthrough
  5824. case int32(';'):
  5825. fallthrough
  5826. case int32('='):
  5827. return libc.Uint8FromInt32(1)
  5828. default:
  5829. return libc.Uint8FromInt32(0)
  5830. }
  5831. return r
  5832. }
  5833. // C documentation
  5834. //
  5835. // /* addBinding() overwrites the value of prefix->binding without checking.
  5836. // Therefore one must keep track of the old value outside of addBinding().
  5837. // */
  5838. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5839. var b, temp, v3 uintptr
  5840. var isXML, isXMLNS, mustBeXML TXML_Bool
  5841. var len1, v2 int32
  5842. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5843. mustBeXML = libc.Uint8FromInt32(0)
  5844. isXML = libc.Uint8FromInt32(1)
  5845. isXMLNS = libc.Uint8FromInt32(1)
  5846. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5847. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5848. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5849. }
  5850. 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) {
  5851. /* Not allowed to bind xmlns */
  5852. 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') {
  5853. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5854. }
  5855. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5856. mustBeXML = libc.Uint8FromInt32(1)
  5857. }
  5858. }
  5859. len1 = 0
  5860. for {
  5861. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5862. break
  5863. }
  5864. if isXML != 0 && (len1 > _xmlLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlNamespace[len1])) {
  5865. isXML = libc.Uint8FromInt32(0)
  5866. }
  5867. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlnsNamespace[len1])) {
  5868. isXMLNS = libc.Uint8FromInt32(0)
  5869. }
  5870. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5871. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5872. // namespaces specification) we have to at least make sure, that
  5873. // the application on top of Expat (that is likely splitting expanded
  5874. // element names ("qualified names") of form
  5875. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  5876. // in its element handler code) cannot be confused by an attacker
  5877. // putting additional namespace separator characters into namespace
  5878. // declarations. That would be ambiguous and not to be expected.
  5879. //
  5880. // While the HTML API docs of function XML_ParserCreateNS have been
  5881. // advising against use of a namespace separator character that can
  5882. // appear in a URI for >20 years now, some widespread applications
  5883. // are using URI characters (':' (colon) in particular) for a
  5884. // namespace separator, in practice. To keep these applications
  5885. // functional, we only reject namespaces URIs containing the
  5886. // application-chosen namespace separator if the chosen separator
  5887. // is a non-URI character with regard to RFC 3986.
  5888. 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) {
  5889. return int32(_XML_ERROR_SYNTAX)
  5890. }
  5891. goto _1
  5892. _1:
  5893. ;
  5894. len1++
  5895. }
  5896. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5897. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5898. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5899. if mustBeXML != 0 {
  5900. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5901. } else {
  5902. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5903. }
  5904. return v2
  5905. }
  5906. if isXMLNS != 0 {
  5907. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5908. }
  5909. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5910. len1++
  5911. }
  5912. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5913. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5914. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5915. /* Detect and prevent integer overflow */
  5916. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5917. return int32(_XML_ERROR_NO_MEMORY)
  5918. }
  5919. /* Detect and prevent integer overflow.
  5920. * The preprocessor guard addresses the "always false" warning
  5921. * from -Wtype-limits on platforms where
  5922. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5923. 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)))
  5924. if temp == libc.UintptrFromInt32(0) {
  5925. return int32(_XML_ERROR_NO_MEMORY)
  5926. }
  5927. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5928. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5929. }
  5930. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5931. } else {
  5932. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  5933. if !(b != 0) {
  5934. return int32(_XML_ERROR_NO_MEMORY)
  5935. }
  5936. /* Detect and prevent integer overflow */
  5937. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5938. return int32(_XML_ERROR_NO_MEMORY)
  5939. }
  5940. /* Detect and prevent integer overflow.
  5941. * The preprocessor guard addresses the "always false" warning
  5942. * from -Wtype-limits on platforms where
  5943. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5944. (*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)))
  5945. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5946. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5947. return int32(_XML_ERROR_NO_MEMORY)
  5948. }
  5949. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5950. }
  5951. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5952. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  5953. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5954. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5955. }
  5956. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5957. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5958. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5959. /* NULL binding when default namespace undeclared */
  5960. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  5961. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5962. } else {
  5963. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5964. }
  5965. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5966. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5967. /* if attId == NULL then we are not starting a namespace scope */
  5968. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5969. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5970. v3 = uri
  5971. } else {
  5972. v3 = uintptr(0)
  5973. }
  5974. (*(*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)
  5975. }
  5976. return int32(_XML_ERROR_NONE)
  5977. }
  5978. // "http://www.w3.org/XML/1998/namespace"
  5979. var _xmlNamespace = [37]TXML_Char{
  5980. 0: int8(m_ASCII_h),
  5981. 1: int8(m_ASCII_t),
  5982. 2: int8(m_ASCII_t),
  5983. 3: int8(m_ASCII_p),
  5984. 4: int8(m_ASCII_COLON),
  5985. 5: int8(m_ASCII_SLASH),
  5986. 6: int8(m_ASCII_SLASH),
  5987. 7: int8(m_ASCII_w),
  5988. 8: int8(m_ASCII_w),
  5989. 9: int8(m_ASCII_w),
  5990. 10: int8(m_ASCII_PERIOD),
  5991. 11: int8(m_ASCII_w),
  5992. 12: int8(m_ASCII_3),
  5993. 13: int8(m_ASCII_PERIOD),
  5994. 14: int8(m_ASCII_o),
  5995. 15: int8(m_ASCII_r),
  5996. 16: int8(m_ASCII_g),
  5997. 17: int8(m_ASCII_SLASH),
  5998. 18: int8(m_ASCII_X),
  5999. 19: int8(m_ASCII_M),
  6000. 20: int8(m_ASCII_L),
  6001. 21: int8(m_ASCII_SLASH),
  6002. 22: int8(m_ASCII_1),
  6003. 23: int8(m_ASCII_9),
  6004. 24: int8(m_ASCII_9),
  6005. 25: int8(m_ASCII_8),
  6006. 26: int8(m_ASCII_SLASH),
  6007. 27: int8(m_ASCII_n),
  6008. 28: int8(m_ASCII_a),
  6009. 29: int8(m_ASCII_m),
  6010. 30: int8(m_ASCII_e),
  6011. 31: int8(m_ASCII_s),
  6012. 32: int8(m_ASCII_p),
  6013. 33: int8(m_ASCII_a),
  6014. 34: int8(m_ASCII_c),
  6015. 35: int8(m_ASCII_e),
  6016. }
  6017. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  6018. // "http://www.w3.org/2000/xmlns/"
  6019. var _xmlnsNamespace = [30]TXML_Char{
  6020. 0: int8(m_ASCII_h),
  6021. 1: int8(m_ASCII_t),
  6022. 2: int8(m_ASCII_t),
  6023. 3: int8(m_ASCII_p),
  6024. 4: int8(m_ASCII_COLON),
  6025. 5: int8(m_ASCII_SLASH),
  6026. 6: int8(m_ASCII_SLASH),
  6027. 7: int8(m_ASCII_w),
  6028. 8: int8(m_ASCII_w),
  6029. 9: int8(m_ASCII_w),
  6030. 10: int8(m_ASCII_PERIOD),
  6031. 11: int8(m_ASCII_w),
  6032. 12: int8(m_ASCII_3),
  6033. 13: int8(m_ASCII_PERIOD),
  6034. 14: int8(m_ASCII_o),
  6035. 15: int8(m_ASCII_r),
  6036. 16: int8(m_ASCII_g),
  6037. 17: int8(m_ASCII_SLASH),
  6038. 18: int8(m_ASCII_2),
  6039. 19: int8(m_ASCII_0),
  6040. 20: int8(m_ASCII_0),
  6041. 21: int8(m_ASCII_0),
  6042. 22: int8(m_ASCII_SLASH),
  6043. 23: int8(m_ASCII_x),
  6044. 24: int8(m_ASCII_m),
  6045. 25: int8(m_ASCII_l),
  6046. 26: int8(m_ASCII_n),
  6047. 27: int8(m_ASCII_s),
  6048. 28: int8(m_ASCII_SLASH),
  6049. }
  6050. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  6051. // C documentation
  6052. //
  6053. // /* The idea here is to avoid using stack for each CDATA section when
  6054. // the whole file is parsed with one call.
  6055. // */
  6056. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6057. bp := tls.Alloc(16)
  6058. defer tls.Free(16)
  6059. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6060. var result _XML_Error
  6061. _ = result
  6062. 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))
  6063. if result != int32(_XML_ERROR_NONE) {
  6064. return result
  6065. }
  6066. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6067. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  6068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  6069. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6070. } else {
  6071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6072. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6073. }
  6074. }
  6075. return result
  6076. }
  6077. // C documentation
  6078. //
  6079. // /* startPtr gets set to non-null if the section is closed, and to null if
  6080. // the section is not yet closed.
  6081. // */
  6082. 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) {
  6083. bp := tls.Alloc(32)
  6084. defer tls.Free(32)
  6085. var charDataHandler TXML_CharacterDataHandler
  6086. var convert_res _XML_Convert_Result
  6087. var eventEndPP, eventPP, v3 uintptr
  6088. var tok int32
  6089. var _ /* c at bp+16 */ TXML_Char
  6090. var _ /* dataPtr at bp+24 */ uintptr
  6091. var _ /* next at bp+8 */ uintptr
  6092. var _ /* s at bp+0 */ uintptr
  6093. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  6094. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6095. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6096. eventPP = parser + 544
  6097. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6098. eventEndPP = parser + 552
  6099. } else {
  6100. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6101. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6102. }
  6103. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6104. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6105. for {
  6106. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6107. 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)
  6108. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4044), account) != 0) {
  6109. _accountingOnAbort(tls, parser)
  6110. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6111. }
  6112. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6113. switch tok {
  6114. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6115. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6116. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6117. } else {
  6118. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6119. (*(*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)
  6120. } else {
  6121. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6122. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6123. }
  6124. }
  6125. }
  6126. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6127. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6128. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6129. return int32(_XML_ERROR_ABORTED)
  6130. } else {
  6131. return int32(_XML_ERROR_NONE)
  6132. }
  6133. fallthrough
  6134. case int32(m_XML_TOK_DATA_NEWLINE):
  6135. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6136. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = int8(0xA)
  6137. (*(*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))
  6138. } else {
  6139. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6140. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6141. }
  6142. }
  6143. case int32(m_XML_TOK_DATA_CHARS):
  6144. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6145. if charDataHandler != 0 {
  6146. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6147. for {
  6148. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6149. 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)
  6150. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6151. (*(*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)))
  6152. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6153. break
  6154. }
  6155. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6156. goto _2
  6157. _2:
  6158. }
  6159. } else {
  6160. (*(*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)))))
  6161. }
  6162. } else {
  6163. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6164. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6165. }
  6166. }
  6167. case m_XML_TOK_INVALID:
  6168. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6169. return int32(_XML_ERROR_INVALID_TOKEN)
  6170. case -int32(2):
  6171. if haveMore != 0 {
  6172. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6173. return int32(_XML_ERROR_NONE)
  6174. }
  6175. return int32(_XML_ERROR_PARTIAL_CHAR)
  6176. case -int32(1):
  6177. fallthrough
  6178. case -int32(4):
  6179. if haveMore != 0 {
  6180. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6181. return int32(_XML_ERROR_NONE)
  6182. }
  6183. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6184. default:
  6185. /* Every token returned by XmlCdataSectionTok() has its own
  6186. * explicit case, so this default case will never be executed.
  6187. * We retain it as a safety net and exclude it from the coverage
  6188. * statistics.
  6189. *
  6190. * LCOV_EXCL_START
  6191. */
  6192. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6193. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6194. /* LCOV_EXCL_STOP */
  6195. }
  6196. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6197. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6198. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6199. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6200. case int32(_XML_SUSPENDED):
  6201. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6202. return int32(_XML_ERROR_NONE)
  6203. case int32(_XML_FINISHED):
  6204. return int32(_XML_ERROR_ABORTED)
  6205. default:
  6206. }
  6207. goto _1
  6208. _1:
  6209. }
  6210. /* not reached */
  6211. return r
  6212. }
  6213. // C documentation
  6214. //
  6215. // /* The idea here is to avoid using stack for each IGNORE section when
  6216. // the whole file is parsed with one call.
  6217. // */
  6218. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6219. bp := tls.Alloc(16)
  6220. defer tls.Free(16)
  6221. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6222. var result _XML_Error
  6223. _ = result
  6224. 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)))
  6225. if result != int32(_XML_ERROR_NONE) {
  6226. return result
  6227. }
  6228. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6229. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6230. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6231. }
  6232. return result
  6233. }
  6234. // C documentation
  6235. //
  6236. // /* startPtr gets set to non-null is the section is closed, and to null
  6237. // if the section is not yet closed.
  6238. // */
  6239. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6240. bp := tls.Alloc(16)
  6241. defer tls.Free(16)
  6242. var eventEndPP, eventPP, s uintptr
  6243. var tok int32
  6244. var _ /* next at bp+0 */ uintptr
  6245. _, _, _, _ = eventEndPP, eventPP, s, tok
  6246. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6247. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6248. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6249. eventPP = parser + 544
  6250. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6251. eventEndPP = parser + 552
  6252. } else {
  6253. /* It's not entirely clear, but it seems the following two lines
  6254. * of code cannot be executed. The only occasions on which 'enc'
  6255. * is not 'encoding' are when this function is called
  6256. * from the internal entity processing, and IGNORE sections are an
  6257. * error in internal entities.
  6258. *
  6259. * Since it really isn't clear that this is true, we keep the code
  6260. * and just remove it from our coverage tests.
  6261. *
  6262. * LCOV_EXCL_START
  6263. */
  6264. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6265. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6266. /* LCOV_EXCL_STOP */
  6267. }
  6268. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6269. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6270. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  6271. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6272. _accountingOnAbort(tls, parser)
  6273. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6274. }
  6275. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6276. switch tok {
  6277. case int32(m_XML_TOK_IGNORE_SECT):
  6278. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6279. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6280. }
  6281. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6282. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6283. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6284. return int32(_XML_ERROR_ABORTED)
  6285. } else {
  6286. return int32(_XML_ERROR_NONE)
  6287. }
  6288. fallthrough
  6289. case m_XML_TOK_INVALID:
  6290. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6291. return int32(_XML_ERROR_INVALID_TOKEN)
  6292. case -int32(2):
  6293. if haveMore != 0 {
  6294. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6295. return int32(_XML_ERROR_NONE)
  6296. }
  6297. return int32(_XML_ERROR_PARTIAL_CHAR)
  6298. case -int32(1):
  6299. fallthrough
  6300. case -int32(4):
  6301. if haveMore != 0 {
  6302. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6303. return int32(_XML_ERROR_NONE)
  6304. }
  6305. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6306. default:
  6307. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6308. * explicit cases to handle them, so this default case is never
  6309. * executed. We keep it as a safety net anyway, and remove it
  6310. * from our test coverage statistics.
  6311. *
  6312. * LCOV_EXCL_START
  6313. */
  6314. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6315. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6316. /* LCOV_EXCL_STOP */
  6317. }
  6318. /* not reached */
  6319. return r
  6320. }
  6321. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6322. var s uintptr
  6323. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6324. _, _ = s, v1
  6325. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6326. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6327. v1 = XXmlInitEncodingNS
  6328. } else {
  6329. v1 = XXmlInitEncoding
  6330. }
  6331. if v1(tls, parser+296, parser+288, s) != 0 {
  6332. return int32(_XML_ERROR_NONE)
  6333. }
  6334. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6335. }
  6336. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6337. bp := tls.Alloc(48)
  6338. defer tls.Free(48)
  6339. var result _XML_Error
  6340. var storedEncName, storedversion uintptr
  6341. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6342. var _ /* encodingName at bp+0 */ uintptr
  6343. var _ /* newEncoding at bp+8 */ uintptr
  6344. var _ /* standalone at bp+32 */ int32
  6345. var _ /* version at bp+16 */ uintptr
  6346. var _ /* versionend at bp+24 */ uintptr
  6347. _, _, _, _ = result, storedEncName, storedversion, v1
  6348. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6349. storedEncName = libc.UintptrFromInt32(0)
  6350. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6351. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  6352. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  6353. storedversion = libc.UintptrFromInt32(0)
  6354. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  6355. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6356. _accountingOnAbort(tls, parser)
  6357. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6358. }
  6359. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6360. v1 = XXmlParseXmlDeclNS
  6361. } else {
  6362. v1 = XXmlParseXmlDecl
  6363. }
  6364. 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) {
  6365. if isGeneralTextEntity != 0 {
  6366. return int32(_XML_ERROR_TEXT_DECL)
  6367. } else {
  6368. return int32(_XML_ERROR_XML_DECL)
  6369. }
  6370. }
  6371. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  6372. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6373. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6374. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6375. }
  6376. }
  6377. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6378. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6379. 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)))))
  6380. if !(storedEncName != 0) {
  6381. return int32(_XML_ERROR_NO_MEMORY)
  6382. }
  6383. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  6384. }
  6385. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  6386. 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))
  6387. if !(storedversion != 0) {
  6388. return int32(_XML_ERROR_NO_MEMORY)
  6389. }
  6390. }
  6391. (*(*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)))
  6392. } else {
  6393. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6394. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6395. }
  6396. }
  6397. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6398. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6399. /* Check that the specified encoding does not conflict with what
  6400. * the parser has already deduced. Do we have the same number
  6401. * of bytes in the smallest representation of a character? If
  6402. * this is UTF-16, is it the same endianness?
  6403. */
  6404. 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 {
  6405. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6406. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6407. }
  6408. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  6409. } else {
  6410. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6411. if !(storedEncName != 0) {
  6412. 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)))))
  6413. if !(storedEncName != 0) {
  6414. return int32(_XML_ERROR_NO_MEMORY)
  6415. }
  6416. }
  6417. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6418. _poolClear(tls, parser+832)
  6419. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6420. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6421. }
  6422. return result
  6423. }
  6424. }
  6425. }
  6426. if storedEncName != 0 || storedversion != 0 {
  6427. _poolClear(tls, parser+832)
  6428. }
  6429. return int32(_XML_ERROR_NONE)
  6430. }
  6431. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6432. bp := tls.Alloc(1056)
  6433. defer tls.Free(1056)
  6434. var enc uintptr
  6435. var i int32
  6436. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6437. var _ /* info at bp+0 */ TXML_Encoding
  6438. _, _, _ = enc, i, v2
  6439. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6440. i = 0
  6441. for {
  6442. if !(i < int32(256)) {
  6443. break
  6444. }
  6445. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6446. goto _1
  6447. _1:
  6448. ;
  6449. i++
  6450. }
  6451. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6452. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6453. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6454. 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 {
  6455. (*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)))
  6456. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6457. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6458. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6459. }
  6460. return int32(_XML_ERROR_NO_MEMORY)
  6461. }
  6462. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6463. v2 = XXmlInitUnknownEncodingNS
  6464. } else {
  6465. v2 = XXmlInitUnknownEncoding
  6466. }
  6467. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6468. if enc != 0 {
  6469. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6470. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6471. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6472. return int32(_XML_ERROR_NONE)
  6473. }
  6474. }
  6475. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6476. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6477. }
  6478. }
  6479. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6480. }
  6481. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6482. var result _XML_Error
  6483. _ = result
  6484. result = _initializeEncoding(tls, parser)
  6485. if result != int32(_XML_ERROR_NONE) {
  6486. return result
  6487. }
  6488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6489. return _prologProcessor(tls, parser, s, end, nextPtr)
  6490. }
  6491. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6492. var result _XML_Error
  6493. _ = result
  6494. result = _initializeEncoding(tls, parser)
  6495. if result != int32(_XML_ERROR_NONE) {
  6496. return result
  6497. }
  6498. /* we know now that XML_Parse(Buffer) has been called,
  6499. so we consider the external parameter entity read */
  6500. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6501. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6502. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6503. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6504. } else {
  6505. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6506. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6507. }
  6508. return r
  6509. }
  6510. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6511. bp := tls.Alloc(16)
  6512. defer tls.Free(16)
  6513. var result _XML_Error
  6514. var start uintptr
  6515. var tok int32
  6516. var _ /* next at bp+0 */ uintptr
  6517. _, _, _ = result, start, tok
  6518. start = s
  6519. *(*uintptr)(unsafe.Pointer(bp)) = start
  6520. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6521. for {
  6522. 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)
  6523. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6524. - storeEntityValue
  6525. - processXmlDecl
  6526. */
  6527. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6528. if tok <= 0 {
  6529. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6530. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6531. return int32(_XML_ERROR_NONE)
  6532. }
  6533. switch tok {
  6534. case m_XML_TOK_INVALID:
  6535. return int32(_XML_ERROR_INVALID_TOKEN)
  6536. case -int32(1):
  6537. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6538. case -int32(2):
  6539. return int32(_XML_ERROR_PARTIAL_CHAR)
  6540. case -int32(4): /* start == end */
  6541. fallthrough
  6542. default:
  6543. break
  6544. }
  6545. /* found end of entity value - can store it now */
  6546. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6547. } else {
  6548. if tok == int32(m_XML_TOK_XML_DECL) {
  6549. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6550. if result != int32(_XML_ERROR_NONE) {
  6551. return result
  6552. }
  6553. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6554. * that to happen, a parameter entity parsing handler must have attempted
  6555. * to suspend the parser, which fails and raises an error. The parser can
  6556. * be aborted, but can't be suspended.
  6557. */
  6558. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6559. return int32(_XML_ERROR_ABORTED)
  6560. }
  6561. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6562. /* stop scanning for text declaration - we found one */
  6563. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6564. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6565. } else {
  6566. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6567. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6568. _accountingOnAbort(tls, parser)
  6569. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6570. }
  6571. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6572. return int32(_XML_ERROR_NONE)
  6573. } else {
  6574. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6575. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6576. return int32(_XML_ERROR_SYNTAX)
  6577. }
  6578. }
  6579. }
  6580. }
  6581. start = *(*uintptr)(unsafe.Pointer(bp))
  6582. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6583. goto _1
  6584. _1:
  6585. }
  6586. return r
  6587. }
  6588. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6589. bp := tls.Alloc(16)
  6590. defer tls.Free(16)
  6591. var tok int32
  6592. var _ /* next at bp+0 */ uintptr
  6593. _ = tok
  6594. *(*uintptr)(unsafe.Pointer(bp)) = s
  6595. 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)
  6596. if tok <= 0 {
  6597. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6598. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6599. return int32(_XML_ERROR_NONE)
  6600. }
  6601. switch tok {
  6602. case m_XML_TOK_INVALID:
  6603. return int32(_XML_ERROR_INVALID_TOKEN)
  6604. case -int32(1):
  6605. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6606. case -int32(2):
  6607. return int32(_XML_ERROR_PARTIAL_CHAR)
  6608. case -int32(4): /* start == end */
  6609. fallthrough
  6610. default:
  6611. break
  6612. }
  6613. } else {
  6614. if tok == int32(m_XML_TOK_BOM) {
  6615. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6616. _accountingOnAbort(tls, parser)
  6617. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6618. }
  6619. s = *(*uintptr)(unsafe.Pointer(bp))
  6620. 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)
  6621. }
  6622. }
  6623. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6624. 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))
  6625. }
  6626. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6627. bp := tls.Alloc(16)
  6628. defer tls.Free(16)
  6629. var enc, start uintptr
  6630. var tok int32
  6631. var _ /* next at bp+0 */ uintptr
  6632. _, _, _ = enc, start, tok
  6633. start = s
  6634. *(*uintptr)(unsafe.Pointer(bp)) = s
  6635. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6636. for {
  6637. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6638. /* Note: These bytes are accounted later in:
  6639. - storeEntityValue
  6640. */
  6641. if tok <= 0 {
  6642. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6643. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6644. return int32(_XML_ERROR_NONE)
  6645. }
  6646. switch tok {
  6647. case m_XML_TOK_INVALID:
  6648. return int32(_XML_ERROR_INVALID_TOKEN)
  6649. case -int32(1):
  6650. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6651. case -int32(2):
  6652. return int32(_XML_ERROR_PARTIAL_CHAR)
  6653. case -int32(4): /* start == end */
  6654. fallthrough
  6655. default:
  6656. break
  6657. }
  6658. /* found end of entity value - can store it now */
  6659. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6660. }
  6661. start = *(*uintptr)(unsafe.Pointer(bp))
  6662. goto _1
  6663. _1:
  6664. }
  6665. return r
  6666. }
  6667. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6668. bp := tls.Alloc(16)
  6669. defer tls.Free(16)
  6670. var tok int32
  6671. var _ /* next at bp+0 */ uintptr
  6672. _ = tok
  6673. *(*uintptr)(unsafe.Pointer(bp)) = s
  6674. 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)
  6675. 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))
  6676. }
  6677. 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) {
  6678. bp := tls.Alloc(16)
  6679. defer tls.Free(16)
  6680. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6681. 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
  6682. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6683. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6684. var nameLen, v88 Tsize_t
  6685. var quant _XML_Content_Quant
  6686. var result, result1, result2, result3, result4, result5 _XML_Error
  6687. var v72, v79, v83 bool
  6688. var v81 uint32
  6689. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6690. /* save one level of indirection */
  6691. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6692. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6693. eventPP = parser + 544
  6694. eventEndPP = parser + 552
  6695. } else {
  6696. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6697. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6698. }
  6699. for {
  6700. handleDefault = libc.Uint8FromInt32(1)
  6701. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6702. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6703. if tok <= 0 {
  6704. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6705. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6706. return int32(_XML_ERROR_NONE)
  6707. }
  6708. switch tok {
  6709. case m_XML_TOK_INVALID:
  6710. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6711. return int32(_XML_ERROR_INVALID_TOKEN)
  6712. case -int32(1):
  6713. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6714. case -int32(2):
  6715. return int32(_XML_ERROR_PARTIAL_CHAR)
  6716. case -int32(m_XML_TOK_PROLOG_S):
  6717. tok = -tok
  6718. case -int32(4):
  6719. /* for internal PE NOT referenced between declarations */
  6720. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6721. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6722. return int32(_XML_ERROR_NONE)
  6723. }
  6724. /* WFC: PE Between Declarations - must check that PE contains
  6725. complete markup, not only for external PEs, but also for
  6726. internal PEs if the reference occurs between declarations.
  6727. */
  6728. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6729. 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) {
  6730. return int32(_XML_ERROR_INCOMPLETE_PE)
  6731. }
  6732. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6733. return int32(_XML_ERROR_NONE)
  6734. }
  6735. return int32(_XML_ERROR_NO_ELEMENTS)
  6736. default:
  6737. tok = -tok
  6738. *(*uintptr)(unsafe.Pointer(bp)) = end
  6739. break
  6740. }
  6741. }
  6742. 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)
  6743. switch role {
  6744. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6745. fallthrough
  6746. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6747. fallthrough
  6748. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6749. default:
  6750. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6751. _accountingOnAbort(tls, parser)
  6752. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6753. }
  6754. }
  6755. switch role {
  6756. case int32(_XML_ROLE_XML_DECL):
  6757. goto _2
  6758. case int32(_XML_ROLE_DOCTYPE_NAME):
  6759. goto _3
  6760. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6761. goto _4
  6762. case int32(_XML_ROLE_TEXT_DECL):
  6763. goto _5
  6764. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6765. goto _6
  6766. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6767. goto _7
  6768. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6769. goto _8
  6770. case int32(_XML_ROLE_INSTANCE_START):
  6771. goto _9
  6772. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6773. goto _10
  6774. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6775. goto _11
  6776. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6777. goto _12
  6778. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6779. goto _13
  6780. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6781. goto _14
  6782. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6783. goto _15
  6784. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6785. goto _16
  6786. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6787. goto _17
  6788. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6789. goto _18
  6790. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6791. goto _19
  6792. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6793. goto _20
  6794. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6795. goto _21
  6796. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6797. goto _22
  6798. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6799. goto _23
  6800. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6801. goto _24
  6802. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6803. goto _25
  6804. case int32(_XML_ROLE_ENTITY_VALUE):
  6805. goto _26
  6806. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6807. goto _27
  6808. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6809. goto _28
  6810. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6811. goto _29
  6812. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6813. goto _30
  6814. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6815. goto _31
  6816. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6817. goto _32
  6818. case int32(_XML_ROLE_NOTATION_NAME):
  6819. goto _33
  6820. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6821. goto _34
  6822. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6823. goto _35
  6824. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6825. goto _36
  6826. case int32(_XML_ROLE_ERROR):
  6827. goto _37
  6828. case int32(_XML_ROLE_IGNORE_SECT):
  6829. goto _38
  6830. case int32(_XML_ROLE_GROUP_OPEN):
  6831. goto _39
  6832. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6833. goto _40
  6834. case int32(_XML_ROLE_GROUP_CHOICE):
  6835. goto _41
  6836. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6837. goto _42
  6838. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6839. goto _43
  6840. case int32(_XML_ROLE_ELEMENT_NAME):
  6841. goto _44
  6842. case int32(_XML_ROLE_CONTENT_EMPTY):
  6843. goto _45
  6844. case int32(_XML_ROLE_CONTENT_ANY):
  6845. goto _46
  6846. case int32(_XML_ROLE_CONTENT_PCDATA):
  6847. goto _47
  6848. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6849. goto _48
  6850. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6851. goto _49
  6852. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6853. goto _50
  6854. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6855. goto _51
  6856. case int32(_XML_ROLE_GROUP_CLOSE):
  6857. goto _52
  6858. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6859. goto _53
  6860. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6861. goto _54
  6862. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6863. goto _55
  6864. case int32(_XML_ROLE_PI):
  6865. goto _56
  6866. case int32(_XML_ROLE_COMMENT):
  6867. goto _57
  6868. case int32(_XML_ROLE_NONE):
  6869. goto _58
  6870. case int32(_XML_ROLE_DOCTYPE_NONE):
  6871. goto _59
  6872. case int32(_XML_ROLE_ENTITY_NONE):
  6873. goto _60
  6874. case int32(_XML_ROLE_NOTATION_NONE):
  6875. goto _61
  6876. case int32(_XML_ROLE_ATTLIST_NONE):
  6877. goto _62
  6878. case int32(_XML_ROLE_ELEMENT_NONE):
  6879. goto _63
  6880. }
  6881. goto _64
  6882. _2:
  6883. ;
  6884. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6885. if result != int32(_XML_ERROR_NONE) {
  6886. return result
  6887. }
  6888. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6889. handleDefault = libc.Uint8FromInt32(0)
  6890. goto _64
  6891. _3:
  6892. ;
  6893. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6894. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6895. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6896. return int32(_XML_ERROR_NO_MEMORY)
  6897. }
  6898. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6899. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6900. handleDefault = libc.Uint8FromInt32(0)
  6901. }
  6902. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6903. goto _64
  6904. _4:
  6905. ;
  6906. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6907. (*(*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))
  6908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6909. _poolClear(tls, parser+784)
  6910. handleDefault = libc.Uint8FromInt32(0)
  6911. }
  6912. goto _64
  6913. _5:
  6914. ;
  6915. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6916. if result1 != int32(_XML_ERROR_NONE) {
  6917. return result1
  6918. }
  6919. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6920. handleDefault = libc.Uint8FromInt32(0)
  6921. goto _64
  6922. _6:
  6923. ;
  6924. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6925. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6926. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6927. return int32(_XML_ERROR_NO_MEMORY)
  6928. }
  6929. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6930. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6931. 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) {
  6932. return int32(_XML_ERROR_PUBLICID)
  6933. }
  6934. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6935. if !(pubId != 0) {
  6936. return int32(_XML_ERROR_NO_MEMORY)
  6937. }
  6938. _normalizePublicId(tls, pubId)
  6939. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6940. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6941. handleDefault = libc.Uint8FromInt32(0)
  6942. goto alreadyChecked
  6943. }
  6944. /* fall through */
  6945. _7:
  6946. ;
  6947. 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) {
  6948. return int32(_XML_ERROR_PUBLICID)
  6949. }
  6950. goto alreadyChecked
  6951. alreadyChecked:
  6952. ;
  6953. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6954. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6955. if !(tem != 0) {
  6956. return int32(_XML_ERROR_NO_MEMORY)
  6957. }
  6958. _normalizePublicId(tls, tem)
  6959. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6960. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6961. /* Don't suppress the default handler if we fell through from
  6962. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6963. */
  6964. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6965. handleDefault = libc.Uint8FromInt32(0)
  6966. }
  6967. }
  6968. goto _64
  6969. _8:
  6970. ;
  6971. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6972. /* Must not close doctype from within expanded parameter entities */
  6973. return int32(_XML_ERROR_INVALID_TOKEN)
  6974. }
  6975. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6976. (*(*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)
  6977. _poolClear(tls, parser+784)
  6978. handleDefault = libc.Uint8FromInt32(0)
  6979. }
  6980. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6981. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6982. was not set, indicating an external subset
  6983. */
  6984. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6985. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6986. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6987. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6988. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6989. if !(entity != 0) {
  6990. /* The external subset name "#" will have already been
  6991. * inserted into the hash table at the start of the
  6992. * external entity parsing, so no allocation will happen
  6993. * and lookup() cannot fail.
  6994. */
  6995. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6996. }
  6997. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6998. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6999. }
  7000. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7001. 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) {
  7002. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7003. }
  7004. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  7005. 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) {
  7006. return int32(_XML_ERROR_NOT_STANDALONE)
  7007. }
  7008. } else {
  7009. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  7010. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  7011. }
  7012. }
  7013. /* end of DTD - no need to update dtd->keepProcessing */
  7014. }
  7015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7016. }
  7017. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  7018. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  7019. handleDefault = libc.Uint8FromInt32(0)
  7020. }
  7021. goto _64
  7022. _9:
  7023. ;
  7024. /* if there is no DOCTYPE declaration then now is the
  7025. last chance to read the foreign DTD
  7026. */
  7027. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  7028. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  7029. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7030. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7031. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7032. if !(entity1 != 0) {
  7033. return int32(_XML_ERROR_NO_MEMORY)
  7034. }
  7035. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7036. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7037. 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) {
  7038. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7039. }
  7040. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  7041. 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) {
  7042. return int32(_XML_ERROR_NOT_STANDALONE)
  7043. }
  7044. } else {
  7045. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  7046. }
  7047. /* end of DTD - no need to update dtd->keepProcessing */
  7048. }
  7049. }
  7050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  7051. return _contentProcessor(tls, parser, s, end, nextPtr)
  7052. _10:
  7053. ;
  7054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7055. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7056. return int32(_XML_ERROR_NO_MEMORY)
  7057. }
  7058. goto checkAttListDeclHandler
  7059. _11:
  7060. ;
  7061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7062. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  7063. return int32(_XML_ERROR_NO_MEMORY)
  7064. }
  7065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  7066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  7067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  7068. goto checkAttListDeclHandler
  7069. _12:
  7070. ;
  7071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  7072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  7073. goto checkAttListDeclHandler
  7074. _13:
  7075. ;
  7076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  7077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  7078. goto checkAttListDeclHandler
  7079. _14:
  7080. ;
  7081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  7082. goto checkAttListDeclHandler
  7083. _15:
  7084. ;
  7085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  7086. goto checkAttListDeclHandler
  7087. _16:
  7088. ;
  7089. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  7090. goto checkAttListDeclHandler
  7091. _17:
  7092. ;
  7093. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  7094. goto checkAttListDeclHandler
  7095. _18:
  7096. ;
  7097. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  7098. goto checkAttListDeclHandler
  7099. _19:
  7100. ;
  7101. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7102. goto checkAttListDeclHandler
  7103. checkAttListDeclHandler:
  7104. ;
  7105. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7106. handleDefault = libc.Uint8FromInt32(0)
  7107. }
  7108. goto _64
  7109. _21:
  7110. ;
  7111. _20:
  7112. ;
  7113. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7114. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7115. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7116. } else {
  7117. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7118. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7119. } else {
  7120. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7121. }
  7122. prefix = v65
  7123. }
  7124. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  7125. return int32(_XML_ERROR_NO_MEMORY)
  7126. }
  7127. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7128. return int32(_XML_ERROR_NO_MEMORY)
  7129. }
  7130. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7131. handleDefault = libc.Uint8FromInt32(0)
  7132. }
  7133. goto _64
  7134. _23:
  7135. ;
  7136. _22:
  7137. ;
  7138. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7139. 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) {
  7140. return int32(_XML_ERROR_NO_MEMORY)
  7141. }
  7142. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7143. 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) {
  7144. /* Enumerated or Notation type */
  7145. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7146. v66 = 0
  7147. } else {
  7148. v68 = parser + 784 + 24
  7149. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7150. *(*uintptr)(unsafe.Pointer(v68))++
  7151. *(*TXML_Char)(unsafe.Pointer(v67)) = int8(m_ASCII_RPAREN)
  7152. v66 = libc.Int32FromInt32(1)
  7153. }
  7154. if v72 = !(v66 != 0); !v72 {
  7155. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7156. v69 = 0
  7157. } else {
  7158. v71 = parser + 784 + 24
  7159. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7160. *(*uintptr)(unsafe.Pointer(v71))++
  7161. *(*TXML_Char)(unsafe.Pointer(v70)) = int8('\000')
  7162. v69 = libc.Int32FromInt32(1)
  7163. }
  7164. }
  7165. if v72 || !(v69 != 0) {
  7166. return int32(_XML_ERROR_NO_MEMORY)
  7167. }
  7168. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7169. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7170. }
  7171. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7172. (*(*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)))
  7173. handleDefault = libc.Uint8FromInt32(0)
  7174. }
  7175. }
  7176. _poolClear(tls, parser+784)
  7177. goto _64
  7178. _25:
  7179. ;
  7180. _24:
  7181. ;
  7182. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7183. 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))
  7184. if result2 != 0 {
  7185. return result2
  7186. }
  7187. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7188. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7189. /* ID attributes aren't allowed to have a default */
  7190. 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) {
  7191. return int32(_XML_ERROR_NO_MEMORY)
  7192. }
  7193. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7194. 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) {
  7195. /* Enumerated or Notation type */
  7196. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7197. v73 = 0
  7198. } else {
  7199. v75 = parser + 784 + 24
  7200. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7201. *(*uintptr)(unsafe.Pointer(v75))++
  7202. *(*TXML_Char)(unsafe.Pointer(v74)) = int8(m_ASCII_RPAREN)
  7203. v73 = libc.Int32FromInt32(1)
  7204. }
  7205. if v79 = !(v73 != 0); !v79 {
  7206. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7207. v76 = 0
  7208. } else {
  7209. v78 = parser + 784 + 24
  7210. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7211. *(*uintptr)(unsafe.Pointer(v78))++
  7212. *(*TXML_Char)(unsafe.Pointer(v77)) = int8('\000')
  7213. v76 = libc.Int32FromInt32(1)
  7214. }
  7215. }
  7216. if v79 || !(v76 != 0) {
  7217. return int32(_XML_ERROR_NO_MEMORY)
  7218. }
  7219. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7220. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7221. }
  7222. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7223. (*(*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)))
  7224. _poolClear(tls, parser+784)
  7225. handleDefault = libc.Uint8FromInt32(0)
  7226. }
  7227. }
  7228. goto _64
  7229. _26:
  7230. ;
  7231. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7232. 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))
  7233. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7234. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7235. (*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))
  7236. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  7237. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7238. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7239. (*(*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))
  7240. handleDefault = libc.Uint8FromInt32(0)
  7241. }
  7242. } else {
  7243. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7244. }
  7245. if result3 != int32(_XML_ERROR_NONE) {
  7246. return result3
  7247. }
  7248. }
  7249. goto _64
  7250. _27:
  7251. ;
  7252. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7253. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7254. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7255. (*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))
  7256. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7257. return int32(_XML_ERROR_NO_MEMORY)
  7258. }
  7259. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7260. handleDefault = libc.Uint8FromInt32(0)
  7261. } else {
  7262. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7263. for the case where no parser->m_startDoctypeDeclHandler is set */
  7264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7265. }
  7266. 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) {
  7267. return int32(_XML_ERROR_NOT_STANDALONE)
  7268. }
  7269. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7271. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7272. return int32(_XML_ERROR_NO_MEMORY)
  7273. }
  7274. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7275. }
  7276. /* fall through */
  7277. _28:
  7278. ;
  7279. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7280. (*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))
  7281. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7282. return int32(_XML_ERROR_NO_MEMORY)
  7283. }
  7284. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7285. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7286. /* Don't suppress the default handler if we fell through from
  7287. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7288. */
  7289. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7290. handleDefault = libc.Uint8FromInt32(0)
  7291. }
  7292. }
  7293. goto _64
  7294. _29:
  7295. ;
  7296. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7297. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7298. (*(*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))
  7299. handleDefault = libc.Uint8FromInt32(0)
  7300. }
  7301. goto _64
  7302. _30:
  7303. ;
  7304. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7305. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7306. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7307. return int32(_XML_ERROR_NO_MEMORY)
  7308. }
  7309. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7310. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7311. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7312. (*(*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)
  7313. handleDefault = libc.Uint8FromInt32(0)
  7314. } else {
  7315. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7316. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7317. (*(*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)
  7318. handleDefault = libc.Uint8FromInt32(0)
  7319. }
  7320. }
  7321. }
  7322. goto _64
  7323. _31:
  7324. ;
  7325. 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 {
  7326. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7327. goto _64
  7328. }
  7329. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7330. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7331. if !(name != 0) {
  7332. return int32(_XML_ERROR_NO_MEMORY)
  7333. }
  7334. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  7335. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7336. return int32(_XML_ERROR_NO_MEMORY)
  7337. }
  7338. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7339. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7340. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7341. } else {
  7342. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7343. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7344. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7345. /* if we have a parent parser or are reading an internal parameter
  7346. entity, then the entity declaration is not considered "internal"
  7347. */
  7348. (*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))
  7349. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7350. handleDefault = libc.Uint8FromInt32(0)
  7351. }
  7352. }
  7353. } else {
  7354. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7355. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7356. }
  7357. goto _64
  7358. _32:
  7359. ;
  7360. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7361. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7362. if !(name1 != 0) {
  7363. return int32(_XML_ERROR_NO_MEMORY)
  7364. }
  7365. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  7366. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7367. return int32(_XML_ERROR_NO_MEMORY)
  7368. }
  7369. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7370. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7371. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7372. } else {
  7373. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7374. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7375. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7376. /* if we have a parent parser or are reading an internal parameter
  7377. entity, then the entity declaration is not considered "internal"
  7378. */
  7379. (*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))
  7380. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7381. handleDefault = libc.Uint8FromInt32(0)
  7382. }
  7383. }
  7384. } else {
  7385. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7386. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7387. }
  7388. goto _64
  7389. _33:
  7390. ;
  7391. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7392. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7393. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7395. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7396. return int32(_XML_ERROR_NO_MEMORY)
  7397. }
  7398. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7399. handleDefault = libc.Uint8FromInt32(0)
  7400. }
  7401. goto _64
  7402. _34:
  7403. ;
  7404. 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) {
  7405. return int32(_XML_ERROR_PUBLICID)
  7406. }
  7407. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7408. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7409. if !(tem1 != 0) {
  7410. return int32(_XML_ERROR_NO_MEMORY)
  7411. }
  7412. _normalizePublicId(tls, tem1)
  7413. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7414. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7415. handleDefault = libc.Uint8FromInt32(0)
  7416. }
  7417. goto _64
  7418. _35:
  7419. ;
  7420. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7421. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7422. if !(systemId != 0) {
  7423. return int32(_XML_ERROR_NO_MEMORY)
  7424. }
  7425. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7426. (*(*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)
  7427. handleDefault = libc.Uint8FromInt32(0)
  7428. }
  7429. _poolClear(tls, parser+784)
  7430. goto _64
  7431. _36:
  7432. ;
  7433. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7434. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7435. (*(*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)
  7436. handleDefault = libc.Uint8FromInt32(0)
  7437. }
  7438. _poolClear(tls, parser+784)
  7439. goto _64
  7440. _37:
  7441. ;
  7442. switch tok {
  7443. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7444. /* PE references in internal subset are
  7445. not allowed within declarations. */
  7446. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7447. case int32(m_XML_TOK_XML_DECL):
  7448. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7449. default:
  7450. return int32(_XML_ERROR_SYNTAX)
  7451. }
  7452. _38:
  7453. ;
  7454. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7455. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7456. }
  7457. handleDefault = libc.Uint8FromInt32(0)
  7458. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7459. if result4 != int32(_XML_ERROR_NONE) {
  7460. return result4
  7461. } else {
  7462. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7463. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7464. return result4
  7465. }
  7466. }
  7467. goto _64
  7468. _39:
  7469. ;
  7470. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7471. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7472. /* Detect and prevent integer overflow */
  7473. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7474. return int32(_XML_ERROR_NO_MEMORY)
  7475. }
  7476. p80 = parser + 888
  7477. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7478. 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))))
  7479. if new_connector == libc.UintptrFromInt32(0) {
  7480. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  7481. return int32(_XML_ERROR_NO_MEMORY)
  7482. }
  7483. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7484. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7485. /* Detect and prevent integer overflow.
  7486. * The preprocessor guard addresses the "always false" warning
  7487. * from -Wtype-limits on platforms where
  7488. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7489. 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))
  7490. if new_scaff_index == libc.UintptrFromInt32(0) {
  7491. return int32(_XML_ERROR_NO_MEMORY)
  7492. }
  7493. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7494. }
  7495. } else {
  7496. v81 = libc.Uint32FromInt32(32)
  7497. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7498. (*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))
  7499. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7500. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7501. return int32(_XML_ERROR_NO_MEMORY)
  7502. }
  7503. }
  7504. }
  7505. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = 0
  7506. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7507. myindex = _nextScaffoldPart(tls, parser)
  7508. if myindex < 0 {
  7509. return int32(_XML_ERROR_NO_MEMORY)
  7510. }
  7511. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7512. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7513. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7514. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7515. handleDefault = libc.Uint8FromInt32(0)
  7516. }
  7517. }
  7518. goto _64
  7519. _40:
  7520. ;
  7521. 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) {
  7522. return int32(_XML_ERROR_SYNTAX)
  7523. }
  7524. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_COMMA)
  7525. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7526. handleDefault = libc.Uint8FromInt32(0)
  7527. }
  7528. goto _64
  7529. _41:
  7530. ;
  7531. 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) {
  7532. return int32(_XML_ERROR_SYNTAX)
  7533. }
  7534. 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) {
  7535. (*(*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)
  7536. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7537. handleDefault = libc.Uint8FromInt32(0)
  7538. }
  7539. }
  7540. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_PIPE)
  7541. goto _64
  7542. _43:
  7543. ;
  7544. _42:
  7545. ;
  7546. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7547. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7548. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7549. } else {
  7550. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7551. if !(name2 != 0) {
  7552. return int32(_XML_ERROR_NO_MEMORY)
  7553. }
  7554. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7555. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7556. /* first, determine if a check for an existing declaration is needed;
  7557. if yes, check that the entity exists, and that it is internal,
  7558. otherwise call the skipped entity handler
  7559. */
  7560. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7561. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7562. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7563. } else {
  7564. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7565. }
  7566. }
  7567. if v83 && v82 != 0 {
  7568. if !(entity2 != 0) {
  7569. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7570. } else {
  7571. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7572. /* It's hard to exhaustively search the code to be sure,
  7573. * but there doesn't seem to be a way of executing the
  7574. * following line. There are two cases:
  7575. *
  7576. * If 'standalone' is false, the DTD must have no
  7577. * parameter entities or we wouldn't have passed the outer
  7578. * 'if' statement. That means the only entity in the hash
  7579. * table is the external subset name "#" which cannot be
  7580. * given as a parameter entity name in XML syntax, so the
  7581. * lookup must have returned NULL and we don't even reach
  7582. * the test for an internal entity.
  7583. *
  7584. * If 'standalone' is true, it does not seem to be
  7585. * possible to create entities taking this code path that
  7586. * are not internal entities, so fail the test above.
  7587. *
  7588. * Because this analysis is very uncertain, the code is
  7589. * being left in place and merely removed from the
  7590. * coverage test statistics.
  7591. */
  7592. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7593. }
  7594. }
  7595. } else {
  7596. if !(entity2 != 0) {
  7597. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7598. /* cannot report skipped entities in declarations */
  7599. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7600. (*(*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))
  7601. handleDefault = libc.Uint8FromInt32(0)
  7602. }
  7603. goto _64
  7604. }
  7605. }
  7606. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7607. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7608. }
  7609. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7610. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7611. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7612. } else {
  7613. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7614. }
  7615. betweenDecl = libc.Uint8FromInt32(v84)
  7616. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7617. if result5 != int32(_XML_ERROR_NONE) {
  7618. return result5
  7619. }
  7620. handleDefault = libc.Uint8FromInt32(0)
  7621. goto _64
  7622. }
  7623. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7624. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7625. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7626. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7627. 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) {
  7628. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7629. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7630. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7631. }
  7632. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7633. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7634. handleDefault = libc.Uint8FromInt32(0)
  7635. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7636. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7637. goto _64
  7638. }
  7639. } else {
  7640. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7641. goto _64
  7642. }
  7643. }
  7644. 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) {
  7645. return int32(_XML_ERROR_NOT_STANDALONE)
  7646. }
  7647. goto _64
  7648. /* Element declaration stuff */
  7649. _44:
  7650. ;
  7651. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7652. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7653. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7654. return int32(_XML_ERROR_NO_MEMORY)
  7655. }
  7656. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7657. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7658. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7659. handleDefault = libc.Uint8FromInt32(0)
  7660. }
  7661. goto _64
  7662. _46:
  7663. ;
  7664. _45:
  7665. ;
  7666. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7667. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7668. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7669. if !(content != 0) {
  7670. return int32(_XML_ERROR_NO_MEMORY)
  7671. }
  7672. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7673. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7674. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7675. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7676. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7677. v85 = int32(_XML_CTYPE_ANY)
  7678. } else {
  7679. v85 = int32(_XML_CTYPE_EMPTY)
  7680. }
  7681. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7682. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7683. (*(*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)
  7684. handleDefault = libc.Uint8FromInt32(0)
  7685. }
  7686. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7687. }
  7688. goto _64
  7689. _47:
  7690. ;
  7691. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7692. (*(*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)
  7693. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7694. handleDefault = libc.Uint8FromInt32(0)
  7695. }
  7696. }
  7697. goto _64
  7698. _48:
  7699. ;
  7700. quant = int32(_XML_CQUANT_NONE)
  7701. goto elementContent
  7702. _49:
  7703. ;
  7704. quant = int32(_XML_CQUANT_OPT)
  7705. goto elementContent
  7706. _50:
  7707. ;
  7708. quant = int32(_XML_CQUANT_REP)
  7709. goto elementContent
  7710. _51:
  7711. ;
  7712. quant = int32(_XML_CQUANT_PLUS)
  7713. goto elementContent
  7714. elementContent:
  7715. ;
  7716. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7717. if quant == int32(_XML_CQUANT_NONE) {
  7718. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7719. } else {
  7720. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7721. }
  7722. nxt = v86
  7723. myindex1 = _nextScaffoldPart(tls, parser)
  7724. if myindex1 < 0 {
  7725. return int32(_XML_ERROR_NO_MEMORY)
  7726. }
  7727. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7728. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7729. el = _getElementType(tls, parser, enc, s, nxt)
  7730. if !(el != 0) {
  7731. return int32(_XML_ERROR_NO_MEMORY)
  7732. }
  7733. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7734. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7735. nameLen = uint64(0)
  7736. for {
  7737. v88 = nameLen
  7738. nameLen++
  7739. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7740. break
  7741. }
  7742. goto _87
  7743. _87:
  7744. }
  7745. /* Detect and prevent integer overflow */
  7746. if nameLen > uint64(uint32(0xffffffff)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen) {
  7747. return int32(_XML_ERROR_NO_MEMORY)
  7748. }
  7749. *(*uint32)(unsafe.Pointer(dtd + 336)) += uint32(nameLen)
  7750. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7751. handleDefault = libc.Uint8FromInt32(0)
  7752. }
  7753. }
  7754. goto _64
  7755. _52:
  7756. ;
  7757. quant = int32(_XML_CQUANT_NONE)
  7758. goto closeGroup
  7759. _53:
  7760. ;
  7761. quant = int32(_XML_CQUANT_OPT)
  7762. goto closeGroup
  7763. _54:
  7764. ;
  7765. quant = int32(_XML_CQUANT_REP)
  7766. goto closeGroup
  7767. _55:
  7768. ;
  7769. quant = int32(_XML_CQUANT_PLUS)
  7770. goto closeGroup
  7771. closeGroup:
  7772. ;
  7773. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7774. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7775. handleDefault = libc.Uint8FromInt32(0)
  7776. }
  7777. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7778. (*(*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
  7779. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7780. if !(handleDefault != 0) {
  7781. model = _build_model(tls, parser)
  7782. if !(model != 0) {
  7783. return int32(_XML_ERROR_NO_MEMORY)
  7784. }
  7785. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7786. (*(*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)
  7787. }
  7788. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7789. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7790. }
  7791. }
  7792. goto _64
  7793. /* End element declaration stuff */
  7794. _56:
  7795. ;
  7796. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7797. return int32(_XML_ERROR_NO_MEMORY)
  7798. }
  7799. handleDefault = libc.Uint8FromInt32(0)
  7800. goto _64
  7801. _57:
  7802. ;
  7803. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7804. return int32(_XML_ERROR_NO_MEMORY)
  7805. }
  7806. handleDefault = libc.Uint8FromInt32(0)
  7807. goto _64
  7808. _58:
  7809. ;
  7810. switch tok {
  7811. case int32(m_XML_TOK_BOM):
  7812. handleDefault = libc.Uint8FromInt32(0)
  7813. break
  7814. }
  7815. goto _64
  7816. _59:
  7817. ;
  7818. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7819. handleDefault = libc.Uint8FromInt32(0)
  7820. }
  7821. goto _64
  7822. _60:
  7823. ;
  7824. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7825. handleDefault = libc.Uint8FromInt32(0)
  7826. }
  7827. goto _64
  7828. _61:
  7829. ;
  7830. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7831. handleDefault = libc.Uint8FromInt32(0)
  7832. }
  7833. goto _64
  7834. _62:
  7835. ;
  7836. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7837. handleDefault = libc.Uint8FromInt32(0)
  7838. }
  7839. goto _64
  7840. _63:
  7841. ;
  7842. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7843. handleDefault = libc.Uint8FromInt32(0)
  7844. }
  7845. goto _64
  7846. _64:
  7847. ; /* end of big switch */
  7848. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7849. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7850. }
  7851. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7852. case int32(_XML_SUSPENDED):
  7853. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7854. return int32(_XML_ERROR_NONE)
  7855. case int32(_XML_FINISHED):
  7856. return int32(_XML_ERROR_ABORTED)
  7857. default:
  7858. s = *(*uintptr)(unsafe.Pointer(bp))
  7859. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7860. }
  7861. goto _1
  7862. _1:
  7863. }
  7864. /* not reached */
  7865. return r
  7866. }
  7867. var _externalSubsetName = [2]TXML_Char{
  7868. 0: int8(m_ASCII_HASH),
  7869. }
  7870. var _atypeCDATA = [6]TXML_Char{
  7871. 0: int8(m_ASCII_C),
  7872. 1: int8(m_ASCII_D),
  7873. 2: int8(m_ASCII_A),
  7874. 3: int8(m_ASCII_T),
  7875. 4: int8(m_ASCII_A),
  7876. }
  7877. var _atypeID = [3]TXML_Char{
  7878. 0: int8(m_ASCII_I),
  7879. 1: int8(m_ASCII_D),
  7880. }
  7881. var _atypeIDREF = [6]TXML_Char{
  7882. 0: int8(m_ASCII_I),
  7883. 1: int8(m_ASCII_D),
  7884. 2: int8(m_ASCII_R),
  7885. 3: int8(m_ASCII_E),
  7886. 4: int8(m_ASCII_F),
  7887. }
  7888. var _atypeIDREFS = [7]TXML_Char{
  7889. 0: int8(m_ASCII_I),
  7890. 1: int8(m_ASCII_D),
  7891. 2: int8(m_ASCII_R),
  7892. 3: int8(m_ASCII_E),
  7893. 4: int8(m_ASCII_F),
  7894. 5: int8(m_ASCII_S),
  7895. }
  7896. var _atypeENTITY = [7]TXML_Char{
  7897. 0: int8(m_ASCII_E),
  7898. 1: int8(m_ASCII_N),
  7899. 2: int8(m_ASCII_T),
  7900. 3: int8(m_ASCII_I),
  7901. 4: int8(m_ASCII_T),
  7902. 5: int8(m_ASCII_Y),
  7903. }
  7904. var _atypeENTITIES = [9]TXML_Char{
  7905. 0: int8(m_ASCII_E),
  7906. 1: int8(m_ASCII_N),
  7907. 2: int8(m_ASCII_T),
  7908. 3: int8(m_ASCII_I),
  7909. 4: int8(m_ASCII_T),
  7910. 5: int8(m_ASCII_I),
  7911. 6: int8(m_ASCII_E),
  7912. 7: int8(m_ASCII_S),
  7913. }
  7914. var _atypeNMTOKEN = [8]TXML_Char{
  7915. 0: int8(m_ASCII_N),
  7916. 1: int8(m_ASCII_M),
  7917. 2: int8(m_ASCII_T),
  7918. 3: int8(m_ASCII_O),
  7919. 4: int8(m_ASCII_K),
  7920. 5: int8(m_ASCII_E),
  7921. 6: int8(m_ASCII_N),
  7922. }
  7923. var _atypeNMTOKENS = [9]TXML_Char{
  7924. 0: int8(m_ASCII_N),
  7925. 1: int8(m_ASCII_M),
  7926. 2: int8(m_ASCII_T),
  7927. 3: int8(m_ASCII_O),
  7928. 4: int8(m_ASCII_K),
  7929. 5: int8(m_ASCII_E),
  7930. 6: int8(m_ASCII_N),
  7931. 7: int8(m_ASCII_S),
  7932. }
  7933. var _notationPrefix = [10]TXML_Char{
  7934. 0: int8(m_ASCII_N),
  7935. 1: int8(m_ASCII_O),
  7936. 2: int8(m_ASCII_T),
  7937. 3: int8(m_ASCII_A),
  7938. 4: int8(m_ASCII_T),
  7939. 5: int8(m_ASCII_I),
  7940. 6: int8(m_ASCII_O),
  7941. 7: int8(m_ASCII_N),
  7942. 8: int8(m_ASCII_LPAREN),
  7943. }
  7944. var _enumValueSep = [2]TXML_Char{
  7945. 0: int8(m_ASCII_PIPE),
  7946. }
  7947. var _enumValueStart = [2]TXML_Char{
  7948. 0: int8(m_ASCII_LPAREN),
  7949. }
  7950. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7951. bp := tls.Alloc(16)
  7952. defer tls.Free(16)
  7953. var tok int32
  7954. var v2 uintptr
  7955. var _ /* next at bp+0 */ uintptr
  7956. _, _ = tok, v2
  7957. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7958. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7959. for {
  7960. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7961. 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)
  7962. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  7963. _accountingOnAbort(tls, parser)
  7964. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7965. }
  7966. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7967. switch tok {
  7968. /* report partial linebreak - it might be the last token */
  7969. case -int32(m_XML_TOK_PROLOG_S):
  7970. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7971. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7972. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7973. return int32(_XML_ERROR_ABORTED)
  7974. }
  7975. }
  7976. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7977. return int32(_XML_ERROR_NONE)
  7978. case -int32(4):
  7979. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7980. return int32(_XML_ERROR_NONE)
  7981. case int32(m_XML_TOK_PROLOG_S):
  7982. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7983. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7984. }
  7985. case int32(m_XML_TOK_PI):
  7986. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7987. return int32(_XML_ERROR_NO_MEMORY)
  7988. }
  7989. case int32(m_XML_TOK_COMMENT):
  7990. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7991. return int32(_XML_ERROR_NO_MEMORY)
  7992. }
  7993. case m_XML_TOK_INVALID:
  7994. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7995. return int32(_XML_ERROR_INVALID_TOKEN)
  7996. case -int32(1):
  7997. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7998. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7999. return int32(_XML_ERROR_NONE)
  8000. }
  8001. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  8002. case -int32(2):
  8003. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  8004. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  8005. return int32(_XML_ERROR_NONE)
  8006. }
  8007. return int32(_XML_ERROR_PARTIAL_CHAR)
  8008. default:
  8009. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  8010. }
  8011. v2 = *(*uintptr)(unsafe.Pointer(bp))
  8012. s = v2
  8013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  8014. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  8015. case int32(_XML_SUSPENDED):
  8016. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  8017. return int32(_XML_ERROR_NONE)
  8018. case int32(_XML_FINISHED):
  8019. return int32(_XML_ERROR_ABORTED)
  8020. default:
  8021. }
  8022. goto _1
  8023. _1:
  8024. }
  8025. return r
  8026. }
  8027. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  8028. bp := tls.Alloc(16)
  8029. defer tls.Free(16)
  8030. var openEntity, textEnd, textStart uintptr
  8031. var result _XML_Error
  8032. var tok int32
  8033. var _ /* next at bp+0 */ uintptr
  8034. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  8035. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  8036. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8038. } else {
  8039. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  8040. if !(openEntity != 0) {
  8041. return int32(_XML_ERROR_NO_MEMORY)
  8042. }
  8043. }
  8044. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8045. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  8046. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  8047. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  8049. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  8050. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  8051. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  8052. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  8053. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  8054. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  8055. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8056. /* Set a safe default value in case 'next' does not get set */
  8057. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8058. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8059. 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)
  8060. 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))
  8061. } else {
  8062. 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))
  8063. }
  8064. if result == int32(_XML_ERROR_NONE) {
  8065. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8066. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  8067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  8068. } else {
  8069. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  8070. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8072. /* put openEntity back in list of free instances */
  8073. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8075. }
  8076. }
  8077. return result
  8078. }
  8079. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8080. bp := tls.Alloc(16)
  8081. defer tls.Free(16)
  8082. var entity, openEntity, textEnd, textStart uintptr
  8083. var result _XML_Error
  8084. var tok, tok1, v1 int32
  8085. var _ /* next at bp+0 */ uintptr
  8086. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  8087. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8088. if !(openEntity != 0) {
  8089. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8090. }
  8091. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  8092. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  8093. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8094. /* Set a safe default value in case 'next' does not get set */
  8095. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8096. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8097. 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)
  8098. 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))
  8099. } else {
  8100. 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))
  8101. }
  8102. if result != int32(_XML_ERROR_NONE) {
  8103. return result
  8104. }
  8105. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8106. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  8107. return result
  8108. }
  8109. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8110. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8112. /* put openEntity back in list of free instances */
  8113. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8115. // If there are more open entities we want to stop right here and have the
  8116. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8117. // be ignored altogether.
  8118. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8119. return int32(_XML_ERROR_NONE)
  8120. }
  8121. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8123. 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)
  8124. 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))
  8125. } else {
  8126. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8127. /* see externalEntityContentProcessor vs contentProcessor */
  8128. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8129. v1 = int32(1)
  8130. } else {
  8131. v1 = 0
  8132. }
  8133. 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))
  8134. if result == int32(_XML_ERROR_NONE) {
  8135. if !(_storeRawNames(tls, parser) != 0) {
  8136. return int32(_XML_ERROR_NO_MEMORY)
  8137. }
  8138. }
  8139. return result
  8140. }
  8141. return r
  8142. }
  8143. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8144. _ = s
  8145. _ = end
  8146. _ = nextPtr
  8147. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8148. }
  8149. 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) {
  8150. var result _XML_Error
  8151. var v1 int32
  8152. var v2, v3 uintptr
  8153. _, _, _, _ = result, v1, v2, v3
  8154. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8155. if result != 0 {
  8156. return result
  8157. }
  8158. 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) {
  8159. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8160. }
  8161. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8162. v1 = 0
  8163. } else {
  8164. v3 = pool + 24
  8165. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8166. *(*uintptr)(unsafe.Pointer(v3))++
  8167. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8168. v1 = libc.Int32FromInt32(1)
  8169. }
  8170. if !(v1 != 0) {
  8171. return int32(_XML_ERROR_NO_MEMORY)
  8172. }
  8173. return int32(_XML_ERROR_NONE)
  8174. }
  8175. 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) {
  8176. bp := tls.Alloc(16)
  8177. defer tls.Free(16)
  8178. var checkEntityDecl int8
  8179. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8180. var i, n, tok, v12, v3, v6, v9 int32
  8181. var result _XML_Error
  8182. var v13 bool
  8183. var _ /* buf at bp+8 */ [4]TXML_Char
  8184. var _ /* ch at bp+12 */ TXML_Char
  8185. var _ /* next at bp+0 */ uintptr
  8186. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8187. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8188. for {
  8189. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8190. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  8191. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8192. _accountingOnAbort(tls, parser)
  8193. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8194. }
  8195. switch tok {
  8196. case -int32(4):
  8197. return int32(_XML_ERROR_NONE)
  8198. case m_XML_TOK_INVALID:
  8199. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8200. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8201. }
  8202. return int32(_XML_ERROR_INVALID_TOKEN)
  8203. case -int32(1):
  8204. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8205. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8206. }
  8207. return int32(_XML_ERROR_INVALID_TOKEN)
  8208. case int32(m_XML_TOK_CHAR_REF):
  8209. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8210. if n < 0 {
  8211. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8212. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8213. }
  8214. return int32(_XML_ERROR_BAD_CHAR_REF)
  8215. }
  8216. 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)) {
  8217. break
  8218. }
  8219. n = XXmlUtf8Encode(tls, n, bp+8)
  8220. /* The XmlEncode() functions can never return 0 here. That
  8221. * error return happens if the code point passed in is either
  8222. * negative or greater than or equal to 0x110000. The
  8223. * XmlCharRefNumber() functions will all return a number
  8224. * strictly less than 0x110000 or a negative value if an error
  8225. * occurred. The negative value is intercepted above, so
  8226. * XmlEncode() is never passed a value it might return an
  8227. * error for.
  8228. */
  8229. i = 0
  8230. for {
  8231. if !(i < n) {
  8232. break
  8233. }
  8234. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8235. v3 = 0
  8236. } else {
  8237. v5 = pool + 24
  8238. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8239. *(*uintptr)(unsafe.Pointer(v5))++
  8240. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8241. v3 = libc.Int32FromInt32(1)
  8242. }
  8243. if !(v3 != 0) {
  8244. return int32(_XML_ERROR_NO_MEMORY)
  8245. }
  8246. goto _2
  8247. _2:
  8248. ;
  8249. i++
  8250. }
  8251. case int32(m_XML_TOK_DATA_CHARS):
  8252. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8253. return int32(_XML_ERROR_NO_MEMORY)
  8254. }
  8255. case -int32(3):
  8256. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8257. /* fall through */
  8258. fallthrough
  8259. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8260. fallthrough
  8261. case int32(m_XML_TOK_DATA_NEWLINE):
  8262. 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)) {
  8263. break
  8264. }
  8265. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8266. v6 = 0
  8267. } else {
  8268. v8 = pool + 24
  8269. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8270. *(*uintptr)(unsafe.Pointer(v8))++
  8271. *(*TXML_Char)(unsafe.Pointer(v7)) = int8(0x20)
  8272. v6 = libc.Int32FromInt32(1)
  8273. }
  8274. if !(v6 != 0) {
  8275. return int32(_XML_ERROR_NO_MEMORY)
  8276. }
  8277. case int32(m_XML_TOK_ENTITY_REF):
  8278. *(*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)))
  8279. if *(*TXML_Char)(unsafe.Pointer(bp + 12)) != 0 {
  8280. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8281. * so there is no amplification and hence recording without
  8282. * protection. */
  8283. _accountingDiffTolerated(tls, parser, tok, bp+12, bp+12+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8284. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8285. v9 = 0
  8286. } else {
  8287. v11 = pool + 24
  8288. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8289. *(*uintptr)(unsafe.Pointer(v11))++
  8290. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 12))
  8291. v9 = libc.Int32FromInt32(1)
  8292. }
  8293. if !(v9 != 0) {
  8294. return int32(_XML_ERROR_NO_MEMORY)
  8295. }
  8296. break
  8297. }
  8298. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8299. if !(name != 0) {
  8300. return int32(_XML_ERROR_NO_MEMORY)
  8301. }
  8302. entity = _lookup(tls, parser, dtd, name, uint64(0))
  8303. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  8304. /* First, determine if a check for an existing declaration is needed;
  8305. if yes, check that the entity exists, and that it is internal.
  8306. */
  8307. if pool == dtd+160 { /* are we called from prolog? */
  8308. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8309. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8310. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8311. } else {
  8312. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8313. }
  8314. }
  8315. checkEntityDecl = libc.BoolInt8(v13 && v12 != 0)
  8316. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8317. checkEntityDecl = libc.BoolInt8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8318. }
  8319. if checkEntityDecl != 0 {
  8320. if !(entity != 0) {
  8321. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8322. } else {
  8323. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8324. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8325. }
  8326. }
  8327. } else {
  8328. if !(entity != 0) {
  8329. /* Cannot report skipped entity here - see comments on
  8330. parser->m_skippedEntityHandler.
  8331. if (parser->m_skippedEntityHandler)
  8332. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8333. */
  8334. /* Cannot call the default handler because this would be
  8335. out of sync with the call to the startElementHandler.
  8336. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8337. reportDefault(parser, enc, ptr, next);
  8338. */
  8339. break
  8340. }
  8341. }
  8342. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8343. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8344. /* It does not appear that this line can be executed.
  8345. *
  8346. * The "if (entity->open)" check catches recursive entity
  8347. * definitions. In order to be called with an open
  8348. * entity, it must have gone through this code before and
  8349. * been through the recursive call to
  8350. * appendAttributeValue() some lines below. That call
  8351. * sets the local encoding ("enc") to the parser's
  8352. * internal encoding (internal_utf8 or internal_utf16),
  8353. * which can never be the same as the principle encoding.
  8354. * It doesn't appear there is another code path that gets
  8355. * here with entity->open being TRUE.
  8356. *
  8357. * Since it is not certain that this logic is watertight,
  8358. * we keep the line and merely exclude it from coverage
  8359. * tests.
  8360. */
  8361. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8362. }
  8363. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8364. }
  8365. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8366. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8367. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8368. }
  8369. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8370. }
  8371. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8372. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8373. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8374. }
  8375. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8376. } else {
  8377. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8378. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8379. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8380. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8381. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8382. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8383. if result != 0 {
  8384. return result
  8385. }
  8386. }
  8387. default:
  8388. /* The only token returned by XmlAttributeValueTok() that does
  8389. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8390. * Getting that would require an entity name to contain an
  8391. * incomplete XML character (e.g. \xE2\x82); however previous
  8392. * tokenisers will have already recognised and rejected such
  8393. * names before XmlAttributeValueTok() gets a look-in. This
  8394. * default case should be retained as a safety net, but the code
  8395. * excluded from coverage tests.
  8396. *
  8397. * LCOV_EXCL_START
  8398. */
  8399. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8400. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8401. }
  8402. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8403. /* LCOV_EXCL_STOP */
  8404. }
  8405. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8406. goto _1
  8407. _1:
  8408. }
  8409. /* not reached */
  8410. return r
  8411. }
  8412. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8413. bp := tls.Alloc(16)
  8414. defer tls.Free(16)
  8415. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8416. var i, n, oldInEntityValue, tok int32
  8417. var result _XML_Error
  8418. var _ /* buf at bp+8 */ [4]TXML_Char
  8419. var _ /* next at bp+0 */ uintptr
  8420. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8421. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8422. pool = dtd + 208
  8423. result = int32(_XML_ERROR_NONE)
  8424. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8425. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8426. /* never return Null for the value argument in EntityDeclHandler,
  8427. since this would indicate an external entity; therefore we
  8428. have to make sure that entityValuePool.start is not null */
  8429. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8430. if !(_poolGrow(tls, pool) != 0) {
  8431. return int32(_XML_ERROR_NO_MEMORY)
  8432. }
  8433. }
  8434. for {
  8435. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8436. 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)
  8437. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8438. _accountingOnAbort(tls, parser)
  8439. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8440. goto endEntityValue
  8441. }
  8442. switch tok {
  8443. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8444. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8445. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8446. if !(name != 0) {
  8447. result = int32(_XML_ERROR_NO_MEMORY)
  8448. goto endEntityValue
  8449. }
  8450. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  8451. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8452. if !(entity != 0) {
  8453. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8454. /* cannot report skipped entity here - see comments on
  8455. parser->m_skippedEntityHandler
  8456. if (parser->m_skippedEntityHandler)
  8457. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8458. */
  8459. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8460. goto endEntityValue
  8461. }
  8462. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8463. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8464. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8465. }
  8466. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8467. goto endEntityValue
  8468. }
  8469. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8470. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8471. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8472. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8473. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8474. 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) {
  8475. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8476. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8477. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8478. goto endEntityValue
  8479. }
  8480. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8481. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8482. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8483. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8484. }
  8485. } else {
  8486. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8487. }
  8488. } else {
  8489. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8490. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8491. 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))
  8492. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8493. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8494. if result != 0 {
  8495. goto endEntityValue
  8496. }
  8497. }
  8498. break
  8499. }
  8500. /* In the internal subset, PE references are not legal
  8501. within markup declarations, e.g entity values in this case. */
  8502. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8503. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8504. goto endEntityValue
  8505. case -int32(4):
  8506. result = int32(_XML_ERROR_NONE)
  8507. goto endEntityValue
  8508. case int32(m_XML_TOK_ENTITY_REF):
  8509. fallthrough
  8510. case int32(m_XML_TOK_DATA_CHARS):
  8511. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8512. result = int32(_XML_ERROR_NO_MEMORY)
  8513. goto endEntityValue
  8514. }
  8515. case -int32(3):
  8516. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8517. /* fall through */
  8518. fallthrough
  8519. case int32(m_XML_TOK_DATA_NEWLINE):
  8520. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8521. result = int32(_XML_ERROR_NO_MEMORY)
  8522. goto endEntityValue
  8523. }
  8524. v3 = pool + 24
  8525. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8526. *(*uintptr)(unsafe.Pointer(v3))++
  8527. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8528. case int32(m_XML_TOK_CHAR_REF):
  8529. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8530. if n < 0 {
  8531. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8532. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8533. }
  8534. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8535. goto endEntityValue
  8536. }
  8537. n = XXmlUtf8Encode(tls, n, bp+8)
  8538. /* The XmlEncode() functions can never return 0 here. That
  8539. * error return happens if the code point passed in is either
  8540. * negative or greater than or equal to 0x110000. The
  8541. * XmlCharRefNumber() functions will all return a number
  8542. * strictly less than 0x110000 or a negative value if an error
  8543. * occurred. The negative value is intercepted above, so
  8544. * XmlEncode() is never passed a value it might return an
  8545. * error for.
  8546. */
  8547. i = 0
  8548. for {
  8549. if !(i < n) {
  8550. break
  8551. }
  8552. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8553. result = int32(_XML_ERROR_NO_MEMORY)
  8554. goto endEntityValue
  8555. }
  8556. v6 = pool + 24
  8557. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8558. *(*uintptr)(unsafe.Pointer(v6))++
  8559. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8560. goto _4
  8561. _4:
  8562. ;
  8563. i++
  8564. }
  8565. case -int32(1):
  8566. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8567. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8568. }
  8569. result = int32(_XML_ERROR_INVALID_TOKEN)
  8570. goto endEntityValue
  8571. case m_XML_TOK_INVALID:
  8572. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8573. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8574. }
  8575. result = int32(_XML_ERROR_INVALID_TOKEN)
  8576. goto endEntityValue
  8577. default:
  8578. /* This default case should be unnecessary -- all the tokens
  8579. * that XmlEntityValueTok() can return have their own explicit
  8580. * cases -- but should be retained for safety. We do however
  8581. * exclude it from the coverage statistics.
  8582. *
  8583. * LCOV_EXCL_START
  8584. */
  8585. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8586. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8587. }
  8588. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8589. goto endEntityValue
  8590. /* LCOV_EXCL_STOP */
  8591. }
  8592. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8593. goto _1
  8594. _1:
  8595. }
  8596. goto endEntityValue
  8597. endEntityValue:
  8598. ;
  8599. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8600. return result
  8601. }
  8602. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8603. var p, v2, v3, v4, v5 uintptr
  8604. _, _, _, _, _ = p, v2, v3, v4, v5
  8605. for {
  8606. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8607. return
  8608. }
  8609. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8610. break
  8611. }
  8612. goto _1
  8613. _1:
  8614. ;
  8615. s++
  8616. }
  8617. p = s
  8618. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8619. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8620. v2 = p
  8621. p++
  8622. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8623. s++
  8624. v3 = s
  8625. if int32(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8626. s++
  8627. }
  8628. } else {
  8629. v4 = p
  8630. p++
  8631. v5 = s
  8632. s++
  8633. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8634. }
  8635. }
  8636. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  8637. }
  8638. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8639. var data, target, tem uintptr
  8640. _, _, _ = data, target, tem
  8641. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8642. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8643. _reportDefault(tls, parser, enc, start, end)
  8644. }
  8645. return int32(1)
  8646. }
  8647. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8648. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8649. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8650. if !(target != 0) {
  8651. return 0
  8652. }
  8653. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8654. 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)))
  8655. if !(data != 0) {
  8656. return 0
  8657. }
  8658. _normalizeLines(tls, data)
  8659. (*(*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)
  8660. _poolClear(tls, parser+784)
  8661. return int32(1)
  8662. }
  8663. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8664. var data uintptr
  8665. _ = data
  8666. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8667. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8668. _reportDefault(tls, parser, enc, start, end)
  8669. }
  8670. return int32(1)
  8671. }
  8672. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8673. if !(data != 0) {
  8674. return 0
  8675. }
  8676. _normalizeLines(tls, data)
  8677. (*(*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)
  8678. _poolClear(tls, parser+784)
  8679. return int32(1)
  8680. }
  8681. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8682. bp := tls.Alloc(16)
  8683. defer tls.Free(16)
  8684. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8685. var convert_res _XML_Convert_Result
  8686. var eventEndPP, eventPP uintptr
  8687. var _ /* dataPtr at bp+8 */ uintptr
  8688. _, _, _ = convert_res, eventEndPP, eventPP
  8689. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8690. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8691. eventPP = parser + 544
  8692. eventEndPP = parser + 552
  8693. } else {
  8694. /* To get here, two things must be true; the parser must be
  8695. * using a character encoding that is not the same as the
  8696. * encoding passed in, and the encoding passed in must need
  8697. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8698. * is defined). The only occasions on which the encoding passed
  8699. * in is not the same as the parser's encoding are when it is
  8700. * the internal encoding (e.g. a previously defined parameter
  8701. * entity, already converted to internal format). This by
  8702. * definition doesn't need conversion, so the whole branch never
  8703. * gets executed.
  8704. *
  8705. * For safety's sake we don't delete these lines and merely
  8706. * exclude them from coverage statistics.
  8707. *
  8708. * LCOV_EXCL_START
  8709. */
  8710. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8711. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8712. /* LCOV_EXCL_STOP */
  8713. }
  8714. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8715. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8716. 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)
  8717. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8718. (*(*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)))
  8719. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8720. }
  8721. } else {
  8722. (*(*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)))))
  8723. }
  8724. }
  8725. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8726. var att, temp uintptr
  8727. var count, i int32
  8728. _, _, _, _ = att, count, i, temp
  8729. if value != 0 || isId != 0 {
  8730. i = 0
  8731. for {
  8732. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8733. break
  8734. }
  8735. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8736. return int32(1)
  8737. }
  8738. goto _1
  8739. _1:
  8740. ;
  8741. i++
  8742. }
  8743. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8744. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8745. }
  8746. }
  8747. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8748. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8749. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8750. (*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))
  8751. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8752. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8753. return 0
  8754. }
  8755. } else {
  8756. /* Detect and prevent integer overflow */
  8757. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m_INT_MAX)/libc.Int32FromInt32(2) {
  8758. return 0
  8759. }
  8760. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8761. /* Detect and prevent integer overflow.
  8762. * The preprocessor guard addresses the "always false" warning
  8763. * from -Wtype-limits on platforms where
  8764. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8765. 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))
  8766. if temp == libc.UintptrFromInt32(0) {
  8767. return 0
  8768. }
  8769. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8770. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8771. }
  8772. }
  8773. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8774. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8775. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8776. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8777. if !(isCdata != 0) {
  8778. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8779. }
  8780. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8781. return int32(1)
  8782. }
  8783. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8784. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8785. var v3, v6 int32
  8786. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8787. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8788. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8789. for {
  8790. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8791. break
  8792. }
  8793. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8794. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8795. for {
  8796. if !(s != name) {
  8797. break
  8798. }
  8799. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8800. v3 = 0
  8801. } else {
  8802. v5 = dtd + 160 + 24
  8803. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8804. *(*uintptr)(unsafe.Pointer(v5))++
  8805. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8806. v3 = libc.Int32FromInt32(1)
  8807. }
  8808. if !(v3 != 0) {
  8809. return 0
  8810. }
  8811. goto _2
  8812. _2:
  8813. ;
  8814. s++
  8815. }
  8816. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8817. v6 = 0
  8818. } else {
  8819. v8 = dtd + 160 + 24
  8820. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8821. *(*uintptr)(unsafe.Pointer(v8))++
  8822. *(*TXML_Char)(unsafe.Pointer(v7)) = int8('\000')
  8823. v6 = libc.Int32FromInt32(1)
  8824. }
  8825. if !(v6 != 0) {
  8826. return 0
  8827. }
  8828. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8829. if !(prefix != 0) {
  8830. return 0
  8831. }
  8832. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8833. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8834. } else {
  8835. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8836. }
  8837. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8838. break
  8839. }
  8840. goto _1
  8841. _1:
  8842. ;
  8843. name++
  8844. }
  8845. return int32(1)
  8846. }
  8847. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8848. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8849. var i, j, v1, v6, v9 int32
  8850. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8851. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8852. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8853. v1 = 0
  8854. } else {
  8855. v3 = dtd + 160 + 24
  8856. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8857. *(*uintptr)(unsafe.Pointer(v3))++
  8858. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8859. v1 = libc.Int32FromInt32(1)
  8860. }
  8861. if !(v1 != 0) {
  8862. return libc.UintptrFromInt32(0)
  8863. }
  8864. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8865. if !(name != 0) {
  8866. return libc.UintptrFromInt32(0)
  8867. }
  8868. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8869. name++
  8870. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8871. if !(id != 0) {
  8872. return libc.UintptrFromInt32(0)
  8873. }
  8874. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8875. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8876. } else {
  8877. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8878. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8879. 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)) {
  8880. if int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8881. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  8882. } else {
  8883. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  8884. }
  8885. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8886. } else {
  8887. i = 0
  8888. for {
  8889. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8890. break
  8891. }
  8892. /* attributes without prefix are *not* in the default namespace */
  8893. if int32(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8894. j = 0
  8895. for {
  8896. if !(j < i) {
  8897. break
  8898. }
  8899. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8900. v6 = 0
  8901. } else {
  8902. v8 = dtd + 160 + 24
  8903. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8904. *(*uintptr)(unsafe.Pointer(v8))++
  8905. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8906. v6 = libc.Int32FromInt32(1)
  8907. }
  8908. if !(v6 != 0) {
  8909. return libc.UintptrFromInt32(0)
  8910. }
  8911. goto _5
  8912. _5:
  8913. ;
  8914. j++
  8915. }
  8916. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8917. v9 = 0
  8918. } else {
  8919. v11 = dtd + 160 + 24
  8920. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8921. *(*uintptr)(unsafe.Pointer(v11))++
  8922. *(*TXML_Char)(unsafe.Pointer(v10)) = int8('\000')
  8923. v9 = libc.Int32FromInt32(1)
  8924. }
  8925. if !(v9 != 0) {
  8926. return libc.UintptrFromInt32(0)
  8927. }
  8928. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8929. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8930. return libc.UintptrFromInt32(0)
  8931. }
  8932. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8933. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8934. } else {
  8935. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8936. }
  8937. break
  8938. }
  8939. goto _4
  8940. _4:
  8941. ;
  8942. i++
  8943. }
  8944. }
  8945. }
  8946. }
  8947. return id
  8948. }
  8949. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8950. bp := tls.Alloc(16)
  8951. defer tls.Free(16)
  8952. 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
  8953. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8954. var needSep TXML_Bool
  8955. var v12, v28 bool
  8956. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8957. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8958. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8959. needSep = libc.Uint8FromInt32(0)
  8960. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8961. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8962. v1 = 0
  8963. } else {
  8964. v3 = parser + 784 + 24
  8965. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8966. *(*uintptr)(unsafe.Pointer(v3))++
  8967. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(m_ASCII_EQUALS)
  8968. v1 = libc.Int32FromInt32(1)
  8969. }
  8970. if !(v1 != 0) {
  8971. return libc.UintptrFromInt32(0)
  8972. }
  8973. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8974. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8975. len1--
  8976. }
  8977. i = 0
  8978. for {
  8979. if !(i < len1) {
  8980. break
  8981. }
  8982. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8983. v5 = 0
  8984. } else {
  8985. v7 = parser + 784 + 24
  8986. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8987. *(*uintptr)(unsafe.Pointer(v7))++
  8988. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8989. v5 = libc.Int32FromInt32(1)
  8990. }
  8991. if !(v5 != 0) {
  8992. /* Because of memory caching, I don't believe this line can be
  8993. * executed.
  8994. *
  8995. * This is part of a loop copying the default prefix binding
  8996. * URI into the parser's temporary string pool. Previously,
  8997. * that URI was copied into the same string pool, with a
  8998. * terminating NUL character, as part of setContext(). When
  8999. * the pool was cleared, that leaves a block definitely big
  9000. * enough to hold the URI on the free block list of the pool.
  9001. * The URI copy in getContext() therefore cannot run out of
  9002. * memory.
  9003. *
  9004. * If the pool is used between the setContext() and
  9005. * getContext() calls, the worst it can do is leave a bigger
  9006. * block on the front of the free list. Given that this is
  9007. * all somewhat inobvious and program logic can be changed, we
  9008. * don't delete the line but we do exclude it from the test
  9009. * coverage statistics.
  9010. */
  9011. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9012. }
  9013. goto _4
  9014. _4:
  9015. ;
  9016. i++
  9017. }
  9018. needSep = libc.Uint8FromInt32(1)
  9019. }
  9020. _hashTableIterInit(tls, bp, dtd+120)
  9021. for {
  9022. prefix = _hashTableIterNext(tls, bp)
  9023. if !(prefix != 0) {
  9024. break
  9025. }
  9026. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  9027. /* This test appears to be (justifiable) paranoia. There does
  9028. * not seem to be a way of injecting a prefix without a binding
  9029. * that doesn't get errored long before this function is called.
  9030. * The test should remain for safety's sake, so we instead
  9031. * exclude the following line from the coverage statistics.
  9032. */
  9033. goto _8 /* LCOV_EXCL_LINE */
  9034. }
  9035. if v12 = needSep != 0; v12 {
  9036. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9037. v9 = 0
  9038. } else {
  9039. v11 = parser + 784 + 24
  9040. v10 = *(*uintptr)(unsafe.Pointer(v11))
  9041. *(*uintptr)(unsafe.Pointer(v11))++
  9042. *(*TXML_Char)(unsafe.Pointer(v10)) = int8(m_ASCII_FF)
  9043. v9 = libc.Int32FromInt32(1)
  9044. }
  9045. }
  9046. if v12 && !(v9 != 0) {
  9047. return libc.UintptrFromInt32(0)
  9048. }
  9049. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  9050. for {
  9051. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9052. break
  9053. }
  9054. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9055. v14 = 0
  9056. } else {
  9057. v16 = parser + 784 + 24
  9058. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9059. *(*uintptr)(unsafe.Pointer(v16))++
  9060. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9061. v14 = libc.Int32FromInt32(1)
  9062. }
  9063. if !(v14 != 0) {
  9064. return libc.UintptrFromInt32(0)
  9065. }
  9066. goto _13
  9067. _13:
  9068. ;
  9069. s++
  9070. }
  9071. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9072. v17 = 0
  9073. } else {
  9074. v19 = parser + 784 + 24
  9075. v18 = *(*uintptr)(unsafe.Pointer(v19))
  9076. *(*uintptr)(unsafe.Pointer(v19))++
  9077. *(*TXML_Char)(unsafe.Pointer(v18)) = int8(m_ASCII_EQUALS)
  9078. v17 = libc.Int32FromInt32(1)
  9079. }
  9080. if !(v17 != 0) {
  9081. return libc.UintptrFromInt32(0)
  9082. }
  9083. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  9084. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  9085. len11--
  9086. }
  9087. i1 = 0
  9088. for {
  9089. if !(i1 < len11) {
  9090. break
  9091. }
  9092. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9093. v21 = 0
  9094. } else {
  9095. v23 = parser + 784 + 24
  9096. v22 = *(*uintptr)(unsafe.Pointer(v23))
  9097. *(*uintptr)(unsafe.Pointer(v23))++
  9098. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  9099. v21 = libc.Int32FromInt32(1)
  9100. }
  9101. if !(v21 != 0) {
  9102. return libc.UintptrFromInt32(0)
  9103. }
  9104. goto _20
  9105. _20:
  9106. ;
  9107. i1++
  9108. }
  9109. needSep = libc.Uint8FromInt32(1)
  9110. goto _8
  9111. _8:
  9112. }
  9113. _hashTableIterInit(tls, bp, dtd)
  9114. for {
  9115. e = _hashTableIterNext(tls, bp)
  9116. if !(e != 0) {
  9117. break
  9118. }
  9119. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9120. goto _24
  9121. }
  9122. if v28 = needSep != 0; v28 {
  9123. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9124. v25 = 0
  9125. } else {
  9126. v27 = parser + 784 + 24
  9127. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9128. *(*uintptr)(unsafe.Pointer(v27))++
  9129. *(*TXML_Char)(unsafe.Pointer(v26)) = int8(m_ASCII_FF)
  9130. v25 = libc.Int32FromInt32(1)
  9131. }
  9132. }
  9133. if v28 && !(v25 != 0) {
  9134. return libc.UintptrFromInt32(0)
  9135. }
  9136. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9137. for {
  9138. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9139. break
  9140. }
  9141. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9142. v30 = 0
  9143. } else {
  9144. v32 = parser + 784 + 24
  9145. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9146. *(*uintptr)(unsafe.Pointer(v32))++
  9147. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9148. v30 = libc.Int32FromInt32(1)
  9149. }
  9150. if !(v30 != 0) {
  9151. return uintptr(0)
  9152. }
  9153. goto _29
  9154. _29:
  9155. ;
  9156. s1++
  9157. }
  9158. needSep = libc.Uint8FromInt32(1)
  9159. goto _24
  9160. _24:
  9161. }
  9162. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9163. v33 = 0
  9164. } else {
  9165. v35 = parser + 784 + 24
  9166. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9167. *(*uintptr)(unsafe.Pointer(v35))++
  9168. *(*TXML_Char)(unsafe.Pointer(v34)) = int8('\000')
  9169. v33 = libc.Int32FromInt32(1)
  9170. }
  9171. if !(v33 != 0) {
  9172. return libc.UintptrFromInt32(0)
  9173. }
  9174. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9175. }
  9176. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9177. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9178. var v1, v11, v14, v4, v8 int32
  9179. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9180. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9181. s = context
  9182. for int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9183. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9184. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9185. v1 = 0
  9186. } else {
  9187. v3 = parser + 784 + 24
  9188. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9189. *(*uintptr)(unsafe.Pointer(v3))++
  9190. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  9191. v1 = libc.Int32FromInt32(1)
  9192. }
  9193. if !(v1 != 0) {
  9194. return libc.Uint8FromInt32(0)
  9195. }
  9196. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  9197. if e != 0 {
  9198. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9199. }
  9200. if int32(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9201. s++
  9202. }
  9203. context = s
  9204. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9205. } else {
  9206. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9207. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  9208. prefix = dtd + 304
  9209. } else {
  9210. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9211. v4 = 0
  9212. } else {
  9213. v6 = parser + 784 + 24
  9214. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9215. *(*uintptr)(unsafe.Pointer(v6))++
  9216. *(*TXML_Char)(unsafe.Pointer(v5)) = int8('\000')
  9217. v4 = libc.Int32FromInt32(1)
  9218. }
  9219. if !(v4 != 0) {
  9220. return libc.Uint8FromInt32(0)
  9221. }
  9222. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  9223. if !(prefix != 0) {
  9224. return libc.Uint8FromInt32(0)
  9225. }
  9226. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  9227. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9228. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9229. return libc.Uint8FromInt32(0)
  9230. }
  9231. }
  9232. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9233. }
  9234. context = s + uintptr(1)
  9235. for {
  9236. if !(int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9237. break
  9238. }
  9239. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9240. v8 = 0
  9241. } else {
  9242. v10 = parser + 784 + 24
  9243. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9244. *(*uintptr)(unsafe.Pointer(v10))++
  9245. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9246. v8 = libc.Int32FromInt32(1)
  9247. }
  9248. if !(v8 != 0) {
  9249. return libc.Uint8FromInt32(0)
  9250. }
  9251. goto _7
  9252. _7:
  9253. ;
  9254. context++
  9255. }
  9256. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9257. v11 = 0
  9258. } else {
  9259. v13 = parser + 784 + 24
  9260. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9261. *(*uintptr)(unsafe.Pointer(v13))++
  9262. *(*TXML_Char)(unsafe.Pointer(v12)) = int8('\000')
  9263. v11 = libc.Int32FromInt32(1)
  9264. }
  9265. if !(v11 != 0) {
  9266. return libc.Uint8FromInt32(0)
  9267. }
  9268. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  9269. return libc.Uint8FromInt32(0)
  9270. }
  9271. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9272. if int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9273. context++
  9274. }
  9275. s = context
  9276. } else {
  9277. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9278. v14 = 0
  9279. } else {
  9280. v16 = parser + 784 + 24
  9281. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9282. *(*uintptr)(unsafe.Pointer(v16))++
  9283. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9284. v14 = libc.Int32FromInt32(1)
  9285. }
  9286. if !(v14 != 0) {
  9287. return libc.Uint8FromInt32(0)
  9288. }
  9289. s++
  9290. }
  9291. }
  9292. }
  9293. return libc.Uint8FromInt32(1)
  9294. }
  9295. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9296. var p, s, v2, v3 uintptr
  9297. _, _, _, _ = p, s, v2, v3
  9298. p = publicId
  9299. s = publicId
  9300. for {
  9301. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9302. break
  9303. }
  9304. switch int32(*(*TXML_Char)(unsafe.Pointer(s))) {
  9305. case int32(0x20):
  9306. fallthrough
  9307. case int32(0xD):
  9308. fallthrough
  9309. case int32(0xA):
  9310. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9311. v2 = p
  9312. p++
  9313. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0x20)
  9314. }
  9315. default:
  9316. v3 = p
  9317. p++
  9318. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9319. }
  9320. goto _1
  9321. _1:
  9322. ;
  9323. s++
  9324. }
  9325. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9326. p--
  9327. }
  9328. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  9329. }
  9330. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9331. var p uintptr
  9332. _ = p
  9333. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  9334. if p == libc.UintptrFromInt32(0) {
  9335. return p
  9336. }
  9337. _poolInit(tls, p+160, ms)
  9338. _poolInit(tls, p+208, ms)
  9339. _hashTableInit(tls, p, ms)
  9340. _hashTableInit(tls, p+40, ms)
  9341. _hashTableInit(tls, p+80, ms)
  9342. _hashTableInit(tls, p+120, ms)
  9343. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9344. _hashTableInit(tls, p+264, ms)
  9345. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9346. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9347. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9348. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9349. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9350. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9351. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9352. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9353. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9354. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9355. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9356. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9357. return p
  9358. }
  9359. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9360. bp := tls.Alloc(16)
  9361. defer tls.Free(16)
  9362. var e uintptr
  9363. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9364. _ = e
  9365. _hashTableIterInit(tls, bp, p+40)
  9366. for {
  9367. e = _hashTableIterNext(tls, bp)
  9368. if !(e != 0) {
  9369. break
  9370. }
  9371. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9372. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9373. }
  9374. goto _1
  9375. _1:
  9376. }
  9377. _hashTableClear(tls, p)
  9378. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9379. _hashTableClear(tls, p+264)
  9380. _hashTableClear(tls, p+40)
  9381. _hashTableClear(tls, p+80)
  9382. _hashTableClear(tls, p+120)
  9383. _poolClear(tls, p+160)
  9384. _poolClear(tls, p+208)
  9385. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9386. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9387. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9388. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9389. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9390. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9391. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9392. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9393. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9394. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9395. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9396. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9397. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9398. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9399. }
  9400. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9401. bp := tls.Alloc(16)
  9402. defer tls.Free(16)
  9403. var e uintptr
  9404. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9405. _ = e
  9406. _hashTableIterInit(tls, bp, p+40)
  9407. for {
  9408. e = _hashTableIterNext(tls, bp)
  9409. if !(e != 0) {
  9410. break
  9411. }
  9412. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9413. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9414. }
  9415. goto _1
  9416. _1:
  9417. }
  9418. _hashTableDestroy(tls, p)
  9419. _hashTableDestroy(tls, p+264)
  9420. _hashTableDestroy(tls, p+40)
  9421. _hashTableDestroy(tls, p+80)
  9422. _hashTableDestroy(tls, p+120)
  9423. _poolDestroy(tls, p+160)
  9424. _poolDestroy(tls, p+208)
  9425. if isDocEntity != 0 {
  9426. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9427. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9428. }
  9429. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9430. }
  9431. // C documentation
  9432. //
  9433. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9434. // The new DTD has already been initialized.
  9435. // */
  9436. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9437. bp := tls.Alloc(16)
  9438. defer tls.Free(16)
  9439. var i, v3, v7 int32
  9440. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9441. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9442. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9443. /* Copy the prefix table. */
  9444. _hashTableIterInit(tls, bp, oldDtd+120)
  9445. for {
  9446. oldP = _hashTableIterNext(tls, bp)
  9447. if !(oldP != 0) {
  9448. break
  9449. }
  9450. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9451. if !(name != 0) {
  9452. return 0
  9453. }
  9454. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  9455. return 0
  9456. }
  9457. goto _1
  9458. _1:
  9459. }
  9460. _hashTableIterInit(tls, bp, oldDtd+80)
  9461. /* Copy the attribute id table. */
  9462. for {
  9463. oldA = _hashTableIterNext(tls, bp)
  9464. if !(oldA != 0) {
  9465. break
  9466. }
  9467. /* Remember to allocate the scratch byte before the name. */
  9468. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  9469. v3 = 0
  9470. } else {
  9471. v5 = newDtd + 160 + 24
  9472. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9473. *(*uintptr)(unsafe.Pointer(v5))++
  9474. *(*TXML_Char)(unsafe.Pointer(v4)) = int8('\000')
  9475. v3 = libc.Int32FromInt32(1)
  9476. }
  9477. if !(v3 != 0) {
  9478. return 0
  9479. }
  9480. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9481. if !(name1 != 0) {
  9482. return 0
  9483. }
  9484. name1++
  9485. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  9486. if !(newA != 0) {
  9487. return 0
  9488. }
  9489. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9490. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9491. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9492. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  9493. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  9494. } else {
  9495. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  9496. }
  9497. }
  9498. goto _2
  9499. _2:
  9500. }
  9501. /* Copy the element type table. */
  9502. _hashTableIterInit(tls, bp, oldDtd+40)
  9503. for {
  9504. oldE = _hashTableIterNext(tls, bp)
  9505. if !(oldE != 0) {
  9506. break
  9507. }
  9508. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9509. if !(name2 != 0) {
  9510. return 0
  9511. }
  9512. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  9513. if !(newE != 0) {
  9514. return 0
  9515. }
  9516. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9517. (*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))
  9518. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9519. return 0
  9520. }
  9521. }
  9522. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9523. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  9524. }
  9525. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9526. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9527. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9528. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9529. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  9530. }
  9531. i = 0
  9532. for {
  9533. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9534. break
  9535. }
  9536. (*(*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))
  9537. (*(*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
  9538. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  9539. (*(*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)
  9540. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  9541. return 0
  9542. }
  9543. } else {
  9544. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  9545. }
  9546. goto _8
  9547. _8:
  9548. ;
  9549. i++
  9550. }
  9551. goto _6
  9552. _6:
  9553. }
  9554. /* Copy the entity tables. */
  9555. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  9556. return 0
  9557. }
  9558. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  9559. return 0
  9560. }
  9561. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9562. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9563. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9564. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9565. /* Don't want deep copying for scaffolding */
  9566. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9567. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9568. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9569. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9570. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9571. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9572. return int32(1)
  9573. }
  9574. /* End dtdCopy */
  9575. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9576. bp := tls.Alloc(16)
  9577. defer tls.Free(16)
  9578. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9579. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9580. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9581. cachedOldBase = libc.UintptrFromInt32(0)
  9582. cachedNewBase = libc.UintptrFromInt32(0)
  9583. _hashTableIterInit(tls, bp, oldTable)
  9584. for {
  9585. oldE = _hashTableIterNext(tls, bp)
  9586. if !(oldE != 0) {
  9587. break
  9588. }
  9589. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9590. if !(name != 0) {
  9591. return 0
  9592. }
  9593. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  9594. if !(newE != 0) {
  9595. return 0
  9596. }
  9597. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9598. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9599. if !(tem != 0) {
  9600. return 0
  9601. }
  9602. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9603. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9604. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9605. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9606. } else {
  9607. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9608. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9609. if !(tem != 0) {
  9610. return 0
  9611. }
  9612. v2 = tem
  9613. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9614. cachedNewBase = v2
  9615. }
  9616. }
  9617. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9618. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9619. if !(tem != 0) {
  9620. return 0
  9621. }
  9622. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9623. }
  9624. } else {
  9625. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9626. if !(tem1 != 0) {
  9627. return 0
  9628. }
  9629. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9630. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9631. }
  9632. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9633. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9634. if !(tem2 != 0) {
  9635. return 0
  9636. }
  9637. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9638. }
  9639. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9640. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9641. goto _1
  9642. _1:
  9643. }
  9644. return int32(1)
  9645. }
  9646. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9647. for {
  9648. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9649. break
  9650. }
  9651. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9652. return libc.Uint8FromInt32(1)
  9653. }
  9654. goto _1
  9655. _1:
  9656. ;
  9657. s1++
  9658. s2++
  9659. }
  9660. return libc.Uint8FromInt32(0)
  9661. }
  9662. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9663. var len1 Tsize_t
  9664. _ = len1
  9665. len1 = uint64(0)
  9666. for {
  9667. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9668. break
  9669. }
  9670. goto _1
  9671. _1:
  9672. ;
  9673. s++
  9674. len1++
  9675. }
  9676. return len1
  9677. }
  9678. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9679. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9680. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9681. }
  9682. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9683. bp := tls.Alloc(80)
  9684. defer tls.Free(80)
  9685. var _ /* key at bp+56 */ Tsipkey
  9686. var _ /* state at bp+0 */ Tsiphash
  9687. _ = __ccgo_fp(_sip24_valid)
  9688. _copy_salt_to_sipkey(tls, parser, bp+56)
  9689. _sip24_init(tls, bp, bp+56)
  9690. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9691. return _sip24_final(tls, bp)
  9692. }
  9693. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9694. var h, mask, newHash, newMask uint64
  9695. var i, j, newSize, tsize, tsize1 Tsize_t
  9696. var newPower, step uint8
  9697. var newV uintptr
  9698. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9699. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9700. if !(createSize != 0) {
  9701. return libc.UintptrFromInt32(0)
  9702. }
  9703. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9704. /* table->size is a power of 2 */
  9705. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9706. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9707. (*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)
  9708. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9709. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9710. return libc.UintptrFromInt32(0)
  9711. }
  9712. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9713. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9714. } else {
  9715. h = _hash(tls, parser, name)
  9716. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9717. step = uint8(0)
  9718. i = h & mask
  9719. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9720. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9721. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9722. }
  9723. if !(step != 0) {
  9724. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9725. }
  9726. if i < uint64(step) {
  9727. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9728. } else {
  9729. i -= uint64(step)
  9730. }
  9731. }
  9732. if !(createSize != 0) {
  9733. return libc.UintptrFromInt32(0)
  9734. }
  9735. /* check for overflow (table is half full) */
  9736. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9737. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9738. /* Detect and prevent invalid shift */
  9739. if uint64(newPower) >= libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8) {
  9740. return libc.UintptrFromInt32(0)
  9741. }
  9742. newSize = libc.Uint64FromInt32(1) << newPower
  9743. newMask = newSize - uint64(1)
  9744. /* Detect and prevent integer overflow */
  9745. if newSize > libc.Uint64FromInt32(-libc.Int32FromInt32(1))/libc.Uint64FromInt64(8) {
  9746. return libc.UintptrFromInt32(0)
  9747. }
  9748. tsize1 = newSize * uint64(8)
  9749. 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)
  9750. if !(newV != 0) {
  9751. return libc.UintptrFromInt32(0)
  9752. }
  9753. libc.Xmemset(tls, newV, 0, tsize1)
  9754. i = uint64(0)
  9755. for {
  9756. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9757. break
  9758. }
  9759. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9760. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9761. j = newHash & newMask
  9762. step = uint8(0)
  9763. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9764. if !(step != 0) {
  9765. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9766. }
  9767. if j < uint64(step) {
  9768. j += newSize - uint64(step)
  9769. } else {
  9770. j -= uint64(step)
  9771. }
  9772. }
  9773. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9774. }
  9775. goto _2
  9776. _2:
  9777. ;
  9778. i++
  9779. }
  9780. (*(*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)
  9781. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9782. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9783. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9784. i = h & newMask
  9785. step = uint8(0)
  9786. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9787. if !(step != 0) {
  9788. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9789. }
  9790. if i < uint64(step) {
  9791. i += newSize - uint64(step)
  9792. } else {
  9793. i -= uint64(step)
  9794. }
  9795. }
  9796. }
  9797. }
  9798. *(*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)
  9799. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9800. return libc.UintptrFromInt32(0)
  9801. }
  9802. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9803. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9804. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9805. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9806. }
  9807. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9808. var i Tsize_t
  9809. _ = i
  9810. i = uint64(0)
  9811. for {
  9812. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9813. break
  9814. }
  9815. (*(*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)))
  9816. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9817. goto _1
  9818. _1:
  9819. ;
  9820. i++
  9821. }
  9822. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9823. }
  9824. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9825. var i Tsize_t
  9826. _ = i
  9827. i = uint64(0)
  9828. for {
  9829. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9830. break
  9831. }
  9832. (*(*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)))
  9833. goto _1
  9834. _1:
  9835. ;
  9836. i++
  9837. }
  9838. (*(*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)
  9839. }
  9840. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9841. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9842. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9843. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9844. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9845. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9846. }
  9847. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9848. var v1 uintptr
  9849. _ = v1
  9850. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9851. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9852. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9853. } else {
  9854. v1 = libc.UintptrFromInt32(0)
  9855. }
  9856. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9857. }
  9858. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9859. var tem, v1, v2 uintptr
  9860. _, _, _ = tem, v1, v2
  9861. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9862. v2 = iter
  9863. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9864. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9865. tem = *(*uintptr)(unsafe.Pointer(v1))
  9866. if tem != 0 {
  9867. return tem
  9868. }
  9869. }
  9870. return libc.UintptrFromInt32(0)
  9871. }
  9872. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9873. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9874. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9875. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9876. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9877. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9878. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9879. }
  9880. func _poolClear(tls *libc.TLS, pool uintptr) {
  9881. var p, tem uintptr
  9882. _, _ = p, tem
  9883. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9884. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9885. } else {
  9886. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9887. for p != 0 {
  9888. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9889. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9890. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9891. p = tem
  9892. }
  9893. }
  9894. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9895. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9896. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9897. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9898. }
  9899. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9900. var p, tem, tem1 uintptr
  9901. _, _, _ = p, tem, tem1
  9902. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9903. for p != 0 {
  9904. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9905. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9906. p = tem
  9907. }
  9908. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9909. for p != 0 {
  9910. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9911. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9912. p = tem1
  9913. }
  9914. }
  9915. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9916. bp := tls.Alloc(16)
  9917. defer tls.Free(16)
  9918. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9919. var convert_res _XML_Convert_Result
  9920. _ = convert_res
  9921. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9922. return libc.UintptrFromInt32(0)
  9923. }
  9924. for {
  9925. 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)
  9926. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9927. break
  9928. }
  9929. if !(_poolGrow(tls, pool) != 0) {
  9930. return libc.UintptrFromInt32(0)
  9931. }
  9932. goto _1
  9933. _1:
  9934. }
  9935. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9936. }
  9937. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9938. var v1, v4, v5 uintptr
  9939. var v3 int32
  9940. _, _, _, _ = v1, v3, v4, v5
  9941. for {
  9942. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9943. v3 = 0
  9944. } else {
  9945. v5 = pool + 24
  9946. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9947. *(*uintptr)(unsafe.Pointer(v5))++
  9948. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9949. v3 = libc.Int32FromInt32(1)
  9950. }
  9951. if !(v3 != 0) {
  9952. return libc.UintptrFromInt32(0)
  9953. }
  9954. goto _2
  9955. _2:
  9956. ;
  9957. v1 = s
  9958. s++
  9959. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9960. break
  9961. }
  9962. }
  9963. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9964. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9965. return s
  9966. }
  9967. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9968. var v2 int32
  9969. var v3, v4 uintptr
  9970. _, _, _ = v2, v3, v4
  9971. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9972. /* The following line is unreachable given the current usage of
  9973. * poolCopyStringN(). Currently it is called from exactly one
  9974. * place to copy the text of a simple general entity. By that
  9975. * point, the name of the entity is already stored in the pool, so
  9976. * pool->ptr cannot be NULL.
  9977. *
  9978. * If poolCopyStringN() is used elsewhere as it well might be,
  9979. * this line may well become executable again. Regardless, this
  9980. * sort of check shouldn't be removed lightly, so we just exclude
  9981. * it from the coverage statistics.
  9982. */
  9983. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9984. }
  9985. for {
  9986. if !(n > 0) {
  9987. break
  9988. }
  9989. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9990. v2 = 0
  9991. } else {
  9992. v4 = pool + 24
  9993. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9994. *(*uintptr)(unsafe.Pointer(v4))++
  9995. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9996. v2 = libc.Int32FromInt32(1)
  9997. }
  9998. if !(v2 != 0) {
  9999. return libc.UintptrFromInt32(0)
  10000. }
  10001. goto _1
  10002. _1:
  10003. ;
  10004. n--
  10005. s++
  10006. }
  10007. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10008. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  10009. return s
  10010. }
  10011. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  10012. var v1 int32
  10013. var v2, v3 uintptr
  10014. _, _, _ = v1, v2, v3
  10015. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  10016. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10017. v1 = 0
  10018. } else {
  10019. v3 = pool + 24
  10020. v2 = *(*uintptr)(unsafe.Pointer(v3))
  10021. *(*uintptr)(unsafe.Pointer(v3))++
  10022. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  10023. v1 = libc.Int32FromInt32(1)
  10024. }
  10025. if !(v1 != 0) {
  10026. return libc.UintptrFromInt32(0)
  10027. }
  10028. s++
  10029. }
  10030. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10031. }
  10032. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10033. var v1, v2 uintptr
  10034. _, _ = v1, v2
  10035. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  10036. return libc.UintptrFromInt32(0)
  10037. }
  10038. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  10039. return libc.UintptrFromInt32(0)
  10040. }
  10041. v2 = pool + 24
  10042. v1 = *(*uintptr)(unsafe.Pointer(v2))
  10043. *(*uintptr)(unsafe.Pointer(v2))++
  10044. *(*TXML_Char)(unsafe.Pointer(v1)) = 0
  10045. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10046. }
  10047. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  10048. var bytesToAllocate, stretchedBlockSize int32
  10049. var stretch Tsize_t
  10050. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  10051. /* Unprotected math would be:
  10052. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  10053. **
  10054. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  10055. ** For a + b * c we check b * c in isolation first, so that addition of a
  10056. ** on top has no chance of making us accept a small non-negative number
  10057. */
  10058. stretch = uint64(1) /* can be 4 bytes */
  10059. if blockSize <= 0 {
  10060. return uint64(0)
  10061. }
  10062. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m_INT_MAX)/stretch) {
  10063. return uint64(0)
  10064. }
  10065. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  10066. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  10067. if bytesToAllocate < 0 {
  10068. return uint64(0)
  10069. }
  10070. return libc.Uint64FromInt32(bytesToAllocate)
  10071. return r
  10072. }
  10073. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  10074. var blockSize, blockSize1 int32
  10075. var bytesToAllocate, bytesToAllocate1 Tsize_t
  10076. var offsetInsideBlock Tptrdiff_t
  10077. var tem, tem1, temp uintptr
  10078. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  10079. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  10080. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  10081. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10082. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10083. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  10084. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10085. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10086. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10087. return libc.Uint8FromInt32(1)
  10088. }
  10089. 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) {
  10090. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10091. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10092. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10093. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  10094. 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))
  10095. (*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))
  10096. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10097. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10098. return libc.Uint8FromInt32(1)
  10099. }
  10100. }
  10101. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  10102. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10103. /* NOTE: Needs to be calculated prior to calling `realloc`
  10104. to avoid dangling pointers: */
  10105. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10106. if blockSize < 0 {
  10107. /* This condition traps a situation where either more than
  10108. * INT_MAX/2 bytes have already been allocated. This isn't
  10109. * readily testable, since it is unlikely that an average
  10110. * machine will have that much memory, so we exclude it from the
  10111. * coverage statistics.
  10112. */
  10113. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10114. }
  10115. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10116. if bytesToAllocate == uint64(0) {
  10117. return libc.Uint8FromInt32(0)
  10118. }
  10119. 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)))
  10120. if temp == libc.UintptrFromInt32(0) {
  10121. return libc.Uint8FromInt32(0)
  10122. }
  10123. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10124. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10125. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  10126. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10127. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10128. } else {
  10129. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10130. if blockSize1 < 0 {
  10131. /* This condition traps a situation where either more than
  10132. * INT_MAX bytes have already been allocated (which is prevented
  10133. * by various pieces of program logic, not least this one, never
  10134. * mind the unlikelihood of actually having that much memory) or
  10135. * the pool control fields have been corrupted (which could
  10136. * conceivably happen in an extremely buggy user handler
  10137. * function). Either way it isn't readily testable, so we
  10138. * exclude it from the coverage statistics.
  10139. */
  10140. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10141. }
  10142. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10143. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10144. } else {
  10145. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10146. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10147. return libc.Uint8FromInt32(0)
  10148. }
  10149. blockSize1 *= int32(2)
  10150. }
  10151. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10152. if bytesToAllocate1 == uint64(0) {
  10153. return libc.Uint8FromInt32(0)
  10154. }
  10155. 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)
  10156. if !(tem1 != 0) {
  10157. return libc.Uint8FromInt32(0)
  10158. }
  10159. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10160. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10161. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10162. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10163. 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))
  10164. }
  10165. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10166. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  10167. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  10168. }
  10169. return libc.Uint8FromInt32(1)
  10170. }
  10171. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10172. var dtd, me, parent, temp, v2 uintptr
  10173. var next, v3, v4, v5 int32
  10174. var v1 uint32
  10175. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10176. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10177. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10178. (*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))
  10179. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10180. return -int32(1)
  10181. }
  10182. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10183. }
  10184. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10185. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10186. /* Detect and prevent integer overflow */
  10187. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromUint32(2) {
  10188. return -int32(1)
  10189. }
  10190. /* Detect and prevent integer overflow.
  10191. * The preprocessor guard addresses the "always false" warning
  10192. * from -Wtype-limits on platforms where
  10193. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10194. 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))
  10195. if temp == libc.UintptrFromInt32(0) {
  10196. return -int32(1)
  10197. }
  10198. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  10199. } else {
  10200. 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))
  10201. if temp == libc.UintptrFromInt32(0) {
  10202. return -int32(1)
  10203. }
  10204. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10205. }
  10206. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10207. }
  10208. v2 = dtd + 344
  10209. v1 = *(*uint32)(unsafe.Pointer(v2))
  10210. *(*uint32)(unsafe.Pointer(v2))++
  10211. next = libc.Int32FromUint32(v1)
  10212. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  10213. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10214. 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
  10215. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10216. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  10217. }
  10218. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10219. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10220. }
  10221. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10222. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10223. }
  10224. v5 = libc.Int32FromInt32(0)
  10225. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10226. v4 = v5
  10227. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10228. v3 = v4
  10229. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10230. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10231. return next
  10232. }
  10233. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10234. var allocsize Tsize_t
  10235. var cn, src_node int32
  10236. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10237. var i uint32
  10238. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10239. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10240. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10241. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10242. * strings. */
  10243. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10244. /* Detect and prevent integer overflow.
  10245. * The preprocessor guard addresses the "always false" warning
  10246. * from -Wtype-limits on platforms where
  10247. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10248. if uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*uint64(32) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*uint64(1) {
  10249. return libc.UintptrFromInt32(0)
  10250. }
  10251. allocsize = uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1)
  10252. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10253. if !(ret != 0) {
  10254. return libc.UintptrFromInt32(0)
  10255. }
  10256. /* What follows is an iterative implementation (of what was previously done
  10257. * recursively in a dedicated function called "build_node". The old recursive
  10258. * build_node could be forced into stack exhaustion from input as small as a
  10259. * few megabyte, and so that was a security issue. Hence, a function call
  10260. * stack is avoided now by resolving recursion.)
  10261. *
  10262. * The iterative approach works as follows:
  10263. *
  10264. * - We have two writing pointers, both walking up the result array; one does
  10265. * the work, the other creates "jobs" for its colleague to do, and leads
  10266. * the way:
  10267. *
  10268. * - The faster one, pointer jobDest, always leads and writes "what job
  10269. * to do" by the other, once they reach that place in the
  10270. * array: leader "jobDest" stores the source node array index (relative
  10271. * to array dtd->scaffold) in field "numchildren".
  10272. *
  10273. * - The slower one, pointer dest, looks at the value stored in the
  10274. * "numchildren" field (which actually holds a source node array index
  10275. * at that time) and puts the real data from dtd->scaffold in.
  10276. *
  10277. * - Before the loop starts, jobDest writes source array index 0
  10278. * (where the root node is located) so that dest will have something to do
  10279. * when it starts operation.
  10280. *
  10281. * - Whenever nodes with children are encountered, jobDest appends
  10282. * them as new jobs, in order. As a result, tree node siblings are
  10283. * adjacent in the resulting array, for example:
  10284. *
  10285. * [0] root, has two children
  10286. * [1] first child of 0, has three children
  10287. * [3] first child of 1, does not have children
  10288. * [4] second child of 1, does not have children
  10289. * [5] third child of 1, does not have children
  10290. * [2] second child of 0, does not have children
  10291. *
  10292. * Or (the same data) presented in flat array view:
  10293. *
  10294. * [0] root, has two children
  10295. *
  10296. * [1] first child of 0, has three children
  10297. * [2] second child of 0, does not have children
  10298. *
  10299. * [3] first child of 1, does not have children
  10300. * [4] second child of 1, does not have children
  10301. * [5] third child of 1, does not have children
  10302. *
  10303. * - The algorithm repeats until all target array indices have been processed.
  10304. */
  10305. dest = ret /* tree node writing location, moves upwards */
  10306. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10307. jobDest = ret /* next free writing location in target array */
  10308. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10309. /* Add the starting job, the root node (index 0) of the source tree */
  10310. v1 = jobDest
  10311. jobDest += 32
  10312. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10313. for {
  10314. if !(dest < destLimit) {
  10315. break
  10316. }
  10317. /* Retrieve source tree array index from job storage */
  10318. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10319. /* Convert item */
  10320. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  10321. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  10322. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10323. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10324. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  10325. for {
  10326. v4 = str
  10327. str++
  10328. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10329. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10330. break
  10331. }
  10332. src++
  10333. goto _3
  10334. _3:
  10335. }
  10336. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10337. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10338. } else {
  10339. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10340. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  10341. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10342. /* Append scaffold indices of children to array */
  10343. i = uint32(0)
  10344. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  10345. for {
  10346. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10347. break
  10348. }
  10349. v6 = jobDest
  10350. jobDest += 32
  10351. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10352. goto _5
  10353. _5:
  10354. ;
  10355. i++
  10356. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  10357. }
  10358. }
  10359. goto _2
  10360. _2:
  10361. ;
  10362. dest += 32
  10363. }
  10364. return ret
  10365. }
  10366. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10367. var dtd, name, ret uintptr
  10368. _, _, _ = dtd, name, ret
  10369. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10370. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  10371. if !(name != 0) {
  10372. return libc.UintptrFromInt32(0)
  10373. }
  10374. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  10375. if !(ret != 0) {
  10376. return libc.UintptrFromInt32(0)
  10377. }
  10378. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10379. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10380. } else {
  10381. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10382. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10383. return libc.UintptrFromInt32(0)
  10384. }
  10385. }
  10386. return ret
  10387. }
  10388. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10389. var charsRequired Tsize_t
  10390. var result uintptr
  10391. _, _ = charsRequired, result
  10392. charsRequired = uint64(0)
  10393. /* First determine how long the string is */
  10394. for int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10395. charsRequired++
  10396. }
  10397. /* Include the terminator */
  10398. charsRequired++
  10399. /* Now allocate space for the copy */
  10400. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint64(1))
  10401. if result == libc.UintptrFromInt32(0) {
  10402. return libc.UintptrFromInt32(0)
  10403. }
  10404. /* Copy the original into place */
  10405. libc.Xmemcpy(tls, result, s, charsRequired*uint64(1))
  10406. return result
  10407. }
  10408. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10409. var amplificationFactor, v1 float32
  10410. var countBytesOutput TXmlBigCount
  10411. _, _, _ = amplificationFactor, countBytesOutput, v1
  10412. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10413. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10414. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10415. } else {
  10416. v1 = libc.Float32FromFloat32(1)
  10417. }
  10418. amplificationFactor = v1
  10419. return amplificationFactor
  10420. }
  10421. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10422. bp := tls.Alloc(48)
  10423. defer tls.Free(48)
  10424. var amplificationFactor float32
  10425. var rootParser TXML_Parser
  10426. _, _ = amplificationFactor, rootParser
  10427. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10428. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10429. return
  10430. }
  10431. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10432. libc.Xfprintf(tls, libc.Xstderr, __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))
  10433. }
  10434. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10435. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10436. }
  10437. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10438. bp := tls.Alloc(64)
  10439. defer tls.Free(64)
  10440. var contextLength uint32
  10441. var ellipsisLength Tsize_t
  10442. var walker, v1 uintptr
  10443. var _ /* ellipis at bp+0 */ [5]int8
  10444. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10445. if account == int32(_XML_ACCOUNT_DIRECT) {
  10446. v1 = __ccgo_ts + 1759
  10447. } else {
  10448. v1 = __ccgo_ts + 1763
  10449. }
  10450. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1808))
  10451. *(*[5]int8)(unsafe.Pointer(bp)) = [5]int8{'[', '.', '.', ']'}
  10452. ellipsisLength = libc.Uint64FromInt64(5) - libc.Uint64FromInt32(1)
  10453. contextLength = uint32(10)
  10454. /* Note: Performance is of no concern here */
  10455. walker = before
  10456. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int64(after)-int64(before) <= libc.Int64FromUint64(uint64(contextLength)+ellipsisLength+uint64(contextLength)) {
  10457. for {
  10458. if !(walker < after) {
  10459. break
  10460. }
  10461. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10462. goto _2
  10463. _2:
  10464. ;
  10465. walker++
  10466. }
  10467. } else {
  10468. for {
  10469. if !(walker < before+uintptr(contextLength)) {
  10470. break
  10471. }
  10472. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10473. goto _3
  10474. _3:
  10475. ;
  10476. walker++
  10477. }
  10478. libc.Xfprintf(tls, libc.Xstderr, bp, 0)
  10479. walker = after - uintptr(contextLength)
  10480. for {
  10481. if !(walker < after) {
  10482. break
  10483. }
  10484. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10485. goto _4
  10486. _4:
  10487. ;
  10488. walker++
  10489. }
  10490. }
  10491. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1812, 0)
  10492. }
  10493. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10494. bp := tls.Alloc(16)
  10495. defer tls.Free(16)
  10496. var additionTarget, v1 uintptr
  10497. var amplificationFactor float32
  10498. var bytesMore Tptrdiff_t
  10499. var countBytesOutput TXmlBigCount
  10500. var isDirect int32
  10501. var rootParser TXML_Parser
  10502. var tolerated TXML_Bool
  10503. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10504. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10505. /* Note: We need to check the token type *first* to be sure that
  10506. * we can even access variable <after>, safely.
  10507. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10508. switch tok {
  10509. case m_XML_TOK_INVALID:
  10510. fallthrough
  10511. case -int32(1):
  10512. fallthrough
  10513. case -int32(2):
  10514. fallthrough
  10515. case -int32(4):
  10516. return libc.Uint8FromInt32(1)
  10517. }
  10518. if account == int32(_XML_ACCOUNT_NONE) {
  10519. return libc.Uint8FromInt32(1)
  10520. }
  10521. rootParser = _getRootParserOf(tls, originParser, bp)
  10522. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10523. bytesMore = int64(after) - int64(before)
  10524. if isDirect != 0 {
  10525. v1 = rootParser + 928
  10526. } else {
  10527. v1 = rootParser + 928 + 8
  10528. }
  10529. additionTarget = v1
  10530. /* Detect and avoid integer overflow */
  10531. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt64(bytesMore) {
  10532. return libc.Uint8FromInt32(0)
  10533. }
  10534. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt64(bytesMore)
  10535. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10536. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10537. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10538. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10539. _accountingReportStats(tls, rootParser, __ccgo_ts+1808)
  10540. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10541. }
  10542. return tolerated
  10543. }
  10544. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10545. if !(parser != 0) {
  10546. return uint64(0)
  10547. }
  10548. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10549. }
  10550. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10551. if !(parser != 0) {
  10552. return uint64(0)
  10553. }
  10554. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10555. }
  10556. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10557. bp := tls.Alloc(96)
  10558. defer tls.Free(96)
  10559. var entityName, v1 uintptr
  10560. _, _ = entityName, v1
  10561. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10562. return
  10563. }
  10564. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10565. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10566. v1 = __ccgo_ts + 1815
  10567. } else {
  10568. v1 = __ccgo_ts + 1817
  10569. }
  10570. libc.Xfprintf(tls, libc.Xstderr, __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))
  10571. }
  10572. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10573. var rootParser TXML_Parser
  10574. _ = rootParser
  10575. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10576. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10577. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10578. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10579. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10580. }
  10581. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1904, sourceLine)
  10582. }
  10583. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10584. var rootParser TXML_Parser
  10585. _ = rootParser
  10586. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10587. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1910, sourceLine)
  10588. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10589. }
  10590. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10591. var rootParser TXML_Parser
  10592. var stepsTakenUpwards uint32
  10593. _, _ = rootParser, stepsTakenUpwards
  10594. rootParser = parser
  10595. stepsTakenUpwards = uint32(0)
  10596. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10597. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10598. stepsTakenUpwards++
  10599. }
  10600. if outLevelDiff != libc.UintptrFromInt32(0) {
  10601. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10602. }
  10603. return rootParser
  10604. }
  10605. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10606. switch libc.Int32FromUint8(c) {
  10607. case 0:
  10608. return __ccgo_ts + 1916
  10609. case int32(1):
  10610. return __ccgo_ts + 1919
  10611. case int32(2):
  10612. return __ccgo_ts + 1923
  10613. case int32(3):
  10614. return __ccgo_ts + 1927
  10615. case int32(4):
  10616. return __ccgo_ts + 1931
  10617. case int32(5):
  10618. return __ccgo_ts + 1935
  10619. case int32(6):
  10620. return __ccgo_ts + 1939
  10621. case int32(7):
  10622. return __ccgo_ts + 1943
  10623. case int32(8):
  10624. return __ccgo_ts + 1947
  10625. case int32(9):
  10626. return __ccgo_ts + 1951
  10627. case int32(10):
  10628. return __ccgo_ts + 1954
  10629. case int32(11):
  10630. return __ccgo_ts + 1957
  10631. case int32(12):
  10632. return __ccgo_ts + 1961
  10633. case int32(13):
  10634. return __ccgo_ts + 1965
  10635. case int32(14):
  10636. return __ccgo_ts + 1968
  10637. case int32(15):
  10638. return __ccgo_ts + 1972
  10639. case int32(16):
  10640. return __ccgo_ts + 1976
  10641. case int32(17):
  10642. return __ccgo_ts + 1981
  10643. case int32(18):
  10644. return __ccgo_ts + 1986
  10645. case int32(19):
  10646. return __ccgo_ts + 1991
  10647. case int32(20):
  10648. return __ccgo_ts + 1996
  10649. case int32(21):
  10650. return __ccgo_ts + 2001
  10651. case int32(22):
  10652. return __ccgo_ts + 2006
  10653. case int32(23):
  10654. return __ccgo_ts + 2011
  10655. case int32(24):
  10656. return __ccgo_ts + 2016
  10657. case int32(25):
  10658. return __ccgo_ts + 2021
  10659. case int32(26):
  10660. return __ccgo_ts + 2026
  10661. case int32(27):
  10662. return __ccgo_ts + 2031
  10663. case int32(28):
  10664. return __ccgo_ts + 2036
  10665. case int32(29):
  10666. return __ccgo_ts + 2041
  10667. case int32(30):
  10668. return __ccgo_ts + 2046
  10669. case int32(31):
  10670. return __ccgo_ts + 2051
  10671. case int32(32):
  10672. return __ccgo_ts + 2056
  10673. case int32(33):
  10674. return __ccgo_ts + 2058
  10675. case int32(34):
  10676. return __ccgo_ts + 2060
  10677. case int32(35):
  10678. return __ccgo_ts + 2063
  10679. case int32(36):
  10680. return __ccgo_ts + 2065
  10681. case int32(37):
  10682. return __ccgo_ts + 1815
  10683. case int32(38):
  10684. return __ccgo_ts + 1817
  10685. case int32(39):
  10686. return __ccgo_ts + 2067
  10687. case int32(40):
  10688. return __ccgo_ts + 2069
  10689. case int32(41):
  10690. return __ccgo_ts + 2071
  10691. case int32(42):
  10692. return __ccgo_ts + 2073
  10693. case int32(43):
  10694. return __ccgo_ts + 2075
  10695. case int32(44):
  10696. return __ccgo_ts + 2077
  10697. case int32(45):
  10698. return __ccgo_ts + 2079
  10699. case int32(46):
  10700. return __ccgo_ts + 2081
  10701. case int32(47):
  10702. return __ccgo_ts + 2083
  10703. case int32(48):
  10704. return __ccgo_ts + 2085
  10705. case int32(49):
  10706. return __ccgo_ts + 2087
  10707. case int32(50):
  10708. return __ccgo_ts + 2089
  10709. case int32(51):
  10710. return __ccgo_ts + 2091
  10711. case int32(52):
  10712. return __ccgo_ts + 2093
  10713. case int32(53):
  10714. return __ccgo_ts + 2095
  10715. case int32(54):
  10716. return __ccgo_ts + 2097
  10717. case int32(55):
  10718. return __ccgo_ts + 2099
  10719. case int32(56):
  10720. return __ccgo_ts + 2101
  10721. case int32(57):
  10722. return __ccgo_ts + 2103
  10723. case int32(58):
  10724. return __ccgo_ts + 2105
  10725. case int32(59):
  10726. return __ccgo_ts + 2107
  10727. case int32(60):
  10728. return __ccgo_ts + 2109
  10729. case int32(61):
  10730. return __ccgo_ts + 2111
  10731. case int32(62):
  10732. return __ccgo_ts + 2113
  10733. case int32(63):
  10734. return __ccgo_ts + 2115
  10735. case int32(64):
  10736. return __ccgo_ts + 2117
  10737. case int32(65):
  10738. return __ccgo_ts + 2119
  10739. case int32(66):
  10740. return __ccgo_ts + 2121
  10741. case int32(67):
  10742. return __ccgo_ts + 2123
  10743. case int32(68):
  10744. return __ccgo_ts + 2125
  10745. case int32(69):
  10746. return __ccgo_ts + 2127
  10747. case int32(70):
  10748. return __ccgo_ts + 2129
  10749. case int32(71):
  10750. return __ccgo_ts + 2131
  10751. case int32(72):
  10752. return __ccgo_ts + 2133
  10753. case int32(73):
  10754. return __ccgo_ts + 2135
  10755. case int32(74):
  10756. return __ccgo_ts + 2137
  10757. case int32(75):
  10758. return __ccgo_ts + 2139
  10759. case int32(76):
  10760. return __ccgo_ts + 2141
  10761. case int32(77):
  10762. return __ccgo_ts + 2143
  10763. case int32(78):
  10764. return __ccgo_ts + 2145
  10765. case int32(79):
  10766. return __ccgo_ts + 2147
  10767. case int32(80):
  10768. return __ccgo_ts + 2149
  10769. case int32(81):
  10770. return __ccgo_ts + 2151
  10771. case int32(82):
  10772. return __ccgo_ts + 2153
  10773. case int32(83):
  10774. return __ccgo_ts + 2155
  10775. case int32(84):
  10776. return __ccgo_ts + 2157
  10777. case int32(85):
  10778. return __ccgo_ts + 2159
  10779. case int32(86):
  10780. return __ccgo_ts + 2161
  10781. case int32(87):
  10782. return __ccgo_ts + 2163
  10783. case int32(88):
  10784. return __ccgo_ts + 2165
  10785. case int32(89):
  10786. return __ccgo_ts + 2167
  10787. case int32(90):
  10788. return __ccgo_ts + 2169
  10789. case int32(91):
  10790. return __ccgo_ts + 2171
  10791. case int32(92):
  10792. return __ccgo_ts + 2173
  10793. case int32(93):
  10794. return __ccgo_ts + 2176
  10795. case int32(94):
  10796. return __ccgo_ts + 2178
  10797. case int32(95):
  10798. return __ccgo_ts + 2180
  10799. case int32(96):
  10800. return __ccgo_ts + 2182
  10801. case int32(97):
  10802. return __ccgo_ts + 2184
  10803. case int32(98):
  10804. return __ccgo_ts + 2186
  10805. case int32(99):
  10806. return __ccgo_ts + 2188
  10807. case int32(100):
  10808. return __ccgo_ts + 2190
  10809. case int32(101):
  10810. return __ccgo_ts + 2192
  10811. case int32(102):
  10812. return __ccgo_ts + 2194
  10813. case int32(103):
  10814. return __ccgo_ts + 2196
  10815. case int32(104):
  10816. return __ccgo_ts + 2198
  10817. case int32(105):
  10818. return __ccgo_ts + 2200
  10819. case int32(106):
  10820. return __ccgo_ts + 2202
  10821. case int32(107):
  10822. return __ccgo_ts + 2204
  10823. case int32(108):
  10824. return __ccgo_ts + 2206
  10825. case int32(109):
  10826. return __ccgo_ts + 2208
  10827. case int32(110):
  10828. return __ccgo_ts + 2210
  10829. case int32(111):
  10830. return __ccgo_ts + 2212
  10831. case int32(112):
  10832. return __ccgo_ts + 2214
  10833. case int32(113):
  10834. return __ccgo_ts + 2216
  10835. case int32(114):
  10836. return __ccgo_ts + 2218
  10837. case int32(115):
  10838. return __ccgo_ts + 2220
  10839. case int32(116):
  10840. return __ccgo_ts + 2222
  10841. case int32(117):
  10842. return __ccgo_ts + 2224
  10843. case int32(118):
  10844. return __ccgo_ts + 2226
  10845. case int32(119):
  10846. return __ccgo_ts + 2228
  10847. case int32(120):
  10848. return __ccgo_ts + 2230
  10849. case int32(121):
  10850. return __ccgo_ts + 2232
  10851. case int32(122):
  10852. return __ccgo_ts + 2234
  10853. case int32(123):
  10854. return __ccgo_ts + 2236
  10855. case int32(124):
  10856. return __ccgo_ts + 2238
  10857. case int32(125):
  10858. return __ccgo_ts + 2240
  10859. case int32(126):
  10860. return __ccgo_ts + 2242
  10861. case int32(127):
  10862. return __ccgo_ts + 2244
  10863. case int32(128):
  10864. return __ccgo_ts + 2249
  10865. case int32(129):
  10866. return __ccgo_ts + 2254
  10867. case int32(130):
  10868. return __ccgo_ts + 2259
  10869. case int32(131):
  10870. return __ccgo_ts + 2264
  10871. case int32(132):
  10872. return __ccgo_ts + 2269
  10873. case int32(133):
  10874. return __ccgo_ts + 2274
  10875. case int32(134):
  10876. return __ccgo_ts + 2279
  10877. case int32(135):
  10878. return __ccgo_ts + 2284
  10879. case int32(136):
  10880. return __ccgo_ts + 2289
  10881. case int32(137):
  10882. return __ccgo_ts + 2294
  10883. case int32(138):
  10884. return __ccgo_ts + 2299
  10885. case int32(139):
  10886. return __ccgo_ts + 2304
  10887. case int32(140):
  10888. return __ccgo_ts + 2309
  10889. case int32(141):
  10890. return __ccgo_ts + 2314
  10891. case int32(142):
  10892. return __ccgo_ts + 2319
  10893. case int32(143):
  10894. return __ccgo_ts + 2324
  10895. case int32(144):
  10896. return __ccgo_ts + 2329
  10897. case int32(145):
  10898. return __ccgo_ts + 2334
  10899. case int32(146):
  10900. return __ccgo_ts + 2339
  10901. case int32(147):
  10902. return __ccgo_ts + 2344
  10903. case int32(148):
  10904. return __ccgo_ts + 2349
  10905. case int32(149):
  10906. return __ccgo_ts + 2354
  10907. case int32(150):
  10908. return __ccgo_ts + 2359
  10909. case int32(151):
  10910. return __ccgo_ts + 2364
  10911. case int32(152):
  10912. return __ccgo_ts + 2369
  10913. case int32(153):
  10914. return __ccgo_ts + 2374
  10915. case int32(154):
  10916. return __ccgo_ts + 2379
  10917. case int32(155):
  10918. return __ccgo_ts + 2384
  10919. case int32(156):
  10920. return __ccgo_ts + 2389
  10921. case int32(157):
  10922. return __ccgo_ts + 2394
  10923. case int32(158):
  10924. return __ccgo_ts + 2399
  10925. case int32(159):
  10926. return __ccgo_ts + 2404
  10927. case int32(160):
  10928. return __ccgo_ts + 2409
  10929. case int32(161):
  10930. return __ccgo_ts + 2414
  10931. case int32(162):
  10932. return __ccgo_ts + 2419
  10933. case int32(163):
  10934. return __ccgo_ts + 2424
  10935. case int32(164):
  10936. return __ccgo_ts + 2429
  10937. case int32(165):
  10938. return __ccgo_ts + 2434
  10939. case int32(166):
  10940. return __ccgo_ts + 2439
  10941. case int32(167):
  10942. return __ccgo_ts + 2444
  10943. case int32(168):
  10944. return __ccgo_ts + 2449
  10945. case int32(169):
  10946. return __ccgo_ts + 2454
  10947. case int32(170):
  10948. return __ccgo_ts + 2459
  10949. case int32(171):
  10950. return __ccgo_ts + 2464
  10951. case int32(172):
  10952. return __ccgo_ts + 2469
  10953. case int32(173):
  10954. return __ccgo_ts + 2474
  10955. case int32(174):
  10956. return __ccgo_ts + 2479
  10957. case int32(175):
  10958. return __ccgo_ts + 2484
  10959. case int32(176):
  10960. return __ccgo_ts + 2489
  10961. case int32(177):
  10962. return __ccgo_ts + 2494
  10963. case int32(178):
  10964. return __ccgo_ts + 2499
  10965. case int32(179):
  10966. return __ccgo_ts + 2504
  10967. case int32(180):
  10968. return __ccgo_ts + 2509
  10969. case int32(181):
  10970. return __ccgo_ts + 2514
  10971. case int32(182):
  10972. return __ccgo_ts + 2519
  10973. case int32(183):
  10974. return __ccgo_ts + 2524
  10975. case int32(184):
  10976. return __ccgo_ts + 2529
  10977. case int32(185):
  10978. return __ccgo_ts + 2534
  10979. case int32(186):
  10980. return __ccgo_ts + 2539
  10981. case int32(187):
  10982. return __ccgo_ts + 2544
  10983. case int32(188):
  10984. return __ccgo_ts + 2549
  10985. case int32(189):
  10986. return __ccgo_ts + 2554
  10987. case int32(190):
  10988. return __ccgo_ts + 2559
  10989. case int32(191):
  10990. return __ccgo_ts + 2564
  10991. case int32(192):
  10992. return __ccgo_ts + 2569
  10993. case int32(193):
  10994. return __ccgo_ts + 2574
  10995. case int32(194):
  10996. return __ccgo_ts + 2579
  10997. case int32(195):
  10998. return __ccgo_ts + 2584
  10999. case int32(196):
  11000. return __ccgo_ts + 2589
  11001. case int32(197):
  11002. return __ccgo_ts + 2594
  11003. case int32(198):
  11004. return __ccgo_ts + 2599
  11005. case int32(199):
  11006. return __ccgo_ts + 2604
  11007. case int32(200):
  11008. return __ccgo_ts + 2609
  11009. case int32(201):
  11010. return __ccgo_ts + 2614
  11011. case int32(202):
  11012. return __ccgo_ts + 2619
  11013. case int32(203):
  11014. return __ccgo_ts + 2624
  11015. case int32(204):
  11016. return __ccgo_ts + 2629
  11017. case int32(205):
  11018. return __ccgo_ts + 2634
  11019. case int32(206):
  11020. return __ccgo_ts + 2639
  11021. case int32(207):
  11022. return __ccgo_ts + 2644
  11023. case int32(208):
  11024. return __ccgo_ts + 2649
  11025. case int32(209):
  11026. return __ccgo_ts + 2654
  11027. case int32(210):
  11028. return __ccgo_ts + 2659
  11029. case int32(211):
  11030. return __ccgo_ts + 2664
  11031. case int32(212):
  11032. return __ccgo_ts + 2669
  11033. case int32(213):
  11034. return __ccgo_ts + 2674
  11035. case int32(214):
  11036. return __ccgo_ts + 2679
  11037. case int32(215):
  11038. return __ccgo_ts + 2684
  11039. case int32(216):
  11040. return __ccgo_ts + 2689
  11041. case int32(217):
  11042. return __ccgo_ts + 2694
  11043. case int32(218):
  11044. return __ccgo_ts + 2699
  11045. case int32(219):
  11046. return __ccgo_ts + 2704
  11047. case int32(220):
  11048. return __ccgo_ts + 2709
  11049. case int32(221):
  11050. return __ccgo_ts + 2714
  11051. case int32(222):
  11052. return __ccgo_ts + 2719
  11053. case int32(223):
  11054. return __ccgo_ts + 2724
  11055. case int32(224):
  11056. return __ccgo_ts + 2729
  11057. case int32(225):
  11058. return __ccgo_ts + 2734
  11059. case int32(226):
  11060. return __ccgo_ts + 2739
  11061. case int32(227):
  11062. return __ccgo_ts + 2744
  11063. case int32(228):
  11064. return __ccgo_ts + 2749
  11065. case int32(229):
  11066. return __ccgo_ts + 2754
  11067. case int32(230):
  11068. return __ccgo_ts + 2759
  11069. case int32(231):
  11070. return __ccgo_ts + 2764
  11071. case int32(232):
  11072. return __ccgo_ts + 2769
  11073. case int32(233):
  11074. return __ccgo_ts + 2774
  11075. case int32(234):
  11076. return __ccgo_ts + 2779
  11077. case int32(235):
  11078. return __ccgo_ts + 2784
  11079. case int32(236):
  11080. return __ccgo_ts + 2789
  11081. case int32(237):
  11082. return __ccgo_ts + 2794
  11083. case int32(238):
  11084. return __ccgo_ts + 2799
  11085. case int32(239):
  11086. return __ccgo_ts + 2804
  11087. case int32(240):
  11088. return __ccgo_ts + 2809
  11089. case int32(241):
  11090. return __ccgo_ts + 2814
  11091. case int32(242):
  11092. return __ccgo_ts + 2819
  11093. case int32(243):
  11094. return __ccgo_ts + 2824
  11095. case int32(244):
  11096. return __ccgo_ts + 2829
  11097. case int32(245):
  11098. return __ccgo_ts + 2834
  11099. case int32(246):
  11100. return __ccgo_ts + 2839
  11101. case int32(247):
  11102. return __ccgo_ts + 2844
  11103. case int32(248):
  11104. return __ccgo_ts + 2849
  11105. case int32(249):
  11106. return __ccgo_ts + 2854
  11107. case int32(250):
  11108. return __ccgo_ts + 2859
  11109. case int32(251):
  11110. return __ccgo_ts + 2864
  11111. case int32(252):
  11112. return __ccgo_ts + 2869
  11113. case int32(253):
  11114. return __ccgo_ts + 2874
  11115. case int32(254):
  11116. return __ccgo_ts + 2879
  11117. case int32(255):
  11118. return __ccgo_ts + 2884
  11119. default:
  11120. /* never gets here */
  11121. return __ccgo_ts + 2889
  11122. }
  11123. /* never gets here */
  11124. return r
  11125. }
  11126. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint64) (r uint64) {
  11127. bp := tls.Alloc(16)
  11128. defer tls.Free(16)
  11129. var debugLevel uint64
  11130. var value, valueOrNull uintptr
  11131. var _ /* afterValue at bp+0 */ uintptr
  11132. _, _, _ = debugLevel, value, valueOrNull
  11133. valueOrNull = libc.Xgetenv(tls, variableName)
  11134. if valueOrNull == libc.UintptrFromInt32(0) {
  11135. return defaultDebugLevel
  11136. }
  11137. value = valueOrNull
  11138. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11139. *(*uintptr)(unsafe.Pointer(bp)) = value
  11140. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11141. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11142. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11143. return defaultDebugLevel
  11144. }
  11145. return debugLevel
  11146. }
  11147. const m_ASCII_01 = 0x30
  11148. const m_ASCII_11 = 0x31
  11149. const m_ASCII_21 = 0x32
  11150. const m_ASCII_31 = 0x33
  11151. const m_ASCII_81 = 0x38
  11152. const m_ASCII_91 = 0x39
  11153. const m_ASCII_B1 = 66
  11154. const m_ASCII_COLON1 = 0x3A
  11155. const m_ASCII_COMMA1 = 0x2C
  11156. const m_ASCII_EQUALS1 = 0x3D
  11157. const m_ASCII_EXCL1 = 0x21
  11158. const m_ASCII_FF1 = 0x0C
  11159. const m_ASCII_G1 = 71
  11160. const m_ASCII_HASH1 = 0x23
  11161. const m_ASCII_LPAREN1 = 0x28
  11162. const m_ASCII_P1 = 80
  11163. const m_ASCII_PERIOD1 = 0x2E
  11164. const m_ASCII_PIPE1 = 0x7C
  11165. const m_ASCII_Q1 = 81
  11166. const m_ASCII_RPAREN1 = 0x29
  11167. const m_ASCII_SLASH1 = 0x2F
  11168. const m_ASCII_U1 = 85
  11169. const m_ASCII_a1 = 0x61
  11170. const m_ASCII_c1 = 0x63
  11171. const m_ASCII_e1 = 0x65
  11172. const m_ASCII_g1 = 0x67
  11173. const m_ASCII_h1 = 0x68
  11174. const m_ASCII_l1 = 0x6C
  11175. const m_ASCII_m1 = 0x6D
  11176. const m_ASCII_n1 = 0x6E
  11177. const m_ASCII_o1 = 0x6F
  11178. const m_ASCII_p1 = 0x70
  11179. const m_ASCII_r1 = 0x72
  11180. const m_ASCII_s1 = 0x73
  11181. const m_ASCII_t1 = 0x74
  11182. const m_ASCII_w1 = 0x77
  11183. const m_ASCII_x1 = 0x78
  11184. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11185. const m_INT_MAX1 = 0x7fffffff
  11186. const m_UINT_MAX1 = 0xffffffff
  11187. /*
  11188. __ __ _
  11189. ___\ \/ /_ __ __ _| |_
  11190. / _ \\ /| '_ \ / _` | __|
  11191. | __// \| |_) | (_| | |_
  11192. \___/_/\_\ .__/ \__,_|\__|
  11193. |_| XML parser
  11194. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11195. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11196. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11197. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11198. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11199. Licensed under the MIT license:
  11200. Permission is hereby granted, free of charge, to any person obtaining
  11201. a copy of this software and associated documentation files (the
  11202. "Software"), to deal in the Software without restriction, including
  11203. without limitation the rights to use, copy, modify, merge, publish,
  11204. distribute, sublicense, and/or sell copies of the Software, and to permit
  11205. persons to whom the Software is furnished to do so, subject to the
  11206. following conditions:
  11207. The above copyright notice and this permission notice shall be included
  11208. in all copies or substantial portions of the Software.
  11209. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11210. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11211. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11212. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11213. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11214. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11215. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11216. */
  11217. /* Doesn't check:
  11218. that ,| are not mixed in a model group
  11219. content of literals
  11220. */
  11221. var _KW_ANY = [4]int8{
  11222. 0: int8(m_ASCII_A),
  11223. 1: int8(m_ASCII_N),
  11224. 2: int8(m_ASCII_Y),
  11225. }
  11226. var _KW_ATTLIST = [8]int8{
  11227. 0: int8(m_ASCII_A),
  11228. 1: int8(m_ASCII_T),
  11229. 2: int8(m_ASCII_T),
  11230. 3: int8(m_ASCII_L),
  11231. 4: int8(m_ASCII_I),
  11232. 5: int8(m_ASCII_S),
  11233. 6: int8(m_ASCII_T),
  11234. }
  11235. var _KW_CDATA = [6]int8{
  11236. 0: int8(m_ASCII_C),
  11237. 1: int8(m_ASCII_D),
  11238. 2: int8(m_ASCII_A),
  11239. 3: int8(m_ASCII_T),
  11240. 4: int8(m_ASCII_A),
  11241. }
  11242. var _KW_DOCTYPE = [8]int8{
  11243. 0: int8(m_ASCII_D),
  11244. 1: int8(m_ASCII_O),
  11245. 2: int8(m_ASCII_C),
  11246. 3: int8(m_ASCII_T),
  11247. 4: int8(m_ASCII_Y),
  11248. 5: int8(m_ASCII_P1),
  11249. 6: int8(m_ASCII_E),
  11250. }
  11251. var _KW_ELEMENT = [8]int8{
  11252. 0: int8(m_ASCII_E),
  11253. 1: int8(m_ASCII_L),
  11254. 2: int8(m_ASCII_E),
  11255. 3: int8(m_ASCII_M),
  11256. 4: int8(m_ASCII_E),
  11257. 5: int8(m_ASCII_N),
  11258. 6: int8(m_ASCII_T),
  11259. }
  11260. var _KW_EMPTY = [6]int8{
  11261. 0: int8(m_ASCII_E),
  11262. 1: int8(m_ASCII_M),
  11263. 2: int8(m_ASCII_P1),
  11264. 3: int8(m_ASCII_T),
  11265. 4: int8(m_ASCII_Y),
  11266. }
  11267. var _KW_ENTITIES = [9]int8{
  11268. 0: int8(m_ASCII_E),
  11269. 1: int8(m_ASCII_N),
  11270. 2: int8(m_ASCII_T),
  11271. 3: int8(m_ASCII_I),
  11272. 4: int8(m_ASCII_T),
  11273. 5: int8(m_ASCII_I),
  11274. 6: int8(m_ASCII_E),
  11275. 7: int8(m_ASCII_S),
  11276. }
  11277. var _KW_ENTITY = [7]int8{
  11278. 0: int8(m_ASCII_E),
  11279. 1: int8(m_ASCII_N),
  11280. 2: int8(m_ASCII_T),
  11281. 3: int8(m_ASCII_I),
  11282. 4: int8(m_ASCII_T),
  11283. 5: int8(m_ASCII_Y),
  11284. }
  11285. var _KW_FIXED = [6]int8{
  11286. 0: int8(m_ASCII_F),
  11287. 1: int8(m_ASCII_I),
  11288. 2: int8(m_ASCII_X),
  11289. 3: int8(m_ASCII_E),
  11290. 4: int8(m_ASCII_D),
  11291. }
  11292. var _KW_ID = [3]int8{
  11293. 0: int8(m_ASCII_I),
  11294. 1: int8(m_ASCII_D),
  11295. }
  11296. var _KW_IDREF = [6]int8{
  11297. 0: int8(m_ASCII_I),
  11298. 1: int8(m_ASCII_D),
  11299. 2: int8(m_ASCII_R),
  11300. 3: int8(m_ASCII_E),
  11301. 4: int8(m_ASCII_F),
  11302. }
  11303. var _KW_IDREFS = [7]int8{
  11304. 0: int8(m_ASCII_I),
  11305. 1: int8(m_ASCII_D),
  11306. 2: int8(m_ASCII_R),
  11307. 3: int8(m_ASCII_E),
  11308. 4: int8(m_ASCII_F),
  11309. 5: int8(m_ASCII_S),
  11310. }
  11311. var _KW_IGNORE = [7]int8{
  11312. 0: int8(m_ASCII_I),
  11313. 1: int8(m_ASCII_G1),
  11314. 2: int8(m_ASCII_N),
  11315. 3: int8(m_ASCII_O),
  11316. 4: int8(m_ASCII_R),
  11317. 5: int8(m_ASCII_E),
  11318. }
  11319. var _KW_IMPLIED = [8]int8{
  11320. 0: int8(m_ASCII_I),
  11321. 1: int8(m_ASCII_M),
  11322. 2: int8(m_ASCII_P1),
  11323. 3: int8(m_ASCII_L),
  11324. 4: int8(m_ASCII_I),
  11325. 5: int8(m_ASCII_E),
  11326. 6: int8(m_ASCII_D),
  11327. }
  11328. var _KW_INCLUDE = [8]int8{
  11329. 0: int8(m_ASCII_I),
  11330. 1: int8(m_ASCII_N),
  11331. 2: int8(m_ASCII_C),
  11332. 3: int8(m_ASCII_L),
  11333. 4: int8(m_ASCII_U1),
  11334. 5: int8(m_ASCII_D),
  11335. 6: int8(m_ASCII_E),
  11336. }
  11337. var _KW_NDATA = [6]int8{
  11338. 0: int8(m_ASCII_N),
  11339. 1: int8(m_ASCII_D),
  11340. 2: int8(m_ASCII_A),
  11341. 3: int8(m_ASCII_T),
  11342. 4: int8(m_ASCII_A),
  11343. }
  11344. var _KW_NMTOKEN = [8]int8{
  11345. 0: int8(m_ASCII_N),
  11346. 1: int8(m_ASCII_M),
  11347. 2: int8(m_ASCII_T),
  11348. 3: int8(m_ASCII_O),
  11349. 4: int8(m_ASCII_K),
  11350. 5: int8(m_ASCII_E),
  11351. 6: int8(m_ASCII_N),
  11352. }
  11353. var _KW_NMTOKENS = [9]int8{
  11354. 0: int8(m_ASCII_N),
  11355. 1: int8(m_ASCII_M),
  11356. 2: int8(m_ASCII_T),
  11357. 3: int8(m_ASCII_O),
  11358. 4: int8(m_ASCII_K),
  11359. 5: int8(m_ASCII_E),
  11360. 6: int8(m_ASCII_N),
  11361. 7: int8(m_ASCII_S),
  11362. }
  11363. var _KW_NOTATION = [9]int8{
  11364. 0: int8(m_ASCII_N),
  11365. 1: int8(m_ASCII_O),
  11366. 2: int8(m_ASCII_T),
  11367. 3: int8(m_ASCII_A),
  11368. 4: int8(m_ASCII_T),
  11369. 5: int8(m_ASCII_I),
  11370. 6: int8(m_ASCII_O),
  11371. 7: int8(m_ASCII_N),
  11372. }
  11373. var _KW_PCDATA = [7]int8{
  11374. 0: int8(m_ASCII_P1),
  11375. 1: int8(m_ASCII_C),
  11376. 2: int8(m_ASCII_D),
  11377. 3: int8(m_ASCII_A),
  11378. 4: int8(m_ASCII_T),
  11379. 5: int8(m_ASCII_A),
  11380. }
  11381. var _KW_PUBLIC = [7]int8{
  11382. 0: int8(m_ASCII_P1),
  11383. 1: int8(m_ASCII_U1),
  11384. 2: int8(m_ASCII_B1),
  11385. 3: int8(m_ASCII_L),
  11386. 4: int8(m_ASCII_I),
  11387. 5: int8(m_ASCII_C),
  11388. }
  11389. var _KW_REQUIRED = [9]int8{
  11390. 0: int8(m_ASCII_R),
  11391. 1: int8(m_ASCII_E),
  11392. 2: int8(m_ASCII_Q1),
  11393. 3: int8(m_ASCII_U1),
  11394. 4: int8(m_ASCII_I),
  11395. 5: int8(m_ASCII_R),
  11396. 6: int8(m_ASCII_E),
  11397. 7: int8(m_ASCII_D),
  11398. }
  11399. var _KW_SYSTEM = [7]int8{
  11400. 0: int8(m_ASCII_S),
  11401. 1: int8(m_ASCII_Y),
  11402. 2: int8(m_ASCII_S),
  11403. 3: int8(m_ASCII_T),
  11404. 4: int8(m_ASCII_E),
  11405. 5: int8(m_ASCII_M),
  11406. }
  11407. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11408. switch tok {
  11409. case int32(m_XML_TOK_PROLOG_S):
  11410. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11411. return int32(_XML_ROLE_NONE)
  11412. case int32(m_XML_TOK_XML_DECL):
  11413. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11414. return int32(_XML_ROLE_XML_DECL)
  11415. case int32(m_XML_TOK_PI):
  11416. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11417. return int32(_XML_ROLE_PI)
  11418. case int32(m_XML_TOK_COMMENT):
  11419. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11420. return int32(_XML_ROLE_COMMENT)
  11421. case int32(m_XML_TOK_BOM):
  11422. return int32(_XML_ROLE_NONE)
  11423. case int32(m_XML_TOK_DECL_OPEN):
  11424. 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) {
  11425. break
  11426. }
  11427. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11428. return int32(_XML_ROLE_DOCTYPE_NONE)
  11429. case int32(m_XML_TOK_INSTANCE_START):
  11430. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11431. return int32(_XML_ROLE_INSTANCE_START)
  11432. }
  11433. return _common(tls, state, tok)
  11434. }
  11435. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11436. switch tok {
  11437. case int32(m_XML_TOK_PROLOG_S):
  11438. return int32(_XML_ROLE_NONE)
  11439. case int32(m_XML_TOK_PI):
  11440. return int32(_XML_ROLE_PI)
  11441. case int32(m_XML_TOK_COMMENT):
  11442. return int32(_XML_ROLE_COMMENT)
  11443. case int32(m_XML_TOK_BOM):
  11444. /* This case can never arise. To reach this role function, the
  11445. * parse must have passed through prolog0 and therefore have had
  11446. * some form of input, even if only a space. At that point, a
  11447. * byte order mark is no longer a valid character (though
  11448. * technically it should be interpreted as a non-breaking space),
  11449. * so will be rejected by the tokenizing stages.
  11450. */
  11451. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11452. case int32(m_XML_TOK_DECL_OPEN):
  11453. 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) {
  11454. break
  11455. }
  11456. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11457. return int32(_XML_ROLE_DOCTYPE_NONE)
  11458. case int32(m_XML_TOK_INSTANCE_START):
  11459. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11460. return int32(_XML_ROLE_INSTANCE_START)
  11461. }
  11462. return _common(tls, state, tok)
  11463. }
  11464. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11465. _ = ptr
  11466. _ = end
  11467. _ = enc
  11468. switch tok {
  11469. case int32(m_XML_TOK_PROLOG_S):
  11470. return int32(_XML_ROLE_NONE)
  11471. case int32(m_XML_TOK_PI):
  11472. return int32(_XML_ROLE_PI)
  11473. case int32(m_XML_TOK_COMMENT):
  11474. return int32(_XML_ROLE_COMMENT)
  11475. case int32(m_XML_TOK_INSTANCE_START):
  11476. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11477. return int32(_XML_ROLE_INSTANCE_START)
  11478. }
  11479. return _common(tls, state, tok)
  11480. }
  11481. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11482. _ = ptr
  11483. _ = end
  11484. _ = enc
  11485. switch tok {
  11486. case int32(m_XML_TOK_PROLOG_S):
  11487. return int32(_XML_ROLE_DOCTYPE_NONE)
  11488. case int32(m_XML_TOK_NAME):
  11489. fallthrough
  11490. case int32(m_XML_TOK_PREFIXED_NAME):
  11491. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11492. return int32(_XML_ROLE_DOCTYPE_NAME)
  11493. }
  11494. return _common(tls, state, tok)
  11495. }
  11496. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11497. switch tok {
  11498. case int32(m_XML_TOK_PROLOG_S):
  11499. return int32(_XML_ROLE_DOCTYPE_NONE)
  11500. case int32(m_XML_TOK_OPEN_BRACKET):
  11501. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11502. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11503. case int32(m_XML_TOK_DECL_CLOSE):
  11504. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11505. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11506. case int32(m_XML_TOK_NAME):
  11507. 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 {
  11508. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11509. return int32(_XML_ROLE_DOCTYPE_NONE)
  11510. }
  11511. 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 {
  11512. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11513. return int32(_XML_ROLE_DOCTYPE_NONE)
  11514. }
  11515. break
  11516. }
  11517. return _common(tls, state, tok)
  11518. }
  11519. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11520. _ = ptr
  11521. _ = end
  11522. _ = enc
  11523. switch tok {
  11524. case int32(m_XML_TOK_PROLOG_S):
  11525. return int32(_XML_ROLE_DOCTYPE_NONE)
  11526. case int32(m_XML_TOK_LITERAL):
  11527. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11528. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11529. }
  11530. return _common(tls, state, tok)
  11531. }
  11532. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11533. _ = ptr
  11534. _ = end
  11535. _ = enc
  11536. switch tok {
  11537. case int32(m_XML_TOK_PROLOG_S):
  11538. return int32(_XML_ROLE_DOCTYPE_NONE)
  11539. case int32(m_XML_TOK_LITERAL):
  11540. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11541. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11542. }
  11543. return _common(tls, state, tok)
  11544. }
  11545. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11546. _ = ptr
  11547. _ = end
  11548. _ = enc
  11549. switch tok {
  11550. case int32(m_XML_TOK_PROLOG_S):
  11551. return int32(_XML_ROLE_DOCTYPE_NONE)
  11552. case int32(m_XML_TOK_OPEN_BRACKET):
  11553. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11554. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11555. case int32(m_XML_TOK_DECL_CLOSE):
  11556. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11557. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11558. }
  11559. return _common(tls, state, tok)
  11560. }
  11561. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11562. _ = ptr
  11563. _ = end
  11564. _ = enc
  11565. switch tok {
  11566. case int32(m_XML_TOK_PROLOG_S):
  11567. return int32(_XML_ROLE_DOCTYPE_NONE)
  11568. case int32(m_XML_TOK_DECL_CLOSE):
  11569. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11570. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11571. }
  11572. return _common(tls, state, tok)
  11573. }
  11574. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11575. switch tok {
  11576. case int32(m_XML_TOK_PROLOG_S):
  11577. return int32(_XML_ROLE_NONE)
  11578. case int32(m_XML_TOK_DECL_OPEN):
  11579. 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 {
  11580. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11581. return int32(_XML_ROLE_ENTITY_NONE)
  11582. }
  11583. 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 {
  11584. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11585. return int32(_XML_ROLE_ATTLIST_NONE)
  11586. }
  11587. 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 {
  11588. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11589. return int32(_XML_ROLE_ELEMENT_NONE)
  11590. }
  11591. 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 {
  11592. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11593. return int32(_XML_ROLE_NOTATION_NONE)
  11594. }
  11595. case int32(m_XML_TOK_PI):
  11596. return int32(_XML_ROLE_PI)
  11597. case int32(m_XML_TOK_COMMENT):
  11598. return int32(_XML_ROLE_COMMENT)
  11599. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11600. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11601. case int32(m_XML_TOK_CLOSE_BRACKET):
  11602. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11603. return int32(_XML_ROLE_DOCTYPE_NONE)
  11604. case -int32(4):
  11605. return int32(_XML_ROLE_NONE)
  11606. }
  11607. return _common(tls, state, tok)
  11608. }
  11609. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11610. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11611. if tok == int32(m_XML_TOK_XML_DECL) {
  11612. return int32(_XML_ROLE_TEXT_DECL)
  11613. }
  11614. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11615. }
  11616. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11617. switch tok {
  11618. case int32(m_XML_TOK_COND_SECT_OPEN):
  11619. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11620. return int32(_XML_ROLE_NONE)
  11621. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11622. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11623. break
  11624. }
  11625. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  11626. return int32(_XML_ROLE_NONE)
  11627. case int32(m_XML_TOK_PROLOG_S):
  11628. return int32(_XML_ROLE_NONE)
  11629. case int32(m_XML_TOK_CLOSE_BRACKET):
  11630. case -int32(4):
  11631. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11632. break
  11633. }
  11634. return int32(_XML_ROLE_NONE)
  11635. default:
  11636. return _internalSubset(tls, state, tok, ptr, end, enc)
  11637. }
  11638. return _common(tls, state, tok)
  11639. }
  11640. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11641. _ = ptr
  11642. _ = end
  11643. _ = enc
  11644. switch tok {
  11645. case int32(m_XML_TOK_PROLOG_S):
  11646. return int32(_XML_ROLE_ENTITY_NONE)
  11647. case int32(m_XML_TOK_PERCENT):
  11648. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11649. return int32(_XML_ROLE_ENTITY_NONE)
  11650. case int32(m_XML_TOK_NAME):
  11651. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11652. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11653. }
  11654. return _common(tls, state, tok)
  11655. }
  11656. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11657. _ = ptr
  11658. _ = end
  11659. _ = enc
  11660. switch tok {
  11661. case int32(m_XML_TOK_PROLOG_S):
  11662. return int32(_XML_ROLE_ENTITY_NONE)
  11663. case int32(m_XML_TOK_NAME):
  11664. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11665. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11666. }
  11667. return _common(tls, state, tok)
  11668. }
  11669. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11670. switch tok {
  11671. case int32(m_XML_TOK_PROLOG_S):
  11672. return int32(_XML_ROLE_ENTITY_NONE)
  11673. case int32(m_XML_TOK_NAME):
  11674. 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 {
  11675. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11676. return int32(_XML_ROLE_ENTITY_NONE)
  11677. }
  11678. 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 {
  11679. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11680. return int32(_XML_ROLE_ENTITY_NONE)
  11681. }
  11682. case int32(m_XML_TOK_LITERAL):
  11683. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11684. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11685. return int32(_XML_ROLE_ENTITY_VALUE)
  11686. }
  11687. return _common(tls, state, tok)
  11688. }
  11689. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11690. _ = ptr
  11691. _ = end
  11692. _ = enc
  11693. switch tok {
  11694. case int32(m_XML_TOK_PROLOG_S):
  11695. return int32(_XML_ROLE_ENTITY_NONE)
  11696. case int32(m_XML_TOK_LITERAL):
  11697. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11698. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11699. }
  11700. return _common(tls, state, tok)
  11701. }
  11702. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11703. _ = ptr
  11704. _ = end
  11705. _ = enc
  11706. switch tok {
  11707. case int32(m_XML_TOK_PROLOG_S):
  11708. return int32(_XML_ROLE_ENTITY_NONE)
  11709. case int32(m_XML_TOK_LITERAL):
  11710. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11711. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11712. }
  11713. return _common(tls, state, tok)
  11714. }
  11715. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11716. var v1 uintptr
  11717. _ = v1
  11718. switch tok {
  11719. case int32(m_XML_TOK_PROLOG_S):
  11720. return int32(_XML_ROLE_ENTITY_NONE)
  11721. case int32(m_XML_TOK_DECL_CLOSE):
  11722. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11723. v1 = __ccgo_fp(_internalSubset)
  11724. } else {
  11725. v1 = __ccgo_fp(_externalSubset1)
  11726. }
  11727. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11728. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11729. case int32(m_XML_TOK_NAME):
  11730. 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 {
  11731. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11732. return int32(_XML_ROLE_ENTITY_NONE)
  11733. }
  11734. break
  11735. }
  11736. return _common(tls, state, tok)
  11737. }
  11738. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11739. _ = ptr
  11740. _ = end
  11741. _ = enc
  11742. switch tok {
  11743. case int32(m_XML_TOK_PROLOG_S):
  11744. return int32(_XML_ROLE_ENTITY_NONE)
  11745. case int32(m_XML_TOK_NAME):
  11746. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11747. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11748. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11749. }
  11750. return _common(tls, state, tok)
  11751. }
  11752. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11753. switch tok {
  11754. case int32(m_XML_TOK_PROLOG_S):
  11755. return int32(_XML_ROLE_ENTITY_NONE)
  11756. case int32(m_XML_TOK_NAME):
  11757. 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 {
  11758. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11759. return int32(_XML_ROLE_ENTITY_NONE)
  11760. }
  11761. 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 {
  11762. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11763. return int32(_XML_ROLE_ENTITY_NONE)
  11764. }
  11765. case int32(m_XML_TOK_LITERAL):
  11766. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11767. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11768. return int32(_XML_ROLE_ENTITY_VALUE)
  11769. }
  11770. return _common(tls, state, tok)
  11771. }
  11772. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11773. _ = ptr
  11774. _ = end
  11775. _ = enc
  11776. switch tok {
  11777. case int32(m_XML_TOK_PROLOG_S):
  11778. return int32(_XML_ROLE_ENTITY_NONE)
  11779. case int32(m_XML_TOK_LITERAL):
  11780. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11781. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11782. }
  11783. return _common(tls, state, tok)
  11784. }
  11785. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11786. _ = ptr
  11787. _ = end
  11788. _ = enc
  11789. switch tok {
  11790. case int32(m_XML_TOK_PROLOG_S):
  11791. return int32(_XML_ROLE_ENTITY_NONE)
  11792. case int32(m_XML_TOK_LITERAL):
  11793. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11794. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11795. }
  11796. return _common(tls, state, tok)
  11797. }
  11798. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11799. var v1 uintptr
  11800. _ = v1
  11801. _ = ptr
  11802. _ = end
  11803. _ = enc
  11804. switch tok {
  11805. case int32(m_XML_TOK_PROLOG_S):
  11806. return int32(_XML_ROLE_ENTITY_NONE)
  11807. case int32(m_XML_TOK_DECL_CLOSE):
  11808. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11809. v1 = __ccgo_fp(_internalSubset)
  11810. } else {
  11811. v1 = __ccgo_fp(_externalSubset1)
  11812. }
  11813. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11814. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11815. }
  11816. return _common(tls, state, tok)
  11817. }
  11818. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11819. _ = ptr
  11820. _ = end
  11821. _ = enc
  11822. switch tok {
  11823. case int32(m_XML_TOK_PROLOG_S):
  11824. return int32(_XML_ROLE_NOTATION_NONE)
  11825. case int32(m_XML_TOK_NAME):
  11826. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11827. return int32(_XML_ROLE_NOTATION_NAME)
  11828. }
  11829. return _common(tls, state, tok)
  11830. }
  11831. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11832. switch tok {
  11833. case int32(m_XML_TOK_PROLOG_S):
  11834. return int32(_XML_ROLE_NOTATION_NONE)
  11835. case int32(m_XML_TOK_NAME):
  11836. 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 {
  11837. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11838. return int32(_XML_ROLE_NOTATION_NONE)
  11839. }
  11840. 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 {
  11841. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11842. return int32(_XML_ROLE_NOTATION_NONE)
  11843. }
  11844. break
  11845. }
  11846. return _common(tls, state, tok)
  11847. }
  11848. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11849. _ = ptr
  11850. _ = end
  11851. _ = enc
  11852. switch tok {
  11853. case int32(m_XML_TOK_PROLOG_S):
  11854. return int32(_XML_ROLE_NOTATION_NONE)
  11855. case int32(m_XML_TOK_LITERAL):
  11856. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11857. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11858. }
  11859. return _common(tls, state, tok)
  11860. }
  11861. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11862. _ = ptr
  11863. _ = end
  11864. _ = enc
  11865. switch tok {
  11866. case int32(m_XML_TOK_PROLOG_S):
  11867. return int32(_XML_ROLE_NOTATION_NONE)
  11868. case int32(m_XML_TOK_LITERAL):
  11869. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11870. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11871. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11872. }
  11873. return _common(tls, state, tok)
  11874. }
  11875. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11876. var v1 uintptr
  11877. _ = v1
  11878. _ = ptr
  11879. _ = end
  11880. _ = enc
  11881. switch tok {
  11882. case int32(m_XML_TOK_PROLOG_S):
  11883. return int32(_XML_ROLE_NOTATION_NONE)
  11884. case int32(m_XML_TOK_LITERAL):
  11885. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11886. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11887. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11888. case int32(m_XML_TOK_DECL_CLOSE):
  11889. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11890. v1 = __ccgo_fp(_internalSubset)
  11891. } else {
  11892. v1 = __ccgo_fp(_externalSubset1)
  11893. }
  11894. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11895. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  11896. }
  11897. return _common(tls, state, tok)
  11898. }
  11899. func _attlist0(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_ATTLIST_NONE)
  11906. case int32(m_XML_TOK_NAME):
  11907. fallthrough
  11908. case int32(m_XML_TOK_PREFIXED_NAME):
  11909. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11910. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  11911. }
  11912. return _common(tls, state, tok)
  11913. }
  11914. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11915. var v1 uintptr
  11916. _ = v1
  11917. _ = ptr
  11918. _ = end
  11919. _ = enc
  11920. switch tok {
  11921. case int32(m_XML_TOK_PROLOG_S):
  11922. return int32(_XML_ROLE_ATTLIST_NONE)
  11923. case int32(m_XML_TOK_DECL_CLOSE):
  11924. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11925. v1 = __ccgo_fp(_internalSubset)
  11926. } else {
  11927. v1 = __ccgo_fp(_externalSubset1)
  11928. }
  11929. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11930. return int32(_XML_ROLE_ATTLIST_NONE)
  11931. case int32(m_XML_TOK_NAME):
  11932. fallthrough
  11933. case int32(m_XML_TOK_PREFIXED_NAME):
  11934. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  11935. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  11936. }
  11937. return _common(tls, state, tok)
  11938. }
  11939. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11940. var i int32
  11941. _ = i
  11942. switch tok {
  11943. case int32(m_XML_TOK_PROLOG_S):
  11944. return int32(_XML_ROLE_ATTLIST_NONE)
  11945. case int32(m_XML_TOK_NAME):
  11946. i = 0
  11947. for {
  11948. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  11949. break
  11950. }
  11951. 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 {
  11952. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11953. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  11954. }
  11955. goto _1
  11956. _1:
  11957. ;
  11958. i++
  11959. }
  11960. 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 {
  11961. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  11962. return int32(_XML_ROLE_ATTLIST_NONE)
  11963. }
  11964. case int32(m_XML_TOK_OPEN_PAREN):
  11965. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11966. return int32(_XML_ROLE_ATTLIST_NONE)
  11967. }
  11968. return _common(tls, state, tok)
  11969. }
  11970. var _types = [8]uintptr{
  11971. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  11972. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  11973. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  11974. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  11975. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  11976. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  11977. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  11978. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  11979. }
  11980. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11981. _ = ptr
  11982. _ = end
  11983. _ = enc
  11984. switch tok {
  11985. case int32(m_XML_TOK_PROLOG_S):
  11986. return int32(_XML_ROLE_ATTLIST_NONE)
  11987. case int32(m_XML_TOK_NMTOKEN):
  11988. fallthrough
  11989. case int32(m_XML_TOK_NAME):
  11990. fallthrough
  11991. case int32(m_XML_TOK_PREFIXED_NAME):
  11992. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  11993. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  11994. }
  11995. return _common(tls, state, tok)
  11996. }
  11997. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11998. _ = ptr
  11999. _ = end
  12000. _ = enc
  12001. switch tok {
  12002. case int32(m_XML_TOK_PROLOG_S):
  12003. return int32(_XML_ROLE_ATTLIST_NONE)
  12004. case int32(m_XML_TOK_CLOSE_PAREN):
  12005. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12006. return int32(_XML_ROLE_ATTLIST_NONE)
  12007. case int32(m_XML_TOK_OR):
  12008. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  12009. return int32(_XML_ROLE_ATTLIST_NONE)
  12010. }
  12011. return _common(tls, state, tok)
  12012. }
  12013. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12014. _ = ptr
  12015. _ = end
  12016. _ = enc
  12017. switch tok {
  12018. case int32(m_XML_TOK_PROLOG_S):
  12019. return int32(_XML_ROLE_ATTLIST_NONE)
  12020. case int32(m_XML_TOK_OPEN_PAREN):
  12021. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  12022. return int32(_XML_ROLE_ATTLIST_NONE)
  12023. }
  12024. return _common(tls, state, tok)
  12025. }
  12026. func _attlist6(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. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  12035. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  12036. }
  12037. return _common(tls, state, tok)
  12038. }
  12039. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12040. _ = ptr
  12041. _ = end
  12042. _ = enc
  12043. switch tok {
  12044. case int32(m_XML_TOK_PROLOG_S):
  12045. return int32(_XML_ROLE_ATTLIST_NONE)
  12046. case int32(m_XML_TOK_CLOSE_PAREN):
  12047. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  12048. return int32(_XML_ROLE_ATTLIST_NONE)
  12049. case int32(m_XML_TOK_OR):
  12050. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  12051. return int32(_XML_ROLE_ATTLIST_NONE)
  12052. }
  12053. return _common(tls, state, tok)
  12054. }
  12055. // C documentation
  12056. //
  12057. // /* default value */
  12058. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12059. switch tok {
  12060. case int32(m_XML_TOK_PROLOG_S):
  12061. return int32(_XML_ROLE_ATTLIST_NONE)
  12062. case int32(m_XML_TOK_POUND_NAME):
  12063. 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 {
  12064. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12065. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  12066. }
  12067. 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 {
  12068. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12069. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  12070. }
  12071. 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 {
  12072. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  12073. return int32(_XML_ROLE_ATTLIST_NONE)
  12074. }
  12075. case int32(m_XML_TOK_LITERAL):
  12076. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12077. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  12078. }
  12079. return _common(tls, state, tok)
  12080. }
  12081. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12082. _ = ptr
  12083. _ = end
  12084. _ = enc
  12085. switch tok {
  12086. case int32(m_XML_TOK_PROLOG_S):
  12087. return int32(_XML_ROLE_ATTLIST_NONE)
  12088. case int32(m_XML_TOK_LITERAL):
  12089. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12090. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  12091. }
  12092. return _common(tls, state, tok)
  12093. }
  12094. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12095. _ = ptr
  12096. _ = end
  12097. _ = enc
  12098. switch tok {
  12099. case int32(m_XML_TOK_PROLOG_S):
  12100. return int32(_XML_ROLE_ELEMENT_NONE)
  12101. case int32(m_XML_TOK_NAME):
  12102. fallthrough
  12103. case int32(m_XML_TOK_PREFIXED_NAME):
  12104. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12105. return int32(_XML_ROLE_ELEMENT_NAME)
  12106. }
  12107. return _common(tls, state, tok)
  12108. }
  12109. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12110. switch tok {
  12111. case int32(m_XML_TOK_PROLOG_S):
  12112. return int32(_XML_ROLE_ELEMENT_NONE)
  12113. case int32(m_XML_TOK_NAME):
  12114. 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 {
  12115. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12116. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12117. return int32(_XML_ROLE_CONTENT_EMPTY)
  12118. }
  12119. 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 {
  12120. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12121. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12122. return int32(_XML_ROLE_CONTENT_ANY)
  12123. }
  12124. case int32(m_XML_TOK_OPEN_PAREN):
  12125. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12126. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12127. return int32(_XML_ROLE_GROUP_OPEN)
  12128. }
  12129. return _common(tls, state, tok)
  12130. }
  12131. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12132. switch tok {
  12133. case int32(m_XML_TOK_PROLOG_S):
  12134. return int32(_XML_ROLE_ELEMENT_NONE)
  12135. case int32(m_XML_TOK_POUND_NAME):
  12136. 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 {
  12137. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12138. return int32(_XML_ROLE_CONTENT_PCDATA)
  12139. }
  12140. case int32(m_XML_TOK_OPEN_PAREN):
  12141. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12142. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12143. return int32(_XML_ROLE_GROUP_OPEN)
  12144. case int32(m_XML_TOK_NAME):
  12145. fallthrough
  12146. case int32(m_XML_TOK_PREFIXED_NAME):
  12147. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12148. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12149. case int32(m_XML_TOK_NAME_QUESTION):
  12150. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12151. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12152. case int32(m_XML_TOK_NAME_ASTERISK):
  12153. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12154. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12155. case int32(m_XML_TOK_NAME_PLUS):
  12156. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12157. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12158. }
  12159. return _common(tls, state, tok)
  12160. }
  12161. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12162. _ = ptr
  12163. _ = end
  12164. _ = enc
  12165. switch tok {
  12166. case int32(m_XML_TOK_PROLOG_S):
  12167. return int32(_XML_ROLE_ELEMENT_NONE)
  12168. case int32(m_XML_TOK_CLOSE_PAREN):
  12169. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12170. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12171. return int32(_XML_ROLE_GROUP_CLOSE)
  12172. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12173. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12174. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12175. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12176. case int32(m_XML_TOK_OR):
  12177. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12178. return int32(_XML_ROLE_ELEMENT_NONE)
  12179. }
  12180. return _common(tls, state, tok)
  12181. }
  12182. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12183. _ = ptr
  12184. _ = end
  12185. _ = enc
  12186. switch tok {
  12187. case int32(m_XML_TOK_PROLOG_S):
  12188. return int32(_XML_ROLE_ELEMENT_NONE)
  12189. case int32(m_XML_TOK_NAME):
  12190. fallthrough
  12191. case int32(m_XML_TOK_PREFIXED_NAME):
  12192. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12193. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12194. }
  12195. return _common(tls, state, tok)
  12196. }
  12197. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12198. _ = ptr
  12199. _ = end
  12200. _ = enc
  12201. switch tok {
  12202. case int32(m_XML_TOK_PROLOG_S):
  12203. return int32(_XML_ROLE_ELEMENT_NONE)
  12204. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12205. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12206. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12207. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12208. case int32(m_XML_TOK_OR):
  12209. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12210. return int32(_XML_ROLE_ELEMENT_NONE)
  12211. }
  12212. return _common(tls, state, tok)
  12213. }
  12214. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12215. _ = ptr
  12216. _ = end
  12217. _ = enc
  12218. switch tok {
  12219. case int32(m_XML_TOK_PROLOG_S):
  12220. return int32(_XML_ROLE_ELEMENT_NONE)
  12221. case int32(m_XML_TOK_OPEN_PAREN):
  12222. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  12223. return int32(_XML_ROLE_GROUP_OPEN)
  12224. case int32(m_XML_TOK_NAME):
  12225. fallthrough
  12226. case int32(m_XML_TOK_PREFIXED_NAME):
  12227. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12228. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12229. case int32(m_XML_TOK_NAME_QUESTION):
  12230. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12231. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12232. case int32(m_XML_TOK_NAME_ASTERISK):
  12233. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12234. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12235. case int32(m_XML_TOK_NAME_PLUS):
  12236. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12237. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12238. }
  12239. return _common(tls, state, tok)
  12240. }
  12241. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12242. _ = ptr
  12243. _ = end
  12244. _ = enc
  12245. switch tok {
  12246. case int32(m_XML_TOK_PROLOG_S):
  12247. return int32(_XML_ROLE_ELEMENT_NONE)
  12248. case int32(m_XML_TOK_CLOSE_PAREN):
  12249. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12250. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12251. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12252. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12253. }
  12254. return int32(_XML_ROLE_GROUP_CLOSE)
  12255. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12256. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12257. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12258. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12259. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12260. }
  12261. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12262. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12263. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12264. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12265. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12266. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12267. }
  12268. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12269. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12270. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12271. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12272. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12273. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12274. }
  12275. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12276. case int32(m_XML_TOK_COMMA):
  12277. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12278. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12279. case int32(m_XML_TOK_OR):
  12280. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12281. return int32(_XML_ROLE_GROUP_CHOICE)
  12282. }
  12283. return _common(tls, state, tok)
  12284. }
  12285. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12286. switch tok {
  12287. case int32(m_XML_TOK_PROLOG_S):
  12288. return int32(_XML_ROLE_NONE)
  12289. case int32(m_XML_TOK_NAME):
  12290. 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 {
  12291. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12292. return int32(_XML_ROLE_NONE)
  12293. }
  12294. 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 {
  12295. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12296. return int32(_XML_ROLE_NONE)
  12297. }
  12298. break
  12299. }
  12300. return _common(tls, state, tok)
  12301. }
  12302. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12303. _ = ptr
  12304. _ = end
  12305. _ = enc
  12306. switch tok {
  12307. case int32(m_XML_TOK_PROLOG_S):
  12308. return int32(_XML_ROLE_NONE)
  12309. case int32(m_XML_TOK_OPEN_BRACKET):
  12310. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12311. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  12312. return int32(_XML_ROLE_NONE)
  12313. }
  12314. return _common(tls, state, tok)
  12315. }
  12316. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12317. _ = ptr
  12318. _ = end
  12319. _ = enc
  12320. switch tok {
  12321. case int32(m_XML_TOK_PROLOG_S):
  12322. return int32(_XML_ROLE_NONE)
  12323. case int32(m_XML_TOK_OPEN_BRACKET):
  12324. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12325. return int32(_XML_ROLE_IGNORE_SECT)
  12326. }
  12327. return _common(tls, state, tok)
  12328. }
  12329. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12330. var v1 uintptr
  12331. _ = v1
  12332. _ = ptr
  12333. _ = end
  12334. _ = enc
  12335. switch tok {
  12336. case int32(m_XML_TOK_PROLOG_S):
  12337. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12338. case int32(m_XML_TOK_DECL_CLOSE):
  12339. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12340. v1 = __ccgo_fp(_internalSubset)
  12341. } else {
  12342. v1 = __ccgo_fp(_externalSubset1)
  12343. }
  12344. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12345. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12346. }
  12347. return _common(tls, state, tok)
  12348. }
  12349. // C documentation
  12350. //
  12351. // /* This function will only be invoked if the internal logic of the
  12352. // * parser has broken down. It is used in two cases:
  12353. // *
  12354. // * 1: When the XML prolog has been finished. At this point the
  12355. // * processor (the parser level above these role handlers) should
  12356. // * switch from prologProcessor to contentProcessor and reinitialise
  12357. // * the handler function.
  12358. // *
  12359. // * 2: When an error has been detected (via common() below). At this
  12360. // * point again the processor should be switched to errorProcessor,
  12361. // * which will never call a handler.
  12362. // *
  12363. // * The result of this is that error() can only be called if the
  12364. // * processor switch failed to happen, which is an internal error and
  12365. // * therefore we shouldn't be able to provoke it simply by using the
  12366. // * library. It is a necessary backstop, however, so we merely exclude
  12367. // * it from the coverage statistics.
  12368. // *
  12369. // * LCOV_EXCL_START
  12370. // */
  12371. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12372. _ = state
  12373. _ = tok
  12374. _ = ptr
  12375. _ = end
  12376. _ = enc
  12377. return int32(_XML_ROLE_NONE)
  12378. }
  12379. /* LCOV_EXCL_STOP */
  12380. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12381. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12382. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12383. }
  12384. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12385. return int32(_XML_ROLE_ERROR)
  12386. }
  12387. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12388. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12389. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12390. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12391. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12392. }
  12393. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12394. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12395. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12396. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12397. }
  12398. const m_ASCII_02 = 48
  12399. const m_ASCII_12 = 49
  12400. const m_ASCII_22 = 50
  12401. const m_ASCII_32 = 51
  12402. const m_ASCII_41 = 52
  12403. const m_ASCII_51 = 53
  12404. const m_ASCII_61 = 54
  12405. const m_ASCII_71 = 55
  12406. const m_ASCII_82 = 56
  12407. const m_ASCII_92 = 57
  12408. const m_ASCII_AMP1 = 38
  12409. const m_ASCII_APOS1 = 39
  12410. const m_ASCII_COLON2 = 58
  12411. const m_ASCII_EQUALS2 = 61
  12412. const m_ASCII_EXCL2 = 33
  12413. const m_ASCII_G2 = 0x47
  12414. const m_ASCII_GT1 = 62
  12415. const m_ASCII_K1 = 0x4B
  12416. const m_ASCII_LSQB1 = 91
  12417. const m_ASCII_LT1 = 60
  12418. const m_ASCII_MINUS1 = 45
  12419. const m_ASCII_N1 = 0x4E
  12420. const m_ASCII_P2 = 0x50
  12421. const m_ASCII_PERIOD2 = 46
  12422. const m_ASCII_Q2 = 0x51
  12423. const m_ASCII_QUOT1 = 34
  12424. const m_ASCII_R1 = 0x52
  12425. const m_ASCII_RSQB1 = 93
  12426. const m_ASCII_SEMI1 = 59
  12427. const m_ASCII_SPACE1 = 32
  12428. const m_ASCII_TAB1 = 9
  12429. const m_ASCII_UNDERSCORE1 = 95
  12430. const m_ASCII_Y1 = 0x59
  12431. const m_ASCII_Z1 = 90
  12432. const m_ASCII_a2 = 97
  12433. const m_ASCII_b1 = 98
  12434. const m_ASCII_c2 = 99
  12435. const m_ASCII_d1 = 100
  12436. const m_ASCII_e2 = 101
  12437. const m_ASCII_f1 = 102
  12438. const m_ASCII_g2 = 103
  12439. const m_ASCII_i1 = 105
  12440. const m_ASCII_l2 = 108
  12441. const m_ASCII_m2 = 109
  12442. const m_ASCII_n2 = 110
  12443. const m_ASCII_o2 = 111
  12444. const m_ASCII_p2 = 112
  12445. const m_ASCII_q1 = 113
  12446. const m_ASCII_r2 = 114
  12447. const m_ASCII_s2 = 115
  12448. const m_ASCII_t2 = 116
  12449. const m_ASCII_u1 = 117
  12450. const m_ASCII_v1 = 118
  12451. const m_ASCII_x2 = 120
  12452. const m_ASCII_y1 = 121
  12453. const m_ASCII_z1 = 122
  12454. const m_ENCODING_MAX = 128
  12455. const m___bool_true_false_are_defined = 1
  12456. const m_bool = "_Bool"
  12457. const m_false = 0
  12458. const m_true = 1
  12459. const m_utf8_isName4 = "isNever"
  12460. const m_utf8_isNmstrt4 = "isNever"
  12461. var _namingBitmap = [320]uint32{
  12462. 8: uint32(0xFFFFFFFF),
  12463. 9: uint32(0xFFFFFFFF),
  12464. 10: uint32(0xFFFFFFFF),
  12465. 11: uint32(0xFFFFFFFF),
  12466. 12: uint32(0xFFFFFFFF),
  12467. 13: uint32(0xFFFFFFFF),
  12468. 14: uint32(0xFFFFFFFF),
  12469. 15: uint32(0xFFFFFFFF),
  12470. 17: uint32(0x04000000),
  12471. 18: uint32(0x87FFFFFE),
  12472. 19: uint32(0x07FFFFFE),
  12473. 22: uint32(0xFF7FFFFF),
  12474. 23: uint32(0xFF7FFFFF),
  12475. 24: uint32(0xFFFFFFFF),
  12476. 25: uint32(0x7FF3FFFF),
  12477. 26: uint32(0xFFFFFDFE),
  12478. 27: uint32(0x7FFFFFFF),
  12479. 28: uint32(0xFFFFFFFF),
  12480. 29: uint32(0xFFFFFFFF),
  12481. 30: uint32(0xFFFFE00F),
  12482. 31: uint32(0xFC31FFFF),
  12483. 32: uint32(0x00FFFFFF),
  12484. 34: uint32(0xFFFF0000),
  12485. 35: uint32(0xFFFFFFFF),
  12486. 36: uint32(0xFFFFFFFF),
  12487. 37: uint32(0xF80001FF),
  12488. 38: uint32(0x00000003),
  12489. 44: uint32(0xFFFFD740),
  12490. 45: uint32(0xFFFFFFFB),
  12491. 46: uint32(0x547F7FFF),
  12492. 47: uint32(0x000FFFFD),
  12493. 48: uint32(0xFFFFDFFE),
  12494. 49: uint32(0xFFFFFFFF),
  12495. 50: uint32(0xDFFEFFFF),
  12496. 51: uint32(0xFFFFFFFF),
  12497. 52: uint32(0xFFFF0003),
  12498. 53: uint32(0xFFFFFFFF),
  12499. 54: uint32(0xFFFF199F),
  12500. 55: uint32(0x033FCFFF),
  12501. 57: uint32(0xFFFE0000),
  12502. 58: uint32(0x027FFFFF),
  12503. 59: uint32(0xFFFFFFFE),
  12504. 60: uint32(0x0000007F),
  12505. 62: uint32(0xFFFF0000),
  12506. 63: uint32(0x000707FF),
  12507. 65: uint32(0x07FFFFFE),
  12508. 66: uint32(0x000007FE),
  12509. 67: uint32(0xFFFE0000),
  12510. 68: uint32(0xFFFFFFFF),
  12511. 69: uint32(0x7CFFFFFF),
  12512. 70: uint32(0x002F7FFF),
  12513. 71: uint32(0x00000060),
  12514. 72: uint32(0xFFFFFFE0),
  12515. 73: uint32(0x23FFFFFF),
  12516. 74: uint32(0xFF000000),
  12517. 75: uint32(0x00000003),
  12518. 76: uint32(0xFFF99FE0),
  12519. 77: uint32(0x03C5FDFF),
  12520. 78: uint32(0xB0000000),
  12521. 79: uint32(0x00030003),
  12522. 80: uint32(0xFFF987E0),
  12523. 81: uint32(0x036DFDFF),
  12524. 82: uint32(0x5E000000),
  12525. 83: uint32(0x001C0000),
  12526. 84: uint32(0xFFFBAFE0),
  12527. 85: uint32(0x23EDFDFF),
  12528. 87: uint32(0x00000001),
  12529. 88: uint32(0xFFF99FE0),
  12530. 89: uint32(0x23CDFDFF),
  12531. 90: uint32(0xB0000000),
  12532. 91: uint32(0x00000003),
  12533. 92: uint32(0xD63DC7E0),
  12534. 93: uint32(0x03BFC718),
  12535. 96: uint32(0xFFFDDFE0),
  12536. 97: uint32(0x03EFFDFF),
  12537. 99: uint32(0x00000003),
  12538. 100: uint32(0xFFFDDFE0),
  12539. 101: uint32(0x03EFFDFF),
  12540. 102: uint32(0x40000000),
  12541. 103: uint32(0x00000003),
  12542. 104: uint32(0xFFFDDFE0),
  12543. 105: uint32(0x03FFFDFF),
  12544. 107: uint32(0x00000003),
  12545. 112: uint32(0xFFFFFFFE),
  12546. 113: uint32(0x000D7FFF),
  12547. 114: uint32(0x0000003F),
  12548. 116: uint32(0xFEF02596),
  12549. 117: uint32(0x200D6CAE),
  12550. 118: uint32(0x0000001F),
  12551. 122: uint32(0xFFFFFEFF),
  12552. 123: uint32(0x000003FF),
  12553. 133: uint32(0xFFFFFFFF),
  12554. 134: uint32(0xFFFF003F),
  12555. 135: uint32(0x007FFFFF),
  12556. 136: uint32(0x0007DAED),
  12557. 137: uint32(0x50000000),
  12558. 138: uint32(0x82315001),
  12559. 139: uint32(0x002C62AB),
  12560. 140: uint32(0x40000000),
  12561. 141: uint32(0xF580C900),
  12562. 142: uint32(0x00000007),
  12563. 143: uint32(0x02010800),
  12564. 144: uint32(0xFFFFFFFF),
  12565. 145: uint32(0xFFFFFFFF),
  12566. 146: uint32(0xFFFFFFFF),
  12567. 147: uint32(0xFFFFFFFF),
  12568. 148: uint32(0x0FFFFFFF),
  12569. 149: uint32(0xFFFFFFFF),
  12570. 150: uint32(0xFFFFFFFF),
  12571. 151: uint32(0x03FFFFFF),
  12572. 152: uint32(0x3F3FFFFF),
  12573. 153: uint32(0xFFFFFFFF),
  12574. 154: uint32(0xAAFF3F3F),
  12575. 155: uint32(0x3FFFFFFF),
  12576. 156: uint32(0xFFFFFFFF),
  12577. 157: uint32(0x5FDFFFFF),
  12578. 158: uint32(0x0FCF1FDC),
  12579. 159: uint32(0x1FDC1FFF),
  12580. 161: uint32(0x00004C40),
  12581. 164: uint32(0x00000007),
  12582. 168: uint32(0x00000080),
  12583. 169: uint32(0x000003FE),
  12584. 170: uint32(0xFFFFFFFE),
  12585. 171: uint32(0xFFFFFFFF),
  12586. 172: uint32(0x001FFFFF),
  12587. 173: uint32(0xFFFFFFFE),
  12588. 174: uint32(0xFFFFFFFF),
  12589. 175: uint32(0x07FFFFFF),
  12590. 176: uint32(0xFFFFFFE0),
  12591. 177: uint32(0x00001FFF),
  12592. 184: uint32(0xFFFFFFFF),
  12593. 185: uint32(0xFFFFFFFF),
  12594. 186: uint32(0xFFFFFFFF),
  12595. 187: uint32(0xFFFFFFFF),
  12596. 188: uint32(0xFFFFFFFF),
  12597. 189: uint32(0x0000003F),
  12598. 192: uint32(0xFFFFFFFF),
  12599. 193: uint32(0xFFFFFFFF),
  12600. 194: uint32(0xFFFFFFFF),
  12601. 195: uint32(0xFFFFFFFF),
  12602. 196: uint32(0xFFFFFFFF),
  12603. 197: uint32(0x0000000F),
  12604. 201: uint32(0x07FF6000),
  12605. 202: uint32(0x87FFFFFE),
  12606. 203: uint32(0x07FFFFFE),
  12607. 205: uint32(0x00800000),
  12608. 206: uint32(0xFF7FFFFF),
  12609. 207: uint32(0xFF7FFFFF),
  12610. 208: uint32(0x00FFFFFF),
  12611. 210: uint32(0xFFFF0000),
  12612. 211: uint32(0xFFFFFFFF),
  12613. 212: uint32(0xFFFFFFFF),
  12614. 213: uint32(0xF80001FF),
  12615. 214: uint32(0x00030003),
  12616. 216: uint32(0xFFFFFFFF),
  12617. 217: uint32(0xFFFFFFFF),
  12618. 218: uint32(0x0000003F),
  12619. 219: uint32(0x00000003),
  12620. 220: uint32(0xFFFFD7C0),
  12621. 221: uint32(0xFFFFFFFB),
  12622. 222: uint32(0x547F7FFF),
  12623. 223: uint32(0x000FFFFD),
  12624. 224: uint32(0xFFFFDFFE),
  12625. 225: uint32(0xFFFFFFFF),
  12626. 226: uint32(0xDFFEFFFF),
  12627. 227: uint32(0xFFFFFFFF),
  12628. 228: uint32(0xFFFF007B),
  12629. 229: uint32(0xFFFFFFFF),
  12630. 230: uint32(0xFFFF199F),
  12631. 231: uint32(0x033FCFFF),
  12632. 233: uint32(0xFFFE0000),
  12633. 234: uint32(0x027FFFFF),
  12634. 235: uint32(0xFFFFFFFE),
  12635. 236: uint32(0xFFFE007F),
  12636. 237: uint32(0xBBFFFFFB),
  12637. 238: uint32(0xFFFF0016),
  12638. 239: uint32(0x000707FF),
  12639. 241: uint32(0x07FFFFFE),
  12640. 242: uint32(0x0007FFFF),
  12641. 243: uint32(0xFFFF03FF),
  12642. 244: uint32(0xFFFFFFFF),
  12643. 245: uint32(0x7CFFFFFF),
  12644. 246: uint32(0xFFEF7FFF),
  12645. 247: uint32(0x03FF3DFF),
  12646. 248: uint32(0xFFFFFFEE),
  12647. 249: uint32(0xF3FFFFFF),
  12648. 250: uint32(0xFF1E3FFF),
  12649. 251: uint32(0x0000FFCF),
  12650. 252: uint32(0xFFF99FEE),
  12651. 253: uint32(0xD3C5FDFF),
  12652. 254: uint32(0xB080399F),
  12653. 255: uint32(0x0003FFCF),
  12654. 256: uint32(0xFFF987E4),
  12655. 257: uint32(0xD36DFDFF),
  12656. 258: uint32(0x5E003987),
  12657. 259: uint32(0x001FFFC0),
  12658. 260: uint32(0xFFFBAFEE),
  12659. 261: uint32(0xF3EDFDFF),
  12660. 262: uint32(0x00003BBF),
  12661. 263: uint32(0x0000FFC1),
  12662. 264: uint32(0xFFF99FEE),
  12663. 265: uint32(0xF3CDFDFF),
  12664. 266: uint32(0xB0C0398F),
  12665. 267: uint32(0x0000FFC3),
  12666. 268: uint32(0xD63DC7EC),
  12667. 269: uint32(0xC3BFC718),
  12668. 270: uint32(0x00803DC7),
  12669. 271: uint32(0x0000FF80),
  12670. 272: uint32(0xFFFDDFEE),
  12671. 273: uint32(0xC3EFFDFF),
  12672. 274: uint32(0x00603DDF),
  12673. 275: uint32(0x0000FFC3),
  12674. 276: uint32(0xFFFDDFEC),
  12675. 277: uint32(0xC3EFFDFF),
  12676. 278: uint32(0x40603DDF),
  12677. 279: uint32(0x0000FFC3),
  12678. 280: uint32(0xFFFDDFEC),
  12679. 281: uint32(0xC3FFFDFF),
  12680. 282: uint32(0x00803DCF),
  12681. 283: uint32(0x0000FFC3),
  12682. 288: uint32(0xFFFFFFFE),
  12683. 289: uint32(0x07FF7FFF),
  12684. 290: uint32(0x03FF7FFF),
  12685. 292: uint32(0xFEF02596),
  12686. 293: uint32(0x3BFF6CAE),
  12687. 294: uint32(0x03FF3F5F),
  12688. 296: uint32(0x03000000),
  12689. 297: uint32(0xC2A003FF),
  12690. 298: uint32(0xFFFFFEFF),
  12691. 299: uint32(0xFFFE03FF),
  12692. 300: uint32(0xFEBF0FDF),
  12693. 301: uint32(0x02FE3FFF),
  12694. 310: uint32(0x1FFF0000),
  12695. 311: uint32(0x00000002),
  12696. 312: uint32(0x000000A0),
  12697. 313: uint32(0x003EFFFE),
  12698. 314: uint32(0xFFFFFFFE),
  12699. 315: uint32(0xFFFFFFFF),
  12700. 316: uint32(0x661FFFFF),
  12701. 317: uint32(0xFFFFFFFE),
  12702. 318: uint32(0xFFFFFFFF),
  12703. 319: uint32(0x77FFFFFF),
  12704. }
  12705. var _nmstrtPages = [256]uint8{
  12706. 0: uint8(0x02),
  12707. 1: uint8(0x03),
  12708. 2: uint8(0x04),
  12709. 3: uint8(0x05),
  12710. 4: uint8(0x06),
  12711. 5: uint8(0x07),
  12712. 6: uint8(0x08),
  12713. 9: uint8(0x09),
  12714. 10: uint8(0x0A),
  12715. 11: uint8(0x0B),
  12716. 12: uint8(0x0C),
  12717. 13: uint8(0x0D),
  12718. 14: uint8(0x0E),
  12719. 15: uint8(0x0F),
  12720. 16: uint8(0x10),
  12721. 17: uint8(0x11),
  12722. 30: uint8(0x12),
  12723. 31: uint8(0x13),
  12724. 33: uint8(0x14),
  12725. 48: uint8(0x15),
  12726. 49: uint8(0x16),
  12727. 78: uint8(0x01),
  12728. 79: uint8(0x01),
  12729. 80: uint8(0x01),
  12730. 81: uint8(0x01),
  12731. 82: uint8(0x01),
  12732. 83: uint8(0x01),
  12733. 84: uint8(0x01),
  12734. 85: uint8(0x01),
  12735. 86: uint8(0x01),
  12736. 87: uint8(0x01),
  12737. 88: uint8(0x01),
  12738. 89: uint8(0x01),
  12739. 90: uint8(0x01),
  12740. 91: uint8(0x01),
  12741. 92: uint8(0x01),
  12742. 93: uint8(0x01),
  12743. 94: uint8(0x01),
  12744. 95: uint8(0x01),
  12745. 96: uint8(0x01),
  12746. 97: uint8(0x01),
  12747. 98: uint8(0x01),
  12748. 99: uint8(0x01),
  12749. 100: uint8(0x01),
  12750. 101: uint8(0x01),
  12751. 102: uint8(0x01),
  12752. 103: uint8(0x01),
  12753. 104: uint8(0x01),
  12754. 105: uint8(0x01),
  12755. 106: uint8(0x01),
  12756. 107: uint8(0x01),
  12757. 108: uint8(0x01),
  12758. 109: uint8(0x01),
  12759. 110: uint8(0x01),
  12760. 111: uint8(0x01),
  12761. 112: uint8(0x01),
  12762. 113: uint8(0x01),
  12763. 114: uint8(0x01),
  12764. 115: uint8(0x01),
  12765. 116: uint8(0x01),
  12766. 117: uint8(0x01),
  12767. 118: uint8(0x01),
  12768. 119: uint8(0x01),
  12769. 120: uint8(0x01),
  12770. 121: uint8(0x01),
  12771. 122: uint8(0x01),
  12772. 123: uint8(0x01),
  12773. 124: uint8(0x01),
  12774. 125: uint8(0x01),
  12775. 126: uint8(0x01),
  12776. 127: uint8(0x01),
  12777. 128: uint8(0x01),
  12778. 129: uint8(0x01),
  12779. 130: uint8(0x01),
  12780. 131: uint8(0x01),
  12781. 132: uint8(0x01),
  12782. 133: uint8(0x01),
  12783. 134: uint8(0x01),
  12784. 135: uint8(0x01),
  12785. 136: uint8(0x01),
  12786. 137: uint8(0x01),
  12787. 138: uint8(0x01),
  12788. 139: uint8(0x01),
  12789. 140: uint8(0x01),
  12790. 141: uint8(0x01),
  12791. 142: uint8(0x01),
  12792. 143: uint8(0x01),
  12793. 144: uint8(0x01),
  12794. 145: uint8(0x01),
  12795. 146: uint8(0x01),
  12796. 147: uint8(0x01),
  12797. 148: uint8(0x01),
  12798. 149: uint8(0x01),
  12799. 150: uint8(0x01),
  12800. 151: uint8(0x01),
  12801. 152: uint8(0x01),
  12802. 153: uint8(0x01),
  12803. 154: uint8(0x01),
  12804. 155: uint8(0x01),
  12805. 156: uint8(0x01),
  12806. 157: uint8(0x01),
  12807. 158: uint8(0x01),
  12808. 159: uint8(0x17),
  12809. 172: uint8(0x01),
  12810. 173: uint8(0x01),
  12811. 174: uint8(0x01),
  12812. 175: uint8(0x01),
  12813. 176: uint8(0x01),
  12814. 177: uint8(0x01),
  12815. 178: uint8(0x01),
  12816. 179: uint8(0x01),
  12817. 180: uint8(0x01),
  12818. 181: uint8(0x01),
  12819. 182: uint8(0x01),
  12820. 183: uint8(0x01),
  12821. 184: uint8(0x01),
  12822. 185: uint8(0x01),
  12823. 186: uint8(0x01),
  12824. 187: uint8(0x01),
  12825. 188: uint8(0x01),
  12826. 189: uint8(0x01),
  12827. 190: uint8(0x01),
  12828. 191: uint8(0x01),
  12829. 192: uint8(0x01),
  12830. 193: uint8(0x01),
  12831. 194: uint8(0x01),
  12832. 195: uint8(0x01),
  12833. 196: uint8(0x01),
  12834. 197: uint8(0x01),
  12835. 198: uint8(0x01),
  12836. 199: uint8(0x01),
  12837. 200: uint8(0x01),
  12838. 201: uint8(0x01),
  12839. 202: uint8(0x01),
  12840. 203: uint8(0x01),
  12841. 204: uint8(0x01),
  12842. 205: uint8(0x01),
  12843. 206: uint8(0x01),
  12844. 207: uint8(0x01),
  12845. 208: uint8(0x01),
  12846. 209: uint8(0x01),
  12847. 210: uint8(0x01),
  12848. 211: uint8(0x01),
  12849. 212: uint8(0x01),
  12850. 213: uint8(0x01),
  12851. 214: uint8(0x01),
  12852. 215: uint8(0x18),
  12853. }
  12854. var _namePages = [256]uint8{
  12855. 0: uint8(0x19),
  12856. 1: uint8(0x03),
  12857. 2: uint8(0x1A),
  12858. 3: uint8(0x1B),
  12859. 4: uint8(0x1C),
  12860. 5: uint8(0x1D),
  12861. 6: uint8(0x1E),
  12862. 9: uint8(0x1F),
  12863. 10: uint8(0x20),
  12864. 11: uint8(0x21),
  12865. 12: uint8(0x22),
  12866. 13: uint8(0x23),
  12867. 14: uint8(0x24),
  12868. 15: uint8(0x25),
  12869. 16: uint8(0x10),
  12870. 17: uint8(0x11),
  12871. 30: uint8(0x12),
  12872. 31: uint8(0x13),
  12873. 32: uint8(0x26),
  12874. 33: uint8(0x14),
  12875. 48: uint8(0x27),
  12876. 49: uint8(0x16),
  12877. 78: uint8(0x01),
  12878. 79: uint8(0x01),
  12879. 80: uint8(0x01),
  12880. 81: uint8(0x01),
  12881. 82: uint8(0x01),
  12882. 83: uint8(0x01),
  12883. 84: uint8(0x01),
  12884. 85: uint8(0x01),
  12885. 86: uint8(0x01),
  12886. 87: uint8(0x01),
  12887. 88: uint8(0x01),
  12888. 89: uint8(0x01),
  12889. 90: uint8(0x01),
  12890. 91: uint8(0x01),
  12891. 92: uint8(0x01),
  12892. 93: uint8(0x01),
  12893. 94: uint8(0x01),
  12894. 95: uint8(0x01),
  12895. 96: uint8(0x01),
  12896. 97: uint8(0x01),
  12897. 98: uint8(0x01),
  12898. 99: uint8(0x01),
  12899. 100: uint8(0x01),
  12900. 101: uint8(0x01),
  12901. 102: uint8(0x01),
  12902. 103: uint8(0x01),
  12903. 104: uint8(0x01),
  12904. 105: uint8(0x01),
  12905. 106: uint8(0x01),
  12906. 107: uint8(0x01),
  12907. 108: uint8(0x01),
  12908. 109: uint8(0x01),
  12909. 110: uint8(0x01),
  12910. 111: uint8(0x01),
  12911. 112: uint8(0x01),
  12912. 113: uint8(0x01),
  12913. 114: uint8(0x01),
  12914. 115: uint8(0x01),
  12915. 116: uint8(0x01),
  12916. 117: uint8(0x01),
  12917. 118: uint8(0x01),
  12918. 119: uint8(0x01),
  12919. 120: uint8(0x01),
  12920. 121: uint8(0x01),
  12921. 122: uint8(0x01),
  12922. 123: uint8(0x01),
  12923. 124: uint8(0x01),
  12924. 125: uint8(0x01),
  12925. 126: uint8(0x01),
  12926. 127: uint8(0x01),
  12927. 128: uint8(0x01),
  12928. 129: uint8(0x01),
  12929. 130: uint8(0x01),
  12930. 131: uint8(0x01),
  12931. 132: uint8(0x01),
  12932. 133: uint8(0x01),
  12933. 134: uint8(0x01),
  12934. 135: uint8(0x01),
  12935. 136: uint8(0x01),
  12936. 137: uint8(0x01),
  12937. 138: uint8(0x01),
  12938. 139: uint8(0x01),
  12939. 140: uint8(0x01),
  12940. 141: uint8(0x01),
  12941. 142: uint8(0x01),
  12942. 143: uint8(0x01),
  12943. 144: uint8(0x01),
  12944. 145: uint8(0x01),
  12945. 146: uint8(0x01),
  12946. 147: uint8(0x01),
  12947. 148: uint8(0x01),
  12948. 149: uint8(0x01),
  12949. 150: uint8(0x01),
  12950. 151: uint8(0x01),
  12951. 152: uint8(0x01),
  12952. 153: uint8(0x01),
  12953. 154: uint8(0x01),
  12954. 155: uint8(0x01),
  12955. 156: uint8(0x01),
  12956. 157: uint8(0x01),
  12957. 158: uint8(0x01),
  12958. 159: uint8(0x17),
  12959. 172: uint8(0x01),
  12960. 173: uint8(0x01),
  12961. 174: uint8(0x01),
  12962. 175: uint8(0x01),
  12963. 176: uint8(0x01),
  12964. 177: uint8(0x01),
  12965. 178: uint8(0x01),
  12966. 179: uint8(0x01),
  12967. 180: uint8(0x01),
  12968. 181: uint8(0x01),
  12969. 182: uint8(0x01),
  12970. 183: uint8(0x01),
  12971. 184: uint8(0x01),
  12972. 185: uint8(0x01),
  12973. 186: uint8(0x01),
  12974. 187: uint8(0x01),
  12975. 188: uint8(0x01),
  12976. 189: uint8(0x01),
  12977. 190: uint8(0x01),
  12978. 191: uint8(0x01),
  12979. 192: uint8(0x01),
  12980. 193: uint8(0x01),
  12981. 194: uint8(0x01),
  12982. 195: uint8(0x01),
  12983. 196: uint8(0x01),
  12984. 197: uint8(0x01),
  12985. 198: uint8(0x01),
  12986. 199: uint8(0x01),
  12987. 200: uint8(0x01),
  12988. 201: uint8(0x01),
  12989. 202: uint8(0x01),
  12990. 203: uint8(0x01),
  12991. 204: uint8(0x01),
  12992. 205: uint8(0x01),
  12993. 206: uint8(0x01),
  12994. 207: uint8(0x01),
  12995. 208: uint8(0x01),
  12996. 209: uint8(0x01),
  12997. 210: uint8(0x01),
  12998. 211: uint8(0x01),
  12999. 212: uint8(0x01),
  13000. 213: uint8(0x01),
  13001. 214: uint8(0x01),
  13002. 215: uint8(0x18),
  13003. }
  13004. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  13005. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  13006. pages, 3 bits to add to that index and 5 bits to generate the mask.
  13007. */
  13008. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  13009. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  13010. into pages, 3 bits to add to that index and 5 bits to generate the
  13011. mask.
  13012. */
  13013. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  13014. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  13015. with the additional restriction of not allowing the Unicode
  13016. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  13017. Implementation details:
  13018. (A & 0x80) == 0 means A < 0x80
  13019. and
  13020. (A & 0xC0) == 0xC0 means A > 0xBF
  13021. */
  13022. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13023. _ = enc
  13024. _ = p
  13025. return 0
  13026. }
  13027. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13028. _ = enc
  13029. 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))))
  13030. }
  13031. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13032. _ = enc
  13033. 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))))
  13034. }
  13035. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13036. _ = enc
  13037. 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))))
  13038. }
  13039. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13040. _ = enc
  13041. 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))))
  13042. }
  13043. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13044. _ = enc
  13045. 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))
  13046. }
  13047. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13048. var v1, v3, v4 int32
  13049. var v2, v5, v6 bool
  13050. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  13051. _ = enc
  13052. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  13053. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  13054. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  13055. } else {
  13056. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  13057. }
  13058. }
  13059. if v6 = v2 || v1 != 0; !v6 {
  13060. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  13061. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13062. } else {
  13063. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  13064. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  13065. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  13066. } else {
  13067. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13068. }
  13069. }
  13070. v3 = libc.BoolInt32(v5 || v4 != 0)
  13071. }
  13072. }
  13073. return libc.BoolInt32(v6 || v3 != 0)
  13074. }
  13075. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13076. var v1, v2 int32
  13077. var v3, v4 bool
  13078. _, _, _, _ = v1, v2, v3, v4
  13079. _ = enc
  13080. 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 {
  13081. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  13082. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13083. } else {
  13084. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  13085. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  13086. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  13087. } else {
  13088. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13089. }
  13090. }
  13091. v1 = libc.BoolInt32(v3 || v2 != 0)
  13092. }
  13093. }
  13094. return libc.BoolInt32(v4 || v1 != 0)
  13095. }
  13096. type Tnormal_encoding = struct {
  13097. Fenc TENCODING
  13098. Ftype1 [256]uint8
  13099. FisName2 uintptr
  13100. FisName3 uintptr
  13101. FisName4 uintptr
  13102. FisNmstrt2 uintptr
  13103. FisNmstrt3 uintptr
  13104. FisNmstrt4 uintptr
  13105. FisInvalid2 uintptr
  13106. FisInvalid3 uintptr
  13107. FisInvalid4 uintptr
  13108. }
  13109. const _BT_NONXML = 0
  13110. const _BT_MALFORM = 1
  13111. const _BT_LT = 2
  13112. const _BT_AMP = 3
  13113. const _BT_RSQB = 4
  13114. const _BT_LEAD2 = 5
  13115. const _BT_LEAD3 = 6
  13116. const _BT_LEAD4 = 7
  13117. const _BT_TRAIL = 8
  13118. const _BT_CR = 9
  13119. const _BT_LF = 10
  13120. const _BT_GT = 11
  13121. const _BT_QUOT = 12
  13122. const _BT_APOS = 13
  13123. const _BT_EQUALS = 14
  13124. const _BT_QUEST = 15
  13125. const _BT_EXCL = 16
  13126. const _BT_SOL = 17
  13127. const _BT_SEMI = 18
  13128. const _BT_NUM = 19
  13129. const _BT_LSQB = 20
  13130. const _BT_S = 21
  13131. const _BT_NMSTRT = 22
  13132. const _BT_COLON = 23
  13133. const _BT_HEX = 24
  13134. const _BT_DIGIT = 25
  13135. const _BT_NAME = 26
  13136. const _BT_MINUS = 27
  13137. const _BT_OTHER = 28
  13138. const _BT_NONASCII = 29
  13139. const _BT_PERCNT = 30
  13140. const _BT_LPAR = 31
  13141. const _BT_RPAR = 32
  13142. const _BT_AST = 33
  13143. const _BT_PLUS = 34
  13144. const _BT_COMMA = 35
  13145. const _BT_VERBAR = 36
  13146. /*
  13147. __ __ _
  13148. ___\ \/ /_ __ __ _| |_
  13149. / _ \\ /| '_ \ / _` | __|
  13150. | __// \| |_) | (_| | |_
  13151. \___/_/\_\ .__/ \__,_|\__|
  13152. |_| XML parser
  13153. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13154. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13155. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13156. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13157. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13158. Licensed under the MIT license:
  13159. Permission is hereby granted, free of charge, to any person obtaining
  13160. a copy of this software and associated documentation files (the
  13161. "Software"), to deal in the Software without restriction, including
  13162. without limitation the rights to use, copy, modify, merge, publish,
  13163. distribute, sublicense, and/or sell copies of the Software, and to permit
  13164. persons to whom the Software is furnished to do so, subject to the
  13165. following conditions:
  13166. The above copyright notice and this permission notice shall be included
  13167. in all copies or substantial portions of the Software.
  13168. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13169. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13170. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13171. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13172. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13173. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13174. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13175. */
  13176. /* minimum bytes per character */
  13177. /* c is an ASCII character */
  13178. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13179. __ __ _
  13180. ___\ \/ /_ __ __ _| |_
  13181. / _ \\ /| '_ \ / _` | __|
  13182. | __// \| |_) | (_| | |_
  13183. \___/_/\_\ .__/ \__,_|\__|
  13184. |_| XML parser
  13185. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13186. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13187. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13188. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13189. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13190. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13191. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13192. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13193. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13194. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13195. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13196. Licensed under the MIT license:
  13197. Permission is hereby granted, free of charge, to any person obtaining
  13198. a copy of this software and associated documentation files (the
  13199. "Software"), to deal in the Software without restriction, including
  13200. without limitation the rights to use, copy, modify, merge, publish,
  13201. distribute, sublicense, and/or sell copies of the Software, and to permit
  13202. persons to whom the Software is furnished to do so, subject to the
  13203. following conditions:
  13204. The above copyright notice and this permission notice shall be included
  13205. in all copies or substantial portions of the Software.
  13206. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13207. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13208. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13209. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13210. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13211. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13212. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13213. */
  13214. /* ptr points to character following "<!-" */
  13215. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13216. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13217. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13219. return m_XML_TOK_INVALID
  13220. }
  13221. ptr += uintptr(1)
  13222. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13223. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13224. case int32(_BT_LEAD2):
  13225. if int64(end)-int64(ptr) < int64(2) {
  13226. return -int32(2)
  13227. }
  13228. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13229. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13230. return m_XML_TOK_INVALID
  13231. }
  13232. ptr += uintptr(2)
  13233. case int32(_BT_LEAD3):
  13234. if int64(end)-int64(ptr) < int64(3) {
  13235. return -int32(2)
  13236. }
  13237. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13238. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13239. return m_XML_TOK_INVALID
  13240. }
  13241. ptr += uintptr(3)
  13242. case int32(_BT_LEAD4):
  13243. if int64(end)-int64(ptr) < int64(4) {
  13244. return -int32(2)
  13245. }
  13246. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13248. return m_XML_TOK_INVALID
  13249. }
  13250. ptr += uintptr(4)
  13251. case int32(_BT_NONXML):
  13252. fallthrough
  13253. case int32(_BT_MALFORM):
  13254. fallthrough
  13255. case int32(_BT_TRAIL):
  13256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13257. return m_XML_TOK_INVALID
  13258. case int32(_BT_MINUS):
  13259. ptr += uintptr(1)
  13260. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13261. return -int32(1)
  13262. }
  13263. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13264. ptr += uintptr(1)
  13265. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13266. return -int32(1)
  13267. }
  13268. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13269. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13270. return m_XML_TOK_INVALID
  13271. }
  13272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13273. return int32(m_XML_TOK_COMMENT)
  13274. }
  13275. default:
  13276. ptr += uintptr(1)
  13277. break
  13278. }
  13279. }
  13280. }
  13281. return -int32(1)
  13282. }
  13283. /* ptr points to character following "<!" */
  13284. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13285. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13286. return -int32(1)
  13287. }
  13288. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13289. case int32(_BT_MINUS):
  13290. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13291. case int32(_BT_LSQB):
  13292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13293. return int32(m_XML_TOK_COND_SECT_OPEN)
  13294. case int32(_BT_NMSTRT):
  13295. fallthrough
  13296. case int32(_BT_HEX):
  13297. ptr += uintptr(1)
  13298. default:
  13299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13300. return m_XML_TOK_INVALID
  13301. }
  13302. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13303. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13304. case int32(_BT_PERCNT):
  13305. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  13306. return -int32(1)
  13307. }
  13308. /* don't allow <!ENTITY% foo "whatever"> */
  13309. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) {
  13310. case int32(_BT_S):
  13311. fallthrough
  13312. case int32(_BT_CR):
  13313. fallthrough
  13314. case int32(_BT_LF):
  13315. fallthrough
  13316. case int32(_BT_PERCNT):
  13317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13318. return m_XML_TOK_INVALID
  13319. }
  13320. /* fall through */
  13321. fallthrough
  13322. case int32(_BT_S):
  13323. fallthrough
  13324. case int32(_BT_CR):
  13325. fallthrough
  13326. case int32(_BT_LF):
  13327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13328. return int32(m_XML_TOK_DECL_OPEN)
  13329. case int32(_BT_NMSTRT):
  13330. fallthrough
  13331. case int32(_BT_HEX):
  13332. ptr += uintptr(1)
  13333. default:
  13334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13335. return m_XML_TOK_INVALID
  13336. }
  13337. }
  13338. return -int32(1)
  13339. }
  13340. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13341. var upper int32
  13342. _ = upper
  13343. upper = 0
  13344. _ = enc
  13345. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13346. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  13347. return int32(1)
  13348. }
  13349. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13350. case int32(m_ASCII_x2):
  13351. case int32(m_ASCII_X):
  13352. upper = int32(1)
  13353. default:
  13354. return int32(1)
  13355. }
  13356. ptr += uintptr(1)
  13357. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13358. case int32(m_ASCII_m2):
  13359. case int32(m_ASCII_M):
  13360. upper = int32(1)
  13361. default:
  13362. return int32(1)
  13363. }
  13364. ptr += uintptr(1)
  13365. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13366. case int32(m_ASCII_l2):
  13367. case int32(m_ASCII_L):
  13368. upper = int32(1)
  13369. default:
  13370. return int32(1)
  13371. }
  13372. if upper != 0 {
  13373. return 0
  13374. }
  13375. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13376. return int32(1)
  13377. }
  13378. /* ptr points to character following "<?" */
  13379. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13380. bp := tls.Alloc(16)
  13381. defer tls.Free(16)
  13382. var target uintptr
  13383. var _ /* tok at bp+0 */ int32
  13384. _ = target
  13385. target = ptr
  13386. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13387. return -int32(1)
  13388. }
  13389. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13390. case int32(_BT_NONASCII):
  13391. if !(libc.Int32FromInt32(0) != 0) {
  13392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13393. return m_XML_TOK_INVALID
  13394. } /* fall through */
  13395. fallthrough
  13396. case int32(_BT_NMSTRT):
  13397. fallthrough
  13398. case int32(_BT_HEX):
  13399. ptr += uintptr(1)
  13400. case int32(_BT_LEAD2):
  13401. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13402. return -int32(2)
  13403. }
  13404. 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) {
  13405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13406. return m_XML_TOK_INVALID
  13407. }
  13408. ptr += uintptr(2)
  13409. case int32(_BT_LEAD3):
  13410. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13411. return -int32(2)
  13412. }
  13413. 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) {
  13414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13415. return m_XML_TOK_INVALID
  13416. }
  13417. ptr += uintptr(3)
  13418. case int32(_BT_LEAD4):
  13419. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13420. return -int32(2)
  13421. }
  13422. 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) {
  13423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13424. return m_XML_TOK_INVALID
  13425. }
  13426. ptr += uintptr(4)
  13427. default:
  13428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13429. return m_XML_TOK_INVALID
  13430. }
  13431. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13432. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13433. case int32(_BT_NONASCII):
  13434. if !(libc.Int32FromInt32(0) != 0) {
  13435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13436. return m_XML_TOK_INVALID
  13437. } /* fall through */
  13438. fallthrough
  13439. case int32(_BT_NMSTRT):
  13440. fallthrough
  13441. case int32(_BT_HEX):
  13442. fallthrough
  13443. case int32(_BT_DIGIT):
  13444. fallthrough
  13445. case int32(_BT_NAME):
  13446. fallthrough
  13447. case int32(_BT_MINUS):
  13448. ptr += uintptr(1)
  13449. case int32(_BT_LEAD2):
  13450. if int64(end)-int64(ptr) < int64(2) {
  13451. return -int32(2)
  13452. }
  13453. 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) {
  13454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13455. return m_XML_TOK_INVALID
  13456. }
  13457. ptr += uintptr(2)
  13458. case int32(_BT_LEAD3):
  13459. if int64(end)-int64(ptr) < int64(3) {
  13460. return -int32(2)
  13461. }
  13462. 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) {
  13463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13464. return m_XML_TOK_INVALID
  13465. }
  13466. ptr += uintptr(3)
  13467. case int32(_BT_LEAD4):
  13468. if int64(end)-int64(ptr) < int64(4) {
  13469. return -int32(2)
  13470. }
  13471. 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) {
  13472. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13473. return m_XML_TOK_INVALID
  13474. }
  13475. ptr += uintptr(4)
  13476. case int32(_BT_S):
  13477. fallthrough
  13478. case int32(_BT_CR):
  13479. fallthrough
  13480. case int32(_BT_LF):
  13481. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13482. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13483. return m_XML_TOK_INVALID
  13484. }
  13485. ptr += uintptr(1)
  13486. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13487. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13488. case int32(_BT_LEAD2):
  13489. if int64(end)-int64(ptr) < int64(2) {
  13490. return -int32(2)
  13491. }
  13492. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13494. return m_XML_TOK_INVALID
  13495. }
  13496. ptr += uintptr(2)
  13497. case int32(_BT_LEAD3):
  13498. if int64(end)-int64(ptr) < int64(3) {
  13499. return -int32(2)
  13500. }
  13501. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13502. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13503. return m_XML_TOK_INVALID
  13504. }
  13505. ptr += uintptr(3)
  13506. case int32(_BT_LEAD4):
  13507. if int64(end)-int64(ptr) < int64(4) {
  13508. return -int32(2)
  13509. }
  13510. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13512. return m_XML_TOK_INVALID
  13513. }
  13514. ptr += uintptr(4)
  13515. case int32(_BT_NONXML):
  13516. fallthrough
  13517. case int32(_BT_MALFORM):
  13518. fallthrough
  13519. case int32(_BT_TRAIL):
  13520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13521. return m_XML_TOK_INVALID
  13522. case int32(_BT_QUEST):
  13523. ptr += uintptr(1)
  13524. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13525. return -int32(1)
  13526. }
  13527. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13529. return *(*int32)(unsafe.Pointer(bp))
  13530. }
  13531. default:
  13532. ptr += uintptr(1)
  13533. break
  13534. }
  13535. }
  13536. return -int32(1)
  13537. case int32(_BT_QUEST):
  13538. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13540. return m_XML_TOK_INVALID
  13541. }
  13542. ptr += uintptr(1)
  13543. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13544. return -int32(1)
  13545. }
  13546. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13548. return *(*int32)(unsafe.Pointer(bp))
  13549. }
  13550. /* fall through */
  13551. fallthrough
  13552. default:
  13553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13554. return m_XML_TOK_INVALID
  13555. }
  13556. }
  13557. return -int32(1)
  13558. }
  13559. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13560. var i int32
  13561. _ = i
  13562. _ = enc
  13563. /* CDATA[ */
  13564. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  13565. return -int32(1)
  13566. }
  13567. i = 0
  13568. for {
  13569. if !(i < int32(6)) {
  13570. break
  13571. }
  13572. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB[i])) {
  13573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13574. return m_XML_TOK_INVALID
  13575. }
  13576. goto _1
  13577. _1:
  13578. ;
  13579. i++
  13580. ptr += uintptr(1)
  13581. }
  13582. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13583. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13584. }
  13585. var _CDATA_LSQB = [6]int8{
  13586. 0: int8(m_ASCII_C),
  13587. 1: int8(m_ASCII_D),
  13588. 2: int8(m_ASCII_A),
  13589. 3: int8(m_ASCII_T),
  13590. 4: int8(m_ASCII_A),
  13591. 5: int8(m_ASCII_LSQB1),
  13592. }
  13593. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13594. var n Tsize_t
  13595. _ = n
  13596. if ptr >= end {
  13597. return -int32(4)
  13598. }
  13599. if int32(1) > int32(1) {
  13600. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13601. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13602. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13603. if n == uint64(0) {
  13604. return -int32(1)
  13605. }
  13606. end = ptr + uintptr(n)
  13607. }
  13608. }
  13609. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13610. case int32(_BT_RSQB):
  13611. ptr += uintptr(1)
  13612. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13613. return -int32(1)
  13614. }
  13615. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13616. break
  13617. }
  13618. ptr += uintptr(1)
  13619. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13620. return -int32(1)
  13621. }
  13622. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13623. ptr -= uintptr(1)
  13624. break
  13625. }
  13626. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13627. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13628. case int32(_BT_CR):
  13629. ptr += uintptr(1)
  13630. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13631. return -int32(1)
  13632. }
  13633. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  13634. ptr += uintptr(1)
  13635. }
  13636. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13637. return int32(m_XML_TOK_DATA_NEWLINE)
  13638. case int32(_BT_LF):
  13639. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13640. return int32(m_XML_TOK_DATA_NEWLINE)
  13641. case int32(_BT_LEAD2):
  13642. if int64(end)-int64(ptr) < int64(2) {
  13643. return -int32(2)
  13644. }
  13645. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13647. return m_XML_TOK_INVALID
  13648. }
  13649. ptr += uintptr(2)
  13650. case int32(_BT_LEAD3):
  13651. if int64(end)-int64(ptr) < int64(3) {
  13652. return -int32(2)
  13653. }
  13654. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13655. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13656. return m_XML_TOK_INVALID
  13657. }
  13658. ptr += uintptr(3)
  13659. case int32(_BT_LEAD4):
  13660. if int64(end)-int64(ptr) < int64(4) {
  13661. return -int32(2)
  13662. }
  13663. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13665. return m_XML_TOK_INVALID
  13666. }
  13667. ptr += uintptr(4)
  13668. case int32(_BT_NONXML):
  13669. fallthrough
  13670. case int32(_BT_MALFORM):
  13671. fallthrough
  13672. case int32(_BT_TRAIL):
  13673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13674. return m_XML_TOK_INVALID
  13675. default:
  13676. ptr += uintptr(1)
  13677. break
  13678. }
  13679. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13680. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13681. case int32(_BT_LEAD2):
  13682. 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 {
  13683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13684. return int32(m_XML_TOK_DATA_CHARS)
  13685. }
  13686. ptr += uintptr(2)
  13687. case int32(_BT_LEAD3):
  13688. 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 {
  13689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13690. return int32(m_XML_TOK_DATA_CHARS)
  13691. }
  13692. ptr += uintptr(3)
  13693. case int32(_BT_LEAD4):
  13694. 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 {
  13695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13696. return int32(m_XML_TOK_DATA_CHARS)
  13697. }
  13698. ptr += uintptr(4)
  13699. case int32(_BT_NONXML):
  13700. fallthrough
  13701. case int32(_BT_MALFORM):
  13702. fallthrough
  13703. case int32(_BT_TRAIL):
  13704. fallthrough
  13705. case int32(_BT_CR):
  13706. fallthrough
  13707. case int32(_BT_LF):
  13708. fallthrough
  13709. case int32(_BT_RSQB):
  13710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13711. return int32(m_XML_TOK_DATA_CHARS)
  13712. default:
  13713. ptr += uintptr(1)
  13714. break
  13715. }
  13716. }
  13717. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13718. return int32(m_XML_TOK_DATA_CHARS)
  13719. }
  13720. /* ptr points to character following "</" */
  13721. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13722. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13723. return -int32(1)
  13724. }
  13725. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13726. case int32(_BT_NONASCII):
  13727. if !(libc.Int32FromInt32(0) != 0) {
  13728. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13729. return m_XML_TOK_INVALID
  13730. } /* fall through */
  13731. fallthrough
  13732. case int32(_BT_NMSTRT):
  13733. fallthrough
  13734. case int32(_BT_HEX):
  13735. ptr += uintptr(1)
  13736. case int32(_BT_LEAD2):
  13737. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13738. return -int32(2)
  13739. }
  13740. 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) {
  13741. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13742. return m_XML_TOK_INVALID
  13743. }
  13744. ptr += uintptr(2)
  13745. case int32(_BT_LEAD3):
  13746. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13747. return -int32(2)
  13748. }
  13749. 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) {
  13750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13751. return m_XML_TOK_INVALID
  13752. }
  13753. ptr += uintptr(3)
  13754. case int32(_BT_LEAD4):
  13755. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13756. return -int32(2)
  13757. }
  13758. 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) {
  13759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13760. return m_XML_TOK_INVALID
  13761. }
  13762. ptr += uintptr(4)
  13763. default:
  13764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13765. return m_XML_TOK_INVALID
  13766. }
  13767. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13768. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13769. case int32(_BT_NONASCII):
  13770. goto _1
  13771. case int32(_BT_MINUS):
  13772. goto _2
  13773. case int32(_BT_NAME):
  13774. goto _3
  13775. case int32(_BT_DIGIT):
  13776. goto _4
  13777. case int32(_BT_HEX):
  13778. goto _5
  13779. case int32(_BT_NMSTRT):
  13780. goto _6
  13781. case int32(_BT_LEAD2):
  13782. goto _7
  13783. case int32(_BT_LEAD3):
  13784. goto _8
  13785. case int32(_BT_LEAD4):
  13786. goto _9
  13787. case int32(_BT_LF):
  13788. goto _10
  13789. case int32(_BT_CR):
  13790. goto _11
  13791. case int32(_BT_S):
  13792. goto _12
  13793. case int32(_BT_COLON):
  13794. goto _13
  13795. case int32(_BT_GT):
  13796. goto _14
  13797. default:
  13798. goto _15
  13799. }
  13800. goto _16
  13801. _1:
  13802. ;
  13803. if !(libc.Int32FromInt32(0) != 0) {
  13804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13805. return m_XML_TOK_INVALID
  13806. } /* fall through */
  13807. _6:
  13808. ;
  13809. _5:
  13810. ;
  13811. _4:
  13812. ;
  13813. _3:
  13814. ;
  13815. _2:
  13816. ;
  13817. ptr += uintptr(1)
  13818. goto _16
  13819. _7:
  13820. ;
  13821. if int64(end)-int64(ptr) < int64(2) {
  13822. return -int32(2)
  13823. }
  13824. 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) {
  13825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13826. return m_XML_TOK_INVALID
  13827. }
  13828. ptr += uintptr(2)
  13829. goto _16
  13830. _8:
  13831. ;
  13832. if int64(end)-int64(ptr) < int64(3) {
  13833. return -int32(2)
  13834. }
  13835. 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) {
  13836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13837. return m_XML_TOK_INVALID
  13838. }
  13839. ptr += uintptr(3)
  13840. goto _16
  13841. _9:
  13842. ;
  13843. if int64(end)-int64(ptr) < int64(4) {
  13844. return -int32(2)
  13845. }
  13846. 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) {
  13847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13848. return m_XML_TOK_INVALID
  13849. }
  13850. ptr += uintptr(4)
  13851. goto _16
  13852. _12:
  13853. ;
  13854. _11:
  13855. ;
  13856. _10:
  13857. ;
  13858. ptr += uintptr(1)
  13859. _19:
  13860. ;
  13861. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13862. goto _17
  13863. }
  13864. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13865. case int32(_BT_S):
  13866. fallthrough
  13867. case int32(_BT_CR):
  13868. fallthrough
  13869. case int32(_BT_LF):
  13870. case int32(_BT_GT):
  13871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13872. return int32(m_XML_TOK_END_TAG)
  13873. default:
  13874. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13875. return m_XML_TOK_INVALID
  13876. }
  13877. goto _18
  13878. _18:
  13879. ;
  13880. ptr += uintptr(1)
  13881. goto _19
  13882. goto _17
  13883. _17:
  13884. ;
  13885. return -int32(1)
  13886. _13:
  13887. ;
  13888. /* no need to check qname syntax here,
  13889. since end-tag must match exactly */
  13890. ptr += uintptr(1)
  13891. goto _16
  13892. _14:
  13893. ;
  13894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13895. return int32(m_XML_TOK_END_TAG)
  13896. _15:
  13897. ;
  13898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13899. return m_XML_TOK_INVALID
  13900. _16:
  13901. }
  13902. return -int32(1)
  13903. }
  13904. /* ptr points to character following "&#X" */
  13905. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13906. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13907. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13908. case int32(_BT_DIGIT):
  13909. fallthrough
  13910. case int32(_BT_HEX):
  13911. default:
  13912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13913. return m_XML_TOK_INVALID
  13914. }
  13915. ptr += uintptr(1)
  13916. for {
  13917. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13918. break
  13919. }
  13920. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13921. case int32(_BT_DIGIT):
  13922. fallthrough
  13923. case int32(_BT_HEX):
  13924. case int32(_BT_SEMI):
  13925. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13926. return int32(m_XML_TOK_CHAR_REF)
  13927. default:
  13928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13929. return m_XML_TOK_INVALID
  13930. }
  13931. goto _1
  13932. _1:
  13933. ;
  13934. ptr += uintptr(1)
  13935. }
  13936. }
  13937. return -int32(1)
  13938. }
  13939. /* ptr points to character following "&#" */
  13940. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13941. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13942. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  13943. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13944. }
  13945. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13946. case int32(_BT_DIGIT):
  13947. default:
  13948. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13949. return m_XML_TOK_INVALID
  13950. }
  13951. ptr += uintptr(1)
  13952. for {
  13953. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13954. break
  13955. }
  13956. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13957. case int32(_BT_DIGIT):
  13958. case int32(_BT_SEMI):
  13959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13960. return int32(m_XML_TOK_CHAR_REF)
  13961. default:
  13962. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13963. return m_XML_TOK_INVALID
  13964. }
  13965. goto _1
  13966. _1:
  13967. ;
  13968. ptr += uintptr(1)
  13969. }
  13970. }
  13971. return -int32(1)
  13972. }
  13973. /* ptr points to character following "&" */
  13974. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13975. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13976. return -int32(1)
  13977. }
  13978. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13979. case int32(_BT_NONASCII):
  13980. if !(libc.Int32FromInt32(0) != 0) {
  13981. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13982. return m_XML_TOK_INVALID
  13983. } /* fall through */
  13984. fallthrough
  13985. case int32(_BT_NMSTRT):
  13986. fallthrough
  13987. case int32(_BT_HEX):
  13988. ptr += uintptr(1)
  13989. case int32(_BT_LEAD2):
  13990. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13991. return -int32(2)
  13992. }
  13993. 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) {
  13994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13995. return m_XML_TOK_INVALID
  13996. }
  13997. ptr += uintptr(2)
  13998. case int32(_BT_LEAD3):
  13999. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14000. return -int32(2)
  14001. }
  14002. 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) {
  14003. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14004. return m_XML_TOK_INVALID
  14005. }
  14006. ptr += uintptr(3)
  14007. case int32(_BT_LEAD4):
  14008. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14009. return -int32(2)
  14010. }
  14011. 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) {
  14012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14013. return m_XML_TOK_INVALID
  14014. }
  14015. ptr += uintptr(4)
  14016. case int32(_BT_NUM):
  14017. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14018. default:
  14019. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14020. return m_XML_TOK_INVALID
  14021. }
  14022. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14023. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14024. case int32(_BT_NONASCII):
  14025. if !(libc.Int32FromInt32(0) != 0) {
  14026. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14027. return m_XML_TOK_INVALID
  14028. } /* fall through */
  14029. fallthrough
  14030. case int32(_BT_NMSTRT):
  14031. fallthrough
  14032. case int32(_BT_HEX):
  14033. fallthrough
  14034. case int32(_BT_DIGIT):
  14035. fallthrough
  14036. case int32(_BT_NAME):
  14037. fallthrough
  14038. case int32(_BT_MINUS):
  14039. ptr += uintptr(1)
  14040. case int32(_BT_LEAD2):
  14041. if int64(end)-int64(ptr) < int64(2) {
  14042. return -int32(2)
  14043. }
  14044. 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) {
  14045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14046. return m_XML_TOK_INVALID
  14047. }
  14048. ptr += uintptr(2)
  14049. case int32(_BT_LEAD3):
  14050. if int64(end)-int64(ptr) < int64(3) {
  14051. return -int32(2)
  14052. }
  14053. 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) {
  14054. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14055. return m_XML_TOK_INVALID
  14056. }
  14057. ptr += uintptr(3)
  14058. case int32(_BT_LEAD4):
  14059. if int64(end)-int64(ptr) < int64(4) {
  14060. return -int32(2)
  14061. }
  14062. 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) {
  14063. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14064. return m_XML_TOK_INVALID
  14065. }
  14066. ptr += uintptr(4)
  14067. case int32(_BT_SEMI):
  14068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14069. return int32(m_XML_TOK_ENTITY_REF)
  14070. default:
  14071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14072. return m_XML_TOK_INVALID
  14073. }
  14074. }
  14075. return -int32(1)
  14076. }
  14077. /* ptr points to character following first character of attribute name */
  14078. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14079. bp := tls.Alloc(16)
  14080. defer tls.Free(16)
  14081. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  14082. var hadColon, open, t, t1, tok int32
  14083. _, _, _, _, _ = hadColon, open, t, t1, tok
  14084. hadColon = 0
  14085. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14086. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14087. case int32(_BT_NONASCII):
  14088. goto _1
  14089. case int32(_BT_MINUS):
  14090. goto _2
  14091. case int32(_BT_NAME):
  14092. goto _3
  14093. case int32(_BT_DIGIT):
  14094. goto _4
  14095. case int32(_BT_HEX):
  14096. goto _5
  14097. case int32(_BT_NMSTRT):
  14098. goto _6
  14099. case int32(_BT_LEAD2):
  14100. goto _7
  14101. case int32(_BT_LEAD3):
  14102. goto _8
  14103. case int32(_BT_LEAD4):
  14104. goto _9
  14105. case int32(_BT_COLON):
  14106. goto _10
  14107. case int32(_BT_LF):
  14108. goto _11
  14109. case int32(_BT_CR):
  14110. goto _12
  14111. case int32(_BT_S):
  14112. goto _13
  14113. case int32(_BT_EQUALS):
  14114. goto _14
  14115. default:
  14116. goto _15
  14117. }
  14118. goto _16
  14119. _1:
  14120. ;
  14121. if !(libc.Int32FromInt32(0) != 0) {
  14122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14123. return m_XML_TOK_INVALID
  14124. } /* fall through */
  14125. _6:
  14126. ;
  14127. _5:
  14128. ;
  14129. _4:
  14130. ;
  14131. _3:
  14132. ;
  14133. _2:
  14134. ;
  14135. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14136. goto _16
  14137. _7:
  14138. ;
  14139. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14140. return -int32(2)
  14141. }
  14142. 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) {
  14143. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14144. return m_XML_TOK_INVALID
  14145. }
  14146. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14147. goto _16
  14148. _8:
  14149. ;
  14150. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14151. return -int32(2)
  14152. }
  14153. 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) {
  14154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14155. return m_XML_TOK_INVALID
  14156. }
  14157. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14158. goto _16
  14159. _9:
  14160. ;
  14161. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14162. return -int32(2)
  14163. }
  14164. 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) {
  14165. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14166. return m_XML_TOK_INVALID
  14167. }
  14168. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14169. goto _16
  14170. _10:
  14171. ;
  14172. if hadColon != 0 {
  14173. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14174. return m_XML_TOK_INVALID
  14175. }
  14176. hadColon = int32(1)
  14177. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14178. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14179. return -int32(1)
  14180. }
  14181. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14182. case int32(_BT_NONASCII):
  14183. if !(libc.Int32FromInt32(0) != 0) {
  14184. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14185. return m_XML_TOK_INVALID
  14186. } /* fall through */
  14187. fallthrough
  14188. case int32(_BT_NMSTRT):
  14189. fallthrough
  14190. case int32(_BT_HEX):
  14191. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14192. case int32(_BT_LEAD2):
  14193. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14194. return -int32(2)
  14195. }
  14196. 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) {
  14197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14198. return m_XML_TOK_INVALID
  14199. }
  14200. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14201. case int32(_BT_LEAD3):
  14202. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14203. return -int32(2)
  14204. }
  14205. 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) {
  14206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14207. return m_XML_TOK_INVALID
  14208. }
  14209. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14210. case int32(_BT_LEAD4):
  14211. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14212. return -int32(2)
  14213. }
  14214. 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) {
  14215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14216. return m_XML_TOK_INVALID
  14217. }
  14218. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14219. default:
  14220. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14221. return m_XML_TOK_INVALID
  14222. }
  14223. goto _16
  14224. _13:
  14225. ;
  14226. _12:
  14227. ;
  14228. _11:
  14229. ;
  14230. _19:
  14231. ;
  14232. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14233. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14234. return -int32(1)
  14235. }
  14236. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14237. if t == int32(_BT_EQUALS) {
  14238. goto _17
  14239. }
  14240. switch t {
  14241. case int32(_BT_S):
  14242. fallthrough
  14243. case int32(_BT_LF):
  14244. fallthrough
  14245. case int32(_BT_CR):
  14246. default:
  14247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14248. return m_XML_TOK_INVALID
  14249. }
  14250. goto _18
  14251. _18:
  14252. ;
  14253. goto _19
  14254. goto _17
  14255. _17:
  14256. ;
  14257. /* fall through */
  14258. _14:
  14259. ;
  14260. hadColon = 0
  14261. for {
  14262. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14263. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14264. return -int32(1)
  14265. }
  14266. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14267. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14268. break
  14269. }
  14270. switch open {
  14271. case int32(_BT_S):
  14272. fallthrough
  14273. case int32(_BT_LF):
  14274. fallthrough
  14275. case int32(_BT_CR):
  14276. default:
  14277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14278. return m_XML_TOK_INVALID
  14279. }
  14280. goto _20
  14281. _20:
  14282. }
  14283. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14284. /* in attribute value */
  14285. for {
  14286. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14287. return -int32(1)
  14288. }
  14289. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14290. if t1 == open {
  14291. break
  14292. }
  14293. switch t1 {
  14294. case int32(_BT_LEAD2):
  14295. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14296. return -int32(2)
  14297. }
  14298. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14300. return m_XML_TOK_INVALID
  14301. }
  14302. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14303. case int32(_BT_LEAD3):
  14304. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14305. return -int32(2)
  14306. }
  14307. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14309. return m_XML_TOK_INVALID
  14310. }
  14311. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14312. case int32(_BT_LEAD4):
  14313. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14314. return -int32(2)
  14315. }
  14316. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14318. return m_XML_TOK_INVALID
  14319. }
  14320. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14321. case int32(_BT_NONXML):
  14322. fallthrough
  14323. case int32(_BT_MALFORM):
  14324. fallthrough
  14325. case int32(_BT_TRAIL):
  14326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14327. return m_XML_TOK_INVALID
  14328. case int32(_BT_AMP):
  14329. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14330. if tok <= 0 {
  14331. if tok == m_XML_TOK_INVALID {
  14332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14333. }
  14334. return tok
  14335. }
  14336. case int32(_BT_LT):
  14337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14338. return m_XML_TOK_INVALID
  14339. default:
  14340. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14341. break
  14342. }
  14343. goto _21
  14344. _21:
  14345. }
  14346. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14347. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14348. return -int32(1)
  14349. }
  14350. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14351. case int32(_BT_S):
  14352. fallthrough
  14353. case int32(_BT_CR):
  14354. fallthrough
  14355. case int32(_BT_LF):
  14356. case int32(_BT_SOL):
  14357. goto sol
  14358. case int32(_BT_GT):
  14359. goto gt
  14360. default:
  14361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14362. return m_XML_TOK_INVALID
  14363. }
  14364. /* ptr points to closing quote */
  14365. _24:
  14366. ;
  14367. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14368. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14369. return -int32(1)
  14370. }
  14371. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14372. case int32(_BT_NONASCII):
  14373. goto _25
  14374. case int32(_BT_HEX):
  14375. goto _26
  14376. case int32(_BT_NMSTRT):
  14377. goto _27
  14378. case int32(_BT_LEAD2):
  14379. goto _28
  14380. case int32(_BT_LEAD3):
  14381. goto _29
  14382. case int32(_BT_LEAD4):
  14383. goto _30
  14384. case int32(_BT_LF):
  14385. goto _31
  14386. case int32(_BT_CR):
  14387. goto _32
  14388. case int32(_BT_S):
  14389. goto _33
  14390. case int32(_BT_GT):
  14391. goto _34
  14392. case int32(_BT_SOL):
  14393. goto _35
  14394. default:
  14395. goto _36
  14396. }
  14397. goto _37
  14398. _25:
  14399. ;
  14400. if !(libc.Int32FromInt32(0) != 0) {
  14401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14402. return m_XML_TOK_INVALID
  14403. } /* fall through */
  14404. _27:
  14405. ;
  14406. _26:
  14407. ;
  14408. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14409. goto _37
  14410. _28:
  14411. ;
  14412. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14413. return -int32(2)
  14414. }
  14415. 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) {
  14416. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14417. return m_XML_TOK_INVALID
  14418. }
  14419. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14420. goto _37
  14421. _29:
  14422. ;
  14423. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14424. return -int32(2)
  14425. }
  14426. 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) {
  14427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14428. return m_XML_TOK_INVALID
  14429. }
  14430. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14431. goto _37
  14432. _30:
  14433. ;
  14434. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14435. return -int32(2)
  14436. }
  14437. 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) {
  14438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14439. return m_XML_TOK_INVALID
  14440. }
  14441. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14442. goto _37
  14443. _33:
  14444. ;
  14445. _32:
  14446. ;
  14447. _31:
  14448. ;
  14449. goto _23
  14450. _34:
  14451. ;
  14452. goto gt
  14453. gt:
  14454. ;
  14455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14456. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14457. _35:
  14458. ;
  14459. goto sol
  14460. sol:
  14461. ;
  14462. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14463. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14464. return -int32(1)
  14465. }
  14466. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14468. return m_XML_TOK_INVALID
  14469. }
  14470. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14471. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14472. _36:
  14473. ;
  14474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14475. return m_XML_TOK_INVALID
  14476. _37:
  14477. ;
  14478. goto _22
  14479. goto _23
  14480. _23:
  14481. ;
  14482. goto _24
  14483. goto _22
  14484. _22:
  14485. ;
  14486. goto _16
  14487. _15:
  14488. ;
  14489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14490. return m_XML_TOK_INVALID
  14491. _16:
  14492. }
  14493. return -int32(1)
  14494. }
  14495. /* ptr points to character following "<" */
  14496. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14497. var hadColon int32
  14498. _ = hadColon
  14499. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14500. return -int32(1)
  14501. }
  14502. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14503. case int32(_BT_NONASCII):
  14504. if !(libc.Int32FromInt32(0) != 0) {
  14505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14506. return m_XML_TOK_INVALID
  14507. } /* fall through */
  14508. fallthrough
  14509. case int32(_BT_NMSTRT):
  14510. fallthrough
  14511. case int32(_BT_HEX):
  14512. ptr += uintptr(1)
  14513. case int32(_BT_LEAD2):
  14514. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14515. return -int32(2)
  14516. }
  14517. 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) {
  14518. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14519. return m_XML_TOK_INVALID
  14520. }
  14521. ptr += uintptr(2)
  14522. case int32(_BT_LEAD3):
  14523. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14524. return -int32(2)
  14525. }
  14526. 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) {
  14527. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14528. return m_XML_TOK_INVALID
  14529. }
  14530. ptr += uintptr(3)
  14531. case int32(_BT_LEAD4):
  14532. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14533. return -int32(2)
  14534. }
  14535. 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) {
  14536. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14537. return m_XML_TOK_INVALID
  14538. }
  14539. ptr += uintptr(4)
  14540. case int32(_BT_EXCL):
  14541. ptr += uintptr(1)
  14542. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14543. return -int32(1)
  14544. }
  14545. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14546. case int32(_BT_MINUS):
  14547. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14548. case int32(_BT_LSQB):
  14549. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14550. }
  14551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14552. return m_XML_TOK_INVALID
  14553. case int32(_BT_QUEST):
  14554. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14555. case int32(_BT_SOL):
  14556. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14557. default:
  14558. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14559. return m_XML_TOK_INVALID
  14560. }
  14561. hadColon = 0
  14562. /* we have a start-tag */
  14563. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14564. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14565. case int32(_BT_NONASCII):
  14566. goto _1
  14567. case int32(_BT_MINUS):
  14568. goto _2
  14569. case int32(_BT_NAME):
  14570. goto _3
  14571. case int32(_BT_DIGIT):
  14572. goto _4
  14573. case int32(_BT_HEX):
  14574. goto _5
  14575. case int32(_BT_NMSTRT):
  14576. goto _6
  14577. case int32(_BT_LEAD2):
  14578. goto _7
  14579. case int32(_BT_LEAD3):
  14580. goto _8
  14581. case int32(_BT_LEAD4):
  14582. goto _9
  14583. case int32(_BT_COLON):
  14584. goto _10
  14585. case int32(_BT_LF):
  14586. goto _11
  14587. case int32(_BT_CR):
  14588. goto _12
  14589. case int32(_BT_S):
  14590. goto _13
  14591. case int32(_BT_GT):
  14592. goto _14
  14593. case int32(_BT_SOL):
  14594. goto _15
  14595. default:
  14596. goto _16
  14597. }
  14598. goto _17
  14599. _1:
  14600. ;
  14601. if !(libc.Int32FromInt32(0) != 0) {
  14602. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14603. return m_XML_TOK_INVALID
  14604. } /* fall through */
  14605. _6:
  14606. ;
  14607. _5:
  14608. ;
  14609. _4:
  14610. ;
  14611. _3:
  14612. ;
  14613. _2:
  14614. ;
  14615. ptr += uintptr(1)
  14616. goto _17
  14617. _7:
  14618. ;
  14619. if int64(end)-int64(ptr) < int64(2) {
  14620. return -int32(2)
  14621. }
  14622. 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) {
  14623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14624. return m_XML_TOK_INVALID
  14625. }
  14626. ptr += uintptr(2)
  14627. goto _17
  14628. _8:
  14629. ;
  14630. if int64(end)-int64(ptr) < int64(3) {
  14631. return -int32(2)
  14632. }
  14633. 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) {
  14634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14635. return m_XML_TOK_INVALID
  14636. }
  14637. ptr += uintptr(3)
  14638. goto _17
  14639. _9:
  14640. ;
  14641. if int64(end)-int64(ptr) < int64(4) {
  14642. return -int32(2)
  14643. }
  14644. 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) {
  14645. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14646. return m_XML_TOK_INVALID
  14647. }
  14648. ptr += uintptr(4)
  14649. goto _17
  14650. _10:
  14651. ;
  14652. if hadColon != 0 {
  14653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14654. return m_XML_TOK_INVALID
  14655. }
  14656. hadColon = int32(1)
  14657. ptr += uintptr(1)
  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. default:
  14700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14701. return m_XML_TOK_INVALID
  14702. }
  14703. goto _17
  14704. _13:
  14705. ;
  14706. _12:
  14707. ;
  14708. _11:
  14709. ;
  14710. ptr += uintptr(1)
  14711. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14712. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14713. case int32(_BT_NONASCII):
  14714. if !(libc.Int32FromInt32(0) != 0) {
  14715. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14716. return m_XML_TOK_INVALID
  14717. } /* fall through */
  14718. fallthrough
  14719. case int32(_BT_NMSTRT):
  14720. fallthrough
  14721. case int32(_BT_HEX):
  14722. ptr += uintptr(1)
  14723. case int32(_BT_LEAD2):
  14724. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14725. return -int32(2)
  14726. }
  14727. 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) {
  14728. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14729. return m_XML_TOK_INVALID
  14730. }
  14731. ptr += uintptr(2)
  14732. case int32(_BT_LEAD3):
  14733. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14734. return -int32(2)
  14735. }
  14736. 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) {
  14737. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14738. return m_XML_TOK_INVALID
  14739. }
  14740. ptr += uintptr(3)
  14741. case int32(_BT_LEAD4):
  14742. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14743. return -int32(2)
  14744. }
  14745. 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) {
  14746. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14747. return m_XML_TOK_INVALID
  14748. }
  14749. ptr += uintptr(4)
  14750. case int32(_BT_GT):
  14751. goto gt
  14752. case int32(_BT_SOL):
  14753. goto sol
  14754. case int32(_BT_S):
  14755. fallthrough
  14756. case int32(_BT_CR):
  14757. fallthrough
  14758. case int32(_BT_LF):
  14759. ptr += uintptr(1)
  14760. continue
  14761. default:
  14762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14763. return m_XML_TOK_INVALID
  14764. }
  14765. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14766. }
  14767. return -int32(1)
  14768. _14:
  14769. ;
  14770. goto gt
  14771. gt:
  14772. ;
  14773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14774. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14775. _15:
  14776. ;
  14777. goto sol
  14778. sol:
  14779. ;
  14780. ptr += uintptr(1)
  14781. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14782. return -int32(1)
  14783. }
  14784. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14785. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14786. return m_XML_TOK_INVALID
  14787. }
  14788. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14789. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14790. _16:
  14791. ;
  14792. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14793. return m_XML_TOK_INVALID
  14794. _17:
  14795. }
  14796. return -int32(1)
  14797. }
  14798. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14799. var n Tsize_t
  14800. _ = n
  14801. if ptr >= end {
  14802. return -int32(4)
  14803. }
  14804. if int32(1) > int32(1) {
  14805. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  14806. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14807. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14808. if n == uint64(0) {
  14809. return -int32(1)
  14810. }
  14811. end = ptr + uintptr(n)
  14812. }
  14813. }
  14814. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14815. case int32(_BT_LT):
  14816. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14817. case int32(_BT_AMP):
  14818. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14819. case int32(_BT_CR):
  14820. ptr += uintptr(1)
  14821. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14822. return -int32(3)
  14823. }
  14824. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  14825. ptr += uintptr(1)
  14826. }
  14827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14828. return int32(m_XML_TOK_DATA_NEWLINE)
  14829. case int32(_BT_LF):
  14830. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14831. return int32(m_XML_TOK_DATA_NEWLINE)
  14832. case int32(_BT_RSQB):
  14833. ptr += uintptr(1)
  14834. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14835. return -int32(5)
  14836. }
  14837. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14838. break
  14839. }
  14840. ptr += uintptr(1)
  14841. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14842. return -int32(5)
  14843. }
  14844. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14845. ptr -= uintptr(1)
  14846. break
  14847. }
  14848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14849. return m_XML_TOK_INVALID
  14850. case int32(_BT_LEAD2):
  14851. if int64(end)-int64(ptr) < int64(2) {
  14852. return -int32(2)
  14853. }
  14854. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14856. return m_XML_TOK_INVALID
  14857. }
  14858. ptr += uintptr(2)
  14859. case int32(_BT_LEAD3):
  14860. if int64(end)-int64(ptr) < int64(3) {
  14861. return -int32(2)
  14862. }
  14863. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14864. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14865. return m_XML_TOK_INVALID
  14866. }
  14867. ptr += uintptr(3)
  14868. case int32(_BT_LEAD4):
  14869. if int64(end)-int64(ptr) < int64(4) {
  14870. return -int32(2)
  14871. }
  14872. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14873. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14874. return m_XML_TOK_INVALID
  14875. }
  14876. ptr += uintptr(4)
  14877. case int32(_BT_NONXML):
  14878. fallthrough
  14879. case int32(_BT_MALFORM):
  14880. fallthrough
  14881. case int32(_BT_TRAIL):
  14882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14883. return m_XML_TOK_INVALID
  14884. default:
  14885. ptr += uintptr(1)
  14886. break
  14887. }
  14888. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14889. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14890. case int32(_BT_LEAD2):
  14891. 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 {
  14892. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14893. return int32(m_XML_TOK_DATA_CHARS)
  14894. }
  14895. ptr += uintptr(2)
  14896. case int32(_BT_LEAD3):
  14897. 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 {
  14898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14899. return int32(m_XML_TOK_DATA_CHARS)
  14900. }
  14901. ptr += uintptr(3)
  14902. case int32(_BT_LEAD4):
  14903. 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 {
  14904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14905. return int32(m_XML_TOK_DATA_CHARS)
  14906. }
  14907. ptr += uintptr(4)
  14908. case int32(_BT_RSQB):
  14909. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  14910. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14911. ptr += uintptr(1)
  14912. break
  14913. }
  14914. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  14915. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14916. ptr += uintptr(1)
  14917. break
  14918. }
  14919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  14920. return m_XML_TOK_INVALID
  14921. }
  14922. }
  14923. /* fall through */
  14924. fallthrough
  14925. case int32(_BT_AMP):
  14926. fallthrough
  14927. case int32(_BT_LT):
  14928. fallthrough
  14929. case int32(_BT_NONXML):
  14930. fallthrough
  14931. case int32(_BT_MALFORM):
  14932. fallthrough
  14933. case int32(_BT_TRAIL):
  14934. fallthrough
  14935. case int32(_BT_CR):
  14936. fallthrough
  14937. case int32(_BT_LF):
  14938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14939. return int32(m_XML_TOK_DATA_CHARS)
  14940. default:
  14941. ptr += uintptr(1)
  14942. break
  14943. }
  14944. }
  14945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14946. return int32(m_XML_TOK_DATA_CHARS)
  14947. }
  14948. /* ptr points to character following "%" */
  14949. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14950. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14951. return -int32(1)
  14952. }
  14953. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14954. case int32(_BT_NONASCII):
  14955. if !(libc.Int32FromInt32(0) != 0) {
  14956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14957. return m_XML_TOK_INVALID
  14958. } /* fall through */
  14959. fallthrough
  14960. case int32(_BT_NMSTRT):
  14961. fallthrough
  14962. case int32(_BT_HEX):
  14963. ptr += uintptr(1)
  14964. case int32(_BT_LEAD2):
  14965. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14966. return -int32(2)
  14967. }
  14968. 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) {
  14969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14970. return m_XML_TOK_INVALID
  14971. }
  14972. ptr += uintptr(2)
  14973. case int32(_BT_LEAD3):
  14974. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14975. return -int32(2)
  14976. }
  14977. 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) {
  14978. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14979. return m_XML_TOK_INVALID
  14980. }
  14981. ptr += uintptr(3)
  14982. case int32(_BT_LEAD4):
  14983. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14984. return -int32(2)
  14985. }
  14986. 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) {
  14987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14988. return m_XML_TOK_INVALID
  14989. }
  14990. ptr += uintptr(4)
  14991. case int32(_BT_S):
  14992. fallthrough
  14993. case int32(_BT_LF):
  14994. fallthrough
  14995. case int32(_BT_CR):
  14996. fallthrough
  14997. case int32(_BT_PERCNT):
  14998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14999. return int32(m_XML_TOK_PERCENT)
  15000. default:
  15001. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15002. return m_XML_TOK_INVALID
  15003. }
  15004. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15005. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15006. case int32(_BT_NONASCII):
  15007. if !(libc.Int32FromInt32(0) != 0) {
  15008. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15009. return m_XML_TOK_INVALID
  15010. } /* fall through */
  15011. fallthrough
  15012. case int32(_BT_NMSTRT):
  15013. fallthrough
  15014. case int32(_BT_HEX):
  15015. fallthrough
  15016. case int32(_BT_DIGIT):
  15017. fallthrough
  15018. case int32(_BT_NAME):
  15019. fallthrough
  15020. case int32(_BT_MINUS):
  15021. ptr += uintptr(1)
  15022. case int32(_BT_LEAD2):
  15023. if int64(end)-int64(ptr) < int64(2) {
  15024. return -int32(2)
  15025. }
  15026. 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) {
  15027. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15028. return m_XML_TOK_INVALID
  15029. }
  15030. ptr += uintptr(2)
  15031. case int32(_BT_LEAD3):
  15032. if int64(end)-int64(ptr) < int64(3) {
  15033. return -int32(2)
  15034. }
  15035. 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) {
  15036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15037. return m_XML_TOK_INVALID
  15038. }
  15039. ptr += uintptr(3)
  15040. case int32(_BT_LEAD4):
  15041. if int64(end)-int64(ptr) < int64(4) {
  15042. return -int32(2)
  15043. }
  15044. 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) {
  15045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15046. return m_XML_TOK_INVALID
  15047. }
  15048. ptr += uintptr(4)
  15049. case int32(_BT_SEMI):
  15050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15051. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  15052. default:
  15053. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15054. return m_XML_TOK_INVALID
  15055. }
  15056. }
  15057. return -int32(1)
  15058. }
  15059. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15060. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15061. return -int32(1)
  15062. }
  15063. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15064. case int32(_BT_NONASCII):
  15065. if !(libc.Int32FromInt32(0) != 0) {
  15066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15067. return m_XML_TOK_INVALID
  15068. } /* fall through */
  15069. fallthrough
  15070. case int32(_BT_NMSTRT):
  15071. fallthrough
  15072. case int32(_BT_HEX):
  15073. ptr += uintptr(1)
  15074. case int32(_BT_LEAD2):
  15075. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  15076. return -int32(2)
  15077. }
  15078. 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) {
  15079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15080. return m_XML_TOK_INVALID
  15081. }
  15082. ptr += uintptr(2)
  15083. case int32(_BT_LEAD3):
  15084. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  15085. return -int32(2)
  15086. }
  15087. 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) {
  15088. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15089. return m_XML_TOK_INVALID
  15090. }
  15091. ptr += uintptr(3)
  15092. case int32(_BT_LEAD4):
  15093. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  15094. return -int32(2)
  15095. }
  15096. 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) {
  15097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15098. return m_XML_TOK_INVALID
  15099. }
  15100. ptr += uintptr(4)
  15101. default:
  15102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15103. return m_XML_TOK_INVALID
  15104. }
  15105. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15106. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15107. case int32(_BT_NONASCII):
  15108. if !(libc.Int32FromInt32(0) != 0) {
  15109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15110. return m_XML_TOK_INVALID
  15111. } /* fall through */
  15112. fallthrough
  15113. case int32(_BT_NMSTRT):
  15114. fallthrough
  15115. case int32(_BT_HEX):
  15116. fallthrough
  15117. case int32(_BT_DIGIT):
  15118. fallthrough
  15119. case int32(_BT_NAME):
  15120. fallthrough
  15121. case int32(_BT_MINUS):
  15122. ptr += uintptr(1)
  15123. case int32(_BT_LEAD2):
  15124. if int64(end)-int64(ptr) < int64(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)).FisName2})))(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(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)).FisName3})))(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(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)).FisName4})))(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_CR):
  15151. fallthrough
  15152. case int32(_BT_LF):
  15153. fallthrough
  15154. case int32(_BT_S):
  15155. fallthrough
  15156. case int32(_BT_RPAR):
  15157. fallthrough
  15158. case int32(_BT_GT):
  15159. fallthrough
  15160. case int32(_BT_PERCNT):
  15161. fallthrough
  15162. case int32(_BT_VERBAR):
  15163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15164. return int32(m_XML_TOK_POUND_NAME)
  15165. default:
  15166. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15167. return m_XML_TOK_INVALID
  15168. }
  15169. }
  15170. return -int32(m_XML_TOK_POUND_NAME)
  15171. }
  15172. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15173. var t int32
  15174. _ = t
  15175. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15176. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  15177. switch t {
  15178. case int32(_BT_LEAD2):
  15179. if int64(end)-int64(ptr) < int64(2) {
  15180. return -int32(2)
  15181. }
  15182. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15184. return m_XML_TOK_INVALID
  15185. }
  15186. ptr += uintptr(2)
  15187. case int32(_BT_LEAD3):
  15188. if int64(end)-int64(ptr) < int64(3) {
  15189. return -int32(2)
  15190. }
  15191. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15193. return m_XML_TOK_INVALID
  15194. }
  15195. ptr += uintptr(3)
  15196. case int32(_BT_LEAD4):
  15197. if int64(end)-int64(ptr) < int64(4) {
  15198. return -int32(2)
  15199. }
  15200. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15202. return m_XML_TOK_INVALID
  15203. }
  15204. ptr += uintptr(4)
  15205. case int32(_BT_NONXML):
  15206. fallthrough
  15207. case int32(_BT_MALFORM):
  15208. fallthrough
  15209. case int32(_BT_TRAIL):
  15210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15211. return m_XML_TOK_INVALID
  15212. case int32(_BT_QUOT):
  15213. fallthrough
  15214. case int32(_BT_APOS):
  15215. ptr += uintptr(1)
  15216. if t != open {
  15217. break
  15218. }
  15219. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15220. return -int32(m_XML_TOK_LITERAL)
  15221. }
  15222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15223. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15224. case int32(_BT_S):
  15225. fallthrough
  15226. case int32(_BT_CR):
  15227. fallthrough
  15228. case int32(_BT_LF):
  15229. fallthrough
  15230. case int32(_BT_GT):
  15231. fallthrough
  15232. case int32(_BT_PERCNT):
  15233. fallthrough
  15234. case int32(_BT_LSQB):
  15235. return int32(m_XML_TOK_LITERAL)
  15236. default:
  15237. return m_XML_TOK_INVALID
  15238. }
  15239. fallthrough
  15240. default:
  15241. ptr += uintptr(1)
  15242. break
  15243. }
  15244. }
  15245. return -int32(1)
  15246. }
  15247. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15248. var n Tsize_t
  15249. var tok int32
  15250. _, _ = n, tok
  15251. if ptr >= end {
  15252. return -int32(4)
  15253. }
  15254. if int32(1) > int32(1) {
  15255. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15256. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15257. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15258. if n == uint64(0) {
  15259. return -int32(1)
  15260. }
  15261. end = ptr + uintptr(n)
  15262. }
  15263. }
  15264. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15265. case int32(_BT_QUOT):
  15266. goto _1
  15267. case int32(_BT_APOS):
  15268. goto _2
  15269. case int32(_BT_LT):
  15270. goto _3
  15271. case int32(_BT_CR):
  15272. goto _4
  15273. case int32(_BT_LF):
  15274. goto _5
  15275. case int32(_BT_S):
  15276. goto _6
  15277. case int32(_BT_PERCNT):
  15278. goto _7
  15279. case int32(_BT_COMMA):
  15280. goto _8
  15281. case int32(_BT_LSQB):
  15282. goto _9
  15283. case int32(_BT_RSQB):
  15284. goto _10
  15285. case int32(_BT_LPAR):
  15286. goto _11
  15287. case int32(_BT_RPAR):
  15288. goto _12
  15289. case int32(_BT_VERBAR):
  15290. goto _13
  15291. case int32(_BT_GT):
  15292. goto _14
  15293. case int32(_BT_NUM):
  15294. goto _15
  15295. case int32(_BT_LEAD2):
  15296. goto _16
  15297. case int32(_BT_LEAD3):
  15298. goto _17
  15299. case int32(_BT_LEAD4):
  15300. goto _18
  15301. case int32(_BT_HEX):
  15302. goto _19
  15303. case int32(_BT_NMSTRT):
  15304. goto _20
  15305. case int32(_BT_COLON):
  15306. goto _21
  15307. case int32(_BT_MINUS):
  15308. goto _22
  15309. case int32(_BT_NAME):
  15310. goto _23
  15311. case int32(_BT_DIGIT):
  15312. goto _24
  15313. case int32(_BT_NONASCII):
  15314. goto _25
  15315. default:
  15316. goto _26
  15317. }
  15318. goto _27
  15319. _1:
  15320. ;
  15321. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15322. _2:
  15323. ;
  15324. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15325. _3:
  15326. ;
  15327. ptr += uintptr(1)
  15328. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15329. return -int32(1)
  15330. }
  15331. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15332. case int32(_BT_EXCL):
  15333. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15334. case int32(_BT_QUEST):
  15335. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15336. case int32(_BT_NMSTRT):
  15337. fallthrough
  15338. case int32(_BT_HEX):
  15339. fallthrough
  15340. case int32(_BT_NONASCII):
  15341. fallthrough
  15342. case int32(_BT_LEAD2):
  15343. fallthrough
  15344. case int32(_BT_LEAD3):
  15345. fallthrough
  15346. case int32(_BT_LEAD4):
  15347. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15348. return int32(m_XML_TOK_INSTANCE_START)
  15349. }
  15350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15351. return m_XML_TOK_INVALID
  15352. _4:
  15353. ;
  15354. if ptr+uintptr(1) == end {
  15355. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15356. /* indicate that this might be part of a CR/LF pair */
  15357. return -int32(m_XML_TOK_PROLOG_S)
  15358. }
  15359. /* fall through */
  15360. _6:
  15361. ;
  15362. _5:
  15363. ;
  15364. _30:
  15365. ;
  15366. ptr += uintptr(1)
  15367. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15368. goto _28
  15369. }
  15370. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15371. case int32(_BT_S):
  15372. fallthrough
  15373. case int32(_BT_LF):
  15374. case int32(_BT_CR):
  15375. /* don't split CR/LF pair */
  15376. if ptr+uintptr(1) != end {
  15377. break
  15378. }
  15379. /* fall through */
  15380. fallthrough
  15381. default:
  15382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15383. return int32(m_XML_TOK_PROLOG_S)
  15384. }
  15385. goto _29
  15386. _29:
  15387. ;
  15388. goto _30
  15389. goto _28
  15390. _28:
  15391. ;
  15392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15393. return int32(m_XML_TOK_PROLOG_S)
  15394. _7:
  15395. ;
  15396. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15397. _8:
  15398. ;
  15399. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15400. return int32(m_XML_TOK_COMMA)
  15401. _9:
  15402. ;
  15403. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15404. return int32(m_XML_TOK_OPEN_BRACKET)
  15405. _10:
  15406. ;
  15407. ptr += uintptr(1)
  15408. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15409. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15410. }
  15411. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15412. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  15413. return -int32(1)
  15414. }
  15415. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15416. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15417. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15418. }
  15419. }
  15420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15421. return int32(m_XML_TOK_CLOSE_BRACKET)
  15422. _11:
  15423. ;
  15424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15425. return int32(m_XML_TOK_OPEN_PAREN)
  15426. _12:
  15427. ;
  15428. ptr += uintptr(1)
  15429. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15430. return -int32(m_XML_TOK_CLOSE_PAREN)
  15431. }
  15432. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15433. case int32(_BT_AST):
  15434. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15435. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15436. case int32(_BT_QUEST):
  15437. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15438. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15439. case int32(_BT_PLUS):
  15440. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15441. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15442. case int32(_BT_CR):
  15443. fallthrough
  15444. case int32(_BT_LF):
  15445. fallthrough
  15446. case int32(_BT_S):
  15447. fallthrough
  15448. case int32(_BT_GT):
  15449. fallthrough
  15450. case int32(_BT_COMMA):
  15451. fallthrough
  15452. case int32(_BT_VERBAR):
  15453. fallthrough
  15454. case int32(_BT_RPAR):
  15455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15456. return int32(m_XML_TOK_CLOSE_PAREN)
  15457. }
  15458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15459. return m_XML_TOK_INVALID
  15460. _13:
  15461. ;
  15462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15463. return int32(m_XML_TOK_OR)
  15464. _14:
  15465. ;
  15466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15467. return int32(m_XML_TOK_DECL_CLOSE)
  15468. _15:
  15469. ;
  15470. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15471. _16:
  15472. ;
  15473. if int64(end)-int64(ptr) < int64(2) {
  15474. return -int32(2)
  15475. }
  15476. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15478. return m_XML_TOK_INVALID
  15479. }
  15480. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15481. ptr += uintptr(2)
  15482. tok = int32(m_XML_TOK_NAME)
  15483. goto _27
  15484. }
  15485. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15486. ptr += uintptr(2)
  15487. tok = int32(m_XML_TOK_NMTOKEN)
  15488. goto _27
  15489. }
  15490. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15491. return m_XML_TOK_INVALID
  15492. _17:
  15493. ;
  15494. if int64(end)-int64(ptr) < int64(3) {
  15495. return -int32(2)
  15496. }
  15497. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15499. return m_XML_TOK_INVALID
  15500. }
  15501. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15502. ptr += uintptr(3)
  15503. tok = int32(m_XML_TOK_NAME)
  15504. goto _27
  15505. }
  15506. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15507. ptr += uintptr(3)
  15508. tok = int32(m_XML_TOK_NMTOKEN)
  15509. goto _27
  15510. }
  15511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15512. return m_XML_TOK_INVALID
  15513. _18:
  15514. ;
  15515. if int64(end)-int64(ptr) < int64(4) {
  15516. return -int32(2)
  15517. }
  15518. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15520. return m_XML_TOK_INVALID
  15521. }
  15522. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15523. ptr += uintptr(4)
  15524. tok = int32(m_XML_TOK_NAME)
  15525. goto _27
  15526. }
  15527. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15528. ptr += uintptr(4)
  15529. tok = int32(m_XML_TOK_NMTOKEN)
  15530. goto _27
  15531. }
  15532. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15533. return m_XML_TOK_INVALID
  15534. _20:
  15535. ;
  15536. _19:
  15537. ;
  15538. tok = int32(m_XML_TOK_NAME)
  15539. ptr += uintptr(1)
  15540. goto _27
  15541. _24:
  15542. ;
  15543. _23:
  15544. ;
  15545. _22:
  15546. ;
  15547. _21:
  15548. ;
  15549. tok = int32(m_XML_TOK_NMTOKEN)
  15550. ptr += uintptr(1)
  15551. goto _27
  15552. _25:
  15553. ;
  15554. if 0 != 0 {
  15555. ptr += uintptr(1)
  15556. tok = int32(m_XML_TOK_NAME)
  15557. goto _27
  15558. }
  15559. if 0 != 0 {
  15560. ptr += uintptr(1)
  15561. tok = int32(m_XML_TOK_NMTOKEN)
  15562. goto _27
  15563. }
  15564. /* fall through */
  15565. _26:
  15566. ;
  15567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15568. return m_XML_TOK_INVALID
  15569. _27:
  15570. ;
  15571. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15572. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15573. case int32(_BT_NONASCII):
  15574. if !(libc.Int32FromInt32(0) != 0) {
  15575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15576. return m_XML_TOK_INVALID
  15577. } /* fall through */
  15578. fallthrough
  15579. case int32(_BT_NMSTRT):
  15580. fallthrough
  15581. case int32(_BT_HEX):
  15582. fallthrough
  15583. case int32(_BT_DIGIT):
  15584. fallthrough
  15585. case int32(_BT_NAME):
  15586. fallthrough
  15587. case int32(_BT_MINUS):
  15588. ptr += uintptr(1)
  15589. case int32(_BT_LEAD2):
  15590. if int64(end)-int64(ptr) < int64(2) {
  15591. return -int32(2)
  15592. }
  15593. 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) {
  15594. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15595. return m_XML_TOK_INVALID
  15596. }
  15597. ptr += uintptr(2)
  15598. case int32(_BT_LEAD3):
  15599. if int64(end)-int64(ptr) < int64(3) {
  15600. return -int32(2)
  15601. }
  15602. 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) {
  15603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15604. return m_XML_TOK_INVALID
  15605. }
  15606. ptr += uintptr(3)
  15607. case int32(_BT_LEAD4):
  15608. if int64(end)-int64(ptr) < int64(4) {
  15609. return -int32(2)
  15610. }
  15611. 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) {
  15612. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15613. return m_XML_TOK_INVALID
  15614. }
  15615. ptr += uintptr(4)
  15616. case int32(_BT_GT):
  15617. fallthrough
  15618. case int32(_BT_RPAR):
  15619. fallthrough
  15620. case int32(_BT_COMMA):
  15621. fallthrough
  15622. case int32(_BT_VERBAR):
  15623. fallthrough
  15624. case int32(_BT_LSQB):
  15625. fallthrough
  15626. case int32(_BT_PERCNT):
  15627. fallthrough
  15628. case int32(_BT_S):
  15629. fallthrough
  15630. case int32(_BT_CR):
  15631. fallthrough
  15632. case int32(_BT_LF):
  15633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15634. return tok
  15635. case int32(_BT_COLON):
  15636. ptr += uintptr(1)
  15637. switch tok {
  15638. case int32(m_XML_TOK_NAME):
  15639. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15640. return -int32(1)
  15641. }
  15642. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15643. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15644. case int32(_BT_NONASCII):
  15645. if !(libc.Int32FromInt32(0) != 0) {
  15646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15647. return m_XML_TOK_INVALID
  15648. } /* fall through */
  15649. fallthrough
  15650. case int32(_BT_NMSTRT):
  15651. fallthrough
  15652. case int32(_BT_HEX):
  15653. fallthrough
  15654. case int32(_BT_DIGIT):
  15655. fallthrough
  15656. case int32(_BT_NAME):
  15657. fallthrough
  15658. case int32(_BT_MINUS):
  15659. ptr += uintptr(1)
  15660. case int32(_BT_LEAD2):
  15661. if int64(end)-int64(ptr) < int64(2) {
  15662. return -int32(2)
  15663. }
  15664. 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) {
  15665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15666. return m_XML_TOK_INVALID
  15667. }
  15668. ptr += uintptr(2)
  15669. case int32(_BT_LEAD3):
  15670. if int64(end)-int64(ptr) < int64(3) {
  15671. return -int32(2)
  15672. }
  15673. 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) {
  15674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15675. return m_XML_TOK_INVALID
  15676. }
  15677. ptr += uintptr(3)
  15678. case int32(_BT_LEAD4):
  15679. if int64(end)-int64(ptr) < int64(4) {
  15680. return -int32(2)
  15681. }
  15682. 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) {
  15683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15684. return m_XML_TOK_INVALID
  15685. }
  15686. ptr += uintptr(4)
  15687. default:
  15688. tok = int32(m_XML_TOK_NMTOKEN)
  15689. break
  15690. }
  15691. case int32(m_XML_TOK_PREFIXED_NAME):
  15692. tok = int32(m_XML_TOK_NMTOKEN)
  15693. break
  15694. }
  15695. case int32(_BT_PLUS):
  15696. if tok == int32(m_XML_TOK_NMTOKEN) {
  15697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15698. return m_XML_TOK_INVALID
  15699. }
  15700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15701. return int32(m_XML_TOK_NAME_PLUS)
  15702. case int32(_BT_AST):
  15703. if tok == int32(m_XML_TOK_NMTOKEN) {
  15704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15705. return m_XML_TOK_INVALID
  15706. }
  15707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15708. return int32(m_XML_TOK_NAME_ASTERISK)
  15709. case int32(_BT_QUEST):
  15710. if tok == int32(m_XML_TOK_NMTOKEN) {
  15711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15712. return m_XML_TOK_INVALID
  15713. }
  15714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15715. return int32(m_XML_TOK_NAME_QUESTION)
  15716. default:
  15717. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15718. return m_XML_TOK_INVALID
  15719. }
  15720. }
  15721. return -tok
  15722. }
  15723. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15724. var start uintptr
  15725. _ = start
  15726. if ptr >= end {
  15727. return -int32(4)
  15728. } else {
  15729. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15730. /* This line cannot be executed. The incoming data has already
  15731. * been tokenized once, so incomplete characters like this have
  15732. * already been eliminated from the input. Retaining the paranoia
  15733. * check is still valuable, however.
  15734. */
  15735. return -int32(1) /* LCOV_EXCL_LINE */
  15736. }
  15737. }
  15738. start = ptr
  15739. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15740. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15741. case int32(_BT_LEAD2):
  15742. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15743. case int32(_BT_LEAD3):
  15744. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15745. case int32(_BT_LEAD4):
  15746. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15747. case int32(_BT_AMP):
  15748. if ptr == start {
  15749. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15750. }
  15751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15752. return int32(m_XML_TOK_DATA_CHARS)
  15753. case int32(_BT_LT):
  15754. /* this is for inside entity references */
  15755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15756. return m_XML_TOK_INVALID
  15757. case int32(_BT_LF):
  15758. if ptr == start {
  15759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15760. return int32(m_XML_TOK_DATA_NEWLINE)
  15761. }
  15762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15763. return int32(m_XML_TOK_DATA_CHARS)
  15764. case int32(_BT_CR):
  15765. if ptr == start {
  15766. ptr += uintptr(1)
  15767. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15768. return -int32(3)
  15769. }
  15770. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15771. ptr += uintptr(1)
  15772. }
  15773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15774. return int32(m_XML_TOK_DATA_NEWLINE)
  15775. }
  15776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15777. return int32(m_XML_TOK_DATA_CHARS)
  15778. case int32(_BT_S):
  15779. if ptr == start {
  15780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15781. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15782. }
  15783. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15784. return int32(m_XML_TOK_DATA_CHARS)
  15785. default:
  15786. ptr += uintptr(1)
  15787. break
  15788. }
  15789. }
  15790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15791. return int32(m_XML_TOK_DATA_CHARS)
  15792. }
  15793. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15794. var start uintptr
  15795. var tok, v1 int32
  15796. _, _, _ = start, tok, v1
  15797. if ptr >= end {
  15798. return -int32(4)
  15799. } else {
  15800. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15801. /* This line cannot be executed. The incoming data has already
  15802. * been tokenized once, so incomplete characters like this have
  15803. * already been eliminated from the input. Retaining the paranoia
  15804. * check is still valuable, however.
  15805. */
  15806. return -int32(1) /* LCOV_EXCL_LINE */
  15807. }
  15808. }
  15809. start = ptr
  15810. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15811. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15812. case int32(_BT_LEAD2):
  15813. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15814. case int32(_BT_LEAD3):
  15815. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15816. case int32(_BT_LEAD4):
  15817. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15818. case int32(_BT_AMP):
  15819. if ptr == start {
  15820. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15821. }
  15822. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15823. return int32(m_XML_TOK_DATA_CHARS)
  15824. case int32(_BT_PERCNT):
  15825. if ptr == start {
  15826. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15827. if tok == int32(m_XML_TOK_PERCENT) {
  15828. v1 = m_XML_TOK_INVALID
  15829. } else {
  15830. v1 = tok
  15831. }
  15832. return v1
  15833. }
  15834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15835. return int32(m_XML_TOK_DATA_CHARS)
  15836. case int32(_BT_LF):
  15837. if ptr == start {
  15838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15839. return int32(m_XML_TOK_DATA_NEWLINE)
  15840. }
  15841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15842. return int32(m_XML_TOK_DATA_CHARS)
  15843. case int32(_BT_CR):
  15844. if ptr == start {
  15845. ptr += uintptr(1)
  15846. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15847. return -int32(3)
  15848. }
  15849. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15850. ptr += uintptr(1)
  15851. }
  15852. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15853. return int32(m_XML_TOK_DATA_NEWLINE)
  15854. }
  15855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15856. return int32(m_XML_TOK_DATA_CHARS)
  15857. default:
  15858. ptr += uintptr(1)
  15859. break
  15860. }
  15861. }
  15862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15863. return int32(m_XML_TOK_DATA_CHARS)
  15864. }
  15865. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15866. var level int32
  15867. var n Tsize_t
  15868. _, _ = level, n
  15869. level = 0
  15870. if int32(1) > int32(1) {
  15871. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15872. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15873. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15874. end = ptr + uintptr(n)
  15875. }
  15876. }
  15877. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15878. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15879. case int32(_BT_LEAD2):
  15880. if int64(end)-int64(ptr) < int64(2) {
  15881. return -int32(2)
  15882. }
  15883. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15884. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15885. return m_XML_TOK_INVALID
  15886. }
  15887. ptr += uintptr(2)
  15888. case int32(_BT_LEAD3):
  15889. if int64(end)-int64(ptr) < int64(3) {
  15890. return -int32(2)
  15891. }
  15892. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15894. return m_XML_TOK_INVALID
  15895. }
  15896. ptr += uintptr(3)
  15897. case int32(_BT_LEAD4):
  15898. if int64(end)-int64(ptr) < int64(4) {
  15899. return -int32(2)
  15900. }
  15901. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15902. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15903. return m_XML_TOK_INVALID
  15904. }
  15905. ptr += uintptr(4)
  15906. case int32(_BT_NONXML):
  15907. fallthrough
  15908. case int32(_BT_MALFORM):
  15909. fallthrough
  15910. case int32(_BT_TRAIL):
  15911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15912. return m_XML_TOK_INVALID
  15913. case int32(_BT_LT):
  15914. ptr += uintptr(1)
  15915. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15916. return -int32(1)
  15917. }
  15918. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  15919. ptr += uintptr(1)
  15920. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15921. return -int32(1)
  15922. }
  15923. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  15924. level++
  15925. ptr += uintptr(1)
  15926. }
  15927. }
  15928. case int32(_BT_RSQB):
  15929. ptr += uintptr(1)
  15930. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15931. return -int32(1)
  15932. }
  15933. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15934. ptr += uintptr(1)
  15935. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15936. return -int32(1)
  15937. }
  15938. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15939. ptr += uintptr(1)
  15940. if level == 0 {
  15941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15942. return int32(m_XML_TOK_IGNORE_SECT)
  15943. }
  15944. level--
  15945. }
  15946. }
  15947. default:
  15948. ptr += uintptr(1)
  15949. break
  15950. }
  15951. }
  15952. return -int32(1)
  15953. }
  15954. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  15955. ptr += uintptr(1)
  15956. end -= uintptr(1)
  15957. for {
  15958. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15959. break
  15960. }
  15961. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15962. case int32(_BT_DIGIT):
  15963. fallthrough
  15964. case int32(_BT_HEX):
  15965. fallthrough
  15966. case int32(_BT_MINUS):
  15967. fallthrough
  15968. case int32(_BT_APOS):
  15969. fallthrough
  15970. case int32(_BT_LPAR):
  15971. fallthrough
  15972. case int32(_BT_RPAR):
  15973. fallthrough
  15974. case int32(_BT_PLUS):
  15975. fallthrough
  15976. case int32(_BT_COMMA):
  15977. fallthrough
  15978. case int32(_BT_SOL):
  15979. fallthrough
  15980. case int32(_BT_EQUALS):
  15981. fallthrough
  15982. case int32(_BT_QUEST):
  15983. fallthrough
  15984. case int32(_BT_CR):
  15985. fallthrough
  15986. case int32(_BT_LF):
  15987. fallthrough
  15988. case int32(_BT_SEMI):
  15989. fallthrough
  15990. case int32(_BT_EXCL):
  15991. fallthrough
  15992. case int32(_BT_AST):
  15993. fallthrough
  15994. case int32(_BT_PERCNT):
  15995. fallthrough
  15996. case int32(_BT_NUM):
  15997. fallthrough
  15998. case int32(_BT_COLON):
  15999. case int32(_BT_S):
  16000. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  16001. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  16002. return 0
  16003. }
  16004. case int32(_BT_NAME):
  16005. fallthrough
  16006. case int32(_BT_NMSTRT):
  16007. if !(int32(*(*int8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  16008. break
  16009. }
  16010. /* fall through */
  16011. fallthrough
  16012. default:
  16013. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16014. case int32(0x24): /* $ */
  16015. fallthrough
  16016. case int32(0x40): /* @ */
  16017. default:
  16018. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  16019. return 0
  16020. }
  16021. break
  16022. }
  16023. goto _1
  16024. _1:
  16025. ;
  16026. ptr += uintptr(1)
  16027. }
  16028. return int32(1)
  16029. }
  16030. /* This must only be called for a well-formed start-tag or empty
  16031. element tag. Returns the number of attributes. Pointers to the
  16032. first attsMax attributes are stored in atts.
  16033. */
  16034. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  16035. var nAtts, open, state int32
  16036. _, _, _ = nAtts, open, state
  16037. state = 1
  16038. nAtts = 0
  16039. open = 0 /* defined when state == inValue;
  16040. initialization just to shut up compilers */
  16041. ptr += uintptr(1)
  16042. for {
  16043. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16044. case int32(_BT_LEAD2):
  16045. if state == 0 {
  16046. if nAtts < attsMax {
  16047. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16048. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16049. }
  16050. state = 1
  16051. }
  16052. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16053. case int32(_BT_LEAD3):
  16054. if state == 0 {
  16055. if nAtts < attsMax {
  16056. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16057. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16058. }
  16059. state = 1
  16060. }
  16061. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16062. case int32(_BT_LEAD4):
  16063. if state == 0 {
  16064. if nAtts < attsMax {
  16065. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16066. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16067. }
  16068. state = 1
  16069. }
  16070. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16071. case int32(_BT_NONASCII):
  16072. fallthrough
  16073. case int32(_BT_NMSTRT):
  16074. fallthrough
  16075. case int32(_BT_HEX):
  16076. if state == 0 {
  16077. if nAtts < attsMax {
  16078. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  16079. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  16080. }
  16081. state = 1
  16082. }
  16083. case int32(_BT_QUOT):
  16084. if state != 2 {
  16085. if nAtts < attsMax {
  16086. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16087. }
  16088. state = 2
  16089. open = int32(_BT_QUOT)
  16090. } else {
  16091. if open == int32(_BT_QUOT) {
  16092. state = 0
  16093. if nAtts < attsMax {
  16094. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16095. }
  16096. nAtts++
  16097. }
  16098. }
  16099. case int32(_BT_APOS):
  16100. if state != 2 {
  16101. if nAtts < attsMax {
  16102. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16103. }
  16104. state = 2
  16105. open = int32(_BT_APOS)
  16106. } else {
  16107. if open == int32(_BT_APOS) {
  16108. state = 0
  16109. if nAtts < attsMax {
  16110. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16111. }
  16112. nAtts++
  16113. }
  16114. }
  16115. case int32(_BT_AMP):
  16116. if nAtts < attsMax {
  16117. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16118. }
  16119. case int32(_BT_S):
  16120. if state == 1 {
  16121. state = 0
  16122. } else {
  16123. 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) {
  16124. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16125. }
  16126. }
  16127. case int32(_BT_CR):
  16128. fallthrough
  16129. case int32(_BT_LF):
  16130. /* This case ensures that the first attribute name is counted
  16131. Apart from that we could just change state on the quote. */
  16132. if state == 1 {
  16133. state = 0
  16134. } else {
  16135. if state == 2 && nAtts < attsMax {
  16136. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  16137. }
  16138. }
  16139. case int32(_BT_GT):
  16140. fallthrough
  16141. case int32(_BT_SOL):
  16142. if state != 2 {
  16143. return nAtts
  16144. }
  16145. default:
  16146. break
  16147. }
  16148. goto _1
  16149. _1:
  16150. ;
  16151. ptr += uintptr(1)
  16152. }
  16153. /* not reached */
  16154. return r
  16155. }
  16156. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16157. var c, c1, result int32
  16158. _, _, _ = c, c1, result
  16159. result = 0
  16160. /* skip &# */
  16161. _ = enc
  16162. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16163. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16164. ptr += uintptr(1)
  16165. for {
  16166. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16167. break
  16168. }
  16169. c = int32(*(*int8)(unsafe.Pointer(ptr)))
  16170. switch c {
  16171. case int32(m_ASCII_02):
  16172. fallthrough
  16173. case int32(m_ASCII_12):
  16174. fallthrough
  16175. case int32(m_ASCII_22):
  16176. fallthrough
  16177. case int32(m_ASCII_32):
  16178. fallthrough
  16179. case int32(m_ASCII_41):
  16180. fallthrough
  16181. case int32(m_ASCII_51):
  16182. fallthrough
  16183. case int32(m_ASCII_61):
  16184. fallthrough
  16185. case int32(m_ASCII_71):
  16186. fallthrough
  16187. case int32(m_ASCII_82):
  16188. fallthrough
  16189. case int32(m_ASCII_92):
  16190. result <<= int32(4)
  16191. result |= c - int32(m_ASCII_02)
  16192. case int32(m_ASCII_A):
  16193. fallthrough
  16194. case int32(m_ASCII_B1):
  16195. fallthrough
  16196. case int32(m_ASCII_C):
  16197. fallthrough
  16198. case int32(m_ASCII_D):
  16199. fallthrough
  16200. case int32(m_ASCII_E):
  16201. fallthrough
  16202. case int32(m_ASCII_F):
  16203. result <<= int32(4)
  16204. result += int32(10) + (c - int32(m_ASCII_A))
  16205. case int32(m_ASCII_a2):
  16206. fallthrough
  16207. case int32(m_ASCII_b1):
  16208. fallthrough
  16209. case int32(m_ASCII_c2):
  16210. fallthrough
  16211. case int32(m_ASCII_d1):
  16212. fallthrough
  16213. case int32(m_ASCII_e2):
  16214. fallthrough
  16215. case int32(m_ASCII_f1):
  16216. result <<= int32(4)
  16217. result += int32(10) + (c - int32(m_ASCII_a2))
  16218. break
  16219. }
  16220. if result >= int32(0x110000) {
  16221. return -int32(1)
  16222. }
  16223. goto _1
  16224. _1:
  16225. ;
  16226. ptr += uintptr(1)
  16227. }
  16228. } else {
  16229. for {
  16230. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16231. break
  16232. }
  16233. c1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  16234. result *= int32(10)
  16235. result += c1 - int32(m_ASCII_02)
  16236. if result >= int32(0x110000) {
  16237. return -int32(1)
  16238. }
  16239. goto _2
  16240. _2:
  16241. ;
  16242. ptr += uintptr(1)
  16243. }
  16244. }
  16245. return _checkCharRefNumber(tls, result)
  16246. }
  16247. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16248. _ = enc
  16249. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  16250. case int64(2):
  16251. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16252. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16253. case int32(m_ASCII_l2):
  16254. return int32(m_ASCII_LT1)
  16255. case int32(m_ASCII_g2):
  16256. return int32(m_ASCII_GT1)
  16257. }
  16258. }
  16259. case int64(3):
  16260. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16261. ptr += uintptr(1)
  16262. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16263. ptr += uintptr(1)
  16264. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16265. return int32(m_ASCII_AMP1)
  16266. }
  16267. }
  16268. }
  16269. case int64(4):
  16270. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16271. case int32(m_ASCII_q1):
  16272. ptr += uintptr(1)
  16273. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16274. ptr += uintptr(1)
  16275. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16276. ptr += uintptr(1)
  16277. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16278. return int32(m_ASCII_QUOT1)
  16279. }
  16280. }
  16281. }
  16282. case int32(m_ASCII_a2):
  16283. ptr += uintptr(1)
  16284. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16285. ptr += uintptr(1)
  16286. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16287. ptr += uintptr(1)
  16288. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16289. return int32(m_ASCII_APOS1)
  16290. }
  16291. }
  16292. }
  16293. break
  16294. }
  16295. }
  16296. return 0
  16297. }
  16298. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16299. _ = enc
  16300. for {
  16301. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  16302. break
  16303. }
  16304. if int64(end1)-int64(ptr1) < int64(1) {
  16305. /* This line cannot be executed. The incoming data has already
  16306. * been tokenized once, so incomplete characters like this have
  16307. * already been eliminated from the input. Retaining the
  16308. * paranoia check is still valuable, however.
  16309. */
  16310. return 0 /* LCOV_EXCL_LINE */
  16311. }
  16312. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  16313. return 0
  16314. }
  16315. goto _1
  16316. _1:
  16317. ;
  16318. ptr1 += uintptr(1)
  16319. ptr2++
  16320. }
  16321. return libc.BoolInt32(ptr1 == end1)
  16322. }
  16323. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16324. var start uintptr
  16325. _ = start
  16326. start = ptr
  16327. for {
  16328. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16329. case int32(_BT_LEAD2):
  16330. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16331. case int32(_BT_LEAD3):
  16332. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16333. case int32(_BT_LEAD4):
  16334. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16335. case int32(_BT_NONASCII):
  16336. fallthrough
  16337. case int32(_BT_NMSTRT):
  16338. fallthrough
  16339. case int32(_BT_COLON):
  16340. fallthrough
  16341. case int32(_BT_HEX):
  16342. fallthrough
  16343. case int32(_BT_DIGIT):
  16344. fallthrough
  16345. case int32(_BT_NAME):
  16346. fallthrough
  16347. case int32(_BT_MINUS):
  16348. ptr += uintptr(1)
  16349. default:
  16350. return int32(int64(ptr) - int64(start))
  16351. }
  16352. goto _1
  16353. _1:
  16354. }
  16355. return r
  16356. }
  16357. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16358. for {
  16359. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16360. case int32(_BT_LF):
  16361. fallthrough
  16362. case int32(_BT_CR):
  16363. fallthrough
  16364. case int32(_BT_S):
  16365. ptr += uintptr(1)
  16366. default:
  16367. return ptr
  16368. }
  16369. goto _1
  16370. _1:
  16371. }
  16372. return r
  16373. }
  16374. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16375. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16376. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16377. case int32(_BT_LEAD2):
  16378. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16379. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16380. case int32(_BT_LEAD3):
  16381. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16382. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16383. case int32(_BT_LEAD4):
  16384. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16385. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16386. case int32(_BT_LF):
  16387. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16388. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16389. ptr += uintptr(1)
  16390. case int32(_BT_CR):
  16391. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16392. ptr += uintptr(1)
  16393. 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) {
  16394. ptr += uintptr(1)
  16395. }
  16396. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16397. default:
  16398. ptr += uintptr(1)
  16399. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16400. break
  16401. }
  16402. }
  16403. }
  16404. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16405. _UTF8_cval1 = 0
  16406. const _UTF8_cval2 = 192
  16407. const _UTF8_cval3 = 224
  16408. const _UTF8_cval4 = 240
  16409. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16410. var fromLim uintptr
  16411. var prev uint8
  16412. var walked Tsize_t
  16413. _, _, _ = fromLim, prev, walked
  16414. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16415. walked = uint64(0)
  16416. for {
  16417. if !(fromLim > from) {
  16418. break
  16419. }
  16420. prev = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1)))))
  16421. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16422. if walked+uint64(1) >= uint64(4) {
  16423. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16424. break
  16425. } else {
  16426. walked = uint64(0)
  16427. }
  16428. } else {
  16429. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16430. if walked+uint64(1) >= uint64(3) {
  16431. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16432. break
  16433. } else {
  16434. walked = uint64(0)
  16435. }
  16436. } else {
  16437. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16438. if walked+uint64(1) >= uint64(2) {
  16439. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16440. break
  16441. } else {
  16442. walked = uint64(0)
  16443. }
  16444. } else {
  16445. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16446. break
  16447. }
  16448. }
  16449. }
  16450. }
  16451. goto _1
  16452. _1:
  16453. ;
  16454. fromLim--
  16455. walked++
  16456. }
  16457. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16458. }
  16459. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16460. bp := tls.Alloc(16)
  16461. defer tls.Free(16)
  16462. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16463. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16464. var fromLimBefore uintptr
  16465. var input_incomplete, output_exhausted uint8
  16466. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16467. input_incomplete = uint8(m_false)
  16468. output_exhausted = uint8(m_false)
  16469. /* Avoid copying partial characters (due to limited space). */
  16470. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16471. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  16472. _ = enc
  16473. if bytesAvailable > bytesStorable {
  16474. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16475. output_exhausted = uint8(m_true)
  16476. }
  16477. /* Avoid copying partial characters (from incomplete input). */
  16478. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16479. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16480. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16481. input_incomplete = uint8(m_true)
  16482. }
  16483. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16484. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  16485. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16486. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16487. if output_exhausted != 0 { /* needs to go first */
  16488. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16489. } else {
  16490. if input_incomplete != 0 {
  16491. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16492. } else {
  16493. return int32(_XML_CONVERT_COMPLETED)
  16494. }
  16495. }
  16496. return r
  16497. }
  16498. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16499. var from, to, v1, v2, v3, v4 uintptr
  16500. var n uint64
  16501. var res _XML_Convert_Result
  16502. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16503. res = int32(_XML_CONVERT_COMPLETED)
  16504. to = *(*uintptr)(unsafe.Pointer(toP))
  16505. from = *(*uintptr)(unsafe.Pointer(fromP))
  16506. for from < fromLim && to < toLim {
  16507. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))))) {
  16508. case int32(_BT_LEAD2):
  16509. if int64(fromLim)-int64(from) < int64(2) {
  16510. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16511. goto after
  16512. }
  16513. v1 = to
  16514. to += 2
  16515. *(*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))
  16516. from += uintptr(2)
  16517. case int32(_BT_LEAD3):
  16518. if int64(fromLim)-int64(from) < int64(3) {
  16519. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16520. goto after
  16521. }
  16522. v2 = to
  16523. to += 2
  16524. *(*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))
  16525. from += uintptr(3)
  16526. case int32(_BT_LEAD4):
  16527. if (int64(toLim)-int64(to))/2 < int64(2) {
  16528. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16529. goto after
  16530. }
  16531. if int64(fromLim)-int64(from) < int64(4) {
  16532. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16533. goto after
  16534. }
  16535. 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))
  16536. n -= uint64(0x10000)
  16537. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  16538. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  16539. to += uintptr(2) * 2
  16540. from += uintptr(4)
  16541. default:
  16542. v3 = to
  16543. to += 2
  16544. v4 = from
  16545. from++
  16546. *(*uint16)(unsafe.Pointer(v3)) = libc.Uint16FromInt8(*(*int8)(unsafe.Pointer(v4)))
  16547. break
  16548. }
  16549. }
  16550. if from < fromLim {
  16551. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16552. }
  16553. goto after
  16554. after:
  16555. ;
  16556. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16557. *(*uintptr)(unsafe.Pointer(toP)) = to
  16558. return res
  16559. }
  16560. var _utf8_encoding_ns = Tnormal_encoding{
  16561. Fenc: TENCODING{
  16562. Fscanners: [4]TSCANNER{},
  16563. FliteralScanners: [2]TSCANNER{},
  16564. FminBytesPerChar: int32(1),
  16565. FisUtf8: int8(1),
  16566. },
  16567. Ftype1: [256]uint8{
  16568. 9: uint8(_BT_S),
  16569. 10: uint8(_BT_LF),
  16570. 13: uint8(_BT_CR),
  16571. 32: uint8(_BT_S),
  16572. 33: uint8(_BT_EXCL),
  16573. 34: uint8(_BT_QUOT),
  16574. 35: uint8(_BT_NUM),
  16575. 36: uint8(_BT_OTHER),
  16576. 37: uint8(_BT_PERCNT),
  16577. 38: uint8(_BT_AMP),
  16578. 39: uint8(_BT_APOS),
  16579. 40: uint8(_BT_LPAR),
  16580. 41: uint8(_BT_RPAR),
  16581. 42: uint8(_BT_AST),
  16582. 43: uint8(_BT_PLUS),
  16583. 44: uint8(_BT_COMMA),
  16584. 45: uint8(_BT_MINUS),
  16585. 46: uint8(_BT_NAME),
  16586. 47: uint8(_BT_SOL),
  16587. 48: uint8(_BT_DIGIT),
  16588. 49: uint8(_BT_DIGIT),
  16589. 50: uint8(_BT_DIGIT),
  16590. 51: uint8(_BT_DIGIT),
  16591. 52: uint8(_BT_DIGIT),
  16592. 53: uint8(_BT_DIGIT),
  16593. 54: uint8(_BT_DIGIT),
  16594. 55: uint8(_BT_DIGIT),
  16595. 56: uint8(_BT_DIGIT),
  16596. 57: uint8(_BT_DIGIT),
  16597. 58: uint8(_BT_COLON),
  16598. 59: uint8(_BT_SEMI),
  16599. 60: uint8(_BT_LT),
  16600. 61: uint8(_BT_EQUALS),
  16601. 62: uint8(_BT_GT),
  16602. 63: uint8(_BT_QUEST),
  16603. 64: uint8(_BT_OTHER),
  16604. 65: uint8(_BT_HEX),
  16605. 66: uint8(_BT_HEX),
  16606. 67: uint8(_BT_HEX),
  16607. 68: uint8(_BT_HEX),
  16608. 69: uint8(_BT_HEX),
  16609. 70: uint8(_BT_HEX),
  16610. 71: uint8(_BT_NMSTRT),
  16611. 72: uint8(_BT_NMSTRT),
  16612. 73: uint8(_BT_NMSTRT),
  16613. 74: uint8(_BT_NMSTRT),
  16614. 75: uint8(_BT_NMSTRT),
  16615. 76: uint8(_BT_NMSTRT),
  16616. 77: uint8(_BT_NMSTRT),
  16617. 78: uint8(_BT_NMSTRT),
  16618. 79: uint8(_BT_NMSTRT),
  16619. 80: uint8(_BT_NMSTRT),
  16620. 81: uint8(_BT_NMSTRT),
  16621. 82: uint8(_BT_NMSTRT),
  16622. 83: uint8(_BT_NMSTRT),
  16623. 84: uint8(_BT_NMSTRT),
  16624. 85: uint8(_BT_NMSTRT),
  16625. 86: uint8(_BT_NMSTRT),
  16626. 87: uint8(_BT_NMSTRT),
  16627. 88: uint8(_BT_NMSTRT),
  16628. 89: uint8(_BT_NMSTRT),
  16629. 90: uint8(_BT_NMSTRT),
  16630. 91: uint8(_BT_LSQB),
  16631. 92: uint8(_BT_OTHER),
  16632. 93: uint8(_BT_RSQB),
  16633. 94: uint8(_BT_OTHER),
  16634. 95: uint8(_BT_NMSTRT),
  16635. 96: uint8(_BT_OTHER),
  16636. 97: uint8(_BT_HEX),
  16637. 98: uint8(_BT_HEX),
  16638. 99: uint8(_BT_HEX),
  16639. 100: uint8(_BT_HEX),
  16640. 101: uint8(_BT_HEX),
  16641. 102: uint8(_BT_HEX),
  16642. 103: uint8(_BT_NMSTRT),
  16643. 104: uint8(_BT_NMSTRT),
  16644. 105: uint8(_BT_NMSTRT),
  16645. 106: uint8(_BT_NMSTRT),
  16646. 107: uint8(_BT_NMSTRT),
  16647. 108: uint8(_BT_NMSTRT),
  16648. 109: uint8(_BT_NMSTRT),
  16649. 110: uint8(_BT_NMSTRT),
  16650. 111: uint8(_BT_NMSTRT),
  16651. 112: uint8(_BT_NMSTRT),
  16652. 113: uint8(_BT_NMSTRT),
  16653. 114: uint8(_BT_NMSTRT),
  16654. 115: uint8(_BT_NMSTRT),
  16655. 116: uint8(_BT_NMSTRT),
  16656. 117: uint8(_BT_NMSTRT),
  16657. 118: uint8(_BT_NMSTRT),
  16658. 119: uint8(_BT_NMSTRT),
  16659. 120: uint8(_BT_NMSTRT),
  16660. 121: uint8(_BT_NMSTRT),
  16661. 122: uint8(_BT_NMSTRT),
  16662. 123: uint8(_BT_OTHER),
  16663. 124: uint8(_BT_VERBAR),
  16664. 125: uint8(_BT_OTHER),
  16665. 126: uint8(_BT_OTHER),
  16666. 127: uint8(_BT_OTHER),
  16667. 128: uint8(_BT_TRAIL),
  16668. 129: uint8(_BT_TRAIL),
  16669. 130: uint8(_BT_TRAIL),
  16670. 131: uint8(_BT_TRAIL),
  16671. 132: uint8(_BT_TRAIL),
  16672. 133: uint8(_BT_TRAIL),
  16673. 134: uint8(_BT_TRAIL),
  16674. 135: uint8(_BT_TRAIL),
  16675. 136: uint8(_BT_TRAIL),
  16676. 137: uint8(_BT_TRAIL),
  16677. 138: uint8(_BT_TRAIL),
  16678. 139: uint8(_BT_TRAIL),
  16679. 140: uint8(_BT_TRAIL),
  16680. 141: uint8(_BT_TRAIL),
  16681. 142: uint8(_BT_TRAIL),
  16682. 143: uint8(_BT_TRAIL),
  16683. 144: uint8(_BT_TRAIL),
  16684. 145: uint8(_BT_TRAIL),
  16685. 146: uint8(_BT_TRAIL),
  16686. 147: uint8(_BT_TRAIL),
  16687. 148: uint8(_BT_TRAIL),
  16688. 149: uint8(_BT_TRAIL),
  16689. 150: uint8(_BT_TRAIL),
  16690. 151: uint8(_BT_TRAIL),
  16691. 152: uint8(_BT_TRAIL),
  16692. 153: uint8(_BT_TRAIL),
  16693. 154: uint8(_BT_TRAIL),
  16694. 155: uint8(_BT_TRAIL),
  16695. 156: uint8(_BT_TRAIL),
  16696. 157: uint8(_BT_TRAIL),
  16697. 158: uint8(_BT_TRAIL),
  16698. 159: uint8(_BT_TRAIL),
  16699. 160: uint8(_BT_TRAIL),
  16700. 161: uint8(_BT_TRAIL),
  16701. 162: uint8(_BT_TRAIL),
  16702. 163: uint8(_BT_TRAIL),
  16703. 164: uint8(_BT_TRAIL),
  16704. 165: uint8(_BT_TRAIL),
  16705. 166: uint8(_BT_TRAIL),
  16706. 167: uint8(_BT_TRAIL),
  16707. 168: uint8(_BT_TRAIL),
  16708. 169: uint8(_BT_TRAIL),
  16709. 170: uint8(_BT_TRAIL),
  16710. 171: uint8(_BT_TRAIL),
  16711. 172: uint8(_BT_TRAIL),
  16712. 173: uint8(_BT_TRAIL),
  16713. 174: uint8(_BT_TRAIL),
  16714. 175: uint8(_BT_TRAIL),
  16715. 176: uint8(_BT_TRAIL),
  16716. 177: uint8(_BT_TRAIL),
  16717. 178: uint8(_BT_TRAIL),
  16718. 179: uint8(_BT_TRAIL),
  16719. 180: uint8(_BT_TRAIL),
  16720. 181: uint8(_BT_TRAIL),
  16721. 182: uint8(_BT_TRAIL),
  16722. 183: uint8(_BT_TRAIL),
  16723. 184: uint8(_BT_TRAIL),
  16724. 185: uint8(_BT_TRAIL),
  16725. 186: uint8(_BT_TRAIL),
  16726. 187: uint8(_BT_TRAIL),
  16727. 188: uint8(_BT_TRAIL),
  16728. 189: uint8(_BT_TRAIL),
  16729. 190: uint8(_BT_TRAIL),
  16730. 191: uint8(_BT_TRAIL),
  16731. 192: uint8(_BT_LEAD2),
  16732. 193: uint8(_BT_LEAD2),
  16733. 194: uint8(_BT_LEAD2),
  16734. 195: uint8(_BT_LEAD2),
  16735. 196: uint8(_BT_LEAD2),
  16736. 197: uint8(_BT_LEAD2),
  16737. 198: uint8(_BT_LEAD2),
  16738. 199: uint8(_BT_LEAD2),
  16739. 200: uint8(_BT_LEAD2),
  16740. 201: uint8(_BT_LEAD2),
  16741. 202: uint8(_BT_LEAD2),
  16742. 203: uint8(_BT_LEAD2),
  16743. 204: uint8(_BT_LEAD2),
  16744. 205: uint8(_BT_LEAD2),
  16745. 206: uint8(_BT_LEAD2),
  16746. 207: uint8(_BT_LEAD2),
  16747. 208: uint8(_BT_LEAD2),
  16748. 209: uint8(_BT_LEAD2),
  16749. 210: uint8(_BT_LEAD2),
  16750. 211: uint8(_BT_LEAD2),
  16751. 212: uint8(_BT_LEAD2),
  16752. 213: uint8(_BT_LEAD2),
  16753. 214: uint8(_BT_LEAD2),
  16754. 215: uint8(_BT_LEAD2),
  16755. 216: uint8(_BT_LEAD2),
  16756. 217: uint8(_BT_LEAD2),
  16757. 218: uint8(_BT_LEAD2),
  16758. 219: uint8(_BT_LEAD2),
  16759. 220: uint8(_BT_LEAD2),
  16760. 221: uint8(_BT_LEAD2),
  16761. 222: uint8(_BT_LEAD2),
  16762. 223: uint8(_BT_LEAD2),
  16763. 224: uint8(_BT_LEAD3),
  16764. 225: uint8(_BT_LEAD3),
  16765. 226: uint8(_BT_LEAD3),
  16766. 227: uint8(_BT_LEAD3),
  16767. 228: uint8(_BT_LEAD3),
  16768. 229: uint8(_BT_LEAD3),
  16769. 230: uint8(_BT_LEAD3),
  16770. 231: uint8(_BT_LEAD3),
  16771. 232: uint8(_BT_LEAD3),
  16772. 233: uint8(_BT_LEAD3),
  16773. 234: uint8(_BT_LEAD3),
  16774. 235: uint8(_BT_LEAD3),
  16775. 236: uint8(_BT_LEAD3),
  16776. 237: uint8(_BT_LEAD3),
  16777. 238: uint8(_BT_LEAD3),
  16778. 239: uint8(_BT_LEAD3),
  16779. 240: uint8(_BT_LEAD4),
  16780. 241: uint8(_BT_LEAD4),
  16781. 242: uint8(_BT_LEAD4),
  16782. 243: uint8(_BT_LEAD4),
  16783. 244: uint8(_BT_LEAD4),
  16784. 254: uint8(_BT_MALFORM),
  16785. 255: uint8(_BT_MALFORM),
  16786. },
  16787. }
  16788. func init() {
  16789. p := unsafe.Pointer(&_utf8_encoding_ns)
  16790. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16791. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16792. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16793. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16794. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16795. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16796. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16797. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16798. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16799. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16800. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16801. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16802. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16803. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16804. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16805. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16806. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16807. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16808. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16809. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16810. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16811. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16812. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16813. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16814. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16815. }
  16816. var _utf8_encoding = Tnormal_encoding{
  16817. Fenc: TENCODING{
  16818. Fscanners: [4]TSCANNER{},
  16819. FliteralScanners: [2]TSCANNER{},
  16820. FminBytesPerChar: int32(1),
  16821. FisUtf8: int8(1),
  16822. },
  16823. Ftype1: [256]uint8{
  16824. 9: uint8(_BT_S),
  16825. 10: uint8(_BT_LF),
  16826. 13: uint8(_BT_CR),
  16827. 32: uint8(_BT_S),
  16828. 33: uint8(_BT_EXCL),
  16829. 34: uint8(_BT_QUOT),
  16830. 35: uint8(_BT_NUM),
  16831. 36: uint8(_BT_OTHER),
  16832. 37: uint8(_BT_PERCNT),
  16833. 38: uint8(_BT_AMP),
  16834. 39: uint8(_BT_APOS),
  16835. 40: uint8(_BT_LPAR),
  16836. 41: uint8(_BT_RPAR),
  16837. 42: uint8(_BT_AST),
  16838. 43: uint8(_BT_PLUS),
  16839. 44: uint8(_BT_COMMA),
  16840. 45: uint8(_BT_MINUS),
  16841. 46: uint8(_BT_NAME),
  16842. 47: uint8(_BT_SOL),
  16843. 48: uint8(_BT_DIGIT),
  16844. 49: uint8(_BT_DIGIT),
  16845. 50: uint8(_BT_DIGIT),
  16846. 51: uint8(_BT_DIGIT),
  16847. 52: uint8(_BT_DIGIT),
  16848. 53: uint8(_BT_DIGIT),
  16849. 54: uint8(_BT_DIGIT),
  16850. 55: uint8(_BT_DIGIT),
  16851. 56: uint8(_BT_DIGIT),
  16852. 57: uint8(_BT_DIGIT),
  16853. 58: uint8(_BT_NMSTRT),
  16854. 59: uint8(_BT_SEMI),
  16855. 60: uint8(_BT_LT),
  16856. 61: uint8(_BT_EQUALS),
  16857. 62: uint8(_BT_GT),
  16858. 63: uint8(_BT_QUEST),
  16859. 64: uint8(_BT_OTHER),
  16860. 65: uint8(_BT_HEX),
  16861. 66: uint8(_BT_HEX),
  16862. 67: uint8(_BT_HEX),
  16863. 68: uint8(_BT_HEX),
  16864. 69: uint8(_BT_HEX),
  16865. 70: uint8(_BT_HEX),
  16866. 71: uint8(_BT_NMSTRT),
  16867. 72: uint8(_BT_NMSTRT),
  16868. 73: uint8(_BT_NMSTRT),
  16869. 74: uint8(_BT_NMSTRT),
  16870. 75: uint8(_BT_NMSTRT),
  16871. 76: uint8(_BT_NMSTRT),
  16872. 77: uint8(_BT_NMSTRT),
  16873. 78: uint8(_BT_NMSTRT),
  16874. 79: uint8(_BT_NMSTRT),
  16875. 80: uint8(_BT_NMSTRT),
  16876. 81: uint8(_BT_NMSTRT),
  16877. 82: uint8(_BT_NMSTRT),
  16878. 83: uint8(_BT_NMSTRT),
  16879. 84: uint8(_BT_NMSTRT),
  16880. 85: uint8(_BT_NMSTRT),
  16881. 86: uint8(_BT_NMSTRT),
  16882. 87: uint8(_BT_NMSTRT),
  16883. 88: uint8(_BT_NMSTRT),
  16884. 89: uint8(_BT_NMSTRT),
  16885. 90: uint8(_BT_NMSTRT),
  16886. 91: uint8(_BT_LSQB),
  16887. 92: uint8(_BT_OTHER),
  16888. 93: uint8(_BT_RSQB),
  16889. 94: uint8(_BT_OTHER),
  16890. 95: uint8(_BT_NMSTRT),
  16891. 96: uint8(_BT_OTHER),
  16892. 97: uint8(_BT_HEX),
  16893. 98: uint8(_BT_HEX),
  16894. 99: uint8(_BT_HEX),
  16895. 100: uint8(_BT_HEX),
  16896. 101: uint8(_BT_HEX),
  16897. 102: uint8(_BT_HEX),
  16898. 103: uint8(_BT_NMSTRT),
  16899. 104: uint8(_BT_NMSTRT),
  16900. 105: uint8(_BT_NMSTRT),
  16901. 106: uint8(_BT_NMSTRT),
  16902. 107: uint8(_BT_NMSTRT),
  16903. 108: uint8(_BT_NMSTRT),
  16904. 109: uint8(_BT_NMSTRT),
  16905. 110: uint8(_BT_NMSTRT),
  16906. 111: uint8(_BT_NMSTRT),
  16907. 112: uint8(_BT_NMSTRT),
  16908. 113: uint8(_BT_NMSTRT),
  16909. 114: uint8(_BT_NMSTRT),
  16910. 115: uint8(_BT_NMSTRT),
  16911. 116: uint8(_BT_NMSTRT),
  16912. 117: uint8(_BT_NMSTRT),
  16913. 118: uint8(_BT_NMSTRT),
  16914. 119: uint8(_BT_NMSTRT),
  16915. 120: uint8(_BT_NMSTRT),
  16916. 121: uint8(_BT_NMSTRT),
  16917. 122: uint8(_BT_NMSTRT),
  16918. 123: uint8(_BT_OTHER),
  16919. 124: uint8(_BT_VERBAR),
  16920. 125: uint8(_BT_OTHER),
  16921. 126: uint8(_BT_OTHER),
  16922. 127: uint8(_BT_OTHER),
  16923. 128: uint8(_BT_TRAIL),
  16924. 129: uint8(_BT_TRAIL),
  16925. 130: uint8(_BT_TRAIL),
  16926. 131: uint8(_BT_TRAIL),
  16927. 132: uint8(_BT_TRAIL),
  16928. 133: uint8(_BT_TRAIL),
  16929. 134: uint8(_BT_TRAIL),
  16930. 135: uint8(_BT_TRAIL),
  16931. 136: uint8(_BT_TRAIL),
  16932. 137: uint8(_BT_TRAIL),
  16933. 138: uint8(_BT_TRAIL),
  16934. 139: uint8(_BT_TRAIL),
  16935. 140: uint8(_BT_TRAIL),
  16936. 141: uint8(_BT_TRAIL),
  16937. 142: uint8(_BT_TRAIL),
  16938. 143: uint8(_BT_TRAIL),
  16939. 144: uint8(_BT_TRAIL),
  16940. 145: uint8(_BT_TRAIL),
  16941. 146: uint8(_BT_TRAIL),
  16942. 147: uint8(_BT_TRAIL),
  16943. 148: uint8(_BT_TRAIL),
  16944. 149: uint8(_BT_TRAIL),
  16945. 150: uint8(_BT_TRAIL),
  16946. 151: uint8(_BT_TRAIL),
  16947. 152: uint8(_BT_TRAIL),
  16948. 153: uint8(_BT_TRAIL),
  16949. 154: uint8(_BT_TRAIL),
  16950. 155: uint8(_BT_TRAIL),
  16951. 156: uint8(_BT_TRAIL),
  16952. 157: uint8(_BT_TRAIL),
  16953. 158: uint8(_BT_TRAIL),
  16954. 159: uint8(_BT_TRAIL),
  16955. 160: uint8(_BT_TRAIL),
  16956. 161: uint8(_BT_TRAIL),
  16957. 162: uint8(_BT_TRAIL),
  16958. 163: uint8(_BT_TRAIL),
  16959. 164: uint8(_BT_TRAIL),
  16960. 165: uint8(_BT_TRAIL),
  16961. 166: uint8(_BT_TRAIL),
  16962. 167: uint8(_BT_TRAIL),
  16963. 168: uint8(_BT_TRAIL),
  16964. 169: uint8(_BT_TRAIL),
  16965. 170: uint8(_BT_TRAIL),
  16966. 171: uint8(_BT_TRAIL),
  16967. 172: uint8(_BT_TRAIL),
  16968. 173: uint8(_BT_TRAIL),
  16969. 174: uint8(_BT_TRAIL),
  16970. 175: uint8(_BT_TRAIL),
  16971. 176: uint8(_BT_TRAIL),
  16972. 177: uint8(_BT_TRAIL),
  16973. 178: uint8(_BT_TRAIL),
  16974. 179: uint8(_BT_TRAIL),
  16975. 180: uint8(_BT_TRAIL),
  16976. 181: uint8(_BT_TRAIL),
  16977. 182: uint8(_BT_TRAIL),
  16978. 183: uint8(_BT_TRAIL),
  16979. 184: uint8(_BT_TRAIL),
  16980. 185: uint8(_BT_TRAIL),
  16981. 186: uint8(_BT_TRAIL),
  16982. 187: uint8(_BT_TRAIL),
  16983. 188: uint8(_BT_TRAIL),
  16984. 189: uint8(_BT_TRAIL),
  16985. 190: uint8(_BT_TRAIL),
  16986. 191: uint8(_BT_TRAIL),
  16987. 192: uint8(_BT_LEAD2),
  16988. 193: uint8(_BT_LEAD2),
  16989. 194: uint8(_BT_LEAD2),
  16990. 195: uint8(_BT_LEAD2),
  16991. 196: uint8(_BT_LEAD2),
  16992. 197: uint8(_BT_LEAD2),
  16993. 198: uint8(_BT_LEAD2),
  16994. 199: uint8(_BT_LEAD2),
  16995. 200: uint8(_BT_LEAD2),
  16996. 201: uint8(_BT_LEAD2),
  16997. 202: uint8(_BT_LEAD2),
  16998. 203: uint8(_BT_LEAD2),
  16999. 204: uint8(_BT_LEAD2),
  17000. 205: uint8(_BT_LEAD2),
  17001. 206: uint8(_BT_LEAD2),
  17002. 207: uint8(_BT_LEAD2),
  17003. 208: uint8(_BT_LEAD2),
  17004. 209: uint8(_BT_LEAD2),
  17005. 210: uint8(_BT_LEAD2),
  17006. 211: uint8(_BT_LEAD2),
  17007. 212: uint8(_BT_LEAD2),
  17008. 213: uint8(_BT_LEAD2),
  17009. 214: uint8(_BT_LEAD2),
  17010. 215: uint8(_BT_LEAD2),
  17011. 216: uint8(_BT_LEAD2),
  17012. 217: uint8(_BT_LEAD2),
  17013. 218: uint8(_BT_LEAD2),
  17014. 219: uint8(_BT_LEAD2),
  17015. 220: uint8(_BT_LEAD2),
  17016. 221: uint8(_BT_LEAD2),
  17017. 222: uint8(_BT_LEAD2),
  17018. 223: uint8(_BT_LEAD2),
  17019. 224: uint8(_BT_LEAD3),
  17020. 225: uint8(_BT_LEAD3),
  17021. 226: uint8(_BT_LEAD3),
  17022. 227: uint8(_BT_LEAD3),
  17023. 228: uint8(_BT_LEAD3),
  17024. 229: uint8(_BT_LEAD3),
  17025. 230: uint8(_BT_LEAD3),
  17026. 231: uint8(_BT_LEAD3),
  17027. 232: uint8(_BT_LEAD3),
  17028. 233: uint8(_BT_LEAD3),
  17029. 234: uint8(_BT_LEAD3),
  17030. 235: uint8(_BT_LEAD3),
  17031. 236: uint8(_BT_LEAD3),
  17032. 237: uint8(_BT_LEAD3),
  17033. 238: uint8(_BT_LEAD3),
  17034. 239: uint8(_BT_LEAD3),
  17035. 240: uint8(_BT_LEAD4),
  17036. 241: uint8(_BT_LEAD4),
  17037. 242: uint8(_BT_LEAD4),
  17038. 243: uint8(_BT_LEAD4),
  17039. 244: uint8(_BT_LEAD4),
  17040. 254: uint8(_BT_MALFORM),
  17041. 255: uint8(_BT_MALFORM),
  17042. },
  17043. }
  17044. func init() {
  17045. p := unsafe.Pointer(&_utf8_encoding)
  17046. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17047. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17048. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17049. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17050. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17051. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17052. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17053. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17054. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17055. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17056. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17057. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17058. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17059. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17060. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17061. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17062. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17063. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17064. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17065. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17066. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17067. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17068. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17069. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17070. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17071. }
  17072. var _internal_utf8_encoding_ns = Tnormal_encoding{
  17073. Fenc: TENCODING{
  17074. Fscanners: [4]TSCANNER{},
  17075. FliteralScanners: [2]TSCANNER{},
  17076. FminBytesPerChar: int32(1),
  17077. FisUtf8: int8(1),
  17078. },
  17079. Ftype1: [256]uint8{
  17080. 9: uint8(_BT_S),
  17081. 10: uint8(_BT_LF),
  17082. 13: uint8(_BT_S),
  17083. 32: uint8(_BT_S),
  17084. 33: uint8(_BT_EXCL),
  17085. 34: uint8(_BT_QUOT),
  17086. 35: uint8(_BT_NUM),
  17087. 36: uint8(_BT_OTHER),
  17088. 37: uint8(_BT_PERCNT),
  17089. 38: uint8(_BT_AMP),
  17090. 39: uint8(_BT_APOS),
  17091. 40: uint8(_BT_LPAR),
  17092. 41: uint8(_BT_RPAR),
  17093. 42: uint8(_BT_AST),
  17094. 43: uint8(_BT_PLUS),
  17095. 44: uint8(_BT_COMMA),
  17096. 45: uint8(_BT_MINUS),
  17097. 46: uint8(_BT_NAME),
  17098. 47: uint8(_BT_SOL),
  17099. 48: uint8(_BT_DIGIT),
  17100. 49: uint8(_BT_DIGIT),
  17101. 50: uint8(_BT_DIGIT),
  17102. 51: uint8(_BT_DIGIT),
  17103. 52: uint8(_BT_DIGIT),
  17104. 53: uint8(_BT_DIGIT),
  17105. 54: uint8(_BT_DIGIT),
  17106. 55: uint8(_BT_DIGIT),
  17107. 56: uint8(_BT_DIGIT),
  17108. 57: uint8(_BT_DIGIT),
  17109. 58: uint8(_BT_COLON),
  17110. 59: uint8(_BT_SEMI),
  17111. 60: uint8(_BT_LT),
  17112. 61: uint8(_BT_EQUALS),
  17113. 62: uint8(_BT_GT),
  17114. 63: uint8(_BT_QUEST),
  17115. 64: uint8(_BT_OTHER),
  17116. 65: uint8(_BT_HEX),
  17117. 66: uint8(_BT_HEX),
  17118. 67: uint8(_BT_HEX),
  17119. 68: uint8(_BT_HEX),
  17120. 69: uint8(_BT_HEX),
  17121. 70: uint8(_BT_HEX),
  17122. 71: uint8(_BT_NMSTRT),
  17123. 72: uint8(_BT_NMSTRT),
  17124. 73: uint8(_BT_NMSTRT),
  17125. 74: uint8(_BT_NMSTRT),
  17126. 75: uint8(_BT_NMSTRT),
  17127. 76: uint8(_BT_NMSTRT),
  17128. 77: uint8(_BT_NMSTRT),
  17129. 78: uint8(_BT_NMSTRT),
  17130. 79: uint8(_BT_NMSTRT),
  17131. 80: uint8(_BT_NMSTRT),
  17132. 81: uint8(_BT_NMSTRT),
  17133. 82: uint8(_BT_NMSTRT),
  17134. 83: uint8(_BT_NMSTRT),
  17135. 84: uint8(_BT_NMSTRT),
  17136. 85: uint8(_BT_NMSTRT),
  17137. 86: uint8(_BT_NMSTRT),
  17138. 87: uint8(_BT_NMSTRT),
  17139. 88: uint8(_BT_NMSTRT),
  17140. 89: uint8(_BT_NMSTRT),
  17141. 90: uint8(_BT_NMSTRT),
  17142. 91: uint8(_BT_LSQB),
  17143. 92: uint8(_BT_OTHER),
  17144. 93: uint8(_BT_RSQB),
  17145. 94: uint8(_BT_OTHER),
  17146. 95: uint8(_BT_NMSTRT),
  17147. 96: uint8(_BT_OTHER),
  17148. 97: uint8(_BT_HEX),
  17149. 98: uint8(_BT_HEX),
  17150. 99: uint8(_BT_HEX),
  17151. 100: uint8(_BT_HEX),
  17152. 101: uint8(_BT_HEX),
  17153. 102: uint8(_BT_HEX),
  17154. 103: uint8(_BT_NMSTRT),
  17155. 104: uint8(_BT_NMSTRT),
  17156. 105: uint8(_BT_NMSTRT),
  17157. 106: uint8(_BT_NMSTRT),
  17158. 107: uint8(_BT_NMSTRT),
  17159. 108: uint8(_BT_NMSTRT),
  17160. 109: uint8(_BT_NMSTRT),
  17161. 110: uint8(_BT_NMSTRT),
  17162. 111: uint8(_BT_NMSTRT),
  17163. 112: uint8(_BT_NMSTRT),
  17164. 113: uint8(_BT_NMSTRT),
  17165. 114: uint8(_BT_NMSTRT),
  17166. 115: uint8(_BT_NMSTRT),
  17167. 116: uint8(_BT_NMSTRT),
  17168. 117: uint8(_BT_NMSTRT),
  17169. 118: uint8(_BT_NMSTRT),
  17170. 119: uint8(_BT_NMSTRT),
  17171. 120: uint8(_BT_NMSTRT),
  17172. 121: uint8(_BT_NMSTRT),
  17173. 122: uint8(_BT_NMSTRT),
  17174. 123: uint8(_BT_OTHER),
  17175. 124: uint8(_BT_VERBAR),
  17176. 125: uint8(_BT_OTHER),
  17177. 126: uint8(_BT_OTHER),
  17178. 127: uint8(_BT_OTHER),
  17179. 128: uint8(_BT_TRAIL),
  17180. 129: uint8(_BT_TRAIL),
  17181. 130: uint8(_BT_TRAIL),
  17182. 131: uint8(_BT_TRAIL),
  17183. 132: uint8(_BT_TRAIL),
  17184. 133: uint8(_BT_TRAIL),
  17185. 134: uint8(_BT_TRAIL),
  17186. 135: uint8(_BT_TRAIL),
  17187. 136: uint8(_BT_TRAIL),
  17188. 137: uint8(_BT_TRAIL),
  17189. 138: uint8(_BT_TRAIL),
  17190. 139: uint8(_BT_TRAIL),
  17191. 140: uint8(_BT_TRAIL),
  17192. 141: uint8(_BT_TRAIL),
  17193. 142: uint8(_BT_TRAIL),
  17194. 143: uint8(_BT_TRAIL),
  17195. 144: uint8(_BT_TRAIL),
  17196. 145: uint8(_BT_TRAIL),
  17197. 146: uint8(_BT_TRAIL),
  17198. 147: uint8(_BT_TRAIL),
  17199. 148: uint8(_BT_TRAIL),
  17200. 149: uint8(_BT_TRAIL),
  17201. 150: uint8(_BT_TRAIL),
  17202. 151: uint8(_BT_TRAIL),
  17203. 152: uint8(_BT_TRAIL),
  17204. 153: uint8(_BT_TRAIL),
  17205. 154: uint8(_BT_TRAIL),
  17206. 155: uint8(_BT_TRAIL),
  17207. 156: uint8(_BT_TRAIL),
  17208. 157: uint8(_BT_TRAIL),
  17209. 158: uint8(_BT_TRAIL),
  17210. 159: uint8(_BT_TRAIL),
  17211. 160: uint8(_BT_TRAIL),
  17212. 161: uint8(_BT_TRAIL),
  17213. 162: uint8(_BT_TRAIL),
  17214. 163: uint8(_BT_TRAIL),
  17215. 164: uint8(_BT_TRAIL),
  17216. 165: uint8(_BT_TRAIL),
  17217. 166: uint8(_BT_TRAIL),
  17218. 167: uint8(_BT_TRAIL),
  17219. 168: uint8(_BT_TRAIL),
  17220. 169: uint8(_BT_TRAIL),
  17221. 170: uint8(_BT_TRAIL),
  17222. 171: uint8(_BT_TRAIL),
  17223. 172: uint8(_BT_TRAIL),
  17224. 173: uint8(_BT_TRAIL),
  17225. 174: uint8(_BT_TRAIL),
  17226. 175: uint8(_BT_TRAIL),
  17227. 176: uint8(_BT_TRAIL),
  17228. 177: uint8(_BT_TRAIL),
  17229. 178: uint8(_BT_TRAIL),
  17230. 179: uint8(_BT_TRAIL),
  17231. 180: uint8(_BT_TRAIL),
  17232. 181: uint8(_BT_TRAIL),
  17233. 182: uint8(_BT_TRAIL),
  17234. 183: uint8(_BT_TRAIL),
  17235. 184: uint8(_BT_TRAIL),
  17236. 185: uint8(_BT_TRAIL),
  17237. 186: uint8(_BT_TRAIL),
  17238. 187: uint8(_BT_TRAIL),
  17239. 188: uint8(_BT_TRAIL),
  17240. 189: uint8(_BT_TRAIL),
  17241. 190: uint8(_BT_TRAIL),
  17242. 191: uint8(_BT_TRAIL),
  17243. 192: uint8(_BT_LEAD2),
  17244. 193: uint8(_BT_LEAD2),
  17245. 194: uint8(_BT_LEAD2),
  17246. 195: uint8(_BT_LEAD2),
  17247. 196: uint8(_BT_LEAD2),
  17248. 197: uint8(_BT_LEAD2),
  17249. 198: uint8(_BT_LEAD2),
  17250. 199: uint8(_BT_LEAD2),
  17251. 200: uint8(_BT_LEAD2),
  17252. 201: uint8(_BT_LEAD2),
  17253. 202: uint8(_BT_LEAD2),
  17254. 203: uint8(_BT_LEAD2),
  17255. 204: uint8(_BT_LEAD2),
  17256. 205: uint8(_BT_LEAD2),
  17257. 206: uint8(_BT_LEAD2),
  17258. 207: uint8(_BT_LEAD2),
  17259. 208: uint8(_BT_LEAD2),
  17260. 209: uint8(_BT_LEAD2),
  17261. 210: uint8(_BT_LEAD2),
  17262. 211: uint8(_BT_LEAD2),
  17263. 212: uint8(_BT_LEAD2),
  17264. 213: uint8(_BT_LEAD2),
  17265. 214: uint8(_BT_LEAD2),
  17266. 215: uint8(_BT_LEAD2),
  17267. 216: uint8(_BT_LEAD2),
  17268. 217: uint8(_BT_LEAD2),
  17269. 218: uint8(_BT_LEAD2),
  17270. 219: uint8(_BT_LEAD2),
  17271. 220: uint8(_BT_LEAD2),
  17272. 221: uint8(_BT_LEAD2),
  17273. 222: uint8(_BT_LEAD2),
  17274. 223: uint8(_BT_LEAD2),
  17275. 224: uint8(_BT_LEAD3),
  17276. 225: uint8(_BT_LEAD3),
  17277. 226: uint8(_BT_LEAD3),
  17278. 227: uint8(_BT_LEAD3),
  17279. 228: uint8(_BT_LEAD3),
  17280. 229: uint8(_BT_LEAD3),
  17281. 230: uint8(_BT_LEAD3),
  17282. 231: uint8(_BT_LEAD3),
  17283. 232: uint8(_BT_LEAD3),
  17284. 233: uint8(_BT_LEAD3),
  17285. 234: uint8(_BT_LEAD3),
  17286. 235: uint8(_BT_LEAD3),
  17287. 236: uint8(_BT_LEAD3),
  17288. 237: uint8(_BT_LEAD3),
  17289. 238: uint8(_BT_LEAD3),
  17290. 239: uint8(_BT_LEAD3),
  17291. 240: uint8(_BT_LEAD4),
  17292. 241: uint8(_BT_LEAD4),
  17293. 242: uint8(_BT_LEAD4),
  17294. 243: uint8(_BT_LEAD4),
  17295. 244: uint8(_BT_LEAD4),
  17296. 254: uint8(_BT_MALFORM),
  17297. 255: uint8(_BT_MALFORM),
  17298. },
  17299. }
  17300. func init() {
  17301. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17302. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17303. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17304. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17305. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17306. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17307. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17308. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17309. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17310. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17311. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17312. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17313. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17314. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17315. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17316. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17317. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17318. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17319. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17320. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17321. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17322. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17323. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17324. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17325. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17326. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17327. }
  17328. var _internal_utf8_encoding = Tnormal_encoding{
  17329. Fenc: TENCODING{
  17330. Fscanners: [4]TSCANNER{},
  17331. FliteralScanners: [2]TSCANNER{},
  17332. FminBytesPerChar: int32(1),
  17333. FisUtf8: int8(1),
  17334. },
  17335. Ftype1: [256]uint8{
  17336. 9: uint8(_BT_S),
  17337. 10: uint8(_BT_LF),
  17338. 13: uint8(_BT_S),
  17339. 32: uint8(_BT_S),
  17340. 33: uint8(_BT_EXCL),
  17341. 34: uint8(_BT_QUOT),
  17342. 35: uint8(_BT_NUM),
  17343. 36: uint8(_BT_OTHER),
  17344. 37: uint8(_BT_PERCNT),
  17345. 38: uint8(_BT_AMP),
  17346. 39: uint8(_BT_APOS),
  17347. 40: uint8(_BT_LPAR),
  17348. 41: uint8(_BT_RPAR),
  17349. 42: uint8(_BT_AST),
  17350. 43: uint8(_BT_PLUS),
  17351. 44: uint8(_BT_COMMA),
  17352. 45: uint8(_BT_MINUS),
  17353. 46: uint8(_BT_NAME),
  17354. 47: uint8(_BT_SOL),
  17355. 48: uint8(_BT_DIGIT),
  17356. 49: uint8(_BT_DIGIT),
  17357. 50: uint8(_BT_DIGIT),
  17358. 51: uint8(_BT_DIGIT),
  17359. 52: uint8(_BT_DIGIT),
  17360. 53: uint8(_BT_DIGIT),
  17361. 54: uint8(_BT_DIGIT),
  17362. 55: uint8(_BT_DIGIT),
  17363. 56: uint8(_BT_DIGIT),
  17364. 57: uint8(_BT_DIGIT),
  17365. 58: uint8(_BT_NMSTRT),
  17366. 59: uint8(_BT_SEMI),
  17367. 60: uint8(_BT_LT),
  17368. 61: uint8(_BT_EQUALS),
  17369. 62: uint8(_BT_GT),
  17370. 63: uint8(_BT_QUEST),
  17371. 64: uint8(_BT_OTHER),
  17372. 65: uint8(_BT_HEX),
  17373. 66: uint8(_BT_HEX),
  17374. 67: uint8(_BT_HEX),
  17375. 68: uint8(_BT_HEX),
  17376. 69: uint8(_BT_HEX),
  17377. 70: uint8(_BT_HEX),
  17378. 71: uint8(_BT_NMSTRT),
  17379. 72: uint8(_BT_NMSTRT),
  17380. 73: uint8(_BT_NMSTRT),
  17381. 74: uint8(_BT_NMSTRT),
  17382. 75: uint8(_BT_NMSTRT),
  17383. 76: uint8(_BT_NMSTRT),
  17384. 77: uint8(_BT_NMSTRT),
  17385. 78: uint8(_BT_NMSTRT),
  17386. 79: uint8(_BT_NMSTRT),
  17387. 80: uint8(_BT_NMSTRT),
  17388. 81: uint8(_BT_NMSTRT),
  17389. 82: uint8(_BT_NMSTRT),
  17390. 83: uint8(_BT_NMSTRT),
  17391. 84: uint8(_BT_NMSTRT),
  17392. 85: uint8(_BT_NMSTRT),
  17393. 86: uint8(_BT_NMSTRT),
  17394. 87: uint8(_BT_NMSTRT),
  17395. 88: uint8(_BT_NMSTRT),
  17396. 89: uint8(_BT_NMSTRT),
  17397. 90: uint8(_BT_NMSTRT),
  17398. 91: uint8(_BT_LSQB),
  17399. 92: uint8(_BT_OTHER),
  17400. 93: uint8(_BT_RSQB),
  17401. 94: uint8(_BT_OTHER),
  17402. 95: uint8(_BT_NMSTRT),
  17403. 96: uint8(_BT_OTHER),
  17404. 97: uint8(_BT_HEX),
  17405. 98: uint8(_BT_HEX),
  17406. 99: uint8(_BT_HEX),
  17407. 100: uint8(_BT_HEX),
  17408. 101: uint8(_BT_HEX),
  17409. 102: uint8(_BT_HEX),
  17410. 103: uint8(_BT_NMSTRT),
  17411. 104: uint8(_BT_NMSTRT),
  17412. 105: uint8(_BT_NMSTRT),
  17413. 106: uint8(_BT_NMSTRT),
  17414. 107: uint8(_BT_NMSTRT),
  17415. 108: uint8(_BT_NMSTRT),
  17416. 109: uint8(_BT_NMSTRT),
  17417. 110: uint8(_BT_NMSTRT),
  17418. 111: uint8(_BT_NMSTRT),
  17419. 112: uint8(_BT_NMSTRT),
  17420. 113: uint8(_BT_NMSTRT),
  17421. 114: uint8(_BT_NMSTRT),
  17422. 115: uint8(_BT_NMSTRT),
  17423. 116: uint8(_BT_NMSTRT),
  17424. 117: uint8(_BT_NMSTRT),
  17425. 118: uint8(_BT_NMSTRT),
  17426. 119: uint8(_BT_NMSTRT),
  17427. 120: uint8(_BT_NMSTRT),
  17428. 121: uint8(_BT_NMSTRT),
  17429. 122: uint8(_BT_NMSTRT),
  17430. 123: uint8(_BT_OTHER),
  17431. 124: uint8(_BT_VERBAR),
  17432. 125: uint8(_BT_OTHER),
  17433. 126: uint8(_BT_OTHER),
  17434. 127: uint8(_BT_OTHER),
  17435. 128: uint8(_BT_TRAIL),
  17436. 129: uint8(_BT_TRAIL),
  17437. 130: uint8(_BT_TRAIL),
  17438. 131: uint8(_BT_TRAIL),
  17439. 132: uint8(_BT_TRAIL),
  17440. 133: uint8(_BT_TRAIL),
  17441. 134: uint8(_BT_TRAIL),
  17442. 135: uint8(_BT_TRAIL),
  17443. 136: uint8(_BT_TRAIL),
  17444. 137: uint8(_BT_TRAIL),
  17445. 138: uint8(_BT_TRAIL),
  17446. 139: uint8(_BT_TRAIL),
  17447. 140: uint8(_BT_TRAIL),
  17448. 141: uint8(_BT_TRAIL),
  17449. 142: uint8(_BT_TRAIL),
  17450. 143: uint8(_BT_TRAIL),
  17451. 144: uint8(_BT_TRAIL),
  17452. 145: uint8(_BT_TRAIL),
  17453. 146: uint8(_BT_TRAIL),
  17454. 147: uint8(_BT_TRAIL),
  17455. 148: uint8(_BT_TRAIL),
  17456. 149: uint8(_BT_TRAIL),
  17457. 150: uint8(_BT_TRAIL),
  17458. 151: uint8(_BT_TRAIL),
  17459. 152: uint8(_BT_TRAIL),
  17460. 153: uint8(_BT_TRAIL),
  17461. 154: uint8(_BT_TRAIL),
  17462. 155: uint8(_BT_TRAIL),
  17463. 156: uint8(_BT_TRAIL),
  17464. 157: uint8(_BT_TRAIL),
  17465. 158: uint8(_BT_TRAIL),
  17466. 159: uint8(_BT_TRAIL),
  17467. 160: uint8(_BT_TRAIL),
  17468. 161: uint8(_BT_TRAIL),
  17469. 162: uint8(_BT_TRAIL),
  17470. 163: uint8(_BT_TRAIL),
  17471. 164: uint8(_BT_TRAIL),
  17472. 165: uint8(_BT_TRAIL),
  17473. 166: uint8(_BT_TRAIL),
  17474. 167: uint8(_BT_TRAIL),
  17475. 168: uint8(_BT_TRAIL),
  17476. 169: uint8(_BT_TRAIL),
  17477. 170: uint8(_BT_TRAIL),
  17478. 171: uint8(_BT_TRAIL),
  17479. 172: uint8(_BT_TRAIL),
  17480. 173: uint8(_BT_TRAIL),
  17481. 174: uint8(_BT_TRAIL),
  17482. 175: uint8(_BT_TRAIL),
  17483. 176: uint8(_BT_TRAIL),
  17484. 177: uint8(_BT_TRAIL),
  17485. 178: uint8(_BT_TRAIL),
  17486. 179: uint8(_BT_TRAIL),
  17487. 180: uint8(_BT_TRAIL),
  17488. 181: uint8(_BT_TRAIL),
  17489. 182: uint8(_BT_TRAIL),
  17490. 183: uint8(_BT_TRAIL),
  17491. 184: uint8(_BT_TRAIL),
  17492. 185: uint8(_BT_TRAIL),
  17493. 186: uint8(_BT_TRAIL),
  17494. 187: uint8(_BT_TRAIL),
  17495. 188: uint8(_BT_TRAIL),
  17496. 189: uint8(_BT_TRAIL),
  17497. 190: uint8(_BT_TRAIL),
  17498. 191: uint8(_BT_TRAIL),
  17499. 192: uint8(_BT_LEAD2),
  17500. 193: uint8(_BT_LEAD2),
  17501. 194: uint8(_BT_LEAD2),
  17502. 195: uint8(_BT_LEAD2),
  17503. 196: uint8(_BT_LEAD2),
  17504. 197: uint8(_BT_LEAD2),
  17505. 198: uint8(_BT_LEAD2),
  17506. 199: uint8(_BT_LEAD2),
  17507. 200: uint8(_BT_LEAD2),
  17508. 201: uint8(_BT_LEAD2),
  17509. 202: uint8(_BT_LEAD2),
  17510. 203: uint8(_BT_LEAD2),
  17511. 204: uint8(_BT_LEAD2),
  17512. 205: uint8(_BT_LEAD2),
  17513. 206: uint8(_BT_LEAD2),
  17514. 207: uint8(_BT_LEAD2),
  17515. 208: uint8(_BT_LEAD2),
  17516. 209: uint8(_BT_LEAD2),
  17517. 210: uint8(_BT_LEAD2),
  17518. 211: uint8(_BT_LEAD2),
  17519. 212: uint8(_BT_LEAD2),
  17520. 213: uint8(_BT_LEAD2),
  17521. 214: uint8(_BT_LEAD2),
  17522. 215: uint8(_BT_LEAD2),
  17523. 216: uint8(_BT_LEAD2),
  17524. 217: uint8(_BT_LEAD2),
  17525. 218: uint8(_BT_LEAD2),
  17526. 219: uint8(_BT_LEAD2),
  17527. 220: uint8(_BT_LEAD2),
  17528. 221: uint8(_BT_LEAD2),
  17529. 222: uint8(_BT_LEAD2),
  17530. 223: uint8(_BT_LEAD2),
  17531. 224: uint8(_BT_LEAD3),
  17532. 225: uint8(_BT_LEAD3),
  17533. 226: uint8(_BT_LEAD3),
  17534. 227: uint8(_BT_LEAD3),
  17535. 228: uint8(_BT_LEAD3),
  17536. 229: uint8(_BT_LEAD3),
  17537. 230: uint8(_BT_LEAD3),
  17538. 231: uint8(_BT_LEAD3),
  17539. 232: uint8(_BT_LEAD3),
  17540. 233: uint8(_BT_LEAD3),
  17541. 234: uint8(_BT_LEAD3),
  17542. 235: uint8(_BT_LEAD3),
  17543. 236: uint8(_BT_LEAD3),
  17544. 237: uint8(_BT_LEAD3),
  17545. 238: uint8(_BT_LEAD3),
  17546. 239: uint8(_BT_LEAD3),
  17547. 240: uint8(_BT_LEAD4),
  17548. 241: uint8(_BT_LEAD4),
  17549. 242: uint8(_BT_LEAD4),
  17550. 243: uint8(_BT_LEAD4),
  17551. 244: uint8(_BT_LEAD4),
  17552. 254: uint8(_BT_MALFORM),
  17553. 255: uint8(_BT_MALFORM),
  17554. },
  17555. }
  17556. func init() {
  17557. p := unsafe.Pointer(&_internal_utf8_encoding)
  17558. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17559. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17560. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17561. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17562. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17563. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17564. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17565. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17566. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17567. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17568. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17569. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17570. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17571. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17572. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17573. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17574. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17575. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17576. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17577. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17578. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17579. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17580. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17581. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17582. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17583. }
  17584. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17585. var c uint8
  17586. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17587. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17588. _ = enc
  17589. for {
  17590. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17591. return int32(_XML_CONVERT_COMPLETED)
  17592. }
  17593. c = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))
  17594. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17595. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  17596. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17597. }
  17598. v3 = toP
  17599. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17600. *(*uintptr)(unsafe.Pointer(v3))++
  17601. *(*int8)(unsafe.Pointer(v2)) = int8(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17602. v5 = toP
  17603. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17604. *(*uintptr)(unsafe.Pointer(v5))++
  17605. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17606. *(*uintptr)(unsafe.Pointer(fromP))++
  17607. } else {
  17608. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17609. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17610. }
  17611. v7 = toP
  17612. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17613. *(*uintptr)(unsafe.Pointer(v7))++
  17614. v9 = fromP
  17615. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17616. *(*uintptr)(unsafe.Pointer(v9))++
  17617. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(v8))
  17618. }
  17619. goto _1
  17620. _1:
  17621. }
  17622. return r
  17623. }
  17624. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17625. var v1, v2, v3, v4 uintptr
  17626. _, _, _, _ = v1, v2, v3, v4
  17627. _ = enc
  17628. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17629. v2 = toP
  17630. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17631. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17632. v4 = fromP
  17633. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17634. *(*uintptr)(unsafe.Pointer(v4))++
  17635. *(*uint16)(unsafe.Pointer(v1)) = uint16(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(v3))))
  17636. }
  17637. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17638. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17639. } else {
  17640. return int32(_XML_CONVERT_COMPLETED)
  17641. }
  17642. return r
  17643. }
  17644. var _latin1_encoding_ns = Tnormal_encoding{
  17645. Fenc: TENCODING{
  17646. Fscanners: [4]TSCANNER{},
  17647. FliteralScanners: [2]TSCANNER{},
  17648. FminBytesPerChar: int32(1),
  17649. },
  17650. Ftype1: [256]uint8{
  17651. 9: uint8(_BT_S),
  17652. 10: uint8(_BT_LF),
  17653. 13: uint8(_BT_CR),
  17654. 32: uint8(_BT_S),
  17655. 33: uint8(_BT_EXCL),
  17656. 34: uint8(_BT_QUOT),
  17657. 35: uint8(_BT_NUM),
  17658. 36: uint8(_BT_OTHER),
  17659. 37: uint8(_BT_PERCNT),
  17660. 38: uint8(_BT_AMP),
  17661. 39: uint8(_BT_APOS),
  17662. 40: uint8(_BT_LPAR),
  17663. 41: uint8(_BT_RPAR),
  17664. 42: uint8(_BT_AST),
  17665. 43: uint8(_BT_PLUS),
  17666. 44: uint8(_BT_COMMA),
  17667. 45: uint8(_BT_MINUS),
  17668. 46: uint8(_BT_NAME),
  17669. 47: uint8(_BT_SOL),
  17670. 48: uint8(_BT_DIGIT),
  17671. 49: uint8(_BT_DIGIT),
  17672. 50: uint8(_BT_DIGIT),
  17673. 51: uint8(_BT_DIGIT),
  17674. 52: uint8(_BT_DIGIT),
  17675. 53: uint8(_BT_DIGIT),
  17676. 54: uint8(_BT_DIGIT),
  17677. 55: uint8(_BT_DIGIT),
  17678. 56: uint8(_BT_DIGIT),
  17679. 57: uint8(_BT_DIGIT),
  17680. 58: uint8(_BT_COLON),
  17681. 59: uint8(_BT_SEMI),
  17682. 60: uint8(_BT_LT),
  17683. 61: uint8(_BT_EQUALS),
  17684. 62: uint8(_BT_GT),
  17685. 63: uint8(_BT_QUEST),
  17686. 64: uint8(_BT_OTHER),
  17687. 65: uint8(_BT_HEX),
  17688. 66: uint8(_BT_HEX),
  17689. 67: uint8(_BT_HEX),
  17690. 68: uint8(_BT_HEX),
  17691. 69: uint8(_BT_HEX),
  17692. 70: uint8(_BT_HEX),
  17693. 71: uint8(_BT_NMSTRT),
  17694. 72: uint8(_BT_NMSTRT),
  17695. 73: uint8(_BT_NMSTRT),
  17696. 74: uint8(_BT_NMSTRT),
  17697. 75: uint8(_BT_NMSTRT),
  17698. 76: uint8(_BT_NMSTRT),
  17699. 77: uint8(_BT_NMSTRT),
  17700. 78: uint8(_BT_NMSTRT),
  17701. 79: uint8(_BT_NMSTRT),
  17702. 80: uint8(_BT_NMSTRT),
  17703. 81: uint8(_BT_NMSTRT),
  17704. 82: uint8(_BT_NMSTRT),
  17705. 83: uint8(_BT_NMSTRT),
  17706. 84: uint8(_BT_NMSTRT),
  17707. 85: uint8(_BT_NMSTRT),
  17708. 86: uint8(_BT_NMSTRT),
  17709. 87: uint8(_BT_NMSTRT),
  17710. 88: uint8(_BT_NMSTRT),
  17711. 89: uint8(_BT_NMSTRT),
  17712. 90: uint8(_BT_NMSTRT),
  17713. 91: uint8(_BT_LSQB),
  17714. 92: uint8(_BT_OTHER),
  17715. 93: uint8(_BT_RSQB),
  17716. 94: uint8(_BT_OTHER),
  17717. 95: uint8(_BT_NMSTRT),
  17718. 96: uint8(_BT_OTHER),
  17719. 97: uint8(_BT_HEX),
  17720. 98: uint8(_BT_HEX),
  17721. 99: uint8(_BT_HEX),
  17722. 100: uint8(_BT_HEX),
  17723. 101: uint8(_BT_HEX),
  17724. 102: uint8(_BT_HEX),
  17725. 103: uint8(_BT_NMSTRT),
  17726. 104: uint8(_BT_NMSTRT),
  17727. 105: uint8(_BT_NMSTRT),
  17728. 106: uint8(_BT_NMSTRT),
  17729. 107: uint8(_BT_NMSTRT),
  17730. 108: uint8(_BT_NMSTRT),
  17731. 109: uint8(_BT_NMSTRT),
  17732. 110: uint8(_BT_NMSTRT),
  17733. 111: uint8(_BT_NMSTRT),
  17734. 112: uint8(_BT_NMSTRT),
  17735. 113: uint8(_BT_NMSTRT),
  17736. 114: uint8(_BT_NMSTRT),
  17737. 115: uint8(_BT_NMSTRT),
  17738. 116: uint8(_BT_NMSTRT),
  17739. 117: uint8(_BT_NMSTRT),
  17740. 118: uint8(_BT_NMSTRT),
  17741. 119: uint8(_BT_NMSTRT),
  17742. 120: uint8(_BT_NMSTRT),
  17743. 121: uint8(_BT_NMSTRT),
  17744. 122: uint8(_BT_NMSTRT),
  17745. 123: uint8(_BT_OTHER),
  17746. 124: uint8(_BT_VERBAR),
  17747. 125: uint8(_BT_OTHER),
  17748. 126: uint8(_BT_OTHER),
  17749. 127: uint8(_BT_OTHER),
  17750. 128: uint8(_BT_OTHER),
  17751. 129: uint8(_BT_OTHER),
  17752. 130: uint8(_BT_OTHER),
  17753. 131: uint8(_BT_OTHER),
  17754. 132: uint8(_BT_OTHER),
  17755. 133: uint8(_BT_OTHER),
  17756. 134: uint8(_BT_OTHER),
  17757. 135: uint8(_BT_OTHER),
  17758. 136: uint8(_BT_OTHER),
  17759. 137: uint8(_BT_OTHER),
  17760. 138: uint8(_BT_OTHER),
  17761. 139: uint8(_BT_OTHER),
  17762. 140: uint8(_BT_OTHER),
  17763. 141: uint8(_BT_OTHER),
  17764. 142: uint8(_BT_OTHER),
  17765. 143: uint8(_BT_OTHER),
  17766. 144: uint8(_BT_OTHER),
  17767. 145: uint8(_BT_OTHER),
  17768. 146: uint8(_BT_OTHER),
  17769. 147: uint8(_BT_OTHER),
  17770. 148: uint8(_BT_OTHER),
  17771. 149: uint8(_BT_OTHER),
  17772. 150: uint8(_BT_OTHER),
  17773. 151: uint8(_BT_OTHER),
  17774. 152: uint8(_BT_OTHER),
  17775. 153: uint8(_BT_OTHER),
  17776. 154: uint8(_BT_OTHER),
  17777. 155: uint8(_BT_OTHER),
  17778. 156: uint8(_BT_OTHER),
  17779. 157: uint8(_BT_OTHER),
  17780. 158: uint8(_BT_OTHER),
  17781. 159: uint8(_BT_OTHER),
  17782. 160: uint8(_BT_OTHER),
  17783. 161: uint8(_BT_OTHER),
  17784. 162: uint8(_BT_OTHER),
  17785. 163: uint8(_BT_OTHER),
  17786. 164: uint8(_BT_OTHER),
  17787. 165: uint8(_BT_OTHER),
  17788. 166: uint8(_BT_OTHER),
  17789. 167: uint8(_BT_OTHER),
  17790. 168: uint8(_BT_OTHER),
  17791. 169: uint8(_BT_OTHER),
  17792. 170: uint8(_BT_NMSTRT),
  17793. 171: uint8(_BT_OTHER),
  17794. 172: uint8(_BT_OTHER),
  17795. 173: uint8(_BT_OTHER),
  17796. 174: uint8(_BT_OTHER),
  17797. 175: uint8(_BT_OTHER),
  17798. 176: uint8(_BT_OTHER),
  17799. 177: uint8(_BT_OTHER),
  17800. 178: uint8(_BT_OTHER),
  17801. 179: uint8(_BT_OTHER),
  17802. 180: uint8(_BT_OTHER),
  17803. 181: uint8(_BT_NMSTRT),
  17804. 182: uint8(_BT_OTHER),
  17805. 183: uint8(_BT_NAME),
  17806. 184: uint8(_BT_OTHER),
  17807. 185: uint8(_BT_OTHER),
  17808. 186: uint8(_BT_NMSTRT),
  17809. 187: uint8(_BT_OTHER),
  17810. 188: uint8(_BT_OTHER),
  17811. 189: uint8(_BT_OTHER),
  17812. 190: uint8(_BT_OTHER),
  17813. 191: uint8(_BT_OTHER),
  17814. 192: uint8(_BT_NMSTRT),
  17815. 193: uint8(_BT_NMSTRT),
  17816. 194: uint8(_BT_NMSTRT),
  17817. 195: uint8(_BT_NMSTRT),
  17818. 196: uint8(_BT_NMSTRT),
  17819. 197: uint8(_BT_NMSTRT),
  17820. 198: uint8(_BT_NMSTRT),
  17821. 199: uint8(_BT_NMSTRT),
  17822. 200: uint8(_BT_NMSTRT),
  17823. 201: uint8(_BT_NMSTRT),
  17824. 202: uint8(_BT_NMSTRT),
  17825. 203: uint8(_BT_NMSTRT),
  17826. 204: uint8(_BT_NMSTRT),
  17827. 205: uint8(_BT_NMSTRT),
  17828. 206: uint8(_BT_NMSTRT),
  17829. 207: uint8(_BT_NMSTRT),
  17830. 208: uint8(_BT_NMSTRT),
  17831. 209: uint8(_BT_NMSTRT),
  17832. 210: uint8(_BT_NMSTRT),
  17833. 211: uint8(_BT_NMSTRT),
  17834. 212: uint8(_BT_NMSTRT),
  17835. 213: uint8(_BT_NMSTRT),
  17836. 214: uint8(_BT_NMSTRT),
  17837. 215: uint8(_BT_OTHER),
  17838. 216: uint8(_BT_NMSTRT),
  17839. 217: uint8(_BT_NMSTRT),
  17840. 218: uint8(_BT_NMSTRT),
  17841. 219: uint8(_BT_NMSTRT),
  17842. 220: uint8(_BT_NMSTRT),
  17843. 221: uint8(_BT_NMSTRT),
  17844. 222: uint8(_BT_NMSTRT),
  17845. 223: uint8(_BT_NMSTRT),
  17846. 224: uint8(_BT_NMSTRT),
  17847. 225: uint8(_BT_NMSTRT),
  17848. 226: uint8(_BT_NMSTRT),
  17849. 227: uint8(_BT_NMSTRT),
  17850. 228: uint8(_BT_NMSTRT),
  17851. 229: uint8(_BT_NMSTRT),
  17852. 230: uint8(_BT_NMSTRT),
  17853. 231: uint8(_BT_NMSTRT),
  17854. 232: uint8(_BT_NMSTRT),
  17855. 233: uint8(_BT_NMSTRT),
  17856. 234: uint8(_BT_NMSTRT),
  17857. 235: uint8(_BT_NMSTRT),
  17858. 236: uint8(_BT_NMSTRT),
  17859. 237: uint8(_BT_NMSTRT),
  17860. 238: uint8(_BT_NMSTRT),
  17861. 239: uint8(_BT_NMSTRT),
  17862. 240: uint8(_BT_NMSTRT),
  17863. 241: uint8(_BT_NMSTRT),
  17864. 242: uint8(_BT_NMSTRT),
  17865. 243: uint8(_BT_NMSTRT),
  17866. 244: uint8(_BT_NMSTRT),
  17867. 245: uint8(_BT_NMSTRT),
  17868. 246: uint8(_BT_NMSTRT),
  17869. 247: uint8(_BT_OTHER),
  17870. 248: uint8(_BT_NMSTRT),
  17871. 249: uint8(_BT_NMSTRT),
  17872. 250: uint8(_BT_NMSTRT),
  17873. 251: uint8(_BT_NMSTRT),
  17874. 252: uint8(_BT_NMSTRT),
  17875. 253: uint8(_BT_NMSTRT),
  17876. 254: uint8(_BT_NMSTRT),
  17877. 255: uint8(_BT_NMSTRT),
  17878. },
  17879. }
  17880. func init() {
  17881. p := unsafe.Pointer(&_latin1_encoding_ns)
  17882. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17883. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17884. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17885. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17886. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17887. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17888. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17889. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17890. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17891. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17892. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17893. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17894. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17895. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17896. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  17897. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  17898. }
  17899. var _latin1_encoding = Tnormal_encoding{
  17900. Fenc: TENCODING{
  17901. Fscanners: [4]TSCANNER{},
  17902. FliteralScanners: [2]TSCANNER{},
  17903. FminBytesPerChar: int32(1),
  17904. },
  17905. Ftype1: [256]uint8{
  17906. 9: uint8(_BT_S),
  17907. 10: uint8(_BT_LF),
  17908. 13: uint8(_BT_CR),
  17909. 32: uint8(_BT_S),
  17910. 33: uint8(_BT_EXCL),
  17911. 34: uint8(_BT_QUOT),
  17912. 35: uint8(_BT_NUM),
  17913. 36: uint8(_BT_OTHER),
  17914. 37: uint8(_BT_PERCNT),
  17915. 38: uint8(_BT_AMP),
  17916. 39: uint8(_BT_APOS),
  17917. 40: uint8(_BT_LPAR),
  17918. 41: uint8(_BT_RPAR),
  17919. 42: uint8(_BT_AST),
  17920. 43: uint8(_BT_PLUS),
  17921. 44: uint8(_BT_COMMA),
  17922. 45: uint8(_BT_MINUS),
  17923. 46: uint8(_BT_NAME),
  17924. 47: uint8(_BT_SOL),
  17925. 48: uint8(_BT_DIGIT),
  17926. 49: uint8(_BT_DIGIT),
  17927. 50: uint8(_BT_DIGIT),
  17928. 51: uint8(_BT_DIGIT),
  17929. 52: uint8(_BT_DIGIT),
  17930. 53: uint8(_BT_DIGIT),
  17931. 54: uint8(_BT_DIGIT),
  17932. 55: uint8(_BT_DIGIT),
  17933. 56: uint8(_BT_DIGIT),
  17934. 57: uint8(_BT_DIGIT),
  17935. 58: uint8(_BT_NMSTRT),
  17936. 59: uint8(_BT_SEMI),
  17937. 60: uint8(_BT_LT),
  17938. 61: uint8(_BT_EQUALS),
  17939. 62: uint8(_BT_GT),
  17940. 63: uint8(_BT_QUEST),
  17941. 64: uint8(_BT_OTHER),
  17942. 65: uint8(_BT_HEX),
  17943. 66: uint8(_BT_HEX),
  17944. 67: uint8(_BT_HEX),
  17945. 68: uint8(_BT_HEX),
  17946. 69: uint8(_BT_HEX),
  17947. 70: uint8(_BT_HEX),
  17948. 71: uint8(_BT_NMSTRT),
  17949. 72: uint8(_BT_NMSTRT),
  17950. 73: uint8(_BT_NMSTRT),
  17951. 74: uint8(_BT_NMSTRT),
  17952. 75: uint8(_BT_NMSTRT),
  17953. 76: uint8(_BT_NMSTRT),
  17954. 77: uint8(_BT_NMSTRT),
  17955. 78: uint8(_BT_NMSTRT),
  17956. 79: uint8(_BT_NMSTRT),
  17957. 80: uint8(_BT_NMSTRT),
  17958. 81: uint8(_BT_NMSTRT),
  17959. 82: uint8(_BT_NMSTRT),
  17960. 83: uint8(_BT_NMSTRT),
  17961. 84: uint8(_BT_NMSTRT),
  17962. 85: uint8(_BT_NMSTRT),
  17963. 86: uint8(_BT_NMSTRT),
  17964. 87: uint8(_BT_NMSTRT),
  17965. 88: uint8(_BT_NMSTRT),
  17966. 89: uint8(_BT_NMSTRT),
  17967. 90: uint8(_BT_NMSTRT),
  17968. 91: uint8(_BT_LSQB),
  17969. 92: uint8(_BT_OTHER),
  17970. 93: uint8(_BT_RSQB),
  17971. 94: uint8(_BT_OTHER),
  17972. 95: uint8(_BT_NMSTRT),
  17973. 96: uint8(_BT_OTHER),
  17974. 97: uint8(_BT_HEX),
  17975. 98: uint8(_BT_HEX),
  17976. 99: uint8(_BT_HEX),
  17977. 100: uint8(_BT_HEX),
  17978. 101: uint8(_BT_HEX),
  17979. 102: uint8(_BT_HEX),
  17980. 103: uint8(_BT_NMSTRT),
  17981. 104: uint8(_BT_NMSTRT),
  17982. 105: uint8(_BT_NMSTRT),
  17983. 106: uint8(_BT_NMSTRT),
  17984. 107: uint8(_BT_NMSTRT),
  17985. 108: uint8(_BT_NMSTRT),
  17986. 109: uint8(_BT_NMSTRT),
  17987. 110: uint8(_BT_NMSTRT),
  17988. 111: uint8(_BT_NMSTRT),
  17989. 112: uint8(_BT_NMSTRT),
  17990. 113: uint8(_BT_NMSTRT),
  17991. 114: uint8(_BT_NMSTRT),
  17992. 115: uint8(_BT_NMSTRT),
  17993. 116: uint8(_BT_NMSTRT),
  17994. 117: uint8(_BT_NMSTRT),
  17995. 118: uint8(_BT_NMSTRT),
  17996. 119: uint8(_BT_NMSTRT),
  17997. 120: uint8(_BT_NMSTRT),
  17998. 121: uint8(_BT_NMSTRT),
  17999. 122: uint8(_BT_NMSTRT),
  18000. 123: uint8(_BT_OTHER),
  18001. 124: uint8(_BT_VERBAR),
  18002. 125: uint8(_BT_OTHER),
  18003. 126: uint8(_BT_OTHER),
  18004. 127: uint8(_BT_OTHER),
  18005. 128: uint8(_BT_OTHER),
  18006. 129: uint8(_BT_OTHER),
  18007. 130: uint8(_BT_OTHER),
  18008. 131: uint8(_BT_OTHER),
  18009. 132: uint8(_BT_OTHER),
  18010. 133: uint8(_BT_OTHER),
  18011. 134: uint8(_BT_OTHER),
  18012. 135: uint8(_BT_OTHER),
  18013. 136: uint8(_BT_OTHER),
  18014. 137: uint8(_BT_OTHER),
  18015. 138: uint8(_BT_OTHER),
  18016. 139: uint8(_BT_OTHER),
  18017. 140: uint8(_BT_OTHER),
  18018. 141: uint8(_BT_OTHER),
  18019. 142: uint8(_BT_OTHER),
  18020. 143: uint8(_BT_OTHER),
  18021. 144: uint8(_BT_OTHER),
  18022. 145: uint8(_BT_OTHER),
  18023. 146: uint8(_BT_OTHER),
  18024. 147: uint8(_BT_OTHER),
  18025. 148: uint8(_BT_OTHER),
  18026. 149: uint8(_BT_OTHER),
  18027. 150: uint8(_BT_OTHER),
  18028. 151: uint8(_BT_OTHER),
  18029. 152: uint8(_BT_OTHER),
  18030. 153: uint8(_BT_OTHER),
  18031. 154: uint8(_BT_OTHER),
  18032. 155: uint8(_BT_OTHER),
  18033. 156: uint8(_BT_OTHER),
  18034. 157: uint8(_BT_OTHER),
  18035. 158: uint8(_BT_OTHER),
  18036. 159: uint8(_BT_OTHER),
  18037. 160: uint8(_BT_OTHER),
  18038. 161: uint8(_BT_OTHER),
  18039. 162: uint8(_BT_OTHER),
  18040. 163: uint8(_BT_OTHER),
  18041. 164: uint8(_BT_OTHER),
  18042. 165: uint8(_BT_OTHER),
  18043. 166: uint8(_BT_OTHER),
  18044. 167: uint8(_BT_OTHER),
  18045. 168: uint8(_BT_OTHER),
  18046. 169: uint8(_BT_OTHER),
  18047. 170: uint8(_BT_NMSTRT),
  18048. 171: uint8(_BT_OTHER),
  18049. 172: uint8(_BT_OTHER),
  18050. 173: uint8(_BT_OTHER),
  18051. 174: uint8(_BT_OTHER),
  18052. 175: uint8(_BT_OTHER),
  18053. 176: uint8(_BT_OTHER),
  18054. 177: uint8(_BT_OTHER),
  18055. 178: uint8(_BT_OTHER),
  18056. 179: uint8(_BT_OTHER),
  18057. 180: uint8(_BT_OTHER),
  18058. 181: uint8(_BT_NMSTRT),
  18059. 182: uint8(_BT_OTHER),
  18060. 183: uint8(_BT_NAME),
  18061. 184: uint8(_BT_OTHER),
  18062. 185: uint8(_BT_OTHER),
  18063. 186: uint8(_BT_NMSTRT),
  18064. 187: uint8(_BT_OTHER),
  18065. 188: uint8(_BT_OTHER),
  18066. 189: uint8(_BT_OTHER),
  18067. 190: uint8(_BT_OTHER),
  18068. 191: uint8(_BT_OTHER),
  18069. 192: uint8(_BT_NMSTRT),
  18070. 193: uint8(_BT_NMSTRT),
  18071. 194: uint8(_BT_NMSTRT),
  18072. 195: uint8(_BT_NMSTRT),
  18073. 196: uint8(_BT_NMSTRT),
  18074. 197: uint8(_BT_NMSTRT),
  18075. 198: uint8(_BT_NMSTRT),
  18076. 199: uint8(_BT_NMSTRT),
  18077. 200: uint8(_BT_NMSTRT),
  18078. 201: uint8(_BT_NMSTRT),
  18079. 202: uint8(_BT_NMSTRT),
  18080. 203: uint8(_BT_NMSTRT),
  18081. 204: uint8(_BT_NMSTRT),
  18082. 205: uint8(_BT_NMSTRT),
  18083. 206: uint8(_BT_NMSTRT),
  18084. 207: uint8(_BT_NMSTRT),
  18085. 208: uint8(_BT_NMSTRT),
  18086. 209: uint8(_BT_NMSTRT),
  18087. 210: uint8(_BT_NMSTRT),
  18088. 211: uint8(_BT_NMSTRT),
  18089. 212: uint8(_BT_NMSTRT),
  18090. 213: uint8(_BT_NMSTRT),
  18091. 214: uint8(_BT_NMSTRT),
  18092. 215: uint8(_BT_OTHER),
  18093. 216: uint8(_BT_NMSTRT),
  18094. 217: uint8(_BT_NMSTRT),
  18095. 218: uint8(_BT_NMSTRT),
  18096. 219: uint8(_BT_NMSTRT),
  18097. 220: uint8(_BT_NMSTRT),
  18098. 221: uint8(_BT_NMSTRT),
  18099. 222: uint8(_BT_NMSTRT),
  18100. 223: uint8(_BT_NMSTRT),
  18101. 224: uint8(_BT_NMSTRT),
  18102. 225: uint8(_BT_NMSTRT),
  18103. 226: uint8(_BT_NMSTRT),
  18104. 227: uint8(_BT_NMSTRT),
  18105. 228: uint8(_BT_NMSTRT),
  18106. 229: uint8(_BT_NMSTRT),
  18107. 230: uint8(_BT_NMSTRT),
  18108. 231: uint8(_BT_NMSTRT),
  18109. 232: uint8(_BT_NMSTRT),
  18110. 233: uint8(_BT_NMSTRT),
  18111. 234: uint8(_BT_NMSTRT),
  18112. 235: uint8(_BT_NMSTRT),
  18113. 236: uint8(_BT_NMSTRT),
  18114. 237: uint8(_BT_NMSTRT),
  18115. 238: uint8(_BT_NMSTRT),
  18116. 239: uint8(_BT_NMSTRT),
  18117. 240: uint8(_BT_NMSTRT),
  18118. 241: uint8(_BT_NMSTRT),
  18119. 242: uint8(_BT_NMSTRT),
  18120. 243: uint8(_BT_NMSTRT),
  18121. 244: uint8(_BT_NMSTRT),
  18122. 245: uint8(_BT_NMSTRT),
  18123. 246: uint8(_BT_NMSTRT),
  18124. 247: uint8(_BT_OTHER),
  18125. 248: uint8(_BT_NMSTRT),
  18126. 249: uint8(_BT_NMSTRT),
  18127. 250: uint8(_BT_NMSTRT),
  18128. 251: uint8(_BT_NMSTRT),
  18129. 252: uint8(_BT_NMSTRT),
  18130. 253: uint8(_BT_NMSTRT),
  18131. 254: uint8(_BT_NMSTRT),
  18132. 255: uint8(_BT_NMSTRT),
  18133. },
  18134. }
  18135. func init() {
  18136. p := unsafe.Pointer(&_latin1_encoding)
  18137. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18138. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18139. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18140. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18141. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18142. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18143. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18144. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18145. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18146. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18147. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18148. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18149. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18150. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18151. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  18152. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18153. }
  18154. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18155. var v1, v2, v3, v4 uintptr
  18156. _, _, _, _ = v1, v2, v3, v4
  18157. _ = enc
  18158. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18159. v2 = toP
  18160. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18161. *(*uintptr)(unsafe.Pointer(v2))++
  18162. v4 = fromP
  18163. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18164. *(*uintptr)(unsafe.Pointer(v4))++
  18165. *(*int8)(unsafe.Pointer(v1)) = *(*int8)(unsafe.Pointer(v3))
  18166. }
  18167. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18168. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18169. } else {
  18170. return int32(_XML_CONVERT_COMPLETED)
  18171. }
  18172. return r
  18173. }
  18174. var _ascii_encoding_ns = Tnormal_encoding{
  18175. Fenc: TENCODING{
  18176. Fscanners: [4]TSCANNER{},
  18177. FliteralScanners: [2]TSCANNER{},
  18178. FminBytesPerChar: int32(1),
  18179. FisUtf8: int8(1),
  18180. },
  18181. Ftype1: [256]uint8{
  18182. 9: uint8(_BT_S),
  18183. 10: uint8(_BT_LF),
  18184. 13: uint8(_BT_CR),
  18185. 32: uint8(_BT_S),
  18186. 33: uint8(_BT_EXCL),
  18187. 34: uint8(_BT_QUOT),
  18188. 35: uint8(_BT_NUM),
  18189. 36: uint8(_BT_OTHER),
  18190. 37: uint8(_BT_PERCNT),
  18191. 38: uint8(_BT_AMP),
  18192. 39: uint8(_BT_APOS),
  18193. 40: uint8(_BT_LPAR),
  18194. 41: uint8(_BT_RPAR),
  18195. 42: uint8(_BT_AST),
  18196. 43: uint8(_BT_PLUS),
  18197. 44: uint8(_BT_COMMA),
  18198. 45: uint8(_BT_MINUS),
  18199. 46: uint8(_BT_NAME),
  18200. 47: uint8(_BT_SOL),
  18201. 48: uint8(_BT_DIGIT),
  18202. 49: uint8(_BT_DIGIT),
  18203. 50: uint8(_BT_DIGIT),
  18204. 51: uint8(_BT_DIGIT),
  18205. 52: uint8(_BT_DIGIT),
  18206. 53: uint8(_BT_DIGIT),
  18207. 54: uint8(_BT_DIGIT),
  18208. 55: uint8(_BT_DIGIT),
  18209. 56: uint8(_BT_DIGIT),
  18210. 57: uint8(_BT_DIGIT),
  18211. 58: uint8(_BT_COLON),
  18212. 59: uint8(_BT_SEMI),
  18213. 60: uint8(_BT_LT),
  18214. 61: uint8(_BT_EQUALS),
  18215. 62: uint8(_BT_GT),
  18216. 63: uint8(_BT_QUEST),
  18217. 64: uint8(_BT_OTHER),
  18218. 65: uint8(_BT_HEX),
  18219. 66: uint8(_BT_HEX),
  18220. 67: uint8(_BT_HEX),
  18221. 68: uint8(_BT_HEX),
  18222. 69: uint8(_BT_HEX),
  18223. 70: uint8(_BT_HEX),
  18224. 71: uint8(_BT_NMSTRT),
  18225. 72: uint8(_BT_NMSTRT),
  18226. 73: uint8(_BT_NMSTRT),
  18227. 74: uint8(_BT_NMSTRT),
  18228. 75: uint8(_BT_NMSTRT),
  18229. 76: uint8(_BT_NMSTRT),
  18230. 77: uint8(_BT_NMSTRT),
  18231. 78: uint8(_BT_NMSTRT),
  18232. 79: uint8(_BT_NMSTRT),
  18233. 80: uint8(_BT_NMSTRT),
  18234. 81: uint8(_BT_NMSTRT),
  18235. 82: uint8(_BT_NMSTRT),
  18236. 83: uint8(_BT_NMSTRT),
  18237. 84: uint8(_BT_NMSTRT),
  18238. 85: uint8(_BT_NMSTRT),
  18239. 86: uint8(_BT_NMSTRT),
  18240. 87: uint8(_BT_NMSTRT),
  18241. 88: uint8(_BT_NMSTRT),
  18242. 89: uint8(_BT_NMSTRT),
  18243. 90: uint8(_BT_NMSTRT),
  18244. 91: uint8(_BT_LSQB),
  18245. 92: uint8(_BT_OTHER),
  18246. 93: uint8(_BT_RSQB),
  18247. 94: uint8(_BT_OTHER),
  18248. 95: uint8(_BT_NMSTRT),
  18249. 96: uint8(_BT_OTHER),
  18250. 97: uint8(_BT_HEX),
  18251. 98: uint8(_BT_HEX),
  18252. 99: uint8(_BT_HEX),
  18253. 100: uint8(_BT_HEX),
  18254. 101: uint8(_BT_HEX),
  18255. 102: uint8(_BT_HEX),
  18256. 103: uint8(_BT_NMSTRT),
  18257. 104: uint8(_BT_NMSTRT),
  18258. 105: uint8(_BT_NMSTRT),
  18259. 106: uint8(_BT_NMSTRT),
  18260. 107: uint8(_BT_NMSTRT),
  18261. 108: uint8(_BT_NMSTRT),
  18262. 109: uint8(_BT_NMSTRT),
  18263. 110: uint8(_BT_NMSTRT),
  18264. 111: uint8(_BT_NMSTRT),
  18265. 112: uint8(_BT_NMSTRT),
  18266. 113: uint8(_BT_NMSTRT),
  18267. 114: uint8(_BT_NMSTRT),
  18268. 115: uint8(_BT_NMSTRT),
  18269. 116: uint8(_BT_NMSTRT),
  18270. 117: uint8(_BT_NMSTRT),
  18271. 118: uint8(_BT_NMSTRT),
  18272. 119: uint8(_BT_NMSTRT),
  18273. 120: uint8(_BT_NMSTRT),
  18274. 121: uint8(_BT_NMSTRT),
  18275. 122: uint8(_BT_NMSTRT),
  18276. 123: uint8(_BT_OTHER),
  18277. 124: uint8(_BT_VERBAR),
  18278. 125: uint8(_BT_OTHER),
  18279. 126: uint8(_BT_OTHER),
  18280. 127: uint8(_BT_OTHER),
  18281. },
  18282. }
  18283. func init() {
  18284. p := unsafe.Pointer(&_ascii_encoding_ns)
  18285. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18286. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18287. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18288. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18289. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18290. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18291. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18292. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18293. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18294. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18295. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18296. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18297. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18298. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18299. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18300. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18301. }
  18302. var _ascii_encoding = Tnormal_encoding{
  18303. Fenc: TENCODING{
  18304. Fscanners: [4]TSCANNER{},
  18305. FliteralScanners: [2]TSCANNER{},
  18306. FminBytesPerChar: int32(1),
  18307. FisUtf8: int8(1),
  18308. },
  18309. Ftype1: [256]uint8{
  18310. 9: uint8(_BT_S),
  18311. 10: uint8(_BT_LF),
  18312. 13: uint8(_BT_CR),
  18313. 32: uint8(_BT_S),
  18314. 33: uint8(_BT_EXCL),
  18315. 34: uint8(_BT_QUOT),
  18316. 35: uint8(_BT_NUM),
  18317. 36: uint8(_BT_OTHER),
  18318. 37: uint8(_BT_PERCNT),
  18319. 38: uint8(_BT_AMP),
  18320. 39: uint8(_BT_APOS),
  18321. 40: uint8(_BT_LPAR),
  18322. 41: uint8(_BT_RPAR),
  18323. 42: uint8(_BT_AST),
  18324. 43: uint8(_BT_PLUS),
  18325. 44: uint8(_BT_COMMA),
  18326. 45: uint8(_BT_MINUS),
  18327. 46: uint8(_BT_NAME),
  18328. 47: uint8(_BT_SOL),
  18329. 48: uint8(_BT_DIGIT),
  18330. 49: uint8(_BT_DIGIT),
  18331. 50: uint8(_BT_DIGIT),
  18332. 51: uint8(_BT_DIGIT),
  18333. 52: uint8(_BT_DIGIT),
  18334. 53: uint8(_BT_DIGIT),
  18335. 54: uint8(_BT_DIGIT),
  18336. 55: uint8(_BT_DIGIT),
  18337. 56: uint8(_BT_DIGIT),
  18338. 57: uint8(_BT_DIGIT),
  18339. 58: uint8(_BT_NMSTRT),
  18340. 59: uint8(_BT_SEMI),
  18341. 60: uint8(_BT_LT),
  18342. 61: uint8(_BT_EQUALS),
  18343. 62: uint8(_BT_GT),
  18344. 63: uint8(_BT_QUEST),
  18345. 64: uint8(_BT_OTHER),
  18346. 65: uint8(_BT_HEX),
  18347. 66: uint8(_BT_HEX),
  18348. 67: uint8(_BT_HEX),
  18349. 68: uint8(_BT_HEX),
  18350. 69: uint8(_BT_HEX),
  18351. 70: uint8(_BT_HEX),
  18352. 71: uint8(_BT_NMSTRT),
  18353. 72: uint8(_BT_NMSTRT),
  18354. 73: uint8(_BT_NMSTRT),
  18355. 74: uint8(_BT_NMSTRT),
  18356. 75: uint8(_BT_NMSTRT),
  18357. 76: uint8(_BT_NMSTRT),
  18358. 77: uint8(_BT_NMSTRT),
  18359. 78: uint8(_BT_NMSTRT),
  18360. 79: uint8(_BT_NMSTRT),
  18361. 80: uint8(_BT_NMSTRT),
  18362. 81: uint8(_BT_NMSTRT),
  18363. 82: uint8(_BT_NMSTRT),
  18364. 83: uint8(_BT_NMSTRT),
  18365. 84: uint8(_BT_NMSTRT),
  18366. 85: uint8(_BT_NMSTRT),
  18367. 86: uint8(_BT_NMSTRT),
  18368. 87: uint8(_BT_NMSTRT),
  18369. 88: uint8(_BT_NMSTRT),
  18370. 89: uint8(_BT_NMSTRT),
  18371. 90: uint8(_BT_NMSTRT),
  18372. 91: uint8(_BT_LSQB),
  18373. 92: uint8(_BT_OTHER),
  18374. 93: uint8(_BT_RSQB),
  18375. 94: uint8(_BT_OTHER),
  18376. 95: uint8(_BT_NMSTRT),
  18377. 96: uint8(_BT_OTHER),
  18378. 97: uint8(_BT_HEX),
  18379. 98: uint8(_BT_HEX),
  18380. 99: uint8(_BT_HEX),
  18381. 100: uint8(_BT_HEX),
  18382. 101: uint8(_BT_HEX),
  18383. 102: uint8(_BT_HEX),
  18384. 103: uint8(_BT_NMSTRT),
  18385. 104: uint8(_BT_NMSTRT),
  18386. 105: uint8(_BT_NMSTRT),
  18387. 106: uint8(_BT_NMSTRT),
  18388. 107: uint8(_BT_NMSTRT),
  18389. 108: uint8(_BT_NMSTRT),
  18390. 109: uint8(_BT_NMSTRT),
  18391. 110: uint8(_BT_NMSTRT),
  18392. 111: uint8(_BT_NMSTRT),
  18393. 112: uint8(_BT_NMSTRT),
  18394. 113: uint8(_BT_NMSTRT),
  18395. 114: uint8(_BT_NMSTRT),
  18396. 115: uint8(_BT_NMSTRT),
  18397. 116: uint8(_BT_NMSTRT),
  18398. 117: uint8(_BT_NMSTRT),
  18399. 118: uint8(_BT_NMSTRT),
  18400. 119: uint8(_BT_NMSTRT),
  18401. 120: uint8(_BT_NMSTRT),
  18402. 121: uint8(_BT_NMSTRT),
  18403. 122: uint8(_BT_NMSTRT),
  18404. 123: uint8(_BT_OTHER),
  18405. 124: uint8(_BT_VERBAR),
  18406. 125: uint8(_BT_OTHER),
  18407. 126: uint8(_BT_OTHER),
  18408. 127: uint8(_BT_OTHER),
  18409. },
  18410. }
  18411. func init() {
  18412. p := unsafe.Pointer(&_ascii_encoding)
  18413. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18414. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18415. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18416. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18417. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18418. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18419. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18420. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18421. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18422. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18423. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18424. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18425. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18426. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18427. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18428. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18429. }
  18430. func _unicode_byte_type(tls *libc.TLS, hi int8, lo int8) (r int32) {
  18431. switch libc.Int32FromUint8(libc.Uint8FromInt8(hi)) {
  18432. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18433. case int32(0xD8):
  18434. fallthrough
  18435. case int32(0xD9):
  18436. fallthrough
  18437. case int32(0xDA):
  18438. fallthrough
  18439. case int32(0xDB):
  18440. return int32(_BT_LEAD4)
  18441. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18442. fallthrough
  18443. case int32(0xDC):
  18444. fallthrough
  18445. case int32(0xDD):
  18446. fallthrough
  18447. case int32(0xDE):
  18448. fallthrough
  18449. case int32(0xDF):
  18450. return int32(_BT_TRAIL)
  18451. case int32(0xFF):
  18452. switch libc.Int32FromUint8(libc.Uint8FromInt8(lo)) {
  18453. case int32(0xFF): /* noncharacter-FFFF */
  18454. fallthrough
  18455. case int32(0xFE): /* noncharacter-FFFE */
  18456. return int32(_BT_NONXML)
  18457. }
  18458. break
  18459. }
  18460. return int32(_BT_NONASCII)
  18461. }
  18462. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18463. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18464. var hi, lo, lo2 uint8
  18465. var plane int32
  18466. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18467. from = *(*uintptr)(unsafe.Pointer(fromP))
  18468. _ = enc
  18469. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18470. for {
  18471. if !(from < fromLim) {
  18472. break
  18473. }
  18474. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18475. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18476. switch libc.Int32FromUint8(hi) {
  18477. case 0:
  18478. if libc.Int32FromUint8(lo) < int32(0x80) {
  18479. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18480. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18481. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18482. }
  18483. v3 = toP
  18484. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18485. *(*uintptr)(unsafe.Pointer(v3))++
  18486. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18487. break
  18488. } /* fall through */
  18489. fallthrough
  18490. case int32(0x1):
  18491. fallthrough
  18492. case int32(0x2):
  18493. fallthrough
  18494. case int32(0x3):
  18495. fallthrough
  18496. case int32(0x4):
  18497. fallthrough
  18498. case int32(0x5):
  18499. fallthrough
  18500. case int32(0x6):
  18501. fallthrough
  18502. case int32(0x7):
  18503. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18504. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18505. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18506. }
  18507. v5 = toP
  18508. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18509. *(*uintptr)(unsafe.Pointer(v5))++
  18510. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18511. v7 = toP
  18512. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18513. *(*uintptr)(unsafe.Pointer(v7))++
  18514. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18515. default:
  18516. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18517. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18518. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18519. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18520. v9 = toP
  18521. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18522. *(*uintptr)(unsafe.Pointer(v9))++
  18523. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18524. v11 = toP
  18525. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18526. *(*uintptr)(unsafe.Pointer(v11))++
  18527. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18528. v13 = toP
  18529. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18530. *(*uintptr)(unsafe.Pointer(v13))++
  18531. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18532. case int32(0xD8):
  18533. fallthrough
  18534. case int32(0xD9):
  18535. fallthrough
  18536. case int32(0xDA):
  18537. fallthrough
  18538. case int32(0xDB):
  18539. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18540. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18541. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18542. }
  18543. if int64(fromLim)-int64(from) < int64(4) {
  18544. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18545. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18546. }
  18547. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18548. v15 = toP
  18549. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18550. *(*uintptr)(unsafe.Pointer(v15))++
  18551. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18552. v17 = toP
  18553. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18554. *(*uintptr)(unsafe.Pointer(v17))++
  18555. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18556. from += uintptr(2)
  18557. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18558. v19 = toP
  18559. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18560. *(*uintptr)(unsafe.Pointer(v19))++
  18561. *(*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))
  18562. v21 = toP
  18563. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18564. *(*uintptr)(unsafe.Pointer(v21))++
  18565. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18566. break
  18567. }
  18568. goto _1
  18569. _1:
  18570. ;
  18571. from += uintptr(2)
  18572. }
  18573. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18574. if from < fromLim {
  18575. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18576. } else {
  18577. return int32(_XML_CONVERT_COMPLETED)
  18578. }
  18579. return r
  18580. }
  18581. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18582. var res _XML_Convert_Result
  18583. var v2, v3 uintptr
  18584. _, _, _ = res, v2, v3
  18585. res = int32(_XML_CONVERT_COMPLETED)
  18586. _ = enc
  18587. 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 */
  18588. 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) {
  18589. fromLim -= uintptr(2)
  18590. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18591. }
  18592. for {
  18593. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18594. break
  18595. }
  18596. v3 = toP
  18597. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18598. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18599. *(*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)))))))
  18600. goto _1
  18601. _1:
  18602. ;
  18603. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18604. }
  18605. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18606. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18607. } else {
  18608. return res
  18609. }
  18610. return r
  18611. }
  18612. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18613. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18614. var hi, lo, lo2 uint8
  18615. var plane int32
  18616. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18617. from = *(*uintptr)(unsafe.Pointer(fromP))
  18618. _ = enc
  18619. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18620. for {
  18621. if !(from < fromLim) {
  18622. break
  18623. }
  18624. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18625. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18626. switch libc.Int32FromUint8(hi) {
  18627. case 0:
  18628. if libc.Int32FromUint8(lo) < int32(0x80) {
  18629. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18630. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18631. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18632. }
  18633. v3 = toP
  18634. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18635. *(*uintptr)(unsafe.Pointer(v3))++
  18636. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18637. break
  18638. } /* fall through */
  18639. fallthrough
  18640. case int32(0x1):
  18641. fallthrough
  18642. case int32(0x2):
  18643. fallthrough
  18644. case int32(0x3):
  18645. fallthrough
  18646. case int32(0x4):
  18647. fallthrough
  18648. case int32(0x5):
  18649. fallthrough
  18650. case int32(0x6):
  18651. fallthrough
  18652. case int32(0x7):
  18653. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18654. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18655. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18656. }
  18657. v5 = toP
  18658. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18659. *(*uintptr)(unsafe.Pointer(v5))++
  18660. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18661. v7 = toP
  18662. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18663. *(*uintptr)(unsafe.Pointer(v7))++
  18664. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18665. default:
  18666. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18667. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18668. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18669. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18670. v9 = toP
  18671. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18672. *(*uintptr)(unsafe.Pointer(v9))++
  18673. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18674. v11 = toP
  18675. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18676. *(*uintptr)(unsafe.Pointer(v11))++
  18677. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18678. v13 = toP
  18679. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18680. *(*uintptr)(unsafe.Pointer(v13))++
  18681. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18682. case int32(0xD8):
  18683. fallthrough
  18684. case int32(0xD9):
  18685. fallthrough
  18686. case int32(0xDA):
  18687. fallthrough
  18688. case int32(0xDB):
  18689. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18690. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18691. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18692. }
  18693. if int64(fromLim)-int64(from) < int64(4) {
  18694. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18695. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18696. }
  18697. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18698. v15 = toP
  18699. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18700. *(*uintptr)(unsafe.Pointer(v15))++
  18701. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18702. v17 = toP
  18703. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18704. *(*uintptr)(unsafe.Pointer(v17))++
  18705. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18706. from += uintptr(2)
  18707. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18708. v19 = toP
  18709. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18710. *(*uintptr)(unsafe.Pointer(v19))++
  18711. *(*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))
  18712. v21 = toP
  18713. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18714. *(*uintptr)(unsafe.Pointer(v21))++
  18715. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18716. break
  18717. }
  18718. goto _1
  18719. _1:
  18720. ;
  18721. from += uintptr(2)
  18722. }
  18723. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18724. if from < fromLim {
  18725. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18726. } else {
  18727. return int32(_XML_CONVERT_COMPLETED)
  18728. }
  18729. return r
  18730. }
  18731. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18732. var res _XML_Convert_Result
  18733. var v2, v3 uintptr
  18734. _, _, _ = res, v2, v3
  18735. res = int32(_XML_CONVERT_COMPLETED)
  18736. _ = enc
  18737. 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 */
  18738. 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) {
  18739. fromLim -= uintptr(2)
  18740. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18741. }
  18742. for {
  18743. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18744. break
  18745. }
  18746. v3 = toP
  18747. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18748. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18749. *(*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)))))
  18750. goto _1
  18751. _1:
  18752. ;
  18753. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18754. }
  18755. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18756. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18757. } else {
  18758. return res
  18759. }
  18760. return r
  18761. }
  18762. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18763. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18764. __ __ _
  18765. ___\ \/ /_ __ __ _| |_
  18766. / _ \\ /| '_ \ / _` | __|
  18767. | __// \| |_) | (_| | |_
  18768. \___/_/\_\ .__/ \__,_|\__|
  18769. |_| XML parser
  18770. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18771. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18772. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18773. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18774. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18775. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18776. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18777. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18778. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18779. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18780. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18781. Licensed under the MIT license:
  18782. Permission is hereby granted, free of charge, to any person obtaining
  18783. a copy of this software and associated documentation files (the
  18784. "Software"), to deal in the Software without restriction, including
  18785. without limitation the rights to use, copy, modify, merge, publish,
  18786. distribute, sublicense, and/or sell copies of the Software, and to permit
  18787. persons to whom the Software is furnished to do so, subject to the
  18788. following conditions:
  18789. The above copyright notice and this permission notice shall be included
  18790. in all copies or substantial portions of the Software.
  18791. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18792. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18793. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18794. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18795. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18796. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18797. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18798. */
  18799. /* ptr points to character following "<!-" */
  18800. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18801. var v1 int32
  18802. _ = v1
  18803. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18804. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18806. return m_XML_TOK_INVALID
  18807. }
  18808. ptr += uintptr(2)
  18809. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18810. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18811. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18812. } else {
  18813. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18814. }
  18815. switch v1 {
  18816. case int32(_BT_LEAD2):
  18817. if int64(end)-int64(ptr) < int64(2) {
  18818. return -int32(2)
  18819. }
  18820. if 0 != 0 {
  18821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18822. return m_XML_TOK_INVALID
  18823. }
  18824. ptr += uintptr(2)
  18825. case int32(_BT_LEAD3):
  18826. if int64(end)-int64(ptr) < int64(3) {
  18827. return -int32(2)
  18828. }
  18829. if 0 != 0 {
  18830. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18831. return m_XML_TOK_INVALID
  18832. }
  18833. ptr += uintptr(3)
  18834. case int32(_BT_LEAD4):
  18835. if int64(end)-int64(ptr) < int64(4) {
  18836. return -int32(2)
  18837. }
  18838. if 0 != 0 {
  18839. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18840. return m_XML_TOK_INVALID
  18841. }
  18842. ptr += uintptr(4)
  18843. case int32(_BT_NONXML):
  18844. fallthrough
  18845. case int32(_BT_MALFORM):
  18846. fallthrough
  18847. case int32(_BT_TRAIL):
  18848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18849. return m_XML_TOK_INVALID
  18850. case int32(_BT_MINUS):
  18851. ptr += uintptr(2)
  18852. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18853. return -int32(1)
  18854. }
  18855. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  18856. ptr += uintptr(2)
  18857. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18858. return -int32(1)
  18859. }
  18860. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  18861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18862. return m_XML_TOK_INVALID
  18863. }
  18864. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18865. return int32(m_XML_TOK_COMMENT)
  18866. }
  18867. default:
  18868. ptr += uintptr(2)
  18869. break
  18870. }
  18871. }
  18872. }
  18873. return -int32(1)
  18874. }
  18875. /* ptr points to character following "<!" */
  18876. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18877. var v1, v2, v3 int32
  18878. _, _, _ = v1, v2, v3
  18879. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18880. return -int32(1)
  18881. }
  18882. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18883. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18884. } else {
  18885. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18886. }
  18887. switch v1 {
  18888. case int32(_BT_MINUS):
  18889. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18890. case int32(_BT_LSQB):
  18891. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18892. return int32(m_XML_TOK_COND_SECT_OPEN)
  18893. case int32(_BT_NMSTRT):
  18894. fallthrough
  18895. case int32(_BT_HEX):
  18896. ptr += uintptr(2)
  18897. default:
  18898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18899. return m_XML_TOK_INVALID
  18900. }
  18901. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18902. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18903. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18904. } else {
  18905. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18906. }
  18907. switch v2 {
  18908. case int32(_BT_PERCNT):
  18909. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  18910. return -int32(1)
  18911. }
  18912. /* don't allow <!ENTITY% foo "whatever"> */
  18913. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  18914. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  18915. } else {
  18916. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  18917. }
  18918. switch v3 {
  18919. case int32(_BT_S):
  18920. fallthrough
  18921. case int32(_BT_CR):
  18922. fallthrough
  18923. case int32(_BT_LF):
  18924. fallthrough
  18925. case int32(_BT_PERCNT):
  18926. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18927. return m_XML_TOK_INVALID
  18928. }
  18929. /* fall through */
  18930. fallthrough
  18931. case int32(_BT_S):
  18932. fallthrough
  18933. case int32(_BT_CR):
  18934. fallthrough
  18935. case int32(_BT_LF):
  18936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18937. return int32(m_XML_TOK_DECL_OPEN)
  18938. case int32(_BT_NMSTRT):
  18939. fallthrough
  18940. case int32(_BT_HEX):
  18941. ptr += uintptr(2)
  18942. default:
  18943. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18944. return m_XML_TOK_INVALID
  18945. }
  18946. }
  18947. return -int32(1)
  18948. }
  18949. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  18950. var upper, v1, v2, v3 int32
  18951. _, _, _, _ = upper, v1, v2, v3
  18952. upper = 0
  18953. _ = enc
  18954. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  18955. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  18956. return int32(1)
  18957. }
  18958. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18959. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18960. } else {
  18961. v1 = -int32(1)
  18962. }
  18963. switch v1 {
  18964. case int32(m_ASCII_x2):
  18965. case int32(m_ASCII_X):
  18966. upper = int32(1)
  18967. default:
  18968. return int32(1)
  18969. }
  18970. ptr += uintptr(2)
  18971. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18972. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18973. } else {
  18974. v2 = -int32(1)
  18975. }
  18976. switch v2 {
  18977. case int32(m_ASCII_m2):
  18978. case int32(m_ASCII_M):
  18979. upper = int32(1)
  18980. default:
  18981. return int32(1)
  18982. }
  18983. ptr += uintptr(2)
  18984. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18985. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18986. } else {
  18987. v3 = -int32(1)
  18988. }
  18989. switch v3 {
  18990. case int32(m_ASCII_l2):
  18991. case int32(m_ASCII_L):
  18992. upper = int32(1)
  18993. default:
  18994. return int32(1)
  18995. }
  18996. if upper != 0 {
  18997. return 0
  18998. }
  18999. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  19000. return int32(1)
  19001. }
  19002. /* ptr points to character following "<?" */
  19003. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19004. bp := tls.Alloc(16)
  19005. defer tls.Free(16)
  19006. var target uintptr
  19007. var v1, v2, v3 int32
  19008. var _ /* tok at bp+0 */ int32
  19009. _, _, _, _ = target, v1, v2, v3
  19010. target = ptr
  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 {
  19015. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19016. } else {
  19017. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19018. }
  19019. switch v1 {
  19020. case int32(_BT_NONASCII):
  19021. 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) {
  19022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19023. return m_XML_TOK_INVALID
  19024. } /* fall through */
  19025. fallthrough
  19026. case int32(_BT_NMSTRT):
  19027. fallthrough
  19028. case int32(_BT_HEX):
  19029. ptr += uintptr(2)
  19030. case int32(_BT_LEAD2):
  19031. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19032. return -int32(2)
  19033. }
  19034. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19035. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19036. return m_XML_TOK_INVALID
  19037. }
  19038. ptr += uintptr(2)
  19039. case int32(_BT_LEAD3):
  19040. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19041. return -int32(2)
  19042. }
  19043. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19044. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19045. return m_XML_TOK_INVALID
  19046. }
  19047. ptr += uintptr(3)
  19048. case int32(_BT_LEAD4):
  19049. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19050. return -int32(2)
  19051. }
  19052. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19053. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19054. return m_XML_TOK_INVALID
  19055. }
  19056. ptr += uintptr(4)
  19057. default:
  19058. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19059. return m_XML_TOK_INVALID
  19060. }
  19061. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19062. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19063. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19064. } else {
  19065. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19066. }
  19067. switch v2 {
  19068. case int32(_BT_NONASCII):
  19069. 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) {
  19070. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19071. return m_XML_TOK_INVALID
  19072. } /* fall through */
  19073. fallthrough
  19074. case int32(_BT_NMSTRT):
  19075. fallthrough
  19076. case int32(_BT_HEX):
  19077. fallthrough
  19078. case int32(_BT_DIGIT):
  19079. fallthrough
  19080. case int32(_BT_NAME):
  19081. fallthrough
  19082. case int32(_BT_MINUS):
  19083. ptr += uintptr(2)
  19084. case int32(_BT_LEAD2):
  19085. if int64(end)-int64(ptr) < int64(2) {
  19086. return -int32(2)
  19087. }
  19088. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19089. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19090. return m_XML_TOK_INVALID
  19091. }
  19092. ptr += uintptr(2)
  19093. case int32(_BT_LEAD3):
  19094. if int64(end)-int64(ptr) < int64(3) {
  19095. return -int32(2)
  19096. }
  19097. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19098. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19099. return m_XML_TOK_INVALID
  19100. }
  19101. ptr += uintptr(3)
  19102. case int32(_BT_LEAD4):
  19103. if int64(end)-int64(ptr) < int64(4) {
  19104. return -int32(2)
  19105. }
  19106. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19108. return m_XML_TOK_INVALID
  19109. }
  19110. ptr += uintptr(4)
  19111. case int32(_BT_S):
  19112. fallthrough
  19113. case int32(_BT_CR):
  19114. fallthrough
  19115. case int32(_BT_LF):
  19116. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19118. return m_XML_TOK_INVALID
  19119. }
  19120. ptr += uintptr(2)
  19121. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19122. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19123. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19124. } else {
  19125. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19126. }
  19127. switch v3 {
  19128. case int32(_BT_LEAD2):
  19129. if int64(end)-int64(ptr) < int64(2) {
  19130. return -int32(2)
  19131. }
  19132. if 0 != 0 {
  19133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19134. return m_XML_TOK_INVALID
  19135. }
  19136. ptr += uintptr(2)
  19137. case int32(_BT_LEAD3):
  19138. if int64(end)-int64(ptr) < int64(3) {
  19139. return -int32(2)
  19140. }
  19141. if 0 != 0 {
  19142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19143. return m_XML_TOK_INVALID
  19144. }
  19145. ptr += uintptr(3)
  19146. case int32(_BT_LEAD4):
  19147. if int64(end)-int64(ptr) < int64(4) {
  19148. return -int32(2)
  19149. }
  19150. if 0 != 0 {
  19151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19152. return m_XML_TOK_INVALID
  19153. }
  19154. ptr += uintptr(4)
  19155. case int32(_BT_NONXML):
  19156. fallthrough
  19157. case int32(_BT_MALFORM):
  19158. fallthrough
  19159. case int32(_BT_TRAIL):
  19160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19161. return m_XML_TOK_INVALID
  19162. case int32(_BT_QUEST):
  19163. ptr += uintptr(2)
  19164. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19165. return -int32(1)
  19166. }
  19167. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19168. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19169. return *(*int32)(unsafe.Pointer(bp))
  19170. }
  19171. default:
  19172. ptr += uintptr(2)
  19173. break
  19174. }
  19175. }
  19176. return -int32(1)
  19177. case int32(_BT_QUEST):
  19178. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19180. return m_XML_TOK_INVALID
  19181. }
  19182. ptr += uintptr(2)
  19183. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19184. return -int32(1)
  19185. }
  19186. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19188. return *(*int32)(unsafe.Pointer(bp))
  19189. }
  19190. /* fall through */
  19191. fallthrough
  19192. default:
  19193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19194. return m_XML_TOK_INVALID
  19195. }
  19196. }
  19197. return -int32(1)
  19198. }
  19199. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19200. var i int32
  19201. _ = i
  19202. _ = enc
  19203. /* CDATA[ */
  19204. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  19205. return -int32(1)
  19206. }
  19207. i = 0
  19208. for {
  19209. if !(i < int32(6)) {
  19210. break
  19211. }
  19212. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB1[i])) {
  19213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19214. return m_XML_TOK_INVALID
  19215. }
  19216. goto _1
  19217. _1:
  19218. ;
  19219. i++
  19220. ptr += uintptr(2)
  19221. }
  19222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19223. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19224. }
  19225. var _CDATA_LSQB1 = [6]int8{
  19226. 0: int8(m_ASCII_C),
  19227. 1: int8(m_ASCII_D),
  19228. 2: int8(m_ASCII_A),
  19229. 3: int8(m_ASCII_T),
  19230. 4: int8(m_ASCII_A),
  19231. 5: int8(m_ASCII_LSQB1),
  19232. }
  19233. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19234. var n Tsize_t
  19235. var v1, v2, v3 int32
  19236. _, _, _, _ = n, v1, v2, v3
  19237. if ptr >= end {
  19238. return -int32(4)
  19239. }
  19240. if int32(2) > int32(1) {
  19241. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19242. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19243. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19244. if n == uint64(0) {
  19245. return -int32(1)
  19246. }
  19247. end = ptr + uintptr(n)
  19248. }
  19249. }
  19250. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19251. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19252. } else {
  19253. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19254. }
  19255. switch v1 {
  19256. case int32(_BT_RSQB):
  19257. ptr += uintptr(2)
  19258. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19259. return -int32(1)
  19260. }
  19261. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19262. break
  19263. }
  19264. ptr += uintptr(2)
  19265. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19266. return -int32(1)
  19267. }
  19268. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19269. ptr -= uintptr(2)
  19270. break
  19271. }
  19272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19273. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19274. case int32(_BT_CR):
  19275. ptr += uintptr(2)
  19276. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19277. return -int32(1)
  19278. }
  19279. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19280. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19281. } else {
  19282. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19283. }
  19284. if v2 == int32(_BT_LF) {
  19285. ptr += uintptr(2)
  19286. }
  19287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19288. return int32(m_XML_TOK_DATA_NEWLINE)
  19289. case int32(_BT_LF):
  19290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19291. return int32(m_XML_TOK_DATA_NEWLINE)
  19292. case int32(_BT_LEAD2):
  19293. if int64(end)-int64(ptr) < int64(2) {
  19294. return -int32(2)
  19295. }
  19296. if 0 != 0 {
  19297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19298. return m_XML_TOK_INVALID
  19299. }
  19300. ptr += uintptr(2)
  19301. case int32(_BT_LEAD3):
  19302. if int64(end)-int64(ptr) < int64(3) {
  19303. return -int32(2)
  19304. }
  19305. if 0 != 0 {
  19306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19307. return m_XML_TOK_INVALID
  19308. }
  19309. ptr += uintptr(3)
  19310. case int32(_BT_LEAD4):
  19311. if int64(end)-int64(ptr) < int64(4) {
  19312. return -int32(2)
  19313. }
  19314. if 0 != 0 {
  19315. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19316. return m_XML_TOK_INVALID
  19317. }
  19318. ptr += uintptr(4)
  19319. case int32(_BT_NONXML):
  19320. fallthrough
  19321. case int32(_BT_MALFORM):
  19322. fallthrough
  19323. case int32(_BT_TRAIL):
  19324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19325. return m_XML_TOK_INVALID
  19326. default:
  19327. ptr += uintptr(2)
  19328. break
  19329. }
  19330. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19331. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19332. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19333. } else {
  19334. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19335. }
  19336. switch v3 {
  19337. case int32(_BT_LEAD2):
  19338. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  19339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19340. return int32(m_XML_TOK_DATA_CHARS)
  19341. }
  19342. ptr += uintptr(2)
  19343. case int32(_BT_LEAD3):
  19344. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  19345. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19346. return int32(m_XML_TOK_DATA_CHARS)
  19347. }
  19348. ptr += uintptr(3)
  19349. case int32(_BT_LEAD4):
  19350. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  19351. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19352. return int32(m_XML_TOK_DATA_CHARS)
  19353. }
  19354. ptr += uintptr(4)
  19355. case int32(_BT_NONXML):
  19356. fallthrough
  19357. case int32(_BT_MALFORM):
  19358. fallthrough
  19359. case int32(_BT_TRAIL):
  19360. fallthrough
  19361. case int32(_BT_CR):
  19362. fallthrough
  19363. case int32(_BT_LF):
  19364. fallthrough
  19365. case int32(_BT_RSQB):
  19366. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19367. return int32(m_XML_TOK_DATA_CHARS)
  19368. default:
  19369. ptr += uintptr(2)
  19370. break
  19371. }
  19372. }
  19373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19374. return int32(m_XML_TOK_DATA_CHARS)
  19375. }
  19376. /* ptr points to character following "</" */
  19377. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19378. var v1, v2, v22 int32
  19379. _, _, _ = v1, v2, v22
  19380. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19381. return -int32(1)
  19382. }
  19383. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19384. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19385. } else {
  19386. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19387. }
  19388. switch v1 {
  19389. case int32(_BT_NONASCII):
  19390. 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) {
  19391. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19392. return m_XML_TOK_INVALID
  19393. } /* fall through */
  19394. fallthrough
  19395. case int32(_BT_NMSTRT):
  19396. fallthrough
  19397. case int32(_BT_HEX):
  19398. ptr += uintptr(2)
  19399. case int32(_BT_LEAD2):
  19400. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19401. return -int32(2)
  19402. }
  19403. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19405. return m_XML_TOK_INVALID
  19406. }
  19407. ptr += uintptr(2)
  19408. case int32(_BT_LEAD3):
  19409. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19410. return -int32(2)
  19411. }
  19412. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19414. return m_XML_TOK_INVALID
  19415. }
  19416. ptr += uintptr(3)
  19417. case int32(_BT_LEAD4):
  19418. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19419. return -int32(2)
  19420. }
  19421. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19422. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19423. return m_XML_TOK_INVALID
  19424. }
  19425. ptr += uintptr(4)
  19426. default:
  19427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19428. return m_XML_TOK_INVALID
  19429. }
  19430. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19431. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19432. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19433. } else {
  19434. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19435. }
  19436. switch v2 {
  19437. case int32(_BT_NONASCII):
  19438. goto _3
  19439. case int32(_BT_MINUS):
  19440. goto _4
  19441. case int32(_BT_NAME):
  19442. goto _5
  19443. case int32(_BT_DIGIT):
  19444. goto _6
  19445. case int32(_BT_HEX):
  19446. goto _7
  19447. case int32(_BT_NMSTRT):
  19448. goto _8
  19449. case int32(_BT_LEAD2):
  19450. goto _9
  19451. case int32(_BT_LEAD3):
  19452. goto _10
  19453. case int32(_BT_LEAD4):
  19454. goto _11
  19455. case int32(_BT_LF):
  19456. goto _12
  19457. case int32(_BT_CR):
  19458. goto _13
  19459. case int32(_BT_S):
  19460. goto _14
  19461. case int32(_BT_COLON):
  19462. goto _15
  19463. case int32(_BT_GT):
  19464. goto _16
  19465. default:
  19466. goto _17
  19467. }
  19468. goto _18
  19469. _3:
  19470. ;
  19471. 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) {
  19472. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19473. return m_XML_TOK_INVALID
  19474. } /* fall through */
  19475. _8:
  19476. ;
  19477. _7:
  19478. ;
  19479. _6:
  19480. ;
  19481. _5:
  19482. ;
  19483. _4:
  19484. ;
  19485. ptr += uintptr(2)
  19486. goto _18
  19487. _9:
  19488. ;
  19489. if int64(end)-int64(ptr) < int64(2) {
  19490. return -int32(2)
  19491. }
  19492. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19494. return m_XML_TOK_INVALID
  19495. }
  19496. ptr += uintptr(2)
  19497. goto _18
  19498. _10:
  19499. ;
  19500. if int64(end)-int64(ptr) < int64(3) {
  19501. return -int32(2)
  19502. }
  19503. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19504. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19505. return m_XML_TOK_INVALID
  19506. }
  19507. ptr += uintptr(3)
  19508. goto _18
  19509. _11:
  19510. ;
  19511. if int64(end)-int64(ptr) < int64(4) {
  19512. return -int32(2)
  19513. }
  19514. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19515. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19516. return m_XML_TOK_INVALID
  19517. }
  19518. ptr += uintptr(4)
  19519. goto _18
  19520. _14:
  19521. ;
  19522. _13:
  19523. ;
  19524. _12:
  19525. ;
  19526. ptr += uintptr(2)
  19527. _21:
  19528. ;
  19529. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19530. goto _19
  19531. }
  19532. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19533. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19534. } else {
  19535. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19536. }
  19537. switch v22 {
  19538. case int32(_BT_S):
  19539. fallthrough
  19540. case int32(_BT_CR):
  19541. fallthrough
  19542. case int32(_BT_LF):
  19543. case int32(_BT_GT):
  19544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19545. return int32(m_XML_TOK_END_TAG)
  19546. default:
  19547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19548. return m_XML_TOK_INVALID
  19549. }
  19550. goto _20
  19551. _20:
  19552. ;
  19553. ptr += uintptr(2)
  19554. goto _21
  19555. goto _19
  19556. _19:
  19557. ;
  19558. return -int32(1)
  19559. _15:
  19560. ;
  19561. /* no need to check qname syntax here,
  19562. since end-tag must match exactly */
  19563. ptr += uintptr(2)
  19564. goto _18
  19565. _16:
  19566. ;
  19567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19568. return int32(m_XML_TOK_END_TAG)
  19569. _17:
  19570. ;
  19571. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19572. return m_XML_TOK_INVALID
  19573. _18:
  19574. }
  19575. return -int32(1)
  19576. }
  19577. /* ptr points to character following "&#X" */
  19578. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19579. var v1, v3 int32
  19580. _, _ = v1, v3
  19581. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19582. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19583. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19584. } else {
  19585. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19586. }
  19587. switch v1 {
  19588. case int32(_BT_DIGIT):
  19589. fallthrough
  19590. case int32(_BT_HEX):
  19591. default:
  19592. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19593. return m_XML_TOK_INVALID
  19594. }
  19595. ptr += uintptr(2)
  19596. for {
  19597. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19598. break
  19599. }
  19600. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19601. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19602. } else {
  19603. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19604. }
  19605. switch v3 {
  19606. case int32(_BT_DIGIT):
  19607. fallthrough
  19608. case int32(_BT_HEX):
  19609. case int32(_BT_SEMI):
  19610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19611. return int32(m_XML_TOK_CHAR_REF)
  19612. default:
  19613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19614. return m_XML_TOK_INVALID
  19615. }
  19616. goto _2
  19617. _2:
  19618. ;
  19619. ptr += uintptr(2)
  19620. }
  19621. }
  19622. return -int32(1)
  19623. }
  19624. /* ptr points to character following "&#" */
  19625. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19626. var v1, v3 int32
  19627. _, _ = v1, v3
  19628. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19629. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19630. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19631. }
  19632. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19633. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19634. } else {
  19635. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19636. }
  19637. switch v1 {
  19638. case int32(_BT_DIGIT):
  19639. default:
  19640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19641. return m_XML_TOK_INVALID
  19642. }
  19643. ptr += uintptr(2)
  19644. for {
  19645. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19646. break
  19647. }
  19648. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19649. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19650. } else {
  19651. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19652. }
  19653. switch v3 {
  19654. case int32(_BT_DIGIT):
  19655. case int32(_BT_SEMI):
  19656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19657. return int32(m_XML_TOK_CHAR_REF)
  19658. default:
  19659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19660. return m_XML_TOK_INVALID
  19661. }
  19662. goto _2
  19663. _2:
  19664. ;
  19665. ptr += uintptr(2)
  19666. }
  19667. }
  19668. return -int32(1)
  19669. }
  19670. /* ptr points to character following "&" */
  19671. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19672. var v1, v2 int32
  19673. _, _ = v1, v2
  19674. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19675. return -int32(1)
  19676. }
  19677. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19678. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19679. } else {
  19680. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19681. }
  19682. switch v1 {
  19683. case int32(_BT_NONASCII):
  19684. 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) {
  19685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19686. return m_XML_TOK_INVALID
  19687. } /* fall through */
  19688. fallthrough
  19689. case int32(_BT_NMSTRT):
  19690. fallthrough
  19691. case int32(_BT_HEX):
  19692. ptr += uintptr(2)
  19693. case int32(_BT_LEAD2):
  19694. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19695. return -int32(2)
  19696. }
  19697. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19698. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19699. return m_XML_TOK_INVALID
  19700. }
  19701. ptr += uintptr(2)
  19702. case int32(_BT_LEAD3):
  19703. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19704. return -int32(2)
  19705. }
  19706. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19708. return m_XML_TOK_INVALID
  19709. }
  19710. ptr += uintptr(3)
  19711. case int32(_BT_LEAD4):
  19712. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19713. return -int32(2)
  19714. }
  19715. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19717. return m_XML_TOK_INVALID
  19718. }
  19719. ptr += uintptr(4)
  19720. case int32(_BT_NUM):
  19721. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19722. default:
  19723. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19724. return m_XML_TOK_INVALID
  19725. }
  19726. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19727. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19728. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19729. } else {
  19730. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19731. }
  19732. switch v2 {
  19733. case int32(_BT_NONASCII):
  19734. 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) {
  19735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19736. return m_XML_TOK_INVALID
  19737. } /* fall through */
  19738. fallthrough
  19739. case int32(_BT_NMSTRT):
  19740. fallthrough
  19741. case int32(_BT_HEX):
  19742. fallthrough
  19743. case int32(_BT_DIGIT):
  19744. fallthrough
  19745. case int32(_BT_NAME):
  19746. fallthrough
  19747. case int32(_BT_MINUS):
  19748. ptr += uintptr(2)
  19749. case int32(_BT_LEAD2):
  19750. if int64(end)-int64(ptr) < int64(2) {
  19751. return -int32(2)
  19752. }
  19753. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19755. return m_XML_TOK_INVALID
  19756. }
  19757. ptr += uintptr(2)
  19758. case int32(_BT_LEAD3):
  19759. if int64(end)-int64(ptr) < int64(3) {
  19760. return -int32(2)
  19761. }
  19762. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19764. return m_XML_TOK_INVALID
  19765. }
  19766. ptr += uintptr(3)
  19767. case int32(_BT_LEAD4):
  19768. if int64(end)-int64(ptr) < int64(4) {
  19769. return -int32(2)
  19770. }
  19771. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19772. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19773. return m_XML_TOK_INVALID
  19774. }
  19775. ptr += uintptr(4)
  19776. case int32(_BT_SEMI):
  19777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19778. return int32(m_XML_TOK_ENTITY_REF)
  19779. default:
  19780. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19781. return m_XML_TOK_INVALID
  19782. }
  19783. }
  19784. return -int32(1)
  19785. }
  19786. /* ptr points to character following first character of attribute name */
  19787. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19788. bp := tls.Alloc(16)
  19789. defer tls.Free(16)
  19790. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19791. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19792. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19793. hadColon = 0
  19794. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19795. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19796. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19797. } else {
  19798. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19799. }
  19800. switch v1 {
  19801. case int32(_BT_NONASCII):
  19802. goto _2
  19803. case int32(_BT_MINUS):
  19804. goto _3
  19805. case int32(_BT_NAME):
  19806. goto _4
  19807. case int32(_BT_DIGIT):
  19808. goto _5
  19809. case int32(_BT_HEX):
  19810. goto _6
  19811. case int32(_BT_NMSTRT):
  19812. goto _7
  19813. case int32(_BT_LEAD2):
  19814. goto _8
  19815. case int32(_BT_LEAD3):
  19816. goto _9
  19817. case int32(_BT_LEAD4):
  19818. goto _10
  19819. case int32(_BT_COLON):
  19820. goto _11
  19821. case int32(_BT_LF):
  19822. goto _12
  19823. case int32(_BT_CR):
  19824. goto _13
  19825. case int32(_BT_S):
  19826. goto _14
  19827. case int32(_BT_EQUALS):
  19828. goto _15
  19829. default:
  19830. goto _16
  19831. }
  19832. goto _17
  19833. _2:
  19834. ;
  19835. 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) {
  19836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19837. return m_XML_TOK_INVALID
  19838. } /* fall through */
  19839. _7:
  19840. ;
  19841. _6:
  19842. ;
  19843. _5:
  19844. ;
  19845. _4:
  19846. ;
  19847. _3:
  19848. ;
  19849. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19850. goto _17
  19851. _8:
  19852. ;
  19853. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19854. return -int32(2)
  19855. }
  19856. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19858. return m_XML_TOK_INVALID
  19859. }
  19860. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19861. goto _17
  19862. _9:
  19863. ;
  19864. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19865. return -int32(2)
  19866. }
  19867. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19869. return m_XML_TOK_INVALID
  19870. }
  19871. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19872. goto _17
  19873. _10:
  19874. ;
  19875. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19876. return -int32(2)
  19877. }
  19878. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19879. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19880. return m_XML_TOK_INVALID
  19881. }
  19882. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19883. goto _17
  19884. _11:
  19885. ;
  19886. if hadColon != 0 {
  19887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19888. return m_XML_TOK_INVALID
  19889. }
  19890. hadColon = int32(1)
  19891. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19892. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19893. return -int32(1)
  19894. }
  19895. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19896. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19897. } else {
  19898. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19899. }
  19900. switch v18 {
  19901. case int32(_BT_NONASCII):
  19902. 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) {
  19903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19904. return m_XML_TOK_INVALID
  19905. } /* fall through */
  19906. fallthrough
  19907. case int32(_BT_NMSTRT):
  19908. fallthrough
  19909. case int32(_BT_HEX):
  19910. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19911. case int32(_BT_LEAD2):
  19912. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  19913. return -int32(2)
  19914. }
  19915. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19917. return m_XML_TOK_INVALID
  19918. }
  19919. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19920. case int32(_BT_LEAD3):
  19921. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  19922. return -int32(2)
  19923. }
  19924. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19925. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19926. return m_XML_TOK_INVALID
  19927. }
  19928. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19929. case int32(_BT_LEAD4):
  19930. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  19931. return -int32(2)
  19932. }
  19933. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19935. return m_XML_TOK_INVALID
  19936. }
  19937. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19938. default:
  19939. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19940. return m_XML_TOK_INVALID
  19941. }
  19942. goto _17
  19943. _14:
  19944. ;
  19945. _13:
  19946. ;
  19947. _12:
  19948. ;
  19949. _21:
  19950. ;
  19951. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19952. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19953. return -int32(1)
  19954. }
  19955. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19956. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19957. } else {
  19958. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19959. }
  19960. t = v22
  19961. if t == int32(_BT_EQUALS) {
  19962. goto _19
  19963. }
  19964. switch t {
  19965. case int32(_BT_S):
  19966. fallthrough
  19967. case int32(_BT_LF):
  19968. fallthrough
  19969. case int32(_BT_CR):
  19970. default:
  19971. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19972. return m_XML_TOK_INVALID
  19973. }
  19974. goto _20
  19975. _20:
  19976. ;
  19977. goto _21
  19978. goto _19
  19979. _19:
  19980. ;
  19981. /* fall through */
  19982. _15:
  19983. ;
  19984. hadColon = 0
  19985. for {
  19986. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19987. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19988. return -int32(1)
  19989. }
  19990. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19991. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19992. } else {
  19993. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19994. }
  19995. open = v24
  19996. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  19997. break
  19998. }
  19999. switch open {
  20000. case int32(_BT_S):
  20001. fallthrough
  20002. case int32(_BT_LF):
  20003. fallthrough
  20004. case int32(_BT_CR):
  20005. default:
  20006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20007. return m_XML_TOK_INVALID
  20008. }
  20009. goto _23
  20010. _23:
  20011. }
  20012. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20013. /* in attribute value */
  20014. for {
  20015. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20016. return -int32(1)
  20017. }
  20018. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20019. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20020. } else {
  20021. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20022. }
  20023. t1 = v26
  20024. if t1 == open {
  20025. break
  20026. }
  20027. switch t1 {
  20028. case int32(_BT_LEAD2):
  20029. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  20030. return -int32(2)
  20031. }
  20032. if 0 != 0 {
  20033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20034. return m_XML_TOK_INVALID
  20035. }
  20036. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20037. case int32(_BT_LEAD3):
  20038. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  20039. return -int32(2)
  20040. }
  20041. if 0 != 0 {
  20042. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20043. return m_XML_TOK_INVALID
  20044. }
  20045. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20046. case int32(_BT_LEAD4):
  20047. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  20048. return -int32(2)
  20049. }
  20050. if 0 != 0 {
  20051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20052. return m_XML_TOK_INVALID
  20053. }
  20054. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20055. case int32(_BT_NONXML):
  20056. fallthrough
  20057. case int32(_BT_MALFORM):
  20058. fallthrough
  20059. case int32(_BT_TRAIL):
  20060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20061. return m_XML_TOK_INVALID
  20062. case int32(_BT_AMP):
  20063. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  20064. if tok <= 0 {
  20065. if tok == m_XML_TOK_INVALID {
  20066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20067. }
  20068. return tok
  20069. }
  20070. case int32(_BT_LT):
  20071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20072. return m_XML_TOK_INVALID
  20073. default:
  20074. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20075. break
  20076. }
  20077. goto _25
  20078. _25:
  20079. }
  20080. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20081. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20082. return -int32(1)
  20083. }
  20084. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20085. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20086. } else {
  20087. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20088. }
  20089. switch v27 {
  20090. case int32(_BT_S):
  20091. fallthrough
  20092. case int32(_BT_CR):
  20093. fallthrough
  20094. case int32(_BT_LF):
  20095. case int32(_BT_SOL):
  20096. goto sol
  20097. case int32(_BT_GT):
  20098. goto gt
  20099. default:
  20100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20101. return m_XML_TOK_INVALID
  20102. }
  20103. /* ptr points to closing quote */
  20104. _30:
  20105. ;
  20106. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20107. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20108. return -int32(1)
  20109. }
  20110. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20111. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20112. } else {
  20113. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20114. }
  20115. switch v31 {
  20116. case int32(_BT_NONASCII):
  20117. goto _32
  20118. case int32(_BT_HEX):
  20119. goto _33
  20120. case int32(_BT_NMSTRT):
  20121. goto _34
  20122. case int32(_BT_LEAD2):
  20123. goto _35
  20124. case int32(_BT_LEAD3):
  20125. goto _36
  20126. case int32(_BT_LEAD4):
  20127. goto _37
  20128. case int32(_BT_LF):
  20129. goto _38
  20130. case int32(_BT_CR):
  20131. goto _39
  20132. case int32(_BT_S):
  20133. goto _40
  20134. case int32(_BT_GT):
  20135. goto _41
  20136. case int32(_BT_SOL):
  20137. goto _42
  20138. default:
  20139. goto _43
  20140. }
  20141. goto _44
  20142. _32:
  20143. ;
  20144. 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) {
  20145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20146. return m_XML_TOK_INVALID
  20147. } /* fall through */
  20148. _34:
  20149. ;
  20150. _33:
  20151. ;
  20152. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20153. goto _44
  20154. _35:
  20155. ;
  20156. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  20157. return -int32(2)
  20158. }
  20159. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20161. return m_XML_TOK_INVALID
  20162. }
  20163. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20164. goto _44
  20165. _36:
  20166. ;
  20167. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  20168. return -int32(2)
  20169. }
  20170. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20171. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20172. return m_XML_TOK_INVALID
  20173. }
  20174. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20175. goto _44
  20176. _37:
  20177. ;
  20178. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  20179. return -int32(2)
  20180. }
  20181. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20182. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20183. return m_XML_TOK_INVALID
  20184. }
  20185. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20186. goto _44
  20187. _40:
  20188. ;
  20189. _39:
  20190. ;
  20191. _38:
  20192. ;
  20193. goto _29
  20194. _41:
  20195. ;
  20196. goto gt
  20197. gt:
  20198. ;
  20199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20200. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20201. _42:
  20202. ;
  20203. goto sol
  20204. sol:
  20205. ;
  20206. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20207. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20208. return -int32(1)
  20209. }
  20210. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  20211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20212. return m_XML_TOK_INVALID
  20213. }
  20214. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20215. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20216. _43:
  20217. ;
  20218. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20219. return m_XML_TOK_INVALID
  20220. _44:
  20221. ;
  20222. goto _28
  20223. goto _29
  20224. _29:
  20225. ;
  20226. goto _30
  20227. goto _28
  20228. _28:
  20229. ;
  20230. goto _17
  20231. _16:
  20232. ;
  20233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20234. return m_XML_TOK_INVALID
  20235. _17:
  20236. }
  20237. return -int32(1)
  20238. }
  20239. /* ptr points to character following "<" */
  20240. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20241. var hadColon, v1, v2, v21, v22, v3 int32
  20242. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20243. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20244. return -int32(1)
  20245. }
  20246. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20247. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20248. } else {
  20249. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20250. }
  20251. switch v1 {
  20252. case int32(_BT_NONASCII):
  20253. 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) {
  20254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20255. return m_XML_TOK_INVALID
  20256. } /* fall through */
  20257. fallthrough
  20258. case int32(_BT_NMSTRT):
  20259. fallthrough
  20260. case int32(_BT_HEX):
  20261. ptr += uintptr(2)
  20262. case int32(_BT_LEAD2):
  20263. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20264. return -int32(2)
  20265. }
  20266. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20267. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20268. return m_XML_TOK_INVALID
  20269. }
  20270. ptr += uintptr(2)
  20271. case int32(_BT_LEAD3):
  20272. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20273. return -int32(2)
  20274. }
  20275. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20277. return m_XML_TOK_INVALID
  20278. }
  20279. ptr += uintptr(3)
  20280. case int32(_BT_LEAD4):
  20281. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20282. return -int32(2)
  20283. }
  20284. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20285. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20286. return m_XML_TOK_INVALID
  20287. }
  20288. ptr += uintptr(4)
  20289. case int32(_BT_EXCL):
  20290. ptr += uintptr(2)
  20291. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20292. return -int32(1)
  20293. }
  20294. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20295. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20296. } else {
  20297. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20298. }
  20299. switch v2 {
  20300. case int32(_BT_MINUS):
  20301. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20302. case int32(_BT_LSQB):
  20303. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20304. }
  20305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20306. return m_XML_TOK_INVALID
  20307. case int32(_BT_QUEST):
  20308. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20309. case int32(_BT_SOL):
  20310. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20311. default:
  20312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20313. return m_XML_TOK_INVALID
  20314. }
  20315. hadColon = 0
  20316. /* we have a start-tag */
  20317. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20318. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20319. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20320. } else {
  20321. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20322. }
  20323. switch v3 {
  20324. case int32(_BT_NONASCII):
  20325. goto _4
  20326. case int32(_BT_MINUS):
  20327. goto _5
  20328. case int32(_BT_NAME):
  20329. goto _6
  20330. case int32(_BT_DIGIT):
  20331. goto _7
  20332. case int32(_BT_HEX):
  20333. goto _8
  20334. case int32(_BT_NMSTRT):
  20335. goto _9
  20336. case int32(_BT_LEAD2):
  20337. goto _10
  20338. case int32(_BT_LEAD3):
  20339. goto _11
  20340. case int32(_BT_LEAD4):
  20341. goto _12
  20342. case int32(_BT_COLON):
  20343. goto _13
  20344. case int32(_BT_LF):
  20345. goto _14
  20346. case int32(_BT_CR):
  20347. goto _15
  20348. case int32(_BT_S):
  20349. goto _16
  20350. case int32(_BT_GT):
  20351. goto _17
  20352. case int32(_BT_SOL):
  20353. goto _18
  20354. default:
  20355. goto _19
  20356. }
  20357. goto _20
  20358. _4:
  20359. ;
  20360. 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) {
  20361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20362. return m_XML_TOK_INVALID
  20363. } /* fall through */
  20364. _9:
  20365. ;
  20366. _8:
  20367. ;
  20368. _7:
  20369. ;
  20370. _6:
  20371. ;
  20372. _5:
  20373. ;
  20374. ptr += uintptr(2)
  20375. goto _20
  20376. _10:
  20377. ;
  20378. if int64(end)-int64(ptr) < int64(2) {
  20379. return -int32(2)
  20380. }
  20381. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20383. return m_XML_TOK_INVALID
  20384. }
  20385. ptr += uintptr(2)
  20386. goto _20
  20387. _11:
  20388. ;
  20389. if int64(end)-int64(ptr) < int64(3) {
  20390. return -int32(2)
  20391. }
  20392. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20394. return m_XML_TOK_INVALID
  20395. }
  20396. ptr += uintptr(3)
  20397. goto _20
  20398. _12:
  20399. ;
  20400. if int64(end)-int64(ptr) < int64(4) {
  20401. return -int32(2)
  20402. }
  20403. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20405. return m_XML_TOK_INVALID
  20406. }
  20407. ptr += uintptr(4)
  20408. goto _20
  20409. _13:
  20410. ;
  20411. if hadColon != 0 {
  20412. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20413. return m_XML_TOK_INVALID
  20414. }
  20415. hadColon = int32(1)
  20416. ptr += uintptr(2)
  20417. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20418. return -int32(1)
  20419. }
  20420. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20421. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20422. } else {
  20423. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20424. }
  20425. switch v21 {
  20426. case int32(_BT_NONASCII):
  20427. 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) {
  20428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20429. return m_XML_TOK_INVALID
  20430. } /* fall through */
  20431. fallthrough
  20432. case int32(_BT_NMSTRT):
  20433. fallthrough
  20434. case int32(_BT_HEX):
  20435. ptr += uintptr(2)
  20436. case int32(_BT_LEAD2):
  20437. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20438. return -int32(2)
  20439. }
  20440. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20441. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20442. return m_XML_TOK_INVALID
  20443. }
  20444. ptr += uintptr(2)
  20445. case int32(_BT_LEAD3):
  20446. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20447. return -int32(2)
  20448. }
  20449. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20450. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20451. return m_XML_TOK_INVALID
  20452. }
  20453. ptr += uintptr(3)
  20454. case int32(_BT_LEAD4):
  20455. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20456. return -int32(2)
  20457. }
  20458. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20459. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20460. return m_XML_TOK_INVALID
  20461. }
  20462. ptr += uintptr(4)
  20463. default:
  20464. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20465. return m_XML_TOK_INVALID
  20466. }
  20467. goto _20
  20468. _16:
  20469. ;
  20470. _15:
  20471. ;
  20472. _14:
  20473. ;
  20474. ptr += uintptr(2)
  20475. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20476. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20477. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20478. } else {
  20479. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20480. }
  20481. switch v22 {
  20482. case int32(_BT_NONASCII):
  20483. 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) {
  20484. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20485. return m_XML_TOK_INVALID
  20486. } /* fall through */
  20487. fallthrough
  20488. case int32(_BT_NMSTRT):
  20489. fallthrough
  20490. case int32(_BT_HEX):
  20491. ptr += uintptr(2)
  20492. case int32(_BT_LEAD2):
  20493. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20494. return -int32(2)
  20495. }
  20496. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20498. return m_XML_TOK_INVALID
  20499. }
  20500. ptr += uintptr(2)
  20501. case int32(_BT_LEAD3):
  20502. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20503. return -int32(2)
  20504. }
  20505. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20506. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20507. return m_XML_TOK_INVALID
  20508. }
  20509. ptr += uintptr(3)
  20510. case int32(_BT_LEAD4):
  20511. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20512. return -int32(2)
  20513. }
  20514. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20515. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20516. return m_XML_TOK_INVALID
  20517. }
  20518. ptr += uintptr(4)
  20519. case int32(_BT_GT):
  20520. goto gt
  20521. case int32(_BT_SOL):
  20522. goto sol
  20523. case int32(_BT_S):
  20524. fallthrough
  20525. case int32(_BT_CR):
  20526. fallthrough
  20527. case int32(_BT_LF):
  20528. ptr += uintptr(2)
  20529. continue
  20530. default:
  20531. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20532. return m_XML_TOK_INVALID
  20533. }
  20534. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20535. }
  20536. return -int32(1)
  20537. _17:
  20538. ;
  20539. goto gt
  20540. gt:
  20541. ;
  20542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20543. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20544. _18:
  20545. ;
  20546. goto sol
  20547. sol:
  20548. ;
  20549. ptr += uintptr(2)
  20550. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20551. return -int32(1)
  20552. }
  20553. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20554. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20555. return m_XML_TOK_INVALID
  20556. }
  20557. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20558. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20559. _19:
  20560. ;
  20561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20562. return m_XML_TOK_INVALID
  20563. _20:
  20564. }
  20565. return -int32(1)
  20566. }
  20567. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20568. var n Tsize_t
  20569. var v1, v2, v3 int32
  20570. _, _, _, _ = n, v1, v2, v3
  20571. if ptr >= end {
  20572. return -int32(4)
  20573. }
  20574. if int32(2) > int32(1) {
  20575. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20576. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20577. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20578. if n == uint64(0) {
  20579. return -int32(1)
  20580. }
  20581. end = ptr + uintptr(n)
  20582. }
  20583. }
  20584. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20585. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20586. } else {
  20587. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20588. }
  20589. switch v1 {
  20590. case int32(_BT_LT):
  20591. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20592. case int32(_BT_AMP):
  20593. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20594. case int32(_BT_CR):
  20595. ptr += uintptr(2)
  20596. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20597. return -int32(3)
  20598. }
  20599. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20600. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20601. } else {
  20602. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20603. }
  20604. if v2 == int32(_BT_LF) {
  20605. ptr += uintptr(2)
  20606. }
  20607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20608. return int32(m_XML_TOK_DATA_NEWLINE)
  20609. case int32(_BT_LF):
  20610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20611. return int32(m_XML_TOK_DATA_NEWLINE)
  20612. case int32(_BT_RSQB):
  20613. ptr += uintptr(2)
  20614. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20615. return -int32(5)
  20616. }
  20617. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20618. break
  20619. }
  20620. ptr += uintptr(2)
  20621. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20622. return -int32(5)
  20623. }
  20624. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20625. ptr -= uintptr(2)
  20626. break
  20627. }
  20628. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20629. return m_XML_TOK_INVALID
  20630. case int32(_BT_LEAD2):
  20631. if int64(end)-int64(ptr) < int64(2) {
  20632. return -int32(2)
  20633. }
  20634. if 0 != 0 {
  20635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20636. return m_XML_TOK_INVALID
  20637. }
  20638. ptr += uintptr(2)
  20639. case int32(_BT_LEAD3):
  20640. if int64(end)-int64(ptr) < int64(3) {
  20641. return -int32(2)
  20642. }
  20643. if 0 != 0 {
  20644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20645. return m_XML_TOK_INVALID
  20646. }
  20647. ptr += uintptr(3)
  20648. case int32(_BT_LEAD4):
  20649. if int64(end)-int64(ptr) < int64(4) {
  20650. return -int32(2)
  20651. }
  20652. if 0 != 0 {
  20653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20654. return m_XML_TOK_INVALID
  20655. }
  20656. ptr += uintptr(4)
  20657. case int32(_BT_NONXML):
  20658. fallthrough
  20659. case int32(_BT_MALFORM):
  20660. fallthrough
  20661. case int32(_BT_TRAIL):
  20662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20663. return m_XML_TOK_INVALID
  20664. default:
  20665. ptr += uintptr(2)
  20666. break
  20667. }
  20668. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20669. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20670. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20671. } else {
  20672. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20673. }
  20674. switch v3 {
  20675. case int32(_BT_LEAD2):
  20676. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  20677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20678. return int32(m_XML_TOK_DATA_CHARS)
  20679. }
  20680. ptr += uintptr(2)
  20681. case int32(_BT_LEAD3):
  20682. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  20683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20684. return int32(m_XML_TOK_DATA_CHARS)
  20685. }
  20686. ptr += uintptr(3)
  20687. case int32(_BT_LEAD4):
  20688. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  20689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20690. return int32(m_XML_TOK_DATA_CHARS)
  20691. }
  20692. ptr += uintptr(4)
  20693. case int32(_BT_RSQB):
  20694. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  20695. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  20696. ptr += uintptr(2)
  20697. break
  20698. }
  20699. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  20700. 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)) {
  20701. ptr += uintptr(2)
  20702. break
  20703. }
  20704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20705. return m_XML_TOK_INVALID
  20706. }
  20707. }
  20708. /* fall through */
  20709. fallthrough
  20710. case int32(_BT_AMP):
  20711. fallthrough
  20712. case int32(_BT_LT):
  20713. fallthrough
  20714. case int32(_BT_NONXML):
  20715. fallthrough
  20716. case int32(_BT_MALFORM):
  20717. fallthrough
  20718. case int32(_BT_TRAIL):
  20719. fallthrough
  20720. case int32(_BT_CR):
  20721. fallthrough
  20722. case int32(_BT_LF):
  20723. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20724. return int32(m_XML_TOK_DATA_CHARS)
  20725. default:
  20726. ptr += uintptr(2)
  20727. break
  20728. }
  20729. }
  20730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20731. return int32(m_XML_TOK_DATA_CHARS)
  20732. }
  20733. /* ptr points to character following "%" */
  20734. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20735. var v1, v2 int32
  20736. _, _ = v1, v2
  20737. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20738. return -int32(1)
  20739. }
  20740. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20741. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20742. } else {
  20743. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20744. }
  20745. switch v1 {
  20746. case int32(_BT_NONASCII):
  20747. 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) {
  20748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20749. return m_XML_TOK_INVALID
  20750. } /* fall through */
  20751. fallthrough
  20752. case int32(_BT_NMSTRT):
  20753. fallthrough
  20754. case int32(_BT_HEX):
  20755. ptr += uintptr(2)
  20756. case int32(_BT_LEAD2):
  20757. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20758. return -int32(2)
  20759. }
  20760. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20762. return m_XML_TOK_INVALID
  20763. }
  20764. ptr += uintptr(2)
  20765. case int32(_BT_LEAD3):
  20766. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20767. return -int32(2)
  20768. }
  20769. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20771. return m_XML_TOK_INVALID
  20772. }
  20773. ptr += uintptr(3)
  20774. case int32(_BT_LEAD4):
  20775. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20776. return -int32(2)
  20777. }
  20778. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20780. return m_XML_TOK_INVALID
  20781. }
  20782. ptr += uintptr(4)
  20783. case int32(_BT_S):
  20784. fallthrough
  20785. case int32(_BT_LF):
  20786. fallthrough
  20787. case int32(_BT_CR):
  20788. fallthrough
  20789. case int32(_BT_PERCNT):
  20790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20791. return int32(m_XML_TOK_PERCENT)
  20792. default:
  20793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20794. return m_XML_TOK_INVALID
  20795. }
  20796. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20797. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20798. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20799. } else {
  20800. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20801. }
  20802. switch v2 {
  20803. case int32(_BT_NONASCII):
  20804. 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) {
  20805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20806. return m_XML_TOK_INVALID
  20807. } /* fall through */
  20808. fallthrough
  20809. case int32(_BT_NMSTRT):
  20810. fallthrough
  20811. case int32(_BT_HEX):
  20812. fallthrough
  20813. case int32(_BT_DIGIT):
  20814. fallthrough
  20815. case int32(_BT_NAME):
  20816. fallthrough
  20817. case int32(_BT_MINUS):
  20818. ptr += uintptr(2)
  20819. case int32(_BT_LEAD2):
  20820. if int64(end)-int64(ptr) < int64(2) {
  20821. return -int32(2)
  20822. }
  20823. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20825. return m_XML_TOK_INVALID
  20826. }
  20827. ptr += uintptr(2)
  20828. case int32(_BT_LEAD3):
  20829. if int64(end)-int64(ptr) < int64(3) {
  20830. return -int32(2)
  20831. }
  20832. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20833. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20834. return m_XML_TOK_INVALID
  20835. }
  20836. ptr += uintptr(3)
  20837. case int32(_BT_LEAD4):
  20838. if int64(end)-int64(ptr) < int64(4) {
  20839. return -int32(2)
  20840. }
  20841. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20843. return m_XML_TOK_INVALID
  20844. }
  20845. ptr += uintptr(4)
  20846. case int32(_BT_SEMI):
  20847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20848. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  20849. default:
  20850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20851. return m_XML_TOK_INVALID
  20852. }
  20853. }
  20854. return -int32(1)
  20855. }
  20856. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20857. var v1, v2 int32
  20858. _, _ = v1, v2
  20859. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20860. return -int32(1)
  20861. }
  20862. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20863. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20864. } else {
  20865. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20866. }
  20867. switch v1 {
  20868. case int32(_BT_NONASCII):
  20869. 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) {
  20870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20871. return m_XML_TOK_INVALID
  20872. } /* fall through */
  20873. fallthrough
  20874. case int32(_BT_NMSTRT):
  20875. fallthrough
  20876. case int32(_BT_HEX):
  20877. ptr += uintptr(2)
  20878. case int32(_BT_LEAD2):
  20879. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20880. return -int32(2)
  20881. }
  20882. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20883. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20884. return m_XML_TOK_INVALID
  20885. }
  20886. ptr += uintptr(2)
  20887. case int32(_BT_LEAD3):
  20888. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20889. return -int32(2)
  20890. }
  20891. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20892. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20893. return m_XML_TOK_INVALID
  20894. }
  20895. ptr += uintptr(3)
  20896. case int32(_BT_LEAD4):
  20897. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20898. return -int32(2)
  20899. }
  20900. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20901. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20902. return m_XML_TOK_INVALID
  20903. }
  20904. ptr += uintptr(4)
  20905. default:
  20906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20907. return m_XML_TOK_INVALID
  20908. }
  20909. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20910. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20911. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20912. } else {
  20913. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20914. }
  20915. switch v2 {
  20916. case int32(_BT_NONASCII):
  20917. 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) {
  20918. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20919. return m_XML_TOK_INVALID
  20920. } /* fall through */
  20921. fallthrough
  20922. case int32(_BT_NMSTRT):
  20923. fallthrough
  20924. case int32(_BT_HEX):
  20925. fallthrough
  20926. case int32(_BT_DIGIT):
  20927. fallthrough
  20928. case int32(_BT_NAME):
  20929. fallthrough
  20930. case int32(_BT_MINUS):
  20931. ptr += uintptr(2)
  20932. case int32(_BT_LEAD2):
  20933. if int64(end)-int64(ptr) < int64(2) {
  20934. return -int32(2)
  20935. }
  20936. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20937. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20938. return m_XML_TOK_INVALID
  20939. }
  20940. ptr += uintptr(2)
  20941. case int32(_BT_LEAD3):
  20942. if int64(end)-int64(ptr) < int64(3) {
  20943. return -int32(2)
  20944. }
  20945. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20946. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20947. return m_XML_TOK_INVALID
  20948. }
  20949. ptr += uintptr(3)
  20950. case int32(_BT_LEAD4):
  20951. if int64(end)-int64(ptr) < int64(4) {
  20952. return -int32(2)
  20953. }
  20954. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20955. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20956. return m_XML_TOK_INVALID
  20957. }
  20958. ptr += uintptr(4)
  20959. case int32(_BT_CR):
  20960. fallthrough
  20961. case int32(_BT_LF):
  20962. fallthrough
  20963. case int32(_BT_S):
  20964. fallthrough
  20965. case int32(_BT_RPAR):
  20966. fallthrough
  20967. case int32(_BT_GT):
  20968. fallthrough
  20969. case int32(_BT_PERCNT):
  20970. fallthrough
  20971. case int32(_BT_VERBAR):
  20972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20973. return int32(m_XML_TOK_POUND_NAME)
  20974. default:
  20975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20976. return m_XML_TOK_INVALID
  20977. }
  20978. }
  20979. return -int32(m_XML_TOK_POUND_NAME)
  20980. }
  20981. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20982. var t, v1, v2 int32
  20983. _, _, _ = t, v1, v2
  20984. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20985. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20986. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20987. } else {
  20988. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20989. }
  20990. t = v1
  20991. switch t {
  20992. case int32(_BT_LEAD2):
  20993. if int64(end)-int64(ptr) < int64(2) {
  20994. return -int32(2)
  20995. }
  20996. if 0 != 0 {
  20997. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20998. return m_XML_TOK_INVALID
  20999. }
  21000. ptr += uintptr(2)
  21001. case int32(_BT_LEAD3):
  21002. if int64(end)-int64(ptr) < int64(3) {
  21003. return -int32(2)
  21004. }
  21005. if 0 != 0 {
  21006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21007. return m_XML_TOK_INVALID
  21008. }
  21009. ptr += uintptr(3)
  21010. case int32(_BT_LEAD4):
  21011. if int64(end)-int64(ptr) < int64(4) {
  21012. return -int32(2)
  21013. }
  21014. if 0 != 0 {
  21015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21016. return m_XML_TOK_INVALID
  21017. }
  21018. ptr += uintptr(4)
  21019. case int32(_BT_NONXML):
  21020. fallthrough
  21021. case int32(_BT_MALFORM):
  21022. fallthrough
  21023. case int32(_BT_TRAIL):
  21024. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21025. return m_XML_TOK_INVALID
  21026. case int32(_BT_QUOT):
  21027. fallthrough
  21028. case int32(_BT_APOS):
  21029. ptr += uintptr(2)
  21030. if t != open {
  21031. break
  21032. }
  21033. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21034. return -int32(m_XML_TOK_LITERAL)
  21035. }
  21036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21037. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21038. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21039. } else {
  21040. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21041. }
  21042. switch v2 {
  21043. case int32(_BT_S):
  21044. fallthrough
  21045. case int32(_BT_CR):
  21046. fallthrough
  21047. case int32(_BT_LF):
  21048. fallthrough
  21049. case int32(_BT_GT):
  21050. fallthrough
  21051. case int32(_BT_PERCNT):
  21052. fallthrough
  21053. case int32(_BT_LSQB):
  21054. return int32(m_XML_TOK_LITERAL)
  21055. default:
  21056. return m_XML_TOK_INVALID
  21057. }
  21058. fallthrough
  21059. default:
  21060. ptr += uintptr(2)
  21061. break
  21062. }
  21063. }
  21064. return -int32(1)
  21065. }
  21066. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21067. var n Tsize_t
  21068. var tok, v1, v29, v33, v34, v35, v36 int32
  21069. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  21070. if ptr >= end {
  21071. return -int32(4)
  21072. }
  21073. if int32(2) > int32(1) {
  21074. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21075. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21076. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21077. if n == uint64(0) {
  21078. return -int32(1)
  21079. }
  21080. end = ptr + uintptr(n)
  21081. }
  21082. }
  21083. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21084. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21085. } else {
  21086. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21087. }
  21088. switch v1 {
  21089. case int32(_BT_QUOT):
  21090. goto _2
  21091. case int32(_BT_APOS):
  21092. goto _3
  21093. case int32(_BT_LT):
  21094. goto _4
  21095. case int32(_BT_CR):
  21096. goto _5
  21097. case int32(_BT_LF):
  21098. goto _6
  21099. case int32(_BT_S):
  21100. goto _7
  21101. case int32(_BT_PERCNT):
  21102. goto _8
  21103. case int32(_BT_COMMA):
  21104. goto _9
  21105. case int32(_BT_LSQB):
  21106. goto _10
  21107. case int32(_BT_RSQB):
  21108. goto _11
  21109. case int32(_BT_LPAR):
  21110. goto _12
  21111. case int32(_BT_RPAR):
  21112. goto _13
  21113. case int32(_BT_VERBAR):
  21114. goto _14
  21115. case int32(_BT_GT):
  21116. goto _15
  21117. case int32(_BT_NUM):
  21118. goto _16
  21119. case int32(_BT_LEAD2):
  21120. goto _17
  21121. case int32(_BT_LEAD3):
  21122. goto _18
  21123. case int32(_BT_LEAD4):
  21124. goto _19
  21125. case int32(_BT_HEX):
  21126. goto _20
  21127. case int32(_BT_NMSTRT):
  21128. goto _21
  21129. case int32(_BT_COLON):
  21130. goto _22
  21131. case int32(_BT_MINUS):
  21132. goto _23
  21133. case int32(_BT_NAME):
  21134. goto _24
  21135. case int32(_BT_DIGIT):
  21136. goto _25
  21137. case int32(_BT_NONASCII):
  21138. goto _26
  21139. default:
  21140. goto _27
  21141. }
  21142. goto _28
  21143. _2:
  21144. ;
  21145. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21146. _3:
  21147. ;
  21148. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21149. _4:
  21150. ;
  21151. ptr += uintptr(2)
  21152. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21153. return -int32(1)
  21154. }
  21155. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21156. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21157. } else {
  21158. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21159. }
  21160. switch v29 {
  21161. case int32(_BT_EXCL):
  21162. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21163. case int32(_BT_QUEST):
  21164. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21165. case int32(_BT_NMSTRT):
  21166. fallthrough
  21167. case int32(_BT_HEX):
  21168. fallthrough
  21169. case int32(_BT_NONASCII):
  21170. fallthrough
  21171. case int32(_BT_LEAD2):
  21172. fallthrough
  21173. case int32(_BT_LEAD3):
  21174. fallthrough
  21175. case int32(_BT_LEAD4):
  21176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21177. return int32(m_XML_TOK_INSTANCE_START)
  21178. }
  21179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21180. return m_XML_TOK_INVALID
  21181. _5:
  21182. ;
  21183. if ptr+uintptr(2) == end {
  21184. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21185. /* indicate that this might be part of a CR/LF pair */
  21186. return -int32(m_XML_TOK_PROLOG_S)
  21187. }
  21188. /* fall through */
  21189. _7:
  21190. ;
  21191. _6:
  21192. ;
  21193. _32:
  21194. ;
  21195. ptr += uintptr(2)
  21196. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21197. goto _30
  21198. }
  21199. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21200. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21201. } else {
  21202. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21203. }
  21204. switch v33 {
  21205. case int32(_BT_S):
  21206. fallthrough
  21207. case int32(_BT_LF):
  21208. case int32(_BT_CR):
  21209. /* don't split CR/LF pair */
  21210. if ptr+uintptr(2) != end {
  21211. break
  21212. }
  21213. /* fall through */
  21214. fallthrough
  21215. default:
  21216. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21217. return int32(m_XML_TOK_PROLOG_S)
  21218. }
  21219. goto _31
  21220. _31:
  21221. ;
  21222. goto _32
  21223. goto _30
  21224. _30:
  21225. ;
  21226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21227. return int32(m_XML_TOK_PROLOG_S)
  21228. _8:
  21229. ;
  21230. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21231. _9:
  21232. ;
  21233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21234. return int32(m_XML_TOK_COMMA)
  21235. _10:
  21236. ;
  21237. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21238. return int32(m_XML_TOK_OPEN_BRACKET)
  21239. _11:
  21240. ;
  21241. ptr += uintptr(2)
  21242. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21243. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21244. }
  21245. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21246. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  21247. return -int32(1)
  21248. }
  21249. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  21250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21251. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21252. }
  21253. }
  21254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21255. return int32(m_XML_TOK_CLOSE_BRACKET)
  21256. _12:
  21257. ;
  21258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21259. return int32(m_XML_TOK_OPEN_PAREN)
  21260. _13:
  21261. ;
  21262. ptr += uintptr(2)
  21263. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21264. return -int32(m_XML_TOK_CLOSE_PAREN)
  21265. }
  21266. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21267. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21268. } else {
  21269. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21270. }
  21271. switch v34 {
  21272. case int32(_BT_AST):
  21273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21274. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21275. case int32(_BT_QUEST):
  21276. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21277. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21278. case int32(_BT_PLUS):
  21279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21280. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21281. case int32(_BT_CR):
  21282. fallthrough
  21283. case int32(_BT_LF):
  21284. fallthrough
  21285. case int32(_BT_S):
  21286. fallthrough
  21287. case int32(_BT_GT):
  21288. fallthrough
  21289. case int32(_BT_COMMA):
  21290. fallthrough
  21291. case int32(_BT_VERBAR):
  21292. fallthrough
  21293. case int32(_BT_RPAR):
  21294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21295. return int32(m_XML_TOK_CLOSE_PAREN)
  21296. }
  21297. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21298. return m_XML_TOK_INVALID
  21299. _14:
  21300. ;
  21301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21302. return int32(m_XML_TOK_OR)
  21303. _15:
  21304. ;
  21305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21306. return int32(m_XML_TOK_DECL_CLOSE)
  21307. _16:
  21308. ;
  21309. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21310. _17:
  21311. ;
  21312. if int64(end)-int64(ptr) < int64(2) {
  21313. return -int32(2)
  21314. }
  21315. if 0 != 0 {
  21316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21317. return m_XML_TOK_INVALID
  21318. }
  21319. if 0 != 0 {
  21320. ptr += uintptr(2)
  21321. tok = int32(m_XML_TOK_NAME)
  21322. goto _28
  21323. }
  21324. if 0 != 0 {
  21325. ptr += uintptr(2)
  21326. tok = int32(m_XML_TOK_NMTOKEN)
  21327. goto _28
  21328. }
  21329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21330. return m_XML_TOK_INVALID
  21331. _18:
  21332. ;
  21333. if int64(end)-int64(ptr) < int64(3) {
  21334. return -int32(2)
  21335. }
  21336. if 0 != 0 {
  21337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21338. return m_XML_TOK_INVALID
  21339. }
  21340. if 0 != 0 {
  21341. ptr += uintptr(3)
  21342. tok = int32(m_XML_TOK_NAME)
  21343. goto _28
  21344. }
  21345. if 0 != 0 {
  21346. ptr += uintptr(3)
  21347. tok = int32(m_XML_TOK_NMTOKEN)
  21348. goto _28
  21349. }
  21350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21351. return m_XML_TOK_INVALID
  21352. _19:
  21353. ;
  21354. if int64(end)-int64(ptr) < int64(4) {
  21355. return -int32(2)
  21356. }
  21357. if 0 != 0 {
  21358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21359. return m_XML_TOK_INVALID
  21360. }
  21361. if 0 != 0 {
  21362. ptr += uintptr(4)
  21363. tok = int32(m_XML_TOK_NAME)
  21364. goto _28
  21365. }
  21366. if 0 != 0 {
  21367. ptr += uintptr(4)
  21368. tok = int32(m_XML_TOK_NMTOKEN)
  21369. goto _28
  21370. }
  21371. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21372. return m_XML_TOK_INVALID
  21373. _21:
  21374. ;
  21375. _20:
  21376. ;
  21377. tok = int32(m_XML_TOK_NAME)
  21378. ptr += uintptr(2)
  21379. goto _28
  21380. _25:
  21381. ;
  21382. _24:
  21383. ;
  21384. _23:
  21385. ;
  21386. _22:
  21387. ;
  21388. tok = int32(m_XML_TOK_NMTOKEN)
  21389. ptr += uintptr(2)
  21390. goto _28
  21391. _26:
  21392. ;
  21393. 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 {
  21394. ptr += uintptr(2)
  21395. tok = int32(m_XML_TOK_NAME)
  21396. goto _28
  21397. }
  21398. 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 {
  21399. ptr += uintptr(2)
  21400. tok = int32(m_XML_TOK_NMTOKEN)
  21401. goto _28
  21402. }
  21403. /* fall through */
  21404. _27:
  21405. ;
  21406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21407. return m_XML_TOK_INVALID
  21408. _28:
  21409. ;
  21410. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21411. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21412. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21413. } else {
  21414. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21415. }
  21416. switch v35 {
  21417. case int32(_BT_NONASCII):
  21418. 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) {
  21419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21420. return m_XML_TOK_INVALID
  21421. } /* fall through */
  21422. fallthrough
  21423. case int32(_BT_NMSTRT):
  21424. fallthrough
  21425. case int32(_BT_HEX):
  21426. fallthrough
  21427. case int32(_BT_DIGIT):
  21428. fallthrough
  21429. case int32(_BT_NAME):
  21430. fallthrough
  21431. case int32(_BT_MINUS):
  21432. ptr += uintptr(2)
  21433. case int32(_BT_LEAD2):
  21434. if int64(end)-int64(ptr) < int64(2) {
  21435. return -int32(2)
  21436. }
  21437. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21439. return m_XML_TOK_INVALID
  21440. }
  21441. ptr += uintptr(2)
  21442. case int32(_BT_LEAD3):
  21443. if int64(end)-int64(ptr) < int64(3) {
  21444. return -int32(2)
  21445. }
  21446. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21447. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21448. return m_XML_TOK_INVALID
  21449. }
  21450. ptr += uintptr(3)
  21451. case int32(_BT_LEAD4):
  21452. if int64(end)-int64(ptr) < int64(4) {
  21453. return -int32(2)
  21454. }
  21455. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21456. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21457. return m_XML_TOK_INVALID
  21458. }
  21459. ptr += uintptr(4)
  21460. case int32(_BT_GT):
  21461. fallthrough
  21462. case int32(_BT_RPAR):
  21463. fallthrough
  21464. case int32(_BT_COMMA):
  21465. fallthrough
  21466. case int32(_BT_VERBAR):
  21467. fallthrough
  21468. case int32(_BT_LSQB):
  21469. fallthrough
  21470. case int32(_BT_PERCNT):
  21471. fallthrough
  21472. case int32(_BT_S):
  21473. fallthrough
  21474. case int32(_BT_CR):
  21475. fallthrough
  21476. case int32(_BT_LF):
  21477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21478. return tok
  21479. case int32(_BT_COLON):
  21480. ptr += uintptr(2)
  21481. switch tok {
  21482. case int32(m_XML_TOK_NAME):
  21483. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21484. return -int32(1)
  21485. }
  21486. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21487. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21488. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21489. } else {
  21490. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21491. }
  21492. switch v36 {
  21493. case int32(_BT_NONASCII):
  21494. 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) {
  21495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21496. return m_XML_TOK_INVALID
  21497. } /* fall through */
  21498. fallthrough
  21499. case int32(_BT_NMSTRT):
  21500. fallthrough
  21501. case int32(_BT_HEX):
  21502. fallthrough
  21503. case int32(_BT_DIGIT):
  21504. fallthrough
  21505. case int32(_BT_NAME):
  21506. fallthrough
  21507. case int32(_BT_MINUS):
  21508. ptr += uintptr(2)
  21509. case int32(_BT_LEAD2):
  21510. if int64(end)-int64(ptr) < int64(2) {
  21511. return -int32(2)
  21512. }
  21513. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21515. return m_XML_TOK_INVALID
  21516. }
  21517. ptr += uintptr(2)
  21518. case int32(_BT_LEAD3):
  21519. if int64(end)-int64(ptr) < int64(3) {
  21520. return -int32(2)
  21521. }
  21522. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21523. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21524. return m_XML_TOK_INVALID
  21525. }
  21526. ptr += uintptr(3)
  21527. case int32(_BT_LEAD4):
  21528. if int64(end)-int64(ptr) < int64(4) {
  21529. return -int32(2)
  21530. }
  21531. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21532. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21533. return m_XML_TOK_INVALID
  21534. }
  21535. ptr += uintptr(4)
  21536. default:
  21537. tok = int32(m_XML_TOK_NMTOKEN)
  21538. break
  21539. }
  21540. case int32(m_XML_TOK_PREFIXED_NAME):
  21541. tok = int32(m_XML_TOK_NMTOKEN)
  21542. break
  21543. }
  21544. case int32(_BT_PLUS):
  21545. if tok == int32(m_XML_TOK_NMTOKEN) {
  21546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21547. return m_XML_TOK_INVALID
  21548. }
  21549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21550. return int32(m_XML_TOK_NAME_PLUS)
  21551. case int32(_BT_AST):
  21552. if tok == int32(m_XML_TOK_NMTOKEN) {
  21553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21554. return m_XML_TOK_INVALID
  21555. }
  21556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21557. return int32(m_XML_TOK_NAME_ASTERISK)
  21558. case int32(_BT_QUEST):
  21559. if tok == int32(m_XML_TOK_NMTOKEN) {
  21560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21561. return m_XML_TOK_INVALID
  21562. }
  21563. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21564. return int32(m_XML_TOK_NAME_QUESTION)
  21565. default:
  21566. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21567. return m_XML_TOK_INVALID
  21568. }
  21569. }
  21570. return -tok
  21571. }
  21572. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21573. var start uintptr
  21574. var v1, v2 int32
  21575. _, _, _ = start, v1, v2
  21576. if ptr >= end {
  21577. return -int32(4)
  21578. } else {
  21579. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21580. /* This line cannot be executed. The incoming data has already
  21581. * been tokenized once, so incomplete characters like this have
  21582. * already been eliminated from the input. Retaining the paranoia
  21583. * check is still valuable, however.
  21584. */
  21585. return -int32(1) /* LCOV_EXCL_LINE */
  21586. }
  21587. }
  21588. start = ptr
  21589. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21590. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21591. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21592. } else {
  21593. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21594. }
  21595. switch v1 {
  21596. case int32(_BT_LEAD2):
  21597. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21598. case int32(_BT_LEAD3):
  21599. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21600. case int32(_BT_LEAD4):
  21601. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21602. case int32(_BT_AMP):
  21603. if ptr == start {
  21604. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21605. }
  21606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21607. return int32(m_XML_TOK_DATA_CHARS)
  21608. case int32(_BT_LT):
  21609. /* this is for inside entity references */
  21610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21611. return m_XML_TOK_INVALID
  21612. case int32(_BT_LF):
  21613. if ptr == start {
  21614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21615. return int32(m_XML_TOK_DATA_NEWLINE)
  21616. }
  21617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21618. return int32(m_XML_TOK_DATA_CHARS)
  21619. case int32(_BT_CR):
  21620. if ptr == start {
  21621. ptr += uintptr(2)
  21622. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21623. return -int32(3)
  21624. }
  21625. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21626. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21627. } else {
  21628. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21629. }
  21630. if v2 == int32(_BT_LF) {
  21631. ptr += uintptr(2)
  21632. }
  21633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21634. return int32(m_XML_TOK_DATA_NEWLINE)
  21635. }
  21636. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21637. return int32(m_XML_TOK_DATA_CHARS)
  21638. case int32(_BT_S):
  21639. if ptr == start {
  21640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21641. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21642. }
  21643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21644. return int32(m_XML_TOK_DATA_CHARS)
  21645. default:
  21646. ptr += uintptr(2)
  21647. break
  21648. }
  21649. }
  21650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21651. return int32(m_XML_TOK_DATA_CHARS)
  21652. }
  21653. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21654. var start uintptr
  21655. var tok, v1, v2, v3 int32
  21656. _, _, _, _, _ = start, tok, v1, v2, v3
  21657. if ptr >= end {
  21658. return -int32(4)
  21659. } else {
  21660. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21661. /* This line cannot be executed. The incoming data has already
  21662. * been tokenized once, so incomplete characters like this have
  21663. * already been eliminated from the input. Retaining the paranoia
  21664. * check is still valuable, however.
  21665. */
  21666. return -int32(1) /* LCOV_EXCL_LINE */
  21667. }
  21668. }
  21669. start = ptr
  21670. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21671. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21672. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21673. } else {
  21674. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21675. }
  21676. switch v1 {
  21677. case int32(_BT_LEAD2):
  21678. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21679. case int32(_BT_LEAD3):
  21680. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21681. case int32(_BT_LEAD4):
  21682. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21683. case int32(_BT_AMP):
  21684. if ptr == start {
  21685. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21686. }
  21687. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21688. return int32(m_XML_TOK_DATA_CHARS)
  21689. case int32(_BT_PERCNT):
  21690. if ptr == start {
  21691. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21692. if tok == int32(m_XML_TOK_PERCENT) {
  21693. v2 = m_XML_TOK_INVALID
  21694. } else {
  21695. v2 = tok
  21696. }
  21697. return v2
  21698. }
  21699. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21700. return int32(m_XML_TOK_DATA_CHARS)
  21701. case int32(_BT_LF):
  21702. if ptr == start {
  21703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21704. return int32(m_XML_TOK_DATA_NEWLINE)
  21705. }
  21706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21707. return int32(m_XML_TOK_DATA_CHARS)
  21708. case int32(_BT_CR):
  21709. if ptr == start {
  21710. ptr += uintptr(2)
  21711. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21712. return -int32(3)
  21713. }
  21714. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21715. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21716. } else {
  21717. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21718. }
  21719. if v3 == int32(_BT_LF) {
  21720. ptr += uintptr(2)
  21721. }
  21722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21723. return int32(m_XML_TOK_DATA_NEWLINE)
  21724. }
  21725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21726. return int32(m_XML_TOK_DATA_CHARS)
  21727. default:
  21728. ptr += uintptr(2)
  21729. break
  21730. }
  21731. }
  21732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21733. return int32(m_XML_TOK_DATA_CHARS)
  21734. }
  21735. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21736. var level, v1 int32
  21737. var n Tsize_t
  21738. _, _, _ = level, n, v1
  21739. level = 0
  21740. if int32(2) > int32(1) {
  21741. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21742. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21743. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21744. end = ptr + uintptr(n)
  21745. }
  21746. }
  21747. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21748. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21749. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21750. } else {
  21751. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21752. }
  21753. switch v1 {
  21754. case int32(_BT_LEAD2):
  21755. if int64(end)-int64(ptr) < int64(2) {
  21756. return -int32(2)
  21757. }
  21758. if 0 != 0 {
  21759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21760. return m_XML_TOK_INVALID
  21761. }
  21762. ptr += uintptr(2)
  21763. case int32(_BT_LEAD3):
  21764. if int64(end)-int64(ptr) < int64(3) {
  21765. return -int32(2)
  21766. }
  21767. if 0 != 0 {
  21768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21769. return m_XML_TOK_INVALID
  21770. }
  21771. ptr += uintptr(3)
  21772. case int32(_BT_LEAD4):
  21773. if int64(end)-int64(ptr) < int64(4) {
  21774. return -int32(2)
  21775. }
  21776. if 0 != 0 {
  21777. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21778. return m_XML_TOK_INVALID
  21779. }
  21780. ptr += uintptr(4)
  21781. case int32(_BT_NONXML):
  21782. fallthrough
  21783. case int32(_BT_MALFORM):
  21784. fallthrough
  21785. case int32(_BT_TRAIL):
  21786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21787. return m_XML_TOK_INVALID
  21788. case int32(_BT_LT):
  21789. ptr += uintptr(2)
  21790. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21791. return -int32(1)
  21792. }
  21793. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21794. ptr += uintptr(2)
  21795. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21796. return -int32(1)
  21797. }
  21798. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21799. level++
  21800. ptr += uintptr(2)
  21801. }
  21802. }
  21803. case int32(_BT_RSQB):
  21804. ptr += uintptr(2)
  21805. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21806. return -int32(1)
  21807. }
  21808. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21809. ptr += uintptr(2)
  21810. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21811. return -int32(1)
  21812. }
  21813. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21814. ptr += uintptr(2)
  21815. if level == 0 {
  21816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21817. return int32(m_XML_TOK_IGNORE_SECT)
  21818. }
  21819. level--
  21820. }
  21821. }
  21822. default:
  21823. ptr += uintptr(2)
  21824. break
  21825. }
  21826. }
  21827. return -int32(1)
  21828. }
  21829. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21830. var v2, v3, v4 int32
  21831. _, _, _ = v2, v3, v4
  21832. ptr += uintptr(2)
  21833. end -= uintptr(2)
  21834. for {
  21835. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21836. break
  21837. }
  21838. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21839. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21840. } else {
  21841. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21842. }
  21843. switch v2 {
  21844. case int32(_BT_DIGIT):
  21845. fallthrough
  21846. case int32(_BT_HEX):
  21847. fallthrough
  21848. case int32(_BT_MINUS):
  21849. fallthrough
  21850. case int32(_BT_APOS):
  21851. fallthrough
  21852. case int32(_BT_LPAR):
  21853. fallthrough
  21854. case int32(_BT_RPAR):
  21855. fallthrough
  21856. case int32(_BT_PLUS):
  21857. fallthrough
  21858. case int32(_BT_COMMA):
  21859. fallthrough
  21860. case int32(_BT_SOL):
  21861. fallthrough
  21862. case int32(_BT_EQUALS):
  21863. fallthrough
  21864. case int32(_BT_QUEST):
  21865. fallthrough
  21866. case int32(_BT_CR):
  21867. fallthrough
  21868. case int32(_BT_LF):
  21869. fallthrough
  21870. case int32(_BT_SEMI):
  21871. fallthrough
  21872. case int32(_BT_EXCL):
  21873. fallthrough
  21874. case int32(_BT_AST):
  21875. fallthrough
  21876. case int32(_BT_PERCNT):
  21877. fallthrough
  21878. case int32(_BT_NUM):
  21879. fallthrough
  21880. case int32(_BT_COLON):
  21881. case int32(_BT_S):
  21882. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  21883. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21884. return 0
  21885. }
  21886. case int32(_BT_NAME):
  21887. fallthrough
  21888. case int32(_BT_NMSTRT):
  21889. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21890. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21891. } else {
  21892. v3 = -int32(1)
  21893. }
  21894. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  21895. break
  21896. }
  21897. /* fall through */
  21898. fallthrough
  21899. default:
  21900. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21901. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21902. } else {
  21903. v4 = -int32(1)
  21904. }
  21905. switch v4 {
  21906. case int32(0x24): /* $ */
  21907. fallthrough
  21908. case int32(0x40): /* @ */
  21909. default:
  21910. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21911. return 0
  21912. }
  21913. break
  21914. }
  21915. goto _1
  21916. _1:
  21917. ;
  21918. ptr += uintptr(2)
  21919. }
  21920. return int32(1)
  21921. }
  21922. /* This must only be called for a well-formed start-tag or empty
  21923. element tag. Returns the number of attributes. Pointers to the
  21924. first attsMax attributes are stored in atts.
  21925. */
  21926. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  21927. var nAtts, open, state, v2, v3, v5, v7 int32
  21928. var v4, v6, v8, v9 bool
  21929. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  21930. state = 1
  21931. nAtts = 0
  21932. open = 0 /* defined when state == inValue;
  21933. initialization just to shut up compilers */
  21934. ptr += uintptr(2)
  21935. for {
  21936. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21937. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21938. } else {
  21939. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21940. }
  21941. switch v2 {
  21942. case int32(_BT_LEAD2):
  21943. if state == 0 {
  21944. if nAtts < attsMax {
  21945. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21946. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21947. }
  21948. state = 1
  21949. }
  21950. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  21951. case int32(_BT_LEAD3):
  21952. if state == 0 {
  21953. if nAtts < attsMax {
  21954. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21955. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21956. }
  21957. state = 1
  21958. }
  21959. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  21960. case int32(_BT_LEAD4):
  21961. if state == 0 {
  21962. if nAtts < attsMax {
  21963. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21964. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21965. }
  21966. state = 1
  21967. }
  21968. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  21969. case int32(_BT_NONASCII):
  21970. fallthrough
  21971. case int32(_BT_NMSTRT):
  21972. fallthrough
  21973. case int32(_BT_HEX):
  21974. if state == 0 {
  21975. if nAtts < attsMax {
  21976. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21977. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  21978. }
  21979. state = 1
  21980. }
  21981. case int32(_BT_QUOT):
  21982. if state != 2 {
  21983. if nAtts < attsMax {
  21984. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21985. }
  21986. state = 2
  21987. open = int32(_BT_QUOT)
  21988. } else {
  21989. if open == int32(_BT_QUOT) {
  21990. state = 0
  21991. if nAtts < attsMax {
  21992. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21993. }
  21994. nAtts++
  21995. }
  21996. }
  21997. case int32(_BT_APOS):
  21998. if state != 2 {
  21999. if nAtts < attsMax {
  22000. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  22001. }
  22002. state = 2
  22003. open = int32(_BT_APOS)
  22004. } else {
  22005. if open == int32(_BT_APOS) {
  22006. state = 0
  22007. if nAtts < attsMax {
  22008. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  22009. }
  22010. nAtts++
  22011. }
  22012. }
  22013. case int32(_BT_AMP):
  22014. if nAtts < attsMax {
  22015. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  22016. }
  22017. case int32(_BT_S):
  22018. if state == 1 {
  22019. state = 0
  22020. } else {
  22021. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  22022. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  22023. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22024. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22025. } else {
  22026. v3 = -int32(1)
  22027. }
  22028. }
  22029. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  22030. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  22031. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  22032. } else {
  22033. v5 = -int32(1)
  22034. }
  22035. }
  22036. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  22037. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  22038. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  22039. } else {
  22040. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  22041. }
  22042. }
  22043. }
  22044. if v9 && (v8 || v7 == open) {
  22045. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  22046. }
  22047. }
  22048. case int32(_BT_CR):
  22049. fallthrough
  22050. case int32(_BT_LF):
  22051. /* This case ensures that the first attribute name is counted
  22052. Apart from that we could just change state on the quote. */
  22053. if state == 1 {
  22054. state = 0
  22055. } else {
  22056. if state == 2 && nAtts < attsMax {
  22057. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  22058. }
  22059. }
  22060. case int32(_BT_GT):
  22061. fallthrough
  22062. case int32(_BT_SOL):
  22063. if state != 2 {
  22064. return nAtts
  22065. }
  22066. default:
  22067. break
  22068. }
  22069. goto _1
  22070. _1:
  22071. ;
  22072. ptr += uintptr(2)
  22073. }
  22074. /* not reached */
  22075. return r
  22076. }
  22077. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22078. var c, c1, result, v2, v4 int32
  22079. _, _, _, _, _ = c, c1, result, v2, v4
  22080. result = 0
  22081. /* skip &# */
  22082. _ = enc
  22083. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  22084. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  22085. ptr += uintptr(2)
  22086. for {
  22087. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22088. break
  22089. }
  22090. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22091. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22092. } else {
  22093. v2 = -int32(1)
  22094. }
  22095. c = v2
  22096. switch c {
  22097. case int32(m_ASCII_02):
  22098. fallthrough
  22099. case int32(m_ASCII_12):
  22100. fallthrough
  22101. case int32(m_ASCII_22):
  22102. fallthrough
  22103. case int32(m_ASCII_32):
  22104. fallthrough
  22105. case int32(m_ASCII_41):
  22106. fallthrough
  22107. case int32(m_ASCII_51):
  22108. fallthrough
  22109. case int32(m_ASCII_61):
  22110. fallthrough
  22111. case int32(m_ASCII_71):
  22112. fallthrough
  22113. case int32(m_ASCII_82):
  22114. fallthrough
  22115. case int32(m_ASCII_92):
  22116. result <<= int32(4)
  22117. result |= c - int32(m_ASCII_02)
  22118. case int32(m_ASCII_A):
  22119. fallthrough
  22120. case int32(m_ASCII_B1):
  22121. fallthrough
  22122. case int32(m_ASCII_C):
  22123. fallthrough
  22124. case int32(m_ASCII_D):
  22125. fallthrough
  22126. case int32(m_ASCII_E):
  22127. fallthrough
  22128. case int32(m_ASCII_F):
  22129. result <<= int32(4)
  22130. result += int32(10) + (c - int32(m_ASCII_A))
  22131. case int32(m_ASCII_a2):
  22132. fallthrough
  22133. case int32(m_ASCII_b1):
  22134. fallthrough
  22135. case int32(m_ASCII_c2):
  22136. fallthrough
  22137. case int32(m_ASCII_d1):
  22138. fallthrough
  22139. case int32(m_ASCII_e2):
  22140. fallthrough
  22141. case int32(m_ASCII_f1):
  22142. result <<= int32(4)
  22143. result += int32(10) + (c - int32(m_ASCII_a2))
  22144. break
  22145. }
  22146. if result >= int32(0x110000) {
  22147. return -int32(1)
  22148. }
  22149. goto _1
  22150. _1:
  22151. ;
  22152. ptr += uintptr(2)
  22153. }
  22154. } else {
  22155. for {
  22156. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22157. break
  22158. }
  22159. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22160. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22161. } else {
  22162. v4 = -int32(1)
  22163. }
  22164. c1 = v4
  22165. result *= int32(10)
  22166. result += c1 - int32(m_ASCII_02)
  22167. if result >= int32(0x110000) {
  22168. return -int32(1)
  22169. }
  22170. goto _3
  22171. _3:
  22172. ;
  22173. ptr += uintptr(2)
  22174. }
  22175. }
  22176. return _checkCharRefNumber(tls, result)
  22177. }
  22178. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22179. var v1, v2 int32
  22180. _, _ = v1, v2
  22181. _ = enc
  22182. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  22183. case int64(2):
  22184. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22185. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22186. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22187. } else {
  22188. v1 = -int32(1)
  22189. }
  22190. switch v1 {
  22191. case int32(m_ASCII_l2):
  22192. return int32(m_ASCII_LT1)
  22193. case int32(m_ASCII_g2):
  22194. return int32(m_ASCII_GT1)
  22195. }
  22196. }
  22197. case int64(3):
  22198. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22199. ptr += uintptr(2)
  22200. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22201. ptr += uintptr(2)
  22202. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22203. return int32(m_ASCII_AMP1)
  22204. }
  22205. }
  22206. }
  22207. case int64(4):
  22208. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22209. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22210. } else {
  22211. v2 = -int32(1)
  22212. }
  22213. switch v2 {
  22214. case int32(m_ASCII_q1):
  22215. ptr += uintptr(2)
  22216. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22217. ptr += uintptr(2)
  22218. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22219. ptr += uintptr(2)
  22220. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22221. return int32(m_ASCII_QUOT1)
  22222. }
  22223. }
  22224. }
  22225. case int32(m_ASCII_a2):
  22226. ptr += uintptr(2)
  22227. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22228. ptr += uintptr(2)
  22229. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22230. ptr += uintptr(2)
  22231. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22232. return int32(m_ASCII_APOS1)
  22233. }
  22234. }
  22235. }
  22236. break
  22237. }
  22238. }
  22239. return 0
  22240. }
  22241. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22242. _ = enc
  22243. for {
  22244. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  22245. break
  22246. }
  22247. if int64(end1)-int64(ptr1) < int64(2) {
  22248. /* This line cannot be executed. The incoming data has already
  22249. * been tokenized once, so incomplete characters like this have
  22250. * already been eliminated from the input. Retaining the
  22251. * paranoia check is still valuable, however.
  22252. */
  22253. return 0 /* LCOV_EXCL_LINE */
  22254. }
  22255. if !(int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  22256. return 0
  22257. }
  22258. goto _1
  22259. _1:
  22260. ;
  22261. ptr1 += uintptr(2)
  22262. ptr2++
  22263. }
  22264. return libc.BoolInt32(ptr1 == end1)
  22265. }
  22266. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22267. var start uintptr
  22268. var v2 int32
  22269. _, _ = start, v2
  22270. start = ptr
  22271. for {
  22272. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22273. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22274. } else {
  22275. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22276. }
  22277. switch v2 {
  22278. case int32(_BT_LEAD2):
  22279. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22280. case int32(_BT_LEAD3):
  22281. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22282. case int32(_BT_LEAD4):
  22283. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22284. case int32(_BT_NONASCII):
  22285. fallthrough
  22286. case int32(_BT_NMSTRT):
  22287. fallthrough
  22288. case int32(_BT_COLON):
  22289. fallthrough
  22290. case int32(_BT_HEX):
  22291. fallthrough
  22292. case int32(_BT_DIGIT):
  22293. fallthrough
  22294. case int32(_BT_NAME):
  22295. fallthrough
  22296. case int32(_BT_MINUS):
  22297. ptr += uintptr(2)
  22298. default:
  22299. return int32(int64(ptr) - int64(start))
  22300. }
  22301. goto _1
  22302. _1:
  22303. }
  22304. return r
  22305. }
  22306. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22307. var v2 int32
  22308. _ = v2
  22309. for {
  22310. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22311. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22312. } else {
  22313. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22314. }
  22315. switch v2 {
  22316. case int32(_BT_LF):
  22317. fallthrough
  22318. case int32(_BT_CR):
  22319. fallthrough
  22320. case int32(_BT_S):
  22321. ptr += uintptr(2)
  22322. default:
  22323. return ptr
  22324. }
  22325. goto _1
  22326. _1:
  22327. }
  22328. return r
  22329. }
  22330. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22331. var v1, v2 int32
  22332. var v3 bool
  22333. _, _, _ = v1, v2, v3
  22334. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22335. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22336. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22337. } else {
  22338. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22339. }
  22340. switch v1 {
  22341. case int32(_BT_LEAD2):
  22342. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22343. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22344. case int32(_BT_LEAD3):
  22345. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22346. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22347. case int32(_BT_LEAD4):
  22348. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22349. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22350. case int32(_BT_LF):
  22351. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22352. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22353. ptr += uintptr(2)
  22354. case int32(_BT_CR):
  22355. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22356. ptr += uintptr(2)
  22357. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  22358. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22359. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22360. } else {
  22361. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22362. }
  22363. }
  22364. if v3 && v2 == int32(_BT_LF) {
  22365. ptr += uintptr(2)
  22366. }
  22367. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22368. default:
  22369. ptr += uintptr(2)
  22370. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22371. break
  22372. }
  22373. }
  22374. }
  22375. var _little2_encoding_ns = Tnormal_encoding{
  22376. Fenc: TENCODING{
  22377. Fscanners: [4]TSCANNER{},
  22378. FliteralScanners: [2]TSCANNER{},
  22379. FminBytesPerChar: int32(2),
  22380. FisUtf16: int8(1),
  22381. },
  22382. Ftype1: [256]uint8{
  22383. 9: uint8(_BT_S),
  22384. 10: uint8(_BT_LF),
  22385. 13: uint8(_BT_CR),
  22386. 32: uint8(_BT_S),
  22387. 33: uint8(_BT_EXCL),
  22388. 34: uint8(_BT_QUOT),
  22389. 35: uint8(_BT_NUM),
  22390. 36: uint8(_BT_OTHER),
  22391. 37: uint8(_BT_PERCNT),
  22392. 38: uint8(_BT_AMP),
  22393. 39: uint8(_BT_APOS),
  22394. 40: uint8(_BT_LPAR),
  22395. 41: uint8(_BT_RPAR),
  22396. 42: uint8(_BT_AST),
  22397. 43: uint8(_BT_PLUS),
  22398. 44: uint8(_BT_COMMA),
  22399. 45: uint8(_BT_MINUS),
  22400. 46: uint8(_BT_NAME),
  22401. 47: uint8(_BT_SOL),
  22402. 48: uint8(_BT_DIGIT),
  22403. 49: uint8(_BT_DIGIT),
  22404. 50: uint8(_BT_DIGIT),
  22405. 51: uint8(_BT_DIGIT),
  22406. 52: uint8(_BT_DIGIT),
  22407. 53: uint8(_BT_DIGIT),
  22408. 54: uint8(_BT_DIGIT),
  22409. 55: uint8(_BT_DIGIT),
  22410. 56: uint8(_BT_DIGIT),
  22411. 57: uint8(_BT_DIGIT),
  22412. 58: uint8(_BT_COLON),
  22413. 59: uint8(_BT_SEMI),
  22414. 60: uint8(_BT_LT),
  22415. 61: uint8(_BT_EQUALS),
  22416. 62: uint8(_BT_GT),
  22417. 63: uint8(_BT_QUEST),
  22418. 64: uint8(_BT_OTHER),
  22419. 65: uint8(_BT_HEX),
  22420. 66: uint8(_BT_HEX),
  22421. 67: uint8(_BT_HEX),
  22422. 68: uint8(_BT_HEX),
  22423. 69: uint8(_BT_HEX),
  22424. 70: uint8(_BT_HEX),
  22425. 71: uint8(_BT_NMSTRT),
  22426. 72: uint8(_BT_NMSTRT),
  22427. 73: uint8(_BT_NMSTRT),
  22428. 74: uint8(_BT_NMSTRT),
  22429. 75: uint8(_BT_NMSTRT),
  22430. 76: uint8(_BT_NMSTRT),
  22431. 77: uint8(_BT_NMSTRT),
  22432. 78: uint8(_BT_NMSTRT),
  22433. 79: uint8(_BT_NMSTRT),
  22434. 80: uint8(_BT_NMSTRT),
  22435. 81: uint8(_BT_NMSTRT),
  22436. 82: uint8(_BT_NMSTRT),
  22437. 83: uint8(_BT_NMSTRT),
  22438. 84: uint8(_BT_NMSTRT),
  22439. 85: uint8(_BT_NMSTRT),
  22440. 86: uint8(_BT_NMSTRT),
  22441. 87: uint8(_BT_NMSTRT),
  22442. 88: uint8(_BT_NMSTRT),
  22443. 89: uint8(_BT_NMSTRT),
  22444. 90: uint8(_BT_NMSTRT),
  22445. 91: uint8(_BT_LSQB),
  22446. 92: uint8(_BT_OTHER),
  22447. 93: uint8(_BT_RSQB),
  22448. 94: uint8(_BT_OTHER),
  22449. 95: uint8(_BT_NMSTRT),
  22450. 96: uint8(_BT_OTHER),
  22451. 97: uint8(_BT_HEX),
  22452. 98: uint8(_BT_HEX),
  22453. 99: uint8(_BT_HEX),
  22454. 100: uint8(_BT_HEX),
  22455. 101: uint8(_BT_HEX),
  22456. 102: uint8(_BT_HEX),
  22457. 103: uint8(_BT_NMSTRT),
  22458. 104: uint8(_BT_NMSTRT),
  22459. 105: uint8(_BT_NMSTRT),
  22460. 106: uint8(_BT_NMSTRT),
  22461. 107: uint8(_BT_NMSTRT),
  22462. 108: uint8(_BT_NMSTRT),
  22463. 109: uint8(_BT_NMSTRT),
  22464. 110: uint8(_BT_NMSTRT),
  22465. 111: uint8(_BT_NMSTRT),
  22466. 112: uint8(_BT_NMSTRT),
  22467. 113: uint8(_BT_NMSTRT),
  22468. 114: uint8(_BT_NMSTRT),
  22469. 115: uint8(_BT_NMSTRT),
  22470. 116: uint8(_BT_NMSTRT),
  22471. 117: uint8(_BT_NMSTRT),
  22472. 118: uint8(_BT_NMSTRT),
  22473. 119: uint8(_BT_NMSTRT),
  22474. 120: uint8(_BT_NMSTRT),
  22475. 121: uint8(_BT_NMSTRT),
  22476. 122: uint8(_BT_NMSTRT),
  22477. 123: uint8(_BT_OTHER),
  22478. 124: uint8(_BT_VERBAR),
  22479. 125: uint8(_BT_OTHER),
  22480. 126: uint8(_BT_OTHER),
  22481. 127: uint8(_BT_OTHER),
  22482. 128: uint8(_BT_OTHER),
  22483. 129: uint8(_BT_OTHER),
  22484. 130: uint8(_BT_OTHER),
  22485. 131: uint8(_BT_OTHER),
  22486. 132: uint8(_BT_OTHER),
  22487. 133: uint8(_BT_OTHER),
  22488. 134: uint8(_BT_OTHER),
  22489. 135: uint8(_BT_OTHER),
  22490. 136: uint8(_BT_OTHER),
  22491. 137: uint8(_BT_OTHER),
  22492. 138: uint8(_BT_OTHER),
  22493. 139: uint8(_BT_OTHER),
  22494. 140: uint8(_BT_OTHER),
  22495. 141: uint8(_BT_OTHER),
  22496. 142: uint8(_BT_OTHER),
  22497. 143: uint8(_BT_OTHER),
  22498. 144: uint8(_BT_OTHER),
  22499. 145: uint8(_BT_OTHER),
  22500. 146: uint8(_BT_OTHER),
  22501. 147: uint8(_BT_OTHER),
  22502. 148: uint8(_BT_OTHER),
  22503. 149: uint8(_BT_OTHER),
  22504. 150: uint8(_BT_OTHER),
  22505. 151: uint8(_BT_OTHER),
  22506. 152: uint8(_BT_OTHER),
  22507. 153: uint8(_BT_OTHER),
  22508. 154: uint8(_BT_OTHER),
  22509. 155: uint8(_BT_OTHER),
  22510. 156: uint8(_BT_OTHER),
  22511. 157: uint8(_BT_OTHER),
  22512. 158: uint8(_BT_OTHER),
  22513. 159: uint8(_BT_OTHER),
  22514. 160: uint8(_BT_OTHER),
  22515. 161: uint8(_BT_OTHER),
  22516. 162: uint8(_BT_OTHER),
  22517. 163: uint8(_BT_OTHER),
  22518. 164: uint8(_BT_OTHER),
  22519. 165: uint8(_BT_OTHER),
  22520. 166: uint8(_BT_OTHER),
  22521. 167: uint8(_BT_OTHER),
  22522. 168: uint8(_BT_OTHER),
  22523. 169: uint8(_BT_OTHER),
  22524. 170: uint8(_BT_NMSTRT),
  22525. 171: uint8(_BT_OTHER),
  22526. 172: uint8(_BT_OTHER),
  22527. 173: uint8(_BT_OTHER),
  22528. 174: uint8(_BT_OTHER),
  22529. 175: uint8(_BT_OTHER),
  22530. 176: uint8(_BT_OTHER),
  22531. 177: uint8(_BT_OTHER),
  22532. 178: uint8(_BT_OTHER),
  22533. 179: uint8(_BT_OTHER),
  22534. 180: uint8(_BT_OTHER),
  22535. 181: uint8(_BT_NMSTRT),
  22536. 182: uint8(_BT_OTHER),
  22537. 183: uint8(_BT_NAME),
  22538. 184: uint8(_BT_OTHER),
  22539. 185: uint8(_BT_OTHER),
  22540. 186: uint8(_BT_NMSTRT),
  22541. 187: uint8(_BT_OTHER),
  22542. 188: uint8(_BT_OTHER),
  22543. 189: uint8(_BT_OTHER),
  22544. 190: uint8(_BT_OTHER),
  22545. 191: uint8(_BT_OTHER),
  22546. 192: uint8(_BT_NMSTRT),
  22547. 193: uint8(_BT_NMSTRT),
  22548. 194: uint8(_BT_NMSTRT),
  22549. 195: uint8(_BT_NMSTRT),
  22550. 196: uint8(_BT_NMSTRT),
  22551. 197: uint8(_BT_NMSTRT),
  22552. 198: uint8(_BT_NMSTRT),
  22553. 199: uint8(_BT_NMSTRT),
  22554. 200: uint8(_BT_NMSTRT),
  22555. 201: uint8(_BT_NMSTRT),
  22556. 202: uint8(_BT_NMSTRT),
  22557. 203: uint8(_BT_NMSTRT),
  22558. 204: uint8(_BT_NMSTRT),
  22559. 205: uint8(_BT_NMSTRT),
  22560. 206: uint8(_BT_NMSTRT),
  22561. 207: uint8(_BT_NMSTRT),
  22562. 208: uint8(_BT_NMSTRT),
  22563. 209: uint8(_BT_NMSTRT),
  22564. 210: uint8(_BT_NMSTRT),
  22565. 211: uint8(_BT_NMSTRT),
  22566. 212: uint8(_BT_NMSTRT),
  22567. 213: uint8(_BT_NMSTRT),
  22568. 214: uint8(_BT_NMSTRT),
  22569. 215: uint8(_BT_OTHER),
  22570. 216: uint8(_BT_NMSTRT),
  22571. 217: uint8(_BT_NMSTRT),
  22572. 218: uint8(_BT_NMSTRT),
  22573. 219: uint8(_BT_NMSTRT),
  22574. 220: uint8(_BT_NMSTRT),
  22575. 221: uint8(_BT_NMSTRT),
  22576. 222: uint8(_BT_NMSTRT),
  22577. 223: uint8(_BT_NMSTRT),
  22578. 224: uint8(_BT_NMSTRT),
  22579. 225: uint8(_BT_NMSTRT),
  22580. 226: uint8(_BT_NMSTRT),
  22581. 227: uint8(_BT_NMSTRT),
  22582. 228: uint8(_BT_NMSTRT),
  22583. 229: uint8(_BT_NMSTRT),
  22584. 230: uint8(_BT_NMSTRT),
  22585. 231: uint8(_BT_NMSTRT),
  22586. 232: uint8(_BT_NMSTRT),
  22587. 233: uint8(_BT_NMSTRT),
  22588. 234: uint8(_BT_NMSTRT),
  22589. 235: uint8(_BT_NMSTRT),
  22590. 236: uint8(_BT_NMSTRT),
  22591. 237: uint8(_BT_NMSTRT),
  22592. 238: uint8(_BT_NMSTRT),
  22593. 239: uint8(_BT_NMSTRT),
  22594. 240: uint8(_BT_NMSTRT),
  22595. 241: uint8(_BT_NMSTRT),
  22596. 242: uint8(_BT_NMSTRT),
  22597. 243: uint8(_BT_NMSTRT),
  22598. 244: uint8(_BT_NMSTRT),
  22599. 245: uint8(_BT_NMSTRT),
  22600. 246: uint8(_BT_NMSTRT),
  22601. 247: uint8(_BT_OTHER),
  22602. 248: uint8(_BT_NMSTRT),
  22603. 249: uint8(_BT_NMSTRT),
  22604. 250: uint8(_BT_NMSTRT),
  22605. 251: uint8(_BT_NMSTRT),
  22606. 252: uint8(_BT_NMSTRT),
  22607. 253: uint8(_BT_NMSTRT),
  22608. 254: uint8(_BT_NMSTRT),
  22609. 255: uint8(_BT_NMSTRT),
  22610. },
  22611. }
  22612. func init() {
  22613. p := unsafe.Pointer(&_little2_encoding_ns)
  22614. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22615. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22616. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22617. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22618. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22619. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22620. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22621. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22622. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22623. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22624. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22625. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22626. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22627. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22628. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22629. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22630. }
  22631. var _little2_encoding = Tnormal_encoding{
  22632. Fenc: TENCODING{
  22633. Fscanners: [4]TSCANNER{},
  22634. FliteralScanners: [2]TSCANNER{},
  22635. FminBytesPerChar: int32(2),
  22636. FisUtf16: int8(1),
  22637. },
  22638. Ftype1: [256]uint8{
  22639. 9: uint8(_BT_S),
  22640. 10: uint8(_BT_LF),
  22641. 13: uint8(_BT_CR),
  22642. 32: uint8(_BT_S),
  22643. 33: uint8(_BT_EXCL),
  22644. 34: uint8(_BT_QUOT),
  22645. 35: uint8(_BT_NUM),
  22646. 36: uint8(_BT_OTHER),
  22647. 37: uint8(_BT_PERCNT),
  22648. 38: uint8(_BT_AMP),
  22649. 39: uint8(_BT_APOS),
  22650. 40: uint8(_BT_LPAR),
  22651. 41: uint8(_BT_RPAR),
  22652. 42: uint8(_BT_AST),
  22653. 43: uint8(_BT_PLUS),
  22654. 44: uint8(_BT_COMMA),
  22655. 45: uint8(_BT_MINUS),
  22656. 46: uint8(_BT_NAME),
  22657. 47: uint8(_BT_SOL),
  22658. 48: uint8(_BT_DIGIT),
  22659. 49: uint8(_BT_DIGIT),
  22660. 50: uint8(_BT_DIGIT),
  22661. 51: uint8(_BT_DIGIT),
  22662. 52: uint8(_BT_DIGIT),
  22663. 53: uint8(_BT_DIGIT),
  22664. 54: uint8(_BT_DIGIT),
  22665. 55: uint8(_BT_DIGIT),
  22666. 56: uint8(_BT_DIGIT),
  22667. 57: uint8(_BT_DIGIT),
  22668. 58: uint8(_BT_NMSTRT),
  22669. 59: uint8(_BT_SEMI),
  22670. 60: uint8(_BT_LT),
  22671. 61: uint8(_BT_EQUALS),
  22672. 62: uint8(_BT_GT),
  22673. 63: uint8(_BT_QUEST),
  22674. 64: uint8(_BT_OTHER),
  22675. 65: uint8(_BT_HEX),
  22676. 66: uint8(_BT_HEX),
  22677. 67: uint8(_BT_HEX),
  22678. 68: uint8(_BT_HEX),
  22679. 69: uint8(_BT_HEX),
  22680. 70: uint8(_BT_HEX),
  22681. 71: uint8(_BT_NMSTRT),
  22682. 72: uint8(_BT_NMSTRT),
  22683. 73: uint8(_BT_NMSTRT),
  22684. 74: uint8(_BT_NMSTRT),
  22685. 75: uint8(_BT_NMSTRT),
  22686. 76: uint8(_BT_NMSTRT),
  22687. 77: uint8(_BT_NMSTRT),
  22688. 78: uint8(_BT_NMSTRT),
  22689. 79: uint8(_BT_NMSTRT),
  22690. 80: uint8(_BT_NMSTRT),
  22691. 81: uint8(_BT_NMSTRT),
  22692. 82: uint8(_BT_NMSTRT),
  22693. 83: uint8(_BT_NMSTRT),
  22694. 84: uint8(_BT_NMSTRT),
  22695. 85: uint8(_BT_NMSTRT),
  22696. 86: uint8(_BT_NMSTRT),
  22697. 87: uint8(_BT_NMSTRT),
  22698. 88: uint8(_BT_NMSTRT),
  22699. 89: uint8(_BT_NMSTRT),
  22700. 90: uint8(_BT_NMSTRT),
  22701. 91: uint8(_BT_LSQB),
  22702. 92: uint8(_BT_OTHER),
  22703. 93: uint8(_BT_RSQB),
  22704. 94: uint8(_BT_OTHER),
  22705. 95: uint8(_BT_NMSTRT),
  22706. 96: uint8(_BT_OTHER),
  22707. 97: uint8(_BT_HEX),
  22708. 98: uint8(_BT_HEX),
  22709. 99: uint8(_BT_HEX),
  22710. 100: uint8(_BT_HEX),
  22711. 101: uint8(_BT_HEX),
  22712. 102: uint8(_BT_HEX),
  22713. 103: uint8(_BT_NMSTRT),
  22714. 104: uint8(_BT_NMSTRT),
  22715. 105: uint8(_BT_NMSTRT),
  22716. 106: uint8(_BT_NMSTRT),
  22717. 107: uint8(_BT_NMSTRT),
  22718. 108: uint8(_BT_NMSTRT),
  22719. 109: uint8(_BT_NMSTRT),
  22720. 110: uint8(_BT_NMSTRT),
  22721. 111: uint8(_BT_NMSTRT),
  22722. 112: uint8(_BT_NMSTRT),
  22723. 113: uint8(_BT_NMSTRT),
  22724. 114: uint8(_BT_NMSTRT),
  22725. 115: uint8(_BT_NMSTRT),
  22726. 116: uint8(_BT_NMSTRT),
  22727. 117: uint8(_BT_NMSTRT),
  22728. 118: uint8(_BT_NMSTRT),
  22729. 119: uint8(_BT_NMSTRT),
  22730. 120: uint8(_BT_NMSTRT),
  22731. 121: uint8(_BT_NMSTRT),
  22732. 122: uint8(_BT_NMSTRT),
  22733. 123: uint8(_BT_OTHER),
  22734. 124: uint8(_BT_VERBAR),
  22735. 125: uint8(_BT_OTHER),
  22736. 126: uint8(_BT_OTHER),
  22737. 127: uint8(_BT_OTHER),
  22738. 128: uint8(_BT_OTHER),
  22739. 129: uint8(_BT_OTHER),
  22740. 130: uint8(_BT_OTHER),
  22741. 131: uint8(_BT_OTHER),
  22742. 132: uint8(_BT_OTHER),
  22743. 133: uint8(_BT_OTHER),
  22744. 134: uint8(_BT_OTHER),
  22745. 135: uint8(_BT_OTHER),
  22746. 136: uint8(_BT_OTHER),
  22747. 137: uint8(_BT_OTHER),
  22748. 138: uint8(_BT_OTHER),
  22749. 139: uint8(_BT_OTHER),
  22750. 140: uint8(_BT_OTHER),
  22751. 141: uint8(_BT_OTHER),
  22752. 142: uint8(_BT_OTHER),
  22753. 143: uint8(_BT_OTHER),
  22754. 144: uint8(_BT_OTHER),
  22755. 145: uint8(_BT_OTHER),
  22756. 146: uint8(_BT_OTHER),
  22757. 147: uint8(_BT_OTHER),
  22758. 148: uint8(_BT_OTHER),
  22759. 149: uint8(_BT_OTHER),
  22760. 150: uint8(_BT_OTHER),
  22761. 151: uint8(_BT_OTHER),
  22762. 152: uint8(_BT_OTHER),
  22763. 153: uint8(_BT_OTHER),
  22764. 154: uint8(_BT_OTHER),
  22765. 155: uint8(_BT_OTHER),
  22766. 156: uint8(_BT_OTHER),
  22767. 157: uint8(_BT_OTHER),
  22768. 158: uint8(_BT_OTHER),
  22769. 159: uint8(_BT_OTHER),
  22770. 160: uint8(_BT_OTHER),
  22771. 161: uint8(_BT_OTHER),
  22772. 162: uint8(_BT_OTHER),
  22773. 163: uint8(_BT_OTHER),
  22774. 164: uint8(_BT_OTHER),
  22775. 165: uint8(_BT_OTHER),
  22776. 166: uint8(_BT_OTHER),
  22777. 167: uint8(_BT_OTHER),
  22778. 168: uint8(_BT_OTHER),
  22779. 169: uint8(_BT_OTHER),
  22780. 170: uint8(_BT_NMSTRT),
  22781. 171: uint8(_BT_OTHER),
  22782. 172: uint8(_BT_OTHER),
  22783. 173: uint8(_BT_OTHER),
  22784. 174: uint8(_BT_OTHER),
  22785. 175: uint8(_BT_OTHER),
  22786. 176: uint8(_BT_OTHER),
  22787. 177: uint8(_BT_OTHER),
  22788. 178: uint8(_BT_OTHER),
  22789. 179: uint8(_BT_OTHER),
  22790. 180: uint8(_BT_OTHER),
  22791. 181: uint8(_BT_NMSTRT),
  22792. 182: uint8(_BT_OTHER),
  22793. 183: uint8(_BT_NAME),
  22794. 184: uint8(_BT_OTHER),
  22795. 185: uint8(_BT_OTHER),
  22796. 186: uint8(_BT_NMSTRT),
  22797. 187: uint8(_BT_OTHER),
  22798. 188: uint8(_BT_OTHER),
  22799. 189: uint8(_BT_OTHER),
  22800. 190: uint8(_BT_OTHER),
  22801. 191: uint8(_BT_OTHER),
  22802. 192: uint8(_BT_NMSTRT),
  22803. 193: uint8(_BT_NMSTRT),
  22804. 194: uint8(_BT_NMSTRT),
  22805. 195: uint8(_BT_NMSTRT),
  22806. 196: uint8(_BT_NMSTRT),
  22807. 197: uint8(_BT_NMSTRT),
  22808. 198: uint8(_BT_NMSTRT),
  22809. 199: uint8(_BT_NMSTRT),
  22810. 200: uint8(_BT_NMSTRT),
  22811. 201: uint8(_BT_NMSTRT),
  22812. 202: uint8(_BT_NMSTRT),
  22813. 203: uint8(_BT_NMSTRT),
  22814. 204: uint8(_BT_NMSTRT),
  22815. 205: uint8(_BT_NMSTRT),
  22816. 206: uint8(_BT_NMSTRT),
  22817. 207: uint8(_BT_NMSTRT),
  22818. 208: uint8(_BT_NMSTRT),
  22819. 209: uint8(_BT_NMSTRT),
  22820. 210: uint8(_BT_NMSTRT),
  22821. 211: uint8(_BT_NMSTRT),
  22822. 212: uint8(_BT_NMSTRT),
  22823. 213: uint8(_BT_NMSTRT),
  22824. 214: uint8(_BT_NMSTRT),
  22825. 215: uint8(_BT_OTHER),
  22826. 216: uint8(_BT_NMSTRT),
  22827. 217: uint8(_BT_NMSTRT),
  22828. 218: uint8(_BT_NMSTRT),
  22829. 219: uint8(_BT_NMSTRT),
  22830. 220: uint8(_BT_NMSTRT),
  22831. 221: uint8(_BT_NMSTRT),
  22832. 222: uint8(_BT_NMSTRT),
  22833. 223: uint8(_BT_NMSTRT),
  22834. 224: uint8(_BT_NMSTRT),
  22835. 225: uint8(_BT_NMSTRT),
  22836. 226: uint8(_BT_NMSTRT),
  22837. 227: uint8(_BT_NMSTRT),
  22838. 228: uint8(_BT_NMSTRT),
  22839. 229: uint8(_BT_NMSTRT),
  22840. 230: uint8(_BT_NMSTRT),
  22841. 231: uint8(_BT_NMSTRT),
  22842. 232: uint8(_BT_NMSTRT),
  22843. 233: uint8(_BT_NMSTRT),
  22844. 234: uint8(_BT_NMSTRT),
  22845. 235: uint8(_BT_NMSTRT),
  22846. 236: uint8(_BT_NMSTRT),
  22847. 237: uint8(_BT_NMSTRT),
  22848. 238: uint8(_BT_NMSTRT),
  22849. 239: uint8(_BT_NMSTRT),
  22850. 240: uint8(_BT_NMSTRT),
  22851. 241: uint8(_BT_NMSTRT),
  22852. 242: uint8(_BT_NMSTRT),
  22853. 243: uint8(_BT_NMSTRT),
  22854. 244: uint8(_BT_NMSTRT),
  22855. 245: uint8(_BT_NMSTRT),
  22856. 246: uint8(_BT_NMSTRT),
  22857. 247: uint8(_BT_OTHER),
  22858. 248: uint8(_BT_NMSTRT),
  22859. 249: uint8(_BT_NMSTRT),
  22860. 250: uint8(_BT_NMSTRT),
  22861. 251: uint8(_BT_NMSTRT),
  22862. 252: uint8(_BT_NMSTRT),
  22863. 253: uint8(_BT_NMSTRT),
  22864. 254: uint8(_BT_NMSTRT),
  22865. 255: uint8(_BT_NMSTRT),
  22866. },
  22867. }
  22868. func init() {
  22869. p := unsafe.Pointer(&_little2_encoding)
  22870. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22871. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22872. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22873. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22874. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22875. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22876. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22877. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22878. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22879. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22880. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22881. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22882. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22883. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22884. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22885. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22886. }
  22887. var _internal_little2_encoding_ns = Tnormal_encoding{
  22888. Fenc: TENCODING{
  22889. Fscanners: [4]TSCANNER{},
  22890. FliteralScanners: [2]TSCANNER{},
  22891. FminBytesPerChar: int32(2),
  22892. FisUtf16: int8(1),
  22893. },
  22894. Ftype1: [256]uint8{
  22895. 9: uint8(_BT_S),
  22896. 10: uint8(_BT_LF),
  22897. 13: uint8(_BT_S),
  22898. 32: uint8(_BT_S),
  22899. 33: uint8(_BT_EXCL),
  22900. 34: uint8(_BT_QUOT),
  22901. 35: uint8(_BT_NUM),
  22902. 36: uint8(_BT_OTHER),
  22903. 37: uint8(_BT_PERCNT),
  22904. 38: uint8(_BT_AMP),
  22905. 39: uint8(_BT_APOS),
  22906. 40: uint8(_BT_LPAR),
  22907. 41: uint8(_BT_RPAR),
  22908. 42: uint8(_BT_AST),
  22909. 43: uint8(_BT_PLUS),
  22910. 44: uint8(_BT_COMMA),
  22911. 45: uint8(_BT_MINUS),
  22912. 46: uint8(_BT_NAME),
  22913. 47: uint8(_BT_SOL),
  22914. 48: uint8(_BT_DIGIT),
  22915. 49: uint8(_BT_DIGIT),
  22916. 50: uint8(_BT_DIGIT),
  22917. 51: uint8(_BT_DIGIT),
  22918. 52: uint8(_BT_DIGIT),
  22919. 53: uint8(_BT_DIGIT),
  22920. 54: uint8(_BT_DIGIT),
  22921. 55: uint8(_BT_DIGIT),
  22922. 56: uint8(_BT_DIGIT),
  22923. 57: uint8(_BT_DIGIT),
  22924. 58: uint8(_BT_COLON),
  22925. 59: uint8(_BT_SEMI),
  22926. 60: uint8(_BT_LT),
  22927. 61: uint8(_BT_EQUALS),
  22928. 62: uint8(_BT_GT),
  22929. 63: uint8(_BT_QUEST),
  22930. 64: uint8(_BT_OTHER),
  22931. 65: uint8(_BT_HEX),
  22932. 66: uint8(_BT_HEX),
  22933. 67: uint8(_BT_HEX),
  22934. 68: uint8(_BT_HEX),
  22935. 69: uint8(_BT_HEX),
  22936. 70: uint8(_BT_HEX),
  22937. 71: uint8(_BT_NMSTRT),
  22938. 72: uint8(_BT_NMSTRT),
  22939. 73: uint8(_BT_NMSTRT),
  22940. 74: uint8(_BT_NMSTRT),
  22941. 75: uint8(_BT_NMSTRT),
  22942. 76: uint8(_BT_NMSTRT),
  22943. 77: uint8(_BT_NMSTRT),
  22944. 78: uint8(_BT_NMSTRT),
  22945. 79: uint8(_BT_NMSTRT),
  22946. 80: uint8(_BT_NMSTRT),
  22947. 81: uint8(_BT_NMSTRT),
  22948. 82: uint8(_BT_NMSTRT),
  22949. 83: uint8(_BT_NMSTRT),
  22950. 84: uint8(_BT_NMSTRT),
  22951. 85: uint8(_BT_NMSTRT),
  22952. 86: uint8(_BT_NMSTRT),
  22953. 87: uint8(_BT_NMSTRT),
  22954. 88: uint8(_BT_NMSTRT),
  22955. 89: uint8(_BT_NMSTRT),
  22956. 90: uint8(_BT_NMSTRT),
  22957. 91: uint8(_BT_LSQB),
  22958. 92: uint8(_BT_OTHER),
  22959. 93: uint8(_BT_RSQB),
  22960. 94: uint8(_BT_OTHER),
  22961. 95: uint8(_BT_NMSTRT),
  22962. 96: uint8(_BT_OTHER),
  22963. 97: uint8(_BT_HEX),
  22964. 98: uint8(_BT_HEX),
  22965. 99: uint8(_BT_HEX),
  22966. 100: uint8(_BT_HEX),
  22967. 101: uint8(_BT_HEX),
  22968. 102: uint8(_BT_HEX),
  22969. 103: uint8(_BT_NMSTRT),
  22970. 104: uint8(_BT_NMSTRT),
  22971. 105: uint8(_BT_NMSTRT),
  22972. 106: uint8(_BT_NMSTRT),
  22973. 107: uint8(_BT_NMSTRT),
  22974. 108: uint8(_BT_NMSTRT),
  22975. 109: uint8(_BT_NMSTRT),
  22976. 110: uint8(_BT_NMSTRT),
  22977. 111: uint8(_BT_NMSTRT),
  22978. 112: uint8(_BT_NMSTRT),
  22979. 113: uint8(_BT_NMSTRT),
  22980. 114: uint8(_BT_NMSTRT),
  22981. 115: uint8(_BT_NMSTRT),
  22982. 116: uint8(_BT_NMSTRT),
  22983. 117: uint8(_BT_NMSTRT),
  22984. 118: uint8(_BT_NMSTRT),
  22985. 119: uint8(_BT_NMSTRT),
  22986. 120: uint8(_BT_NMSTRT),
  22987. 121: uint8(_BT_NMSTRT),
  22988. 122: uint8(_BT_NMSTRT),
  22989. 123: uint8(_BT_OTHER),
  22990. 124: uint8(_BT_VERBAR),
  22991. 125: uint8(_BT_OTHER),
  22992. 126: uint8(_BT_OTHER),
  22993. 127: uint8(_BT_OTHER),
  22994. 128: uint8(_BT_OTHER),
  22995. 129: uint8(_BT_OTHER),
  22996. 130: uint8(_BT_OTHER),
  22997. 131: uint8(_BT_OTHER),
  22998. 132: uint8(_BT_OTHER),
  22999. 133: uint8(_BT_OTHER),
  23000. 134: uint8(_BT_OTHER),
  23001. 135: uint8(_BT_OTHER),
  23002. 136: uint8(_BT_OTHER),
  23003. 137: uint8(_BT_OTHER),
  23004. 138: uint8(_BT_OTHER),
  23005. 139: uint8(_BT_OTHER),
  23006. 140: uint8(_BT_OTHER),
  23007. 141: uint8(_BT_OTHER),
  23008. 142: uint8(_BT_OTHER),
  23009. 143: uint8(_BT_OTHER),
  23010. 144: uint8(_BT_OTHER),
  23011. 145: uint8(_BT_OTHER),
  23012. 146: uint8(_BT_OTHER),
  23013. 147: uint8(_BT_OTHER),
  23014. 148: uint8(_BT_OTHER),
  23015. 149: uint8(_BT_OTHER),
  23016. 150: uint8(_BT_OTHER),
  23017. 151: uint8(_BT_OTHER),
  23018. 152: uint8(_BT_OTHER),
  23019. 153: uint8(_BT_OTHER),
  23020. 154: uint8(_BT_OTHER),
  23021. 155: uint8(_BT_OTHER),
  23022. 156: uint8(_BT_OTHER),
  23023. 157: uint8(_BT_OTHER),
  23024. 158: uint8(_BT_OTHER),
  23025. 159: uint8(_BT_OTHER),
  23026. 160: uint8(_BT_OTHER),
  23027. 161: uint8(_BT_OTHER),
  23028. 162: uint8(_BT_OTHER),
  23029. 163: uint8(_BT_OTHER),
  23030. 164: uint8(_BT_OTHER),
  23031. 165: uint8(_BT_OTHER),
  23032. 166: uint8(_BT_OTHER),
  23033. 167: uint8(_BT_OTHER),
  23034. 168: uint8(_BT_OTHER),
  23035. 169: uint8(_BT_OTHER),
  23036. 170: uint8(_BT_NMSTRT),
  23037. 171: uint8(_BT_OTHER),
  23038. 172: uint8(_BT_OTHER),
  23039. 173: uint8(_BT_OTHER),
  23040. 174: uint8(_BT_OTHER),
  23041. 175: uint8(_BT_OTHER),
  23042. 176: uint8(_BT_OTHER),
  23043. 177: uint8(_BT_OTHER),
  23044. 178: uint8(_BT_OTHER),
  23045. 179: uint8(_BT_OTHER),
  23046. 180: uint8(_BT_OTHER),
  23047. 181: uint8(_BT_NMSTRT),
  23048. 182: uint8(_BT_OTHER),
  23049. 183: uint8(_BT_NAME),
  23050. 184: uint8(_BT_OTHER),
  23051. 185: uint8(_BT_OTHER),
  23052. 186: uint8(_BT_NMSTRT),
  23053. 187: uint8(_BT_OTHER),
  23054. 188: uint8(_BT_OTHER),
  23055. 189: uint8(_BT_OTHER),
  23056. 190: uint8(_BT_OTHER),
  23057. 191: uint8(_BT_OTHER),
  23058. 192: uint8(_BT_NMSTRT),
  23059. 193: uint8(_BT_NMSTRT),
  23060. 194: uint8(_BT_NMSTRT),
  23061. 195: uint8(_BT_NMSTRT),
  23062. 196: uint8(_BT_NMSTRT),
  23063. 197: uint8(_BT_NMSTRT),
  23064. 198: uint8(_BT_NMSTRT),
  23065. 199: uint8(_BT_NMSTRT),
  23066. 200: uint8(_BT_NMSTRT),
  23067. 201: uint8(_BT_NMSTRT),
  23068. 202: uint8(_BT_NMSTRT),
  23069. 203: uint8(_BT_NMSTRT),
  23070. 204: uint8(_BT_NMSTRT),
  23071. 205: uint8(_BT_NMSTRT),
  23072. 206: uint8(_BT_NMSTRT),
  23073. 207: uint8(_BT_NMSTRT),
  23074. 208: uint8(_BT_NMSTRT),
  23075. 209: uint8(_BT_NMSTRT),
  23076. 210: uint8(_BT_NMSTRT),
  23077. 211: uint8(_BT_NMSTRT),
  23078. 212: uint8(_BT_NMSTRT),
  23079. 213: uint8(_BT_NMSTRT),
  23080. 214: uint8(_BT_NMSTRT),
  23081. 215: uint8(_BT_OTHER),
  23082. 216: uint8(_BT_NMSTRT),
  23083. 217: uint8(_BT_NMSTRT),
  23084. 218: uint8(_BT_NMSTRT),
  23085. 219: uint8(_BT_NMSTRT),
  23086. 220: uint8(_BT_NMSTRT),
  23087. 221: uint8(_BT_NMSTRT),
  23088. 222: uint8(_BT_NMSTRT),
  23089. 223: uint8(_BT_NMSTRT),
  23090. 224: uint8(_BT_NMSTRT),
  23091. 225: uint8(_BT_NMSTRT),
  23092. 226: uint8(_BT_NMSTRT),
  23093. 227: uint8(_BT_NMSTRT),
  23094. 228: uint8(_BT_NMSTRT),
  23095. 229: uint8(_BT_NMSTRT),
  23096. 230: uint8(_BT_NMSTRT),
  23097. 231: uint8(_BT_NMSTRT),
  23098. 232: uint8(_BT_NMSTRT),
  23099. 233: uint8(_BT_NMSTRT),
  23100. 234: uint8(_BT_NMSTRT),
  23101. 235: uint8(_BT_NMSTRT),
  23102. 236: uint8(_BT_NMSTRT),
  23103. 237: uint8(_BT_NMSTRT),
  23104. 238: uint8(_BT_NMSTRT),
  23105. 239: uint8(_BT_NMSTRT),
  23106. 240: uint8(_BT_NMSTRT),
  23107. 241: uint8(_BT_NMSTRT),
  23108. 242: uint8(_BT_NMSTRT),
  23109. 243: uint8(_BT_NMSTRT),
  23110. 244: uint8(_BT_NMSTRT),
  23111. 245: uint8(_BT_NMSTRT),
  23112. 246: uint8(_BT_NMSTRT),
  23113. 247: uint8(_BT_OTHER),
  23114. 248: uint8(_BT_NMSTRT),
  23115. 249: uint8(_BT_NMSTRT),
  23116. 250: uint8(_BT_NMSTRT),
  23117. 251: uint8(_BT_NMSTRT),
  23118. 252: uint8(_BT_NMSTRT),
  23119. 253: uint8(_BT_NMSTRT),
  23120. 254: uint8(_BT_NMSTRT),
  23121. 255: uint8(_BT_NMSTRT),
  23122. },
  23123. }
  23124. func init() {
  23125. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23126. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23127. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23128. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23129. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23130. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23131. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23132. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23133. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23134. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23135. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23136. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23137. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23138. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23139. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23140. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23141. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23142. }
  23143. var _internal_little2_encoding = Tnormal_encoding{
  23144. Fenc: TENCODING{
  23145. Fscanners: [4]TSCANNER{},
  23146. FliteralScanners: [2]TSCANNER{},
  23147. FminBytesPerChar: int32(2),
  23148. FisUtf16: int8(1),
  23149. },
  23150. Ftype1: [256]uint8{
  23151. 9: uint8(_BT_S),
  23152. 10: uint8(_BT_LF),
  23153. 13: uint8(_BT_S),
  23154. 32: uint8(_BT_S),
  23155. 33: uint8(_BT_EXCL),
  23156. 34: uint8(_BT_QUOT),
  23157. 35: uint8(_BT_NUM),
  23158. 36: uint8(_BT_OTHER),
  23159. 37: uint8(_BT_PERCNT),
  23160. 38: uint8(_BT_AMP),
  23161. 39: uint8(_BT_APOS),
  23162. 40: uint8(_BT_LPAR),
  23163. 41: uint8(_BT_RPAR),
  23164. 42: uint8(_BT_AST),
  23165. 43: uint8(_BT_PLUS),
  23166. 44: uint8(_BT_COMMA),
  23167. 45: uint8(_BT_MINUS),
  23168. 46: uint8(_BT_NAME),
  23169. 47: uint8(_BT_SOL),
  23170. 48: uint8(_BT_DIGIT),
  23171. 49: uint8(_BT_DIGIT),
  23172. 50: uint8(_BT_DIGIT),
  23173. 51: uint8(_BT_DIGIT),
  23174. 52: uint8(_BT_DIGIT),
  23175. 53: uint8(_BT_DIGIT),
  23176. 54: uint8(_BT_DIGIT),
  23177. 55: uint8(_BT_DIGIT),
  23178. 56: uint8(_BT_DIGIT),
  23179. 57: uint8(_BT_DIGIT),
  23180. 58: uint8(_BT_NMSTRT),
  23181. 59: uint8(_BT_SEMI),
  23182. 60: uint8(_BT_LT),
  23183. 61: uint8(_BT_EQUALS),
  23184. 62: uint8(_BT_GT),
  23185. 63: uint8(_BT_QUEST),
  23186. 64: uint8(_BT_OTHER),
  23187. 65: uint8(_BT_HEX),
  23188. 66: uint8(_BT_HEX),
  23189. 67: uint8(_BT_HEX),
  23190. 68: uint8(_BT_HEX),
  23191. 69: uint8(_BT_HEX),
  23192. 70: uint8(_BT_HEX),
  23193. 71: uint8(_BT_NMSTRT),
  23194. 72: uint8(_BT_NMSTRT),
  23195. 73: uint8(_BT_NMSTRT),
  23196. 74: uint8(_BT_NMSTRT),
  23197. 75: uint8(_BT_NMSTRT),
  23198. 76: uint8(_BT_NMSTRT),
  23199. 77: uint8(_BT_NMSTRT),
  23200. 78: uint8(_BT_NMSTRT),
  23201. 79: uint8(_BT_NMSTRT),
  23202. 80: uint8(_BT_NMSTRT),
  23203. 81: uint8(_BT_NMSTRT),
  23204. 82: uint8(_BT_NMSTRT),
  23205. 83: uint8(_BT_NMSTRT),
  23206. 84: uint8(_BT_NMSTRT),
  23207. 85: uint8(_BT_NMSTRT),
  23208. 86: uint8(_BT_NMSTRT),
  23209. 87: uint8(_BT_NMSTRT),
  23210. 88: uint8(_BT_NMSTRT),
  23211. 89: uint8(_BT_NMSTRT),
  23212. 90: uint8(_BT_NMSTRT),
  23213. 91: uint8(_BT_LSQB),
  23214. 92: uint8(_BT_OTHER),
  23215. 93: uint8(_BT_RSQB),
  23216. 94: uint8(_BT_OTHER),
  23217. 95: uint8(_BT_NMSTRT),
  23218. 96: uint8(_BT_OTHER),
  23219. 97: uint8(_BT_HEX),
  23220. 98: uint8(_BT_HEX),
  23221. 99: uint8(_BT_HEX),
  23222. 100: uint8(_BT_HEX),
  23223. 101: uint8(_BT_HEX),
  23224. 102: uint8(_BT_HEX),
  23225. 103: uint8(_BT_NMSTRT),
  23226. 104: uint8(_BT_NMSTRT),
  23227. 105: uint8(_BT_NMSTRT),
  23228. 106: uint8(_BT_NMSTRT),
  23229. 107: uint8(_BT_NMSTRT),
  23230. 108: uint8(_BT_NMSTRT),
  23231. 109: uint8(_BT_NMSTRT),
  23232. 110: uint8(_BT_NMSTRT),
  23233. 111: uint8(_BT_NMSTRT),
  23234. 112: uint8(_BT_NMSTRT),
  23235. 113: uint8(_BT_NMSTRT),
  23236. 114: uint8(_BT_NMSTRT),
  23237. 115: uint8(_BT_NMSTRT),
  23238. 116: uint8(_BT_NMSTRT),
  23239. 117: uint8(_BT_NMSTRT),
  23240. 118: uint8(_BT_NMSTRT),
  23241. 119: uint8(_BT_NMSTRT),
  23242. 120: uint8(_BT_NMSTRT),
  23243. 121: uint8(_BT_NMSTRT),
  23244. 122: uint8(_BT_NMSTRT),
  23245. 123: uint8(_BT_OTHER),
  23246. 124: uint8(_BT_VERBAR),
  23247. 125: uint8(_BT_OTHER),
  23248. 126: uint8(_BT_OTHER),
  23249. 127: uint8(_BT_OTHER),
  23250. 128: uint8(_BT_OTHER),
  23251. 129: uint8(_BT_OTHER),
  23252. 130: uint8(_BT_OTHER),
  23253. 131: uint8(_BT_OTHER),
  23254. 132: uint8(_BT_OTHER),
  23255. 133: uint8(_BT_OTHER),
  23256. 134: uint8(_BT_OTHER),
  23257. 135: uint8(_BT_OTHER),
  23258. 136: uint8(_BT_OTHER),
  23259. 137: uint8(_BT_OTHER),
  23260. 138: uint8(_BT_OTHER),
  23261. 139: uint8(_BT_OTHER),
  23262. 140: uint8(_BT_OTHER),
  23263. 141: uint8(_BT_OTHER),
  23264. 142: uint8(_BT_OTHER),
  23265. 143: uint8(_BT_OTHER),
  23266. 144: uint8(_BT_OTHER),
  23267. 145: uint8(_BT_OTHER),
  23268. 146: uint8(_BT_OTHER),
  23269. 147: uint8(_BT_OTHER),
  23270. 148: uint8(_BT_OTHER),
  23271. 149: uint8(_BT_OTHER),
  23272. 150: uint8(_BT_OTHER),
  23273. 151: uint8(_BT_OTHER),
  23274. 152: uint8(_BT_OTHER),
  23275. 153: uint8(_BT_OTHER),
  23276. 154: uint8(_BT_OTHER),
  23277. 155: uint8(_BT_OTHER),
  23278. 156: uint8(_BT_OTHER),
  23279. 157: uint8(_BT_OTHER),
  23280. 158: uint8(_BT_OTHER),
  23281. 159: uint8(_BT_OTHER),
  23282. 160: uint8(_BT_OTHER),
  23283. 161: uint8(_BT_OTHER),
  23284. 162: uint8(_BT_OTHER),
  23285. 163: uint8(_BT_OTHER),
  23286. 164: uint8(_BT_OTHER),
  23287. 165: uint8(_BT_OTHER),
  23288. 166: uint8(_BT_OTHER),
  23289. 167: uint8(_BT_OTHER),
  23290. 168: uint8(_BT_OTHER),
  23291. 169: uint8(_BT_OTHER),
  23292. 170: uint8(_BT_NMSTRT),
  23293. 171: uint8(_BT_OTHER),
  23294. 172: uint8(_BT_OTHER),
  23295. 173: uint8(_BT_OTHER),
  23296. 174: uint8(_BT_OTHER),
  23297. 175: uint8(_BT_OTHER),
  23298. 176: uint8(_BT_OTHER),
  23299. 177: uint8(_BT_OTHER),
  23300. 178: uint8(_BT_OTHER),
  23301. 179: uint8(_BT_OTHER),
  23302. 180: uint8(_BT_OTHER),
  23303. 181: uint8(_BT_NMSTRT),
  23304. 182: uint8(_BT_OTHER),
  23305. 183: uint8(_BT_NAME),
  23306. 184: uint8(_BT_OTHER),
  23307. 185: uint8(_BT_OTHER),
  23308. 186: uint8(_BT_NMSTRT),
  23309. 187: uint8(_BT_OTHER),
  23310. 188: uint8(_BT_OTHER),
  23311. 189: uint8(_BT_OTHER),
  23312. 190: uint8(_BT_OTHER),
  23313. 191: uint8(_BT_OTHER),
  23314. 192: uint8(_BT_NMSTRT),
  23315. 193: uint8(_BT_NMSTRT),
  23316. 194: uint8(_BT_NMSTRT),
  23317. 195: uint8(_BT_NMSTRT),
  23318. 196: uint8(_BT_NMSTRT),
  23319. 197: uint8(_BT_NMSTRT),
  23320. 198: uint8(_BT_NMSTRT),
  23321. 199: uint8(_BT_NMSTRT),
  23322. 200: uint8(_BT_NMSTRT),
  23323. 201: uint8(_BT_NMSTRT),
  23324. 202: uint8(_BT_NMSTRT),
  23325. 203: uint8(_BT_NMSTRT),
  23326. 204: uint8(_BT_NMSTRT),
  23327. 205: uint8(_BT_NMSTRT),
  23328. 206: uint8(_BT_NMSTRT),
  23329. 207: uint8(_BT_NMSTRT),
  23330. 208: uint8(_BT_NMSTRT),
  23331. 209: uint8(_BT_NMSTRT),
  23332. 210: uint8(_BT_NMSTRT),
  23333. 211: uint8(_BT_NMSTRT),
  23334. 212: uint8(_BT_NMSTRT),
  23335. 213: uint8(_BT_NMSTRT),
  23336. 214: uint8(_BT_NMSTRT),
  23337. 215: uint8(_BT_OTHER),
  23338. 216: uint8(_BT_NMSTRT),
  23339. 217: uint8(_BT_NMSTRT),
  23340. 218: uint8(_BT_NMSTRT),
  23341. 219: uint8(_BT_NMSTRT),
  23342. 220: uint8(_BT_NMSTRT),
  23343. 221: uint8(_BT_NMSTRT),
  23344. 222: uint8(_BT_NMSTRT),
  23345. 223: uint8(_BT_NMSTRT),
  23346. 224: uint8(_BT_NMSTRT),
  23347. 225: uint8(_BT_NMSTRT),
  23348. 226: uint8(_BT_NMSTRT),
  23349. 227: uint8(_BT_NMSTRT),
  23350. 228: uint8(_BT_NMSTRT),
  23351. 229: uint8(_BT_NMSTRT),
  23352. 230: uint8(_BT_NMSTRT),
  23353. 231: uint8(_BT_NMSTRT),
  23354. 232: uint8(_BT_NMSTRT),
  23355. 233: uint8(_BT_NMSTRT),
  23356. 234: uint8(_BT_NMSTRT),
  23357. 235: uint8(_BT_NMSTRT),
  23358. 236: uint8(_BT_NMSTRT),
  23359. 237: uint8(_BT_NMSTRT),
  23360. 238: uint8(_BT_NMSTRT),
  23361. 239: uint8(_BT_NMSTRT),
  23362. 240: uint8(_BT_NMSTRT),
  23363. 241: uint8(_BT_NMSTRT),
  23364. 242: uint8(_BT_NMSTRT),
  23365. 243: uint8(_BT_NMSTRT),
  23366. 244: uint8(_BT_NMSTRT),
  23367. 245: uint8(_BT_NMSTRT),
  23368. 246: uint8(_BT_NMSTRT),
  23369. 247: uint8(_BT_OTHER),
  23370. 248: uint8(_BT_NMSTRT),
  23371. 249: uint8(_BT_NMSTRT),
  23372. 250: uint8(_BT_NMSTRT),
  23373. 251: uint8(_BT_NMSTRT),
  23374. 252: uint8(_BT_NMSTRT),
  23375. 253: uint8(_BT_NMSTRT),
  23376. 254: uint8(_BT_NMSTRT),
  23377. 255: uint8(_BT_NMSTRT),
  23378. },
  23379. }
  23380. func init() {
  23381. p := unsafe.Pointer(&_internal_little2_encoding)
  23382. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23383. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23384. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23385. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23386. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23387. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23388. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23389. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23390. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23391. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23392. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23393. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23394. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23395. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23396. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23397. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23398. }
  23399. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23400. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23401. __ __ _
  23402. ___\ \/ /_ __ __ _| |_
  23403. / _ \\ /| '_ \ / _` | __|
  23404. | __// \| |_) | (_| | |_
  23405. \___/_/\_\ .__/ \__,_|\__|
  23406. |_| XML parser
  23407. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23408. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23409. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23410. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23411. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23412. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23413. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23414. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23415. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23416. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23417. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23418. Licensed under the MIT license:
  23419. Permission is hereby granted, free of charge, to any person obtaining
  23420. a copy of this software and associated documentation files (the
  23421. "Software"), to deal in the Software without restriction, including
  23422. without limitation the rights to use, copy, modify, merge, publish,
  23423. distribute, sublicense, and/or sell copies of the Software, and to permit
  23424. persons to whom the Software is furnished to do so, subject to the
  23425. following conditions:
  23426. The above copyright notice and this permission notice shall be included
  23427. in all copies or substantial portions of the Software.
  23428. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23429. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23430. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23431. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23432. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23433. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23434. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23435. */
  23436. /* ptr points to character following "<!-" */
  23437. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23438. var v1 int32
  23439. _ = v1
  23440. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23441. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23443. return m_XML_TOK_INVALID
  23444. }
  23445. ptr += uintptr(2)
  23446. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23447. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23448. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23449. } else {
  23450. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23451. }
  23452. switch v1 {
  23453. case int32(_BT_LEAD2):
  23454. if int64(end)-int64(ptr) < int64(2) {
  23455. return -int32(2)
  23456. }
  23457. if 0 != 0 {
  23458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23459. return m_XML_TOK_INVALID
  23460. }
  23461. ptr += uintptr(2)
  23462. case int32(_BT_LEAD3):
  23463. if int64(end)-int64(ptr) < int64(3) {
  23464. return -int32(2)
  23465. }
  23466. if 0 != 0 {
  23467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23468. return m_XML_TOK_INVALID
  23469. }
  23470. ptr += uintptr(3)
  23471. case int32(_BT_LEAD4):
  23472. if int64(end)-int64(ptr) < int64(4) {
  23473. return -int32(2)
  23474. }
  23475. if 0 != 0 {
  23476. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23477. return m_XML_TOK_INVALID
  23478. }
  23479. ptr += uintptr(4)
  23480. case int32(_BT_NONXML):
  23481. fallthrough
  23482. case int32(_BT_MALFORM):
  23483. fallthrough
  23484. case int32(_BT_TRAIL):
  23485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23486. return m_XML_TOK_INVALID
  23487. case int32(_BT_MINUS):
  23488. ptr += uintptr(2)
  23489. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23490. return -int32(1)
  23491. }
  23492. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23493. ptr += uintptr(2)
  23494. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23495. return -int32(1)
  23496. }
  23497. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23499. return m_XML_TOK_INVALID
  23500. }
  23501. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23502. return int32(m_XML_TOK_COMMENT)
  23503. }
  23504. default:
  23505. ptr += uintptr(2)
  23506. break
  23507. }
  23508. }
  23509. }
  23510. return -int32(1)
  23511. }
  23512. /* ptr points to character following "<!" */
  23513. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23514. var v1, v2, v3 int32
  23515. _, _, _ = v1, v2, v3
  23516. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23517. return -int32(1)
  23518. }
  23519. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23520. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23521. } else {
  23522. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23523. }
  23524. switch v1 {
  23525. case int32(_BT_MINUS):
  23526. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23527. case int32(_BT_LSQB):
  23528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23529. return int32(m_XML_TOK_COND_SECT_OPEN)
  23530. case int32(_BT_NMSTRT):
  23531. fallthrough
  23532. case int32(_BT_HEX):
  23533. ptr += uintptr(2)
  23534. default:
  23535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23536. return m_XML_TOK_INVALID
  23537. }
  23538. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23539. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23540. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23541. } else {
  23542. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23543. }
  23544. switch v2 {
  23545. case int32(_BT_PERCNT):
  23546. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23547. return -int32(1)
  23548. }
  23549. /* don't allow <!ENTITY% foo "whatever"> */
  23550. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23551. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  23552. } else {
  23553. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23554. }
  23555. switch v3 {
  23556. case int32(_BT_S):
  23557. fallthrough
  23558. case int32(_BT_CR):
  23559. fallthrough
  23560. case int32(_BT_LF):
  23561. fallthrough
  23562. case int32(_BT_PERCNT):
  23563. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23564. return m_XML_TOK_INVALID
  23565. }
  23566. /* fall through */
  23567. fallthrough
  23568. case int32(_BT_S):
  23569. fallthrough
  23570. case int32(_BT_CR):
  23571. fallthrough
  23572. case int32(_BT_LF):
  23573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23574. return int32(m_XML_TOK_DECL_OPEN)
  23575. case int32(_BT_NMSTRT):
  23576. fallthrough
  23577. case int32(_BT_HEX):
  23578. ptr += uintptr(2)
  23579. default:
  23580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23581. return m_XML_TOK_INVALID
  23582. }
  23583. }
  23584. return -int32(1)
  23585. }
  23586. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23587. var upper, v1, v2, v3 int32
  23588. _, _, _, _ = upper, v1, v2, v3
  23589. upper = 0
  23590. _ = enc
  23591. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23592. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  23593. return int32(1)
  23594. }
  23595. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23596. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23597. } else {
  23598. v1 = -int32(1)
  23599. }
  23600. switch v1 {
  23601. case int32(m_ASCII_x2):
  23602. case int32(m_ASCII_X):
  23603. upper = int32(1)
  23604. default:
  23605. return int32(1)
  23606. }
  23607. ptr += uintptr(2)
  23608. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23609. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23610. } else {
  23611. v2 = -int32(1)
  23612. }
  23613. switch v2 {
  23614. case int32(m_ASCII_m2):
  23615. case int32(m_ASCII_M):
  23616. upper = int32(1)
  23617. default:
  23618. return int32(1)
  23619. }
  23620. ptr += uintptr(2)
  23621. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23622. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23623. } else {
  23624. v3 = -int32(1)
  23625. }
  23626. switch v3 {
  23627. case int32(m_ASCII_l2):
  23628. case int32(m_ASCII_L):
  23629. upper = int32(1)
  23630. default:
  23631. return int32(1)
  23632. }
  23633. if upper != 0 {
  23634. return 0
  23635. }
  23636. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23637. return int32(1)
  23638. }
  23639. /* ptr points to character following "<?" */
  23640. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23641. bp := tls.Alloc(16)
  23642. defer tls.Free(16)
  23643. var target uintptr
  23644. var v1, v2, v3 int32
  23645. var _ /* tok at bp+0 */ int32
  23646. _, _, _, _ = target, v1, v2, v3
  23647. target = ptr
  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 {
  23652. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23653. } else {
  23654. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23655. }
  23656. switch v1 {
  23657. case int32(_BT_NONASCII):
  23658. 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) {
  23659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23660. return m_XML_TOK_INVALID
  23661. } /* fall through */
  23662. fallthrough
  23663. case int32(_BT_NMSTRT):
  23664. fallthrough
  23665. case int32(_BT_HEX):
  23666. ptr += uintptr(2)
  23667. case int32(_BT_LEAD2):
  23668. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23669. return -int32(2)
  23670. }
  23671. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23672. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23673. return m_XML_TOK_INVALID
  23674. }
  23675. ptr += uintptr(2)
  23676. case int32(_BT_LEAD3):
  23677. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23678. return -int32(2)
  23679. }
  23680. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23681. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23682. return m_XML_TOK_INVALID
  23683. }
  23684. ptr += uintptr(3)
  23685. case int32(_BT_LEAD4):
  23686. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23687. return -int32(2)
  23688. }
  23689. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23691. return m_XML_TOK_INVALID
  23692. }
  23693. ptr += uintptr(4)
  23694. default:
  23695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23696. return m_XML_TOK_INVALID
  23697. }
  23698. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23699. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23700. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23701. } else {
  23702. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23703. }
  23704. switch v2 {
  23705. case int32(_BT_NONASCII):
  23706. 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) {
  23707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23708. return m_XML_TOK_INVALID
  23709. } /* fall through */
  23710. fallthrough
  23711. case int32(_BT_NMSTRT):
  23712. fallthrough
  23713. case int32(_BT_HEX):
  23714. fallthrough
  23715. case int32(_BT_DIGIT):
  23716. fallthrough
  23717. case int32(_BT_NAME):
  23718. fallthrough
  23719. case int32(_BT_MINUS):
  23720. ptr += uintptr(2)
  23721. case int32(_BT_LEAD2):
  23722. if int64(end)-int64(ptr) < int64(2) {
  23723. return -int32(2)
  23724. }
  23725. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23727. return m_XML_TOK_INVALID
  23728. }
  23729. ptr += uintptr(2)
  23730. case int32(_BT_LEAD3):
  23731. if int64(end)-int64(ptr) < int64(3) {
  23732. return -int32(2)
  23733. }
  23734. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23736. return m_XML_TOK_INVALID
  23737. }
  23738. ptr += uintptr(3)
  23739. case int32(_BT_LEAD4):
  23740. if int64(end)-int64(ptr) < int64(4) {
  23741. return -int32(2)
  23742. }
  23743. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23745. return m_XML_TOK_INVALID
  23746. }
  23747. ptr += uintptr(4)
  23748. case int32(_BT_S):
  23749. fallthrough
  23750. case int32(_BT_CR):
  23751. fallthrough
  23752. case int32(_BT_LF):
  23753. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23754. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23755. return m_XML_TOK_INVALID
  23756. }
  23757. ptr += uintptr(2)
  23758. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23759. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23760. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23761. } else {
  23762. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23763. }
  23764. switch v3 {
  23765. case int32(_BT_LEAD2):
  23766. if int64(end)-int64(ptr) < int64(2) {
  23767. return -int32(2)
  23768. }
  23769. if 0 != 0 {
  23770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23771. return m_XML_TOK_INVALID
  23772. }
  23773. ptr += uintptr(2)
  23774. case int32(_BT_LEAD3):
  23775. if int64(end)-int64(ptr) < int64(3) {
  23776. return -int32(2)
  23777. }
  23778. if 0 != 0 {
  23779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23780. return m_XML_TOK_INVALID
  23781. }
  23782. ptr += uintptr(3)
  23783. case int32(_BT_LEAD4):
  23784. if int64(end)-int64(ptr) < int64(4) {
  23785. return -int32(2)
  23786. }
  23787. if 0 != 0 {
  23788. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23789. return m_XML_TOK_INVALID
  23790. }
  23791. ptr += uintptr(4)
  23792. case int32(_BT_NONXML):
  23793. fallthrough
  23794. case int32(_BT_MALFORM):
  23795. fallthrough
  23796. case int32(_BT_TRAIL):
  23797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23798. return m_XML_TOK_INVALID
  23799. case int32(_BT_QUEST):
  23800. ptr += uintptr(2)
  23801. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23802. return -int32(1)
  23803. }
  23804. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23806. return *(*int32)(unsafe.Pointer(bp))
  23807. }
  23808. default:
  23809. ptr += uintptr(2)
  23810. break
  23811. }
  23812. }
  23813. return -int32(1)
  23814. case int32(_BT_QUEST):
  23815. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23817. return m_XML_TOK_INVALID
  23818. }
  23819. ptr += uintptr(2)
  23820. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23821. return -int32(1)
  23822. }
  23823. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23825. return *(*int32)(unsafe.Pointer(bp))
  23826. }
  23827. /* fall through */
  23828. fallthrough
  23829. default:
  23830. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23831. return m_XML_TOK_INVALID
  23832. }
  23833. }
  23834. return -int32(1)
  23835. }
  23836. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23837. var i int32
  23838. _ = i
  23839. _ = enc
  23840. /* CDATA[ */
  23841. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  23842. return -int32(1)
  23843. }
  23844. i = 0
  23845. for {
  23846. if !(i < int32(6)) {
  23847. break
  23848. }
  23849. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(_CDATA_LSQB2[i])) {
  23850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23851. return m_XML_TOK_INVALID
  23852. }
  23853. goto _1
  23854. _1:
  23855. ;
  23856. i++
  23857. ptr += uintptr(2)
  23858. }
  23859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23860. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  23861. }
  23862. var _CDATA_LSQB2 = [6]int8{
  23863. 0: int8(m_ASCII_C),
  23864. 1: int8(m_ASCII_D),
  23865. 2: int8(m_ASCII_A),
  23866. 3: int8(m_ASCII_T),
  23867. 4: int8(m_ASCII_A),
  23868. 5: int8(m_ASCII_LSQB1),
  23869. }
  23870. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23871. var n Tsize_t
  23872. var v1, v2, v3 int32
  23873. _, _, _, _ = n, v1, v2, v3
  23874. if ptr >= end {
  23875. return -int32(4)
  23876. }
  23877. if int32(2) > int32(1) {
  23878. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23879. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23880. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23881. if n == uint64(0) {
  23882. return -int32(1)
  23883. }
  23884. end = ptr + uintptr(n)
  23885. }
  23886. }
  23887. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23888. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23889. } else {
  23890. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23891. }
  23892. switch v1 {
  23893. case int32(_BT_RSQB):
  23894. ptr += uintptr(2)
  23895. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23896. return -int32(1)
  23897. }
  23898. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  23899. break
  23900. }
  23901. ptr += uintptr(2)
  23902. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23903. return -int32(1)
  23904. }
  23905. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23906. ptr -= uintptr(2)
  23907. break
  23908. }
  23909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23910. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  23911. case int32(_BT_CR):
  23912. ptr += uintptr(2)
  23913. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23914. return -int32(1)
  23915. }
  23916. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23917. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23918. } else {
  23919. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23920. }
  23921. if v2 == int32(_BT_LF) {
  23922. ptr += uintptr(2)
  23923. }
  23924. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23925. return int32(m_XML_TOK_DATA_NEWLINE)
  23926. case int32(_BT_LF):
  23927. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23928. return int32(m_XML_TOK_DATA_NEWLINE)
  23929. case int32(_BT_LEAD2):
  23930. if int64(end)-int64(ptr) < int64(2) {
  23931. return -int32(2)
  23932. }
  23933. if 0 != 0 {
  23934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23935. return m_XML_TOK_INVALID
  23936. }
  23937. ptr += uintptr(2)
  23938. case int32(_BT_LEAD3):
  23939. if int64(end)-int64(ptr) < int64(3) {
  23940. return -int32(2)
  23941. }
  23942. if 0 != 0 {
  23943. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23944. return m_XML_TOK_INVALID
  23945. }
  23946. ptr += uintptr(3)
  23947. case int32(_BT_LEAD4):
  23948. if int64(end)-int64(ptr) < int64(4) {
  23949. return -int32(2)
  23950. }
  23951. if 0 != 0 {
  23952. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23953. return m_XML_TOK_INVALID
  23954. }
  23955. ptr += uintptr(4)
  23956. case int32(_BT_NONXML):
  23957. fallthrough
  23958. case int32(_BT_MALFORM):
  23959. fallthrough
  23960. case int32(_BT_TRAIL):
  23961. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23962. return m_XML_TOK_INVALID
  23963. default:
  23964. ptr += uintptr(2)
  23965. break
  23966. }
  23967. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23968. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23969. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23970. } else {
  23971. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23972. }
  23973. switch v3 {
  23974. case int32(_BT_LEAD2):
  23975. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  23976. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23977. return int32(m_XML_TOK_DATA_CHARS)
  23978. }
  23979. ptr += uintptr(2)
  23980. case int32(_BT_LEAD3):
  23981. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  23982. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23983. return int32(m_XML_TOK_DATA_CHARS)
  23984. }
  23985. ptr += uintptr(3)
  23986. case int32(_BT_LEAD4):
  23987. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  23988. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23989. return int32(m_XML_TOK_DATA_CHARS)
  23990. }
  23991. ptr += uintptr(4)
  23992. case int32(_BT_NONXML):
  23993. fallthrough
  23994. case int32(_BT_MALFORM):
  23995. fallthrough
  23996. case int32(_BT_TRAIL):
  23997. fallthrough
  23998. case int32(_BT_CR):
  23999. fallthrough
  24000. case int32(_BT_LF):
  24001. fallthrough
  24002. case int32(_BT_RSQB):
  24003. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24004. return int32(m_XML_TOK_DATA_CHARS)
  24005. default:
  24006. ptr += uintptr(2)
  24007. break
  24008. }
  24009. }
  24010. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24011. return int32(m_XML_TOK_DATA_CHARS)
  24012. }
  24013. /* ptr points to character following "</" */
  24014. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24015. var v1, v2, v22 int32
  24016. _, _, _ = v1, v2, v22
  24017. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24018. return -int32(1)
  24019. }
  24020. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24021. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24022. } else {
  24023. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24024. }
  24025. switch v1 {
  24026. case int32(_BT_NONASCII):
  24027. 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) {
  24028. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24029. return m_XML_TOK_INVALID
  24030. } /* fall through */
  24031. fallthrough
  24032. case int32(_BT_NMSTRT):
  24033. fallthrough
  24034. case int32(_BT_HEX):
  24035. ptr += uintptr(2)
  24036. case int32(_BT_LEAD2):
  24037. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24038. return -int32(2)
  24039. }
  24040. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24041. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24042. return m_XML_TOK_INVALID
  24043. }
  24044. ptr += uintptr(2)
  24045. case int32(_BT_LEAD3):
  24046. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24047. return -int32(2)
  24048. }
  24049. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24050. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24051. return m_XML_TOK_INVALID
  24052. }
  24053. ptr += uintptr(3)
  24054. case int32(_BT_LEAD4):
  24055. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24056. return -int32(2)
  24057. }
  24058. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24059. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24060. return m_XML_TOK_INVALID
  24061. }
  24062. ptr += uintptr(4)
  24063. default:
  24064. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24065. return m_XML_TOK_INVALID
  24066. }
  24067. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24068. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24069. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24070. } else {
  24071. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24072. }
  24073. switch v2 {
  24074. case int32(_BT_NONASCII):
  24075. goto _3
  24076. case int32(_BT_MINUS):
  24077. goto _4
  24078. case int32(_BT_NAME):
  24079. goto _5
  24080. case int32(_BT_DIGIT):
  24081. goto _6
  24082. case int32(_BT_HEX):
  24083. goto _7
  24084. case int32(_BT_NMSTRT):
  24085. goto _8
  24086. case int32(_BT_LEAD2):
  24087. goto _9
  24088. case int32(_BT_LEAD3):
  24089. goto _10
  24090. case int32(_BT_LEAD4):
  24091. goto _11
  24092. case int32(_BT_LF):
  24093. goto _12
  24094. case int32(_BT_CR):
  24095. goto _13
  24096. case int32(_BT_S):
  24097. goto _14
  24098. case int32(_BT_COLON):
  24099. goto _15
  24100. case int32(_BT_GT):
  24101. goto _16
  24102. default:
  24103. goto _17
  24104. }
  24105. goto _18
  24106. _3:
  24107. ;
  24108. 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) {
  24109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24110. return m_XML_TOK_INVALID
  24111. } /* fall through */
  24112. _8:
  24113. ;
  24114. _7:
  24115. ;
  24116. _6:
  24117. ;
  24118. _5:
  24119. ;
  24120. _4:
  24121. ;
  24122. ptr += uintptr(2)
  24123. goto _18
  24124. _9:
  24125. ;
  24126. if int64(end)-int64(ptr) < int64(2) {
  24127. return -int32(2)
  24128. }
  24129. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24130. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24131. return m_XML_TOK_INVALID
  24132. }
  24133. ptr += uintptr(2)
  24134. goto _18
  24135. _10:
  24136. ;
  24137. if int64(end)-int64(ptr) < int64(3) {
  24138. return -int32(2)
  24139. }
  24140. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24141. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24142. return m_XML_TOK_INVALID
  24143. }
  24144. ptr += uintptr(3)
  24145. goto _18
  24146. _11:
  24147. ;
  24148. if int64(end)-int64(ptr) < int64(4) {
  24149. return -int32(2)
  24150. }
  24151. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24153. return m_XML_TOK_INVALID
  24154. }
  24155. ptr += uintptr(4)
  24156. goto _18
  24157. _14:
  24158. ;
  24159. _13:
  24160. ;
  24161. _12:
  24162. ;
  24163. ptr += uintptr(2)
  24164. _21:
  24165. ;
  24166. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24167. goto _19
  24168. }
  24169. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24170. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24171. } else {
  24172. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24173. }
  24174. switch v22 {
  24175. case int32(_BT_S):
  24176. fallthrough
  24177. case int32(_BT_CR):
  24178. fallthrough
  24179. case int32(_BT_LF):
  24180. case int32(_BT_GT):
  24181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24182. return int32(m_XML_TOK_END_TAG)
  24183. default:
  24184. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24185. return m_XML_TOK_INVALID
  24186. }
  24187. goto _20
  24188. _20:
  24189. ;
  24190. ptr += uintptr(2)
  24191. goto _21
  24192. goto _19
  24193. _19:
  24194. ;
  24195. return -int32(1)
  24196. _15:
  24197. ;
  24198. /* no need to check qname syntax here,
  24199. since end-tag must match exactly */
  24200. ptr += uintptr(2)
  24201. goto _18
  24202. _16:
  24203. ;
  24204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24205. return int32(m_XML_TOK_END_TAG)
  24206. _17:
  24207. ;
  24208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24209. return m_XML_TOK_INVALID
  24210. _18:
  24211. }
  24212. return -int32(1)
  24213. }
  24214. /* ptr points to character following "&#X" */
  24215. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24216. var v1, v3 int32
  24217. _, _ = v1, v3
  24218. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24219. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24220. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24221. } else {
  24222. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24223. }
  24224. switch v1 {
  24225. case int32(_BT_DIGIT):
  24226. fallthrough
  24227. case int32(_BT_HEX):
  24228. default:
  24229. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24230. return m_XML_TOK_INVALID
  24231. }
  24232. ptr += uintptr(2)
  24233. for {
  24234. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24235. break
  24236. }
  24237. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24238. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24239. } else {
  24240. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24241. }
  24242. switch v3 {
  24243. case int32(_BT_DIGIT):
  24244. fallthrough
  24245. case int32(_BT_HEX):
  24246. case int32(_BT_SEMI):
  24247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24248. return int32(m_XML_TOK_CHAR_REF)
  24249. default:
  24250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24251. return m_XML_TOK_INVALID
  24252. }
  24253. goto _2
  24254. _2:
  24255. ;
  24256. ptr += uintptr(2)
  24257. }
  24258. }
  24259. return -int32(1)
  24260. }
  24261. /* ptr points to character following "&#" */
  24262. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24263. var v1, v3 int32
  24264. _, _ = v1, v3
  24265. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24266. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24267. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24268. }
  24269. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24270. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24271. } else {
  24272. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24273. }
  24274. switch v1 {
  24275. case int32(_BT_DIGIT):
  24276. default:
  24277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24278. return m_XML_TOK_INVALID
  24279. }
  24280. ptr += uintptr(2)
  24281. for {
  24282. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24283. break
  24284. }
  24285. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24286. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24287. } else {
  24288. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24289. }
  24290. switch v3 {
  24291. case int32(_BT_DIGIT):
  24292. case int32(_BT_SEMI):
  24293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24294. return int32(m_XML_TOK_CHAR_REF)
  24295. default:
  24296. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24297. return m_XML_TOK_INVALID
  24298. }
  24299. goto _2
  24300. _2:
  24301. ;
  24302. ptr += uintptr(2)
  24303. }
  24304. }
  24305. return -int32(1)
  24306. }
  24307. /* ptr points to character following "&" */
  24308. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24309. var v1, v2 int32
  24310. _, _ = v1, v2
  24311. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24312. return -int32(1)
  24313. }
  24314. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24315. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24316. } else {
  24317. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24318. }
  24319. switch v1 {
  24320. case int32(_BT_NONASCII):
  24321. 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) {
  24322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24323. return m_XML_TOK_INVALID
  24324. } /* fall through */
  24325. fallthrough
  24326. case int32(_BT_NMSTRT):
  24327. fallthrough
  24328. case int32(_BT_HEX):
  24329. ptr += uintptr(2)
  24330. case int32(_BT_LEAD2):
  24331. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24332. return -int32(2)
  24333. }
  24334. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24335. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24336. return m_XML_TOK_INVALID
  24337. }
  24338. ptr += uintptr(2)
  24339. case int32(_BT_LEAD3):
  24340. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24341. return -int32(2)
  24342. }
  24343. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24345. return m_XML_TOK_INVALID
  24346. }
  24347. ptr += uintptr(3)
  24348. case int32(_BT_LEAD4):
  24349. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24350. return -int32(2)
  24351. }
  24352. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24354. return m_XML_TOK_INVALID
  24355. }
  24356. ptr += uintptr(4)
  24357. case int32(_BT_NUM):
  24358. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24359. default:
  24360. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24361. return m_XML_TOK_INVALID
  24362. }
  24363. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24364. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24365. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24366. } else {
  24367. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24368. }
  24369. switch v2 {
  24370. case int32(_BT_NONASCII):
  24371. 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) {
  24372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24373. return m_XML_TOK_INVALID
  24374. } /* fall through */
  24375. fallthrough
  24376. case int32(_BT_NMSTRT):
  24377. fallthrough
  24378. case int32(_BT_HEX):
  24379. fallthrough
  24380. case int32(_BT_DIGIT):
  24381. fallthrough
  24382. case int32(_BT_NAME):
  24383. fallthrough
  24384. case int32(_BT_MINUS):
  24385. ptr += uintptr(2)
  24386. case int32(_BT_LEAD2):
  24387. if int64(end)-int64(ptr) < int64(2) {
  24388. return -int32(2)
  24389. }
  24390. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24391. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24392. return m_XML_TOK_INVALID
  24393. }
  24394. ptr += uintptr(2)
  24395. case int32(_BT_LEAD3):
  24396. if int64(end)-int64(ptr) < int64(3) {
  24397. return -int32(2)
  24398. }
  24399. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24401. return m_XML_TOK_INVALID
  24402. }
  24403. ptr += uintptr(3)
  24404. case int32(_BT_LEAD4):
  24405. if int64(end)-int64(ptr) < int64(4) {
  24406. return -int32(2)
  24407. }
  24408. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24410. return m_XML_TOK_INVALID
  24411. }
  24412. ptr += uintptr(4)
  24413. case int32(_BT_SEMI):
  24414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24415. return int32(m_XML_TOK_ENTITY_REF)
  24416. default:
  24417. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24418. return m_XML_TOK_INVALID
  24419. }
  24420. }
  24421. return -int32(1)
  24422. }
  24423. /* ptr points to character following first character of attribute name */
  24424. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24425. bp := tls.Alloc(16)
  24426. defer tls.Free(16)
  24427. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24428. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24429. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24430. hadColon = 0
  24431. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24432. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24433. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24434. } else {
  24435. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24436. }
  24437. switch v1 {
  24438. case int32(_BT_NONASCII):
  24439. goto _2
  24440. case int32(_BT_MINUS):
  24441. goto _3
  24442. case int32(_BT_NAME):
  24443. goto _4
  24444. case int32(_BT_DIGIT):
  24445. goto _5
  24446. case int32(_BT_HEX):
  24447. goto _6
  24448. case int32(_BT_NMSTRT):
  24449. goto _7
  24450. case int32(_BT_LEAD2):
  24451. goto _8
  24452. case int32(_BT_LEAD3):
  24453. goto _9
  24454. case int32(_BT_LEAD4):
  24455. goto _10
  24456. case int32(_BT_COLON):
  24457. goto _11
  24458. case int32(_BT_LF):
  24459. goto _12
  24460. case int32(_BT_CR):
  24461. goto _13
  24462. case int32(_BT_S):
  24463. goto _14
  24464. case int32(_BT_EQUALS):
  24465. goto _15
  24466. default:
  24467. goto _16
  24468. }
  24469. goto _17
  24470. _2:
  24471. ;
  24472. 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) {
  24473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24474. return m_XML_TOK_INVALID
  24475. } /* fall through */
  24476. _7:
  24477. ;
  24478. _6:
  24479. ;
  24480. _5:
  24481. ;
  24482. _4:
  24483. ;
  24484. _3:
  24485. ;
  24486. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24487. goto _17
  24488. _8:
  24489. ;
  24490. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24491. return -int32(2)
  24492. }
  24493. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24494. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24495. return m_XML_TOK_INVALID
  24496. }
  24497. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24498. goto _17
  24499. _9:
  24500. ;
  24501. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24502. return -int32(2)
  24503. }
  24504. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24506. return m_XML_TOK_INVALID
  24507. }
  24508. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24509. goto _17
  24510. _10:
  24511. ;
  24512. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24513. return -int32(2)
  24514. }
  24515. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24517. return m_XML_TOK_INVALID
  24518. }
  24519. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24520. goto _17
  24521. _11:
  24522. ;
  24523. if hadColon != 0 {
  24524. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24525. return m_XML_TOK_INVALID
  24526. }
  24527. hadColon = int32(1)
  24528. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24529. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24530. return -int32(1)
  24531. }
  24532. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24533. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24534. } else {
  24535. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24536. }
  24537. switch v18 {
  24538. case int32(_BT_NONASCII):
  24539. 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) {
  24540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24541. return m_XML_TOK_INVALID
  24542. } /* fall through */
  24543. fallthrough
  24544. case int32(_BT_NMSTRT):
  24545. fallthrough
  24546. case int32(_BT_HEX):
  24547. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24548. case int32(_BT_LEAD2):
  24549. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24550. return -int32(2)
  24551. }
  24552. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24554. return m_XML_TOK_INVALID
  24555. }
  24556. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24557. case int32(_BT_LEAD3):
  24558. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24559. return -int32(2)
  24560. }
  24561. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24563. return m_XML_TOK_INVALID
  24564. }
  24565. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24566. case int32(_BT_LEAD4):
  24567. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24568. return -int32(2)
  24569. }
  24570. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24571. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24572. return m_XML_TOK_INVALID
  24573. }
  24574. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24575. default:
  24576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24577. return m_XML_TOK_INVALID
  24578. }
  24579. goto _17
  24580. _14:
  24581. ;
  24582. _13:
  24583. ;
  24584. _12:
  24585. ;
  24586. _21:
  24587. ;
  24588. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24589. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24590. return -int32(1)
  24591. }
  24592. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24593. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24594. } else {
  24595. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24596. }
  24597. t = v22
  24598. if t == int32(_BT_EQUALS) {
  24599. goto _19
  24600. }
  24601. switch t {
  24602. case int32(_BT_S):
  24603. fallthrough
  24604. case int32(_BT_LF):
  24605. fallthrough
  24606. case int32(_BT_CR):
  24607. default:
  24608. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24609. return m_XML_TOK_INVALID
  24610. }
  24611. goto _20
  24612. _20:
  24613. ;
  24614. goto _21
  24615. goto _19
  24616. _19:
  24617. ;
  24618. /* fall through */
  24619. _15:
  24620. ;
  24621. hadColon = 0
  24622. for {
  24623. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24624. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24625. return -int32(1)
  24626. }
  24627. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24628. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24629. } else {
  24630. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24631. }
  24632. open = v24
  24633. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24634. break
  24635. }
  24636. switch open {
  24637. case int32(_BT_S):
  24638. fallthrough
  24639. case int32(_BT_LF):
  24640. fallthrough
  24641. case int32(_BT_CR):
  24642. default:
  24643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24644. return m_XML_TOK_INVALID
  24645. }
  24646. goto _23
  24647. _23:
  24648. }
  24649. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24650. /* in attribute value */
  24651. for {
  24652. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24653. return -int32(1)
  24654. }
  24655. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24656. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24657. } else {
  24658. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24659. }
  24660. t1 = v26
  24661. if t1 == open {
  24662. break
  24663. }
  24664. switch t1 {
  24665. case int32(_BT_LEAD2):
  24666. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24667. return -int32(2)
  24668. }
  24669. if 0 != 0 {
  24670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24671. return m_XML_TOK_INVALID
  24672. }
  24673. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24674. case int32(_BT_LEAD3):
  24675. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24676. return -int32(2)
  24677. }
  24678. if 0 != 0 {
  24679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24680. return m_XML_TOK_INVALID
  24681. }
  24682. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24683. case int32(_BT_LEAD4):
  24684. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24685. return -int32(2)
  24686. }
  24687. if 0 != 0 {
  24688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24689. return m_XML_TOK_INVALID
  24690. }
  24691. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24692. case int32(_BT_NONXML):
  24693. fallthrough
  24694. case int32(_BT_MALFORM):
  24695. fallthrough
  24696. case int32(_BT_TRAIL):
  24697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24698. return m_XML_TOK_INVALID
  24699. case int32(_BT_AMP):
  24700. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24701. if tok <= 0 {
  24702. if tok == m_XML_TOK_INVALID {
  24703. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24704. }
  24705. return tok
  24706. }
  24707. case int32(_BT_LT):
  24708. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24709. return m_XML_TOK_INVALID
  24710. default:
  24711. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24712. break
  24713. }
  24714. goto _25
  24715. _25:
  24716. }
  24717. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24718. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24719. return -int32(1)
  24720. }
  24721. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24722. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24723. } else {
  24724. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24725. }
  24726. switch v27 {
  24727. case int32(_BT_S):
  24728. fallthrough
  24729. case int32(_BT_CR):
  24730. fallthrough
  24731. case int32(_BT_LF):
  24732. case int32(_BT_SOL):
  24733. goto sol
  24734. case int32(_BT_GT):
  24735. goto gt
  24736. default:
  24737. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24738. return m_XML_TOK_INVALID
  24739. }
  24740. /* ptr points to closing quote */
  24741. _30:
  24742. ;
  24743. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24744. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24745. return -int32(1)
  24746. }
  24747. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24748. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24749. } else {
  24750. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24751. }
  24752. switch v31 {
  24753. case int32(_BT_NONASCII):
  24754. goto _32
  24755. case int32(_BT_HEX):
  24756. goto _33
  24757. case int32(_BT_NMSTRT):
  24758. goto _34
  24759. case int32(_BT_LEAD2):
  24760. goto _35
  24761. case int32(_BT_LEAD3):
  24762. goto _36
  24763. case int32(_BT_LEAD4):
  24764. goto _37
  24765. case int32(_BT_LF):
  24766. goto _38
  24767. case int32(_BT_CR):
  24768. goto _39
  24769. case int32(_BT_S):
  24770. goto _40
  24771. case int32(_BT_GT):
  24772. goto _41
  24773. case int32(_BT_SOL):
  24774. goto _42
  24775. default:
  24776. goto _43
  24777. }
  24778. goto _44
  24779. _32:
  24780. ;
  24781. 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) {
  24782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24783. return m_XML_TOK_INVALID
  24784. } /* fall through */
  24785. _34:
  24786. ;
  24787. _33:
  24788. ;
  24789. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24790. goto _44
  24791. _35:
  24792. ;
  24793. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24794. return -int32(2)
  24795. }
  24796. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24798. return m_XML_TOK_INVALID
  24799. }
  24800. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24801. goto _44
  24802. _36:
  24803. ;
  24804. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24805. return -int32(2)
  24806. }
  24807. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24809. return m_XML_TOK_INVALID
  24810. }
  24811. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24812. goto _44
  24813. _37:
  24814. ;
  24815. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24816. return -int32(2)
  24817. }
  24818. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24820. return m_XML_TOK_INVALID
  24821. }
  24822. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24823. goto _44
  24824. _40:
  24825. ;
  24826. _39:
  24827. ;
  24828. _38:
  24829. ;
  24830. goto _29
  24831. _41:
  24832. ;
  24833. goto gt
  24834. gt:
  24835. ;
  24836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24837. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24838. _42:
  24839. ;
  24840. goto sol
  24841. sol:
  24842. ;
  24843. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24844. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24845. return -int32(1)
  24846. }
  24847. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  24848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24849. return m_XML_TOK_INVALID
  24850. }
  24851. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24852. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  24853. _43:
  24854. ;
  24855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24856. return m_XML_TOK_INVALID
  24857. _44:
  24858. ;
  24859. goto _28
  24860. goto _29
  24861. _29:
  24862. ;
  24863. goto _30
  24864. goto _28
  24865. _28:
  24866. ;
  24867. goto _17
  24868. _16:
  24869. ;
  24870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24871. return m_XML_TOK_INVALID
  24872. _17:
  24873. }
  24874. return -int32(1)
  24875. }
  24876. /* ptr points to character following "<" */
  24877. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24878. var hadColon, v1, v2, v21, v22, v3 int32
  24879. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  24880. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24881. return -int32(1)
  24882. }
  24883. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24884. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24885. } else {
  24886. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24887. }
  24888. switch v1 {
  24889. case int32(_BT_NONASCII):
  24890. 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) {
  24891. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24892. return m_XML_TOK_INVALID
  24893. } /* fall through */
  24894. fallthrough
  24895. case int32(_BT_NMSTRT):
  24896. fallthrough
  24897. case int32(_BT_HEX):
  24898. ptr += uintptr(2)
  24899. case int32(_BT_LEAD2):
  24900. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24901. return -int32(2)
  24902. }
  24903. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24905. return m_XML_TOK_INVALID
  24906. }
  24907. ptr += uintptr(2)
  24908. case int32(_BT_LEAD3):
  24909. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24910. return -int32(2)
  24911. }
  24912. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24914. return m_XML_TOK_INVALID
  24915. }
  24916. ptr += uintptr(3)
  24917. case int32(_BT_LEAD4):
  24918. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24919. return -int32(2)
  24920. }
  24921. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24923. return m_XML_TOK_INVALID
  24924. }
  24925. ptr += uintptr(4)
  24926. case int32(_BT_EXCL):
  24927. ptr += uintptr(2)
  24928. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24929. return -int32(1)
  24930. }
  24931. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24932. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24933. } else {
  24934. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24935. }
  24936. switch v2 {
  24937. case int32(_BT_MINUS):
  24938. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24939. case int32(_BT_LSQB):
  24940. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24941. }
  24942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24943. return m_XML_TOK_INVALID
  24944. case int32(_BT_QUEST):
  24945. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24946. case int32(_BT_SOL):
  24947. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24948. default:
  24949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24950. return m_XML_TOK_INVALID
  24951. }
  24952. hadColon = 0
  24953. /* we have a start-tag */
  24954. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24955. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24956. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24957. } else {
  24958. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24959. }
  24960. switch v3 {
  24961. case int32(_BT_NONASCII):
  24962. goto _4
  24963. case int32(_BT_MINUS):
  24964. goto _5
  24965. case int32(_BT_NAME):
  24966. goto _6
  24967. case int32(_BT_DIGIT):
  24968. goto _7
  24969. case int32(_BT_HEX):
  24970. goto _8
  24971. case int32(_BT_NMSTRT):
  24972. goto _9
  24973. case int32(_BT_LEAD2):
  24974. goto _10
  24975. case int32(_BT_LEAD3):
  24976. goto _11
  24977. case int32(_BT_LEAD4):
  24978. goto _12
  24979. case int32(_BT_COLON):
  24980. goto _13
  24981. case int32(_BT_LF):
  24982. goto _14
  24983. case int32(_BT_CR):
  24984. goto _15
  24985. case int32(_BT_S):
  24986. goto _16
  24987. case int32(_BT_GT):
  24988. goto _17
  24989. case int32(_BT_SOL):
  24990. goto _18
  24991. default:
  24992. goto _19
  24993. }
  24994. goto _20
  24995. _4:
  24996. ;
  24997. 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) {
  24998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24999. return m_XML_TOK_INVALID
  25000. } /* fall through */
  25001. _9:
  25002. ;
  25003. _8:
  25004. ;
  25005. _7:
  25006. ;
  25007. _6:
  25008. ;
  25009. _5:
  25010. ;
  25011. ptr += uintptr(2)
  25012. goto _20
  25013. _10:
  25014. ;
  25015. if int64(end)-int64(ptr) < int64(2) {
  25016. return -int32(2)
  25017. }
  25018. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25019. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25020. return m_XML_TOK_INVALID
  25021. }
  25022. ptr += uintptr(2)
  25023. goto _20
  25024. _11:
  25025. ;
  25026. if int64(end)-int64(ptr) < int64(3) {
  25027. return -int32(2)
  25028. }
  25029. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25030. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25031. return m_XML_TOK_INVALID
  25032. }
  25033. ptr += uintptr(3)
  25034. goto _20
  25035. _12:
  25036. ;
  25037. if int64(end)-int64(ptr) < int64(4) {
  25038. return -int32(2)
  25039. }
  25040. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25041. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25042. return m_XML_TOK_INVALID
  25043. }
  25044. ptr += uintptr(4)
  25045. goto _20
  25046. _13:
  25047. ;
  25048. if hadColon != 0 {
  25049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25050. return m_XML_TOK_INVALID
  25051. }
  25052. hadColon = int32(1)
  25053. ptr += uintptr(2)
  25054. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25055. return -int32(1)
  25056. }
  25057. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25058. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25059. } else {
  25060. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25061. }
  25062. switch v21 {
  25063. case int32(_BT_NONASCII):
  25064. 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) {
  25065. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25066. return m_XML_TOK_INVALID
  25067. } /* fall through */
  25068. fallthrough
  25069. case int32(_BT_NMSTRT):
  25070. fallthrough
  25071. case int32(_BT_HEX):
  25072. ptr += uintptr(2)
  25073. case int32(_BT_LEAD2):
  25074. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25075. return -int32(2)
  25076. }
  25077. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25079. return m_XML_TOK_INVALID
  25080. }
  25081. ptr += uintptr(2)
  25082. case int32(_BT_LEAD3):
  25083. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25084. return -int32(2)
  25085. }
  25086. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25087. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25088. return m_XML_TOK_INVALID
  25089. }
  25090. ptr += uintptr(3)
  25091. case int32(_BT_LEAD4):
  25092. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25093. return -int32(2)
  25094. }
  25095. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25096. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25097. return m_XML_TOK_INVALID
  25098. }
  25099. ptr += uintptr(4)
  25100. default:
  25101. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25102. return m_XML_TOK_INVALID
  25103. }
  25104. goto _20
  25105. _16:
  25106. ;
  25107. _15:
  25108. ;
  25109. _14:
  25110. ;
  25111. ptr += uintptr(2)
  25112. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25113. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25114. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25115. } else {
  25116. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25117. }
  25118. switch v22 {
  25119. case int32(_BT_NONASCII):
  25120. 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) {
  25121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25122. return m_XML_TOK_INVALID
  25123. } /* fall through */
  25124. fallthrough
  25125. case int32(_BT_NMSTRT):
  25126. fallthrough
  25127. case int32(_BT_HEX):
  25128. ptr += uintptr(2)
  25129. case int32(_BT_LEAD2):
  25130. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25131. return -int32(2)
  25132. }
  25133. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25134. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25135. return m_XML_TOK_INVALID
  25136. }
  25137. ptr += uintptr(2)
  25138. case int32(_BT_LEAD3):
  25139. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25140. return -int32(2)
  25141. }
  25142. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25143. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25144. return m_XML_TOK_INVALID
  25145. }
  25146. ptr += uintptr(3)
  25147. case int32(_BT_LEAD4):
  25148. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25149. return -int32(2)
  25150. }
  25151. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25153. return m_XML_TOK_INVALID
  25154. }
  25155. ptr += uintptr(4)
  25156. case int32(_BT_GT):
  25157. goto gt
  25158. case int32(_BT_SOL):
  25159. goto sol
  25160. case int32(_BT_S):
  25161. fallthrough
  25162. case int32(_BT_CR):
  25163. fallthrough
  25164. case int32(_BT_LF):
  25165. ptr += uintptr(2)
  25166. continue
  25167. default:
  25168. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25169. return m_XML_TOK_INVALID
  25170. }
  25171. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25172. }
  25173. return -int32(1)
  25174. _17:
  25175. ;
  25176. goto gt
  25177. gt:
  25178. ;
  25179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25180. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25181. _18:
  25182. ;
  25183. goto sol
  25184. sol:
  25185. ;
  25186. ptr += uintptr(2)
  25187. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25188. return -int32(1)
  25189. }
  25190. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25192. return m_XML_TOK_INVALID
  25193. }
  25194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25195. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25196. _19:
  25197. ;
  25198. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25199. return m_XML_TOK_INVALID
  25200. _20:
  25201. }
  25202. return -int32(1)
  25203. }
  25204. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25205. var n Tsize_t
  25206. var v1, v2, v3 int32
  25207. _, _, _, _ = n, v1, v2, v3
  25208. if ptr >= end {
  25209. return -int32(4)
  25210. }
  25211. if int32(2) > int32(1) {
  25212. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25213. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25214. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25215. if n == uint64(0) {
  25216. return -int32(1)
  25217. }
  25218. end = ptr + uintptr(n)
  25219. }
  25220. }
  25221. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25222. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25223. } else {
  25224. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25225. }
  25226. switch v1 {
  25227. case int32(_BT_LT):
  25228. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25229. case int32(_BT_AMP):
  25230. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25231. case int32(_BT_CR):
  25232. ptr += uintptr(2)
  25233. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25234. return -int32(3)
  25235. }
  25236. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25237. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25238. } else {
  25239. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25240. }
  25241. if v2 == int32(_BT_LF) {
  25242. ptr += uintptr(2)
  25243. }
  25244. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25245. return int32(m_XML_TOK_DATA_NEWLINE)
  25246. case int32(_BT_LF):
  25247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25248. return int32(m_XML_TOK_DATA_NEWLINE)
  25249. case int32(_BT_RSQB):
  25250. ptr += uintptr(2)
  25251. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25252. return -int32(5)
  25253. }
  25254. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25255. break
  25256. }
  25257. ptr += uintptr(2)
  25258. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25259. return -int32(5)
  25260. }
  25261. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25262. ptr -= uintptr(2)
  25263. break
  25264. }
  25265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25266. return m_XML_TOK_INVALID
  25267. case int32(_BT_LEAD2):
  25268. if int64(end)-int64(ptr) < int64(2) {
  25269. return -int32(2)
  25270. }
  25271. if 0 != 0 {
  25272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25273. return m_XML_TOK_INVALID
  25274. }
  25275. ptr += uintptr(2)
  25276. case int32(_BT_LEAD3):
  25277. if int64(end)-int64(ptr) < int64(3) {
  25278. return -int32(2)
  25279. }
  25280. if 0 != 0 {
  25281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25282. return m_XML_TOK_INVALID
  25283. }
  25284. ptr += uintptr(3)
  25285. case int32(_BT_LEAD4):
  25286. if int64(end)-int64(ptr) < int64(4) {
  25287. return -int32(2)
  25288. }
  25289. if 0 != 0 {
  25290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25291. return m_XML_TOK_INVALID
  25292. }
  25293. ptr += uintptr(4)
  25294. case int32(_BT_NONXML):
  25295. fallthrough
  25296. case int32(_BT_MALFORM):
  25297. fallthrough
  25298. case int32(_BT_TRAIL):
  25299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25300. return m_XML_TOK_INVALID
  25301. default:
  25302. ptr += uintptr(2)
  25303. break
  25304. }
  25305. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25306. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25307. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25308. } else {
  25309. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25310. }
  25311. switch v3 {
  25312. case int32(_BT_LEAD2):
  25313. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  25314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25315. return int32(m_XML_TOK_DATA_CHARS)
  25316. }
  25317. ptr += uintptr(2)
  25318. case int32(_BT_LEAD3):
  25319. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  25320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25321. return int32(m_XML_TOK_DATA_CHARS)
  25322. }
  25323. ptr += uintptr(3)
  25324. case int32(_BT_LEAD4):
  25325. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  25326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25327. return int32(m_XML_TOK_DATA_CHARS)
  25328. }
  25329. ptr += uintptr(4)
  25330. case int32(_BT_RSQB):
  25331. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25332. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  25333. ptr += uintptr(2)
  25334. break
  25335. }
  25336. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  25337. 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)) {
  25338. ptr += uintptr(2)
  25339. break
  25340. }
  25341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25342. return m_XML_TOK_INVALID
  25343. }
  25344. }
  25345. /* fall through */
  25346. fallthrough
  25347. case int32(_BT_AMP):
  25348. fallthrough
  25349. case int32(_BT_LT):
  25350. fallthrough
  25351. case int32(_BT_NONXML):
  25352. fallthrough
  25353. case int32(_BT_MALFORM):
  25354. fallthrough
  25355. case int32(_BT_TRAIL):
  25356. fallthrough
  25357. case int32(_BT_CR):
  25358. fallthrough
  25359. case int32(_BT_LF):
  25360. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25361. return int32(m_XML_TOK_DATA_CHARS)
  25362. default:
  25363. ptr += uintptr(2)
  25364. break
  25365. }
  25366. }
  25367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25368. return int32(m_XML_TOK_DATA_CHARS)
  25369. }
  25370. /* ptr points to character following "%" */
  25371. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25372. var v1, v2 int32
  25373. _, _ = v1, v2
  25374. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25375. return -int32(1)
  25376. }
  25377. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25378. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25379. } else {
  25380. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25381. }
  25382. switch v1 {
  25383. case int32(_BT_NONASCII):
  25384. 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) {
  25385. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25386. return m_XML_TOK_INVALID
  25387. } /* fall through */
  25388. fallthrough
  25389. case int32(_BT_NMSTRT):
  25390. fallthrough
  25391. case int32(_BT_HEX):
  25392. ptr += uintptr(2)
  25393. case int32(_BT_LEAD2):
  25394. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25395. return -int32(2)
  25396. }
  25397. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25399. return m_XML_TOK_INVALID
  25400. }
  25401. ptr += uintptr(2)
  25402. case int32(_BT_LEAD3):
  25403. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25404. return -int32(2)
  25405. }
  25406. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25407. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25408. return m_XML_TOK_INVALID
  25409. }
  25410. ptr += uintptr(3)
  25411. case int32(_BT_LEAD4):
  25412. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25413. return -int32(2)
  25414. }
  25415. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25416. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25417. return m_XML_TOK_INVALID
  25418. }
  25419. ptr += uintptr(4)
  25420. case int32(_BT_S):
  25421. fallthrough
  25422. case int32(_BT_LF):
  25423. fallthrough
  25424. case int32(_BT_CR):
  25425. fallthrough
  25426. case int32(_BT_PERCNT):
  25427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25428. return int32(m_XML_TOK_PERCENT)
  25429. default:
  25430. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25431. return m_XML_TOK_INVALID
  25432. }
  25433. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25434. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25435. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25436. } else {
  25437. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25438. }
  25439. switch v2 {
  25440. case int32(_BT_NONASCII):
  25441. 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) {
  25442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25443. return m_XML_TOK_INVALID
  25444. } /* fall through */
  25445. fallthrough
  25446. case int32(_BT_NMSTRT):
  25447. fallthrough
  25448. case int32(_BT_HEX):
  25449. fallthrough
  25450. case int32(_BT_DIGIT):
  25451. fallthrough
  25452. case int32(_BT_NAME):
  25453. fallthrough
  25454. case int32(_BT_MINUS):
  25455. ptr += uintptr(2)
  25456. case int32(_BT_LEAD2):
  25457. if int64(end)-int64(ptr) < int64(2) {
  25458. return -int32(2)
  25459. }
  25460. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25462. return m_XML_TOK_INVALID
  25463. }
  25464. ptr += uintptr(2)
  25465. case int32(_BT_LEAD3):
  25466. if int64(end)-int64(ptr) < int64(3) {
  25467. return -int32(2)
  25468. }
  25469. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25470. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25471. return m_XML_TOK_INVALID
  25472. }
  25473. ptr += uintptr(3)
  25474. case int32(_BT_LEAD4):
  25475. if int64(end)-int64(ptr) < int64(4) {
  25476. return -int32(2)
  25477. }
  25478. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25480. return m_XML_TOK_INVALID
  25481. }
  25482. ptr += uintptr(4)
  25483. case int32(_BT_SEMI):
  25484. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25485. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25486. default:
  25487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25488. return m_XML_TOK_INVALID
  25489. }
  25490. }
  25491. return -int32(1)
  25492. }
  25493. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25494. var v1, v2 int32
  25495. _, _ = v1, v2
  25496. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25497. return -int32(1)
  25498. }
  25499. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25500. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25501. } else {
  25502. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25503. }
  25504. switch v1 {
  25505. case int32(_BT_NONASCII):
  25506. 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) {
  25507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25508. return m_XML_TOK_INVALID
  25509. } /* fall through */
  25510. fallthrough
  25511. case int32(_BT_NMSTRT):
  25512. fallthrough
  25513. case int32(_BT_HEX):
  25514. ptr += uintptr(2)
  25515. case int32(_BT_LEAD2):
  25516. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25517. return -int32(2)
  25518. }
  25519. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25521. return m_XML_TOK_INVALID
  25522. }
  25523. ptr += uintptr(2)
  25524. case int32(_BT_LEAD3):
  25525. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25526. return -int32(2)
  25527. }
  25528. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25530. return m_XML_TOK_INVALID
  25531. }
  25532. ptr += uintptr(3)
  25533. case int32(_BT_LEAD4):
  25534. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25535. return -int32(2)
  25536. }
  25537. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25538. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25539. return m_XML_TOK_INVALID
  25540. }
  25541. ptr += uintptr(4)
  25542. default:
  25543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25544. return m_XML_TOK_INVALID
  25545. }
  25546. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25547. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25548. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25549. } else {
  25550. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25551. }
  25552. switch v2 {
  25553. case int32(_BT_NONASCII):
  25554. 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) {
  25555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25556. return m_XML_TOK_INVALID
  25557. } /* fall through */
  25558. fallthrough
  25559. case int32(_BT_NMSTRT):
  25560. fallthrough
  25561. case int32(_BT_HEX):
  25562. fallthrough
  25563. case int32(_BT_DIGIT):
  25564. fallthrough
  25565. case int32(_BT_NAME):
  25566. fallthrough
  25567. case int32(_BT_MINUS):
  25568. ptr += uintptr(2)
  25569. case int32(_BT_LEAD2):
  25570. if int64(end)-int64(ptr) < int64(2) {
  25571. return -int32(2)
  25572. }
  25573. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25575. return m_XML_TOK_INVALID
  25576. }
  25577. ptr += uintptr(2)
  25578. case int32(_BT_LEAD3):
  25579. if int64(end)-int64(ptr) < int64(3) {
  25580. return -int32(2)
  25581. }
  25582. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25584. return m_XML_TOK_INVALID
  25585. }
  25586. ptr += uintptr(3)
  25587. case int32(_BT_LEAD4):
  25588. if int64(end)-int64(ptr) < int64(4) {
  25589. return -int32(2)
  25590. }
  25591. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25592. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25593. return m_XML_TOK_INVALID
  25594. }
  25595. ptr += uintptr(4)
  25596. case int32(_BT_CR):
  25597. fallthrough
  25598. case int32(_BT_LF):
  25599. fallthrough
  25600. case int32(_BT_S):
  25601. fallthrough
  25602. case int32(_BT_RPAR):
  25603. fallthrough
  25604. case int32(_BT_GT):
  25605. fallthrough
  25606. case int32(_BT_PERCNT):
  25607. fallthrough
  25608. case int32(_BT_VERBAR):
  25609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25610. return int32(m_XML_TOK_POUND_NAME)
  25611. default:
  25612. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25613. return m_XML_TOK_INVALID
  25614. }
  25615. }
  25616. return -int32(m_XML_TOK_POUND_NAME)
  25617. }
  25618. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25619. var t, v1, v2 int32
  25620. _, _, _ = t, v1, v2
  25621. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25622. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25623. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25624. } else {
  25625. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25626. }
  25627. t = v1
  25628. switch t {
  25629. case int32(_BT_LEAD2):
  25630. if int64(end)-int64(ptr) < int64(2) {
  25631. return -int32(2)
  25632. }
  25633. if 0 != 0 {
  25634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25635. return m_XML_TOK_INVALID
  25636. }
  25637. ptr += uintptr(2)
  25638. case int32(_BT_LEAD3):
  25639. if int64(end)-int64(ptr) < int64(3) {
  25640. return -int32(2)
  25641. }
  25642. if 0 != 0 {
  25643. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25644. return m_XML_TOK_INVALID
  25645. }
  25646. ptr += uintptr(3)
  25647. case int32(_BT_LEAD4):
  25648. if int64(end)-int64(ptr) < int64(4) {
  25649. return -int32(2)
  25650. }
  25651. if 0 != 0 {
  25652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25653. return m_XML_TOK_INVALID
  25654. }
  25655. ptr += uintptr(4)
  25656. case int32(_BT_NONXML):
  25657. fallthrough
  25658. case int32(_BT_MALFORM):
  25659. fallthrough
  25660. case int32(_BT_TRAIL):
  25661. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25662. return m_XML_TOK_INVALID
  25663. case int32(_BT_QUOT):
  25664. fallthrough
  25665. case int32(_BT_APOS):
  25666. ptr += uintptr(2)
  25667. if t != open {
  25668. break
  25669. }
  25670. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25671. return -int32(m_XML_TOK_LITERAL)
  25672. }
  25673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25674. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25675. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25676. } else {
  25677. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25678. }
  25679. switch v2 {
  25680. case int32(_BT_S):
  25681. fallthrough
  25682. case int32(_BT_CR):
  25683. fallthrough
  25684. case int32(_BT_LF):
  25685. fallthrough
  25686. case int32(_BT_GT):
  25687. fallthrough
  25688. case int32(_BT_PERCNT):
  25689. fallthrough
  25690. case int32(_BT_LSQB):
  25691. return int32(m_XML_TOK_LITERAL)
  25692. default:
  25693. return m_XML_TOK_INVALID
  25694. }
  25695. fallthrough
  25696. default:
  25697. ptr += uintptr(2)
  25698. break
  25699. }
  25700. }
  25701. return -int32(1)
  25702. }
  25703. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25704. var n Tsize_t
  25705. var tok, v1, v29, v33, v34, v35, v36 int32
  25706. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25707. if ptr >= end {
  25708. return -int32(4)
  25709. }
  25710. if int32(2) > int32(1) {
  25711. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25712. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25713. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25714. if n == uint64(0) {
  25715. return -int32(1)
  25716. }
  25717. end = ptr + uintptr(n)
  25718. }
  25719. }
  25720. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25721. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25722. } else {
  25723. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25724. }
  25725. switch v1 {
  25726. case int32(_BT_QUOT):
  25727. goto _2
  25728. case int32(_BT_APOS):
  25729. goto _3
  25730. case int32(_BT_LT):
  25731. goto _4
  25732. case int32(_BT_CR):
  25733. goto _5
  25734. case int32(_BT_LF):
  25735. goto _6
  25736. case int32(_BT_S):
  25737. goto _7
  25738. case int32(_BT_PERCNT):
  25739. goto _8
  25740. case int32(_BT_COMMA):
  25741. goto _9
  25742. case int32(_BT_LSQB):
  25743. goto _10
  25744. case int32(_BT_RSQB):
  25745. goto _11
  25746. case int32(_BT_LPAR):
  25747. goto _12
  25748. case int32(_BT_RPAR):
  25749. goto _13
  25750. case int32(_BT_VERBAR):
  25751. goto _14
  25752. case int32(_BT_GT):
  25753. goto _15
  25754. case int32(_BT_NUM):
  25755. goto _16
  25756. case int32(_BT_LEAD2):
  25757. goto _17
  25758. case int32(_BT_LEAD3):
  25759. goto _18
  25760. case int32(_BT_LEAD4):
  25761. goto _19
  25762. case int32(_BT_HEX):
  25763. goto _20
  25764. case int32(_BT_NMSTRT):
  25765. goto _21
  25766. case int32(_BT_COLON):
  25767. goto _22
  25768. case int32(_BT_MINUS):
  25769. goto _23
  25770. case int32(_BT_NAME):
  25771. goto _24
  25772. case int32(_BT_DIGIT):
  25773. goto _25
  25774. case int32(_BT_NONASCII):
  25775. goto _26
  25776. default:
  25777. goto _27
  25778. }
  25779. goto _28
  25780. _2:
  25781. ;
  25782. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25783. _3:
  25784. ;
  25785. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25786. _4:
  25787. ;
  25788. ptr += uintptr(2)
  25789. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25790. return -int32(1)
  25791. }
  25792. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25793. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25794. } else {
  25795. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25796. }
  25797. switch v29 {
  25798. case int32(_BT_EXCL):
  25799. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25800. case int32(_BT_QUEST):
  25801. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25802. case int32(_BT_NMSTRT):
  25803. fallthrough
  25804. case int32(_BT_HEX):
  25805. fallthrough
  25806. case int32(_BT_NONASCII):
  25807. fallthrough
  25808. case int32(_BT_LEAD2):
  25809. fallthrough
  25810. case int32(_BT_LEAD3):
  25811. fallthrough
  25812. case int32(_BT_LEAD4):
  25813. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25814. return int32(m_XML_TOK_INSTANCE_START)
  25815. }
  25816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25817. return m_XML_TOK_INVALID
  25818. _5:
  25819. ;
  25820. if ptr+uintptr(2) == end {
  25821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25822. /* indicate that this might be part of a CR/LF pair */
  25823. return -int32(m_XML_TOK_PROLOG_S)
  25824. }
  25825. /* fall through */
  25826. _7:
  25827. ;
  25828. _6:
  25829. ;
  25830. _32:
  25831. ;
  25832. ptr += uintptr(2)
  25833. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25834. goto _30
  25835. }
  25836. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25837. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25838. } else {
  25839. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25840. }
  25841. switch v33 {
  25842. case int32(_BT_S):
  25843. fallthrough
  25844. case int32(_BT_LF):
  25845. case int32(_BT_CR):
  25846. /* don't split CR/LF pair */
  25847. if ptr+uintptr(2) != end {
  25848. break
  25849. }
  25850. /* fall through */
  25851. fallthrough
  25852. default:
  25853. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25854. return int32(m_XML_TOK_PROLOG_S)
  25855. }
  25856. goto _31
  25857. _31:
  25858. ;
  25859. goto _32
  25860. goto _30
  25861. _30:
  25862. ;
  25863. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25864. return int32(m_XML_TOK_PROLOG_S)
  25865. _8:
  25866. ;
  25867. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25868. _9:
  25869. ;
  25870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25871. return int32(m_XML_TOK_COMMA)
  25872. _10:
  25873. ;
  25874. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25875. return int32(m_XML_TOK_OPEN_BRACKET)
  25876. _11:
  25877. ;
  25878. ptr += uintptr(2)
  25879. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25880. return -int32(m_XML_TOK_CLOSE_BRACKET)
  25881. }
  25882. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  25883. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  25884. return -int32(1)
  25885. }
  25886. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  25887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25888. return int32(m_XML_TOK_COND_SECT_CLOSE)
  25889. }
  25890. }
  25891. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25892. return int32(m_XML_TOK_CLOSE_BRACKET)
  25893. _12:
  25894. ;
  25895. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25896. return int32(m_XML_TOK_OPEN_PAREN)
  25897. _13:
  25898. ;
  25899. ptr += uintptr(2)
  25900. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25901. return -int32(m_XML_TOK_CLOSE_PAREN)
  25902. }
  25903. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25904. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25905. } else {
  25906. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25907. }
  25908. switch v34 {
  25909. case int32(_BT_AST):
  25910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25911. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  25912. case int32(_BT_QUEST):
  25913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25914. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  25915. case int32(_BT_PLUS):
  25916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25917. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  25918. case int32(_BT_CR):
  25919. fallthrough
  25920. case int32(_BT_LF):
  25921. fallthrough
  25922. case int32(_BT_S):
  25923. fallthrough
  25924. case int32(_BT_GT):
  25925. fallthrough
  25926. case int32(_BT_COMMA):
  25927. fallthrough
  25928. case int32(_BT_VERBAR):
  25929. fallthrough
  25930. case int32(_BT_RPAR):
  25931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25932. return int32(m_XML_TOK_CLOSE_PAREN)
  25933. }
  25934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25935. return m_XML_TOK_INVALID
  25936. _14:
  25937. ;
  25938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25939. return int32(m_XML_TOK_OR)
  25940. _15:
  25941. ;
  25942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25943. return int32(m_XML_TOK_DECL_CLOSE)
  25944. _16:
  25945. ;
  25946. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25947. _17:
  25948. ;
  25949. if int64(end)-int64(ptr) < int64(2) {
  25950. return -int32(2)
  25951. }
  25952. if 0 != 0 {
  25953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25954. return m_XML_TOK_INVALID
  25955. }
  25956. if 0 != 0 {
  25957. ptr += uintptr(2)
  25958. tok = int32(m_XML_TOK_NAME)
  25959. goto _28
  25960. }
  25961. if 0 != 0 {
  25962. ptr += uintptr(2)
  25963. tok = int32(m_XML_TOK_NMTOKEN)
  25964. goto _28
  25965. }
  25966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25967. return m_XML_TOK_INVALID
  25968. _18:
  25969. ;
  25970. if int64(end)-int64(ptr) < int64(3) {
  25971. return -int32(2)
  25972. }
  25973. if 0 != 0 {
  25974. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25975. return m_XML_TOK_INVALID
  25976. }
  25977. if 0 != 0 {
  25978. ptr += uintptr(3)
  25979. tok = int32(m_XML_TOK_NAME)
  25980. goto _28
  25981. }
  25982. if 0 != 0 {
  25983. ptr += uintptr(3)
  25984. tok = int32(m_XML_TOK_NMTOKEN)
  25985. goto _28
  25986. }
  25987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25988. return m_XML_TOK_INVALID
  25989. _19:
  25990. ;
  25991. if int64(end)-int64(ptr) < int64(4) {
  25992. return -int32(2)
  25993. }
  25994. if 0 != 0 {
  25995. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25996. return m_XML_TOK_INVALID
  25997. }
  25998. if 0 != 0 {
  25999. ptr += uintptr(4)
  26000. tok = int32(m_XML_TOK_NAME)
  26001. goto _28
  26002. }
  26003. if 0 != 0 {
  26004. ptr += uintptr(4)
  26005. tok = int32(m_XML_TOK_NMTOKEN)
  26006. goto _28
  26007. }
  26008. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26009. return m_XML_TOK_INVALID
  26010. _21:
  26011. ;
  26012. _20:
  26013. ;
  26014. tok = int32(m_XML_TOK_NAME)
  26015. ptr += uintptr(2)
  26016. goto _28
  26017. _25:
  26018. ;
  26019. _24:
  26020. ;
  26021. _23:
  26022. ;
  26023. _22:
  26024. ;
  26025. tok = int32(m_XML_TOK_NMTOKEN)
  26026. ptr += uintptr(2)
  26027. goto _28
  26028. _26:
  26029. ;
  26030. 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 {
  26031. ptr += uintptr(2)
  26032. tok = int32(m_XML_TOK_NAME)
  26033. goto _28
  26034. }
  26035. 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 {
  26036. ptr += uintptr(2)
  26037. tok = int32(m_XML_TOK_NMTOKEN)
  26038. goto _28
  26039. }
  26040. /* fall through */
  26041. _27:
  26042. ;
  26043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26044. return m_XML_TOK_INVALID
  26045. _28:
  26046. ;
  26047. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26048. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26049. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26050. } else {
  26051. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26052. }
  26053. switch v35 {
  26054. case int32(_BT_NONASCII):
  26055. 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) {
  26056. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26057. return m_XML_TOK_INVALID
  26058. } /* fall through */
  26059. fallthrough
  26060. case int32(_BT_NMSTRT):
  26061. fallthrough
  26062. case int32(_BT_HEX):
  26063. fallthrough
  26064. case int32(_BT_DIGIT):
  26065. fallthrough
  26066. case int32(_BT_NAME):
  26067. fallthrough
  26068. case int32(_BT_MINUS):
  26069. ptr += uintptr(2)
  26070. case int32(_BT_LEAD2):
  26071. if int64(end)-int64(ptr) < int64(2) {
  26072. return -int32(2)
  26073. }
  26074. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26076. return m_XML_TOK_INVALID
  26077. }
  26078. ptr += uintptr(2)
  26079. case int32(_BT_LEAD3):
  26080. if int64(end)-int64(ptr) < int64(3) {
  26081. return -int32(2)
  26082. }
  26083. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26085. return m_XML_TOK_INVALID
  26086. }
  26087. ptr += uintptr(3)
  26088. case int32(_BT_LEAD4):
  26089. if int64(end)-int64(ptr) < int64(4) {
  26090. return -int32(2)
  26091. }
  26092. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26094. return m_XML_TOK_INVALID
  26095. }
  26096. ptr += uintptr(4)
  26097. case int32(_BT_GT):
  26098. fallthrough
  26099. case int32(_BT_RPAR):
  26100. fallthrough
  26101. case int32(_BT_COMMA):
  26102. fallthrough
  26103. case int32(_BT_VERBAR):
  26104. fallthrough
  26105. case int32(_BT_LSQB):
  26106. fallthrough
  26107. case int32(_BT_PERCNT):
  26108. fallthrough
  26109. case int32(_BT_S):
  26110. fallthrough
  26111. case int32(_BT_CR):
  26112. fallthrough
  26113. case int32(_BT_LF):
  26114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26115. return tok
  26116. case int32(_BT_COLON):
  26117. ptr += uintptr(2)
  26118. switch tok {
  26119. case int32(m_XML_TOK_NAME):
  26120. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26121. return -int32(1)
  26122. }
  26123. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26124. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26125. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26126. } else {
  26127. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26128. }
  26129. switch v36 {
  26130. case int32(_BT_NONASCII):
  26131. 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) {
  26132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26133. return m_XML_TOK_INVALID
  26134. } /* fall through */
  26135. fallthrough
  26136. case int32(_BT_NMSTRT):
  26137. fallthrough
  26138. case int32(_BT_HEX):
  26139. fallthrough
  26140. case int32(_BT_DIGIT):
  26141. fallthrough
  26142. case int32(_BT_NAME):
  26143. fallthrough
  26144. case int32(_BT_MINUS):
  26145. ptr += uintptr(2)
  26146. case int32(_BT_LEAD2):
  26147. if int64(end)-int64(ptr) < int64(2) {
  26148. return -int32(2)
  26149. }
  26150. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26152. return m_XML_TOK_INVALID
  26153. }
  26154. ptr += uintptr(2)
  26155. case int32(_BT_LEAD3):
  26156. if int64(end)-int64(ptr) < int64(3) {
  26157. return -int32(2)
  26158. }
  26159. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26161. return m_XML_TOK_INVALID
  26162. }
  26163. ptr += uintptr(3)
  26164. case int32(_BT_LEAD4):
  26165. if int64(end)-int64(ptr) < int64(4) {
  26166. return -int32(2)
  26167. }
  26168. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26169. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26170. return m_XML_TOK_INVALID
  26171. }
  26172. ptr += uintptr(4)
  26173. default:
  26174. tok = int32(m_XML_TOK_NMTOKEN)
  26175. break
  26176. }
  26177. case int32(m_XML_TOK_PREFIXED_NAME):
  26178. tok = int32(m_XML_TOK_NMTOKEN)
  26179. break
  26180. }
  26181. case int32(_BT_PLUS):
  26182. if tok == int32(m_XML_TOK_NMTOKEN) {
  26183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26184. return m_XML_TOK_INVALID
  26185. }
  26186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26187. return int32(m_XML_TOK_NAME_PLUS)
  26188. case int32(_BT_AST):
  26189. if tok == int32(m_XML_TOK_NMTOKEN) {
  26190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26191. return m_XML_TOK_INVALID
  26192. }
  26193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26194. return int32(m_XML_TOK_NAME_ASTERISK)
  26195. case int32(_BT_QUEST):
  26196. if tok == int32(m_XML_TOK_NMTOKEN) {
  26197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26198. return m_XML_TOK_INVALID
  26199. }
  26200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26201. return int32(m_XML_TOK_NAME_QUESTION)
  26202. default:
  26203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26204. return m_XML_TOK_INVALID
  26205. }
  26206. }
  26207. return -tok
  26208. }
  26209. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26210. var start uintptr
  26211. var v1, v2 int32
  26212. _, _, _ = start, v1, v2
  26213. if ptr >= end {
  26214. return -int32(4)
  26215. } else {
  26216. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26217. /* This line cannot be executed. The incoming data has already
  26218. * been tokenized once, so incomplete characters like this have
  26219. * already been eliminated from the input. Retaining the paranoia
  26220. * check is still valuable, however.
  26221. */
  26222. return -int32(1) /* LCOV_EXCL_LINE */
  26223. }
  26224. }
  26225. start = ptr
  26226. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26227. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26228. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26229. } else {
  26230. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26231. }
  26232. switch v1 {
  26233. case int32(_BT_LEAD2):
  26234. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26235. case int32(_BT_LEAD3):
  26236. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26237. case int32(_BT_LEAD4):
  26238. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26239. case int32(_BT_AMP):
  26240. if ptr == start {
  26241. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26242. }
  26243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26244. return int32(m_XML_TOK_DATA_CHARS)
  26245. case int32(_BT_LT):
  26246. /* this is for inside entity references */
  26247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26248. return m_XML_TOK_INVALID
  26249. case int32(_BT_LF):
  26250. if ptr == start {
  26251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26252. return int32(m_XML_TOK_DATA_NEWLINE)
  26253. }
  26254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26255. return int32(m_XML_TOK_DATA_CHARS)
  26256. case int32(_BT_CR):
  26257. if ptr == start {
  26258. ptr += uintptr(2)
  26259. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26260. return -int32(3)
  26261. }
  26262. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26263. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26264. } else {
  26265. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26266. }
  26267. if v2 == int32(_BT_LF) {
  26268. ptr += uintptr(2)
  26269. }
  26270. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26271. return int32(m_XML_TOK_DATA_NEWLINE)
  26272. }
  26273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26274. return int32(m_XML_TOK_DATA_CHARS)
  26275. case int32(_BT_S):
  26276. if ptr == start {
  26277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26278. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26279. }
  26280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26281. return int32(m_XML_TOK_DATA_CHARS)
  26282. default:
  26283. ptr += uintptr(2)
  26284. break
  26285. }
  26286. }
  26287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26288. return int32(m_XML_TOK_DATA_CHARS)
  26289. }
  26290. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26291. var start uintptr
  26292. var tok, v1, v2, v3 int32
  26293. _, _, _, _, _ = start, tok, v1, v2, v3
  26294. if ptr >= end {
  26295. return -int32(4)
  26296. } else {
  26297. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26298. /* This line cannot be executed. The incoming data has already
  26299. * been tokenized once, so incomplete characters like this have
  26300. * already been eliminated from the input. Retaining the paranoia
  26301. * check is still valuable, however.
  26302. */
  26303. return -int32(1) /* LCOV_EXCL_LINE */
  26304. }
  26305. }
  26306. start = ptr
  26307. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26308. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26309. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26310. } else {
  26311. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26312. }
  26313. switch v1 {
  26314. case int32(_BT_LEAD2):
  26315. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26316. case int32(_BT_LEAD3):
  26317. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26318. case int32(_BT_LEAD4):
  26319. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26320. case int32(_BT_AMP):
  26321. if ptr == start {
  26322. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26323. }
  26324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26325. return int32(m_XML_TOK_DATA_CHARS)
  26326. case int32(_BT_PERCNT):
  26327. if ptr == start {
  26328. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26329. if tok == int32(m_XML_TOK_PERCENT) {
  26330. v2 = m_XML_TOK_INVALID
  26331. } else {
  26332. v2 = tok
  26333. }
  26334. return v2
  26335. }
  26336. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26337. return int32(m_XML_TOK_DATA_CHARS)
  26338. case int32(_BT_LF):
  26339. if ptr == start {
  26340. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26341. return int32(m_XML_TOK_DATA_NEWLINE)
  26342. }
  26343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26344. return int32(m_XML_TOK_DATA_CHARS)
  26345. case int32(_BT_CR):
  26346. if ptr == start {
  26347. ptr += uintptr(2)
  26348. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26349. return -int32(3)
  26350. }
  26351. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26352. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26353. } else {
  26354. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26355. }
  26356. if v3 == int32(_BT_LF) {
  26357. ptr += uintptr(2)
  26358. }
  26359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26360. return int32(m_XML_TOK_DATA_NEWLINE)
  26361. }
  26362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26363. return int32(m_XML_TOK_DATA_CHARS)
  26364. default:
  26365. ptr += uintptr(2)
  26366. break
  26367. }
  26368. }
  26369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26370. return int32(m_XML_TOK_DATA_CHARS)
  26371. }
  26372. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26373. var level, v1 int32
  26374. var n Tsize_t
  26375. _, _, _ = level, n, v1
  26376. level = 0
  26377. if int32(2) > int32(1) {
  26378. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  26379. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26380. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26381. end = ptr + uintptr(n)
  26382. }
  26383. }
  26384. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26385. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26386. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26387. } else {
  26388. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26389. }
  26390. switch v1 {
  26391. case int32(_BT_LEAD2):
  26392. if int64(end)-int64(ptr) < int64(2) {
  26393. return -int32(2)
  26394. }
  26395. if 0 != 0 {
  26396. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26397. return m_XML_TOK_INVALID
  26398. }
  26399. ptr += uintptr(2)
  26400. case int32(_BT_LEAD3):
  26401. if int64(end)-int64(ptr) < int64(3) {
  26402. return -int32(2)
  26403. }
  26404. if 0 != 0 {
  26405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26406. return m_XML_TOK_INVALID
  26407. }
  26408. ptr += uintptr(3)
  26409. case int32(_BT_LEAD4):
  26410. if int64(end)-int64(ptr) < int64(4) {
  26411. return -int32(2)
  26412. }
  26413. if 0 != 0 {
  26414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26415. return m_XML_TOK_INVALID
  26416. }
  26417. ptr += uintptr(4)
  26418. case int32(_BT_NONXML):
  26419. fallthrough
  26420. case int32(_BT_MALFORM):
  26421. fallthrough
  26422. case int32(_BT_TRAIL):
  26423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26424. return m_XML_TOK_INVALID
  26425. case int32(_BT_LT):
  26426. ptr += uintptr(2)
  26427. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26428. return -int32(1)
  26429. }
  26430. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26431. ptr += uintptr(2)
  26432. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26433. return -int32(1)
  26434. }
  26435. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26436. level++
  26437. ptr += uintptr(2)
  26438. }
  26439. }
  26440. case int32(_BT_RSQB):
  26441. ptr += uintptr(2)
  26442. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26443. return -int32(1)
  26444. }
  26445. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26446. ptr += uintptr(2)
  26447. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26448. return -int32(1)
  26449. }
  26450. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26451. ptr += uintptr(2)
  26452. if level == 0 {
  26453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26454. return int32(m_XML_TOK_IGNORE_SECT)
  26455. }
  26456. level--
  26457. }
  26458. }
  26459. default:
  26460. ptr += uintptr(2)
  26461. break
  26462. }
  26463. }
  26464. return -int32(1)
  26465. }
  26466. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26467. var v2, v3, v4 int32
  26468. _, _, _ = v2, v3, v4
  26469. ptr += uintptr(2)
  26470. end -= uintptr(2)
  26471. for {
  26472. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26473. break
  26474. }
  26475. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26476. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26477. } else {
  26478. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26479. }
  26480. switch v2 {
  26481. case int32(_BT_DIGIT):
  26482. fallthrough
  26483. case int32(_BT_HEX):
  26484. fallthrough
  26485. case int32(_BT_MINUS):
  26486. fallthrough
  26487. case int32(_BT_APOS):
  26488. fallthrough
  26489. case int32(_BT_LPAR):
  26490. fallthrough
  26491. case int32(_BT_RPAR):
  26492. fallthrough
  26493. case int32(_BT_PLUS):
  26494. fallthrough
  26495. case int32(_BT_COMMA):
  26496. fallthrough
  26497. case int32(_BT_SOL):
  26498. fallthrough
  26499. case int32(_BT_EQUALS):
  26500. fallthrough
  26501. case int32(_BT_QUEST):
  26502. fallthrough
  26503. case int32(_BT_CR):
  26504. fallthrough
  26505. case int32(_BT_LF):
  26506. fallthrough
  26507. case int32(_BT_SEMI):
  26508. fallthrough
  26509. case int32(_BT_EXCL):
  26510. fallthrough
  26511. case int32(_BT_AST):
  26512. fallthrough
  26513. case int32(_BT_PERCNT):
  26514. fallthrough
  26515. case int32(_BT_NUM):
  26516. fallthrough
  26517. case int32(_BT_COLON):
  26518. case int32(_BT_S):
  26519. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26520. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26521. return 0
  26522. }
  26523. case int32(_BT_NAME):
  26524. fallthrough
  26525. case int32(_BT_NMSTRT):
  26526. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26527. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26528. } else {
  26529. v3 = -int32(1)
  26530. }
  26531. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26532. break
  26533. }
  26534. /* fall through */
  26535. fallthrough
  26536. default:
  26537. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26538. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26539. } else {
  26540. v4 = -int32(1)
  26541. }
  26542. switch v4 {
  26543. case int32(0x24): /* $ */
  26544. fallthrough
  26545. case int32(0x40): /* @ */
  26546. default:
  26547. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26548. return 0
  26549. }
  26550. break
  26551. }
  26552. goto _1
  26553. _1:
  26554. ;
  26555. ptr += uintptr(2)
  26556. }
  26557. return int32(1)
  26558. }
  26559. /* This must only be called for a well-formed start-tag or empty
  26560. element tag. Returns the number of attributes. Pointers to the
  26561. first attsMax attributes are stored in atts.
  26562. */
  26563. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26564. var nAtts, open, state, v2, v3, v5, v7 int32
  26565. var v4, v6, v8, v9 bool
  26566. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26567. state = 1
  26568. nAtts = 0
  26569. open = 0 /* defined when state == inValue;
  26570. initialization just to shut up compilers */
  26571. ptr += uintptr(2)
  26572. for {
  26573. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26574. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26575. } else {
  26576. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26577. }
  26578. switch v2 {
  26579. case int32(_BT_LEAD2):
  26580. if state == 0 {
  26581. if nAtts < attsMax {
  26582. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26583. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26584. }
  26585. state = 1
  26586. }
  26587. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26588. case int32(_BT_LEAD3):
  26589. if state == 0 {
  26590. if nAtts < attsMax {
  26591. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26592. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26593. }
  26594. state = 1
  26595. }
  26596. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26597. case int32(_BT_LEAD4):
  26598. if state == 0 {
  26599. if nAtts < attsMax {
  26600. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26601. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26602. }
  26603. state = 1
  26604. }
  26605. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26606. case int32(_BT_NONASCII):
  26607. fallthrough
  26608. case int32(_BT_NMSTRT):
  26609. fallthrough
  26610. case int32(_BT_HEX):
  26611. if state == 0 {
  26612. if nAtts < attsMax {
  26613. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26614. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = int8(1)
  26615. }
  26616. state = 1
  26617. }
  26618. case int32(_BT_QUOT):
  26619. if state != 2 {
  26620. if nAtts < attsMax {
  26621. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26622. }
  26623. state = 2
  26624. open = int32(_BT_QUOT)
  26625. } else {
  26626. if open == int32(_BT_QUOT) {
  26627. state = 0
  26628. if nAtts < attsMax {
  26629. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26630. }
  26631. nAtts++
  26632. }
  26633. }
  26634. case int32(_BT_APOS):
  26635. if state != 2 {
  26636. if nAtts < attsMax {
  26637. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26638. }
  26639. state = 2
  26640. open = int32(_BT_APOS)
  26641. } else {
  26642. if open == int32(_BT_APOS) {
  26643. state = 0
  26644. if nAtts < attsMax {
  26645. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26646. }
  26647. nAtts++
  26648. }
  26649. }
  26650. case int32(_BT_AMP):
  26651. if nAtts < attsMax {
  26652. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26653. }
  26654. case int32(_BT_S):
  26655. if state == 1 {
  26656. state = 0
  26657. } else {
  26658. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  26659. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  26660. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26661. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26662. } else {
  26663. v3 = -int32(1)
  26664. }
  26665. }
  26666. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26667. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26668. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26669. } else {
  26670. v5 = -int32(1)
  26671. }
  26672. }
  26673. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26674. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26675. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  26676. } else {
  26677. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26678. }
  26679. }
  26680. }
  26681. if v9 && (v8 || v7 == open) {
  26682. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26683. }
  26684. }
  26685. case int32(_BT_CR):
  26686. fallthrough
  26687. case int32(_BT_LF):
  26688. /* This case ensures that the first attribute name is counted
  26689. Apart from that we could just change state on the quote. */
  26690. if state == 1 {
  26691. state = 0
  26692. } else {
  26693. if state == 2 && nAtts < attsMax {
  26694. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = 0
  26695. }
  26696. }
  26697. case int32(_BT_GT):
  26698. fallthrough
  26699. case int32(_BT_SOL):
  26700. if state != 2 {
  26701. return nAtts
  26702. }
  26703. default:
  26704. break
  26705. }
  26706. goto _1
  26707. _1:
  26708. ;
  26709. ptr += uintptr(2)
  26710. }
  26711. /* not reached */
  26712. return r
  26713. }
  26714. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26715. var c, c1, result, v2, v4 int32
  26716. _, _, _, _, _ = c, c1, result, v2, v4
  26717. result = 0
  26718. /* skip &# */
  26719. _ = enc
  26720. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26721. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26722. ptr += uintptr(2)
  26723. for {
  26724. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26725. break
  26726. }
  26727. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26728. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26729. } else {
  26730. v2 = -int32(1)
  26731. }
  26732. c = v2
  26733. switch c {
  26734. case int32(m_ASCII_02):
  26735. fallthrough
  26736. case int32(m_ASCII_12):
  26737. fallthrough
  26738. case int32(m_ASCII_22):
  26739. fallthrough
  26740. case int32(m_ASCII_32):
  26741. fallthrough
  26742. case int32(m_ASCII_41):
  26743. fallthrough
  26744. case int32(m_ASCII_51):
  26745. fallthrough
  26746. case int32(m_ASCII_61):
  26747. fallthrough
  26748. case int32(m_ASCII_71):
  26749. fallthrough
  26750. case int32(m_ASCII_82):
  26751. fallthrough
  26752. case int32(m_ASCII_92):
  26753. result <<= int32(4)
  26754. result |= c - int32(m_ASCII_02)
  26755. case int32(m_ASCII_A):
  26756. fallthrough
  26757. case int32(m_ASCII_B1):
  26758. fallthrough
  26759. case int32(m_ASCII_C):
  26760. fallthrough
  26761. case int32(m_ASCII_D):
  26762. fallthrough
  26763. case int32(m_ASCII_E):
  26764. fallthrough
  26765. case int32(m_ASCII_F):
  26766. result <<= int32(4)
  26767. result += int32(10) + (c - int32(m_ASCII_A))
  26768. case int32(m_ASCII_a2):
  26769. fallthrough
  26770. case int32(m_ASCII_b1):
  26771. fallthrough
  26772. case int32(m_ASCII_c2):
  26773. fallthrough
  26774. case int32(m_ASCII_d1):
  26775. fallthrough
  26776. case int32(m_ASCII_e2):
  26777. fallthrough
  26778. case int32(m_ASCII_f1):
  26779. result <<= int32(4)
  26780. result += int32(10) + (c - int32(m_ASCII_a2))
  26781. break
  26782. }
  26783. if result >= int32(0x110000) {
  26784. return -int32(1)
  26785. }
  26786. goto _1
  26787. _1:
  26788. ;
  26789. ptr += uintptr(2)
  26790. }
  26791. } else {
  26792. for {
  26793. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26794. break
  26795. }
  26796. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26797. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26798. } else {
  26799. v4 = -int32(1)
  26800. }
  26801. c1 = v4
  26802. result *= int32(10)
  26803. result += c1 - int32(m_ASCII_02)
  26804. if result >= int32(0x110000) {
  26805. return -int32(1)
  26806. }
  26807. goto _3
  26808. _3:
  26809. ;
  26810. ptr += uintptr(2)
  26811. }
  26812. }
  26813. return _checkCharRefNumber(tls, result)
  26814. }
  26815. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26816. var v1, v2 int32
  26817. _, _ = v1, v2
  26818. _ = enc
  26819. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  26820. case int64(2):
  26821. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26822. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26823. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26824. } else {
  26825. v1 = -int32(1)
  26826. }
  26827. switch v1 {
  26828. case int32(m_ASCII_l2):
  26829. return int32(m_ASCII_LT1)
  26830. case int32(m_ASCII_g2):
  26831. return int32(m_ASCII_GT1)
  26832. }
  26833. }
  26834. case int64(3):
  26835. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26836. ptr += uintptr(2)
  26837. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26838. ptr += uintptr(2)
  26839. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26840. return int32(m_ASCII_AMP1)
  26841. }
  26842. }
  26843. }
  26844. case int64(4):
  26845. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26846. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26847. } else {
  26848. v2 = -int32(1)
  26849. }
  26850. switch v2 {
  26851. case int32(m_ASCII_q1):
  26852. ptr += uintptr(2)
  26853. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  26854. ptr += uintptr(2)
  26855. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26856. ptr += uintptr(2)
  26857. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  26858. return int32(m_ASCII_QUOT1)
  26859. }
  26860. }
  26861. }
  26862. case int32(m_ASCII_a2):
  26863. ptr += uintptr(2)
  26864. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26865. ptr += uintptr(2)
  26866. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26867. ptr += uintptr(2)
  26868. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  26869. return int32(m_ASCII_APOS1)
  26870. }
  26871. }
  26872. }
  26873. break
  26874. }
  26875. }
  26876. return 0
  26877. }
  26878. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  26879. _ = enc
  26880. for {
  26881. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  26882. break
  26883. }
  26884. if int64(end1)-int64(ptr1) < int64(2) {
  26885. /* This line cannot be executed. The incoming data has already
  26886. * been tokenized once, so incomplete characters like this have
  26887. * already been eliminated from the input. Retaining the
  26888. * paranoia check is still valuable, however.
  26889. */
  26890. return 0 /* LCOV_EXCL_LINE */
  26891. }
  26892. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  26893. return 0
  26894. }
  26895. goto _1
  26896. _1:
  26897. ;
  26898. ptr1 += uintptr(2)
  26899. ptr2++
  26900. }
  26901. return libc.BoolInt32(ptr1 == end1)
  26902. }
  26903. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26904. var start uintptr
  26905. var v2 int32
  26906. _, _ = start, v2
  26907. start = ptr
  26908. for {
  26909. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26910. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26911. } else {
  26912. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26913. }
  26914. switch v2 {
  26915. case int32(_BT_LEAD2):
  26916. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26917. case int32(_BT_LEAD3):
  26918. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26919. case int32(_BT_LEAD4):
  26920. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26921. case int32(_BT_NONASCII):
  26922. fallthrough
  26923. case int32(_BT_NMSTRT):
  26924. fallthrough
  26925. case int32(_BT_COLON):
  26926. fallthrough
  26927. case int32(_BT_HEX):
  26928. fallthrough
  26929. case int32(_BT_DIGIT):
  26930. fallthrough
  26931. case int32(_BT_NAME):
  26932. fallthrough
  26933. case int32(_BT_MINUS):
  26934. ptr += uintptr(2)
  26935. default:
  26936. return int32(int64(ptr) - int64(start))
  26937. }
  26938. goto _1
  26939. _1:
  26940. }
  26941. return r
  26942. }
  26943. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  26944. var v2 int32
  26945. _ = v2
  26946. for {
  26947. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26948. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26949. } else {
  26950. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26951. }
  26952. switch v2 {
  26953. case int32(_BT_LF):
  26954. fallthrough
  26955. case int32(_BT_CR):
  26956. fallthrough
  26957. case int32(_BT_S):
  26958. ptr += uintptr(2)
  26959. default:
  26960. return ptr
  26961. }
  26962. goto _1
  26963. _1:
  26964. }
  26965. return r
  26966. }
  26967. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  26968. var v1, v2 int32
  26969. var v3 bool
  26970. _, _, _ = v1, v2, v3
  26971. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26972. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26973. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26974. } else {
  26975. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26976. }
  26977. switch v1 {
  26978. case int32(_BT_LEAD2):
  26979. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26980. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26981. case int32(_BT_LEAD3):
  26982. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26983. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26984. case int32(_BT_LEAD4):
  26985. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26986. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26987. case int32(_BT_LF):
  26988. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26989. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26990. ptr += uintptr(2)
  26991. case int32(_BT_CR):
  26992. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26993. ptr += uintptr(2)
  26994. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  26995. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26996. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26997. } else {
  26998. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26999. }
  27000. }
  27001. if v3 && v2 == int32(_BT_LF) {
  27002. ptr += uintptr(2)
  27003. }
  27004. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  27005. default:
  27006. ptr += uintptr(2)
  27007. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  27008. break
  27009. }
  27010. }
  27011. }
  27012. var _big2_encoding_ns = Tnormal_encoding{
  27013. Fenc: TENCODING{
  27014. Fscanners: [4]TSCANNER{},
  27015. FliteralScanners: [2]TSCANNER{},
  27016. FminBytesPerChar: int32(2),
  27017. },
  27018. Ftype1: [256]uint8{
  27019. 9: uint8(_BT_S),
  27020. 10: uint8(_BT_LF),
  27021. 13: uint8(_BT_CR),
  27022. 32: uint8(_BT_S),
  27023. 33: uint8(_BT_EXCL),
  27024. 34: uint8(_BT_QUOT),
  27025. 35: uint8(_BT_NUM),
  27026. 36: uint8(_BT_OTHER),
  27027. 37: uint8(_BT_PERCNT),
  27028. 38: uint8(_BT_AMP),
  27029. 39: uint8(_BT_APOS),
  27030. 40: uint8(_BT_LPAR),
  27031. 41: uint8(_BT_RPAR),
  27032. 42: uint8(_BT_AST),
  27033. 43: uint8(_BT_PLUS),
  27034. 44: uint8(_BT_COMMA),
  27035. 45: uint8(_BT_MINUS),
  27036. 46: uint8(_BT_NAME),
  27037. 47: uint8(_BT_SOL),
  27038. 48: uint8(_BT_DIGIT),
  27039. 49: uint8(_BT_DIGIT),
  27040. 50: uint8(_BT_DIGIT),
  27041. 51: uint8(_BT_DIGIT),
  27042. 52: uint8(_BT_DIGIT),
  27043. 53: uint8(_BT_DIGIT),
  27044. 54: uint8(_BT_DIGIT),
  27045. 55: uint8(_BT_DIGIT),
  27046. 56: uint8(_BT_DIGIT),
  27047. 57: uint8(_BT_DIGIT),
  27048. 58: uint8(_BT_COLON),
  27049. 59: uint8(_BT_SEMI),
  27050. 60: uint8(_BT_LT),
  27051. 61: uint8(_BT_EQUALS),
  27052. 62: uint8(_BT_GT),
  27053. 63: uint8(_BT_QUEST),
  27054. 64: uint8(_BT_OTHER),
  27055. 65: uint8(_BT_HEX),
  27056. 66: uint8(_BT_HEX),
  27057. 67: uint8(_BT_HEX),
  27058. 68: uint8(_BT_HEX),
  27059. 69: uint8(_BT_HEX),
  27060. 70: uint8(_BT_HEX),
  27061. 71: uint8(_BT_NMSTRT),
  27062. 72: uint8(_BT_NMSTRT),
  27063. 73: uint8(_BT_NMSTRT),
  27064. 74: uint8(_BT_NMSTRT),
  27065. 75: uint8(_BT_NMSTRT),
  27066. 76: uint8(_BT_NMSTRT),
  27067. 77: uint8(_BT_NMSTRT),
  27068. 78: uint8(_BT_NMSTRT),
  27069. 79: uint8(_BT_NMSTRT),
  27070. 80: uint8(_BT_NMSTRT),
  27071. 81: uint8(_BT_NMSTRT),
  27072. 82: uint8(_BT_NMSTRT),
  27073. 83: uint8(_BT_NMSTRT),
  27074. 84: uint8(_BT_NMSTRT),
  27075. 85: uint8(_BT_NMSTRT),
  27076. 86: uint8(_BT_NMSTRT),
  27077. 87: uint8(_BT_NMSTRT),
  27078. 88: uint8(_BT_NMSTRT),
  27079. 89: uint8(_BT_NMSTRT),
  27080. 90: uint8(_BT_NMSTRT),
  27081. 91: uint8(_BT_LSQB),
  27082. 92: uint8(_BT_OTHER),
  27083. 93: uint8(_BT_RSQB),
  27084. 94: uint8(_BT_OTHER),
  27085. 95: uint8(_BT_NMSTRT),
  27086. 96: uint8(_BT_OTHER),
  27087. 97: uint8(_BT_HEX),
  27088. 98: uint8(_BT_HEX),
  27089. 99: uint8(_BT_HEX),
  27090. 100: uint8(_BT_HEX),
  27091. 101: uint8(_BT_HEX),
  27092. 102: uint8(_BT_HEX),
  27093. 103: uint8(_BT_NMSTRT),
  27094. 104: uint8(_BT_NMSTRT),
  27095. 105: uint8(_BT_NMSTRT),
  27096. 106: uint8(_BT_NMSTRT),
  27097. 107: uint8(_BT_NMSTRT),
  27098. 108: uint8(_BT_NMSTRT),
  27099. 109: uint8(_BT_NMSTRT),
  27100. 110: uint8(_BT_NMSTRT),
  27101. 111: uint8(_BT_NMSTRT),
  27102. 112: uint8(_BT_NMSTRT),
  27103. 113: uint8(_BT_NMSTRT),
  27104. 114: uint8(_BT_NMSTRT),
  27105. 115: uint8(_BT_NMSTRT),
  27106. 116: uint8(_BT_NMSTRT),
  27107. 117: uint8(_BT_NMSTRT),
  27108. 118: uint8(_BT_NMSTRT),
  27109. 119: uint8(_BT_NMSTRT),
  27110. 120: uint8(_BT_NMSTRT),
  27111. 121: uint8(_BT_NMSTRT),
  27112. 122: uint8(_BT_NMSTRT),
  27113. 123: uint8(_BT_OTHER),
  27114. 124: uint8(_BT_VERBAR),
  27115. 125: uint8(_BT_OTHER),
  27116. 126: uint8(_BT_OTHER),
  27117. 127: uint8(_BT_OTHER),
  27118. 128: uint8(_BT_OTHER),
  27119. 129: uint8(_BT_OTHER),
  27120. 130: uint8(_BT_OTHER),
  27121. 131: uint8(_BT_OTHER),
  27122. 132: uint8(_BT_OTHER),
  27123. 133: uint8(_BT_OTHER),
  27124. 134: uint8(_BT_OTHER),
  27125. 135: uint8(_BT_OTHER),
  27126. 136: uint8(_BT_OTHER),
  27127. 137: uint8(_BT_OTHER),
  27128. 138: uint8(_BT_OTHER),
  27129. 139: uint8(_BT_OTHER),
  27130. 140: uint8(_BT_OTHER),
  27131. 141: uint8(_BT_OTHER),
  27132. 142: uint8(_BT_OTHER),
  27133. 143: uint8(_BT_OTHER),
  27134. 144: uint8(_BT_OTHER),
  27135. 145: uint8(_BT_OTHER),
  27136. 146: uint8(_BT_OTHER),
  27137. 147: uint8(_BT_OTHER),
  27138. 148: uint8(_BT_OTHER),
  27139. 149: uint8(_BT_OTHER),
  27140. 150: uint8(_BT_OTHER),
  27141. 151: uint8(_BT_OTHER),
  27142. 152: uint8(_BT_OTHER),
  27143. 153: uint8(_BT_OTHER),
  27144. 154: uint8(_BT_OTHER),
  27145. 155: uint8(_BT_OTHER),
  27146. 156: uint8(_BT_OTHER),
  27147. 157: uint8(_BT_OTHER),
  27148. 158: uint8(_BT_OTHER),
  27149. 159: uint8(_BT_OTHER),
  27150. 160: uint8(_BT_OTHER),
  27151. 161: uint8(_BT_OTHER),
  27152. 162: uint8(_BT_OTHER),
  27153. 163: uint8(_BT_OTHER),
  27154. 164: uint8(_BT_OTHER),
  27155. 165: uint8(_BT_OTHER),
  27156. 166: uint8(_BT_OTHER),
  27157. 167: uint8(_BT_OTHER),
  27158. 168: uint8(_BT_OTHER),
  27159. 169: uint8(_BT_OTHER),
  27160. 170: uint8(_BT_NMSTRT),
  27161. 171: uint8(_BT_OTHER),
  27162. 172: uint8(_BT_OTHER),
  27163. 173: uint8(_BT_OTHER),
  27164. 174: uint8(_BT_OTHER),
  27165. 175: uint8(_BT_OTHER),
  27166. 176: uint8(_BT_OTHER),
  27167. 177: uint8(_BT_OTHER),
  27168. 178: uint8(_BT_OTHER),
  27169. 179: uint8(_BT_OTHER),
  27170. 180: uint8(_BT_OTHER),
  27171. 181: uint8(_BT_NMSTRT),
  27172. 182: uint8(_BT_OTHER),
  27173. 183: uint8(_BT_NAME),
  27174. 184: uint8(_BT_OTHER),
  27175. 185: uint8(_BT_OTHER),
  27176. 186: uint8(_BT_NMSTRT),
  27177. 187: uint8(_BT_OTHER),
  27178. 188: uint8(_BT_OTHER),
  27179. 189: uint8(_BT_OTHER),
  27180. 190: uint8(_BT_OTHER),
  27181. 191: uint8(_BT_OTHER),
  27182. 192: uint8(_BT_NMSTRT),
  27183. 193: uint8(_BT_NMSTRT),
  27184. 194: uint8(_BT_NMSTRT),
  27185. 195: uint8(_BT_NMSTRT),
  27186. 196: uint8(_BT_NMSTRT),
  27187. 197: uint8(_BT_NMSTRT),
  27188. 198: uint8(_BT_NMSTRT),
  27189. 199: uint8(_BT_NMSTRT),
  27190. 200: uint8(_BT_NMSTRT),
  27191. 201: uint8(_BT_NMSTRT),
  27192. 202: uint8(_BT_NMSTRT),
  27193. 203: uint8(_BT_NMSTRT),
  27194. 204: uint8(_BT_NMSTRT),
  27195. 205: uint8(_BT_NMSTRT),
  27196. 206: uint8(_BT_NMSTRT),
  27197. 207: uint8(_BT_NMSTRT),
  27198. 208: uint8(_BT_NMSTRT),
  27199. 209: uint8(_BT_NMSTRT),
  27200. 210: uint8(_BT_NMSTRT),
  27201. 211: uint8(_BT_NMSTRT),
  27202. 212: uint8(_BT_NMSTRT),
  27203. 213: uint8(_BT_NMSTRT),
  27204. 214: uint8(_BT_NMSTRT),
  27205. 215: uint8(_BT_OTHER),
  27206. 216: uint8(_BT_NMSTRT),
  27207. 217: uint8(_BT_NMSTRT),
  27208. 218: uint8(_BT_NMSTRT),
  27209. 219: uint8(_BT_NMSTRT),
  27210. 220: uint8(_BT_NMSTRT),
  27211. 221: uint8(_BT_NMSTRT),
  27212. 222: uint8(_BT_NMSTRT),
  27213. 223: uint8(_BT_NMSTRT),
  27214. 224: uint8(_BT_NMSTRT),
  27215. 225: uint8(_BT_NMSTRT),
  27216. 226: uint8(_BT_NMSTRT),
  27217. 227: uint8(_BT_NMSTRT),
  27218. 228: uint8(_BT_NMSTRT),
  27219. 229: uint8(_BT_NMSTRT),
  27220. 230: uint8(_BT_NMSTRT),
  27221. 231: uint8(_BT_NMSTRT),
  27222. 232: uint8(_BT_NMSTRT),
  27223. 233: uint8(_BT_NMSTRT),
  27224. 234: uint8(_BT_NMSTRT),
  27225. 235: uint8(_BT_NMSTRT),
  27226. 236: uint8(_BT_NMSTRT),
  27227. 237: uint8(_BT_NMSTRT),
  27228. 238: uint8(_BT_NMSTRT),
  27229. 239: uint8(_BT_NMSTRT),
  27230. 240: uint8(_BT_NMSTRT),
  27231. 241: uint8(_BT_NMSTRT),
  27232. 242: uint8(_BT_NMSTRT),
  27233. 243: uint8(_BT_NMSTRT),
  27234. 244: uint8(_BT_NMSTRT),
  27235. 245: uint8(_BT_NMSTRT),
  27236. 246: uint8(_BT_NMSTRT),
  27237. 247: uint8(_BT_OTHER),
  27238. 248: uint8(_BT_NMSTRT),
  27239. 249: uint8(_BT_NMSTRT),
  27240. 250: uint8(_BT_NMSTRT),
  27241. 251: uint8(_BT_NMSTRT),
  27242. 252: uint8(_BT_NMSTRT),
  27243. 253: uint8(_BT_NMSTRT),
  27244. 254: uint8(_BT_NMSTRT),
  27245. 255: uint8(_BT_NMSTRT),
  27246. },
  27247. }
  27248. func init() {
  27249. p := unsafe.Pointer(&_big2_encoding_ns)
  27250. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27251. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27252. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27253. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27254. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27255. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27256. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27257. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27258. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27259. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27260. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27261. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27262. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27263. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27264. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27265. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27266. }
  27267. var _big2_encoding = Tnormal_encoding{
  27268. Fenc: TENCODING{
  27269. Fscanners: [4]TSCANNER{},
  27270. FliteralScanners: [2]TSCANNER{},
  27271. FminBytesPerChar: int32(2),
  27272. },
  27273. Ftype1: [256]uint8{
  27274. 9: uint8(_BT_S),
  27275. 10: uint8(_BT_LF),
  27276. 13: uint8(_BT_CR),
  27277. 32: uint8(_BT_S),
  27278. 33: uint8(_BT_EXCL),
  27279. 34: uint8(_BT_QUOT),
  27280. 35: uint8(_BT_NUM),
  27281. 36: uint8(_BT_OTHER),
  27282. 37: uint8(_BT_PERCNT),
  27283. 38: uint8(_BT_AMP),
  27284. 39: uint8(_BT_APOS),
  27285. 40: uint8(_BT_LPAR),
  27286. 41: uint8(_BT_RPAR),
  27287. 42: uint8(_BT_AST),
  27288. 43: uint8(_BT_PLUS),
  27289. 44: uint8(_BT_COMMA),
  27290. 45: uint8(_BT_MINUS),
  27291. 46: uint8(_BT_NAME),
  27292. 47: uint8(_BT_SOL),
  27293. 48: uint8(_BT_DIGIT),
  27294. 49: uint8(_BT_DIGIT),
  27295. 50: uint8(_BT_DIGIT),
  27296. 51: uint8(_BT_DIGIT),
  27297. 52: uint8(_BT_DIGIT),
  27298. 53: uint8(_BT_DIGIT),
  27299. 54: uint8(_BT_DIGIT),
  27300. 55: uint8(_BT_DIGIT),
  27301. 56: uint8(_BT_DIGIT),
  27302. 57: uint8(_BT_DIGIT),
  27303. 58: uint8(_BT_NMSTRT),
  27304. 59: uint8(_BT_SEMI),
  27305. 60: uint8(_BT_LT),
  27306. 61: uint8(_BT_EQUALS),
  27307. 62: uint8(_BT_GT),
  27308. 63: uint8(_BT_QUEST),
  27309. 64: uint8(_BT_OTHER),
  27310. 65: uint8(_BT_HEX),
  27311. 66: uint8(_BT_HEX),
  27312. 67: uint8(_BT_HEX),
  27313. 68: uint8(_BT_HEX),
  27314. 69: uint8(_BT_HEX),
  27315. 70: uint8(_BT_HEX),
  27316. 71: uint8(_BT_NMSTRT),
  27317. 72: uint8(_BT_NMSTRT),
  27318. 73: uint8(_BT_NMSTRT),
  27319. 74: uint8(_BT_NMSTRT),
  27320. 75: uint8(_BT_NMSTRT),
  27321. 76: uint8(_BT_NMSTRT),
  27322. 77: uint8(_BT_NMSTRT),
  27323. 78: uint8(_BT_NMSTRT),
  27324. 79: uint8(_BT_NMSTRT),
  27325. 80: uint8(_BT_NMSTRT),
  27326. 81: uint8(_BT_NMSTRT),
  27327. 82: uint8(_BT_NMSTRT),
  27328. 83: uint8(_BT_NMSTRT),
  27329. 84: uint8(_BT_NMSTRT),
  27330. 85: uint8(_BT_NMSTRT),
  27331. 86: uint8(_BT_NMSTRT),
  27332. 87: uint8(_BT_NMSTRT),
  27333. 88: uint8(_BT_NMSTRT),
  27334. 89: uint8(_BT_NMSTRT),
  27335. 90: uint8(_BT_NMSTRT),
  27336. 91: uint8(_BT_LSQB),
  27337. 92: uint8(_BT_OTHER),
  27338. 93: uint8(_BT_RSQB),
  27339. 94: uint8(_BT_OTHER),
  27340. 95: uint8(_BT_NMSTRT),
  27341. 96: uint8(_BT_OTHER),
  27342. 97: uint8(_BT_HEX),
  27343. 98: uint8(_BT_HEX),
  27344. 99: uint8(_BT_HEX),
  27345. 100: uint8(_BT_HEX),
  27346. 101: uint8(_BT_HEX),
  27347. 102: uint8(_BT_HEX),
  27348. 103: uint8(_BT_NMSTRT),
  27349. 104: uint8(_BT_NMSTRT),
  27350. 105: uint8(_BT_NMSTRT),
  27351. 106: uint8(_BT_NMSTRT),
  27352. 107: uint8(_BT_NMSTRT),
  27353. 108: uint8(_BT_NMSTRT),
  27354. 109: uint8(_BT_NMSTRT),
  27355. 110: uint8(_BT_NMSTRT),
  27356. 111: uint8(_BT_NMSTRT),
  27357. 112: uint8(_BT_NMSTRT),
  27358. 113: uint8(_BT_NMSTRT),
  27359. 114: uint8(_BT_NMSTRT),
  27360. 115: uint8(_BT_NMSTRT),
  27361. 116: uint8(_BT_NMSTRT),
  27362. 117: uint8(_BT_NMSTRT),
  27363. 118: uint8(_BT_NMSTRT),
  27364. 119: uint8(_BT_NMSTRT),
  27365. 120: uint8(_BT_NMSTRT),
  27366. 121: uint8(_BT_NMSTRT),
  27367. 122: uint8(_BT_NMSTRT),
  27368. 123: uint8(_BT_OTHER),
  27369. 124: uint8(_BT_VERBAR),
  27370. 125: uint8(_BT_OTHER),
  27371. 126: uint8(_BT_OTHER),
  27372. 127: uint8(_BT_OTHER),
  27373. 128: uint8(_BT_OTHER),
  27374. 129: uint8(_BT_OTHER),
  27375. 130: uint8(_BT_OTHER),
  27376. 131: uint8(_BT_OTHER),
  27377. 132: uint8(_BT_OTHER),
  27378. 133: uint8(_BT_OTHER),
  27379. 134: uint8(_BT_OTHER),
  27380. 135: uint8(_BT_OTHER),
  27381. 136: uint8(_BT_OTHER),
  27382. 137: uint8(_BT_OTHER),
  27383. 138: uint8(_BT_OTHER),
  27384. 139: uint8(_BT_OTHER),
  27385. 140: uint8(_BT_OTHER),
  27386. 141: uint8(_BT_OTHER),
  27387. 142: uint8(_BT_OTHER),
  27388. 143: uint8(_BT_OTHER),
  27389. 144: uint8(_BT_OTHER),
  27390. 145: uint8(_BT_OTHER),
  27391. 146: uint8(_BT_OTHER),
  27392. 147: uint8(_BT_OTHER),
  27393. 148: uint8(_BT_OTHER),
  27394. 149: uint8(_BT_OTHER),
  27395. 150: uint8(_BT_OTHER),
  27396. 151: uint8(_BT_OTHER),
  27397. 152: uint8(_BT_OTHER),
  27398. 153: uint8(_BT_OTHER),
  27399. 154: uint8(_BT_OTHER),
  27400. 155: uint8(_BT_OTHER),
  27401. 156: uint8(_BT_OTHER),
  27402. 157: uint8(_BT_OTHER),
  27403. 158: uint8(_BT_OTHER),
  27404. 159: uint8(_BT_OTHER),
  27405. 160: uint8(_BT_OTHER),
  27406. 161: uint8(_BT_OTHER),
  27407. 162: uint8(_BT_OTHER),
  27408. 163: uint8(_BT_OTHER),
  27409. 164: uint8(_BT_OTHER),
  27410. 165: uint8(_BT_OTHER),
  27411. 166: uint8(_BT_OTHER),
  27412. 167: uint8(_BT_OTHER),
  27413. 168: uint8(_BT_OTHER),
  27414. 169: uint8(_BT_OTHER),
  27415. 170: uint8(_BT_NMSTRT),
  27416. 171: uint8(_BT_OTHER),
  27417. 172: uint8(_BT_OTHER),
  27418. 173: uint8(_BT_OTHER),
  27419. 174: uint8(_BT_OTHER),
  27420. 175: uint8(_BT_OTHER),
  27421. 176: uint8(_BT_OTHER),
  27422. 177: uint8(_BT_OTHER),
  27423. 178: uint8(_BT_OTHER),
  27424. 179: uint8(_BT_OTHER),
  27425. 180: uint8(_BT_OTHER),
  27426. 181: uint8(_BT_NMSTRT),
  27427. 182: uint8(_BT_OTHER),
  27428. 183: uint8(_BT_NAME),
  27429. 184: uint8(_BT_OTHER),
  27430. 185: uint8(_BT_OTHER),
  27431. 186: uint8(_BT_NMSTRT),
  27432. 187: uint8(_BT_OTHER),
  27433. 188: uint8(_BT_OTHER),
  27434. 189: uint8(_BT_OTHER),
  27435. 190: uint8(_BT_OTHER),
  27436. 191: uint8(_BT_OTHER),
  27437. 192: uint8(_BT_NMSTRT),
  27438. 193: uint8(_BT_NMSTRT),
  27439. 194: uint8(_BT_NMSTRT),
  27440. 195: uint8(_BT_NMSTRT),
  27441. 196: uint8(_BT_NMSTRT),
  27442. 197: uint8(_BT_NMSTRT),
  27443. 198: uint8(_BT_NMSTRT),
  27444. 199: uint8(_BT_NMSTRT),
  27445. 200: uint8(_BT_NMSTRT),
  27446. 201: uint8(_BT_NMSTRT),
  27447. 202: uint8(_BT_NMSTRT),
  27448. 203: uint8(_BT_NMSTRT),
  27449. 204: uint8(_BT_NMSTRT),
  27450. 205: uint8(_BT_NMSTRT),
  27451. 206: uint8(_BT_NMSTRT),
  27452. 207: uint8(_BT_NMSTRT),
  27453. 208: uint8(_BT_NMSTRT),
  27454. 209: uint8(_BT_NMSTRT),
  27455. 210: uint8(_BT_NMSTRT),
  27456. 211: uint8(_BT_NMSTRT),
  27457. 212: uint8(_BT_NMSTRT),
  27458. 213: uint8(_BT_NMSTRT),
  27459. 214: uint8(_BT_NMSTRT),
  27460. 215: uint8(_BT_OTHER),
  27461. 216: uint8(_BT_NMSTRT),
  27462. 217: uint8(_BT_NMSTRT),
  27463. 218: uint8(_BT_NMSTRT),
  27464. 219: uint8(_BT_NMSTRT),
  27465. 220: uint8(_BT_NMSTRT),
  27466. 221: uint8(_BT_NMSTRT),
  27467. 222: uint8(_BT_NMSTRT),
  27468. 223: uint8(_BT_NMSTRT),
  27469. 224: uint8(_BT_NMSTRT),
  27470. 225: uint8(_BT_NMSTRT),
  27471. 226: uint8(_BT_NMSTRT),
  27472. 227: uint8(_BT_NMSTRT),
  27473. 228: uint8(_BT_NMSTRT),
  27474. 229: uint8(_BT_NMSTRT),
  27475. 230: uint8(_BT_NMSTRT),
  27476. 231: uint8(_BT_NMSTRT),
  27477. 232: uint8(_BT_NMSTRT),
  27478. 233: uint8(_BT_NMSTRT),
  27479. 234: uint8(_BT_NMSTRT),
  27480. 235: uint8(_BT_NMSTRT),
  27481. 236: uint8(_BT_NMSTRT),
  27482. 237: uint8(_BT_NMSTRT),
  27483. 238: uint8(_BT_NMSTRT),
  27484. 239: uint8(_BT_NMSTRT),
  27485. 240: uint8(_BT_NMSTRT),
  27486. 241: uint8(_BT_NMSTRT),
  27487. 242: uint8(_BT_NMSTRT),
  27488. 243: uint8(_BT_NMSTRT),
  27489. 244: uint8(_BT_NMSTRT),
  27490. 245: uint8(_BT_NMSTRT),
  27491. 246: uint8(_BT_NMSTRT),
  27492. 247: uint8(_BT_OTHER),
  27493. 248: uint8(_BT_NMSTRT),
  27494. 249: uint8(_BT_NMSTRT),
  27495. 250: uint8(_BT_NMSTRT),
  27496. 251: uint8(_BT_NMSTRT),
  27497. 252: uint8(_BT_NMSTRT),
  27498. 253: uint8(_BT_NMSTRT),
  27499. 254: uint8(_BT_NMSTRT),
  27500. 255: uint8(_BT_NMSTRT),
  27501. },
  27502. }
  27503. func init() {
  27504. p := unsafe.Pointer(&_big2_encoding)
  27505. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27506. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27507. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27508. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27509. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27510. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27511. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27512. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27513. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27514. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27515. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27516. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27517. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27518. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27519. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27520. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27521. }
  27522. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27523. var c1, c2 int8
  27524. var v2, v3 uintptr
  27525. _, _, _, _ = c1, c2, v2, v3
  27526. for {
  27527. v2 = s1
  27528. s1++
  27529. c1 = *(*int8)(unsafe.Pointer(v2))
  27530. v3 = s2
  27531. s2++
  27532. c2 = *(*int8)(unsafe.Pointer(v3))
  27533. if int32(m_ASCII_a2) <= int32(c1) && int32(c1) <= int32(m_ASCII_z1) {
  27534. c1 = int8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27535. }
  27536. if int32(m_ASCII_a2) <= int32(c2) && int32(c2) <= int32(m_ASCII_z1) {
  27537. /* The following line will never get executed. streqci() is
  27538. * only called from two places, both of which guarantee to put
  27539. * upper-case strings into s2.
  27540. */
  27541. c2 = int8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27542. } /* LCOV_EXCL_LINE */
  27543. if int32(c1) != int32(c2) {
  27544. return 0
  27545. }
  27546. if !(c1 != 0) {
  27547. break
  27548. }
  27549. goto _1
  27550. _1:
  27551. }
  27552. return int32(1)
  27553. }
  27554. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27555. _ = enc
  27556. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27557. }
  27558. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27559. bp := tls.Alloc(32)
  27560. defer tls.Free(32)
  27561. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27562. var _ /* buf at bp+8 */ [1]int8
  27563. var _ /* p at bp+16 */ uintptr
  27564. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  27565. (*(*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))
  27566. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  27567. return -int32(1)
  27568. } else {
  27569. return int32((*(*[1]int8)(unsafe.Pointer(bp + 8)))[0])
  27570. }
  27571. return r
  27572. }
  27573. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27574. switch c {
  27575. case int32(0x20):
  27576. fallthrough
  27577. case int32(0xD):
  27578. fallthrough
  27579. case int32(0xA):
  27580. fallthrough
  27581. case int32(0x9):
  27582. return int32(1)
  27583. }
  27584. return 0
  27585. }
  27586. // C documentation
  27587. //
  27588. // /* Return 1 if there's just optional white space or there's an S
  27589. // followed by name=val.
  27590. // */
  27591. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27592. var c, v2 int32
  27593. var open int8
  27594. _, _, _ = c, open, v2
  27595. if ptr == end {
  27596. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27597. return int32(1)
  27598. }
  27599. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27600. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27601. return 0
  27602. }
  27603. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27604. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27605. }
  27606. if ptr == end {
  27607. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27608. return int32(1)
  27609. }
  27610. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27611. for {
  27612. c = _toAscii(tls, enc, ptr, end)
  27613. if c == -int32(1) {
  27614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27615. return 0
  27616. }
  27617. if c == int32(m_ASCII_EQUALS2) {
  27618. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27619. break
  27620. }
  27621. if _isSpace(tls, c) != 0 {
  27622. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27623. for {
  27624. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27625. goto _3
  27626. _3:
  27627. ;
  27628. v2 = _toAscii(tls, enc, ptr, end)
  27629. c = v2
  27630. if !(_isSpace(tls, v2) != 0) {
  27631. break
  27632. }
  27633. }
  27634. if c != int32(m_ASCII_EQUALS2) {
  27635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27636. return 0
  27637. }
  27638. break
  27639. }
  27640. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27641. goto _1
  27642. _1:
  27643. }
  27644. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27645. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27646. return 0
  27647. }
  27648. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27649. c = _toAscii(tls, enc, ptr, end)
  27650. for _isSpace(tls, c) != 0 {
  27651. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27652. c = _toAscii(tls, enc, ptr, end)
  27653. }
  27654. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27655. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27656. return 0
  27657. }
  27658. open = int8(c)
  27659. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27660. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27661. for {
  27662. c = _toAscii(tls, enc, ptr, end)
  27663. if c == int32(open) {
  27664. break
  27665. }
  27666. 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) {
  27667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27668. return 0
  27669. }
  27670. goto _4
  27671. _4:
  27672. ;
  27673. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27674. }
  27675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27676. return int32(1)
  27677. }
  27678. var _KW_version = [8]int8{
  27679. 0: int8(m_ASCII_v1),
  27680. 1: int8(m_ASCII_e2),
  27681. 2: int8(m_ASCII_r2),
  27682. 3: int8(m_ASCII_s2),
  27683. 4: int8(m_ASCII_i1),
  27684. 5: int8(m_ASCII_o2),
  27685. 6: int8(m_ASCII_n2),
  27686. }
  27687. var _KW_encoding = [9]int8{
  27688. 0: int8(m_ASCII_e2),
  27689. 1: int8(m_ASCII_n2),
  27690. 2: int8(m_ASCII_c2),
  27691. 3: int8(m_ASCII_o2),
  27692. 4: int8(m_ASCII_d1),
  27693. 5: int8(m_ASCII_i1),
  27694. 6: int8(m_ASCII_n2),
  27695. 7: int8(m_ASCII_g2),
  27696. }
  27697. var _KW_standalone = [11]int8{
  27698. 0: int8(m_ASCII_s2),
  27699. 1: int8(m_ASCII_t2),
  27700. 2: int8(m_ASCII_a2),
  27701. 3: int8(m_ASCII_n2),
  27702. 4: int8(m_ASCII_d1),
  27703. 5: int8(m_ASCII_a2),
  27704. 6: int8(m_ASCII_l2),
  27705. 7: int8(m_ASCII_o2),
  27706. 8: int8(m_ASCII_n2),
  27707. 9: int8(m_ASCII_e2),
  27708. }
  27709. var _KW_yes = [4]int8{
  27710. 0: int8(m_ASCII_y1),
  27711. 1: int8(m_ASCII_e2),
  27712. 2: int8(m_ASCII_s2),
  27713. }
  27714. var _KW_no = [3]int8{
  27715. 0: int8(m_ASCII_n2),
  27716. 1: int8(m_ASCII_o2),
  27717. }
  27718. 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) {
  27719. bp := tls.Alloc(32)
  27720. defer tls.Free(32)
  27721. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27722. var c int32
  27723. var _ /* name at bp+16 */ uintptr
  27724. var _ /* nameEnd at bp+24 */ uintptr
  27725. var _ /* val at bp+8 */ uintptr
  27726. _ = c
  27727. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27728. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  27729. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  27730. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27731. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27732. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27733. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27734. return 0
  27735. }
  27736. 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) {
  27737. if !(isGeneralTextEntity != 0) {
  27738. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27739. return 0
  27740. }
  27741. } else {
  27742. if versionPtr != 0 {
  27743. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27744. }
  27745. if versionEndPtr != 0 {
  27746. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27747. }
  27748. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27749. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27750. return 0
  27751. }
  27752. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27753. if isGeneralTextEntity != 0 {
  27754. /* a TextDecl must have an EncodingDecl */
  27755. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27756. return 0
  27757. }
  27758. return int32(1)
  27759. }
  27760. }
  27761. 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 {
  27762. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  27763. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27764. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27765. return 0
  27766. }
  27767. if encodingName != 0 {
  27768. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27769. }
  27770. if encoding != 0 {
  27771. *(*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))
  27772. }
  27773. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27774. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27775. return 0
  27776. }
  27777. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27778. return int32(1)
  27779. }
  27780. }
  27781. 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 {
  27782. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27783. return 0
  27784. }
  27785. 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 {
  27786. if standalone != 0 {
  27787. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27788. }
  27789. } else {
  27790. 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 {
  27791. if standalone != 0 {
  27792. *(*int32)(unsafe.Pointer(standalone)) = 0
  27793. }
  27794. } else {
  27795. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27796. return 0
  27797. }
  27798. }
  27799. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27800. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27801. }
  27802. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27803. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27804. return 0
  27805. }
  27806. return int32(1)
  27807. }
  27808. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27809. switch result >> libc.Int32FromInt32(8) {
  27810. case int32(0xD8):
  27811. fallthrough
  27812. case int32(0xD9):
  27813. fallthrough
  27814. case int32(0xDA):
  27815. fallthrough
  27816. case int32(0xDB):
  27817. fallthrough
  27818. case int32(0xDC):
  27819. fallthrough
  27820. case int32(0xDD):
  27821. fallthrough
  27822. case int32(0xDE):
  27823. fallthrough
  27824. case int32(0xDF):
  27825. return -int32(1)
  27826. case 0:
  27827. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  27828. return -int32(1)
  27829. }
  27830. case int32(0xFF):
  27831. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27832. return -int32(1)
  27833. }
  27834. break
  27835. }
  27836. return result
  27837. }
  27838. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27839. if c < 0 {
  27840. return 0
  27841. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  27842. if c < 128 {
  27843. *(*int8)(unsafe.Pointer(buf)) = int8(c | int32(_UTF8_cval1))
  27844. return int32(1)
  27845. }
  27846. if c < 2048 {
  27847. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  27848. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27849. return int32(2)
  27850. }
  27851. if c < 65536 {
  27852. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  27853. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27854. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27855. return int32(3)
  27856. }
  27857. if c < int32(0x110000) {
  27858. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  27859. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27860. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27861. *(*int8)(unsafe.Pointer(buf + 3)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27862. return int32(4)
  27863. }
  27864. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  27865. }
  27866. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  27867. if charNum < 0 {
  27868. return 0
  27869. }
  27870. if charNum < int32(0x10000) {
  27871. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  27872. return int32(1)
  27873. }
  27874. if charNum < int32(0x110000) {
  27875. charNum -= int32(0x10000)
  27876. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  27877. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  27878. return int32(2)
  27879. }
  27880. return 0
  27881. }
  27882. type Tunknown_encoding = struct {
  27883. Fnormal Tnormal_encoding
  27884. Fconvert TCONVERTER
  27885. FuserData uintptr
  27886. Futf16 [256]uint16
  27887. Futf8 [256][4]int8
  27888. }
  27889. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  27890. return int32(2016)
  27891. }
  27892. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27893. var c int32
  27894. var uenc uintptr
  27895. _, _ = c, uenc
  27896. uenc = enc
  27897. 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)
  27898. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27899. return 0
  27900. }
  27901. 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))))
  27902. }
  27903. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27904. var c int32
  27905. var uenc uintptr
  27906. _, _ = c, uenc
  27907. uenc = enc
  27908. 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)
  27909. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27910. return 0
  27911. }
  27912. 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))))
  27913. }
  27914. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27915. var c int32
  27916. var uenc uintptr
  27917. _, _ = c, uenc
  27918. uenc = enc
  27919. 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)
  27920. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  27921. }
  27922. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27923. bp := tls.Alloc(16)
  27924. defer tls.Free(16)
  27925. var c, n int32
  27926. var uenc, utf8, v2 uintptr
  27927. var _ /* buf at bp+0 */ [4]int8
  27928. _, _, _, _, _ = c, n, uenc, utf8, v2
  27929. uenc = enc
  27930. for {
  27931. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  27932. return int32(_XML_CONVERT_COMPLETED)
  27933. }
  27934. utf8 = uenc + 992 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*4
  27935. v2 = utf8
  27936. utf8++
  27937. n = int32(*(*int8)(unsafe.Pointer(v2)))
  27938. if n == 0 {
  27939. 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)))
  27940. n = XXmlUtf8Encode(tls, c, bp)
  27941. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27942. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27943. }
  27944. utf8 = bp
  27945. *(*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)))
  27946. } else {
  27947. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27948. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27949. }
  27950. *(*uintptr)(unsafe.Pointer(fromP))++
  27951. }
  27952. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  27953. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  27954. goto _1
  27955. _1:
  27956. }
  27957. return r
  27958. }
  27959. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27960. var c uint16
  27961. var uenc, v1, v2 uintptr
  27962. _, _, _, _ = c, uenc, v1, v2
  27963. uenc = enc
  27964. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  27965. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*2))
  27966. if libc.Int32FromUint16(c) == 0 {
  27967. 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))))
  27968. *(*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)))
  27969. } else {
  27970. *(*uintptr)(unsafe.Pointer(fromP))++
  27971. }
  27972. v2 = toP
  27973. v1 = *(*uintptr)(unsafe.Pointer(v2))
  27974. *(*uintptr)(unsafe.Pointer(v2)) += 2
  27975. *(*uint16)(unsafe.Pointer(v1)) = c
  27976. }
  27977. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  27978. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27979. } else {
  27980. return int32(_XML_CONVERT_COMPLETED)
  27981. }
  27982. return r
  27983. }
  27984. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  27985. var c, i, v3 int32
  27986. var e uintptr
  27987. _, _, _, _ = c, e, i, v3
  27988. e = mem
  27989. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  27990. i = 0
  27991. for {
  27992. if !(i < int32(128)) {
  27993. break
  27994. }
  27995. 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 {
  27996. return uintptr(0)
  27997. }
  27998. goto _1
  27999. _1:
  28000. ;
  28001. i++
  28002. }
  28003. i = 0
  28004. for {
  28005. if !(i < int32(256)) {
  28006. break
  28007. }
  28008. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  28009. if c == -int32(1) {
  28010. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  28011. /* This shouldn't really get used. */
  28012. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  28013. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  28014. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  28015. } else {
  28016. if c < 0 {
  28017. if c < -int32(4) {
  28018. return uintptr(0)
  28019. }
  28020. /* Multi-byte sequences need a converter function */
  28021. if !(convert != 0) {
  28022. return uintptr(0)
  28023. }
  28024. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  28025. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = 0
  28026. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  28027. } else {
  28028. if c < int32(0x80) {
  28029. 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 {
  28030. return uintptr(0)
  28031. }
  28032. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  28033. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  28034. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = int8(c)
  28035. if c == 0 {
  28036. v3 = int32(0xFFFF)
  28037. } else {
  28038. v3 = c
  28039. }
  28040. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  28041. } else {
  28042. if _checkCharRefNumber(tls, c) < 0 {
  28043. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  28044. /* This shouldn't really get used. */
  28045. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  28046. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(1)
  28047. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = 0
  28048. } else {
  28049. if c > int32(0xFFFF) {
  28050. return uintptr(0)
  28051. }
  28052. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  28053. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  28054. } else {
  28055. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  28056. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  28057. } else {
  28058. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  28059. }
  28060. }
  28061. *(*int8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = int8(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  28062. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  28063. }
  28064. }
  28065. }
  28066. }
  28067. goto _2
  28068. _2:
  28069. ;
  28070. i++
  28071. }
  28072. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  28073. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  28074. if convert != 0 {
  28075. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  28076. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  28077. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  28078. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  28079. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  28080. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  28081. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  28082. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  28083. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  28084. }
  28085. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  28086. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  28087. return e
  28088. }
  28089. const _UNKNOWN_ENC = -1
  28090. const _ISO_8859_1_ENC = 0
  28091. const _US_ASCII_ENC = 1
  28092. const _UTF_8_ENC = 2
  28093. const _UTF_16_ENC = 3
  28094. const _UTF_16BE_ENC = 4
  28095. const _UTF_16LE_ENC = 5
  28096. const
  28097. /* must match encodingNames up to here */
  28098. _NO_ENC = 6
  28099. var _KW_ISO_8859_1 = [11]int8{
  28100. 0: int8(m_ASCII_I),
  28101. 1: int8(m_ASCII_S),
  28102. 2: int8(m_ASCII_O),
  28103. 3: int8(m_ASCII_MINUS1),
  28104. 4: int8(m_ASCII_82),
  28105. 5: int8(m_ASCII_82),
  28106. 6: int8(m_ASCII_51),
  28107. 7: int8(m_ASCII_92),
  28108. 8: int8(m_ASCII_MINUS1),
  28109. 9: int8(m_ASCII_12),
  28110. }
  28111. var _KW_US_ASCII = [9]int8{
  28112. 0: int8(m_ASCII_U1),
  28113. 1: int8(m_ASCII_S),
  28114. 2: int8(m_ASCII_MINUS1),
  28115. 3: int8(m_ASCII_A),
  28116. 4: int8(m_ASCII_S),
  28117. 5: int8(m_ASCII_C),
  28118. 6: int8(m_ASCII_I),
  28119. 7: int8(m_ASCII_I),
  28120. }
  28121. var _KW_UTF_8 = [6]int8{
  28122. 0: int8(m_ASCII_U1),
  28123. 1: int8(m_ASCII_T),
  28124. 2: int8(m_ASCII_F),
  28125. 3: int8(m_ASCII_MINUS1),
  28126. 4: int8(m_ASCII_82),
  28127. }
  28128. var _KW_UTF_16 = [7]int8{
  28129. 0: int8(m_ASCII_U1),
  28130. 1: int8(m_ASCII_T),
  28131. 2: int8(m_ASCII_F),
  28132. 3: int8(m_ASCII_MINUS1),
  28133. 4: int8(m_ASCII_12),
  28134. 5: int8(m_ASCII_61),
  28135. }
  28136. var _KW_UTF_16BE = [9]int8{
  28137. 0: int8(m_ASCII_U1),
  28138. 1: int8(m_ASCII_T),
  28139. 2: int8(m_ASCII_F),
  28140. 3: int8(m_ASCII_MINUS1),
  28141. 4: int8(m_ASCII_12),
  28142. 5: int8(m_ASCII_61),
  28143. 6: int8(m_ASCII_B1),
  28144. 7: int8(m_ASCII_E),
  28145. }
  28146. var _KW_UTF_16LE = [9]int8{
  28147. 0: int8(m_ASCII_U1),
  28148. 1: int8(m_ASCII_T),
  28149. 2: int8(m_ASCII_F),
  28150. 3: int8(m_ASCII_MINUS1),
  28151. 4: int8(m_ASCII_12),
  28152. 5: int8(m_ASCII_61),
  28153. 6: int8(m_ASCII_L),
  28154. 7: int8(m_ASCII_E),
  28155. }
  28156. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28157. var i int32
  28158. _ = i
  28159. if name == libc.UintptrFromInt32(0) {
  28160. return int32(_NO_ENC)
  28161. }
  28162. i = 0
  28163. for {
  28164. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  28165. break
  28166. }
  28167. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28168. return i
  28169. }
  28170. goto _1
  28171. _1:
  28172. ;
  28173. i++
  28174. }
  28175. return int32(_UNKNOWN_ENC)
  28176. }
  28177. var _encodingNames = [6]uintptr{
  28178. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28179. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28180. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28181. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28182. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28183. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28184. }
  28185. /* For binary compatibility, we store the index of the encoding
  28186. specified at initialization in the isUtf16 member.
  28187. */
  28188. /* This is what detects the encoding. encodingTable maps from
  28189. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28190. the external (protocol) specified encoding; state is
  28191. XML_CONTENT_STATE if we're parsing an external text entity, and
  28192. XML_PROLOG_STATE otherwise.
  28193. */
  28194. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28195. var e int32
  28196. var encPtr uintptr
  28197. _, _ = e, encPtr
  28198. if ptr >= end {
  28199. return -int32(4)
  28200. }
  28201. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28202. if ptr+uintptr(1) == end {
  28203. /* only a single byte available for auto-detection */
  28204. /* so we're parsing an external text entity... */
  28205. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28206. switch int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28207. case int32(_UTF_16_ENC):
  28208. fallthrough
  28209. case int32(_UTF_16LE_ENC):
  28210. fallthrough
  28211. case int32(_UTF_16BE_ENC):
  28212. return -int32(1)
  28213. }
  28214. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))) {
  28215. case int32(0xFE):
  28216. fallthrough
  28217. case int32(0xFF):
  28218. fallthrough
  28219. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28220. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28221. break
  28222. }
  28223. /* fall through */
  28224. fallthrough
  28225. case 0x00:
  28226. fallthrough
  28227. case int32(0x3C):
  28228. return -int32(1)
  28229. }
  28230. } else {
  28231. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))) {
  28232. case int32(0xFEFF):
  28233. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28234. break
  28235. }
  28236. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28237. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28238. return int32(m_XML_TOK_BOM)
  28239. /* 00 3C is handled in the default case */
  28240. fallthrough
  28241. case int32(0x3C00):
  28242. 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) {
  28243. break
  28244. }
  28245. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28246. 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)
  28247. case int32(0xFFFE):
  28248. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28249. break
  28250. }
  28251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28252. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28253. return int32(m_XML_TOK_BOM)
  28254. case int32(0xEFBB):
  28255. /* Maybe a UTF-8 BOM (EF BB BF) */
  28256. /* If there's an explicitly specified (external) encoding
  28257. of ISO-8859-1 or some flavour of UTF-16
  28258. and this is an external text entity,
  28259. don't look for the BOM,
  28260. because it might be a legal data.
  28261. */
  28262. if state == int32(m_XML_CONTENT_STATE) {
  28263. e = int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28264. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28265. break
  28266. }
  28267. }
  28268. if ptr+uintptr(2) == end {
  28269. return -int32(1)
  28270. }
  28271. if libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 2)))) == int32(0xBF) {
  28272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28273. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  28274. return int32(m_XML_TOK_BOM)
  28275. }
  28276. default:
  28277. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32('\000') {
  28278. /* 0 isn't a legal data character. Furthermore a document
  28279. entity can only start with ASCII characters. So the only
  28280. way this can fail to be big-endian UTF-16 if it it's an
  28281. external parsed general entity that's labelled as
  28282. UTF-16LE.
  28283. */
  28284. if state == int32(m_XML_CONTENT_STATE) && int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28285. break
  28286. }
  28287. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28288. 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)
  28289. } else {
  28290. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28291. /* We could recover here in the case:
  28292. - parsing an external entity
  28293. - second byte is 0
  28294. - no externally specified encoding
  28295. - no encoding declaration
  28296. by assuming UTF-16LE. But we don't, because this would mean when
  28297. presented just with a single byte, we couldn't reliably determine
  28298. whether we needed further bytes.
  28299. */
  28300. if state == int32(m_XML_CONTENT_STATE) {
  28301. break
  28302. }
  28303. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28304. 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)
  28305. }
  28306. }
  28307. break
  28308. }
  28309. }
  28310. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  28311. 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)
  28312. }
  28313. /* This file is included!
  28314. __ __ _
  28315. ___\ \/ /_ __ __ _| |_
  28316. / _ \\ /| '_ \ / _` | __|
  28317. | __// \| |_) | (_| | |_
  28318. \___/_/\_\ .__/ \__,_|\__|
  28319. |_| XML parser
  28320. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28321. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28322. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28323. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28324. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28325. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28326. Licensed under the MIT license:
  28327. Permission is hereby granted, free of charge, to any person obtaining
  28328. a copy of this software and associated documentation files (the
  28329. "Software"), to deal in the Software without restriction, including
  28330. without limitation the rights to use, copy, modify, merge, publish,
  28331. distribute, sublicense, and/or sell copies of the Software, and to permit
  28332. persons to whom the Software is furnished to do so, subject to the
  28333. following conditions:
  28334. The above copyright notice and this permission notice shall be included
  28335. in all copies or substantial portions of the Software.
  28336. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28337. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28338. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28339. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28340. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28341. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28342. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28343. */
  28344. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28345. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28346. }
  28347. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28348. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28349. }
  28350. var _encodings = [7]uintptr{
  28351. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28352. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28353. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28354. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28355. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28356. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28357. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28358. }
  28359. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28360. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28361. }
  28362. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28363. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28364. }
  28365. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28366. var i int32
  28367. _ = i
  28368. i = _getEncodingIndex(tls, name)
  28369. if i == int32(_UNKNOWN_ENC) {
  28370. return 0
  28371. }
  28372. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28373. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28374. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  28375. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28376. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28377. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28378. return int32(1)
  28379. }
  28380. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28381. bp := tls.Alloc(144)
  28382. defer tls.Free(144)
  28383. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28384. var i int32
  28385. var _ /* buf at bp+8 */ [128]int8
  28386. var _ /* p at bp+136 */ uintptr
  28387. _ = i
  28388. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  28389. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28390. (*(*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))
  28391. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28392. return uintptr(0)
  28393. }
  28394. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  28395. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28396. return enc
  28397. }
  28398. i = _getEncodingIndex(tls, bp+8)
  28399. if i == int32(_UNKNOWN_ENC) {
  28400. return uintptr(0)
  28401. }
  28402. return _encodings[i]
  28403. }
  28404. 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) {
  28405. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28406. }
  28407. /* This file is included!
  28408. __ __ _
  28409. ___\ \/ /_ __ __ _| |_
  28410. / _ \\ /| '_ \ / _` | __|
  28411. | __// \| |_) | (_| | |_
  28412. \___/_/\_\ .__/ \__,_|\__|
  28413. |_| XML parser
  28414. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28415. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28416. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28417. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28418. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28419. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28420. Licensed under the MIT license:
  28421. Permission is hereby granted, free of charge, to any person obtaining
  28422. a copy of this software and associated documentation files (the
  28423. "Software"), to deal in the Software without restriction, including
  28424. without limitation the rights to use, copy, modify, merge, publish,
  28425. distribute, sublicense, and/or sell copies of the Software, and to permit
  28426. persons to whom the Software is furnished to do so, subject to the
  28427. following conditions:
  28428. The above copyright notice and this permission notice shall be included
  28429. in all copies or substantial portions of the Software.
  28430. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28431. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28432. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28433. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28434. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28435. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28436. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28437. */
  28438. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28439. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28440. }
  28441. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28442. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28443. }
  28444. var _encodingsNS = [7]uintptr{
  28445. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28446. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28447. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28448. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28449. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28450. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28451. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28452. }
  28453. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28454. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28455. }
  28456. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28457. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28458. }
  28459. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28460. var i int32
  28461. _ = i
  28462. i = _getEncodingIndex(tls, name)
  28463. if i == int32(_UNKNOWN_ENC) {
  28464. return 0
  28465. }
  28466. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28467. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28468. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  28469. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28470. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28471. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28472. return int32(1)
  28473. }
  28474. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28475. bp := tls.Alloc(144)
  28476. defer tls.Free(144)
  28477. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28478. var i int32
  28479. var _ /* buf at bp+8 */ [128]int8
  28480. var _ /* p at bp+136 */ uintptr
  28481. _ = i
  28482. *(*[128]int8)(unsafe.Pointer(bp + 8)) = [128]int8{}
  28483. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28484. (*(*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))
  28485. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28486. return uintptr(0)
  28487. }
  28488. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = 0
  28489. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28490. return enc
  28491. }
  28492. i = _getEncodingIndex(tls, bp+8)
  28493. if i == int32(_UNKNOWN_ENC) {
  28494. return uintptr(0)
  28495. }
  28496. return _encodingsNS[i]
  28497. }
  28498. 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) {
  28499. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28500. }
  28501. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28502. var enc uintptr
  28503. _ = enc
  28504. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28505. if enc != 0 {
  28506. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  28507. }
  28508. return enc
  28509. }
  28510. func __ccgo_fp(f interface{}) uintptr {
  28511. type iface [2]uintptr
  28512. return (*iface)(unsafe.Pointer(&f))[1]
  28513. }
  28514. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28515. 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"