ccgo_linux_riscv64.go 1.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140
  1. // Code generated for linux/riscv64 by 'generator --prefix-enumerator=_ --prefix-external=x_ --prefix-field=F --prefix-macro=m_ --prefix-static-internal=_ --prefix-static-none=_ --prefix-tagged-enum=_ --prefix-tagged-struct=T --prefix-tagged-union=T --prefix-typename=T --prefix-undefined=_ -I /home/jnml/src/modernc.org/builder/.exclude/modernc.org/libbsd/include/linux/riscv64 -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 && riscv64
  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__CS_GNU_LIBC_VERSION = 2
  639. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  640. const m__CS_PATH = 0
  641. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  642. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  643. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  644. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  645. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  646. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  647. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  648. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  649. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  650. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  651. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  652. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  653. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  654. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  655. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  656. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  657. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  658. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  659. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  660. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  661. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  662. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  663. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  664. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  665. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  666. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  667. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  668. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  669. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  670. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  671. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  672. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  673. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  674. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  675. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  676. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  677. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  678. const m__CS_V6_ENV = 1148
  679. const m__CS_V7_ENV = 1149
  680. const m__GNU_SOURCE = 1
  681. const m__IOFBF = 0
  682. const m__IOLBF = 1
  683. const m__IONBF = 2
  684. const m__LP64 = 1
  685. const m__PC_2_SYMLINKS = 20
  686. const m__PC_ALLOC_SIZE_MIN = 18
  687. const m__PC_ASYNC_IO = 10
  688. const m__PC_CHOWN_RESTRICTED = 6
  689. const m__PC_FILESIZEBITS = 13
  690. const m__PC_LINK_MAX = 0
  691. const m__PC_MAX_CANON = 1
  692. const m__PC_MAX_INPUT = 2
  693. const m__PC_NAME_MAX = 3
  694. const m__PC_NO_TRUNC = 7
  695. const m__PC_PATH_MAX = 4
  696. const m__PC_PIPE_BUF = 5
  697. const m__PC_PRIO_IO = 11
  698. const m__PC_REC_INCR_XFER_SIZE = 14
  699. const m__PC_REC_MAX_XFER_SIZE = 15
  700. const m__PC_REC_MIN_XFER_SIZE = 16
  701. const m__PC_REC_XFER_ALIGN = 17
  702. const m__PC_SOCK_MAXBUF = 12
  703. const m__PC_SYMLINK_MAX = 19
  704. const m__PC_SYNC_IO = 9
  705. const m__PC_VDISABLE = 8
  706. const m__POSIX2_BC_BASE_MAX = 99
  707. const m__POSIX2_BC_DIM_MAX = 2048
  708. const m__POSIX2_BC_SCALE_MAX = 99
  709. const m__POSIX2_BC_STRING_MAX = 1000
  710. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  711. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  712. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  713. const m__POSIX2_EXPR_NEST_MAX = 32
  714. const m__POSIX2_LINE_MAX = 2048
  715. const m__POSIX2_RE_DUP_MAX = 255
  716. const m__POSIX2_VERSION = "_POSIX_VERSION"
  717. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  718. const m__POSIX_AIO_LISTIO_MAX = 2
  719. const m__POSIX_AIO_MAX = 1
  720. const m__POSIX_ARG_MAX = 4096
  721. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  722. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  723. const m__POSIX_CHILD_MAX = 25
  724. const m__POSIX_CHOWN_RESTRICTED = 1
  725. const m__POSIX_CLOCKRES_MIN = 20000000
  726. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  727. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  728. const m__POSIX_DELAYTIMER_MAX = 32
  729. const m__POSIX_FSYNC = "_POSIX_VERSION"
  730. const m__POSIX_HOST_NAME_MAX = 255
  731. const m__POSIX_IPV6 = "_POSIX_VERSION"
  732. const m__POSIX_JOB_CONTROL = 1
  733. const m__POSIX_LINK_MAX = 8
  734. const m__POSIX_LOGIN_NAME_MAX = 9
  735. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  736. const m__POSIX_MAX_CANON = 255
  737. const m__POSIX_MAX_INPUT = 255
  738. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  739. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  740. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  741. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  742. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  743. const m__POSIX_MQ_OPEN_MAX = 8
  744. const m__POSIX_MQ_PRIO_MAX = 32
  745. const m__POSIX_NAME_MAX = 14
  746. const m__POSIX_NGROUPS_MAX = 8
  747. const m__POSIX_NO_TRUNC = 1
  748. const m__POSIX_OPEN_MAX = 20
  749. const m__POSIX_PATH_MAX = 256
  750. const m__POSIX_PIPE_BUF = 512
  751. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  752. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  753. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  754. const m__POSIX_REGEXP = 1
  755. const m__POSIX_RE_DUP_MAX = 255
  756. const m__POSIX_RTSIG_MAX = 8
  757. const m__POSIX_SAVED_IDS = 1
  758. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  759. const m__POSIX_SEM_NSEMS_MAX = 256
  760. const m__POSIX_SEM_VALUE_MAX = 32767
  761. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  762. const m__POSIX_SHELL = 1
  763. const m__POSIX_SIGQUEUE_MAX = 32
  764. const m__POSIX_SPAWN = "_POSIX_VERSION"
  765. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  766. const m__POSIX_SSIZE_MAX = 32767
  767. const m__POSIX_SS_REPL_MAX = 4
  768. const m__POSIX_STREAM_MAX = 8
  769. const m__POSIX_SYMLINK_MAX = 255
  770. const m__POSIX_SYMLOOP_MAX = 8
  771. const m__POSIX_THREADS = "_POSIX_VERSION"
  772. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  773. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  774. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  775. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  776. const m__POSIX_THREAD_KEYS_MAX = 128
  777. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  778. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  779. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  780. const m__POSIX_THREAD_THREADS_MAX = 64
  781. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  782. const m__POSIX_TIMERS = "_POSIX_VERSION"
  783. const m__POSIX_TIMER_MAX = 32
  784. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  785. const m__POSIX_TRACE_NAME_MAX = 8
  786. const m__POSIX_TRACE_SYS_MAX = 8
  787. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  788. const m__POSIX_TTY_NAME_MAX = 9
  789. const m__POSIX_TZNAME_MAX = 6
  790. const m__POSIX_V6_LP64_OFF64 = 1
  791. const m__POSIX_V7_LP64_OFF64 = 1
  792. const m__POSIX_VDISABLE = 0
  793. const m__POSIX_VERSION = 200809
  794. const m__SC_2_CHAR_TERM = 95
  795. const m__SC_2_C_BIND = 47
  796. const m__SC_2_C_DEV = 48
  797. const m__SC_2_FORT_DEV = 49
  798. const m__SC_2_FORT_RUN = 50
  799. const m__SC_2_LOCALEDEF = 52
  800. const m__SC_2_PBS = 168
  801. const m__SC_2_PBS_ACCOUNTING = 169
  802. const m__SC_2_PBS_CHECKPOINT = 175
  803. const m__SC_2_PBS_LOCATE = 170
  804. const m__SC_2_PBS_MESSAGE = 171
  805. const m__SC_2_PBS_TRACK = 172
  806. const m__SC_2_SW_DEV = 51
  807. const m__SC_2_UPE = 97
  808. const m__SC_2_VERSION = 46
  809. const m__SC_ADVISORY_INFO = 132
  810. const m__SC_AIO_LISTIO_MAX = 23
  811. const m__SC_AIO_MAX = 24
  812. const m__SC_AIO_PRIO_DELTA_MAX = 25
  813. const m__SC_ARG_MAX = 0
  814. const m__SC_ASYNCHRONOUS_IO = 12
  815. const m__SC_ATEXIT_MAX = 87
  816. const m__SC_AVPHYS_PAGES = 86
  817. const m__SC_BARRIERS = 133
  818. const m__SC_BC_BASE_MAX = 36
  819. const m__SC_BC_DIM_MAX = 37
  820. const m__SC_BC_SCALE_MAX = 38
  821. const m__SC_BC_STRING_MAX = 39
  822. const m__SC_CHILD_MAX = 1
  823. const m__SC_CLK_TCK = 2
  824. const m__SC_CLOCK_SELECTION = 137
  825. const m__SC_COLL_WEIGHTS_MAX = 40
  826. const m__SC_CPUTIME = 138
  827. const m__SC_DELAYTIMER_MAX = 26
  828. const m__SC_EXPR_NEST_MAX = 42
  829. const m__SC_FSYNC = 15
  830. const m__SC_GETGR_R_SIZE_MAX = 69
  831. const m__SC_GETPW_R_SIZE_MAX = 70
  832. const m__SC_HOST_NAME_MAX = 180
  833. const m__SC_IOV_MAX = 60
  834. const m__SC_IPV6 = 235
  835. const m__SC_JOB_CONTROL = 7
  836. const m__SC_LINE_MAX = 43
  837. const m__SC_LOGIN_NAME_MAX = 71
  838. const m__SC_MAPPED_FILES = 16
  839. const m__SC_MEMLOCK = 17
  840. const m__SC_MEMLOCK_RANGE = 18
  841. const m__SC_MEMORY_PROTECTION = 19
  842. const m__SC_MESSAGE_PASSING = 20
  843. const m__SC_MINSIGSTKSZ = 249
  844. const m__SC_MONOTONIC_CLOCK = 149
  845. const m__SC_MQ_OPEN_MAX = 27
  846. const m__SC_MQ_PRIO_MAX = 28
  847. const m__SC_NGROUPS_MAX = 3
  848. const m__SC_NPROCESSORS_CONF = 83
  849. const m__SC_NPROCESSORS_ONLN = 84
  850. const m__SC_NZERO = 109
  851. const m__SC_OPEN_MAX = 4
  852. const m__SC_PAGESIZE = 30
  853. const m__SC_PAGE_SIZE = 30
  854. const m__SC_PASS_MAX = 88
  855. const m__SC_PHYS_PAGES = 85
  856. const m__SC_PRIORITIZED_IO = 13
  857. const m__SC_PRIORITY_SCHEDULING = 10
  858. const m__SC_RAW_SOCKETS = 236
  859. const m__SC_READER_WRITER_LOCKS = 153
  860. const m__SC_REALTIME_SIGNALS = 9
  861. const m__SC_REGEXP = 155
  862. const m__SC_RE_DUP_MAX = 44
  863. const m__SC_RTSIG_MAX = 31
  864. const m__SC_SAVED_IDS = 8
  865. const m__SC_SEMAPHORES = 21
  866. const m__SC_SEM_NSEMS_MAX = 32
  867. const m__SC_SEM_VALUE_MAX = 33
  868. const m__SC_SHARED_MEMORY_OBJECTS = 22
  869. const m__SC_SHELL = 157
  870. const m__SC_SIGQUEUE_MAX = 34
  871. const m__SC_SIGSTKSZ = 250
  872. const m__SC_SPAWN = 159
  873. const m__SC_SPIN_LOCKS = 154
  874. const m__SC_SPORADIC_SERVER = 160
  875. const m__SC_SS_REPL_MAX = 241
  876. const m__SC_STREAMS = 174
  877. const m__SC_STREAM_MAX = 5
  878. const m__SC_SYMLOOP_MAX = 173
  879. const m__SC_SYNCHRONIZED_IO = 14
  880. const m__SC_THREADS = 67
  881. const m__SC_THREAD_ATTR_STACKADDR = 77
  882. const m__SC_THREAD_ATTR_STACKSIZE = 78
  883. const m__SC_THREAD_CPUTIME = 139
  884. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  885. const m__SC_THREAD_KEYS_MAX = 74
  886. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  887. const m__SC_THREAD_PRIO_INHERIT = 80
  888. const m__SC_THREAD_PRIO_PROTECT = 81
  889. const m__SC_THREAD_PROCESS_SHARED = 82
  890. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  891. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  892. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  893. const m__SC_THREAD_SPORADIC_SERVER = 161
  894. const m__SC_THREAD_STACK_MIN = 75
  895. const m__SC_THREAD_THREADS_MAX = 76
  896. const m__SC_TIMEOUTS = 164
  897. const m__SC_TIMERS = 11
  898. const m__SC_TIMER_MAX = 35
  899. const m__SC_TRACE = 181
  900. const m__SC_TRACE_EVENT_FILTER = 182
  901. const m__SC_TRACE_EVENT_NAME_MAX = 242
  902. const m__SC_TRACE_INHERIT = 183
  903. const m__SC_TRACE_LOG = 184
  904. const m__SC_TRACE_NAME_MAX = 243
  905. const m__SC_TRACE_SYS_MAX = 244
  906. const m__SC_TRACE_USER_EVENT_MAX = 245
  907. const m__SC_TTY_NAME_MAX = 72
  908. const m__SC_TYPED_MEMORY_OBJECTS = 165
  909. const m__SC_TZNAME_MAX = 6
  910. const m__SC_UIO_MAXIOV = 60
  911. const m__SC_V6_ILP32_OFF32 = 176
  912. const m__SC_V6_ILP32_OFFBIG = 177
  913. const m__SC_V6_LP64_OFF64 = 178
  914. const m__SC_V6_LPBIG_OFFBIG = 179
  915. const m__SC_V7_ILP32_OFF32 = 237
  916. const m__SC_V7_ILP32_OFFBIG = 238
  917. const m__SC_V7_LP64_OFF64 = 239
  918. const m__SC_V7_LPBIG_OFFBIG = 240
  919. const m__SC_VERSION = 29
  920. const m__SC_XBS5_ILP32_OFF32 = 125
  921. const m__SC_XBS5_ILP32_OFFBIG = 126
  922. const m__SC_XBS5_LP64_OFF64 = 127
  923. const m__SC_XBS5_LPBIG_OFFBIG = 128
  924. const m__SC_XOPEN_CRYPT = 92
  925. const m__SC_XOPEN_ENH_I18N = 93
  926. const m__SC_XOPEN_LEGACY = 129
  927. const m__SC_XOPEN_REALTIME = 130
  928. const m__SC_XOPEN_REALTIME_THREADS = 131
  929. const m__SC_XOPEN_SHM = 94
  930. const m__SC_XOPEN_STREAMS = 246
  931. const m__SC_XOPEN_UNIX = 91
  932. const m__SC_XOPEN_VERSION = 89
  933. const m__SC_XOPEN_XCU_VERSION = 90
  934. const m__SC_XOPEN_XPG2 = 98
  935. const m__SC_XOPEN_XPG3 = 99
  936. const m__SC_XOPEN_XPG4 = 100
  937. const m__STDC_PREDEF_H = 1
  938. const m__XOPEN_ENH_I18N = 1
  939. const m__XOPEN_IOV_MAX = 16
  940. const m__XOPEN_NAME_MAX = 255
  941. const m__XOPEN_PATH_MAX = 1024
  942. const m__XOPEN_UNIX = 1
  943. const m__XOPEN_VERSION = 700
  944. const m___ATOMIC_ACQUIRE = 2
  945. const m___ATOMIC_ACQ_REL = 4
  946. const m___ATOMIC_CONSUME = 1
  947. const m___ATOMIC_RELAXED = 0
  948. const m___ATOMIC_RELEASE = 3
  949. const m___ATOMIC_SEQ_CST = 5
  950. const m___BIGGEST_ALIGNMENT__ = 16
  951. const m___BIG_ENDIAN = 4321
  952. const m___BYTE_ORDER = 1234
  953. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  954. const m___CCGO__ = 1
  955. const m___CHAR_BIT__ = 8
  956. const m___CHAR_UNSIGNED__ = 1
  957. const m___DBL_DECIMAL_DIG__ = 17
  958. const m___DBL_DIG__ = 15
  959. const m___DBL_HAS_DENORM__ = 1
  960. const m___DBL_HAS_INFINITY__ = 1
  961. const m___DBL_HAS_QUIET_NAN__ = 1
  962. const m___DBL_IS_IEC_60559__ = 1
  963. const m___DBL_MANT_DIG__ = 53
  964. const m___DBL_MAX_10_EXP__ = 308
  965. const m___DBL_MAX_EXP__ = 1024
  966. const m___DECIMAL_DIG__ = 36
  967. const m___DEC_EVAL_METHOD__ = 2
  968. const m___ELF__ = 1
  969. const m___FINITE_MATH_ONLY__ = 0
  970. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  971. const m___FLT128_DECIMAL_DIG__ = 36
  972. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  973. const m___FLT128_DIG__ = 33
  974. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  975. const m___FLT128_HAS_DENORM__ = 1
  976. const m___FLT128_HAS_INFINITY__ = 1
  977. const m___FLT128_HAS_QUIET_NAN__ = 1
  978. const m___FLT128_IS_IEC_60559__ = 1
  979. const m___FLT128_MANT_DIG__ = 113
  980. const m___FLT128_MAX_10_EXP__ = 4932
  981. const m___FLT128_MAX_EXP__ = 16384
  982. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  983. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  984. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  985. const m___FLT16_DECIMAL_DIG__ = 5
  986. const m___FLT16_DENORM_MIN__ = 5.96046447753906250000000000000000000e-8
  987. const m___FLT16_DIG__ = 3
  988. const m___FLT16_EPSILON__ = 9.76562500000000000000000000000000000e-4
  989. const m___FLT16_HAS_DENORM__ = 1
  990. const m___FLT16_HAS_INFINITY__ = 1
  991. const m___FLT16_HAS_QUIET_NAN__ = 1
  992. const m___FLT16_IS_IEC_60559__ = 1
  993. const m___FLT16_MANT_DIG__ = 11
  994. const m___FLT16_MAX_10_EXP__ = 4
  995. const m___FLT16_MAX_EXP__ = 16
  996. const m___FLT16_MAX__ = 6.55040000000000000000000000000000000e+4
  997. const m___FLT16_MIN__ = 6.10351562500000000000000000000000000e-5
  998. const m___FLT16_NORM_MAX__ = 6.55040000000000000000000000000000000e+4
  999. const m___FLT32X_DECIMAL_DIG__ = 17
  1000. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1001. const m___FLT32X_DIG__ = 15
  1002. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1003. const m___FLT32X_HAS_DENORM__ = 1
  1004. const m___FLT32X_HAS_INFINITY__ = 1
  1005. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1006. const m___FLT32X_IS_IEC_60559__ = 1
  1007. const m___FLT32X_MANT_DIG__ = 53
  1008. const m___FLT32X_MAX_10_EXP__ = 308
  1009. const m___FLT32X_MAX_EXP__ = 1024
  1010. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1011. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1012. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1013. const m___FLT32_DECIMAL_DIG__ = 9
  1014. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1015. const m___FLT32_DIG__ = 6
  1016. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1017. const m___FLT32_HAS_DENORM__ = 1
  1018. const m___FLT32_HAS_INFINITY__ = 1
  1019. const m___FLT32_HAS_QUIET_NAN__ = 1
  1020. const m___FLT32_IS_IEC_60559__ = 1
  1021. const m___FLT32_MANT_DIG__ = 24
  1022. const m___FLT32_MAX_10_EXP__ = 38
  1023. const m___FLT32_MAX_EXP__ = 128
  1024. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1025. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1026. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1027. const m___FLT64X_DECIMAL_DIG__ = 36
  1028. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1029. const m___FLT64X_DIG__ = 33
  1030. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1031. const m___FLT64X_HAS_DENORM__ = 1
  1032. const m___FLT64X_HAS_INFINITY__ = 1
  1033. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1034. const m___FLT64X_IS_IEC_60559__ = 1
  1035. const m___FLT64X_MANT_DIG__ = 113
  1036. const m___FLT64X_MAX_10_EXP__ = 4932
  1037. const m___FLT64X_MAX_EXP__ = 16384
  1038. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1039. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1040. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1041. const m___FLT64_DECIMAL_DIG__ = 17
  1042. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1043. const m___FLT64_DIG__ = 15
  1044. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1045. const m___FLT64_HAS_DENORM__ = 1
  1046. const m___FLT64_HAS_INFINITY__ = 1
  1047. const m___FLT64_HAS_QUIET_NAN__ = 1
  1048. const m___FLT64_IS_IEC_60559__ = 1
  1049. const m___FLT64_MANT_DIG__ = 53
  1050. const m___FLT64_MAX_10_EXP__ = 308
  1051. const m___FLT64_MAX_EXP__ = 1024
  1052. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1053. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1054. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1055. const m___FLT_DECIMAL_DIG__ = 9
  1056. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1057. const m___FLT_DIG__ = 6
  1058. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1059. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1060. const m___FLT_EVAL_METHOD__ = 0
  1061. const m___FLT_HAS_DENORM__ = 1
  1062. const m___FLT_HAS_INFINITY__ = 1
  1063. const m___FLT_HAS_QUIET_NAN__ = 1
  1064. const m___FLT_IS_IEC_60559__ = 1
  1065. const m___FLT_MANT_DIG__ = 24
  1066. const m___FLT_MAX_10_EXP__ = 38
  1067. const m___FLT_MAX_EXP__ = 128
  1068. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1069. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1070. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1071. const m___FLT_RADIX__ = 2
  1072. const m___FP_FAST_FMA = 1
  1073. const m___FP_FAST_FMAF = 1
  1074. const m___FP_FAST_FMAF32 = 1
  1075. const m___FP_FAST_FMAF32x = 1
  1076. const m___FP_FAST_FMAF64 = 1
  1077. const m___FUNCTION__ = "__func__"
  1078. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1079. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1080. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1081. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1082. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1083. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1084. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1085. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1086. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1087. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1088. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1089. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1090. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1091. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1092. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1093. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1094. const m___GCC_IEC_559 = 2
  1095. const m___GCC_IEC_559_COMPLEX = 2
  1096. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1097. const m___GNUC_MINOR__ = 2
  1098. const m___GNUC_PATCHLEVEL__ = 0
  1099. const m___GNUC_STDC_INLINE__ = 1
  1100. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1101. const m___GNUC__ = 14
  1102. const m___GXX_ABI_VERSION = 1019
  1103. const m___INT16_MAX__ = 0x7fff
  1104. const m___INT32_MAX__ = 0x7fffffff
  1105. const m___INT32_TYPE__ = "int"
  1106. const m___INT64_MAX__ = 0x7fffffffffffffff
  1107. const m___INT8_MAX__ = 0x7f
  1108. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1109. const m___INTMAX_WIDTH__ = 64
  1110. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1111. const m___INTPTR_WIDTH__ = 64
  1112. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1113. const m___INT_FAST16_WIDTH__ = 64
  1114. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1115. const m___INT_FAST32_WIDTH__ = 64
  1116. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1117. const m___INT_FAST64_WIDTH__ = 64
  1118. const m___INT_FAST8_MAX__ = 0x7f
  1119. const m___INT_FAST8_WIDTH__ = 8
  1120. const m___INT_LEAST16_MAX__ = 0x7fff
  1121. const m___INT_LEAST16_WIDTH__ = 16
  1122. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1123. const m___INT_LEAST32_TYPE__ = "int"
  1124. const m___INT_LEAST32_WIDTH__ = 32
  1125. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1126. const m___INT_LEAST64_WIDTH__ = 64
  1127. const m___INT_LEAST8_MAX__ = 0x7f
  1128. const m___INT_LEAST8_WIDTH__ = 8
  1129. const m___INT_MAX__ = 0x7fffffff
  1130. const m___INT_WIDTH__ = 32
  1131. const m___LDBL_DECIMAL_DIG__ = 36
  1132. const m___LDBL_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1133. const m___LDBL_DIG__ = 33
  1134. const m___LDBL_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1135. const m___LDBL_HAS_DENORM__ = 1
  1136. const m___LDBL_HAS_INFINITY__ = 1
  1137. const m___LDBL_HAS_QUIET_NAN__ = 1
  1138. const m___LDBL_IS_IEC_60559__ = 1
  1139. const m___LDBL_MANT_DIG__ = 113
  1140. const m___LDBL_MAX_10_EXP__ = 4932
  1141. const m___LDBL_MAX_EXP__ = 16384
  1142. const m___LDBL_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1143. const m___LDBL_MIN__ = 3.36210314311209350626267781732175260e-4932
  1144. const m___LDBL_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1145. const m___LITTLE_ENDIAN = 1234
  1146. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1147. const m___LONG_LONG_WIDTH__ = 64
  1148. const m___LONG_MAX = 0x7fffffffffffffff
  1149. const m___LONG_MAX__ = 0x7fffffffffffffff
  1150. const m___LONG_WIDTH__ = 64
  1151. const m___LP64__ = 1
  1152. const m___NO_INLINE__ = 1
  1153. const m___ORDER_BIG_ENDIAN__ = 4321
  1154. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1155. const m___ORDER_PDP_ENDIAN__ = 3412
  1156. const m___PDP_ENDIAN = 3412
  1157. const m___PIC__ = 2
  1158. const m___PIE__ = 2
  1159. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1160. const m___PRETTY_FUNCTION__ = "__func__"
  1161. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1162. const m___PTRDIFF_WIDTH__ = 64
  1163. const m___SCHAR_MAX__ = 0x7f
  1164. const m___SCHAR_WIDTH__ = 8
  1165. const m___SHRT_MAX__ = 0x7fff
  1166. const m___SHRT_WIDTH__ = 16
  1167. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1168. const m___SIG_ATOMIC_TYPE__ = "int"
  1169. const m___SIG_ATOMIC_WIDTH__ = 32
  1170. const m___SIZEOF_DOUBLE__ = 8
  1171. const m___SIZEOF_FLOAT__ = 4
  1172. const m___SIZEOF_INT128__ = 16
  1173. const m___SIZEOF_INT__ = 4
  1174. const m___SIZEOF_LONG_DOUBLE__ = 8
  1175. const m___SIZEOF_LONG_LONG__ = 8
  1176. const m___SIZEOF_LONG__ = 8
  1177. const m___SIZEOF_POINTER__ = 8
  1178. const m___SIZEOF_PTRDIFF_T__ = 8
  1179. const m___SIZEOF_SHORT__ = 2
  1180. const m___SIZEOF_SIZE_T__ = 8
  1181. const m___SIZEOF_WCHAR_T__ = 4
  1182. const m___SIZEOF_WINT_T__ = 4
  1183. const m___SIZE_MAX__ = 0xffffffffffffffff
  1184. const m___SIZE_WIDTH__ = 64
  1185. const m___STDC_HOSTED__ = 1
  1186. const m___STDC_IEC_559_COMPLEX__ = 1
  1187. const m___STDC_IEC_559__ = 1
  1188. const m___STDC_IEC_60559_BFP__ = 201404
  1189. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1190. const m___STDC_ISO_10646__ = 201706
  1191. const m___STDC_UTF_16__ = 1
  1192. const m___STDC_UTF_32__ = 1
  1193. const m___STDC_VERSION__ = 201710
  1194. const m___STDC__ = 1
  1195. const m___UINT16_MAX__ = 0xffff
  1196. const m___UINT32_MAX__ = 0xffffffff
  1197. const m___UINT64_MAX__ = 0xffffffffffffffff
  1198. const m___UINT8_MAX__ = 0xff
  1199. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1200. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1201. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1202. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1203. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1204. const m___UINT_FAST8_MAX__ = 0xff
  1205. const m___UINT_LEAST16_MAX__ = 0xffff
  1206. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1207. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1208. const m___UINT_LEAST8_MAX__ = 0xff
  1209. const m___USE_TIME_BITS64 = 1
  1210. const m___VERSION__ = "14.2.0"
  1211. const m___WCHAR_MAX__ = 0x7fffffff
  1212. const m___WCHAR_TYPE__ = "int"
  1213. const m___WCHAR_WIDTH__ = 32
  1214. const m___WINT_MAX__ = 0xffffffff
  1215. const m___WINT_MIN__ = 0
  1216. const m___WINT_WIDTH__ = 32
  1217. const m___gnu_linux__ = 1
  1218. const m___inline = "inline"
  1219. const m___linux = 1
  1220. const m___linux__ = 1
  1221. const m___pic__ = 2
  1222. const m___pie__ = 2
  1223. const m___restrict = "restrict"
  1224. const m___restrict_arr = "restrict"
  1225. const m___riscv = 1
  1226. const m___riscv_a = 2001000
  1227. const m___riscv_arch_test = 1
  1228. const m___riscv_atomic = 1
  1229. const m___riscv_c = 2000000
  1230. const m___riscv_cmodel_medany = 1
  1231. const m___riscv_compressed = 1
  1232. const m___riscv_d = 2002000
  1233. const m___riscv_div = 1
  1234. const m___riscv_f = 2002000
  1235. const m___riscv_fdiv = 1
  1236. const m___riscv_flen = 64
  1237. const m___riscv_float_abi_double = 1
  1238. const m___riscv_fsqrt = 1
  1239. const m___riscv_i = 2001000
  1240. const m___riscv_m = 2000000
  1241. const m___riscv_misaligned_slow = 1
  1242. const m___riscv_mul = 1
  1243. const m___riscv_muldiv = 1
  1244. const m___riscv_xlen = 64
  1245. const m___riscv_zicsr = 2000000
  1246. const m___riscv_zifencei = 2000000
  1247. const m___unix = 1
  1248. const m___unix__ = 1
  1249. const m_alloca = "__builtin_alloca"
  1250. const m_inline = "__inline"
  1251. const m_linux = 1
  1252. const m_loff_t = "off_t"
  1253. const m_math_errhandling = 2
  1254. const m_static_assert = "_Static_assert"
  1255. const m_unix = 1
  1256. type t__builtin_va_list = uintptr
  1257. type t__predefined_size_t = uint64
  1258. type t__predefined_wchar_t = int32
  1259. type t__predefined_ptrdiff_t = int64
  1260. type Twchar_t = int32
  1261. type Tmax_align_t = struct {
  1262. F__ll int64
  1263. F__ld float64
  1264. }
  1265. type Tsize_t = uint64
  1266. type Tptrdiff_t = int64
  1267. type Tlocale_t = uintptr
  1268. type Tssize_t = int64
  1269. type Toff_t = int64
  1270. type Tva_list = uintptr
  1271. type t__isoc_va_list = uintptr
  1272. type Tfpos_t = struct {
  1273. F__lldata [0]int64
  1274. F__align [0]float64
  1275. F__opaque [16]uint8
  1276. }
  1277. type T_G_fpos64_t = Tfpos_t
  1278. type Tcookie_io_functions_t = struct {
  1279. Fread uintptr
  1280. Fwrite uintptr
  1281. Fseek uintptr
  1282. Fclose1 uintptr
  1283. }
  1284. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1285. type Tdiv_t = struct {
  1286. Fquot int32
  1287. Frem int32
  1288. }
  1289. type Tldiv_t = struct {
  1290. Fquot int64
  1291. Frem int64
  1292. }
  1293. type Tlldiv_t = struct {
  1294. Fquot int64
  1295. Frem int64
  1296. }
  1297. type Tuintptr_t = uint64
  1298. type Tintptr_t = int64
  1299. type Tint8_t = int8
  1300. type Tint16_t = int16
  1301. type Tint32_t = int32
  1302. type Tint64_t = int64
  1303. type Tintmax_t = int64
  1304. type Tuint8_t = uint8
  1305. type Tuint16_t = uint16
  1306. type Tuint32_t = uint32
  1307. type Tuint64_t = uint64
  1308. type Tuintmax_t = uint64
  1309. type Tint_fast8_t = int8
  1310. type Tint_fast64_t = int64
  1311. type Tint_least8_t = int8
  1312. type Tint_least16_t = int16
  1313. type Tint_least32_t = int32
  1314. type Tint_least64_t = int64
  1315. type Tuint_fast8_t = uint8
  1316. type Tuint_fast64_t = uint64
  1317. type Tuint_least8_t = uint8
  1318. type Tuint_least16_t = uint16
  1319. type Tuint_least32_t = uint32
  1320. type Tuint_least64_t = uint64
  1321. type Tint_fast16_t = int32
  1322. type Tint_fast32_t = int32
  1323. type Tuint_fast16_t = uint32
  1324. type Tuint_fast32_t = uint32
  1325. type Tfloat_t = float32
  1326. type Tdouble_t = float64
  1327. type Ttime_t = int64
  1328. type Tsuseconds_t = int64
  1329. type Ttimeval = struct {
  1330. Ftv_sec Ttime_t
  1331. Ftv_usec Tsuseconds_t
  1332. }
  1333. type Ttimespec = struct {
  1334. Ftv_sec Ttime_t
  1335. Ftv_nsec int64
  1336. }
  1337. type Tsigset_t = struct {
  1338. F__bits [16]uint64
  1339. }
  1340. type t__sigset_t = Tsigset_t
  1341. type Tfd_mask = uint64
  1342. type Tfd_set = struct {
  1343. Ffds_bits [16]uint64
  1344. }
  1345. type Titimerval = struct {
  1346. Fit_interval Ttimeval
  1347. Fit_value Ttimeval
  1348. }
  1349. type Ttimezone = struct {
  1350. Ftz_minuteswest int32
  1351. Ftz_dsttime int32
  1352. }
  1353. type Tblksize_t = int32
  1354. type Tnlink_t = uint32
  1355. type Tregister_t = int64
  1356. type Tu_int64_t = uint64
  1357. type Tmode_t = uint32
  1358. type Tino_t = uint64
  1359. type Tdev_t = uint64
  1360. type Tblkcnt_t = int64
  1361. type Tfsblkcnt_t = uint64
  1362. type Tfsfilcnt_t = uint64
  1363. type Ttimer_t = uintptr
  1364. type Tclockid_t = int32
  1365. type Tclock_t = int64
  1366. type Tpid_t = int32
  1367. type Tid_t = uint32
  1368. type Tuid_t = uint32
  1369. type Tgid_t = uint32
  1370. type Tkey_t = int32
  1371. type Tuseconds_t = uint32
  1372. type Tpthread_t = uintptr
  1373. type Tpthread_once_t = int32
  1374. type Tpthread_key_t = uint32
  1375. type Tpthread_spinlock_t = int32
  1376. type Tpthread_mutexattr_t = struct {
  1377. F__attr uint32
  1378. }
  1379. type Tpthread_condattr_t = struct {
  1380. F__attr uint32
  1381. }
  1382. type Tpthread_barrierattr_t = struct {
  1383. F__attr uint32
  1384. }
  1385. type Tpthread_rwlockattr_t = struct {
  1386. F__attr [2]uint32
  1387. }
  1388. type Tpthread_attr_t = struct {
  1389. F__u struct {
  1390. F__vi [0][14]int32
  1391. F__s [0][7]uint64
  1392. F__i [14]int32
  1393. }
  1394. }
  1395. type Tpthread_mutex_t = struct {
  1396. F__u struct {
  1397. F__vi [0][10]int32
  1398. F__p [0][5]uintptr
  1399. F__i [10]int32
  1400. }
  1401. }
  1402. type Tpthread_cond_t = struct {
  1403. F__u struct {
  1404. F__vi [0][12]int32
  1405. F__p [0][6]uintptr
  1406. F__i [12]int32
  1407. }
  1408. }
  1409. type Tpthread_rwlock_t = struct {
  1410. F__u struct {
  1411. F__vi [0][14]int32
  1412. F__p [0][7]uintptr
  1413. F__i [14]int32
  1414. }
  1415. }
  1416. type Tpthread_barrier_t = struct {
  1417. F__u struct {
  1418. F__vi [0][8]int32
  1419. F__p [0][4]uintptr
  1420. F__i [8]int32
  1421. }
  1422. }
  1423. type Tu_int8_t = uint8
  1424. type Tu_int16_t = uint16
  1425. type Tu_int32_t = uint32
  1426. type Tcaddr_t = uintptr
  1427. type Tu_char = uint8
  1428. type Tu_short = uint16
  1429. type Tushort = uint16
  1430. type Tu_int = uint32
  1431. type Tuint = uint32
  1432. type Tu_long = uint64
  1433. type Tulong = uint64
  1434. type Tquad_t = int64
  1435. type Tu_quad_t = uint64
  1436. type Tiovec = struct {
  1437. Fiov_base uintptr
  1438. Fiov_len Tsize_t
  1439. }
  1440. type Tflock = struct {
  1441. Fl_type int16
  1442. Fl_whence int16
  1443. Fl_start Toff_t
  1444. Fl_len Toff_t
  1445. Fl_pid Tpid_t
  1446. }
  1447. type Tfile_handle = struct {
  1448. Fhandle_bytes uint32
  1449. Fhandle_type int32
  1450. }
  1451. type Tf_owner_ex = struct {
  1452. Ftype1 int32
  1453. Fpid Tpid_t
  1454. }
  1455. type TXML_Char = uint8
  1456. type TXML_LChar = uint8
  1457. type TXML_Index = int64
  1458. type TXML_Size = uint64
  1459. type TXML_ParserStruct = struct {
  1460. Fm_userData uintptr
  1461. Fm_handlerArg uintptr
  1462. Fm_buffer uintptr
  1463. Fm_mem TXML_Memory_Handling_Suite
  1464. Fm_bufferPtr uintptr
  1465. Fm_bufferEnd uintptr
  1466. Fm_bufferLim uintptr
  1467. Fm_parseEndByteIndex TXML_Index
  1468. Fm_parseEndPtr uintptr
  1469. Fm_dataBuf uintptr
  1470. Fm_dataBufEnd uintptr
  1471. Fm_startElementHandler TXML_StartElementHandler
  1472. Fm_endElementHandler TXML_EndElementHandler
  1473. Fm_characterDataHandler TXML_CharacterDataHandler
  1474. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1475. Fm_commentHandler TXML_CommentHandler
  1476. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1477. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1478. Fm_defaultHandler TXML_DefaultHandler
  1479. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1480. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1481. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1482. Fm_notationDeclHandler TXML_NotationDeclHandler
  1483. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1484. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1485. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1486. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1487. Fm_externalEntityRefHandlerArg TXML_Parser
  1488. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1489. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1490. Fm_elementDeclHandler TXML_ElementDeclHandler
  1491. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1492. Fm_entityDeclHandler TXML_EntityDeclHandler
  1493. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1494. Fm_encoding uintptr
  1495. Fm_initEncoding TINIT_ENCODING
  1496. Fm_internalEncoding uintptr
  1497. Fm_protocolEncodingName uintptr
  1498. Fm_ns TXML_Bool
  1499. Fm_ns_triplets TXML_Bool
  1500. Fm_unknownEncodingMem uintptr
  1501. Fm_unknownEncodingData uintptr
  1502. Fm_unknownEncodingHandlerData uintptr
  1503. Fm_unknownEncodingRelease uintptr
  1504. Fm_prologState TPROLOG_STATE
  1505. Fm_processor uintptr
  1506. Fm_errorCode _XML_Error
  1507. Fm_eventPtr uintptr
  1508. Fm_eventEndPtr uintptr
  1509. Fm_positionPtr uintptr
  1510. Fm_openInternalEntities uintptr
  1511. Fm_freeInternalEntities uintptr
  1512. Fm_defaultExpandInternalEntities TXML_Bool
  1513. Fm_tagLevel int32
  1514. Fm_declEntity uintptr
  1515. Fm_doctypeName uintptr
  1516. Fm_doctypeSysid uintptr
  1517. Fm_doctypePubid uintptr
  1518. Fm_declAttributeType uintptr
  1519. Fm_declNotationName uintptr
  1520. Fm_declNotationPublicId uintptr
  1521. Fm_declElementType uintptr
  1522. Fm_declAttributeId uintptr
  1523. Fm_declAttributeIsCdata TXML_Bool
  1524. Fm_declAttributeIsId TXML_Bool
  1525. Fm_dtd uintptr
  1526. Fm_curBase uintptr
  1527. Fm_tagStack uintptr
  1528. Fm_freeTagList uintptr
  1529. Fm_inheritedBindings uintptr
  1530. Fm_freeBindingList uintptr
  1531. Fm_attsSize int32
  1532. Fm_nSpecifiedAtts int32
  1533. Fm_idAttIndex int32
  1534. Fm_atts uintptr
  1535. Fm_nsAtts uintptr
  1536. Fm_nsAttsVersion uint64
  1537. Fm_nsAttsPower uint8
  1538. Fm_position TPOSITION
  1539. Fm_tempPool TSTRING_POOL
  1540. Fm_temp2Pool TSTRING_POOL
  1541. Fm_groupConnector uintptr
  1542. Fm_groupSize uint32
  1543. Fm_namespaceSeparator TXML_Char
  1544. Fm_parentParser TXML_Parser
  1545. Fm_parsingStatus TXML_ParsingStatus
  1546. Fm_isParamEntity TXML_Bool
  1547. Fm_useForeignDTD TXML_Bool
  1548. Fm_paramEntityParsing _XML_ParamEntityParsing
  1549. Fm_hash_secret_salt uint64
  1550. Fm_accounting TACCOUNTING
  1551. Fm_entity_stats TENTITY_STATS
  1552. }
  1553. type _XML_Error = int32
  1554. const _XML_ERROR_NONE = 0
  1555. const _XML_ERROR_NO_MEMORY = 1
  1556. const _XML_ERROR_SYNTAX = 2
  1557. const _XML_ERROR_NO_ELEMENTS = 3
  1558. const _XML_ERROR_INVALID_TOKEN = 4
  1559. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1560. const _XML_ERROR_PARTIAL_CHAR = 6
  1561. const _XML_ERROR_TAG_MISMATCH = 7
  1562. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1563. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1564. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1565. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1566. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1567. const _XML_ERROR_ASYNC_ENTITY = 13
  1568. const _XML_ERROR_BAD_CHAR_REF = 14
  1569. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1570. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1571. const _XML_ERROR_MISPLACED_XML_PI = 17
  1572. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1573. const _XML_ERROR_INCORRECT_ENCODING = 19
  1574. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1575. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1576. const _XML_ERROR_NOT_STANDALONE = 22
  1577. const _XML_ERROR_UNEXPECTED_STATE = 23
  1578. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1579. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1580. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1581. const _XML_ERROR_UNBOUND_PREFIX = 27
  1582. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1583. const _XML_ERROR_INCOMPLETE_PE = 29
  1584. const _XML_ERROR_XML_DECL = 30
  1585. const _XML_ERROR_TEXT_DECL = 31
  1586. const _XML_ERROR_PUBLICID = 32
  1587. const _XML_ERROR_SUSPENDED = 33
  1588. const _XML_ERROR_NOT_SUSPENDED = 34
  1589. const _XML_ERROR_ABORTED = 35
  1590. const _XML_ERROR_FINISHED = 36
  1591. const _XML_ERROR_SUSPEND_PE = 37
  1592. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1593. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1594. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1595. const _XML_ERROR_INVALID_ARGUMENT = 41
  1596. const _XML_ERROR_NO_BUFFER = 42
  1597. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1598. type _XML_ParamEntityParsing = int32
  1599. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1600. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1601. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1602. type TXML_Parser = uintptr
  1603. type TXML_Bool = uint8
  1604. type _XML_Status = int32
  1605. const _XML_STATUS_ERROR = 0
  1606. const _XML_STATUS_OK = 1
  1607. const _XML_STATUS_SUSPENDED = 2
  1608. type _XML_Content_Type = int32
  1609. const _XML_CTYPE_EMPTY = 1
  1610. const _XML_CTYPE_ANY = 2
  1611. const _XML_CTYPE_MIXED = 3
  1612. const _XML_CTYPE_NAME = 4
  1613. const _XML_CTYPE_CHOICE = 5
  1614. const _XML_CTYPE_SEQ = 6
  1615. type _XML_Content_Quant = int32
  1616. const _XML_CQUANT_NONE = 0
  1617. const _XML_CQUANT_OPT = 1
  1618. const _XML_CQUANT_REP = 2
  1619. const _XML_CQUANT_PLUS = 3
  1620. type TXML_Content = struct {
  1621. Ftype1 _XML_Content_Type
  1622. Fquant _XML_Content_Quant
  1623. Fname uintptr
  1624. Fnumchildren uint32
  1625. Fchildren uintptr
  1626. }
  1627. type TXML_cp = TXML_Content
  1628. type TXML_ElementDeclHandler = uintptr
  1629. type TXML_AttlistDeclHandler = uintptr
  1630. type TXML_XmlDeclHandler = uintptr
  1631. type TXML_Memory_Handling_Suite = struct {
  1632. Fmalloc_fcn uintptr
  1633. Frealloc_fcn uintptr
  1634. Ffree_fcn uintptr
  1635. }
  1636. type TXML_StartElementHandler = uintptr
  1637. type TXML_EndElementHandler = uintptr
  1638. type TXML_CharacterDataHandler = uintptr
  1639. type TXML_ProcessingInstructionHandler = uintptr
  1640. type TXML_CommentHandler = uintptr
  1641. type TXML_StartCdataSectionHandler = uintptr
  1642. type TXML_EndCdataSectionHandler = uintptr
  1643. type TXML_DefaultHandler = uintptr
  1644. type TXML_StartDoctypeDeclHandler = uintptr
  1645. type TXML_EndDoctypeDeclHandler = uintptr
  1646. type TXML_EntityDeclHandler = uintptr
  1647. type TXML_UnparsedEntityDeclHandler = uintptr
  1648. type TXML_NotationDeclHandler = uintptr
  1649. type TXML_StartNamespaceDeclHandler = uintptr
  1650. type TXML_EndNamespaceDeclHandler = uintptr
  1651. type TXML_NotStandaloneHandler = uintptr
  1652. type TXML_ExternalEntityRefHandler = uintptr
  1653. type TXML_SkippedEntityHandler = uintptr
  1654. type TXML_Encoding = struct {
  1655. Fmap1 [256]int32
  1656. Fdata uintptr
  1657. Fconvert uintptr
  1658. Frelease uintptr
  1659. }
  1660. type TXML_UnknownEncodingHandler = uintptr
  1661. type _XML_Parsing = int32
  1662. const _XML_INITIALIZED = 0
  1663. const _XML_PARSING = 1
  1664. const _XML_FINISHED = 2
  1665. const _XML_SUSPENDED = 3
  1666. type TXML_ParsingStatus = struct {
  1667. Fparsing _XML_Parsing
  1668. FfinalBuffer TXML_Bool
  1669. }
  1670. type TXML_Expat_Version = struct {
  1671. Fmajor int32
  1672. Fminor int32
  1673. Fmicro int32
  1674. }
  1675. type _XML_FeatureEnum = int32
  1676. const _XML_FEATURE_END = 0
  1677. const _XML_FEATURE_UNICODE = 1
  1678. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1679. const _XML_FEATURE_DTD = 3
  1680. const _XML_FEATURE_CONTEXT_BYTES = 4
  1681. const _XML_FEATURE_MIN_SIZE = 5
  1682. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1683. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1684. const _XML_FEATURE_NS = 8
  1685. const _XML_FEATURE_LARGE_SIZE = 9
  1686. const _XML_FEATURE_ATTR_INFO = 10
  1687. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1688. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1689. type TXML_Feature = struct {
  1690. Ffeature _XML_FeatureEnum
  1691. Fname uintptr
  1692. Fvalue int64
  1693. }
  1694. type Tsiphash = struct {
  1695. Fv0 Tuint64_t
  1696. Fv1 Tuint64_t
  1697. Fv2 Tuint64_t
  1698. Fv3 Tuint64_t
  1699. Fbuf [8]uint8
  1700. Fp uintptr
  1701. Fc Tuint64_t
  1702. }
  1703. type Tsipkey = struct {
  1704. Fk [2]Tuint64_t
  1705. }
  1706. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1707. *(*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)
  1708. *(*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)
  1709. return key
  1710. }
  1711. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1712. var i int32
  1713. _ = i
  1714. i = 0
  1715. for {
  1716. if !(i < rounds) {
  1717. break
  1718. }
  1719. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1720. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1721. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1722. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1723. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1724. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1725. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1726. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1727. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1728. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1729. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1730. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1731. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1732. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1733. goto _1
  1734. _1:
  1735. ;
  1736. i++
  1737. }
  1738. }
  1739. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1740. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1741. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1742. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1743. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1744. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1745. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1746. return H
  1747. }
  1748. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1749. var m Tuint64_t
  1750. var p, pe, v1, v2, v3 uintptr
  1751. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1752. p = src
  1753. pe = p + uintptr(len1)
  1754. for cond := true; cond; cond = p < pe {
  1755. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1756. v2 = H + 40
  1757. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1758. *(*uintptr)(unsafe.Pointer(v2))++
  1759. v3 = p
  1760. p++
  1761. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1762. }
  1763. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1764. break
  1765. }
  1766. 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)
  1767. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1768. _sip_round(tls, H, int32(2))
  1769. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1770. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1771. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1772. }
  1773. return H
  1774. }
  1775. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1776. var b Tuint64_t
  1777. var left uint8
  1778. _, _ = b, left
  1779. left = libc.Uint8FromInt64(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1780. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + uint64(left)) << int32(56)
  1781. switch libc.Int32FromUint8(left) {
  1782. case int32(7):
  1783. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1784. fallthrough
  1785. case int32(6):
  1786. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1787. fallthrough
  1788. case int32(5):
  1789. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1790. fallthrough
  1791. case int32(4):
  1792. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1793. fallthrough
  1794. case int32(3):
  1795. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1796. fallthrough
  1797. case int32(2):
  1798. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1799. fallthrough
  1800. case int32(1):
  1801. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1802. fallthrough
  1803. case 0:
  1804. break
  1805. }
  1806. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1807. _sip_round(tls, H, int32(2))
  1808. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1809. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1810. _sip_round(tls, H, int32(4))
  1811. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1812. }
  1813. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1814. bp := tls.Alloc(64)
  1815. defer tls.Free(64)
  1816. var _ /* state at bp+0 */ Tsiphash
  1817. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1818. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1819. }
  1820. func _sip24_valid(tls *libc.TLS) (r int32) {
  1821. bp := tls.Alloc(80)
  1822. defer tls.Free(80)
  1823. var i Tsize_t
  1824. var _ /* in at bp+0 */ [64]uint8
  1825. var _ /* k at bp+64 */ Tsipkey
  1826. _ = i
  1827. _sip_tokey(tls, bp+64, __ccgo_ts)
  1828. i = uint64(0)
  1829. for {
  1830. if !(i < uint64(64)) {
  1831. break
  1832. }
  1833. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1834. 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) {
  1835. return 0
  1836. }
  1837. goto _1
  1838. _1:
  1839. ;
  1840. i++
  1841. }
  1842. return int32(1)
  1843. }
  1844. var _vectors = [64][8]uint8{
  1845. 0: {
  1846. 0: uint8(0x31),
  1847. 1: uint8(0x0e),
  1848. 2: uint8(0x0e),
  1849. 3: uint8(0xdd),
  1850. 4: uint8(0x47),
  1851. 5: uint8(0xdb),
  1852. 6: uint8(0x6f),
  1853. 7: uint8(0x72),
  1854. },
  1855. 1: {
  1856. 0: uint8(0xfd),
  1857. 1: uint8(0x67),
  1858. 2: uint8(0xdc),
  1859. 3: uint8(0x93),
  1860. 4: uint8(0xc5),
  1861. 5: uint8(0x39),
  1862. 6: uint8(0xf8),
  1863. 7: uint8(0x74),
  1864. },
  1865. 2: {
  1866. 0: uint8(0x5a),
  1867. 1: uint8(0x4f),
  1868. 2: uint8(0xa9),
  1869. 3: uint8(0xd9),
  1870. 4: uint8(0x09),
  1871. 5: uint8(0x80),
  1872. 6: uint8(0x6c),
  1873. 7: uint8(0x0d),
  1874. },
  1875. 3: {
  1876. 0: uint8(0x2d),
  1877. 1: uint8(0x7e),
  1878. 2: uint8(0xfb),
  1879. 3: uint8(0xd7),
  1880. 4: uint8(0x96),
  1881. 5: uint8(0x66),
  1882. 6: uint8(0x67),
  1883. 7: uint8(0x85),
  1884. },
  1885. 4: {
  1886. 0: uint8(0xb7),
  1887. 1: uint8(0x87),
  1888. 2: uint8(0x71),
  1889. 3: uint8(0x27),
  1890. 4: uint8(0xe0),
  1891. 5: uint8(0x94),
  1892. 6: uint8(0x27),
  1893. 7: uint8(0xcf),
  1894. },
  1895. 5: {
  1896. 0: uint8(0x8d),
  1897. 1: uint8(0xa6),
  1898. 2: uint8(0x99),
  1899. 3: uint8(0xcd),
  1900. 4: uint8(0x64),
  1901. 5: uint8(0x55),
  1902. 6: uint8(0x76),
  1903. 7: uint8(0x18),
  1904. },
  1905. 6: {
  1906. 0: uint8(0xce),
  1907. 1: uint8(0xe3),
  1908. 2: uint8(0xfe),
  1909. 3: uint8(0x58),
  1910. 4: uint8(0x6e),
  1911. 5: uint8(0x46),
  1912. 6: uint8(0xc9),
  1913. 7: uint8(0xcb),
  1914. },
  1915. 7: {
  1916. 0: uint8(0x37),
  1917. 1: uint8(0xd1),
  1918. 2: uint8(0x01),
  1919. 3: uint8(0x8b),
  1920. 4: uint8(0xf5),
  1921. 6: uint8(0x02),
  1922. 7: uint8(0xab),
  1923. },
  1924. 8: {
  1925. 0: uint8(0x62),
  1926. 1: uint8(0x24),
  1927. 2: uint8(0x93),
  1928. 3: uint8(0x9a),
  1929. 4: uint8(0x79),
  1930. 5: uint8(0xf5),
  1931. 6: uint8(0xf5),
  1932. 7: uint8(0x93),
  1933. },
  1934. 9: {
  1935. 0: uint8(0xb0),
  1936. 1: uint8(0xe4),
  1937. 2: uint8(0xa9),
  1938. 3: uint8(0x0b),
  1939. 4: uint8(0xdf),
  1940. 5: uint8(0x82),
  1941. 7: uint8(0x9e),
  1942. },
  1943. 10: {
  1944. 0: uint8(0xf3),
  1945. 1: uint8(0xb9),
  1946. 2: uint8(0xdd),
  1947. 3: uint8(0x94),
  1948. 4: uint8(0xc5),
  1949. 5: uint8(0xbb),
  1950. 6: uint8(0x5d),
  1951. 7: uint8(0x7a),
  1952. },
  1953. 11: {
  1954. 0: uint8(0xa7),
  1955. 1: uint8(0xad),
  1956. 2: uint8(0x6b),
  1957. 3: uint8(0x22),
  1958. 4: uint8(0x46),
  1959. 5: uint8(0x2f),
  1960. 6: uint8(0xb3),
  1961. 7: uint8(0xf4),
  1962. },
  1963. 12: {
  1964. 0: uint8(0xfb),
  1965. 1: uint8(0xe5),
  1966. 2: uint8(0x0e),
  1967. 3: uint8(0x86),
  1968. 4: uint8(0xbc),
  1969. 5: uint8(0x8f),
  1970. 6: uint8(0x1e),
  1971. 7: uint8(0x75),
  1972. },
  1973. 13: {
  1974. 0: uint8(0x90),
  1975. 1: uint8(0x3d),
  1976. 2: uint8(0x84),
  1977. 3: uint8(0xc0),
  1978. 4: uint8(0x27),
  1979. 5: uint8(0x56),
  1980. 6: uint8(0xea),
  1981. 7: uint8(0x14),
  1982. },
  1983. 14: {
  1984. 0: uint8(0xee),
  1985. 1: uint8(0xf2),
  1986. 2: uint8(0x7a),
  1987. 3: uint8(0x8e),
  1988. 4: uint8(0x90),
  1989. 5: uint8(0xca),
  1990. 6: uint8(0x23),
  1991. 7: uint8(0xf7),
  1992. },
  1993. 15: {
  1994. 0: uint8(0xe5),
  1995. 1: uint8(0x45),
  1996. 2: uint8(0xbe),
  1997. 3: uint8(0x49),
  1998. 4: uint8(0x61),
  1999. 5: uint8(0xca),
  2000. 6: uint8(0x29),
  2001. 7: uint8(0xa1),
  2002. },
  2003. 16: {
  2004. 0: uint8(0xdb),
  2005. 1: uint8(0x9b),
  2006. 2: uint8(0xc2),
  2007. 3: uint8(0x57),
  2008. 4: uint8(0x7f),
  2009. 5: uint8(0xcc),
  2010. 6: uint8(0x2a),
  2011. 7: uint8(0x3f),
  2012. },
  2013. 17: {
  2014. 0: uint8(0x94),
  2015. 1: uint8(0x47),
  2016. 2: uint8(0xbe),
  2017. 3: uint8(0x2c),
  2018. 4: uint8(0xf5),
  2019. 5: uint8(0xe9),
  2020. 6: uint8(0x9a),
  2021. 7: uint8(0x69),
  2022. },
  2023. 18: {
  2024. 0: uint8(0x9c),
  2025. 1: uint8(0xd3),
  2026. 2: uint8(0x8d),
  2027. 3: uint8(0x96),
  2028. 4: uint8(0xf0),
  2029. 5: uint8(0xb3),
  2030. 6: uint8(0xc1),
  2031. 7: uint8(0x4b),
  2032. },
  2033. 19: {
  2034. 0: uint8(0xbd),
  2035. 1: uint8(0x61),
  2036. 2: uint8(0x79),
  2037. 3: uint8(0xa7),
  2038. 4: uint8(0x1d),
  2039. 5: uint8(0xc9),
  2040. 6: uint8(0x6d),
  2041. 7: uint8(0xbb),
  2042. },
  2043. 20: {
  2044. 0: uint8(0x98),
  2045. 1: uint8(0xee),
  2046. 2: uint8(0xa2),
  2047. 3: uint8(0x1a),
  2048. 4: uint8(0xf2),
  2049. 5: uint8(0x5c),
  2050. 6: uint8(0xd6),
  2051. 7: uint8(0xbe),
  2052. },
  2053. 21: {
  2054. 0: uint8(0xc7),
  2055. 1: uint8(0x67),
  2056. 2: uint8(0x3b),
  2057. 3: uint8(0x2e),
  2058. 4: uint8(0xb0),
  2059. 5: uint8(0xcb),
  2060. 6: uint8(0xf2),
  2061. 7: uint8(0xd0),
  2062. },
  2063. 22: {
  2064. 0: uint8(0x88),
  2065. 1: uint8(0x3e),
  2066. 2: uint8(0xa3),
  2067. 3: uint8(0xe3),
  2068. 4: uint8(0x95),
  2069. 5: uint8(0x67),
  2070. 6: uint8(0x53),
  2071. 7: uint8(0x93),
  2072. },
  2073. 23: {
  2074. 0: uint8(0xc8),
  2075. 1: uint8(0xce),
  2076. 2: uint8(0x5c),
  2077. 3: uint8(0xcd),
  2078. 4: uint8(0x8c),
  2079. 5: uint8(0x03),
  2080. 6: uint8(0x0c),
  2081. 7: uint8(0xa8),
  2082. },
  2083. 24: {
  2084. 0: uint8(0x94),
  2085. 1: uint8(0xaf),
  2086. 2: uint8(0x49),
  2087. 3: uint8(0xf6),
  2088. 4: uint8(0xc6),
  2089. 5: uint8(0x50),
  2090. 6: uint8(0xad),
  2091. 7: uint8(0xb8),
  2092. },
  2093. 25: {
  2094. 0: uint8(0xea),
  2095. 1: uint8(0xb8),
  2096. 2: uint8(0x85),
  2097. 3: uint8(0x8a),
  2098. 4: uint8(0xde),
  2099. 5: uint8(0x92),
  2100. 6: uint8(0xe1),
  2101. 7: uint8(0xbc),
  2102. },
  2103. 26: {
  2104. 0: uint8(0xf3),
  2105. 1: uint8(0x15),
  2106. 2: uint8(0xbb),
  2107. 3: uint8(0x5b),
  2108. 4: uint8(0xb8),
  2109. 5: uint8(0x35),
  2110. 6: uint8(0xd8),
  2111. 7: uint8(0x17),
  2112. },
  2113. 27: {
  2114. 0: uint8(0xad),
  2115. 1: uint8(0xcf),
  2116. 2: uint8(0x6b),
  2117. 3: uint8(0x07),
  2118. 4: uint8(0x63),
  2119. 5: uint8(0x61),
  2120. 6: uint8(0x2e),
  2121. 7: uint8(0x2f),
  2122. },
  2123. 28: {
  2124. 0: uint8(0xa5),
  2125. 1: uint8(0xc9),
  2126. 2: uint8(0x1d),
  2127. 3: uint8(0xa7),
  2128. 4: uint8(0xac),
  2129. 5: uint8(0xaa),
  2130. 6: uint8(0x4d),
  2131. 7: uint8(0xde),
  2132. },
  2133. 29: {
  2134. 0: uint8(0x71),
  2135. 1: uint8(0x65),
  2136. 2: uint8(0x95),
  2137. 3: uint8(0x87),
  2138. 4: uint8(0x66),
  2139. 5: uint8(0x50),
  2140. 6: uint8(0xa2),
  2141. 7: uint8(0xa6),
  2142. },
  2143. 30: {
  2144. 0: uint8(0x28),
  2145. 1: uint8(0xef),
  2146. 2: uint8(0x49),
  2147. 3: uint8(0x5c),
  2148. 4: uint8(0x53),
  2149. 5: uint8(0xa3),
  2150. 6: uint8(0x87),
  2151. 7: uint8(0xad),
  2152. },
  2153. 31: {
  2154. 0: uint8(0x42),
  2155. 1: uint8(0xc3),
  2156. 2: uint8(0x41),
  2157. 3: uint8(0xd8),
  2158. 4: uint8(0xfa),
  2159. 5: uint8(0x92),
  2160. 6: uint8(0xd8),
  2161. 7: uint8(0x32),
  2162. },
  2163. 32: {
  2164. 0: uint8(0xce),
  2165. 1: uint8(0x7c),
  2166. 2: uint8(0xf2),
  2167. 3: uint8(0x72),
  2168. 4: uint8(0x2f),
  2169. 5: uint8(0x51),
  2170. 6: uint8(0x27),
  2171. 7: uint8(0x71),
  2172. },
  2173. 33: {
  2174. 0: uint8(0xe3),
  2175. 1: uint8(0x78),
  2176. 2: uint8(0x59),
  2177. 3: uint8(0xf9),
  2178. 4: uint8(0x46),
  2179. 5: uint8(0x23),
  2180. 6: uint8(0xf3),
  2181. 7: uint8(0xa7),
  2182. },
  2183. 34: {
  2184. 0: uint8(0x38),
  2185. 1: uint8(0x12),
  2186. 2: uint8(0x05),
  2187. 3: uint8(0xbb),
  2188. 4: uint8(0x1a),
  2189. 5: uint8(0xb0),
  2190. 6: uint8(0xe0),
  2191. 7: uint8(0x12),
  2192. },
  2193. 35: {
  2194. 0: uint8(0xae),
  2195. 1: uint8(0x97),
  2196. 2: uint8(0xa1),
  2197. 3: uint8(0x0f),
  2198. 4: uint8(0xd4),
  2199. 5: uint8(0x34),
  2200. 6: uint8(0xe0),
  2201. 7: uint8(0x15),
  2202. },
  2203. 36: {
  2204. 0: uint8(0xb4),
  2205. 1: uint8(0xa3),
  2206. 2: uint8(0x15),
  2207. 3: uint8(0x08),
  2208. 4: uint8(0xbe),
  2209. 5: uint8(0xff),
  2210. 6: uint8(0x4d),
  2211. 7: uint8(0x31),
  2212. },
  2213. 37: {
  2214. 0: uint8(0x81),
  2215. 1: uint8(0x39),
  2216. 2: uint8(0x62),
  2217. 3: uint8(0x29),
  2218. 4: uint8(0xf0),
  2219. 5: uint8(0x90),
  2220. 6: uint8(0x79),
  2221. 7: uint8(0x02),
  2222. },
  2223. 38: {
  2224. 0: uint8(0x4d),
  2225. 1: uint8(0x0c),
  2226. 2: uint8(0xf4),
  2227. 3: uint8(0x9e),
  2228. 4: uint8(0xe5),
  2229. 5: uint8(0xd4),
  2230. 6: uint8(0xdc),
  2231. 7: uint8(0xca),
  2232. },
  2233. 39: {
  2234. 0: uint8(0x5c),
  2235. 1: uint8(0x73),
  2236. 2: uint8(0x33),
  2237. 3: uint8(0x6a),
  2238. 4: uint8(0x76),
  2239. 5: uint8(0xd8),
  2240. 6: uint8(0xbf),
  2241. 7: uint8(0x9a),
  2242. },
  2243. 40: {
  2244. 0: uint8(0xd0),
  2245. 1: uint8(0xa7),
  2246. 2: uint8(0x04),
  2247. 3: uint8(0x53),
  2248. 4: uint8(0x6b),
  2249. 5: uint8(0xa9),
  2250. 6: uint8(0x3e),
  2251. 7: uint8(0x0e),
  2252. },
  2253. 41: {
  2254. 0: uint8(0x92),
  2255. 1: uint8(0x59),
  2256. 2: uint8(0x58),
  2257. 3: uint8(0xfc),
  2258. 4: uint8(0xd6),
  2259. 5: uint8(0x42),
  2260. 6: uint8(0x0c),
  2261. 7: uint8(0xad),
  2262. },
  2263. 42: {
  2264. 0: uint8(0xa9),
  2265. 1: uint8(0x15),
  2266. 2: uint8(0xc2),
  2267. 3: uint8(0x9b),
  2268. 4: uint8(0xc8),
  2269. 5: uint8(0x06),
  2270. 6: uint8(0x73),
  2271. 7: uint8(0x18),
  2272. },
  2273. 43: {
  2274. 0: uint8(0x95),
  2275. 1: uint8(0x2b),
  2276. 2: uint8(0x79),
  2277. 3: uint8(0xf3),
  2278. 4: uint8(0xbc),
  2279. 5: uint8(0x0a),
  2280. 6: uint8(0xa6),
  2281. 7: uint8(0xd4),
  2282. },
  2283. 44: {
  2284. 0: uint8(0xf2),
  2285. 1: uint8(0x1d),
  2286. 2: uint8(0xf2),
  2287. 3: uint8(0xe4),
  2288. 4: uint8(0x1d),
  2289. 5: uint8(0x45),
  2290. 6: uint8(0x35),
  2291. 7: uint8(0xf9),
  2292. },
  2293. 45: {
  2294. 0: uint8(0x87),
  2295. 1: uint8(0x57),
  2296. 2: uint8(0x75),
  2297. 3: uint8(0x19),
  2298. 4: uint8(0x04),
  2299. 5: uint8(0x8f),
  2300. 6: uint8(0x53),
  2301. 7: uint8(0xa9),
  2302. },
  2303. 46: {
  2304. 0: uint8(0x10),
  2305. 1: uint8(0xa5),
  2306. 2: uint8(0x6c),
  2307. 3: uint8(0xf5),
  2308. 4: uint8(0xdf),
  2309. 5: uint8(0xcd),
  2310. 6: uint8(0x9a),
  2311. 7: uint8(0xdb),
  2312. },
  2313. 47: {
  2314. 0: uint8(0xeb),
  2315. 1: uint8(0x75),
  2316. 2: uint8(0x09),
  2317. 3: uint8(0x5c),
  2318. 4: uint8(0xcd),
  2319. 5: uint8(0x98),
  2320. 6: uint8(0x6c),
  2321. 7: uint8(0xd0),
  2322. },
  2323. 48: {
  2324. 0: uint8(0x51),
  2325. 1: uint8(0xa9),
  2326. 2: uint8(0xcb),
  2327. 3: uint8(0x9e),
  2328. 4: uint8(0xcb),
  2329. 5: uint8(0xa3),
  2330. 6: uint8(0x12),
  2331. 7: uint8(0xe6),
  2332. },
  2333. 49: {
  2334. 0: uint8(0x96),
  2335. 1: uint8(0xaf),
  2336. 2: uint8(0xad),
  2337. 3: uint8(0xfc),
  2338. 4: uint8(0x2c),
  2339. 5: uint8(0xe6),
  2340. 6: uint8(0x66),
  2341. 7: uint8(0xc7),
  2342. },
  2343. 50: {
  2344. 0: uint8(0x72),
  2345. 1: uint8(0xfe),
  2346. 2: uint8(0x52),
  2347. 3: uint8(0x97),
  2348. 4: uint8(0x5a),
  2349. 5: uint8(0x43),
  2350. 6: uint8(0x64),
  2351. 7: uint8(0xee),
  2352. },
  2353. 51: {
  2354. 0: uint8(0x5a),
  2355. 1: uint8(0x16),
  2356. 2: uint8(0x45),
  2357. 3: uint8(0xb2),
  2358. 4: uint8(0x76),
  2359. 5: uint8(0xd5),
  2360. 6: uint8(0x92),
  2361. 7: uint8(0xa1),
  2362. },
  2363. 52: {
  2364. 0: uint8(0xb2),
  2365. 1: uint8(0x74),
  2366. 2: uint8(0xcb),
  2367. 3: uint8(0x8e),
  2368. 4: uint8(0xbf),
  2369. 5: uint8(0x87),
  2370. 6: uint8(0x87),
  2371. 7: uint8(0x0a),
  2372. },
  2373. 53: {
  2374. 0: uint8(0x6f),
  2375. 1: uint8(0x9b),
  2376. 2: uint8(0xb4),
  2377. 3: uint8(0x20),
  2378. 4: uint8(0x3d),
  2379. 5: uint8(0xe7),
  2380. 6: uint8(0xb3),
  2381. 7: uint8(0x81),
  2382. },
  2383. 54: {
  2384. 0: uint8(0xea),
  2385. 1: uint8(0xec),
  2386. 2: uint8(0xb2),
  2387. 3: uint8(0xa3),
  2388. 4: uint8(0x0b),
  2389. 5: uint8(0x22),
  2390. 6: uint8(0xa8),
  2391. 7: uint8(0x7f),
  2392. },
  2393. 55: {
  2394. 0: uint8(0x99),
  2395. 1: uint8(0x24),
  2396. 2: uint8(0xa4),
  2397. 3: uint8(0x3c),
  2398. 4: uint8(0xc1),
  2399. 5: uint8(0x31),
  2400. 6: uint8(0x57),
  2401. 7: uint8(0x24),
  2402. },
  2403. 56: {
  2404. 0: uint8(0xbd),
  2405. 1: uint8(0x83),
  2406. 2: uint8(0x8d),
  2407. 3: uint8(0x3a),
  2408. 4: uint8(0xaf),
  2409. 5: uint8(0xbf),
  2410. 6: uint8(0x8d),
  2411. 7: uint8(0xb7),
  2412. },
  2413. 57: {
  2414. 0: uint8(0x0b),
  2415. 1: uint8(0x1a),
  2416. 2: uint8(0x2a),
  2417. 3: uint8(0x32),
  2418. 4: uint8(0x65),
  2419. 5: uint8(0xd5),
  2420. 6: uint8(0x1a),
  2421. 7: uint8(0xea),
  2422. },
  2423. 58: {
  2424. 0: uint8(0x13),
  2425. 1: uint8(0x50),
  2426. 2: uint8(0x79),
  2427. 3: uint8(0xa3),
  2428. 4: uint8(0x23),
  2429. 5: uint8(0x1c),
  2430. 6: uint8(0xe6),
  2431. 7: uint8(0x60),
  2432. },
  2433. 59: {
  2434. 0: uint8(0x93),
  2435. 1: uint8(0x2b),
  2436. 2: uint8(0x28),
  2437. 3: uint8(0x46),
  2438. 4: uint8(0xe4),
  2439. 5: uint8(0xd7),
  2440. 6: uint8(0x06),
  2441. 7: uint8(0x66),
  2442. },
  2443. 60: {
  2444. 0: uint8(0xe1),
  2445. 1: uint8(0x91),
  2446. 2: uint8(0x5f),
  2447. 3: uint8(0x5c),
  2448. 4: uint8(0xb1),
  2449. 5: uint8(0xec),
  2450. 6: uint8(0xa4),
  2451. 7: uint8(0x6c),
  2452. },
  2453. 61: {
  2454. 0: uint8(0xf3),
  2455. 1: uint8(0x25),
  2456. 2: uint8(0x96),
  2457. 3: uint8(0x5c),
  2458. 4: uint8(0xa1),
  2459. 5: uint8(0x6d),
  2460. 6: uint8(0x62),
  2461. 7: uint8(0x9f),
  2462. },
  2463. 62: {
  2464. 0: uint8(0x57),
  2465. 1: uint8(0x5f),
  2466. 2: uint8(0xf2),
  2467. 3: uint8(0x8e),
  2468. 4: uint8(0x60),
  2469. 5: uint8(0x38),
  2470. 6: uint8(0x1b),
  2471. 7: uint8(0xe5),
  2472. },
  2473. 63: {
  2474. 0: uint8(0x72),
  2475. 1: uint8(0x45),
  2476. 2: uint8(0x06),
  2477. 3: uint8(0xeb),
  2478. 4: uint8(0x4c),
  2479. 5: uint8(0x32),
  2480. 6: uint8(0x8a),
  2481. 7: uint8(0x95),
  2482. },
  2483. }
  2484. type TICHAR = uint8
  2485. type TPOSITION = struct {
  2486. FlineNumber TXML_Size
  2487. FcolumnNumber TXML_Size
  2488. }
  2489. type Tposition = TPOSITION
  2490. type TATTRIBUTE = struct {
  2491. Fname uintptr
  2492. FvaluePtr uintptr
  2493. FvalueEnd uintptr
  2494. Fnormalized uint8
  2495. }
  2496. type Tencoding = struct {
  2497. Fscanners [4]TSCANNER
  2498. FliteralScanners [2]TSCANNER
  2499. FnameMatchesAscii uintptr
  2500. FnameLength uintptr
  2501. FskipS uintptr
  2502. FgetAtts uintptr
  2503. FcharRefNumber uintptr
  2504. FpredefinedEntityName uintptr
  2505. FupdatePosition uintptr
  2506. FisPublicId uintptr
  2507. Futf8Convert uintptr
  2508. Futf16Convert uintptr
  2509. FminBytesPerChar int32
  2510. FisUtf8 uint8
  2511. FisUtf16 uint8
  2512. }
  2513. type TENCODING = struct {
  2514. Fscanners [4]TSCANNER
  2515. FliteralScanners [2]TSCANNER
  2516. FnameMatchesAscii uintptr
  2517. FnameLength uintptr
  2518. FskipS uintptr
  2519. FgetAtts uintptr
  2520. FcharRefNumber uintptr
  2521. FpredefinedEntityName uintptr
  2522. FupdatePosition uintptr
  2523. FisPublicId uintptr
  2524. Futf8Convert uintptr
  2525. Futf16Convert uintptr
  2526. FminBytesPerChar int32
  2527. FisUtf8 uint8
  2528. FisUtf16 uint8
  2529. }
  2530. type TSCANNER = uintptr
  2531. type _XML_Convert_Result = int32
  2532. const _XML_CONVERT_COMPLETED = 0
  2533. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2534. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2535. type TINIT_ENCODING = struct {
  2536. FinitEnc TENCODING
  2537. FencPtr uintptr
  2538. }
  2539. type TCONVERTER = uintptr
  2540. const _XML_ROLE_ERROR = -1
  2541. const _XML_ROLE_NONE = 0
  2542. const _XML_ROLE_XML_DECL = 1
  2543. const _XML_ROLE_INSTANCE_START = 2
  2544. const _XML_ROLE_DOCTYPE_NONE = 3
  2545. const _XML_ROLE_DOCTYPE_NAME = 4
  2546. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2547. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2548. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2549. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2550. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2551. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2552. const _XML_ROLE_ENTITY_NONE = 11
  2553. const _XML_ROLE_ENTITY_VALUE = 12
  2554. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2555. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2556. const _XML_ROLE_ENTITY_COMPLETE = 15
  2557. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2558. const _XML_ROLE_NOTATION_NONE = 17
  2559. const _XML_ROLE_NOTATION_NAME = 18
  2560. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2561. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2562. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2563. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2564. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2565. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2566. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2567. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2568. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2569. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2570. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2571. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2572. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2573. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2574. const _XML_ROLE_ATTLIST_NONE = 33
  2575. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2576. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2577. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2578. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2579. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2580. const _XML_ROLE_ELEMENT_NONE = 39
  2581. const _XML_ROLE_ELEMENT_NAME = 40
  2582. const _XML_ROLE_CONTENT_ANY = 41
  2583. const _XML_ROLE_CONTENT_EMPTY = 42
  2584. const _XML_ROLE_CONTENT_PCDATA = 43
  2585. const _XML_ROLE_GROUP_OPEN = 44
  2586. const _XML_ROLE_GROUP_CLOSE = 45
  2587. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2588. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2589. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2590. const _XML_ROLE_GROUP_CHOICE = 49
  2591. const _XML_ROLE_GROUP_SEQUENCE = 50
  2592. const _XML_ROLE_CONTENT_ELEMENT = 51
  2593. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2594. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2595. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2596. const _XML_ROLE_PI = 55
  2597. const _XML_ROLE_COMMENT = 56
  2598. const _XML_ROLE_TEXT_DECL = 57
  2599. const _XML_ROLE_IGNORE_SECT = 58
  2600. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2601. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2602. type TPROLOG_STATE = struct {
  2603. Fhandler uintptr
  2604. Flevel uint32
  2605. Frole_none int32
  2606. FincludeLevel uint32
  2607. FdocumentEntity int32
  2608. FinEntityValue int32
  2609. }
  2610. type Tprolog_state = TPROLOG_STATE
  2611. type TKEY = uintptr
  2612. type TNAMED = struct {
  2613. Fname TKEY
  2614. }
  2615. type THASH_TABLE = struct {
  2616. Fv uintptr
  2617. Fpower uint8
  2618. Fsize Tsize_t
  2619. Fused Tsize_t
  2620. Fmem uintptr
  2621. }
  2622. /* For probing (after a collision) we need a step size relative prime
  2623. to the hash table size, which is a power of 2. We use double-hashing,
  2624. since we can calculate a second hash value cheaply by taking those bits
  2625. of the first hash value that were discarded (masked out) when the table
  2626. index was calculated: index = hash & mask, where mask = table->size - 1.
  2627. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2628. it odd, since odd numbers are always relative prime to a power of 2.
  2629. */
  2630. type THASH_TABLE_ITER = struct {
  2631. Fp uintptr
  2632. Fend uintptr
  2633. }
  2634. type TBINDING = struct {
  2635. Fprefix uintptr
  2636. FnextTagBinding uintptr
  2637. FprevPrefixBinding uintptr
  2638. FattId uintptr
  2639. Furi uintptr
  2640. FuriLen int32
  2641. FuriAlloc int32
  2642. }
  2643. type Tbinding = TBINDING
  2644. type TPREFIX = struct {
  2645. Fname uintptr
  2646. Fbinding uintptr
  2647. }
  2648. type Tprefix = TPREFIX
  2649. type TTAG_NAME = struct {
  2650. Fstr uintptr
  2651. FlocalPart uintptr
  2652. Fprefix uintptr
  2653. FstrLen int32
  2654. FuriLen int32
  2655. FprefixLen int32
  2656. }
  2657. // C documentation
  2658. //
  2659. // /* TAG represents an open element.
  2660. // The name of the element is stored in both the document and API
  2661. // encodings. The memory buffer 'buf' is a separately-allocated
  2662. // memory area which stores the name. During the XML_Parse()/
  2663. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2664. // version of the name (in the document encoding) is shared with the
  2665. // document buffer. If the element is open across calls to
  2666. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2667. // contain the 'raw' name as well.
  2668. //
  2669. // A parser re-uses these structures, maintaining a list of allocated
  2670. // TAG objects in a free list.
  2671. // */
  2672. type TTAG = struct {
  2673. Fparent uintptr
  2674. FrawName uintptr
  2675. FrawNameLength int32
  2676. Fname TTAG_NAME
  2677. Fbuf uintptr
  2678. FbufEnd uintptr
  2679. Fbindings uintptr
  2680. }
  2681. // C documentation
  2682. //
  2683. // /* TAG represents an open element.
  2684. // The name of the element is stored in both the document and API
  2685. // encodings. The memory buffer 'buf' is a separately-allocated
  2686. // memory area which stores the name. During the XML_Parse()/
  2687. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2688. // version of the name (in the document encoding) is shared with the
  2689. // document buffer. If the element is open across calls to
  2690. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2691. // contain the 'raw' name as well.
  2692. //
  2693. // A parser re-uses these structures, maintaining a list of allocated
  2694. // TAG objects in a free list.
  2695. // */
  2696. type Ttag = TTAG
  2697. type TENTITY = struct {
  2698. Fname uintptr
  2699. FtextPtr uintptr
  2700. FtextLen int32
  2701. Fprocessed int32
  2702. FsystemId uintptr
  2703. Fbase uintptr
  2704. FpublicId uintptr
  2705. Fnotation uintptr
  2706. Fopen TXML_Bool
  2707. Fis_param TXML_Bool
  2708. Fis_internal TXML_Bool
  2709. }
  2710. type TCONTENT_SCAFFOLD = struct {
  2711. Ftype1 _XML_Content_Type
  2712. Fquant _XML_Content_Quant
  2713. Fname uintptr
  2714. Ffirstchild int32
  2715. Flastchild int32
  2716. Fchildcnt int32
  2717. Fnextsib int32
  2718. }
  2719. type TBLOCK = struct {
  2720. Fnext uintptr
  2721. Fsize int32
  2722. Fs [1]TXML_Char
  2723. }
  2724. type Tblock = TBLOCK
  2725. type TSTRING_POOL = struct {
  2726. Fblocks uintptr
  2727. FfreeBlocks uintptr
  2728. Fend uintptr
  2729. Fptr uintptr
  2730. Fstart uintptr
  2731. Fmem uintptr
  2732. }
  2733. // C documentation
  2734. //
  2735. // /* The XML_Char before the name is used to determine whether
  2736. // an attribute has been specified. */
  2737. type TATTRIBUTE_ID = struct {
  2738. Fname uintptr
  2739. Fprefix uintptr
  2740. FmaybeTokenized TXML_Bool
  2741. Fxmlns TXML_Bool
  2742. }
  2743. // C documentation
  2744. //
  2745. // /* The XML_Char before the name is used to determine whether
  2746. // an attribute has been specified. */
  2747. type Tattribute_id = TATTRIBUTE_ID
  2748. type TDEFAULT_ATTRIBUTE = struct {
  2749. Fid uintptr
  2750. FisCdata TXML_Bool
  2751. Fvalue uintptr
  2752. }
  2753. type TNS_ATT = struct {
  2754. Fversion uint64
  2755. Fhash uint64
  2756. FuriName uintptr
  2757. }
  2758. type TELEMENT_TYPE = struct {
  2759. Fname uintptr
  2760. Fprefix uintptr
  2761. FidAtt uintptr
  2762. FnDefaultAtts int32
  2763. FallocDefaultAtts int32
  2764. FdefaultAtts uintptr
  2765. }
  2766. type TDTD = struct {
  2767. FgeneralEntities THASH_TABLE
  2768. FelementTypes THASH_TABLE
  2769. FattributeIds THASH_TABLE
  2770. Fprefixes THASH_TABLE
  2771. Fpool TSTRING_POOL
  2772. FentityValuePool TSTRING_POOL
  2773. FkeepProcessing TXML_Bool
  2774. FhasParamEntityRefs TXML_Bool
  2775. Fstandalone TXML_Bool
  2776. FparamEntityRead TXML_Bool
  2777. FparamEntities THASH_TABLE
  2778. FdefaultPrefix TPREFIX
  2779. Fin_eldecl TXML_Bool
  2780. Fscaffold uintptr
  2781. FcontentStringLen uint32
  2782. FscaffSize uint32
  2783. FscaffCount uint32
  2784. FscaffLevel int32
  2785. FscaffIndex uintptr
  2786. }
  2787. type TOPEN_INTERNAL_ENTITY = struct {
  2788. FinternalEventPtr uintptr
  2789. FinternalEventEndPtr uintptr
  2790. Fnext uintptr
  2791. Fentity uintptr
  2792. FstartTagLevel int32
  2793. FbetweenDecl TXML_Bool
  2794. }
  2795. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2796. type _XML_Account = int32
  2797. const _XML_ACCOUNT_DIRECT = 0
  2798. const /* bytes directly passed to the Expat parser */
  2799. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  2800. const /* intermediate bytes produced during entity
  2801. expansion */
  2802. _XML_ACCOUNT_NONE = 2
  2803. type TXmlBigCount = uint64
  2804. type TACCOUNTING = struct {
  2805. FcountBytesDirect TXmlBigCount
  2806. FcountBytesIndirect TXmlBigCount
  2807. FdebugLevel int32
  2808. FmaximumAmplificationFactor float32
  2809. FactivationThresholdBytes uint64
  2810. }
  2811. type Taccounting = TACCOUNTING
  2812. type TENTITY_STATS = struct {
  2813. FcountEverOpened uint32
  2814. FcurrentDepth uint32
  2815. FmaximumDepthSeen uint32
  2816. FdebugLevel int32
  2817. }
  2818. type Tentity_stats = TENTITY_STATS
  2819. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2820. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2821. }
  2822. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2823. bp := tls.Alloc(16)
  2824. defer tls.Free(16)
  2825. var _ /* tmp at bp+0 */ [2]TXML_Char
  2826. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  2827. 0: nsSep,
  2828. }
  2829. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2830. }
  2831. // C documentation
  2832. //
  2833. // // "xml=http://www.w3.org/XML/1998/namespace"
  2834. var _implicitContext = [41]TXML_Char{
  2835. 0: uint8(m_ASCII_x),
  2836. 1: uint8(m_ASCII_m),
  2837. 2: uint8(m_ASCII_l),
  2838. 3: uint8(m_ASCII_EQUALS),
  2839. 4: uint8(m_ASCII_h),
  2840. 5: uint8(m_ASCII_t),
  2841. 6: uint8(m_ASCII_t),
  2842. 7: uint8(m_ASCII_p),
  2843. 8: uint8(m_ASCII_COLON),
  2844. 9: uint8(m_ASCII_SLASH),
  2845. 10: uint8(m_ASCII_SLASH),
  2846. 11: uint8(m_ASCII_w),
  2847. 12: uint8(m_ASCII_w),
  2848. 13: uint8(m_ASCII_w),
  2849. 14: uint8(m_ASCII_PERIOD),
  2850. 15: uint8(m_ASCII_w),
  2851. 16: uint8(m_ASCII_3),
  2852. 17: uint8(m_ASCII_PERIOD),
  2853. 18: uint8(m_ASCII_o),
  2854. 19: uint8(m_ASCII_r),
  2855. 20: uint8(m_ASCII_g),
  2856. 21: uint8(m_ASCII_SLASH),
  2857. 22: uint8(m_ASCII_X),
  2858. 23: uint8(m_ASCII_M),
  2859. 24: uint8(m_ASCII_L),
  2860. 25: uint8(m_ASCII_SLASH),
  2861. 26: uint8(m_ASCII_1),
  2862. 27: uint8(m_ASCII_9),
  2863. 28: uint8(m_ASCII_9),
  2864. 29: uint8(m_ASCII_8),
  2865. 30: uint8(m_ASCII_SLASH),
  2866. 31: uint8(m_ASCII_n),
  2867. 32: uint8(m_ASCII_a),
  2868. 33: uint8(m_ASCII_m),
  2869. 34: uint8(m_ASCII_e),
  2870. 35: uint8(m_ASCII_s),
  2871. 36: uint8(m_ASCII_p),
  2872. 37: uint8(m_ASCII_a),
  2873. 38: uint8(m_ASCII_c),
  2874. 39: uint8(m_ASCII_e),
  2875. }
  2876. /* To avoid warnings about unused functions: */
  2877. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  2878. bp := tls.Alloc(48)
  2879. defer tls.Free(48)
  2880. if _getDebugLevel(tls, __ccgo_ts+17, uint64(0)) >= uint64(1) {
  2881. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  2882. }
  2883. return entropy
  2884. }
  2885. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2886. bp := tls.Alloc(16)
  2887. defer tls.Free(16)
  2888. var _ /* entropy at bp+0 */ uint64
  2889. _ = parser
  2890. /* "Failproof" high quality providers: */
  2891. libbsd.Xarc4random_buf(tls, bp, uint64(8))
  2892. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint64)(unsafe.Pointer(bp)))
  2893. }
  2894. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2895. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2896. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2897. }
  2898. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2899. }
  2900. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2901. /* hash functions must be initialized before setContext() is called */
  2902. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  2903. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2904. }
  2905. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2906. /* implicit context only set for root parser, since child
  2907. parsers (i.e. external entity parsers) will inherit it
  2908. */
  2909. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2910. }
  2911. return libc.Uint8FromInt32(1)
  2912. }
  2913. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2914. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2915. }
  2916. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2917. var mtemp, mtemp1 uintptr
  2918. var parser TXML_Parser
  2919. _, _, _ = mtemp, mtemp1, parser
  2920. if memsuite != 0 {
  2921. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(976))
  2922. if parser != libc.UintptrFromInt32(0) {
  2923. mtemp = parser + 24
  2924. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  2925. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  2926. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  2927. }
  2928. } else {
  2929. parser = libc.Xmalloc(tls, uint64(976))
  2930. if parser != libc.UintptrFromInt32(0) {
  2931. mtemp1 = parser + 24
  2932. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  2933. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  2934. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  2935. }
  2936. }
  2937. if !(parser != 0) {
  2938. return parser
  2939. }
  2940. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  2941. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  2942. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  2943. (*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))
  2944. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  2945. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2946. return libc.UintptrFromInt32(0)
  2947. }
  2948. (*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))
  2949. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  2950. (*(*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)
  2951. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2952. return libc.UintptrFromInt32(0)
  2953. }
  2954. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  2955. if dtd != 0 {
  2956. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  2957. } else {
  2958. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  2959. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  2960. (*(*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)
  2961. (*(*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)
  2962. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2963. return libc.UintptrFromInt32(0)
  2964. }
  2965. }
  2966. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  2967. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  2968. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  2969. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  2970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  2971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  2972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  2973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = uint8(m_ASCII_EXCL)
  2974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  2975. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  2976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  2977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  2978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  2979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  2980. _poolInit(tls, parser+784, parser+24)
  2981. _poolInit(tls, parser+832, parser+24)
  2982. _parserInit(tls, parser, encodingName)
  2983. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  2984. if dtd != 0 {
  2985. // We need to stop the upcoming call to XML_ParserFree from happily
  2986. // destroying parser->m_dtd because the DTD is shared with the parent
  2987. // parser and the only guard that keeps XML_ParserFree from destroying
  2988. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  2989. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  2990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  2991. }
  2992. XXML_ParserFree(tls, parser)
  2993. return libc.UintptrFromInt32(0)
  2994. }
  2995. if nameSep != 0 {
  2996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  2997. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  2998. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  2999. } else {
  3000. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3001. }
  3002. return parser
  3003. }
  3004. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3005. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3006. XXmlPrologStateInit(tls, parser+496)
  3007. if encodingName != libc.UintptrFromInt32(0) {
  3008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3009. }
  3010. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3011. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  3012. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3014. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3018. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3019. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3020. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3022. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3023. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3024. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3025. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3039. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3051. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3052. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3053. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3054. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3055. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3056. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3058. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3062. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3070. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3071. libc.Xmemset(tls, parser+928, 0, uint64(32))
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3075. libc.Xmemset(tls, parser+960, 0, uint64(16))
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint64(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3077. }
  3078. // C documentation
  3079. //
  3080. // /* moves list of bindings to m_freeBindingList */
  3081. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3082. var b uintptr
  3083. _ = b
  3084. for bindings != 0 {
  3085. b = bindings
  3086. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3087. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3088. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3089. }
  3090. }
  3091. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3092. var openEntity, openEntityList, tStk, tag uintptr
  3093. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3094. if parser == libc.UintptrFromInt32(0) {
  3095. return libc.Uint8FromInt32(0)
  3096. }
  3097. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3098. return libc.Uint8FromInt32(0)
  3099. }
  3100. /* move m_tagStack to m_freeTagList */
  3101. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3102. for tStk != 0 {
  3103. tag = tStk
  3104. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3105. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3106. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3107. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3109. }
  3110. /* move m_openInternalEntities to m_freeInternalEntities */
  3111. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3112. for openEntityList != 0 {
  3113. openEntity = openEntityList
  3114. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3115. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3117. }
  3118. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3119. (*(*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)
  3120. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3121. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3122. }
  3123. _poolClear(tls, parser+784)
  3124. _poolClear(tls, parser+832)
  3125. (*(*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)
  3126. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3127. _parserInit(tls, parser, encodingName)
  3128. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3129. return libc.Uint8FromInt32(1)
  3130. }
  3131. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3132. if parser == libc.UintptrFromInt32(0) {
  3133. return int32(_XML_STATUS_ERROR)
  3134. }
  3135. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3136. XXX There's no way for the caller to determine which of the
  3137. XXX possible error cases caused the XML_STATUS_ERROR return.
  3138. */
  3139. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3140. return int32(_XML_STATUS_ERROR)
  3141. }
  3142. /* Get rid of any previous encoding name */
  3143. (*(*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)
  3144. if encodingName == libc.UintptrFromInt32(0) {
  3145. /* No new encoding name */
  3146. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3147. } else {
  3148. /* Copy the new encoding name into allocated memory */
  3149. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3150. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3151. return int32(_XML_STATUS_ERROR)
  3152. }
  3153. }
  3154. return int32(_XML_STATUS_OK)
  3155. }
  3156. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3157. bp := tls.Alloc(16)
  3158. defer tls.Free(16)
  3159. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3160. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3161. var oldCharacterDataHandler TXML_CharacterDataHandler
  3162. var oldCommentHandler TXML_CommentHandler
  3163. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3164. var oldDefaultHandler TXML_DefaultHandler
  3165. var oldElementDeclHandler TXML_ElementDeclHandler
  3166. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3167. var oldEndElementHandler TXML_EndElementHandler
  3168. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3169. var oldEntityDeclHandler TXML_EntityDeclHandler
  3170. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3171. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3172. var oldInEntityValue int32
  3173. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3174. var oldNotationDeclHandler TXML_NotationDeclHandler
  3175. var oldParamEntityParsing _XML_ParamEntityParsing
  3176. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3177. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3178. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3179. var oldStartElementHandler TXML_StartElementHandler
  3180. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3181. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3182. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3183. var oldXmlDeclHandler TXML_XmlDeclHandler
  3184. var oldhash_secret_salt uint64
  3185. var _ /* tmp at bp+0 */ [2]TXML_Char
  3186. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3187. parser = oldParser
  3188. newDtd = libc.UintptrFromInt32(0)
  3189. /* Validate the oldParser parameter before we pull everything out of it */
  3190. if oldParser == libc.UintptrFromInt32(0) {
  3191. return libc.UintptrFromInt32(0)
  3192. }
  3193. /* Stash the original parser contents on the stack */
  3194. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3195. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3196. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3197. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3198. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3199. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3200. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3201. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3202. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3203. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3204. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3205. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3206. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3207. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3208. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3209. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3210. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3211. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3212. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3213. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3214. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3215. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3216. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3217. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3218. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3219. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3220. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3221. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3222. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3223. /* Note that the new parser shares the same hash secret as the old
  3224. parser, so that dtdCopy and copyEntityTable can lookup values
  3225. from hash tables associated with either parser without us having
  3226. to worry which hash secrets each table has.
  3227. */
  3228. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3229. if !(context != 0) {
  3230. newDtd = oldDtd
  3231. }
  3232. /* Note that the magical uses of the pre-processor to make field
  3233. access look more like C++ require that `parser' be overwritten
  3234. here. This makes this function more painful to follow than it
  3235. would be otherwise.
  3236. */
  3237. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3238. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3239. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3240. }
  3241. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3242. } else {
  3243. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3244. }
  3245. if !(parser != 0) {
  3246. return libc.UintptrFromInt32(0)
  3247. }
  3248. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3249. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3250. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3251. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3252. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3254. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3255. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3257. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3258. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3259. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3260. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3262. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3263. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3266. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3269. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3270. if oldUserData == oldHandlerArg {
  3271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3272. } else {
  3273. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3274. }
  3275. if oldExternalEntityRefHandlerArg != oldParser {
  3276. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3277. }
  3278. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3280. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3281. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3282. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3283. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3284. if context != 0 {
  3285. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3286. XXML_ParserFree(tls, parser)
  3287. return libc.UintptrFromInt32(0)
  3288. }
  3289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3290. } else {
  3291. /* The DTD instance referenced by parser->m_dtd is shared between the
  3292. document's root parser and external PE parsers, therefore one does not
  3293. need to call setContext. In addition, one also *must* not call
  3294. setContext, because this would overwrite existing prefix->binding
  3295. pointers in parser->m_dtd with ones that get destroyed with the external
  3296. PE parser. This would leave those prefixes with dangling pointers.
  3297. */
  3298. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3299. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3300. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3301. }
  3302. return parser
  3303. }
  3304. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3305. var b uintptr
  3306. _ = b
  3307. for {
  3308. b = bindings
  3309. if !(b != 0) {
  3310. break
  3311. }
  3312. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3313. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3314. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3315. goto _1
  3316. _1:
  3317. }
  3318. }
  3319. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3320. var entityList, openEntity, p, tagList uintptr
  3321. _, _, _, _ = entityList, openEntity, p, tagList
  3322. if parser == libc.UintptrFromInt32(0) {
  3323. return
  3324. }
  3325. /* free m_tagStack and m_freeTagList */
  3326. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3327. for {
  3328. if tagList == libc.UintptrFromInt32(0) {
  3329. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3330. break
  3331. }
  3332. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3333. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3334. }
  3335. p = tagList
  3336. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3337. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3338. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3339. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3340. goto _1
  3341. _1:
  3342. }
  3343. /* free m_openInternalEntities and m_freeInternalEntities */
  3344. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3345. for {
  3346. if entityList == libc.UintptrFromInt32(0) {
  3347. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3348. break
  3349. }
  3350. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3351. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3352. }
  3353. openEntity = entityList
  3354. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3355. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3356. goto _2
  3357. _2:
  3358. }
  3359. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3360. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3361. _poolDestroy(tls, parser+784)
  3362. _poolDestroy(tls, parser+832)
  3363. (*(*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)
  3364. /* external parameter entity parsers share the DTD structure
  3365. parser->m_dtd with the root parser, so we must not destroy it
  3366. */
  3367. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3368. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3369. }
  3370. (*(*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)
  3371. (*(*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)
  3372. (*(*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)
  3373. (*(*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)
  3374. (*(*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)
  3375. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem)
  3376. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3377. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3378. }
  3379. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3380. }
  3381. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3382. if parser != libc.UintptrFromInt32(0) {
  3383. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3384. }
  3385. }
  3386. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3387. if parser == libc.UintptrFromInt32(0) {
  3388. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3389. }
  3390. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3391. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3392. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3393. }
  3394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3395. return int32(_XML_ERROR_NONE)
  3396. }
  3397. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3398. var v1 int32
  3399. _ = v1
  3400. if parser == libc.UintptrFromInt32(0) {
  3401. return
  3402. }
  3403. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3404. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3405. return
  3406. }
  3407. if do_nst != 0 {
  3408. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3409. } else {
  3410. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3411. }
  3412. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3413. }
  3414. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3415. var v1 uintptr
  3416. _ = v1
  3417. if parser == libc.UintptrFromInt32(0) {
  3418. return
  3419. }
  3420. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3421. v1 = p
  3422. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3423. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3424. } else {
  3425. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3426. }
  3427. }
  3428. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3429. if parser == libc.UintptrFromInt32(0) {
  3430. return int32(_XML_STATUS_ERROR)
  3431. }
  3432. if p != 0 {
  3433. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3434. if !(p != 0) {
  3435. return int32(_XML_STATUS_ERROR)
  3436. }
  3437. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3438. } else {
  3439. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3440. }
  3441. return int32(_XML_STATUS_OK)
  3442. }
  3443. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3444. if parser == libc.UintptrFromInt32(0) {
  3445. return libc.UintptrFromInt32(0)
  3446. }
  3447. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3448. }
  3449. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3450. if parser == libc.UintptrFromInt32(0) {
  3451. return -int32(1)
  3452. }
  3453. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3454. }
  3455. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3456. if parser == libc.UintptrFromInt32(0) {
  3457. return -int32(1)
  3458. }
  3459. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3460. }
  3461. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3462. if parser == libc.UintptrFromInt32(0) {
  3463. return
  3464. }
  3465. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3466. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3467. }
  3468. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3469. if parser != libc.UintptrFromInt32(0) {
  3470. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3471. }
  3472. }
  3473. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3474. if parser != libc.UintptrFromInt32(0) {
  3475. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3476. }
  3477. }
  3478. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3479. if parser != libc.UintptrFromInt32(0) {
  3480. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3481. }
  3482. }
  3483. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3484. if parser != libc.UintptrFromInt32(0) {
  3485. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3486. }
  3487. }
  3488. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3489. if parser != libc.UintptrFromInt32(0) {
  3490. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3491. }
  3492. }
  3493. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3494. if parser == libc.UintptrFromInt32(0) {
  3495. return
  3496. }
  3497. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3498. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3499. }
  3500. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3501. if parser != libc.UintptrFromInt32(0) {
  3502. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3503. }
  3504. }
  3505. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3506. if parser != libc.UintptrFromInt32(0) {
  3507. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3508. }
  3509. }
  3510. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3511. if parser == libc.UintptrFromInt32(0) {
  3512. return
  3513. }
  3514. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3515. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3516. }
  3517. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3518. if parser == libc.UintptrFromInt32(0) {
  3519. return
  3520. }
  3521. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3522. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3523. }
  3524. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3525. if parser == libc.UintptrFromInt32(0) {
  3526. return
  3527. }
  3528. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3529. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3530. }
  3531. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3532. if parser != libc.UintptrFromInt32(0) {
  3533. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3534. }
  3535. }
  3536. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3537. if parser != libc.UintptrFromInt32(0) {
  3538. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3539. }
  3540. }
  3541. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3542. if parser != libc.UintptrFromInt32(0) {
  3543. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3544. }
  3545. }
  3546. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3547. if parser != libc.UintptrFromInt32(0) {
  3548. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3549. }
  3550. }
  3551. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3552. if parser == libc.UintptrFromInt32(0) {
  3553. return
  3554. }
  3555. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3556. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3557. }
  3558. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3559. if parser != libc.UintptrFromInt32(0) {
  3560. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3561. }
  3562. }
  3563. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3564. if parser != libc.UintptrFromInt32(0) {
  3565. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3566. }
  3567. }
  3568. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3569. if parser != libc.UintptrFromInt32(0) {
  3570. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3571. }
  3572. }
  3573. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3574. if parser != libc.UintptrFromInt32(0) {
  3575. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3576. }
  3577. }
  3578. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3579. if parser == libc.UintptrFromInt32(0) {
  3580. return
  3581. }
  3582. if arg != 0 {
  3583. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3584. } else {
  3585. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3586. }
  3587. }
  3588. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3589. if parser != libc.UintptrFromInt32(0) {
  3590. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3591. }
  3592. }
  3593. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3594. if parser == libc.UintptrFromInt32(0) {
  3595. return
  3596. }
  3597. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3599. }
  3600. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3601. if parser != libc.UintptrFromInt32(0) {
  3602. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3603. }
  3604. }
  3605. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3606. if parser != libc.UintptrFromInt32(0) {
  3607. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3608. }
  3609. }
  3610. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3611. if parser != libc.UintptrFromInt32(0) {
  3612. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3613. }
  3614. }
  3615. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3616. if parser != libc.UintptrFromInt32(0) {
  3617. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3618. }
  3619. }
  3620. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3621. if parser == libc.UintptrFromInt32(0) {
  3622. return 0
  3623. }
  3624. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3625. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3626. return 0
  3627. }
  3628. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3629. return int32(1)
  3630. }
  3631. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3632. if parser == libc.UintptrFromInt32(0) {
  3633. return 0
  3634. }
  3635. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3636. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3637. }
  3638. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3639. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3640. return 0
  3641. }
  3642. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3643. return int32(1)
  3644. }
  3645. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3646. var buff uintptr
  3647. _ = buff
  3648. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3649. if parser != libc.UintptrFromInt32(0) {
  3650. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3651. }
  3652. return int32(_XML_STATUS_ERROR)
  3653. }
  3654. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3655. case int32(_XML_SUSPENDED):
  3656. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3657. return int32(_XML_STATUS_ERROR)
  3658. case int32(_XML_FINISHED):
  3659. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3660. return int32(_XML_STATUS_ERROR)
  3661. case int32(_XML_INITIALIZED):
  3662. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3663. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3664. return int32(_XML_STATUS_ERROR)
  3665. }
  3666. /* fall through */
  3667. fallthrough
  3668. default:
  3669. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3670. }
  3671. if len1 == 0 {
  3672. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3673. if !(isFinal != 0) {
  3674. return int32(_XML_STATUS_OK)
  3675. }
  3676. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3677. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3678. /* If data are left over from last buffer, and we now know that these
  3679. data are the final chunk of input, then we have to check them again
  3680. to detect errors based on that fact.
  3681. */
  3682. (*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)
  3683. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3684. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3685. case int32(_XML_SUSPENDED):
  3686. /* It is hard to be certain, but it seems that this case
  3687. * cannot occur. This code is cleaning up a previous parse
  3688. * with no new data (since len == 0). Changing the parsing
  3689. * state requires getting to execute a handler function, and
  3690. * there doesn't seem to be an opportunity for that while in
  3691. * this circumstance.
  3692. *
  3693. * Given the uncertainty, we retain the code but exclude it
  3694. * from coverage tests.
  3695. *
  3696. * LCOV_EXCL_START
  3697. */
  3698. (*(*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)
  3699. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3700. return int32(_XML_STATUS_SUSPENDED)
  3701. /* LCOV_EXCL_STOP */
  3702. fallthrough
  3703. case int32(_XML_INITIALIZED):
  3704. fallthrough
  3705. case int32(_XML_PARSING):
  3706. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3707. /* fall through */
  3708. fallthrough
  3709. default:
  3710. return int32(_XML_STATUS_OK)
  3711. }
  3712. }
  3713. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3714. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3715. return int32(_XML_STATUS_ERROR)
  3716. } else {
  3717. buff = XXML_GetBuffer(tls, parser, len1)
  3718. if buff == libc.UintptrFromInt32(0) {
  3719. return int32(_XML_STATUS_ERROR)
  3720. } else {
  3721. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3722. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3723. }
  3724. }
  3725. return r
  3726. }
  3727. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3728. var result _XML_Status
  3729. var start uintptr
  3730. _, _ = result, start
  3731. result = int32(_XML_STATUS_OK)
  3732. if parser == libc.UintptrFromInt32(0) {
  3733. return int32(_XML_STATUS_ERROR)
  3734. }
  3735. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3736. case int32(_XML_SUSPENDED):
  3737. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3738. return int32(_XML_STATUS_ERROR)
  3739. case int32(_XML_FINISHED):
  3740. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3741. return int32(_XML_STATUS_ERROR)
  3742. case int32(_XML_INITIALIZED):
  3743. /* Has someone called XML_GetBuffer successfully before? */
  3744. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3745. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3746. return int32(_XML_STATUS_ERROR)
  3747. }
  3748. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3749. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3750. return int32(_XML_STATUS_ERROR)
  3751. }
  3752. /* fall through */
  3753. fallthrough
  3754. default:
  3755. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3756. }
  3757. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3758. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3759. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3760. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3761. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3762. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3763. (*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)
  3764. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3765. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3766. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3767. return int32(_XML_STATUS_ERROR)
  3768. } else {
  3769. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3770. case int32(_XML_SUSPENDED):
  3771. result = int32(_XML_STATUS_SUSPENDED)
  3772. case int32(_XML_INITIALIZED):
  3773. fallthrough
  3774. case int32(_XML_PARSING):
  3775. if isFinal != 0 {
  3776. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3777. return result
  3778. }
  3779. fallthrough
  3780. default: /* should not happen */
  3781. }
  3782. }
  3783. (*(*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)
  3784. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3785. return result
  3786. }
  3787. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3788. var bufferSize, keep, neededSize, offset int32
  3789. var newBuf, v10, v11 uintptr
  3790. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  3791. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3792. if parser == libc.UintptrFromInt32(0) {
  3793. return libc.UintptrFromInt32(0)
  3794. }
  3795. if len1 < 0 {
  3796. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3797. return libc.UintptrFromInt32(0)
  3798. }
  3799. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3800. case int32(_XML_SUSPENDED):
  3801. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3802. return libc.UintptrFromInt32(0)
  3803. case int32(_XML_FINISHED):
  3804. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3805. return libc.UintptrFromInt32(0)
  3806. default:
  3807. }
  3808. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3809. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3810. } else {
  3811. v1 = 0
  3812. }
  3813. if int64(len1) > v1 {
  3814. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3815. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3816. } else {
  3817. v2 = 0
  3818. }
  3819. /* Do not invoke signed arithmetic overflow: */
  3820. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  3821. if neededSize < 0 {
  3822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3823. return libc.UintptrFromInt32(0)
  3824. }
  3825. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3826. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3827. } else {
  3828. v3 = 0
  3829. }
  3830. keep = int32(v3)
  3831. if keep > int32(m_XML_CONTEXT_BYTES) {
  3832. keep = int32(m_XML_CONTEXT_BYTES)
  3833. }
  3834. /* Detect and prevent integer overflow */
  3835. if keep > int32(m_INT_MAX)-neededSize {
  3836. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3837. return libc.UintptrFromInt32(0)
  3838. }
  3839. neededSize += keep
  3840. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3841. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3842. } else {
  3843. v4 = 0
  3844. }
  3845. if int64(neededSize) <= v4 {
  3846. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3847. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3848. } else {
  3849. v5 = 0
  3850. }
  3851. if int64(keep) < v5 {
  3852. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3853. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3854. } else {
  3855. v6 = 0
  3856. }
  3857. offset = int32(v6) - keep
  3858. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3859. * in the buffer */
  3860. 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)))
  3861. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  3862. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  3863. }
  3864. } else {
  3865. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3866. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3867. } else {
  3868. v7 = 0
  3869. }
  3870. bufferSize = int32(v7)
  3871. if bufferSize == 0 {
  3872. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3873. }
  3874. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3875. /* Do not invoke signed arithmetic overflow: */
  3876. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3877. }
  3878. if bufferSize <= 0 {
  3879. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3880. return libc.UintptrFromInt32(0)
  3881. }
  3882. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  3883. if newBuf == uintptr(0) {
  3884. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3885. return libc.UintptrFromInt32(0)
  3886. }
  3887. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3888. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3889. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3890. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3891. } else {
  3892. v8 = 0
  3893. }
  3894. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  3895. (*(*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)
  3896. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3897. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3898. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3899. } else {
  3900. v9 = 0
  3901. }
  3902. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3903. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3904. } else {
  3905. /* This must be a brand new buffer with no data in it yet */
  3906. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3907. v10 = newBuf
  3908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3909. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3910. }
  3911. }
  3912. v11 = libc.UintptrFromInt32(0)
  3913. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3914. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3915. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3916. }
  3917. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3918. }
  3919. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3920. if parser == libc.UintptrFromInt32(0) {
  3921. return int32(_XML_STATUS_ERROR)
  3922. }
  3923. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3924. case int32(_XML_SUSPENDED):
  3925. if resumable != 0 {
  3926. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3927. return int32(_XML_STATUS_ERROR)
  3928. }
  3929. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3930. case int32(_XML_FINISHED):
  3931. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3932. return int32(_XML_STATUS_ERROR)
  3933. default:
  3934. if resumable != 0 {
  3935. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  3936. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  3937. return int32(_XML_STATUS_ERROR)
  3938. }
  3939. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  3940. } else {
  3941. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3942. }
  3943. }
  3944. return int32(_XML_STATUS_OK)
  3945. }
  3946. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  3947. var result _XML_Status
  3948. _ = result
  3949. result = int32(_XML_STATUS_OK)
  3950. if parser == libc.UintptrFromInt32(0) {
  3951. return int32(_XML_STATUS_ERROR)
  3952. }
  3953. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  3954. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  3955. return int32(_XML_STATUS_ERROR)
  3956. }
  3957. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3958. (*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)
  3959. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3960. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3961. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3962. return int32(_XML_STATUS_ERROR)
  3963. } else {
  3964. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3965. case int32(_XML_SUSPENDED):
  3966. result = int32(_XML_STATUS_SUSPENDED)
  3967. case int32(_XML_INITIALIZED):
  3968. fallthrough
  3969. case int32(_XML_PARSING):
  3970. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  3971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3972. return result
  3973. }
  3974. fallthrough
  3975. default:
  3976. }
  3977. }
  3978. (*(*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)
  3979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3980. return result
  3981. }
  3982. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  3983. if parser == libc.UintptrFromInt32(0) {
  3984. return
  3985. }
  3986. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  3987. }
  3988. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  3989. if parser == libc.UintptrFromInt32(0) {
  3990. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3991. }
  3992. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  3993. }
  3994. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  3995. if parser == libc.UintptrFromInt32(0) {
  3996. return int64(-int32(1))
  3997. }
  3998. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  3999. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4000. }
  4001. return int64(-int32(1))
  4002. }
  4003. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4004. if parser == libc.UintptrFromInt32(0) {
  4005. return 0
  4006. }
  4007. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4008. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4009. }
  4010. return 0
  4011. }
  4012. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4013. if parser == libc.UintptrFromInt32(0) {
  4014. return libc.UintptrFromInt32(0)
  4015. }
  4016. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4017. if offset != libc.UintptrFromInt32(0) {
  4018. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4019. }
  4020. if size != libc.UintptrFromInt32(0) {
  4021. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4022. }
  4023. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4024. }
  4025. return libc.UintptrFromInt32(0)
  4026. }
  4027. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4028. if parser == libc.UintptrFromInt32(0) {
  4029. return uint64(0)
  4030. }
  4031. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4032. (*(*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)
  4033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4034. }
  4035. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  4036. }
  4037. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4038. if parser == libc.UintptrFromInt32(0) {
  4039. return uint64(0)
  4040. }
  4041. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4042. (*(*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)
  4043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4044. }
  4045. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4046. }
  4047. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4048. if parser != libc.UintptrFromInt32(0) {
  4049. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4050. }
  4051. }
  4052. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4053. if parser == libc.UintptrFromInt32(0) {
  4054. return libc.UintptrFromInt32(0)
  4055. }
  4056. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4057. }
  4058. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4059. if parser == libc.UintptrFromInt32(0) {
  4060. return libc.UintptrFromInt32(0)
  4061. }
  4062. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4063. }
  4064. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4065. if parser != libc.UintptrFromInt32(0) {
  4066. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4067. }
  4068. }
  4069. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4070. if parser == libc.UintptrFromInt32(0) {
  4071. return
  4072. }
  4073. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4074. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4075. _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)
  4076. } else {
  4077. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4078. }
  4079. }
  4080. }
  4081. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4082. switch code {
  4083. case int32(_XML_ERROR_NONE):
  4084. return libc.UintptrFromInt32(0)
  4085. case int32(_XML_ERROR_NO_MEMORY):
  4086. return __ccgo_ts + 138
  4087. case int32(_XML_ERROR_SYNTAX):
  4088. return __ccgo_ts + 152
  4089. case int32(_XML_ERROR_NO_ELEMENTS):
  4090. return __ccgo_ts + 165
  4091. case int32(_XML_ERROR_INVALID_TOKEN):
  4092. return __ccgo_ts + 182
  4093. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4094. return __ccgo_ts + 214
  4095. case int32(_XML_ERROR_PARTIAL_CHAR):
  4096. return __ccgo_ts + 229
  4097. case int32(_XML_ERROR_TAG_MISMATCH):
  4098. return __ccgo_ts + 247
  4099. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4100. return __ccgo_ts + 262
  4101. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4102. return __ccgo_ts + 282
  4103. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4104. return __ccgo_ts + 310
  4105. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4106. return __ccgo_ts + 345
  4107. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4108. return __ccgo_ts + 362
  4109. case int32(_XML_ERROR_ASYNC_ENTITY):
  4110. return __ccgo_ts + 389
  4111. case int32(_XML_ERROR_BAD_CHAR_REF):
  4112. return __ccgo_ts + 409
  4113. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4114. return __ccgo_ts + 447
  4115. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4116. return __ccgo_ts + 474
  4117. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4118. return __ccgo_ts + 516
  4119. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4120. return __ccgo_ts + 563
  4121. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4122. return __ccgo_ts + 580
  4123. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4124. return __ccgo_ts + 631
  4125. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4126. return __ccgo_ts + 654
  4127. case int32(_XML_ERROR_NOT_STANDALONE):
  4128. return __ccgo_ts + 700
  4129. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4130. return __ccgo_ts + 727
  4131. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4132. return __ccgo_ts + 778
  4133. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4134. return __ccgo_ts + 814
  4135. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4136. return __ccgo_ts + 866
  4137. /* Added in 1.95.7. */
  4138. fallthrough
  4139. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4140. return __ccgo_ts + 911
  4141. /* Added in 1.95.8. */
  4142. fallthrough
  4143. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4144. return __ccgo_ts + 926
  4145. case int32(_XML_ERROR_INCOMPLETE_PE):
  4146. return __ccgo_ts + 952
  4147. case int32(_XML_ERROR_XML_DECL):
  4148. return __ccgo_ts + 990
  4149. case int32(_XML_ERROR_TEXT_DECL):
  4150. return __ccgo_ts + 1022
  4151. case int32(_XML_ERROR_PUBLICID):
  4152. return __ccgo_ts + 1055
  4153. case int32(_XML_ERROR_SUSPENDED):
  4154. return __ccgo_ts + 1089
  4155. case int32(_XML_ERROR_NOT_SUSPENDED):
  4156. return __ccgo_ts + 1106
  4157. case int32(_XML_ERROR_ABORTED):
  4158. return __ccgo_ts + 1127
  4159. case int32(_XML_ERROR_FINISHED):
  4160. return __ccgo_ts + 1143
  4161. case int32(_XML_ERROR_SUSPEND_PE):
  4162. return __ccgo_ts + 1160
  4163. /* Added in 2.0.0. */
  4164. fallthrough
  4165. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4166. return __ccgo_ts + 1204
  4167. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4168. return __ccgo_ts + 1284
  4169. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4170. return __ccgo_ts + 1343
  4171. /* Added in 2.2.5. */
  4172. fallthrough
  4173. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4174. return __ccgo_ts + 1407
  4175. /* Added in 2.3.0. */
  4176. fallthrough
  4177. case int32(_XML_ERROR_NO_BUFFER):
  4178. return __ccgo_ts + 1424
  4179. /* Added in 2.4.0. */
  4180. fallthrough
  4181. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4182. return __ccgo_ts + 1486
  4183. }
  4184. return libc.UintptrFromInt32(0)
  4185. }
  4186. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4187. /* V1 is used to string-ize the version number. However, it would
  4188. string-ize the actual version macro *names* unless we get them
  4189. substituted before being passed to V1. CPP is defined to expand
  4190. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4191. the version macros, then CPP will expand the resulting V1() macro
  4192. with the correct numerals. */
  4193. /* ### I'm assuming cpp is portable in this respect... */
  4194. return __ccgo_ts + 1555
  4195. }
  4196. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4197. var version TXML_Expat_Version
  4198. _ = version
  4199. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4200. version.Fminor = int32(m_XML_MINOR_VERSION)
  4201. version.Fmicro = m_XML_MICRO_VERSION
  4202. return version
  4203. }
  4204. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4205. return uintptr(unsafe.Pointer(&_features))
  4206. }
  4207. var _features = [8]TXML_Feature{
  4208. 0: {
  4209. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4210. Fname: __ccgo_ts + 1567,
  4211. Fvalue: int64(1),
  4212. },
  4213. 1: {
  4214. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4215. Fname: __ccgo_ts + 1584,
  4216. Fvalue: int64(1),
  4217. },
  4218. 2: {
  4219. Ffeature: int32(_XML_FEATURE_DTD),
  4220. Fname: __ccgo_ts + 1602,
  4221. },
  4222. 3: {
  4223. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4224. Fname: __ccgo_ts + 1610,
  4225. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4226. },
  4227. 4: {
  4228. Ffeature: int32(_XML_FEATURE_NS),
  4229. Fname: __ccgo_ts + 1628,
  4230. },
  4231. 5: {
  4232. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4233. Fname: __ccgo_ts + 1635,
  4234. Fvalue: libc.Int64FromFloat32(100),
  4235. },
  4236. 6: {
  4237. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4238. Fname: __ccgo_ts + 1652,
  4239. Fvalue: int64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4240. },
  4241. 7: {},
  4242. }
  4243. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4244. bp := tls.Alloc(16)
  4245. defer tls.Free(16)
  4246. var v1 uint32
  4247. var v3 bool
  4248. var _ /* __u at bp+0 */ struct {
  4249. F__i [0]uint32
  4250. F__f float32
  4251. }
  4252. _, _ = v1, v3
  4253. if v3 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v3 {
  4254. *(*float32)(unsafe.Pointer(bp)) = maximumAmplificationFactor
  4255. v1 = *(*uint32)(unsafe.Pointer(bp))
  4256. goto _2
  4257. _2:
  4258. }
  4259. if v3 || libc.BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4260. return libc.Uint8FromInt32(0)
  4261. }
  4262. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4263. return libc.Uint8FromInt32(1)
  4264. }
  4265. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4266. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4267. return libc.Uint8FromInt32(0)
  4268. }
  4269. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4270. return libc.Uint8FromInt32(1)
  4271. }
  4272. // C documentation
  4273. //
  4274. // /* Initially tag->rawName always points into the parse buffer;
  4275. // for those TAG instances opened while the current parse buffer was
  4276. // processed, and not yet closed, we need to store tag->rawName in a more
  4277. // permanent location, since the parse buffer is about to be discarded.
  4278. // */
  4279. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4280. var bufSize, nameLen int32
  4281. var rawNameBuf, tag, temp uintptr
  4282. var rawNameLen Tsize_t
  4283. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4284. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4285. for tag != 0 {
  4286. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4287. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4288. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4289. at the first entry that has already been copied; everything
  4290. below it in the stack is already been accounted for in a
  4291. previous call to this function.
  4292. */
  4293. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4294. break
  4295. }
  4296. /* For re-use purposes we need to ensure that the
  4297. size of tag->buf is a multiple of sizeof(XML_Char).
  4298. */
  4299. rawNameLen = (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  4300. /* Detect and prevent integer overflow. */
  4301. if rawNameLen > libc.Uint64FromInt32(m_INT_MAX)-libc.Uint64FromInt32(nameLen) {
  4302. return libc.Uint8FromInt32(0)
  4303. }
  4304. bufSize = nameLen + libc.Int32FromUint64(rawNameLen)
  4305. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4306. 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))
  4307. if temp == libc.UintptrFromInt32(0) {
  4308. return libc.Uint8FromInt32(0)
  4309. }
  4310. /* if tag->name.str points to tag->buf (only when namespace
  4311. processing is off) then we have to update it
  4312. */
  4313. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4314. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4315. }
  4316. /* if tag->name.localPart is set (when namespace processing is on)
  4317. then update it as well, since it will always point into tag->buf
  4318. */
  4319. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4320. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4321. }
  4322. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4323. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4324. rawNameBuf = temp + uintptr(nameLen)
  4325. }
  4326. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4327. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4328. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4329. }
  4330. return libc.Uint8FromInt32(1)
  4331. }
  4332. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4333. var result _XML_Error
  4334. _ = result
  4335. 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))
  4336. if result == int32(_XML_ERROR_NONE) {
  4337. if !(_storeRawNames(tls, parser) != 0) {
  4338. return int32(_XML_ERROR_NO_MEMORY)
  4339. }
  4340. }
  4341. return result
  4342. }
  4343. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4344. var result _XML_Error
  4345. _ = result
  4346. result = _initializeEncoding(tls, parser)
  4347. if result != int32(_XML_ERROR_NONE) {
  4348. return result
  4349. }
  4350. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4351. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4352. }
  4353. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4354. bp := tls.Alloc(16)
  4355. defer tls.Free(16)
  4356. var tok int32
  4357. var _ /* next at bp+0 */ uintptr
  4358. _ = tok
  4359. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4360. 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)
  4361. switch tok {
  4362. case int32(m_XML_TOK_BOM):
  4363. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4364. _accountingOnAbort(tls, parser)
  4365. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4366. }
  4367. /* If we are at the end of the buffer, this would cause the next stage,
  4368. i.e. externalEntityInitProcessor3, to pass control directly to
  4369. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4370. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4371. */
  4372. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4373. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4374. return int32(_XML_ERROR_NONE)
  4375. }
  4376. start = *(*uintptr)(unsafe.Pointer(bp))
  4377. case -int32(1):
  4378. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4379. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4380. return int32(_XML_ERROR_NONE)
  4381. }
  4382. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4383. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4384. case -int32(2):
  4385. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4386. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4387. return int32(_XML_ERROR_NONE)
  4388. }
  4389. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4390. return int32(_XML_ERROR_PARTIAL_CHAR)
  4391. }
  4392. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4393. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4394. }
  4395. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4396. bp := tls.Alloc(16)
  4397. defer tls.Free(16)
  4398. var result _XML_Error
  4399. var tok int32
  4400. var _ /* next at bp+0 */ uintptr
  4401. _, _ = result, tok
  4402. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4403. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4404. 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)
  4405. /* Note: These bytes are accounted later in:
  4406. - processXmlDecl
  4407. - externalEntityContentProcessor
  4408. */
  4409. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4410. switch tok {
  4411. case int32(m_XML_TOK_XML_DECL):
  4412. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4413. if result != int32(_XML_ERROR_NONE) {
  4414. return result
  4415. }
  4416. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4417. case int32(_XML_SUSPENDED):
  4418. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4419. return int32(_XML_ERROR_NONE)
  4420. case int32(_XML_FINISHED):
  4421. return int32(_XML_ERROR_ABORTED)
  4422. default:
  4423. start = *(*uintptr)(unsafe.Pointer(bp))
  4424. }
  4425. case -int32(1):
  4426. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4427. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4428. return int32(_XML_ERROR_NONE)
  4429. }
  4430. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4431. case -int32(2):
  4432. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4433. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4434. return int32(_XML_ERROR_NONE)
  4435. }
  4436. return int32(_XML_ERROR_PARTIAL_CHAR)
  4437. }
  4438. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4439. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4440. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4441. }
  4442. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4443. var result _XML_Error
  4444. _ = result
  4445. 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))
  4446. if result == int32(_XML_ERROR_NONE) {
  4447. if !(_storeRawNames(tls, parser) != 0) {
  4448. return int32(_XML_ERROR_NO_MEMORY)
  4449. }
  4450. }
  4451. return result
  4452. }
  4453. 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) {
  4454. bp := tls.Alloc(112)
  4455. defer tls.Free(112)
  4456. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4457. 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
  4458. var bufSize, convLen, len1, n, tok int32
  4459. var charDataHandler TXML_CharacterDataHandler
  4460. var convert_res, convert_res1 _XML_Convert_Result
  4461. var noElmHandlers TXML_Bool
  4462. var result, result1, result2, result3 _XML_Error
  4463. var _ /* bindings at bp+40 */ uintptr
  4464. var _ /* buf at bp+88 */ [4]TXML_Char
  4465. var _ /* c at bp+16 */ TXML_Char
  4466. var _ /* c at bp+92 */ TXML_Char
  4467. var _ /* ch at bp+17 */ TXML_Char
  4468. var _ /* dataPtr at bp+104 */ uintptr
  4469. var _ /* dataPtr at bp+96 */ uintptr
  4470. var _ /* fromPtr at bp+32 */ uintptr
  4471. var _ /* name at bp+48 */ TTAG_NAME
  4472. var _ /* next at bp+8 */ uintptr
  4473. var _ /* toPtr at bp+24 */ uintptr
  4474. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4475. /* save one level of indirection */
  4476. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4477. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4478. eventPP = parser + 544
  4479. eventEndPP = parser + 552
  4480. } else {
  4481. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4482. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4483. }
  4484. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4485. for {
  4486. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4487. 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)
  4488. if tok == -int32(5) || tok == -int32(3) {
  4489. if haveMore != 0 {
  4490. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4491. } else {
  4492. v3 = end
  4493. }
  4494. v2 = v3
  4495. } else {
  4496. v2 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4497. }
  4498. accountAfter = v2
  4499. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4500. _accountingOnAbort(tls, parser)
  4501. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4502. }
  4503. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4504. switch tok {
  4505. case -int32(3):
  4506. if haveMore != 0 {
  4507. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4508. return int32(_XML_ERROR_NONE)
  4509. }
  4510. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4511. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4512. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  4513. (*(*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))
  4514. } else {
  4515. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4516. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4517. }
  4518. }
  4519. /* We are at the end of the final buffer, should we check for
  4520. XML_SUSPENDED, XML_FINISHED?
  4521. */
  4522. if startTagLevel == 0 {
  4523. return int32(_XML_ERROR_NO_ELEMENTS)
  4524. }
  4525. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4526. return int32(_XML_ERROR_ASYNC_ENTITY)
  4527. }
  4528. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4529. return int32(_XML_ERROR_NONE)
  4530. case -int32(4):
  4531. if haveMore != 0 {
  4532. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4533. return int32(_XML_ERROR_NONE)
  4534. }
  4535. if startTagLevel > 0 {
  4536. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4537. return int32(_XML_ERROR_ASYNC_ENTITY)
  4538. }
  4539. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4540. return int32(_XML_ERROR_NONE)
  4541. }
  4542. return int32(_XML_ERROR_NO_ELEMENTS)
  4543. case m_XML_TOK_INVALID:
  4544. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4545. return int32(_XML_ERROR_INVALID_TOKEN)
  4546. case -int32(1):
  4547. if haveMore != 0 {
  4548. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4549. return int32(_XML_ERROR_NONE)
  4550. }
  4551. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4552. case -int32(2):
  4553. if haveMore != 0 {
  4554. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4555. return int32(_XML_ERROR_NONE)
  4556. }
  4557. return int32(_XML_ERROR_PARTIAL_CHAR)
  4558. case int32(m_XML_TOK_ENTITY_REF):
  4559. *(*TXML_Char)(unsafe.Pointer(bp + 17)) = libc.Uint8FromInt32((*(*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)))
  4560. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4561. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4562. * so there is no amplification and hence recording without
  4563. * protection. */
  4564. _accountingDiffTolerated(tls, parser, tok, bp+17, bp+17+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4565. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4566. (*(*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))
  4567. } else {
  4568. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4569. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4570. }
  4571. }
  4572. break
  4573. }
  4574. 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))
  4575. if !(name != 0) {
  4576. return int32(_XML_ERROR_NO_MEMORY)
  4577. }
  4578. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4579. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4580. /* First, determine if a check for an existing declaration is needed;
  4581. if yes, check that the entity exists, and that it is internal,
  4582. otherwise call the skipped entity or default handler.
  4583. */
  4584. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4585. if !(entity != 0) {
  4586. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4587. } else {
  4588. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4589. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4590. }
  4591. }
  4592. } else {
  4593. if !(entity != 0) {
  4594. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4595. (*(*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)
  4596. } else {
  4597. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4598. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4599. }
  4600. }
  4601. break
  4602. }
  4603. }
  4604. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4605. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4606. }
  4607. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4608. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4609. }
  4610. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4611. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4612. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4613. (*(*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)
  4614. } else {
  4615. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4616. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4617. }
  4618. }
  4619. break
  4620. }
  4621. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4622. if result != int32(_XML_ERROR_NONE) {
  4623. return result
  4624. }
  4625. } else {
  4626. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4627. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4628. context = _getContext(tls, parser)
  4629. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4630. if !(context != 0) {
  4631. return int32(_XML_ERROR_NO_MEMORY)
  4632. }
  4633. 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) {
  4634. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4635. }
  4636. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4637. } else {
  4638. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4639. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4640. }
  4641. }
  4642. }
  4643. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4644. /* fall through */
  4645. fallthrough
  4646. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4647. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4648. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4649. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4650. } else {
  4651. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4652. if !(tag != 0) {
  4653. return int32(_XML_ERROR_NO_MEMORY)
  4654. }
  4655. (*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)))
  4656. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4657. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4658. return int32(_XML_ERROR_NO_MEMORY)
  4659. }
  4660. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4661. }
  4662. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4663. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4664. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4665. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4666. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4667. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4668. (*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)
  4669. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4670. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4671. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4672. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4673. for {
  4674. 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))
  4675. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4676. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4677. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4678. break
  4679. }
  4680. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4681. 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))
  4682. if temp == libc.UintptrFromInt32(0) {
  4683. return int32(_XML_ERROR_NO_MEMORY)
  4684. }
  4685. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4686. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4687. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4688. goto _4
  4689. _4:
  4690. }
  4691. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4692. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = uint8('\000')
  4693. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80, account)
  4694. if result1 != 0 {
  4695. return result1
  4696. }
  4697. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4698. (*(*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)
  4699. } else {
  4700. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4701. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4702. }
  4703. }
  4704. _poolClear(tls, parser+784)
  4705. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4706. /* fall through */
  4707. fallthrough
  4708. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4709. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4710. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4711. noElmHandlers = libc.Uint8FromInt32(1)
  4712. (*(*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)))
  4713. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4714. return int32(_XML_ERROR_NO_MEMORY)
  4715. }
  4716. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4717. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40, int32(_XML_ACCOUNT_NONE))
  4718. if result2 != int32(_XML_ERROR_NONE) {
  4719. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4720. return result2
  4721. }
  4722. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4723. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4724. (*(*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)
  4725. noElmHandlers = libc.Uint8FromInt32(0)
  4726. }
  4727. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4728. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4729. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4730. }
  4731. (*(*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)
  4732. noElmHandlers = libc.Uint8FromInt32(0)
  4733. }
  4734. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4735. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4736. }
  4737. _poolClear(tls, parser+784)
  4738. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4739. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4740. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4741. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4742. } else {
  4743. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4744. }
  4745. }
  4746. case int32(m_XML_TOK_END_TAG):
  4747. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4748. return int32(_XML_ERROR_ASYNC_ENTITY)
  4749. } else {
  4750. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4751. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4752. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4753. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4754. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4755. return int32(_XML_ERROR_TAG_MISMATCH)
  4756. }
  4757. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4758. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4759. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4760. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4761. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4762. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4763. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4764. /* localPart and prefix may have been overwritten in
  4765. tag->name.str, since this points to the binding->uri
  4766. buffer which gets re-used; so we have to add them again
  4767. */
  4768. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4769. /* don't need to check for space - already done in storeAtts() */
  4770. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4771. v5 = uri
  4772. uri++
  4773. v6 = localPart
  4774. localPart++
  4775. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  4776. }
  4777. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4778. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4779. v7 = uri
  4780. uri++
  4781. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4782. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4783. v8 = uri
  4784. uri++
  4785. v9 = prefix
  4786. prefix++
  4787. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  4788. }
  4789. }
  4790. *(*TXML_Char)(unsafe.Pointer(uri)) = uint8('\000')
  4791. }
  4792. (*(*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)
  4793. } else {
  4794. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4795. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4796. }
  4797. }
  4798. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4799. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4800. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4801. (*(*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)
  4802. }
  4803. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4804. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4805. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4806. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4807. }
  4808. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4809. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4810. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4811. } else {
  4812. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4813. }
  4814. }
  4815. }
  4816. case int32(m_XML_TOK_CHAR_REF):
  4817. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4818. if n < 0 {
  4819. return int32(_XML_ERROR_BAD_CHAR_REF)
  4820. }
  4821. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4822. (*(*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))
  4823. } else {
  4824. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4825. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4826. }
  4827. }
  4828. case int32(m_XML_TOK_XML_DECL):
  4829. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4830. case int32(m_XML_TOK_DATA_NEWLINE):
  4831. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4832. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = uint8(0xA)
  4833. (*(*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))
  4834. } else {
  4835. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4836. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4837. }
  4838. }
  4839. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4840. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4841. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4842. } else {
  4843. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4844. (*(*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)
  4845. } else {
  4846. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4847. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4848. }
  4849. }
  4850. }
  4851. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore, account)
  4852. if result3 != int32(_XML_ERROR_NONE) {
  4853. return result3
  4854. } else {
  4855. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  4856. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4857. return result3
  4858. }
  4859. }
  4860. case -int32(5):
  4861. if haveMore != 0 {
  4862. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4863. return int32(_XML_ERROR_NONE)
  4864. }
  4865. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4866. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4867. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4868. (*(*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)
  4869. (*(*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)))
  4870. } else {
  4871. (*(*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)))))
  4872. }
  4873. } else {
  4874. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4875. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4876. }
  4877. }
  4878. /* We are at the end of the final buffer, should we check for
  4879. XML_SUSPENDED, XML_FINISHED?
  4880. */
  4881. if startTagLevel == 0 {
  4882. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4883. return int32(_XML_ERROR_NO_ELEMENTS)
  4884. }
  4885. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4886. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4887. return int32(_XML_ERROR_ASYNC_ENTITY)
  4888. }
  4889. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4890. return int32(_XML_ERROR_NONE)
  4891. case int32(m_XML_TOK_DATA_CHARS):
  4892. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4893. if charDataHandler != 0 {
  4894. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4895. for {
  4896. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4897. 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)
  4898. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4899. (*(*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)))
  4900. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4901. break
  4902. }
  4903. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4904. goto _10
  4905. _10:
  4906. }
  4907. } else {
  4908. (*(*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)))))
  4909. }
  4910. } else {
  4911. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4912. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4913. }
  4914. }
  4915. case int32(m_XML_TOK_PI):
  4916. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4917. return int32(_XML_ERROR_NO_MEMORY)
  4918. }
  4919. case int32(m_XML_TOK_COMMENT):
  4920. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4921. return int32(_XML_ERROR_NO_MEMORY)
  4922. }
  4923. default:
  4924. /* All of the tokens produced by XmlContentTok() have their own
  4925. * explicit cases, so this default is not strictly necessary.
  4926. * However it is a useful safety net, so we retain the code and
  4927. * simply exclude it from the coverage tests.
  4928. *
  4929. * LCOV_EXCL_START
  4930. */
  4931. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4932. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4933. }
  4934. break
  4935. /* LCOV_EXCL_STOP */
  4936. }
  4937. v11 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4938. *(*uintptr)(unsafe.Pointer(bp)) = v11
  4939. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  4940. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4941. case int32(_XML_SUSPENDED):
  4942. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4943. return int32(_XML_ERROR_NONE)
  4944. case int32(_XML_FINISHED):
  4945. return int32(_XML_ERROR_ABORTED)
  4946. default:
  4947. }
  4948. goto _1
  4949. _1:
  4950. }
  4951. /* not reached */
  4952. return r
  4953. }
  4954. // C documentation
  4955. //
  4956. // /* This function does not call free() on the allocated memory, merely
  4957. // * moving it to the parser's m_freeBindingList where it can be freed or
  4958. // * reused as appropriate.
  4959. // */
  4960. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4961. var b uintptr
  4962. _ = b
  4963. for bindings != 0 {
  4964. b = bindings
  4965. /* m_startNamespaceDeclHandler will have been called for this
  4966. * binding in addBindings(), so call the end handler now.
  4967. */
  4968. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4969. (*(*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)
  4970. }
  4971. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4972. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4974. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4975. }
  4976. }
  4977. // C documentation
  4978. //
  4979. // /* Precondition: all arguments must be non-NULL;
  4980. // Purpose:
  4981. // - normalize attributes
  4982. // - check attributes for well-formedness
  4983. // - generate namespace aware attribute names (URI, prefix)
  4984. // - build list of attributes for startElementHandler
  4985. // - default attributes
  4986. // - process namespace declarations (check and report them)
  4987. // - generate namespace aware element name (URI, prefix)
  4988. // */
  4989. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  4990. bp := tls.Alloc(80)
  4991. defer tls.Free(80)
  4992. 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
  4993. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  4994. var c TXML_Char
  4995. var isCdata TXML_Bool
  4996. var mask, uriHash, version, v14 uint64
  4997. var nsAttsSize uint32
  4998. var oldNsAttsPower, step, v10 uint8
  4999. var result, result1, result2 _XML_Error
  5000. var _ /* sip_key at bp+56 */ Tsipkey
  5001. var _ /* sip_state at bp+0 */ Tsiphash
  5002. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5003. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5004. attIndex = 0
  5005. nPrefixes = 0
  5006. /* lookup the element type name */
  5007. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  5008. if !(elementType != 0) {
  5009. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5010. if !(name != 0) {
  5011. return int32(_XML_ERROR_NO_MEMORY)
  5012. }
  5013. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  5014. if !(elementType != 0) {
  5015. return int32(_XML_ERROR_NO_MEMORY)
  5016. }
  5017. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5018. return int32(_XML_ERROR_NO_MEMORY)
  5019. }
  5020. }
  5021. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5022. /* get the attributes from the tokenizer */
  5023. 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)
  5024. /* Detect and prevent integer overflow */
  5025. if n > int32(m_INT_MAX)-nDefaultAtts {
  5026. return int32(_XML_ERROR_NO_MEMORY)
  5027. }
  5028. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5029. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5030. /* Detect and prevent integer overflow */
  5031. if nDefaultAtts > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m_INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5032. return int32(_XML_ERROR_NO_MEMORY)
  5033. }
  5034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5035. /* Detect and prevent integer overflow.
  5036. * The preprocessor guard addresses the "always false" warning
  5037. * from -Wtype-limits on platforms where
  5038. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5039. 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))
  5040. if temp == libc.UintptrFromInt32(0) {
  5041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5042. return int32(_XML_ERROR_NO_MEMORY)
  5043. }
  5044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5045. if n > oldAttsSize {
  5046. (*(*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)
  5047. }
  5048. }
  5049. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5050. i = 0
  5051. for {
  5052. if !(i < n) {
  5053. break
  5054. }
  5055. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  5056. /* add the name and value to the attribute list */
  5057. 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)))
  5058. if !(attId != 0) {
  5059. return int32(_XML_ERROR_NO_MEMORY)
  5060. }
  5061. /* Detect duplicate attributes by their QNames. This does not work when
  5062. namespace processing is turned on and different prefixes for the same
  5063. namespace are used. For this case we have a check further down.
  5064. */
  5065. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5066. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  5068. }
  5069. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5070. }
  5071. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5072. v2 = attIndex
  5073. attIndex++
  5074. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5075. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  5076. isCdata = libc.Uint8FromInt32(1)
  5077. /* figure out whether declared as other than CDATA */
  5078. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5079. j = 0
  5080. for {
  5081. if !(j < nDefaultAtts) {
  5082. break
  5083. }
  5084. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  5085. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  5086. break
  5087. }
  5088. goto _3
  5089. _3:
  5090. ;
  5091. j++
  5092. }
  5093. }
  5094. /* normalize the attribute value */
  5095. 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)
  5096. if result != 0 {
  5097. return result
  5098. }
  5099. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5100. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5101. } else {
  5102. /* the value did not need normalizing */
  5103. *(*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)
  5104. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  5105. return int32(_XML_ERROR_NO_MEMORY)
  5106. }
  5107. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5108. }
  5109. /* handle prefixed attribute names */
  5110. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5111. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5112. /* deal with namespace declarations here */
  5113. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  5114. if result1 != 0 {
  5115. return result1
  5116. }
  5117. attIndex--
  5118. } else {
  5119. /* deal with other prefixed names later */
  5120. attIndex++
  5121. nPrefixes++
  5122. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5123. }
  5124. } else {
  5125. attIndex++
  5126. }
  5127. goto _1
  5128. _1:
  5129. ;
  5130. i++
  5131. }
  5132. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5133. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5134. 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 {
  5135. i = 0
  5136. for {
  5137. if !(i < attIndex) {
  5138. break
  5139. }
  5140. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5141. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5142. break
  5143. }
  5144. goto _4
  5145. _4:
  5146. ;
  5147. i += int32(2)
  5148. }
  5149. } else {
  5150. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5151. }
  5152. /* do attribute defaulting */
  5153. i = 0
  5154. for {
  5155. if !(i < nDefaultAtts) {
  5156. break
  5157. }
  5158. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5159. 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 {
  5160. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5161. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5162. 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)
  5163. if result2 != 0 {
  5164. return result2
  5165. }
  5166. } else {
  5167. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5168. nPrefixes++
  5169. v6 = attIndex
  5170. attIndex++
  5171. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5172. v7 = attIndex
  5173. attIndex++
  5174. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5175. }
  5176. } else {
  5177. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5178. v8 = attIndex
  5179. attIndex++
  5180. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5181. v9 = attIndex
  5182. attIndex++
  5183. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5184. }
  5185. }
  5186. goto _5
  5187. _5:
  5188. ;
  5189. i++
  5190. }
  5191. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5192. /* expand prefixed attribute names, check for duplicates,
  5193. and clear flags that say whether attributes were specified */
  5194. i = 0
  5195. if nPrefixes != 0 { /* hash table index */
  5196. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5197. /* Detect and prevent invalid shift */
  5198. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5199. return int32(_XML_ERROR_NO_MEMORY)
  5200. }
  5201. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5202. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5203. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5204. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5205. /* hash table size must also be a power of 2 and >= 8 */
  5206. for {
  5207. v11 = parser + 760
  5208. v10 = *(*uint8)(unsafe.Pointer(v11))
  5209. *(*uint8)(unsafe.Pointer(v11))++
  5210. if !(nPrefixes>>v10 != 0) {
  5211. break
  5212. }
  5213. }
  5214. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5215. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5216. }
  5217. /* Detect and prevent invalid shift */
  5218. if uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint64FromInt64(4)*libc.Uint64FromInt32(8) {
  5219. /* Restore actual size of memory in m_nsAtts */
  5220. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5221. return int32(_XML_ERROR_NO_MEMORY)
  5222. }
  5223. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5224. /* Detect and prevent integer overflow.
  5225. * The preprocessor guard addresses the "always false" warning
  5226. * from -Wtype-limits on platforms where
  5227. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5228. 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))
  5229. if !(temp1 != 0) {
  5230. /* Restore actual size of memory in m_nsAtts */
  5231. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5232. return int32(_XML_ERROR_NO_MEMORY)
  5233. }
  5234. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5235. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5236. }
  5237. /* using a version flag saves us from initializing m_nsAtts every time */
  5238. if !(version != 0) { /* initialize version flags when version wraps around */
  5239. version = uint64(m_INIT_ATTS_VERSION)
  5240. j1 = libc.Int32FromUint32(nsAttsSize)
  5241. for {
  5242. if !(j1 != 0) {
  5243. break
  5244. }
  5245. j1--
  5246. v13 = j1
  5247. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5248. goto _12
  5249. _12:
  5250. }
  5251. }
  5252. version--
  5253. v14 = version
  5254. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5255. /* expand prefixed names and check for duplicates */
  5256. for {
  5257. if !(i < attIndex) {
  5258. break
  5259. }
  5260. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5261. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5262. _copy_salt_to_sipkey(tls, parser, bp+56)
  5263. _sip24_init(tls, bp, bp+56)
  5264. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0) /* clear flag */
  5265. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5266. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5267. /* This code is walking through the appAtts array, dealing
  5268. * with (in this case) a prefixed attribute name. To be in
  5269. * the array, the attribute must have already been bound, so
  5270. * has to have passed through the hash table lookup once
  5271. * already. That implies that an entry for it already
  5272. * exists, so the lookup above will return a pointer to
  5273. * already allocated memory. There is no opportunaity for
  5274. * the allocator to fail, so the condition above cannot be
  5275. * fulfilled.
  5276. *
  5277. * Since it is difficult to be certain that the above
  5278. * analysis is complete, we retain the test and merely
  5279. * remove the code from coverage tests.
  5280. */
  5281. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5282. }
  5283. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5284. if !(b != 0) {
  5285. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5286. }
  5287. j1 = 0
  5288. for {
  5289. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5290. break
  5291. }
  5292. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5293. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5294. v17 = 0
  5295. } else {
  5296. v19 = parser + 784 + 24
  5297. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5298. *(*uintptr)(unsafe.Pointer(v19))++
  5299. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5300. v17 = libc.Int32FromInt32(1)
  5301. }
  5302. if !(v17 != 0) {
  5303. return int32(_XML_ERROR_NO_MEMORY)
  5304. }
  5305. goto _16
  5306. _16:
  5307. ;
  5308. j1++
  5309. }
  5310. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5311. for {
  5312. v20 = s
  5313. s++
  5314. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5315. break
  5316. }
  5317. }
  5318. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5319. for { /* copies null terminator */
  5320. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5321. v23 = 0
  5322. } else {
  5323. v25 = parser + 784 + 24
  5324. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5325. *(*uintptr)(unsafe.Pointer(v25))++
  5326. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5327. v23 = libc.Int32FromInt32(1)
  5328. }
  5329. if !(v23 != 0) {
  5330. return int32(_XML_ERROR_NO_MEMORY)
  5331. }
  5332. goto _22
  5333. _22:
  5334. ;
  5335. v21 = s
  5336. s++
  5337. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5338. break
  5339. }
  5340. }
  5341. uriHash = _sip24_final(tls, bp)
  5342. /* Check hash table for duplicate of expanded name (uriName).
  5343. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5344. */
  5345. step = uint8(0)
  5346. mask = uint64(nsAttsSize - uint32(1))
  5347. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5348. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5349. /* for speed we compare stored hash values first */
  5350. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5351. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5352. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5353. /* s1 is null terminated, but not s2 */
  5354. for {
  5355. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2))) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5356. break
  5357. }
  5358. goto _26
  5359. _26:
  5360. ;
  5361. s1++
  5362. s2++
  5363. }
  5364. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5365. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5366. }
  5367. }
  5368. if !(step != 0) {
  5369. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5370. }
  5371. if j1 < libc.Int32FromUint8(step) {
  5372. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5373. } else {
  5374. j1 -= libc.Int32FromUint8(step)
  5375. }
  5376. }
  5377. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5378. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5379. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5380. for {
  5381. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5382. v30 = 0
  5383. } else {
  5384. v32 = parser + 784 + 24
  5385. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5386. *(*uintptr)(unsafe.Pointer(v32))++
  5387. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5388. v30 = libc.Int32FromInt32(1)
  5389. }
  5390. if !(v30 != 0) {
  5391. return int32(_XML_ERROR_NO_MEMORY)
  5392. }
  5393. goto _29
  5394. _29:
  5395. ;
  5396. v28 = s
  5397. s++
  5398. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5399. break
  5400. }
  5401. }
  5402. }
  5403. /* store expanded name in attribute list */
  5404. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5405. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5406. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5407. /* fill empty slot with new version, uriName and hash value */
  5408. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5409. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5410. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5411. nPrefixes--
  5412. v33 = nPrefixes
  5413. if !(v33 != 0) {
  5414. i += int32(2)
  5415. break
  5416. }
  5417. } else { /* not prefixed */
  5418. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5419. } /* clear flag */
  5420. goto _15
  5421. _15:
  5422. ;
  5423. i += int32(2)
  5424. }
  5425. }
  5426. /* clear flags for the remaining attributes */
  5427. for {
  5428. if !(i < attIndex) {
  5429. break
  5430. }
  5431. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5432. goto _34
  5433. _34:
  5434. ;
  5435. i += int32(2)
  5436. }
  5437. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5438. for {
  5439. if !(binding != 0) {
  5440. break
  5441. }
  5442. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5443. goto _35
  5444. _35:
  5445. ;
  5446. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5447. }
  5448. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5449. return int32(_XML_ERROR_NONE)
  5450. }
  5451. /* expand the element type name */
  5452. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5453. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5454. if !(binding != 0) {
  5455. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5456. }
  5457. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5458. for {
  5459. v36 = localPart
  5460. localPart++
  5461. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5462. break
  5463. }
  5464. }
  5465. } else {
  5466. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5467. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5468. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5469. } else {
  5470. return int32(_XML_ERROR_NONE)
  5471. }
  5472. }
  5473. prefixLen = 0
  5474. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5475. for {
  5476. v38 = prefixLen
  5477. prefixLen++
  5478. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5479. break
  5480. }
  5481. goto _37
  5482. _37:
  5483. } /* prefixLen includes null terminator */
  5484. }
  5485. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5486. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5487. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5488. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5489. i = 0
  5490. for {
  5491. v40 = i
  5492. i++
  5493. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5494. break
  5495. }
  5496. goto _39
  5497. _39:
  5498. } /* i includes null terminator */
  5499. /* Detect and prevent integer overflow */
  5500. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m_INT_MAX)-prefixLen || i > int32(m_INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5501. return int32(_XML_ERROR_NO_MEMORY)
  5502. }
  5503. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5504. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5505. /* Detect and prevent integer overflow */
  5506. if n > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5507. return int32(_XML_ERROR_NO_MEMORY)
  5508. }
  5509. /* Detect and prevent integer overflow.
  5510. * The preprocessor guard addresses the "always false" warning
  5511. * from -Wtype-limits on platforms where
  5512. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5513. 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))
  5514. if !(uri != 0) {
  5515. return int32(_XML_ERROR_NO_MEMORY)
  5516. }
  5517. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5518. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5519. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5520. for {
  5521. if !(p != 0) {
  5522. break
  5523. }
  5524. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5525. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5526. }
  5527. goto _41
  5528. _41:
  5529. ;
  5530. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5531. }
  5532. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5533. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5534. }
  5535. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5536. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5537. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5538. /* we always have a namespace separator between localPart and prefix */
  5539. if prefixLen != 0 {
  5540. uri += uintptr(i - int32(1))
  5541. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5542. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5543. }
  5544. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5545. return int32(_XML_ERROR_NONE)
  5546. }
  5547. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5548. // For the RFC 3986 ANBF grammar see
  5549. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5550. switch libc.Int32FromUint8(candidate) {
  5551. // From rule "ALPHA" (uppercase half)
  5552. case int32('A'):
  5553. fallthrough
  5554. case int32('B'):
  5555. fallthrough
  5556. case int32('C'):
  5557. fallthrough
  5558. case int32('D'):
  5559. fallthrough
  5560. case int32('E'):
  5561. fallthrough
  5562. case int32('F'):
  5563. fallthrough
  5564. case int32('G'):
  5565. fallthrough
  5566. case int32('H'):
  5567. fallthrough
  5568. case int32('I'):
  5569. fallthrough
  5570. case int32('J'):
  5571. fallthrough
  5572. case int32('K'):
  5573. fallthrough
  5574. case int32('L'):
  5575. fallthrough
  5576. case int32('M'):
  5577. fallthrough
  5578. case int32('N'):
  5579. fallthrough
  5580. case int32('O'):
  5581. fallthrough
  5582. case int32('P'):
  5583. fallthrough
  5584. case int32('Q'):
  5585. fallthrough
  5586. case int32('R'):
  5587. fallthrough
  5588. case int32('S'):
  5589. fallthrough
  5590. case int32('T'):
  5591. fallthrough
  5592. case int32('U'):
  5593. fallthrough
  5594. case int32('V'):
  5595. fallthrough
  5596. case int32('W'):
  5597. fallthrough
  5598. case int32('X'):
  5599. fallthrough
  5600. case int32('Y'):
  5601. fallthrough
  5602. case int32('Z'):
  5603. // From rule "ALPHA" (lowercase half)
  5604. fallthrough
  5605. case int32('a'):
  5606. fallthrough
  5607. case int32('b'):
  5608. fallthrough
  5609. case int32('c'):
  5610. fallthrough
  5611. case int32('d'):
  5612. fallthrough
  5613. case int32('e'):
  5614. fallthrough
  5615. case int32('f'):
  5616. fallthrough
  5617. case int32('g'):
  5618. fallthrough
  5619. case int32('h'):
  5620. fallthrough
  5621. case int32('i'):
  5622. fallthrough
  5623. case int32('j'):
  5624. fallthrough
  5625. case int32('k'):
  5626. fallthrough
  5627. case int32('l'):
  5628. fallthrough
  5629. case int32('m'):
  5630. fallthrough
  5631. case int32('n'):
  5632. fallthrough
  5633. case int32('o'):
  5634. fallthrough
  5635. case int32('p'):
  5636. fallthrough
  5637. case int32('q'):
  5638. fallthrough
  5639. case int32('r'):
  5640. fallthrough
  5641. case int32('s'):
  5642. fallthrough
  5643. case int32('t'):
  5644. fallthrough
  5645. case int32('u'):
  5646. fallthrough
  5647. case int32('v'):
  5648. fallthrough
  5649. case int32('w'):
  5650. fallthrough
  5651. case int32('x'):
  5652. fallthrough
  5653. case int32('y'):
  5654. fallthrough
  5655. case int32('z'):
  5656. // From rule "DIGIT"
  5657. fallthrough
  5658. case int32('0'):
  5659. fallthrough
  5660. case int32('1'):
  5661. fallthrough
  5662. case int32('2'):
  5663. fallthrough
  5664. case int32('3'):
  5665. fallthrough
  5666. case int32('4'):
  5667. fallthrough
  5668. case int32('5'):
  5669. fallthrough
  5670. case int32('6'):
  5671. fallthrough
  5672. case int32('7'):
  5673. fallthrough
  5674. case int32('8'):
  5675. fallthrough
  5676. case int32('9'):
  5677. // From rule "pct-encoded"
  5678. fallthrough
  5679. case int32('%'):
  5680. // From rule "unreserved"
  5681. fallthrough
  5682. case int32('-'):
  5683. fallthrough
  5684. case int32('.'):
  5685. fallthrough
  5686. case int32('_'):
  5687. fallthrough
  5688. case int32('~'):
  5689. // From rule "gen-delims"
  5690. fallthrough
  5691. case int32(':'):
  5692. fallthrough
  5693. case int32('/'):
  5694. fallthrough
  5695. case int32('?'):
  5696. fallthrough
  5697. case int32('#'):
  5698. fallthrough
  5699. case int32('['):
  5700. fallthrough
  5701. case int32(']'):
  5702. fallthrough
  5703. case int32('@'):
  5704. // From rule "sub-delims"
  5705. fallthrough
  5706. case int32('!'):
  5707. fallthrough
  5708. case int32('$'):
  5709. fallthrough
  5710. case int32('&'):
  5711. fallthrough
  5712. case int32('\''):
  5713. fallthrough
  5714. case int32('('):
  5715. fallthrough
  5716. case int32(')'):
  5717. fallthrough
  5718. case int32('*'):
  5719. fallthrough
  5720. case int32('+'):
  5721. fallthrough
  5722. case int32(','):
  5723. fallthrough
  5724. case int32(';'):
  5725. fallthrough
  5726. case int32('='):
  5727. return libc.Uint8FromInt32(1)
  5728. default:
  5729. return libc.Uint8FromInt32(0)
  5730. }
  5731. return r
  5732. }
  5733. // C documentation
  5734. //
  5735. // /* addBinding() overwrites the value of prefix->binding without checking.
  5736. // Therefore one must keep track of the old value outside of addBinding().
  5737. // */
  5738. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5739. var b, temp, v3 uintptr
  5740. var isXML, isXMLNS, mustBeXML TXML_Bool
  5741. var len1, v2 int32
  5742. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5743. mustBeXML = libc.Uint8FromInt32(0)
  5744. isXML = libc.Uint8FromInt32(1)
  5745. isXMLNS = libc.Uint8FromInt32(1)
  5746. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5747. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5748. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5749. }
  5750. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5751. /* Not allowed to bind xmlns */
  5752. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5753. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5754. }
  5755. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5756. mustBeXML = libc.Uint8FromInt32(1)
  5757. }
  5758. }
  5759. len1 = 0
  5760. for {
  5761. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5762. break
  5763. }
  5764. if isXML != 0 && (len1 > _xmlLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlNamespace[len1])) {
  5765. isXML = libc.Uint8FromInt32(0)
  5766. }
  5767. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlnsNamespace[len1])) {
  5768. isXMLNS = libc.Uint8FromInt32(0)
  5769. }
  5770. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5771. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5772. // namespaces specification) we have to at least make sure, that
  5773. // the application on top of Expat (that is likely splitting expanded
  5774. // element names ("qualified names") of form
  5775. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  5776. // in its element handler code) cannot be confused by an attacker
  5777. // putting additional namespace separator characters into namespace
  5778. // declarations. That would be ambiguous and not to be expected.
  5779. //
  5780. // While the HTML API docs of function XML_ParserCreateNS have been
  5781. // advising against use of a namespace separator character that can
  5782. // appear in a URI for >20 years now, some widespread applications
  5783. // are using URI characters (':' (colon) in particular) for a
  5784. // namespace separator, in practice. To keep these applications
  5785. // functional, we only reject namespaces URIs containing the
  5786. // application-chosen namespace separator if the chosen separator
  5787. // is a non-URI character with regard to RFC 3986.
  5788. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  5789. return int32(_XML_ERROR_SYNTAX)
  5790. }
  5791. goto _1
  5792. _1:
  5793. ;
  5794. len1++
  5795. }
  5796. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5797. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5798. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5799. if mustBeXML != 0 {
  5800. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5801. } else {
  5802. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5803. }
  5804. return v2
  5805. }
  5806. if isXMLNS != 0 {
  5807. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5808. }
  5809. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5810. len1++
  5811. }
  5812. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5813. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5814. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5815. /* Detect and prevent integer overflow */
  5816. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5817. return int32(_XML_ERROR_NO_MEMORY)
  5818. }
  5819. /* Detect and prevent integer overflow.
  5820. * The preprocessor guard addresses the "always false" warning
  5821. * from -Wtype-limits on platforms where
  5822. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5823. 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)))
  5824. if temp == libc.UintptrFromInt32(0) {
  5825. return int32(_XML_ERROR_NO_MEMORY)
  5826. }
  5827. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5828. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5829. }
  5830. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5831. } else {
  5832. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  5833. if !(b != 0) {
  5834. return int32(_XML_ERROR_NO_MEMORY)
  5835. }
  5836. /* Detect and prevent integer overflow */
  5837. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5838. return int32(_XML_ERROR_NO_MEMORY)
  5839. }
  5840. /* Detect and prevent integer overflow.
  5841. * The preprocessor guard addresses the "always false" warning
  5842. * from -Wtype-limits on platforms where
  5843. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5844. (*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)))
  5845. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5846. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5847. return int32(_XML_ERROR_NO_MEMORY)
  5848. }
  5849. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5850. }
  5851. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5852. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  5853. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5854. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5855. }
  5856. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5857. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5858. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5859. /* NULL binding when default namespace undeclared */
  5860. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  5861. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5862. } else {
  5863. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5864. }
  5865. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5866. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5867. /* if attId == NULL then we are not starting a namespace scope */
  5868. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5869. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5870. v3 = uri
  5871. } else {
  5872. v3 = uintptr(0)
  5873. }
  5874. (*(*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)
  5875. }
  5876. return int32(_XML_ERROR_NONE)
  5877. }
  5878. // "http://www.w3.org/XML/1998/namespace"
  5879. var _xmlNamespace = [37]TXML_Char{
  5880. 0: uint8(m_ASCII_h),
  5881. 1: uint8(m_ASCII_t),
  5882. 2: uint8(m_ASCII_t),
  5883. 3: uint8(m_ASCII_p),
  5884. 4: uint8(m_ASCII_COLON),
  5885. 5: uint8(m_ASCII_SLASH),
  5886. 6: uint8(m_ASCII_SLASH),
  5887. 7: uint8(m_ASCII_w),
  5888. 8: uint8(m_ASCII_w),
  5889. 9: uint8(m_ASCII_w),
  5890. 10: uint8(m_ASCII_PERIOD),
  5891. 11: uint8(m_ASCII_w),
  5892. 12: uint8(m_ASCII_3),
  5893. 13: uint8(m_ASCII_PERIOD),
  5894. 14: uint8(m_ASCII_o),
  5895. 15: uint8(m_ASCII_r),
  5896. 16: uint8(m_ASCII_g),
  5897. 17: uint8(m_ASCII_SLASH),
  5898. 18: uint8(m_ASCII_X),
  5899. 19: uint8(m_ASCII_M),
  5900. 20: uint8(m_ASCII_L),
  5901. 21: uint8(m_ASCII_SLASH),
  5902. 22: uint8(m_ASCII_1),
  5903. 23: uint8(m_ASCII_9),
  5904. 24: uint8(m_ASCII_9),
  5905. 25: uint8(m_ASCII_8),
  5906. 26: uint8(m_ASCII_SLASH),
  5907. 27: uint8(m_ASCII_n),
  5908. 28: uint8(m_ASCII_a),
  5909. 29: uint8(m_ASCII_m),
  5910. 30: uint8(m_ASCII_e),
  5911. 31: uint8(m_ASCII_s),
  5912. 32: uint8(m_ASCII_p),
  5913. 33: uint8(m_ASCII_a),
  5914. 34: uint8(m_ASCII_c),
  5915. 35: uint8(m_ASCII_e),
  5916. }
  5917. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5918. // "http://www.w3.org/2000/xmlns/"
  5919. var _xmlnsNamespace = [30]TXML_Char{
  5920. 0: uint8(m_ASCII_h),
  5921. 1: uint8(m_ASCII_t),
  5922. 2: uint8(m_ASCII_t),
  5923. 3: uint8(m_ASCII_p),
  5924. 4: uint8(m_ASCII_COLON),
  5925. 5: uint8(m_ASCII_SLASH),
  5926. 6: uint8(m_ASCII_SLASH),
  5927. 7: uint8(m_ASCII_w),
  5928. 8: uint8(m_ASCII_w),
  5929. 9: uint8(m_ASCII_w),
  5930. 10: uint8(m_ASCII_PERIOD),
  5931. 11: uint8(m_ASCII_w),
  5932. 12: uint8(m_ASCII_3),
  5933. 13: uint8(m_ASCII_PERIOD),
  5934. 14: uint8(m_ASCII_o),
  5935. 15: uint8(m_ASCII_r),
  5936. 16: uint8(m_ASCII_g),
  5937. 17: uint8(m_ASCII_SLASH),
  5938. 18: uint8(m_ASCII_2),
  5939. 19: uint8(m_ASCII_0),
  5940. 20: uint8(m_ASCII_0),
  5941. 21: uint8(m_ASCII_0),
  5942. 22: uint8(m_ASCII_SLASH),
  5943. 23: uint8(m_ASCII_x),
  5944. 24: uint8(m_ASCII_m),
  5945. 25: uint8(m_ASCII_l),
  5946. 26: uint8(m_ASCII_n),
  5947. 27: uint8(m_ASCII_s),
  5948. 28: uint8(m_ASCII_SLASH),
  5949. }
  5950. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5951. // C documentation
  5952. //
  5953. // /* The idea here is to avoid using stack for each CDATA section when
  5954. // the whole file is parsed with one call.
  5955. // */
  5956. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5957. bp := tls.Alloc(16)
  5958. defer tls.Free(16)
  5959. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5960. var result _XML_Error
  5961. _ = result
  5962. 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))
  5963. if result != int32(_XML_ERROR_NONE) {
  5964. return result
  5965. }
  5966. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5967. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  5968. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  5969. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5970. } else {
  5971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  5972. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5973. }
  5974. }
  5975. return result
  5976. }
  5977. // C documentation
  5978. //
  5979. // /* startPtr gets set to non-null if the section is closed, and to null if
  5980. // the section is not yet closed.
  5981. // */
  5982. 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) {
  5983. bp := tls.Alloc(32)
  5984. defer tls.Free(32)
  5985. var charDataHandler TXML_CharacterDataHandler
  5986. var convert_res _XML_Convert_Result
  5987. var eventEndPP, eventPP, v3 uintptr
  5988. var tok int32
  5989. var _ /* c at bp+16 */ TXML_Char
  5990. var _ /* dataPtr at bp+24 */ uintptr
  5991. var _ /* next at bp+8 */ uintptr
  5992. var _ /* s at bp+0 */ uintptr
  5993. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  5994. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  5995. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5996. eventPP = parser + 544
  5997. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5998. eventEndPP = parser + 552
  5999. } else {
  6000. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6001. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6002. }
  6003. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6004. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6005. for {
  6006. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6007. 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)
  6008. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)), int32(4044), account) != 0) {
  6009. _accountingOnAbort(tls, parser)
  6010. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6011. }
  6012. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6013. switch tok {
  6014. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6015. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6016. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6017. } else {
  6018. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6019. (*(*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)
  6020. } else {
  6021. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6022. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6023. }
  6024. }
  6025. }
  6026. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6027. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6028. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6029. return int32(_XML_ERROR_ABORTED)
  6030. } else {
  6031. return int32(_XML_ERROR_NONE)
  6032. }
  6033. fallthrough
  6034. case int32(m_XML_TOK_DATA_NEWLINE):
  6035. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6036. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  6037. (*(*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))
  6038. } else {
  6039. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6040. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6041. }
  6042. }
  6043. case int32(m_XML_TOK_DATA_CHARS):
  6044. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6045. if charDataHandler != 0 {
  6046. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6047. for {
  6048. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6049. 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)
  6050. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6051. (*(*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)))
  6052. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6053. break
  6054. }
  6055. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6056. goto _2
  6057. _2:
  6058. }
  6059. } else {
  6060. (*(*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)))))
  6061. }
  6062. } else {
  6063. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6064. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  6065. }
  6066. }
  6067. case m_XML_TOK_INVALID:
  6068. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6069. return int32(_XML_ERROR_INVALID_TOKEN)
  6070. case -int32(2):
  6071. if haveMore != 0 {
  6072. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6073. return int32(_XML_ERROR_NONE)
  6074. }
  6075. return int32(_XML_ERROR_PARTIAL_CHAR)
  6076. case -int32(1):
  6077. fallthrough
  6078. case -int32(4):
  6079. if haveMore != 0 {
  6080. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6081. return int32(_XML_ERROR_NONE)
  6082. }
  6083. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6084. default:
  6085. /* Every token returned by XmlCdataSectionTok() has its own
  6086. * explicit case, so this default case will never be executed.
  6087. * We retain it as a safety net and exclude it from the coverage
  6088. * statistics.
  6089. *
  6090. * LCOV_EXCL_START
  6091. */
  6092. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6093. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6094. /* LCOV_EXCL_STOP */
  6095. }
  6096. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  6097. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6098. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6099. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6100. case int32(_XML_SUSPENDED):
  6101. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  6102. return int32(_XML_ERROR_NONE)
  6103. case int32(_XML_FINISHED):
  6104. return int32(_XML_ERROR_ABORTED)
  6105. default:
  6106. }
  6107. goto _1
  6108. _1:
  6109. }
  6110. /* not reached */
  6111. return r
  6112. }
  6113. // C documentation
  6114. //
  6115. // /* The idea here is to avoid using stack for each IGNORE section when
  6116. // the whole file is parsed with one call.
  6117. // */
  6118. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6119. bp := tls.Alloc(16)
  6120. defer tls.Free(16)
  6121. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6122. var result _XML_Error
  6123. _ = result
  6124. 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)))
  6125. if result != int32(_XML_ERROR_NONE) {
  6126. return result
  6127. }
  6128. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6129. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6130. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6131. }
  6132. return result
  6133. }
  6134. // C documentation
  6135. //
  6136. // /* startPtr gets set to non-null is the section is closed, and to null
  6137. // if the section is not yet closed.
  6138. // */
  6139. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6140. bp := tls.Alloc(16)
  6141. defer tls.Free(16)
  6142. var eventEndPP, eventPP, s uintptr
  6143. var tok int32
  6144. var _ /* next at bp+0 */ uintptr
  6145. _, _, _, _ = eventEndPP, eventPP, s, tok
  6146. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6147. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6148. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6149. eventPP = parser + 544
  6150. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6151. eventEndPP = parser + 552
  6152. } else {
  6153. /* It's not entirely clear, but it seems the following two lines
  6154. * of code cannot be executed. The only occasions on which 'enc'
  6155. * is not 'encoding' are when this function is called
  6156. * from the internal entity processing, and IGNORE sections are an
  6157. * error in internal entities.
  6158. *
  6159. * Since it really isn't clear that this is true, we keep the code
  6160. * and just remove it from our coverage tests.
  6161. *
  6162. * LCOV_EXCL_START
  6163. */
  6164. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6165. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6166. /* LCOV_EXCL_STOP */
  6167. }
  6168. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6169. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6170. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  6171. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6172. _accountingOnAbort(tls, parser)
  6173. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6174. }
  6175. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6176. switch tok {
  6177. case int32(m_XML_TOK_IGNORE_SECT):
  6178. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6179. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6180. }
  6181. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6182. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6183. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6184. return int32(_XML_ERROR_ABORTED)
  6185. } else {
  6186. return int32(_XML_ERROR_NONE)
  6187. }
  6188. fallthrough
  6189. case m_XML_TOK_INVALID:
  6190. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6191. return int32(_XML_ERROR_INVALID_TOKEN)
  6192. case -int32(2):
  6193. if haveMore != 0 {
  6194. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6195. return int32(_XML_ERROR_NONE)
  6196. }
  6197. return int32(_XML_ERROR_PARTIAL_CHAR)
  6198. case -int32(1):
  6199. fallthrough
  6200. case -int32(4):
  6201. if haveMore != 0 {
  6202. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6203. return int32(_XML_ERROR_NONE)
  6204. }
  6205. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6206. default:
  6207. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6208. * explicit cases to handle them, so this default case is never
  6209. * executed. We keep it as a safety net anyway, and remove it
  6210. * from our test coverage statistics.
  6211. *
  6212. * LCOV_EXCL_START
  6213. */
  6214. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6215. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6216. /* LCOV_EXCL_STOP */
  6217. }
  6218. /* not reached */
  6219. return r
  6220. }
  6221. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6222. var s uintptr
  6223. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6224. _, _ = s, v1
  6225. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6226. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6227. v1 = XXmlInitEncodingNS
  6228. } else {
  6229. v1 = XXmlInitEncoding
  6230. }
  6231. if v1(tls, parser+296, parser+288, s) != 0 {
  6232. return int32(_XML_ERROR_NONE)
  6233. }
  6234. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6235. }
  6236. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6237. bp := tls.Alloc(48)
  6238. defer tls.Free(48)
  6239. var result _XML_Error
  6240. var storedEncName, storedversion uintptr
  6241. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6242. var _ /* encodingName at bp+0 */ uintptr
  6243. var _ /* newEncoding at bp+8 */ uintptr
  6244. var _ /* standalone at bp+32 */ int32
  6245. var _ /* version at bp+16 */ uintptr
  6246. var _ /* versionend at bp+24 */ uintptr
  6247. _, _, _, _ = result, storedEncName, storedversion, v1
  6248. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6249. storedEncName = libc.UintptrFromInt32(0)
  6250. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6251. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  6252. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  6253. storedversion = libc.UintptrFromInt32(0)
  6254. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  6255. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6256. _accountingOnAbort(tls, parser)
  6257. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6258. }
  6259. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6260. v1 = XXmlParseXmlDeclNS
  6261. } else {
  6262. v1 = XXmlParseXmlDecl
  6263. }
  6264. 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) {
  6265. if isGeneralTextEntity != 0 {
  6266. return int32(_XML_ERROR_TEXT_DECL)
  6267. } else {
  6268. return int32(_XML_ERROR_XML_DECL)
  6269. }
  6270. }
  6271. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  6272. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6273. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6274. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6275. }
  6276. }
  6277. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6278. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6279. 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)))))
  6280. if !(storedEncName != 0) {
  6281. return int32(_XML_ERROR_NO_MEMORY)
  6282. }
  6283. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  6284. }
  6285. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  6286. 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))
  6287. if !(storedversion != 0) {
  6288. return int32(_XML_ERROR_NO_MEMORY)
  6289. }
  6290. }
  6291. (*(*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)))
  6292. } else {
  6293. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6294. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6295. }
  6296. }
  6297. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6298. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6299. /* Check that the specified encoding does not conflict with what
  6300. * the parser has already deduced. Do we have the same number
  6301. * of bytes in the smallest representation of a character? If
  6302. * this is UTF-16, is it the same endianness?
  6303. */
  6304. 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 {
  6305. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6306. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6307. }
  6308. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  6309. } else {
  6310. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6311. if !(storedEncName != 0) {
  6312. 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)))))
  6313. if !(storedEncName != 0) {
  6314. return int32(_XML_ERROR_NO_MEMORY)
  6315. }
  6316. }
  6317. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6318. _poolClear(tls, parser+832)
  6319. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6320. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6321. }
  6322. return result
  6323. }
  6324. }
  6325. }
  6326. if storedEncName != 0 || storedversion != 0 {
  6327. _poolClear(tls, parser+832)
  6328. }
  6329. return int32(_XML_ERROR_NONE)
  6330. }
  6331. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6332. bp := tls.Alloc(1056)
  6333. defer tls.Free(1056)
  6334. var enc uintptr
  6335. var i int32
  6336. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6337. var _ /* info at bp+0 */ TXML_Encoding
  6338. _, _, _ = enc, i, v2
  6339. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6340. i = 0
  6341. for {
  6342. if !(i < int32(256)) {
  6343. break
  6344. }
  6345. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6346. goto _1
  6347. _1:
  6348. ;
  6349. i++
  6350. }
  6351. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6352. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6353. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6354. 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 {
  6355. (*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)))
  6356. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6357. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6358. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6359. }
  6360. return int32(_XML_ERROR_NO_MEMORY)
  6361. }
  6362. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6363. v2 = XXmlInitUnknownEncodingNS
  6364. } else {
  6365. v2 = XXmlInitUnknownEncoding
  6366. }
  6367. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6368. if enc != 0 {
  6369. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6370. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6371. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6372. return int32(_XML_ERROR_NONE)
  6373. }
  6374. }
  6375. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6376. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6377. }
  6378. }
  6379. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6380. }
  6381. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6382. var result _XML_Error
  6383. _ = result
  6384. result = _initializeEncoding(tls, parser)
  6385. if result != int32(_XML_ERROR_NONE) {
  6386. return result
  6387. }
  6388. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6389. return _prologProcessor(tls, parser, s, end, nextPtr)
  6390. }
  6391. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6392. var result _XML_Error
  6393. _ = result
  6394. result = _initializeEncoding(tls, parser)
  6395. if result != int32(_XML_ERROR_NONE) {
  6396. return result
  6397. }
  6398. /* we know now that XML_Parse(Buffer) has been called,
  6399. so we consider the external parameter entity read */
  6400. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6401. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6402. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6403. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6404. } else {
  6405. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6406. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6407. }
  6408. return r
  6409. }
  6410. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6411. bp := tls.Alloc(16)
  6412. defer tls.Free(16)
  6413. var result _XML_Error
  6414. var start uintptr
  6415. var tok int32
  6416. var _ /* next at bp+0 */ uintptr
  6417. _, _, _ = result, start, tok
  6418. start = s
  6419. *(*uintptr)(unsafe.Pointer(bp)) = start
  6420. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6421. for {
  6422. 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)
  6423. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6424. - storeEntityValue
  6425. - processXmlDecl
  6426. */
  6427. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6428. if tok <= 0 {
  6429. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6430. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6431. return int32(_XML_ERROR_NONE)
  6432. }
  6433. switch tok {
  6434. case m_XML_TOK_INVALID:
  6435. return int32(_XML_ERROR_INVALID_TOKEN)
  6436. case -int32(1):
  6437. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6438. case -int32(2):
  6439. return int32(_XML_ERROR_PARTIAL_CHAR)
  6440. case -int32(4): /* start == end */
  6441. fallthrough
  6442. default:
  6443. break
  6444. }
  6445. /* found end of entity value - can store it now */
  6446. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6447. } else {
  6448. if tok == int32(m_XML_TOK_XML_DECL) {
  6449. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6450. if result != int32(_XML_ERROR_NONE) {
  6451. return result
  6452. }
  6453. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6454. * that to happen, a parameter entity parsing handler must have attempted
  6455. * to suspend the parser, which fails and raises an error. The parser can
  6456. * be aborted, but can't be suspended.
  6457. */
  6458. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6459. return int32(_XML_ERROR_ABORTED)
  6460. }
  6461. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6462. /* stop scanning for text declaration - we found one */
  6463. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6464. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6465. } else {
  6466. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6467. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6468. _accountingOnAbort(tls, parser)
  6469. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6470. }
  6471. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6472. return int32(_XML_ERROR_NONE)
  6473. } else {
  6474. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6475. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6476. return int32(_XML_ERROR_SYNTAX)
  6477. }
  6478. }
  6479. }
  6480. }
  6481. start = *(*uintptr)(unsafe.Pointer(bp))
  6482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6483. goto _1
  6484. _1:
  6485. }
  6486. return r
  6487. }
  6488. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6489. bp := tls.Alloc(16)
  6490. defer tls.Free(16)
  6491. var tok int32
  6492. var _ /* next at bp+0 */ uintptr
  6493. _ = tok
  6494. *(*uintptr)(unsafe.Pointer(bp)) = s
  6495. 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)
  6496. if tok <= 0 {
  6497. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6498. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6499. return int32(_XML_ERROR_NONE)
  6500. }
  6501. switch tok {
  6502. case m_XML_TOK_INVALID:
  6503. return int32(_XML_ERROR_INVALID_TOKEN)
  6504. case -int32(1):
  6505. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6506. case -int32(2):
  6507. return int32(_XML_ERROR_PARTIAL_CHAR)
  6508. case -int32(4): /* start == end */
  6509. fallthrough
  6510. default:
  6511. break
  6512. }
  6513. } else {
  6514. if tok == int32(m_XML_TOK_BOM) {
  6515. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6516. _accountingOnAbort(tls, parser)
  6517. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6518. }
  6519. s = *(*uintptr)(unsafe.Pointer(bp))
  6520. 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)
  6521. }
  6522. }
  6523. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6524. 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))
  6525. }
  6526. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6527. bp := tls.Alloc(16)
  6528. defer tls.Free(16)
  6529. var enc, start uintptr
  6530. var tok int32
  6531. var _ /* next at bp+0 */ uintptr
  6532. _, _, _ = enc, start, tok
  6533. start = s
  6534. *(*uintptr)(unsafe.Pointer(bp)) = s
  6535. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6536. for {
  6537. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6538. /* Note: These bytes are accounted later in:
  6539. - storeEntityValue
  6540. */
  6541. if tok <= 0 {
  6542. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6543. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6544. return int32(_XML_ERROR_NONE)
  6545. }
  6546. switch tok {
  6547. case m_XML_TOK_INVALID:
  6548. return int32(_XML_ERROR_INVALID_TOKEN)
  6549. case -int32(1):
  6550. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6551. case -int32(2):
  6552. return int32(_XML_ERROR_PARTIAL_CHAR)
  6553. case -int32(4): /* start == end */
  6554. fallthrough
  6555. default:
  6556. break
  6557. }
  6558. /* found end of entity value - can store it now */
  6559. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6560. }
  6561. start = *(*uintptr)(unsafe.Pointer(bp))
  6562. goto _1
  6563. _1:
  6564. }
  6565. return r
  6566. }
  6567. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6568. bp := tls.Alloc(16)
  6569. defer tls.Free(16)
  6570. var tok int32
  6571. var _ /* next at bp+0 */ uintptr
  6572. _ = tok
  6573. *(*uintptr)(unsafe.Pointer(bp)) = s
  6574. 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)
  6575. 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))
  6576. }
  6577. 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) {
  6578. bp := tls.Alloc(16)
  6579. defer tls.Free(16)
  6580. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6581. 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
  6582. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6583. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6584. var nameLen, v88 Tsize_t
  6585. var quant _XML_Content_Quant
  6586. var result, result1, result2, result3, result4, result5 _XML_Error
  6587. var v72, v79, v83 bool
  6588. var v81 uint32
  6589. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6590. /* save one level of indirection */
  6591. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6592. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6593. eventPP = parser + 544
  6594. eventEndPP = parser + 552
  6595. } else {
  6596. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6597. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6598. }
  6599. for {
  6600. handleDefault = libc.Uint8FromInt32(1)
  6601. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6602. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6603. if tok <= 0 {
  6604. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6605. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6606. return int32(_XML_ERROR_NONE)
  6607. }
  6608. switch tok {
  6609. case m_XML_TOK_INVALID:
  6610. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6611. return int32(_XML_ERROR_INVALID_TOKEN)
  6612. case -int32(1):
  6613. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6614. case -int32(2):
  6615. return int32(_XML_ERROR_PARTIAL_CHAR)
  6616. case -int32(m_XML_TOK_PROLOG_S):
  6617. tok = -tok
  6618. case -int32(4):
  6619. /* for internal PE NOT referenced between declarations */
  6620. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6621. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6622. return int32(_XML_ERROR_NONE)
  6623. }
  6624. /* WFC: PE Between Declarations - must check that PE contains
  6625. complete markup, not only for external PEs, but also for
  6626. internal PEs if the reference occurs between declarations.
  6627. */
  6628. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6629. 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) {
  6630. return int32(_XML_ERROR_INCOMPLETE_PE)
  6631. }
  6632. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6633. return int32(_XML_ERROR_NONE)
  6634. }
  6635. return int32(_XML_ERROR_NO_ELEMENTS)
  6636. default:
  6637. tok = -tok
  6638. *(*uintptr)(unsafe.Pointer(bp)) = end
  6639. break
  6640. }
  6641. }
  6642. 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)
  6643. switch role {
  6644. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6645. fallthrough
  6646. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6647. fallthrough
  6648. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6649. default:
  6650. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6651. _accountingOnAbort(tls, parser)
  6652. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6653. }
  6654. }
  6655. switch role {
  6656. case int32(_XML_ROLE_XML_DECL):
  6657. goto _2
  6658. case int32(_XML_ROLE_DOCTYPE_NAME):
  6659. goto _3
  6660. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6661. goto _4
  6662. case int32(_XML_ROLE_TEXT_DECL):
  6663. goto _5
  6664. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6665. goto _6
  6666. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6667. goto _7
  6668. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6669. goto _8
  6670. case int32(_XML_ROLE_INSTANCE_START):
  6671. goto _9
  6672. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6673. goto _10
  6674. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6675. goto _11
  6676. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6677. goto _12
  6678. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6679. goto _13
  6680. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6681. goto _14
  6682. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6683. goto _15
  6684. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6685. goto _16
  6686. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6687. goto _17
  6688. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6689. goto _18
  6690. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6691. goto _19
  6692. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6693. goto _20
  6694. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6695. goto _21
  6696. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6697. goto _22
  6698. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6699. goto _23
  6700. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6701. goto _24
  6702. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6703. goto _25
  6704. case int32(_XML_ROLE_ENTITY_VALUE):
  6705. goto _26
  6706. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6707. goto _27
  6708. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6709. goto _28
  6710. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6711. goto _29
  6712. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6713. goto _30
  6714. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6715. goto _31
  6716. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6717. goto _32
  6718. case int32(_XML_ROLE_NOTATION_NAME):
  6719. goto _33
  6720. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6721. goto _34
  6722. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6723. goto _35
  6724. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6725. goto _36
  6726. case int32(_XML_ROLE_ERROR):
  6727. goto _37
  6728. case int32(_XML_ROLE_IGNORE_SECT):
  6729. goto _38
  6730. case int32(_XML_ROLE_GROUP_OPEN):
  6731. goto _39
  6732. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6733. goto _40
  6734. case int32(_XML_ROLE_GROUP_CHOICE):
  6735. goto _41
  6736. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6737. goto _42
  6738. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6739. goto _43
  6740. case int32(_XML_ROLE_ELEMENT_NAME):
  6741. goto _44
  6742. case int32(_XML_ROLE_CONTENT_EMPTY):
  6743. goto _45
  6744. case int32(_XML_ROLE_CONTENT_ANY):
  6745. goto _46
  6746. case int32(_XML_ROLE_CONTENT_PCDATA):
  6747. goto _47
  6748. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6749. goto _48
  6750. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6751. goto _49
  6752. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6753. goto _50
  6754. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6755. goto _51
  6756. case int32(_XML_ROLE_GROUP_CLOSE):
  6757. goto _52
  6758. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6759. goto _53
  6760. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6761. goto _54
  6762. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6763. goto _55
  6764. case int32(_XML_ROLE_PI):
  6765. goto _56
  6766. case int32(_XML_ROLE_COMMENT):
  6767. goto _57
  6768. case int32(_XML_ROLE_NONE):
  6769. goto _58
  6770. case int32(_XML_ROLE_DOCTYPE_NONE):
  6771. goto _59
  6772. case int32(_XML_ROLE_ENTITY_NONE):
  6773. goto _60
  6774. case int32(_XML_ROLE_NOTATION_NONE):
  6775. goto _61
  6776. case int32(_XML_ROLE_ATTLIST_NONE):
  6777. goto _62
  6778. case int32(_XML_ROLE_ELEMENT_NONE):
  6779. goto _63
  6780. }
  6781. goto _64
  6782. _2:
  6783. ;
  6784. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6785. if result != int32(_XML_ERROR_NONE) {
  6786. return result
  6787. }
  6788. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6789. handleDefault = libc.Uint8FromInt32(0)
  6790. goto _64
  6791. _3:
  6792. ;
  6793. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6794. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6795. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6796. return int32(_XML_ERROR_NO_MEMORY)
  6797. }
  6798. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6799. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6800. handleDefault = libc.Uint8FromInt32(0)
  6801. }
  6802. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6803. goto _64
  6804. _4:
  6805. ;
  6806. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6807. (*(*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))
  6808. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6809. _poolClear(tls, parser+784)
  6810. handleDefault = libc.Uint8FromInt32(0)
  6811. }
  6812. goto _64
  6813. _5:
  6814. ;
  6815. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6816. if result1 != int32(_XML_ERROR_NONE) {
  6817. return result1
  6818. }
  6819. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6820. handleDefault = libc.Uint8FromInt32(0)
  6821. goto _64
  6822. _6:
  6823. ;
  6824. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6825. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6826. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6827. return int32(_XML_ERROR_NO_MEMORY)
  6828. }
  6829. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6830. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6831. 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) {
  6832. return int32(_XML_ERROR_PUBLICID)
  6833. }
  6834. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6835. if !(pubId != 0) {
  6836. return int32(_XML_ERROR_NO_MEMORY)
  6837. }
  6838. _normalizePublicId(tls, pubId)
  6839. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6840. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6841. handleDefault = libc.Uint8FromInt32(0)
  6842. goto alreadyChecked
  6843. }
  6844. /* fall through */
  6845. _7:
  6846. ;
  6847. 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) {
  6848. return int32(_XML_ERROR_PUBLICID)
  6849. }
  6850. goto alreadyChecked
  6851. alreadyChecked:
  6852. ;
  6853. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6854. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6855. if !(tem != 0) {
  6856. return int32(_XML_ERROR_NO_MEMORY)
  6857. }
  6858. _normalizePublicId(tls, tem)
  6859. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6860. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6861. /* Don't suppress the default handler if we fell through from
  6862. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6863. */
  6864. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6865. handleDefault = libc.Uint8FromInt32(0)
  6866. }
  6867. }
  6868. goto _64
  6869. _8:
  6870. ;
  6871. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6872. /* Must not close doctype from within expanded parameter entities */
  6873. return int32(_XML_ERROR_INVALID_TOKEN)
  6874. }
  6875. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6876. (*(*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)
  6877. _poolClear(tls, parser+784)
  6878. handleDefault = libc.Uint8FromInt32(0)
  6879. }
  6880. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6881. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6882. was not set, indicating an external subset
  6883. */
  6884. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6885. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6886. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6887. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6888. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6889. if !(entity != 0) {
  6890. /* The external subset name "#" will have already been
  6891. * inserted into the hash table at the start of the
  6892. * external entity parsing, so no allocation will happen
  6893. * and lookup() cannot fail.
  6894. */
  6895. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6896. }
  6897. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6898. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6899. }
  6900. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6901. 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) {
  6902. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6903. }
  6904. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6905. 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) {
  6906. return int32(_XML_ERROR_NOT_STANDALONE)
  6907. }
  6908. } else {
  6909. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  6910. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  6911. }
  6912. }
  6913. /* end of DTD - no need to update dtd->keepProcessing */
  6914. }
  6915. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6916. }
  6917. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  6918. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6919. handleDefault = libc.Uint8FromInt32(0)
  6920. }
  6921. goto _64
  6922. _9:
  6923. ;
  6924. /* if there is no DOCTYPE declaration then now is the
  6925. last chance to read the foreign DTD
  6926. */
  6927. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6928. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6929. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6930. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6931. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6932. if !(entity1 != 0) {
  6933. return int32(_XML_ERROR_NO_MEMORY)
  6934. }
  6935. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6936. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6937. 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) {
  6938. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6939. }
  6940. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6941. 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) {
  6942. return int32(_XML_ERROR_NOT_STANDALONE)
  6943. }
  6944. } else {
  6945. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  6946. }
  6947. /* end of DTD - no need to update dtd->keepProcessing */
  6948. }
  6949. }
  6950. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6951. return _contentProcessor(tls, parser, s, end, nextPtr)
  6952. _10:
  6953. ;
  6954. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6955. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  6956. return int32(_XML_ERROR_NO_MEMORY)
  6957. }
  6958. goto checkAttListDeclHandler
  6959. _11:
  6960. ;
  6961. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6962. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  6963. return int32(_XML_ERROR_NO_MEMORY)
  6964. }
  6965. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  6966. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  6967. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  6968. goto checkAttListDeclHandler
  6969. _12:
  6970. ;
  6971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  6972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  6973. goto checkAttListDeclHandler
  6974. _13:
  6975. ;
  6976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  6977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  6978. goto checkAttListDeclHandler
  6979. _14:
  6980. ;
  6981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  6982. goto checkAttListDeclHandler
  6983. _15:
  6984. ;
  6985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  6986. goto checkAttListDeclHandler
  6987. _16:
  6988. ;
  6989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  6990. goto checkAttListDeclHandler
  6991. _17:
  6992. ;
  6993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  6994. goto checkAttListDeclHandler
  6995. _18:
  6996. ;
  6997. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  6998. goto checkAttListDeclHandler
  6999. _19:
  7000. ;
  7001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7002. goto checkAttListDeclHandler
  7003. checkAttListDeclHandler:
  7004. ;
  7005. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7006. handleDefault = libc.Uint8FromInt32(0)
  7007. }
  7008. goto _64
  7009. _21:
  7010. ;
  7011. _20:
  7012. ;
  7013. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7014. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7015. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7016. } else {
  7017. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7018. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7019. } else {
  7020. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7021. }
  7022. prefix = v65
  7023. }
  7024. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  7025. return int32(_XML_ERROR_NO_MEMORY)
  7026. }
  7027. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7028. return int32(_XML_ERROR_NO_MEMORY)
  7029. }
  7030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7031. handleDefault = libc.Uint8FromInt32(0)
  7032. }
  7033. goto _64
  7034. _23:
  7035. ;
  7036. _22:
  7037. ;
  7038. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7039. 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) {
  7040. return int32(_XML_ERROR_NO_MEMORY)
  7041. }
  7042. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7043. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7044. /* Enumerated or Notation type */
  7045. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7046. v66 = 0
  7047. } else {
  7048. v68 = parser + 784 + 24
  7049. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7050. *(*uintptr)(unsafe.Pointer(v68))++
  7051. *(*TXML_Char)(unsafe.Pointer(v67)) = uint8(m_ASCII_RPAREN)
  7052. v66 = libc.Int32FromInt32(1)
  7053. }
  7054. if v72 = !(v66 != 0); !v72 {
  7055. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7056. v69 = 0
  7057. } else {
  7058. v71 = parser + 784 + 24
  7059. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7060. *(*uintptr)(unsafe.Pointer(v71))++
  7061. *(*TXML_Char)(unsafe.Pointer(v70)) = uint8('\000')
  7062. v69 = libc.Int32FromInt32(1)
  7063. }
  7064. }
  7065. if v72 || !(v69 != 0) {
  7066. return int32(_XML_ERROR_NO_MEMORY)
  7067. }
  7068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7069. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7070. }
  7071. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7072. (*(*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)))
  7073. handleDefault = libc.Uint8FromInt32(0)
  7074. }
  7075. }
  7076. _poolClear(tls, parser+784)
  7077. goto _64
  7078. _25:
  7079. ;
  7080. _24:
  7081. ;
  7082. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7083. 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))
  7084. if result2 != 0 {
  7085. return result2
  7086. }
  7087. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7088. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7089. /* ID attributes aren't allowed to have a default */
  7090. 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) {
  7091. return int32(_XML_ERROR_NO_MEMORY)
  7092. }
  7093. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7094. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7095. /* Enumerated or Notation type */
  7096. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7097. v73 = 0
  7098. } else {
  7099. v75 = parser + 784 + 24
  7100. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7101. *(*uintptr)(unsafe.Pointer(v75))++
  7102. *(*TXML_Char)(unsafe.Pointer(v74)) = uint8(m_ASCII_RPAREN)
  7103. v73 = libc.Int32FromInt32(1)
  7104. }
  7105. if v79 = !(v73 != 0); !v79 {
  7106. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  7107. v76 = 0
  7108. } else {
  7109. v78 = parser + 784 + 24
  7110. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7111. *(*uintptr)(unsafe.Pointer(v78))++
  7112. *(*TXML_Char)(unsafe.Pointer(v77)) = uint8('\000')
  7113. v76 = libc.Int32FromInt32(1)
  7114. }
  7115. }
  7116. if v79 || !(v76 != 0) {
  7117. return int32(_XML_ERROR_NO_MEMORY)
  7118. }
  7119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7120. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7121. }
  7122. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7123. (*(*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)))
  7124. _poolClear(tls, parser+784)
  7125. handleDefault = libc.Uint8FromInt32(0)
  7126. }
  7127. }
  7128. goto _64
  7129. _26:
  7130. ;
  7131. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7132. 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))
  7133. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7134. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7135. (*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))
  7136. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  7137. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7138. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7139. (*(*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))
  7140. handleDefault = libc.Uint8FromInt32(0)
  7141. }
  7142. } else {
  7143. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  7144. }
  7145. if result3 != int32(_XML_ERROR_NONE) {
  7146. return result3
  7147. }
  7148. }
  7149. goto _64
  7150. _27:
  7151. ;
  7152. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7153. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7154. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7155. (*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))
  7156. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7157. return int32(_XML_ERROR_NO_MEMORY)
  7158. }
  7159. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7160. handleDefault = libc.Uint8FromInt32(0)
  7161. } else {
  7162. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7163. for the case where no parser->m_startDoctypeDeclHandler is set */
  7164. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7165. }
  7166. 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) {
  7167. return int32(_XML_ERROR_NOT_STANDALONE)
  7168. }
  7169. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7170. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  7171. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7172. return int32(_XML_ERROR_NO_MEMORY)
  7173. }
  7174. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7175. }
  7176. /* fall through */
  7177. _28:
  7178. ;
  7179. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7180. (*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))
  7181. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7182. return int32(_XML_ERROR_NO_MEMORY)
  7183. }
  7184. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7185. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7186. /* Don't suppress the default handler if we fell through from
  7187. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7188. */
  7189. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7190. handleDefault = libc.Uint8FromInt32(0)
  7191. }
  7192. }
  7193. goto _64
  7194. _29:
  7195. ;
  7196. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7197. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7198. (*(*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))
  7199. handleDefault = libc.Uint8FromInt32(0)
  7200. }
  7201. goto _64
  7202. _30:
  7203. ;
  7204. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7205. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7206. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7207. return int32(_XML_ERROR_NO_MEMORY)
  7208. }
  7209. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7210. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7211. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7212. (*(*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)
  7213. handleDefault = libc.Uint8FromInt32(0)
  7214. } else {
  7215. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7216. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7217. (*(*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)
  7218. handleDefault = libc.Uint8FromInt32(0)
  7219. }
  7220. }
  7221. }
  7222. goto _64
  7223. _31:
  7224. ;
  7225. 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 {
  7226. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7227. goto _64
  7228. }
  7229. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7230. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7231. if !(name != 0) {
  7232. return int32(_XML_ERROR_NO_MEMORY)
  7233. }
  7234. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  7235. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7236. return int32(_XML_ERROR_NO_MEMORY)
  7237. }
  7238. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7239. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7240. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7241. } else {
  7242. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7243. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7244. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7245. /* if we have a parent parser or are reading an internal parameter
  7246. entity, then the entity declaration is not considered "internal"
  7247. */
  7248. (*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))
  7249. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7250. handleDefault = libc.Uint8FromInt32(0)
  7251. }
  7252. }
  7253. } else {
  7254. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7255. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7256. }
  7257. goto _64
  7258. _32:
  7259. ;
  7260. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7261. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7262. if !(name1 != 0) {
  7263. return int32(_XML_ERROR_NO_MEMORY)
  7264. }
  7265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  7266. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7267. return int32(_XML_ERROR_NO_MEMORY)
  7268. }
  7269. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7270. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7272. } else {
  7273. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  7274. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7275. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7276. /* if we have a parent parser or are reading an internal parameter
  7277. entity, then the entity declaration is not considered "internal"
  7278. */
  7279. (*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))
  7280. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7281. handleDefault = libc.Uint8FromInt32(0)
  7282. }
  7283. }
  7284. } else {
  7285. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7286. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7287. }
  7288. goto _64
  7289. _33:
  7290. ;
  7291. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7292. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7293. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7294. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7295. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7296. return int32(_XML_ERROR_NO_MEMORY)
  7297. }
  7298. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7299. handleDefault = libc.Uint8FromInt32(0)
  7300. }
  7301. goto _64
  7302. _34:
  7303. ;
  7304. 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) {
  7305. return int32(_XML_ERROR_PUBLICID)
  7306. }
  7307. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7308. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7309. if !(tem1 != 0) {
  7310. return int32(_XML_ERROR_NO_MEMORY)
  7311. }
  7312. _normalizePublicId(tls, tem1)
  7313. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7314. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  7315. handleDefault = libc.Uint8FromInt32(0)
  7316. }
  7317. goto _64
  7318. _35:
  7319. ;
  7320. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7321. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7322. if !(systemId != 0) {
  7323. return int32(_XML_ERROR_NO_MEMORY)
  7324. }
  7325. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7326. (*(*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)
  7327. handleDefault = libc.Uint8FromInt32(0)
  7328. }
  7329. _poolClear(tls, parser+784)
  7330. goto _64
  7331. _36:
  7332. ;
  7333. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7334. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7335. (*(*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)
  7336. handleDefault = libc.Uint8FromInt32(0)
  7337. }
  7338. _poolClear(tls, parser+784)
  7339. goto _64
  7340. _37:
  7341. ;
  7342. switch tok {
  7343. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7344. /* PE references in internal subset are
  7345. not allowed within declarations. */
  7346. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7347. case int32(m_XML_TOK_XML_DECL):
  7348. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7349. default:
  7350. return int32(_XML_ERROR_SYNTAX)
  7351. }
  7352. _38:
  7353. ;
  7354. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7355. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7356. }
  7357. handleDefault = libc.Uint8FromInt32(0)
  7358. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7359. if result4 != int32(_XML_ERROR_NONE) {
  7360. return result4
  7361. } else {
  7362. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7363. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7364. return result4
  7365. }
  7366. }
  7367. goto _64
  7368. _39:
  7369. ;
  7370. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7371. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7372. /* Detect and prevent integer overflow */
  7373. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7374. return int32(_XML_ERROR_NO_MEMORY)
  7375. }
  7376. p80 = parser + 888
  7377. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7378. 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))))
  7379. if new_connector == libc.UintptrFromInt32(0) {
  7380. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  7381. return int32(_XML_ERROR_NO_MEMORY)
  7382. }
  7383. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7384. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7385. /* Detect and prevent integer overflow.
  7386. * The preprocessor guard addresses the "always false" warning
  7387. * from -Wtype-limits on platforms where
  7388. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7389. 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))
  7390. if new_scaff_index == libc.UintptrFromInt32(0) {
  7391. return int32(_XML_ERROR_NO_MEMORY)
  7392. }
  7393. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7394. }
  7395. } else {
  7396. v81 = libc.Uint32FromInt32(32)
  7397. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7398. (*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))
  7399. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7400. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7401. return int32(_XML_ERROR_NO_MEMORY)
  7402. }
  7403. }
  7404. }
  7405. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(0)
  7406. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7407. myindex = _nextScaffoldPart(tls, parser)
  7408. if myindex < 0 {
  7409. return int32(_XML_ERROR_NO_MEMORY)
  7410. }
  7411. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7412. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7413. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7414. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7415. handleDefault = libc.Uint8FromInt32(0)
  7416. }
  7417. }
  7418. goto _64
  7419. _40:
  7420. ;
  7421. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  7422. return int32(_XML_ERROR_SYNTAX)
  7423. }
  7424. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_COMMA)
  7425. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7426. handleDefault = libc.Uint8FromInt32(0)
  7427. }
  7428. goto _64
  7429. _41:
  7430. ;
  7431. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  7432. return int32(_XML_ERROR_SYNTAX)
  7433. }
  7434. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*uint8)(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) {
  7435. (*(*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)
  7436. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7437. handleDefault = libc.Uint8FromInt32(0)
  7438. }
  7439. }
  7440. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_PIPE)
  7441. goto _64
  7442. _43:
  7443. ;
  7444. _42:
  7445. ;
  7446. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7447. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7448. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7449. } else {
  7450. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7451. if !(name2 != 0) {
  7452. return int32(_XML_ERROR_NO_MEMORY)
  7453. }
  7454. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7455. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7456. /* first, determine if a check for an existing declaration is needed;
  7457. if yes, check that the entity exists, and that it is internal,
  7458. otherwise call the skipped entity handler
  7459. */
  7460. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7461. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7462. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7463. } else {
  7464. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7465. }
  7466. }
  7467. if v83 && v82 != 0 {
  7468. if !(entity2 != 0) {
  7469. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7470. } else {
  7471. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7472. /* It's hard to exhaustively search the code to be sure,
  7473. * but there doesn't seem to be a way of executing the
  7474. * following line. There are two cases:
  7475. *
  7476. * If 'standalone' is false, the DTD must have no
  7477. * parameter entities or we wouldn't have passed the outer
  7478. * 'if' statement. That means the only entity in the hash
  7479. * table is the external subset name "#" which cannot be
  7480. * given as a parameter entity name in XML syntax, so the
  7481. * lookup must have returned NULL and we don't even reach
  7482. * the test for an internal entity.
  7483. *
  7484. * If 'standalone' is true, it does not seem to be
  7485. * possible to create entities taking this code path that
  7486. * are not internal entities, so fail the test above.
  7487. *
  7488. * Because this analysis is very uncertain, the code is
  7489. * being left in place and merely removed from the
  7490. * coverage test statistics.
  7491. */
  7492. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7493. }
  7494. }
  7495. } else {
  7496. if !(entity2 != 0) {
  7497. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7498. /* cannot report skipped entities in declarations */
  7499. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7500. (*(*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))
  7501. handleDefault = libc.Uint8FromInt32(0)
  7502. }
  7503. goto _64
  7504. }
  7505. }
  7506. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7507. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7508. }
  7509. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7510. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7511. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7512. } else {
  7513. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7514. }
  7515. betweenDecl = libc.Uint8FromInt32(v84)
  7516. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7517. if result5 != int32(_XML_ERROR_NONE) {
  7518. return result5
  7519. }
  7520. handleDefault = libc.Uint8FromInt32(0)
  7521. goto _64
  7522. }
  7523. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7524. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7525. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7526. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7527. 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) {
  7528. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7529. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7530. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7531. }
  7532. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7533. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7534. handleDefault = libc.Uint8FromInt32(0)
  7535. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7536. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7537. goto _64
  7538. }
  7539. } else {
  7540. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7541. goto _64
  7542. }
  7543. }
  7544. 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) {
  7545. return int32(_XML_ERROR_NOT_STANDALONE)
  7546. }
  7547. goto _64
  7548. /* Element declaration stuff */
  7549. _44:
  7550. ;
  7551. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7552. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7553. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7554. return int32(_XML_ERROR_NO_MEMORY)
  7555. }
  7556. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7557. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7558. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7559. handleDefault = libc.Uint8FromInt32(0)
  7560. }
  7561. goto _64
  7562. _46:
  7563. ;
  7564. _45:
  7565. ;
  7566. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7567. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7568. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7569. if !(content != 0) {
  7570. return int32(_XML_ERROR_NO_MEMORY)
  7571. }
  7572. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7573. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7574. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7575. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7576. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7577. v85 = int32(_XML_CTYPE_ANY)
  7578. } else {
  7579. v85 = int32(_XML_CTYPE_EMPTY)
  7580. }
  7581. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7582. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7583. (*(*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)
  7584. handleDefault = libc.Uint8FromInt32(0)
  7585. }
  7586. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7587. }
  7588. goto _64
  7589. _47:
  7590. ;
  7591. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7592. (*(*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)
  7593. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7594. handleDefault = libc.Uint8FromInt32(0)
  7595. }
  7596. }
  7597. goto _64
  7598. _48:
  7599. ;
  7600. quant = int32(_XML_CQUANT_NONE)
  7601. goto elementContent
  7602. _49:
  7603. ;
  7604. quant = int32(_XML_CQUANT_OPT)
  7605. goto elementContent
  7606. _50:
  7607. ;
  7608. quant = int32(_XML_CQUANT_REP)
  7609. goto elementContent
  7610. _51:
  7611. ;
  7612. quant = int32(_XML_CQUANT_PLUS)
  7613. goto elementContent
  7614. elementContent:
  7615. ;
  7616. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7617. if quant == int32(_XML_CQUANT_NONE) {
  7618. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7619. } else {
  7620. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7621. }
  7622. nxt = v86
  7623. myindex1 = _nextScaffoldPart(tls, parser)
  7624. if myindex1 < 0 {
  7625. return int32(_XML_ERROR_NO_MEMORY)
  7626. }
  7627. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7628. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7629. el = _getElementType(tls, parser, enc, s, nxt)
  7630. if !(el != 0) {
  7631. return int32(_XML_ERROR_NO_MEMORY)
  7632. }
  7633. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7634. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7635. nameLen = uint64(0)
  7636. for {
  7637. v88 = nameLen
  7638. nameLen++
  7639. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7640. break
  7641. }
  7642. goto _87
  7643. _87:
  7644. }
  7645. /* Detect and prevent integer overflow */
  7646. if nameLen > uint64(uint32(0xffffffff)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen) {
  7647. return int32(_XML_ERROR_NO_MEMORY)
  7648. }
  7649. *(*uint32)(unsafe.Pointer(dtd + 336)) += uint32(nameLen)
  7650. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7651. handleDefault = libc.Uint8FromInt32(0)
  7652. }
  7653. }
  7654. goto _64
  7655. _52:
  7656. ;
  7657. quant = int32(_XML_CQUANT_NONE)
  7658. goto closeGroup
  7659. _53:
  7660. ;
  7661. quant = int32(_XML_CQUANT_OPT)
  7662. goto closeGroup
  7663. _54:
  7664. ;
  7665. quant = int32(_XML_CQUANT_REP)
  7666. goto closeGroup
  7667. _55:
  7668. ;
  7669. quant = int32(_XML_CQUANT_PLUS)
  7670. goto closeGroup
  7671. closeGroup:
  7672. ;
  7673. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7674. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7675. handleDefault = libc.Uint8FromInt32(0)
  7676. }
  7677. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7678. (*(*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
  7679. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7680. if !(handleDefault != 0) {
  7681. model = _build_model(tls, parser)
  7682. if !(model != 0) {
  7683. return int32(_XML_ERROR_NO_MEMORY)
  7684. }
  7685. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7686. (*(*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)
  7687. }
  7688. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7689. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7690. }
  7691. }
  7692. goto _64
  7693. /* End element declaration stuff */
  7694. _56:
  7695. ;
  7696. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7697. return int32(_XML_ERROR_NO_MEMORY)
  7698. }
  7699. handleDefault = libc.Uint8FromInt32(0)
  7700. goto _64
  7701. _57:
  7702. ;
  7703. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7704. return int32(_XML_ERROR_NO_MEMORY)
  7705. }
  7706. handleDefault = libc.Uint8FromInt32(0)
  7707. goto _64
  7708. _58:
  7709. ;
  7710. switch tok {
  7711. case int32(m_XML_TOK_BOM):
  7712. handleDefault = libc.Uint8FromInt32(0)
  7713. break
  7714. }
  7715. goto _64
  7716. _59:
  7717. ;
  7718. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7719. handleDefault = libc.Uint8FromInt32(0)
  7720. }
  7721. goto _64
  7722. _60:
  7723. ;
  7724. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7725. handleDefault = libc.Uint8FromInt32(0)
  7726. }
  7727. goto _64
  7728. _61:
  7729. ;
  7730. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7731. handleDefault = libc.Uint8FromInt32(0)
  7732. }
  7733. goto _64
  7734. _62:
  7735. ;
  7736. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7737. handleDefault = libc.Uint8FromInt32(0)
  7738. }
  7739. goto _64
  7740. _63:
  7741. ;
  7742. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7743. handleDefault = libc.Uint8FromInt32(0)
  7744. }
  7745. goto _64
  7746. _64:
  7747. ; /* end of big switch */
  7748. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7749. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7750. }
  7751. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7752. case int32(_XML_SUSPENDED):
  7753. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7754. return int32(_XML_ERROR_NONE)
  7755. case int32(_XML_FINISHED):
  7756. return int32(_XML_ERROR_ABORTED)
  7757. default:
  7758. s = *(*uintptr)(unsafe.Pointer(bp))
  7759. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7760. }
  7761. goto _1
  7762. _1:
  7763. }
  7764. /* not reached */
  7765. return r
  7766. }
  7767. var _externalSubsetName = [2]TXML_Char{
  7768. 0: uint8(m_ASCII_HASH),
  7769. }
  7770. var _atypeCDATA = [6]TXML_Char{
  7771. 0: uint8(m_ASCII_C),
  7772. 1: uint8(m_ASCII_D),
  7773. 2: uint8(m_ASCII_A),
  7774. 3: uint8(m_ASCII_T),
  7775. 4: uint8(m_ASCII_A),
  7776. }
  7777. var _atypeID = [3]TXML_Char{
  7778. 0: uint8(m_ASCII_I),
  7779. 1: uint8(m_ASCII_D),
  7780. }
  7781. var _atypeIDREF = [6]TXML_Char{
  7782. 0: uint8(m_ASCII_I),
  7783. 1: uint8(m_ASCII_D),
  7784. 2: uint8(m_ASCII_R),
  7785. 3: uint8(m_ASCII_E),
  7786. 4: uint8(m_ASCII_F),
  7787. }
  7788. var _atypeIDREFS = [7]TXML_Char{
  7789. 0: uint8(m_ASCII_I),
  7790. 1: uint8(m_ASCII_D),
  7791. 2: uint8(m_ASCII_R),
  7792. 3: uint8(m_ASCII_E),
  7793. 4: uint8(m_ASCII_F),
  7794. 5: uint8(m_ASCII_S),
  7795. }
  7796. var _atypeENTITY = [7]TXML_Char{
  7797. 0: uint8(m_ASCII_E),
  7798. 1: uint8(m_ASCII_N),
  7799. 2: uint8(m_ASCII_T),
  7800. 3: uint8(m_ASCII_I),
  7801. 4: uint8(m_ASCII_T),
  7802. 5: uint8(m_ASCII_Y),
  7803. }
  7804. var _atypeENTITIES = [9]TXML_Char{
  7805. 0: uint8(m_ASCII_E),
  7806. 1: uint8(m_ASCII_N),
  7807. 2: uint8(m_ASCII_T),
  7808. 3: uint8(m_ASCII_I),
  7809. 4: uint8(m_ASCII_T),
  7810. 5: uint8(m_ASCII_I),
  7811. 6: uint8(m_ASCII_E),
  7812. 7: uint8(m_ASCII_S),
  7813. }
  7814. var _atypeNMTOKEN = [8]TXML_Char{
  7815. 0: uint8(m_ASCII_N),
  7816. 1: uint8(m_ASCII_M),
  7817. 2: uint8(m_ASCII_T),
  7818. 3: uint8(m_ASCII_O),
  7819. 4: uint8(m_ASCII_K),
  7820. 5: uint8(m_ASCII_E),
  7821. 6: uint8(m_ASCII_N),
  7822. }
  7823. var _atypeNMTOKENS = [9]TXML_Char{
  7824. 0: uint8(m_ASCII_N),
  7825. 1: uint8(m_ASCII_M),
  7826. 2: uint8(m_ASCII_T),
  7827. 3: uint8(m_ASCII_O),
  7828. 4: uint8(m_ASCII_K),
  7829. 5: uint8(m_ASCII_E),
  7830. 6: uint8(m_ASCII_N),
  7831. 7: uint8(m_ASCII_S),
  7832. }
  7833. var _notationPrefix = [10]TXML_Char{
  7834. 0: uint8(m_ASCII_N),
  7835. 1: uint8(m_ASCII_O),
  7836. 2: uint8(m_ASCII_T),
  7837. 3: uint8(m_ASCII_A),
  7838. 4: uint8(m_ASCII_T),
  7839. 5: uint8(m_ASCII_I),
  7840. 6: uint8(m_ASCII_O),
  7841. 7: uint8(m_ASCII_N),
  7842. 8: uint8(m_ASCII_LPAREN),
  7843. }
  7844. var _enumValueSep = [2]TXML_Char{
  7845. 0: uint8(m_ASCII_PIPE),
  7846. }
  7847. var _enumValueStart = [2]TXML_Char{
  7848. 0: uint8(m_ASCII_LPAREN),
  7849. }
  7850. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7851. bp := tls.Alloc(16)
  7852. defer tls.Free(16)
  7853. var tok int32
  7854. var v2 uintptr
  7855. var _ /* next at bp+0 */ uintptr
  7856. _, _ = tok, v2
  7857. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7858. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7859. for {
  7860. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7861. 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)
  7862. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  7863. _accountingOnAbort(tls, parser)
  7864. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7865. }
  7866. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7867. switch tok {
  7868. /* report partial linebreak - it might be the last token */
  7869. case -int32(m_XML_TOK_PROLOG_S):
  7870. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7871. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7872. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7873. return int32(_XML_ERROR_ABORTED)
  7874. }
  7875. }
  7876. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7877. return int32(_XML_ERROR_NONE)
  7878. case -int32(4):
  7879. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7880. return int32(_XML_ERROR_NONE)
  7881. case int32(m_XML_TOK_PROLOG_S):
  7882. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7883. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7884. }
  7885. case int32(m_XML_TOK_PI):
  7886. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7887. return int32(_XML_ERROR_NO_MEMORY)
  7888. }
  7889. case int32(m_XML_TOK_COMMENT):
  7890. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7891. return int32(_XML_ERROR_NO_MEMORY)
  7892. }
  7893. case m_XML_TOK_INVALID:
  7894. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7895. return int32(_XML_ERROR_INVALID_TOKEN)
  7896. case -int32(1):
  7897. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7898. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7899. return int32(_XML_ERROR_NONE)
  7900. }
  7901. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7902. case -int32(2):
  7903. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7904. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7905. return int32(_XML_ERROR_NONE)
  7906. }
  7907. return int32(_XML_ERROR_PARTIAL_CHAR)
  7908. default:
  7909. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  7910. }
  7911. v2 = *(*uintptr)(unsafe.Pointer(bp))
  7912. s = v2
  7913. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  7914. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7915. case int32(_XML_SUSPENDED):
  7916. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7917. return int32(_XML_ERROR_NONE)
  7918. case int32(_XML_FINISHED):
  7919. return int32(_XML_ERROR_ABORTED)
  7920. default:
  7921. }
  7922. goto _1
  7923. _1:
  7924. }
  7925. return r
  7926. }
  7927. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  7928. bp := tls.Alloc(16)
  7929. defer tls.Free(16)
  7930. var openEntity, textEnd, textStart uintptr
  7931. var result _XML_Error
  7932. var tok int32
  7933. var _ /* next at bp+0 */ uintptr
  7934. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  7935. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  7936. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7937. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7938. } else {
  7939. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  7940. if !(openEntity != 0) {
  7941. return int32(_XML_ERROR_NO_MEMORY)
  7942. }
  7943. }
  7944. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7945. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  7946. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  7947. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7948. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  7949. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  7950. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  7951. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  7952. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  7953. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  7954. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  7955. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7956. /* Set a safe default value in case 'next' does not get set */
  7957. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7958. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7959. 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)
  7960. 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))
  7961. } else {
  7962. 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))
  7963. }
  7964. if result == int32(_XML_ERROR_NONE) {
  7965. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7966. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  7967. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  7968. } else {
  7969. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  7970. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7972. /* put openEntity back in list of free instances */
  7973. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7975. }
  7976. }
  7977. return result
  7978. }
  7979. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7980. bp := tls.Alloc(16)
  7981. defer tls.Free(16)
  7982. var entity, openEntity, textEnd, textStart uintptr
  7983. var result _XML_Error
  7984. var tok, tok1, v1 int32
  7985. var _ /* next at bp+0 */ uintptr
  7986. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  7987. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7988. if !(openEntity != 0) {
  7989. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7990. }
  7991. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  7992. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  7993. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7994. /* Set a safe default value in case 'next' does not get set */
  7995. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7996. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7997. 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)
  7998. 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))
  7999. } else {
  8000. 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))
  8001. }
  8002. if result != int32(_XML_ERROR_NONE) {
  8003. return result
  8004. }
  8005. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8006. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  8007. return result
  8008. }
  8009. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8010. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8012. /* put openEntity back in list of free instances */
  8013. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8014. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8015. // If there are more open entities we want to stop right here and have the
  8016. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8017. // be ignored altogether.
  8018. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8019. return int32(_XML_ERROR_NONE)
  8020. }
  8021. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8022. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8023. 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)
  8024. 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))
  8025. } else {
  8026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8027. /* see externalEntityContentProcessor vs contentProcessor */
  8028. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8029. v1 = int32(1)
  8030. } else {
  8031. v1 = 0
  8032. }
  8033. 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))
  8034. if result == int32(_XML_ERROR_NONE) {
  8035. if !(_storeRawNames(tls, parser) != 0) {
  8036. return int32(_XML_ERROR_NO_MEMORY)
  8037. }
  8038. }
  8039. return result
  8040. }
  8041. return r
  8042. }
  8043. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8044. _ = s
  8045. _ = end
  8046. _ = nextPtr
  8047. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8048. }
  8049. 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) {
  8050. var result _XML_Error
  8051. var v1 int32
  8052. var v2, v3 uintptr
  8053. _, _, _, _ = result, v1, v2, v3
  8054. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8055. if result != 0 {
  8056. return result
  8057. }
  8058. if !(isCdata != 0) && int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8059. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8060. }
  8061. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8062. v1 = 0
  8063. } else {
  8064. v3 = pool + 24
  8065. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8066. *(*uintptr)(unsafe.Pointer(v3))++
  8067. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8068. v1 = libc.Int32FromInt32(1)
  8069. }
  8070. if !(v1 != 0) {
  8071. return int32(_XML_ERROR_NO_MEMORY)
  8072. }
  8073. return int32(_XML_ERROR_NONE)
  8074. }
  8075. 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) {
  8076. bp := tls.Alloc(16)
  8077. defer tls.Free(16)
  8078. var checkEntityDecl uint8
  8079. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8080. var i, n, tok, v12, v3, v6, v9 int32
  8081. var result _XML_Error
  8082. var v13 bool
  8083. var _ /* buf at bp+8 */ [4]TXML_Char
  8084. var _ /* ch at bp+12 */ TXML_Char
  8085. var _ /* next at bp+0 */ uintptr
  8086. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8087. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8088. for {
  8089. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8090. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  8091. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8092. _accountingOnAbort(tls, parser)
  8093. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8094. }
  8095. switch tok {
  8096. case -int32(4):
  8097. return int32(_XML_ERROR_NONE)
  8098. case m_XML_TOK_INVALID:
  8099. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8100. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8101. }
  8102. return int32(_XML_ERROR_INVALID_TOKEN)
  8103. case -int32(1):
  8104. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8105. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8106. }
  8107. return int32(_XML_ERROR_INVALID_TOKEN)
  8108. case int32(m_XML_TOK_CHAR_REF):
  8109. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8110. if n < 0 {
  8111. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8112. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8113. }
  8114. return int32(_XML_ERROR_BAD_CHAR_REF)
  8115. }
  8116. if !(isCdata != 0) && n == int32(0x20) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8117. break
  8118. }
  8119. n = XXmlUtf8Encode(tls, n, bp+8)
  8120. /* The XmlEncode() functions can never return 0 here. That
  8121. * error return happens if the code point passed in is either
  8122. * negative or greater than or equal to 0x110000. The
  8123. * XmlCharRefNumber() functions will all return a number
  8124. * strictly less than 0x110000 or a negative value if an error
  8125. * occurred. The negative value is intercepted above, so
  8126. * XmlEncode() is never passed a value it might return an
  8127. * error for.
  8128. */
  8129. i = 0
  8130. for {
  8131. if !(i < n) {
  8132. break
  8133. }
  8134. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8135. v3 = 0
  8136. } else {
  8137. v5 = pool + 24
  8138. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8139. *(*uintptr)(unsafe.Pointer(v5))++
  8140. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8141. v3 = libc.Int32FromInt32(1)
  8142. }
  8143. if !(v3 != 0) {
  8144. return int32(_XML_ERROR_NO_MEMORY)
  8145. }
  8146. goto _2
  8147. _2:
  8148. ;
  8149. i++
  8150. }
  8151. case int32(m_XML_TOK_DATA_CHARS):
  8152. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8153. return int32(_XML_ERROR_NO_MEMORY)
  8154. }
  8155. case -int32(3):
  8156. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8157. /* fall through */
  8158. fallthrough
  8159. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8160. fallthrough
  8161. case int32(m_XML_TOK_DATA_NEWLINE):
  8162. if !(isCdata != 0) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8163. break
  8164. }
  8165. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8166. v6 = 0
  8167. } else {
  8168. v8 = pool + 24
  8169. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8170. *(*uintptr)(unsafe.Pointer(v8))++
  8171. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8(0x20)
  8172. v6 = libc.Int32FromInt32(1)
  8173. }
  8174. if !(v6 != 0) {
  8175. return int32(_XML_ERROR_NO_MEMORY)
  8176. }
  8177. case int32(m_XML_TOK_ENTITY_REF):
  8178. *(*TXML_Char)(unsafe.Pointer(bp + 12)) = libc.Uint8FromInt32((*(*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)))
  8179. if *(*TXML_Char)(unsafe.Pointer(bp + 12)) != 0 {
  8180. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8181. * so there is no amplification and hence recording without
  8182. * protection. */
  8183. _accountingDiffTolerated(tls, parser, tok, bp+12, bp+12+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8184. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8185. v9 = 0
  8186. } else {
  8187. v11 = pool + 24
  8188. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8189. *(*uintptr)(unsafe.Pointer(v11))++
  8190. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 12))
  8191. v9 = libc.Int32FromInt32(1)
  8192. }
  8193. if !(v9 != 0) {
  8194. return int32(_XML_ERROR_NO_MEMORY)
  8195. }
  8196. break
  8197. }
  8198. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8199. if !(name != 0) {
  8200. return int32(_XML_ERROR_NO_MEMORY)
  8201. }
  8202. entity = _lookup(tls, parser, dtd, name, uint64(0))
  8203. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  8204. /* First, determine if a check for an existing declaration is needed;
  8205. if yes, check that the entity exists, and that it is internal.
  8206. */
  8207. if pool == dtd+160 { /* are we called from prolog? */
  8208. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8209. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8210. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8211. } else {
  8212. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8213. }
  8214. }
  8215. checkEntityDecl = libc.BoolUint8(v13 && v12 != 0)
  8216. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8217. checkEntityDecl = libc.BoolUint8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8218. }
  8219. if checkEntityDecl != 0 {
  8220. if !(entity != 0) {
  8221. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8222. } else {
  8223. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8224. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8225. }
  8226. }
  8227. } else {
  8228. if !(entity != 0) {
  8229. /* Cannot report skipped entity here - see comments on
  8230. parser->m_skippedEntityHandler.
  8231. if (parser->m_skippedEntityHandler)
  8232. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8233. */
  8234. /* Cannot call the default handler because this would be
  8235. out of sync with the call to the startElementHandler.
  8236. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8237. reportDefault(parser, enc, ptr, next);
  8238. */
  8239. break
  8240. }
  8241. }
  8242. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8243. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8244. /* It does not appear that this line can be executed.
  8245. *
  8246. * The "if (entity->open)" check catches recursive entity
  8247. * definitions. In order to be called with an open
  8248. * entity, it must have gone through this code before and
  8249. * been through the recursive call to
  8250. * appendAttributeValue() some lines below. That call
  8251. * sets the local encoding ("enc") to the parser's
  8252. * internal encoding (internal_utf8 or internal_utf16),
  8253. * which can never be the same as the principle encoding.
  8254. * It doesn't appear there is another code path that gets
  8255. * here with entity->open being TRUE.
  8256. *
  8257. * Since it is not certain that this logic is watertight,
  8258. * we keep the line and merely exclude it from coverage
  8259. * tests.
  8260. */
  8261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8262. }
  8263. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8264. }
  8265. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8266. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8268. }
  8269. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8270. }
  8271. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8272. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8273. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8274. }
  8275. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8276. } else {
  8277. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8278. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8279. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8280. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8281. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8282. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8283. if result != 0 {
  8284. return result
  8285. }
  8286. }
  8287. default:
  8288. /* The only token returned by XmlAttributeValueTok() that does
  8289. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8290. * Getting that would require an entity name to contain an
  8291. * incomplete XML character (e.g. \xE2\x82); however previous
  8292. * tokenisers will have already recognised and rejected such
  8293. * names before XmlAttributeValueTok() gets a look-in. This
  8294. * default case should be retained as a safety net, but the code
  8295. * excluded from coverage tests.
  8296. *
  8297. * LCOV_EXCL_START
  8298. */
  8299. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8300. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8301. }
  8302. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8303. /* LCOV_EXCL_STOP */
  8304. }
  8305. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8306. goto _1
  8307. _1:
  8308. }
  8309. /* not reached */
  8310. return r
  8311. }
  8312. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8313. bp := tls.Alloc(16)
  8314. defer tls.Free(16)
  8315. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8316. var i, n, oldInEntityValue, tok int32
  8317. var result _XML_Error
  8318. var _ /* buf at bp+8 */ [4]TXML_Char
  8319. var _ /* next at bp+0 */ uintptr
  8320. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8321. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8322. pool = dtd + 208
  8323. result = int32(_XML_ERROR_NONE)
  8324. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8325. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8326. /* never return Null for the value argument in EntityDeclHandler,
  8327. since this would indicate an external entity; therefore we
  8328. have to make sure that entityValuePool.start is not null */
  8329. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8330. if !(_poolGrow(tls, pool) != 0) {
  8331. return int32(_XML_ERROR_NO_MEMORY)
  8332. }
  8333. }
  8334. for {
  8335. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8336. 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)
  8337. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8338. _accountingOnAbort(tls, parser)
  8339. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8340. goto endEntityValue
  8341. }
  8342. switch tok {
  8343. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8344. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8345. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8346. if !(name != 0) {
  8347. result = int32(_XML_ERROR_NO_MEMORY)
  8348. goto endEntityValue
  8349. }
  8350. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  8351. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8352. if !(entity != 0) {
  8353. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8354. /* cannot report skipped entity here - see comments on
  8355. parser->m_skippedEntityHandler
  8356. if (parser->m_skippedEntityHandler)
  8357. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8358. */
  8359. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8360. goto endEntityValue
  8361. }
  8362. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8363. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8364. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8365. }
  8366. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8367. goto endEntityValue
  8368. }
  8369. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8370. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8371. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8372. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8373. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8374. 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) {
  8375. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8376. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8377. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8378. goto endEntityValue
  8379. }
  8380. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8381. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8382. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8383. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8384. }
  8385. } else {
  8386. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8387. }
  8388. } else {
  8389. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8390. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8391. 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))
  8392. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8393. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8394. if result != 0 {
  8395. goto endEntityValue
  8396. }
  8397. }
  8398. break
  8399. }
  8400. /* In the internal subset, PE references are not legal
  8401. within markup declarations, e.g entity values in this case. */
  8402. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8403. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8404. goto endEntityValue
  8405. case -int32(4):
  8406. result = int32(_XML_ERROR_NONE)
  8407. goto endEntityValue
  8408. case int32(m_XML_TOK_ENTITY_REF):
  8409. fallthrough
  8410. case int32(m_XML_TOK_DATA_CHARS):
  8411. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8412. result = int32(_XML_ERROR_NO_MEMORY)
  8413. goto endEntityValue
  8414. }
  8415. case -int32(3):
  8416. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8417. /* fall through */
  8418. fallthrough
  8419. case int32(m_XML_TOK_DATA_NEWLINE):
  8420. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8421. result = int32(_XML_ERROR_NO_MEMORY)
  8422. goto endEntityValue
  8423. }
  8424. v3 = pool + 24
  8425. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8426. *(*uintptr)(unsafe.Pointer(v3))++
  8427. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8428. case int32(m_XML_TOK_CHAR_REF):
  8429. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8430. if n < 0 {
  8431. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8432. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8433. }
  8434. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8435. goto endEntityValue
  8436. }
  8437. n = XXmlUtf8Encode(tls, n, bp+8)
  8438. /* The XmlEncode() functions can never return 0 here. That
  8439. * error return happens if the code point passed in is either
  8440. * negative or greater than or equal to 0x110000. The
  8441. * XmlCharRefNumber() functions will all return a number
  8442. * strictly less than 0x110000 or a negative value if an error
  8443. * occurred. The negative value is intercepted above, so
  8444. * XmlEncode() is never passed a value it might return an
  8445. * error for.
  8446. */
  8447. i = 0
  8448. for {
  8449. if !(i < n) {
  8450. break
  8451. }
  8452. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8453. result = int32(_XML_ERROR_NO_MEMORY)
  8454. goto endEntityValue
  8455. }
  8456. v6 = pool + 24
  8457. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8458. *(*uintptr)(unsafe.Pointer(v6))++
  8459. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8460. goto _4
  8461. _4:
  8462. ;
  8463. i++
  8464. }
  8465. case -int32(1):
  8466. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8467. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8468. }
  8469. result = int32(_XML_ERROR_INVALID_TOKEN)
  8470. goto endEntityValue
  8471. case m_XML_TOK_INVALID:
  8472. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8473. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8474. }
  8475. result = int32(_XML_ERROR_INVALID_TOKEN)
  8476. goto endEntityValue
  8477. default:
  8478. /* This default case should be unnecessary -- all the tokens
  8479. * that XmlEntityValueTok() can return have their own explicit
  8480. * cases -- but should be retained for safety. We do however
  8481. * exclude it from the coverage statistics.
  8482. *
  8483. * LCOV_EXCL_START
  8484. */
  8485. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8486. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8487. }
  8488. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8489. goto endEntityValue
  8490. /* LCOV_EXCL_STOP */
  8491. }
  8492. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8493. goto _1
  8494. _1:
  8495. }
  8496. goto endEntityValue
  8497. endEntityValue:
  8498. ;
  8499. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8500. return result
  8501. }
  8502. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8503. var p, v2, v3, v4, v5 uintptr
  8504. _, _, _, _, _ = p, v2, v3, v4, v5
  8505. for {
  8506. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8507. return
  8508. }
  8509. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8510. break
  8511. }
  8512. goto _1
  8513. _1:
  8514. ;
  8515. s++
  8516. }
  8517. p = s
  8518. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8519. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8520. v2 = p
  8521. p++
  8522. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8523. s++
  8524. v3 = s
  8525. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8526. s++
  8527. }
  8528. } else {
  8529. v4 = p
  8530. p++
  8531. v5 = s
  8532. s++
  8533. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8534. }
  8535. }
  8536. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8537. }
  8538. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8539. var data, target, tem uintptr
  8540. _, _, _ = data, target, tem
  8541. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8542. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8543. _reportDefault(tls, parser, enc, start, end)
  8544. }
  8545. return int32(1)
  8546. }
  8547. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8548. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8549. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8550. if !(target != 0) {
  8551. return 0
  8552. }
  8553. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8554. 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)))
  8555. if !(data != 0) {
  8556. return 0
  8557. }
  8558. _normalizeLines(tls, data)
  8559. (*(*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)
  8560. _poolClear(tls, parser+784)
  8561. return int32(1)
  8562. }
  8563. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8564. var data uintptr
  8565. _ = data
  8566. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8567. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8568. _reportDefault(tls, parser, enc, start, end)
  8569. }
  8570. return int32(1)
  8571. }
  8572. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8573. if !(data != 0) {
  8574. return 0
  8575. }
  8576. _normalizeLines(tls, data)
  8577. (*(*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)
  8578. _poolClear(tls, parser+784)
  8579. return int32(1)
  8580. }
  8581. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8582. bp := tls.Alloc(16)
  8583. defer tls.Free(16)
  8584. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8585. var convert_res _XML_Convert_Result
  8586. var eventEndPP, eventPP uintptr
  8587. var _ /* dataPtr at bp+8 */ uintptr
  8588. _, _, _ = convert_res, eventEndPP, eventPP
  8589. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8590. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8591. eventPP = parser + 544
  8592. eventEndPP = parser + 552
  8593. } else {
  8594. /* To get here, two things must be true; the parser must be
  8595. * using a character encoding that is not the same as the
  8596. * encoding passed in, and the encoding passed in must need
  8597. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8598. * is defined). The only occasions on which the encoding passed
  8599. * in is not the same as the parser's encoding are when it is
  8600. * the internal encoding (e.g. a previously defined parameter
  8601. * entity, already converted to internal format). This by
  8602. * definition doesn't need conversion, so the whole branch never
  8603. * gets executed.
  8604. *
  8605. * For safety's sake we don't delete these lines and merely
  8606. * exclude them from coverage statistics.
  8607. *
  8608. * LCOV_EXCL_START
  8609. */
  8610. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8611. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8612. /* LCOV_EXCL_STOP */
  8613. }
  8614. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8615. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8616. 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)
  8617. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8618. (*(*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)))
  8619. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8620. }
  8621. } else {
  8622. (*(*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)))))
  8623. }
  8624. }
  8625. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8626. var att, temp uintptr
  8627. var count, i int32
  8628. _, _, _, _ = att, count, i, temp
  8629. if value != 0 || isId != 0 {
  8630. i = 0
  8631. for {
  8632. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8633. break
  8634. }
  8635. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8636. return int32(1)
  8637. }
  8638. goto _1
  8639. _1:
  8640. ;
  8641. i++
  8642. }
  8643. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8644. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8645. }
  8646. }
  8647. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8648. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8649. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8650. (*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))
  8651. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8652. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8653. return 0
  8654. }
  8655. } else {
  8656. /* Detect and prevent integer overflow */
  8657. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m_INT_MAX)/libc.Int32FromInt32(2) {
  8658. return 0
  8659. }
  8660. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8661. /* Detect and prevent integer overflow.
  8662. * The preprocessor guard addresses the "always false" warning
  8663. * from -Wtype-limits on platforms where
  8664. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8665. 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))
  8666. if temp == libc.UintptrFromInt32(0) {
  8667. return 0
  8668. }
  8669. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8670. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8671. }
  8672. }
  8673. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8674. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8675. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8676. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8677. if !(isCdata != 0) {
  8678. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8679. }
  8680. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8681. return int32(1)
  8682. }
  8683. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8684. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8685. var v3, v6 int32
  8686. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8687. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8688. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8689. for {
  8690. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8691. break
  8692. }
  8693. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8694. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8695. for {
  8696. if !(s != name) {
  8697. break
  8698. }
  8699. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8700. v3 = 0
  8701. } else {
  8702. v5 = dtd + 160 + 24
  8703. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8704. *(*uintptr)(unsafe.Pointer(v5))++
  8705. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8706. v3 = libc.Int32FromInt32(1)
  8707. }
  8708. if !(v3 != 0) {
  8709. return 0
  8710. }
  8711. goto _2
  8712. _2:
  8713. ;
  8714. s++
  8715. }
  8716. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8717. v6 = 0
  8718. } else {
  8719. v8 = dtd + 160 + 24
  8720. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8721. *(*uintptr)(unsafe.Pointer(v8))++
  8722. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8('\000')
  8723. v6 = libc.Int32FromInt32(1)
  8724. }
  8725. if !(v6 != 0) {
  8726. return 0
  8727. }
  8728. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8729. if !(prefix != 0) {
  8730. return 0
  8731. }
  8732. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8733. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8734. } else {
  8735. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8736. }
  8737. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8738. break
  8739. }
  8740. goto _1
  8741. _1:
  8742. ;
  8743. name++
  8744. }
  8745. return int32(1)
  8746. }
  8747. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8748. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8749. var i, j, v1, v6, v9 int32
  8750. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8751. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8752. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8753. v1 = 0
  8754. } else {
  8755. v3 = dtd + 160 + 24
  8756. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8757. *(*uintptr)(unsafe.Pointer(v3))++
  8758. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8759. v1 = libc.Int32FromInt32(1)
  8760. }
  8761. if !(v1 != 0) {
  8762. return libc.UintptrFromInt32(0)
  8763. }
  8764. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8765. if !(name != 0) {
  8766. return libc.UintptrFromInt32(0)
  8767. }
  8768. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8769. name++
  8770. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8771. if !(id != 0) {
  8772. return libc.UintptrFromInt32(0)
  8773. }
  8774. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8775. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8776. } else {
  8777. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8778. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8779. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  8780. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8781. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  8782. } else {
  8783. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  8784. }
  8785. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8786. } else {
  8787. i = 0
  8788. for {
  8789. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8790. break
  8791. }
  8792. /* attributes without prefix are *not* in the default namespace */
  8793. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8794. j = 0
  8795. for {
  8796. if !(j < i) {
  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. v6 = 0
  8801. } else {
  8802. v8 = dtd + 160 + 24
  8803. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8804. *(*uintptr)(unsafe.Pointer(v8))++
  8805. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8806. v6 = libc.Int32FromInt32(1)
  8807. }
  8808. if !(v6 != 0) {
  8809. return libc.UintptrFromInt32(0)
  8810. }
  8811. goto _5
  8812. _5:
  8813. ;
  8814. j++
  8815. }
  8816. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8817. v9 = 0
  8818. } else {
  8819. v11 = dtd + 160 + 24
  8820. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8821. *(*uintptr)(unsafe.Pointer(v11))++
  8822. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8('\000')
  8823. v9 = libc.Int32FromInt32(1)
  8824. }
  8825. if !(v9 != 0) {
  8826. return libc.UintptrFromInt32(0)
  8827. }
  8828. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8829. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8830. return libc.UintptrFromInt32(0)
  8831. }
  8832. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).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. break
  8838. }
  8839. goto _4
  8840. _4:
  8841. ;
  8842. i++
  8843. }
  8844. }
  8845. }
  8846. }
  8847. return id
  8848. }
  8849. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8850. bp := tls.Alloc(16)
  8851. defer tls.Free(16)
  8852. 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
  8853. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8854. var needSep TXML_Bool
  8855. var v12, v28 bool
  8856. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8857. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8858. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8859. needSep = libc.Uint8FromInt32(0)
  8860. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8861. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8862. v1 = 0
  8863. } else {
  8864. v3 = parser + 784 + 24
  8865. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8866. *(*uintptr)(unsafe.Pointer(v3))++
  8867. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(m_ASCII_EQUALS)
  8868. v1 = libc.Int32FromInt32(1)
  8869. }
  8870. if !(v1 != 0) {
  8871. return libc.UintptrFromInt32(0)
  8872. }
  8873. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8874. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8875. len1--
  8876. }
  8877. i = 0
  8878. for {
  8879. if !(i < len1) {
  8880. break
  8881. }
  8882. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8883. v5 = 0
  8884. } else {
  8885. v7 = parser + 784 + 24
  8886. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8887. *(*uintptr)(unsafe.Pointer(v7))++
  8888. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8889. v5 = libc.Int32FromInt32(1)
  8890. }
  8891. if !(v5 != 0) {
  8892. /* Because of memory caching, I don't believe this line can be
  8893. * executed.
  8894. *
  8895. * This is part of a loop copying the default prefix binding
  8896. * URI into the parser's temporary string pool. Previously,
  8897. * that URI was copied into the same string pool, with a
  8898. * terminating NUL character, as part of setContext(). When
  8899. * the pool was cleared, that leaves a block definitely big
  8900. * enough to hold the URI on the free block list of the pool.
  8901. * The URI copy in getContext() therefore cannot run out of
  8902. * memory.
  8903. *
  8904. * If the pool is used between the setContext() and
  8905. * getContext() calls, the worst it can do is leave a bigger
  8906. * block on the front of the free list. Given that this is
  8907. * all somewhat inobvious and program logic can be changed, we
  8908. * don't delete the line but we do exclude it from the test
  8909. * coverage statistics.
  8910. */
  8911. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  8912. }
  8913. goto _4
  8914. _4:
  8915. ;
  8916. i++
  8917. }
  8918. needSep = libc.Uint8FromInt32(1)
  8919. }
  8920. _hashTableIterInit(tls, bp, dtd+120)
  8921. for {
  8922. prefix = _hashTableIterNext(tls, bp)
  8923. if !(prefix != 0) {
  8924. break
  8925. }
  8926. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  8927. /* This test appears to be (justifiable) paranoia. There does
  8928. * not seem to be a way of injecting a prefix without a binding
  8929. * that doesn't get errored long before this function is called.
  8930. * The test should remain for safety's sake, so we instead
  8931. * exclude the following line from the coverage statistics.
  8932. */
  8933. goto _8 /* LCOV_EXCL_LINE */
  8934. }
  8935. if v12 = needSep != 0; v12 {
  8936. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8937. v9 = 0
  8938. } else {
  8939. v11 = parser + 784 + 24
  8940. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8941. *(*uintptr)(unsafe.Pointer(v11))++
  8942. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8(m_ASCII_FF)
  8943. v9 = libc.Int32FromInt32(1)
  8944. }
  8945. }
  8946. if v12 && !(v9 != 0) {
  8947. return libc.UintptrFromInt32(0)
  8948. }
  8949. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  8950. for {
  8951. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8952. break
  8953. }
  8954. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8955. v14 = 0
  8956. } else {
  8957. v16 = parser + 784 + 24
  8958. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8959. *(*uintptr)(unsafe.Pointer(v16))++
  8960. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8961. v14 = libc.Int32FromInt32(1)
  8962. }
  8963. if !(v14 != 0) {
  8964. return libc.UintptrFromInt32(0)
  8965. }
  8966. goto _13
  8967. _13:
  8968. ;
  8969. s++
  8970. }
  8971. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8972. v17 = 0
  8973. } else {
  8974. v19 = parser + 784 + 24
  8975. v18 = *(*uintptr)(unsafe.Pointer(v19))
  8976. *(*uintptr)(unsafe.Pointer(v19))++
  8977. *(*TXML_Char)(unsafe.Pointer(v18)) = uint8(m_ASCII_EQUALS)
  8978. v17 = libc.Int32FromInt32(1)
  8979. }
  8980. if !(v17 != 0) {
  8981. return libc.UintptrFromInt32(0)
  8982. }
  8983. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  8984. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8985. len11--
  8986. }
  8987. i1 = 0
  8988. for {
  8989. if !(i1 < len11) {
  8990. break
  8991. }
  8992. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8993. v21 = 0
  8994. } else {
  8995. v23 = parser + 784 + 24
  8996. v22 = *(*uintptr)(unsafe.Pointer(v23))
  8997. *(*uintptr)(unsafe.Pointer(v23))++
  8998. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  8999. v21 = libc.Int32FromInt32(1)
  9000. }
  9001. if !(v21 != 0) {
  9002. return libc.UintptrFromInt32(0)
  9003. }
  9004. goto _20
  9005. _20:
  9006. ;
  9007. i1++
  9008. }
  9009. needSep = libc.Uint8FromInt32(1)
  9010. goto _8
  9011. _8:
  9012. }
  9013. _hashTableIterInit(tls, bp, dtd)
  9014. for {
  9015. e = _hashTableIterNext(tls, bp)
  9016. if !(e != 0) {
  9017. break
  9018. }
  9019. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9020. goto _24
  9021. }
  9022. if v28 = needSep != 0; v28 {
  9023. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9024. v25 = 0
  9025. } else {
  9026. v27 = parser + 784 + 24
  9027. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9028. *(*uintptr)(unsafe.Pointer(v27))++
  9029. *(*TXML_Char)(unsafe.Pointer(v26)) = uint8(m_ASCII_FF)
  9030. v25 = libc.Int32FromInt32(1)
  9031. }
  9032. }
  9033. if v28 && !(v25 != 0) {
  9034. return libc.UintptrFromInt32(0)
  9035. }
  9036. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9037. for {
  9038. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9039. break
  9040. }
  9041. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9042. v30 = 0
  9043. } else {
  9044. v32 = parser + 784 + 24
  9045. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9046. *(*uintptr)(unsafe.Pointer(v32))++
  9047. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9048. v30 = libc.Int32FromInt32(1)
  9049. }
  9050. if !(v30 != 0) {
  9051. return uintptr(0)
  9052. }
  9053. goto _29
  9054. _29:
  9055. ;
  9056. s1++
  9057. }
  9058. needSep = libc.Uint8FromInt32(1)
  9059. goto _24
  9060. _24:
  9061. }
  9062. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9063. v33 = 0
  9064. } else {
  9065. v35 = parser + 784 + 24
  9066. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9067. *(*uintptr)(unsafe.Pointer(v35))++
  9068. *(*TXML_Char)(unsafe.Pointer(v34)) = uint8('\000')
  9069. v33 = libc.Int32FromInt32(1)
  9070. }
  9071. if !(v33 != 0) {
  9072. return libc.UintptrFromInt32(0)
  9073. }
  9074. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9075. }
  9076. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9077. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9078. var v1, v11, v14, v4, v8 int32
  9079. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9080. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9081. s = context
  9082. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9083. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9084. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9085. v1 = 0
  9086. } else {
  9087. v3 = parser + 784 + 24
  9088. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9089. *(*uintptr)(unsafe.Pointer(v3))++
  9090. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  9091. v1 = libc.Int32FromInt32(1)
  9092. }
  9093. if !(v1 != 0) {
  9094. return libc.Uint8FromInt32(0)
  9095. }
  9096. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  9097. if e != 0 {
  9098. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9099. }
  9100. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9101. s++
  9102. }
  9103. context = s
  9104. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9105. } else {
  9106. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9107. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  9108. prefix = dtd + 304
  9109. } else {
  9110. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9111. v4 = 0
  9112. } else {
  9113. v6 = parser + 784 + 24
  9114. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9115. *(*uintptr)(unsafe.Pointer(v6))++
  9116. *(*TXML_Char)(unsafe.Pointer(v5)) = uint8('\000')
  9117. v4 = libc.Int32FromInt32(1)
  9118. }
  9119. if !(v4 != 0) {
  9120. return libc.Uint8FromInt32(0)
  9121. }
  9122. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  9123. if !(prefix != 0) {
  9124. return libc.Uint8FromInt32(0)
  9125. }
  9126. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  9127. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9128. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9129. return libc.Uint8FromInt32(0)
  9130. }
  9131. }
  9132. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9133. }
  9134. context = s + uintptr(1)
  9135. for {
  9136. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9137. break
  9138. }
  9139. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9140. v8 = 0
  9141. } else {
  9142. v10 = parser + 784 + 24
  9143. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9144. *(*uintptr)(unsafe.Pointer(v10))++
  9145. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9146. v8 = libc.Int32FromInt32(1)
  9147. }
  9148. if !(v8 != 0) {
  9149. return libc.Uint8FromInt32(0)
  9150. }
  9151. goto _7
  9152. _7:
  9153. ;
  9154. context++
  9155. }
  9156. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9157. v11 = 0
  9158. } else {
  9159. v13 = parser + 784 + 24
  9160. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9161. *(*uintptr)(unsafe.Pointer(v13))++
  9162. *(*TXML_Char)(unsafe.Pointer(v12)) = uint8('\000')
  9163. v11 = libc.Int32FromInt32(1)
  9164. }
  9165. if !(v11 != 0) {
  9166. return libc.Uint8FromInt32(0)
  9167. }
  9168. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  9169. return libc.Uint8FromInt32(0)
  9170. }
  9171. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  9172. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9173. context++
  9174. }
  9175. s = context
  9176. } else {
  9177. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  9178. v14 = 0
  9179. } else {
  9180. v16 = parser + 784 + 24
  9181. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9182. *(*uintptr)(unsafe.Pointer(v16))++
  9183. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9184. v14 = libc.Int32FromInt32(1)
  9185. }
  9186. if !(v14 != 0) {
  9187. return libc.Uint8FromInt32(0)
  9188. }
  9189. s++
  9190. }
  9191. }
  9192. }
  9193. return libc.Uint8FromInt32(1)
  9194. }
  9195. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9196. var p, s, v2, v3 uintptr
  9197. _, _, _, _ = p, s, v2, v3
  9198. p = publicId
  9199. s = publicId
  9200. for {
  9201. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9202. break
  9203. }
  9204. switch libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) {
  9205. case int32(0x20):
  9206. fallthrough
  9207. case int32(0xD):
  9208. fallthrough
  9209. case int32(0xA):
  9210. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9211. v2 = p
  9212. p++
  9213. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0x20)
  9214. }
  9215. default:
  9216. v3 = p
  9217. p++
  9218. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9219. }
  9220. goto _1
  9221. _1:
  9222. ;
  9223. s++
  9224. }
  9225. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9226. p--
  9227. }
  9228. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  9229. }
  9230. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9231. var p uintptr
  9232. _ = p
  9233. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  9234. if p == libc.UintptrFromInt32(0) {
  9235. return p
  9236. }
  9237. _poolInit(tls, p+160, ms)
  9238. _poolInit(tls, p+208, ms)
  9239. _hashTableInit(tls, p, ms)
  9240. _hashTableInit(tls, p+40, ms)
  9241. _hashTableInit(tls, p+80, ms)
  9242. _hashTableInit(tls, p+120, ms)
  9243. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9244. _hashTableInit(tls, p+264, ms)
  9245. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9246. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9247. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9248. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9249. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9250. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9251. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9252. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9253. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9254. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9255. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9256. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9257. return p
  9258. }
  9259. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9260. bp := tls.Alloc(16)
  9261. defer tls.Free(16)
  9262. var e uintptr
  9263. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9264. _ = e
  9265. _hashTableIterInit(tls, bp, p+40)
  9266. for {
  9267. e = _hashTableIterNext(tls, bp)
  9268. if !(e != 0) {
  9269. break
  9270. }
  9271. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9272. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9273. }
  9274. goto _1
  9275. _1:
  9276. }
  9277. _hashTableClear(tls, p)
  9278. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9279. _hashTableClear(tls, p+264)
  9280. _hashTableClear(tls, p+40)
  9281. _hashTableClear(tls, p+80)
  9282. _hashTableClear(tls, p+120)
  9283. _poolClear(tls, p+160)
  9284. _poolClear(tls, p+208)
  9285. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9286. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9287. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9288. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9289. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9290. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9291. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9292. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9293. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9294. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9295. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9296. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9297. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9298. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9299. }
  9300. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9301. bp := tls.Alloc(16)
  9302. defer tls.Free(16)
  9303. var e uintptr
  9304. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9305. _ = e
  9306. _hashTableIterInit(tls, bp, p+40)
  9307. for {
  9308. e = _hashTableIterNext(tls, bp)
  9309. if !(e != 0) {
  9310. break
  9311. }
  9312. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9313. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9314. }
  9315. goto _1
  9316. _1:
  9317. }
  9318. _hashTableDestroy(tls, p)
  9319. _hashTableDestroy(tls, p+264)
  9320. _hashTableDestroy(tls, p+40)
  9321. _hashTableDestroy(tls, p+80)
  9322. _hashTableDestroy(tls, p+120)
  9323. _poolDestroy(tls, p+160)
  9324. _poolDestroy(tls, p+208)
  9325. if isDocEntity != 0 {
  9326. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9327. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9328. }
  9329. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9330. }
  9331. // C documentation
  9332. //
  9333. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9334. // The new DTD has already been initialized.
  9335. // */
  9336. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9337. bp := tls.Alloc(16)
  9338. defer tls.Free(16)
  9339. var i, v3, v7 int32
  9340. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9341. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9342. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9343. /* Copy the prefix table. */
  9344. _hashTableIterInit(tls, bp, oldDtd+120)
  9345. for {
  9346. oldP = _hashTableIterNext(tls, bp)
  9347. if !(oldP != 0) {
  9348. break
  9349. }
  9350. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9351. if !(name != 0) {
  9352. return 0
  9353. }
  9354. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  9355. return 0
  9356. }
  9357. goto _1
  9358. _1:
  9359. }
  9360. _hashTableIterInit(tls, bp, oldDtd+80)
  9361. /* Copy the attribute id table. */
  9362. for {
  9363. oldA = _hashTableIterNext(tls, bp)
  9364. if !(oldA != 0) {
  9365. break
  9366. }
  9367. /* Remember to allocate the scratch byte before the name. */
  9368. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  9369. v3 = 0
  9370. } else {
  9371. v5 = newDtd + 160 + 24
  9372. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9373. *(*uintptr)(unsafe.Pointer(v5))++
  9374. *(*TXML_Char)(unsafe.Pointer(v4)) = uint8('\000')
  9375. v3 = libc.Int32FromInt32(1)
  9376. }
  9377. if !(v3 != 0) {
  9378. return 0
  9379. }
  9380. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9381. if !(name1 != 0) {
  9382. return 0
  9383. }
  9384. name1++
  9385. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  9386. if !(newA != 0) {
  9387. return 0
  9388. }
  9389. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9390. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9391. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9392. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  9393. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  9394. } else {
  9395. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  9396. }
  9397. }
  9398. goto _2
  9399. _2:
  9400. }
  9401. /* Copy the element type table. */
  9402. _hashTableIterInit(tls, bp, oldDtd+40)
  9403. for {
  9404. oldE = _hashTableIterNext(tls, bp)
  9405. if !(oldE != 0) {
  9406. break
  9407. }
  9408. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9409. if !(name2 != 0) {
  9410. return 0
  9411. }
  9412. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  9413. if !(newE != 0) {
  9414. return 0
  9415. }
  9416. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9417. (*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))
  9418. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9419. return 0
  9420. }
  9421. }
  9422. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9423. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  9424. }
  9425. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9426. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9427. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9428. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9429. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  9430. }
  9431. i = 0
  9432. for {
  9433. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9434. break
  9435. }
  9436. (*(*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))
  9437. (*(*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
  9438. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  9439. (*(*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)
  9440. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  9441. return 0
  9442. }
  9443. } else {
  9444. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  9445. }
  9446. goto _8
  9447. _8:
  9448. ;
  9449. i++
  9450. }
  9451. goto _6
  9452. _6:
  9453. }
  9454. /* Copy the entity tables. */
  9455. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  9456. return 0
  9457. }
  9458. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  9459. return 0
  9460. }
  9461. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9462. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9463. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9464. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9465. /* Don't want deep copying for scaffolding */
  9466. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9467. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9468. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9469. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9470. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9471. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9472. return int32(1)
  9473. }
  9474. /* End dtdCopy */
  9475. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9476. bp := tls.Alloc(16)
  9477. defer tls.Free(16)
  9478. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9479. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9480. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9481. cachedOldBase = libc.UintptrFromInt32(0)
  9482. cachedNewBase = libc.UintptrFromInt32(0)
  9483. _hashTableIterInit(tls, bp, oldTable)
  9484. for {
  9485. oldE = _hashTableIterNext(tls, bp)
  9486. if !(oldE != 0) {
  9487. break
  9488. }
  9489. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9490. if !(name != 0) {
  9491. return 0
  9492. }
  9493. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  9494. if !(newE != 0) {
  9495. return 0
  9496. }
  9497. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9498. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9499. if !(tem != 0) {
  9500. return 0
  9501. }
  9502. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9503. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9504. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9505. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9506. } else {
  9507. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9508. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9509. if !(tem != 0) {
  9510. return 0
  9511. }
  9512. v2 = tem
  9513. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9514. cachedNewBase = v2
  9515. }
  9516. }
  9517. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9518. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9519. if !(tem != 0) {
  9520. return 0
  9521. }
  9522. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9523. }
  9524. } else {
  9525. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9526. if !(tem1 != 0) {
  9527. return 0
  9528. }
  9529. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9530. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9531. }
  9532. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9533. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9534. if !(tem2 != 0) {
  9535. return 0
  9536. }
  9537. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9538. }
  9539. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9540. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9541. goto _1
  9542. _1:
  9543. }
  9544. return int32(1)
  9545. }
  9546. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9547. for {
  9548. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9549. break
  9550. }
  9551. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9552. return libc.Uint8FromInt32(1)
  9553. }
  9554. goto _1
  9555. _1:
  9556. ;
  9557. s1++
  9558. s2++
  9559. }
  9560. return libc.Uint8FromInt32(0)
  9561. }
  9562. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9563. var len1 Tsize_t
  9564. _ = len1
  9565. len1 = uint64(0)
  9566. for {
  9567. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9568. break
  9569. }
  9570. goto _1
  9571. _1:
  9572. ;
  9573. s++
  9574. len1++
  9575. }
  9576. return len1
  9577. }
  9578. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9579. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9580. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9581. }
  9582. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9583. bp := tls.Alloc(80)
  9584. defer tls.Free(80)
  9585. var _ /* key at bp+56 */ Tsipkey
  9586. var _ /* state at bp+0 */ Tsiphash
  9587. _ = __ccgo_fp(_sip24_valid)
  9588. _copy_salt_to_sipkey(tls, parser, bp+56)
  9589. _sip24_init(tls, bp, bp+56)
  9590. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9591. return _sip24_final(tls, bp)
  9592. }
  9593. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9594. var h, mask, newHash, newMask uint64
  9595. var i, j, newSize, tsize, tsize1 Tsize_t
  9596. var newPower, step uint8
  9597. var newV uintptr
  9598. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9599. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9600. if !(createSize != 0) {
  9601. return libc.UintptrFromInt32(0)
  9602. }
  9603. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9604. /* table->size is a power of 2 */
  9605. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9606. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9607. (*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)
  9608. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9609. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9610. return libc.UintptrFromInt32(0)
  9611. }
  9612. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9613. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9614. } else {
  9615. h = _hash(tls, parser, name)
  9616. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9617. step = uint8(0)
  9618. i = h & mask
  9619. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9620. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9621. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9622. }
  9623. if !(step != 0) {
  9624. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9625. }
  9626. if i < uint64(step) {
  9627. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9628. } else {
  9629. i -= uint64(step)
  9630. }
  9631. }
  9632. if !(createSize != 0) {
  9633. return libc.UintptrFromInt32(0)
  9634. }
  9635. /* check for overflow (table is half full) */
  9636. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9637. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9638. /* Detect and prevent invalid shift */
  9639. if uint64(newPower) >= libc.Uint64FromInt64(8)*libc.Uint64FromInt32(8) {
  9640. return libc.UintptrFromInt32(0)
  9641. }
  9642. newSize = libc.Uint64FromInt32(1) << newPower
  9643. newMask = newSize - uint64(1)
  9644. /* Detect and prevent integer overflow */
  9645. if newSize > libc.Uint64FromInt32(-libc.Int32FromInt32(1))/libc.Uint64FromInt64(8) {
  9646. return libc.UintptrFromInt32(0)
  9647. }
  9648. tsize1 = newSize * uint64(8)
  9649. 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)
  9650. if !(newV != 0) {
  9651. return libc.UintptrFromInt32(0)
  9652. }
  9653. libc.Xmemset(tls, newV, 0, tsize1)
  9654. i = uint64(0)
  9655. for {
  9656. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9657. break
  9658. }
  9659. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9660. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9661. j = newHash & newMask
  9662. step = uint8(0)
  9663. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9664. if !(step != 0) {
  9665. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9666. }
  9667. if j < uint64(step) {
  9668. j += newSize - uint64(step)
  9669. } else {
  9670. j -= uint64(step)
  9671. }
  9672. }
  9673. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9674. }
  9675. goto _2
  9676. _2:
  9677. ;
  9678. i++
  9679. }
  9680. (*(*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)
  9681. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9682. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9683. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9684. i = h & newMask
  9685. step = uint8(0)
  9686. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9687. if !(step != 0) {
  9688. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9689. }
  9690. if i < uint64(step) {
  9691. i += newSize - uint64(step)
  9692. } else {
  9693. i -= uint64(step)
  9694. }
  9695. }
  9696. }
  9697. }
  9698. *(*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)
  9699. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9700. return libc.UintptrFromInt32(0)
  9701. }
  9702. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9703. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9704. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9705. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9706. }
  9707. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9708. var i Tsize_t
  9709. _ = i
  9710. i = uint64(0)
  9711. for {
  9712. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9713. break
  9714. }
  9715. (*(*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)))
  9716. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9717. goto _1
  9718. _1:
  9719. ;
  9720. i++
  9721. }
  9722. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9723. }
  9724. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9725. var i Tsize_t
  9726. _ = i
  9727. i = uint64(0)
  9728. for {
  9729. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9730. break
  9731. }
  9732. (*(*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)))
  9733. goto _1
  9734. _1:
  9735. ;
  9736. i++
  9737. }
  9738. (*(*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)
  9739. }
  9740. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9741. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9742. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9743. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9744. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9745. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9746. }
  9747. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9748. var v1 uintptr
  9749. _ = v1
  9750. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9751. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9752. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9753. } else {
  9754. v1 = libc.UintptrFromInt32(0)
  9755. }
  9756. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9757. }
  9758. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9759. var tem, v1, v2 uintptr
  9760. _, _, _ = tem, v1, v2
  9761. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9762. v2 = iter
  9763. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9764. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9765. tem = *(*uintptr)(unsafe.Pointer(v1))
  9766. if tem != 0 {
  9767. return tem
  9768. }
  9769. }
  9770. return libc.UintptrFromInt32(0)
  9771. }
  9772. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9773. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9774. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9775. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9776. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9777. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9778. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9779. }
  9780. func _poolClear(tls *libc.TLS, pool uintptr) {
  9781. var p, tem uintptr
  9782. _, _ = p, tem
  9783. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9784. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9785. } else {
  9786. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9787. for p != 0 {
  9788. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9789. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9790. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9791. p = tem
  9792. }
  9793. }
  9794. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9795. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9796. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9797. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9798. }
  9799. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9800. var p, tem, tem1 uintptr
  9801. _, _, _ = p, tem, tem1
  9802. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9803. for p != 0 {
  9804. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9805. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9806. p = tem
  9807. }
  9808. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9809. for p != 0 {
  9810. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9811. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9812. p = tem1
  9813. }
  9814. }
  9815. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9816. bp := tls.Alloc(16)
  9817. defer tls.Free(16)
  9818. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9819. var convert_res _XML_Convert_Result
  9820. _ = convert_res
  9821. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9822. return libc.UintptrFromInt32(0)
  9823. }
  9824. for {
  9825. 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)
  9826. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9827. break
  9828. }
  9829. if !(_poolGrow(tls, pool) != 0) {
  9830. return libc.UintptrFromInt32(0)
  9831. }
  9832. goto _1
  9833. _1:
  9834. }
  9835. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9836. }
  9837. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9838. var v1, v4, v5 uintptr
  9839. var v3 int32
  9840. _, _, _, _ = v1, v3, v4, v5
  9841. for {
  9842. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9843. v3 = 0
  9844. } else {
  9845. v5 = pool + 24
  9846. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9847. *(*uintptr)(unsafe.Pointer(v5))++
  9848. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9849. v3 = libc.Int32FromInt32(1)
  9850. }
  9851. if !(v3 != 0) {
  9852. return libc.UintptrFromInt32(0)
  9853. }
  9854. goto _2
  9855. _2:
  9856. ;
  9857. v1 = s
  9858. s++
  9859. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9860. break
  9861. }
  9862. }
  9863. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9864. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9865. return s
  9866. }
  9867. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9868. var v2 int32
  9869. var v3, v4 uintptr
  9870. _, _, _ = v2, v3, v4
  9871. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9872. /* The following line is unreachable given the current usage of
  9873. * poolCopyStringN(). Currently it is called from exactly one
  9874. * place to copy the text of a simple general entity. By that
  9875. * point, the name of the entity is already stored in the pool, so
  9876. * pool->ptr cannot be NULL.
  9877. *
  9878. * If poolCopyStringN() is used elsewhere as it well might be,
  9879. * this line may well become executable again. Regardless, this
  9880. * sort of check shouldn't be removed lightly, so we just exclude
  9881. * it from the coverage statistics.
  9882. */
  9883. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9884. }
  9885. for {
  9886. if !(n > 0) {
  9887. break
  9888. }
  9889. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9890. v2 = 0
  9891. } else {
  9892. v4 = pool + 24
  9893. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9894. *(*uintptr)(unsafe.Pointer(v4))++
  9895. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9896. v2 = libc.Int32FromInt32(1)
  9897. }
  9898. if !(v2 != 0) {
  9899. return libc.UintptrFromInt32(0)
  9900. }
  9901. goto _1
  9902. _1:
  9903. ;
  9904. n--
  9905. s++
  9906. }
  9907. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9908. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9909. return s
  9910. }
  9911. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9912. var v1 int32
  9913. var v2, v3 uintptr
  9914. _, _, _ = v1, v2, v3
  9915. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  9916. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9917. v1 = 0
  9918. } else {
  9919. v3 = pool + 24
  9920. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9921. *(*uintptr)(unsafe.Pointer(v3))++
  9922. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  9923. v1 = libc.Int32FromInt32(1)
  9924. }
  9925. if !(v1 != 0) {
  9926. return libc.UintptrFromInt32(0)
  9927. }
  9928. s++
  9929. }
  9930. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9931. }
  9932. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9933. var v1, v2 uintptr
  9934. _, _ = v1, v2
  9935. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  9936. return libc.UintptrFromInt32(0)
  9937. }
  9938. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9939. return libc.UintptrFromInt32(0)
  9940. }
  9941. v2 = pool + 24
  9942. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9943. *(*uintptr)(unsafe.Pointer(v2))++
  9944. *(*TXML_Char)(unsafe.Pointer(v1)) = uint8(0)
  9945. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9946. }
  9947. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  9948. var bytesToAllocate, stretchedBlockSize int32
  9949. var stretch Tsize_t
  9950. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  9951. /* Unprotected math would be:
  9952. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  9953. **
  9954. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  9955. ** For a + b * c we check b * c in isolation first, so that addition of a
  9956. ** on top has no chance of making us accept a small non-negative number
  9957. */
  9958. stretch = uint64(1) /* can be 4 bytes */
  9959. if blockSize <= 0 {
  9960. return uint64(0)
  9961. }
  9962. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m_INT_MAX)/stretch) {
  9963. return uint64(0)
  9964. }
  9965. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  9966. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  9967. if bytesToAllocate < 0 {
  9968. return uint64(0)
  9969. }
  9970. return libc.Uint64FromInt32(bytesToAllocate)
  9971. return r
  9972. }
  9973. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  9974. var blockSize, blockSize1 int32
  9975. var bytesToAllocate, bytesToAllocate1 Tsize_t
  9976. var offsetInsideBlock Tptrdiff_t
  9977. var tem, tem1, temp uintptr
  9978. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  9979. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  9980. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  9981. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9982. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9983. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  9984. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9985. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9986. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9987. return libc.Uint8FromInt32(1)
  9988. }
  9989. 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) {
  9990. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9991. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9992. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9993. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  9994. 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))
  9995. (*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))
  9996. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9997. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9998. return libc.Uint8FromInt32(1)
  9999. }
  10000. }
  10001. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  10002. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10003. /* NOTE: Needs to be calculated prior to calling `realloc`
  10004. to avoid dangling pointers: */
  10005. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10006. if blockSize < 0 {
  10007. /* This condition traps a situation where either more than
  10008. * INT_MAX/2 bytes have already been allocated. This isn't
  10009. * readily testable, since it is unlikely that an average
  10010. * machine will have that much memory, so we exclude it from the
  10011. * coverage statistics.
  10012. */
  10013. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10014. }
  10015. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10016. if bytesToAllocate == uint64(0) {
  10017. return libc.Uint8FromInt32(0)
  10018. }
  10019. 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)))
  10020. if temp == libc.UintptrFromInt32(0) {
  10021. return libc.Uint8FromInt32(0)
  10022. }
  10023. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10024. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10025. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  10026. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  10027. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10028. } else {
  10029. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10030. if blockSize1 < 0 {
  10031. /* This condition traps a situation where either more than
  10032. * INT_MAX bytes have already been allocated (which is prevented
  10033. * by various pieces of program logic, not least this one, never
  10034. * mind the unlikelihood of actually having that much memory) or
  10035. * the pool control fields have been corrupted (which could
  10036. * conceivably happen in an extremely buggy user handler
  10037. * function). Either way it isn't readily testable, so we
  10038. * exclude it from the coverage statistics.
  10039. */
  10040. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10041. }
  10042. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10043. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10044. } else {
  10045. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10046. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10047. return libc.Uint8FromInt32(0)
  10048. }
  10049. blockSize1 *= int32(2)
  10050. }
  10051. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10052. if bytesToAllocate1 == uint64(0) {
  10053. return libc.Uint8FromInt32(0)
  10054. }
  10055. 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)
  10056. if !(tem1 != 0) {
  10057. return libc.Uint8FromInt32(0)
  10058. }
  10059. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10060. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10061. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10062. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10063. 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))
  10064. }
  10065. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10066. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  10067. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  10068. }
  10069. return libc.Uint8FromInt32(1)
  10070. }
  10071. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10072. var dtd, me, parent, temp, v2 uintptr
  10073. var next, v3, v4, v5 int32
  10074. var v1 uint32
  10075. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10076. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10077. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10078. (*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))
  10079. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10080. return -int32(1)
  10081. }
  10082. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10083. }
  10084. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10085. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10086. /* Detect and prevent integer overflow */
  10087. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromUint32(2) {
  10088. return -int32(1)
  10089. }
  10090. /* Detect and prevent integer overflow.
  10091. * The preprocessor guard addresses the "always false" warning
  10092. * from -Wtype-limits on platforms where
  10093. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10094. 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))
  10095. if temp == libc.UintptrFromInt32(0) {
  10096. return -int32(1)
  10097. }
  10098. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  10099. } else {
  10100. 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))
  10101. if temp == libc.UintptrFromInt32(0) {
  10102. return -int32(1)
  10103. }
  10104. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10105. }
  10106. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10107. }
  10108. v2 = dtd + 344
  10109. v1 = *(*uint32)(unsafe.Pointer(v2))
  10110. *(*uint32)(unsafe.Pointer(v2))++
  10111. next = libc.Int32FromUint32(v1)
  10112. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  10113. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10114. 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
  10115. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10116. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  10117. }
  10118. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10119. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10120. }
  10121. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10122. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10123. }
  10124. v5 = libc.Int32FromInt32(0)
  10125. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10126. v4 = v5
  10127. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10128. v3 = v4
  10129. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10130. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10131. return next
  10132. }
  10133. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10134. var allocsize Tsize_t
  10135. var cn, src_node int32
  10136. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10137. var i uint32
  10138. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10139. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10140. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10141. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10142. * strings. */
  10143. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10144. /* Detect and prevent integer overflow.
  10145. * The preprocessor guard addresses the "always false" warning
  10146. * from -Wtype-limits on platforms where
  10147. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10148. if uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*uint64(32) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*uint64(1) {
  10149. return libc.UintptrFromInt32(0)
  10150. }
  10151. allocsize = uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1)
  10152. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10153. if !(ret != 0) {
  10154. return libc.UintptrFromInt32(0)
  10155. }
  10156. /* What follows is an iterative implementation (of what was previously done
  10157. * recursively in a dedicated function called "build_node". The old recursive
  10158. * build_node could be forced into stack exhaustion from input as small as a
  10159. * few megabyte, and so that was a security issue. Hence, a function call
  10160. * stack is avoided now by resolving recursion.)
  10161. *
  10162. * The iterative approach works as follows:
  10163. *
  10164. * - We have two writing pointers, both walking up the result array; one does
  10165. * the work, the other creates "jobs" for its colleague to do, and leads
  10166. * the way:
  10167. *
  10168. * - The faster one, pointer jobDest, always leads and writes "what job
  10169. * to do" by the other, once they reach that place in the
  10170. * array: leader "jobDest" stores the source node array index (relative
  10171. * to array dtd->scaffold) in field "numchildren".
  10172. *
  10173. * - The slower one, pointer dest, looks at the value stored in the
  10174. * "numchildren" field (which actually holds a source node array index
  10175. * at that time) and puts the real data from dtd->scaffold in.
  10176. *
  10177. * - Before the loop starts, jobDest writes source array index 0
  10178. * (where the root node is located) so that dest will have something to do
  10179. * when it starts operation.
  10180. *
  10181. * - Whenever nodes with children are encountered, jobDest appends
  10182. * them as new jobs, in order. As a result, tree node siblings are
  10183. * adjacent in the resulting array, for example:
  10184. *
  10185. * [0] root, has two children
  10186. * [1] first child of 0, has three children
  10187. * [3] first child of 1, does not have children
  10188. * [4] second child of 1, does not have children
  10189. * [5] third child of 1, does not have children
  10190. * [2] second child of 0, does not have children
  10191. *
  10192. * Or (the same data) presented in flat array view:
  10193. *
  10194. * [0] root, has two children
  10195. *
  10196. * [1] first child of 0, has three children
  10197. * [2] second child of 0, does not have children
  10198. *
  10199. * [3] first child of 1, does not have children
  10200. * [4] second child of 1, does not have children
  10201. * [5] third child of 1, does not have children
  10202. *
  10203. * - The algorithm repeats until all target array indices have been processed.
  10204. */
  10205. dest = ret /* tree node writing location, moves upwards */
  10206. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10207. jobDest = ret /* next free writing location in target array */
  10208. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  10209. /* Add the starting job, the root node (index 0) of the source tree */
  10210. v1 = jobDest
  10211. jobDest += 32
  10212. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10213. for {
  10214. if !(dest < destLimit) {
  10215. break
  10216. }
  10217. /* Retrieve source tree array index from job storage */
  10218. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10219. /* Convert item */
  10220. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  10221. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  10222. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10223. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10224. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  10225. for {
  10226. v4 = str
  10227. str++
  10228. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10229. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10230. break
  10231. }
  10232. src++
  10233. goto _3
  10234. _3:
  10235. }
  10236. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10237. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10238. } else {
  10239. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10240. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  10241. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10242. /* Append scaffold indices of children to array */
  10243. i = uint32(0)
  10244. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  10245. for {
  10246. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10247. break
  10248. }
  10249. v6 = jobDest
  10250. jobDest += 32
  10251. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10252. goto _5
  10253. _5:
  10254. ;
  10255. i++
  10256. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  10257. }
  10258. }
  10259. goto _2
  10260. _2:
  10261. ;
  10262. dest += 32
  10263. }
  10264. return ret
  10265. }
  10266. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10267. var dtd, name, ret uintptr
  10268. _, _, _ = dtd, name, ret
  10269. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10270. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  10271. if !(name != 0) {
  10272. return libc.UintptrFromInt32(0)
  10273. }
  10274. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  10275. if !(ret != 0) {
  10276. return libc.UintptrFromInt32(0)
  10277. }
  10278. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10279. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  10280. } else {
  10281. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  10282. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10283. return libc.UintptrFromInt32(0)
  10284. }
  10285. }
  10286. return ret
  10287. }
  10288. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10289. var charsRequired Tsize_t
  10290. var result uintptr
  10291. _, _ = charsRequired, result
  10292. charsRequired = uint64(0)
  10293. /* First determine how long the string is */
  10294. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10295. charsRequired++
  10296. }
  10297. /* Include the terminator */
  10298. charsRequired++
  10299. /* Now allocate space for the copy */
  10300. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint64(1))
  10301. if result == libc.UintptrFromInt32(0) {
  10302. return libc.UintptrFromInt32(0)
  10303. }
  10304. /* Copy the original into place */
  10305. libc.Xmemcpy(tls, result, s, charsRequired*uint64(1))
  10306. return result
  10307. }
  10308. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10309. var amplificationFactor, v1 float32
  10310. var countBytesOutput TXmlBigCount
  10311. _, _, _ = amplificationFactor, countBytesOutput, v1
  10312. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10313. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10314. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10315. } else {
  10316. v1 = libc.Float32FromFloat32(1)
  10317. }
  10318. amplificationFactor = v1
  10319. return amplificationFactor
  10320. }
  10321. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10322. bp := tls.Alloc(48)
  10323. defer tls.Free(48)
  10324. var amplificationFactor float32
  10325. var rootParser TXML_Parser
  10326. _, _ = amplificationFactor, rootParser
  10327. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10328. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10329. return
  10330. }
  10331. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10332. 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))
  10333. }
  10334. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10335. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10336. }
  10337. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10338. bp := tls.Alloc(64)
  10339. defer tls.Free(64)
  10340. var contextLength uint32
  10341. var ellipsisLength Tsize_t
  10342. var walker, v1 uintptr
  10343. var _ /* ellipis at bp+0 */ [5]uint8
  10344. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10345. if account == int32(_XML_ACCOUNT_DIRECT) {
  10346. v1 = __ccgo_ts + 1759
  10347. } else {
  10348. v1 = __ccgo_ts + 1763
  10349. }
  10350. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1808))
  10351. *(*[5]uint8)(unsafe.Pointer(bp)) = [5]uint8{'[', '.', '.', ']'}
  10352. ellipsisLength = libc.Uint64FromInt64(5) - libc.Uint64FromInt32(1)
  10353. contextLength = uint32(10)
  10354. /* Note: Performance is of no concern here */
  10355. walker = before
  10356. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int64(after)-int64(before) <= libc.Int64FromUint64(uint64(contextLength)+ellipsisLength+uint64(contextLength)) {
  10357. for {
  10358. if !(walker < after) {
  10359. break
  10360. }
  10361. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10362. goto _2
  10363. _2:
  10364. ;
  10365. walker++
  10366. }
  10367. } else {
  10368. for {
  10369. if !(walker < before+uintptr(contextLength)) {
  10370. break
  10371. }
  10372. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10373. goto _3
  10374. _3:
  10375. ;
  10376. walker++
  10377. }
  10378. libc.Xfprintf(tls, libc.Xstderr, bp, 0)
  10379. walker = after - uintptr(contextLength)
  10380. for {
  10381. if !(walker < after) {
  10382. break
  10383. }
  10384. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1809, libc.VaList(bp+16, XunsignedCharToPrintable(tls, *(*uint8)(unsafe.Pointer(walker)))))
  10385. goto _4
  10386. _4:
  10387. ;
  10388. walker++
  10389. }
  10390. }
  10391. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1812, 0)
  10392. }
  10393. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10394. bp := tls.Alloc(16)
  10395. defer tls.Free(16)
  10396. var additionTarget, v1 uintptr
  10397. var amplificationFactor float32
  10398. var bytesMore Tptrdiff_t
  10399. var countBytesOutput TXmlBigCount
  10400. var isDirect int32
  10401. var rootParser TXML_Parser
  10402. var tolerated TXML_Bool
  10403. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10404. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10405. /* Note: We need to check the token type *first* to be sure that
  10406. * we can even access variable <after>, safely.
  10407. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10408. switch tok {
  10409. case m_XML_TOK_INVALID:
  10410. fallthrough
  10411. case -int32(1):
  10412. fallthrough
  10413. case -int32(2):
  10414. fallthrough
  10415. case -int32(4):
  10416. return libc.Uint8FromInt32(1)
  10417. }
  10418. if account == int32(_XML_ACCOUNT_NONE) {
  10419. return libc.Uint8FromInt32(1)
  10420. }
  10421. rootParser = _getRootParserOf(tls, originParser, bp)
  10422. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10423. bytesMore = int64(after) - int64(before)
  10424. if isDirect != 0 {
  10425. v1 = rootParser + 928
  10426. } else {
  10427. v1 = rootParser + 928 + 8
  10428. }
  10429. additionTarget = v1
  10430. /* Detect and avoid integer overflow */
  10431. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt64(bytesMore) {
  10432. return libc.Uint8FromInt32(0)
  10433. }
  10434. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt64(bytesMore)
  10435. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10436. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10437. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10438. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10439. _accountingReportStats(tls, rootParser, __ccgo_ts+1808)
  10440. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10441. }
  10442. return tolerated
  10443. }
  10444. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10445. if !(parser != 0) {
  10446. return uint64(0)
  10447. }
  10448. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10449. }
  10450. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10451. if !(parser != 0) {
  10452. return uint64(0)
  10453. }
  10454. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10455. }
  10456. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10457. bp := tls.Alloc(96)
  10458. defer tls.Free(96)
  10459. var entityName, v1 uintptr
  10460. _, _ = entityName, v1
  10461. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10462. return
  10463. }
  10464. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10465. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10466. v1 = __ccgo_ts + 1815
  10467. } else {
  10468. v1 = __ccgo_ts + 1817
  10469. }
  10470. 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))
  10471. }
  10472. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10473. var rootParser TXML_Parser
  10474. _ = rootParser
  10475. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10476. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10477. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10478. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10479. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10480. }
  10481. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1904, sourceLine)
  10482. }
  10483. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10484. var rootParser TXML_Parser
  10485. _ = rootParser
  10486. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10487. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1910, sourceLine)
  10488. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10489. }
  10490. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10491. var rootParser TXML_Parser
  10492. var stepsTakenUpwards uint32
  10493. _, _ = rootParser, stepsTakenUpwards
  10494. rootParser = parser
  10495. stepsTakenUpwards = uint32(0)
  10496. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10497. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10498. stepsTakenUpwards++
  10499. }
  10500. if outLevelDiff != libc.UintptrFromInt32(0) {
  10501. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10502. }
  10503. return rootParser
  10504. }
  10505. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10506. switch libc.Int32FromUint8(c) {
  10507. case 0:
  10508. return __ccgo_ts + 1916
  10509. case int32(1):
  10510. return __ccgo_ts + 1919
  10511. case int32(2):
  10512. return __ccgo_ts + 1923
  10513. case int32(3):
  10514. return __ccgo_ts + 1927
  10515. case int32(4):
  10516. return __ccgo_ts + 1931
  10517. case int32(5):
  10518. return __ccgo_ts + 1935
  10519. case int32(6):
  10520. return __ccgo_ts + 1939
  10521. case int32(7):
  10522. return __ccgo_ts + 1943
  10523. case int32(8):
  10524. return __ccgo_ts + 1947
  10525. case int32(9):
  10526. return __ccgo_ts + 1951
  10527. case int32(10):
  10528. return __ccgo_ts + 1954
  10529. case int32(11):
  10530. return __ccgo_ts + 1957
  10531. case int32(12):
  10532. return __ccgo_ts + 1961
  10533. case int32(13):
  10534. return __ccgo_ts + 1965
  10535. case int32(14):
  10536. return __ccgo_ts + 1968
  10537. case int32(15):
  10538. return __ccgo_ts + 1972
  10539. case int32(16):
  10540. return __ccgo_ts + 1976
  10541. case int32(17):
  10542. return __ccgo_ts + 1981
  10543. case int32(18):
  10544. return __ccgo_ts + 1986
  10545. case int32(19):
  10546. return __ccgo_ts + 1991
  10547. case int32(20):
  10548. return __ccgo_ts + 1996
  10549. case int32(21):
  10550. return __ccgo_ts + 2001
  10551. case int32(22):
  10552. return __ccgo_ts + 2006
  10553. case int32(23):
  10554. return __ccgo_ts + 2011
  10555. case int32(24):
  10556. return __ccgo_ts + 2016
  10557. case int32(25):
  10558. return __ccgo_ts + 2021
  10559. case int32(26):
  10560. return __ccgo_ts + 2026
  10561. case int32(27):
  10562. return __ccgo_ts + 2031
  10563. case int32(28):
  10564. return __ccgo_ts + 2036
  10565. case int32(29):
  10566. return __ccgo_ts + 2041
  10567. case int32(30):
  10568. return __ccgo_ts + 2046
  10569. case int32(31):
  10570. return __ccgo_ts + 2051
  10571. case int32(32):
  10572. return __ccgo_ts + 2056
  10573. case int32(33):
  10574. return __ccgo_ts + 2058
  10575. case int32(34):
  10576. return __ccgo_ts + 2060
  10577. case int32(35):
  10578. return __ccgo_ts + 2063
  10579. case int32(36):
  10580. return __ccgo_ts + 2065
  10581. case int32(37):
  10582. return __ccgo_ts + 1815
  10583. case int32(38):
  10584. return __ccgo_ts + 1817
  10585. case int32(39):
  10586. return __ccgo_ts + 2067
  10587. case int32(40):
  10588. return __ccgo_ts + 2069
  10589. case int32(41):
  10590. return __ccgo_ts + 2071
  10591. case int32(42):
  10592. return __ccgo_ts + 2073
  10593. case int32(43):
  10594. return __ccgo_ts + 2075
  10595. case int32(44):
  10596. return __ccgo_ts + 2077
  10597. case int32(45):
  10598. return __ccgo_ts + 2079
  10599. case int32(46):
  10600. return __ccgo_ts + 2081
  10601. case int32(47):
  10602. return __ccgo_ts + 2083
  10603. case int32(48):
  10604. return __ccgo_ts + 2085
  10605. case int32(49):
  10606. return __ccgo_ts + 2087
  10607. case int32(50):
  10608. return __ccgo_ts + 2089
  10609. case int32(51):
  10610. return __ccgo_ts + 2091
  10611. case int32(52):
  10612. return __ccgo_ts + 2093
  10613. case int32(53):
  10614. return __ccgo_ts + 2095
  10615. case int32(54):
  10616. return __ccgo_ts + 2097
  10617. case int32(55):
  10618. return __ccgo_ts + 2099
  10619. case int32(56):
  10620. return __ccgo_ts + 2101
  10621. case int32(57):
  10622. return __ccgo_ts + 2103
  10623. case int32(58):
  10624. return __ccgo_ts + 2105
  10625. case int32(59):
  10626. return __ccgo_ts + 2107
  10627. case int32(60):
  10628. return __ccgo_ts + 2109
  10629. case int32(61):
  10630. return __ccgo_ts + 2111
  10631. case int32(62):
  10632. return __ccgo_ts + 2113
  10633. case int32(63):
  10634. return __ccgo_ts + 2115
  10635. case int32(64):
  10636. return __ccgo_ts + 2117
  10637. case int32(65):
  10638. return __ccgo_ts + 2119
  10639. case int32(66):
  10640. return __ccgo_ts + 2121
  10641. case int32(67):
  10642. return __ccgo_ts + 2123
  10643. case int32(68):
  10644. return __ccgo_ts + 2125
  10645. case int32(69):
  10646. return __ccgo_ts + 2127
  10647. case int32(70):
  10648. return __ccgo_ts + 2129
  10649. case int32(71):
  10650. return __ccgo_ts + 2131
  10651. case int32(72):
  10652. return __ccgo_ts + 2133
  10653. case int32(73):
  10654. return __ccgo_ts + 2135
  10655. case int32(74):
  10656. return __ccgo_ts + 2137
  10657. case int32(75):
  10658. return __ccgo_ts + 2139
  10659. case int32(76):
  10660. return __ccgo_ts + 2141
  10661. case int32(77):
  10662. return __ccgo_ts + 2143
  10663. case int32(78):
  10664. return __ccgo_ts + 2145
  10665. case int32(79):
  10666. return __ccgo_ts + 2147
  10667. case int32(80):
  10668. return __ccgo_ts + 2149
  10669. case int32(81):
  10670. return __ccgo_ts + 2151
  10671. case int32(82):
  10672. return __ccgo_ts + 2153
  10673. case int32(83):
  10674. return __ccgo_ts + 2155
  10675. case int32(84):
  10676. return __ccgo_ts + 2157
  10677. case int32(85):
  10678. return __ccgo_ts + 2159
  10679. case int32(86):
  10680. return __ccgo_ts + 2161
  10681. case int32(87):
  10682. return __ccgo_ts + 2163
  10683. case int32(88):
  10684. return __ccgo_ts + 2165
  10685. case int32(89):
  10686. return __ccgo_ts + 2167
  10687. case int32(90):
  10688. return __ccgo_ts + 2169
  10689. case int32(91):
  10690. return __ccgo_ts + 2171
  10691. case int32(92):
  10692. return __ccgo_ts + 2173
  10693. case int32(93):
  10694. return __ccgo_ts + 2176
  10695. case int32(94):
  10696. return __ccgo_ts + 2178
  10697. case int32(95):
  10698. return __ccgo_ts + 2180
  10699. case int32(96):
  10700. return __ccgo_ts + 2182
  10701. case int32(97):
  10702. return __ccgo_ts + 2184
  10703. case int32(98):
  10704. return __ccgo_ts + 2186
  10705. case int32(99):
  10706. return __ccgo_ts + 2188
  10707. case int32(100):
  10708. return __ccgo_ts + 2190
  10709. case int32(101):
  10710. return __ccgo_ts + 2192
  10711. case int32(102):
  10712. return __ccgo_ts + 2194
  10713. case int32(103):
  10714. return __ccgo_ts + 2196
  10715. case int32(104):
  10716. return __ccgo_ts + 2198
  10717. case int32(105):
  10718. return __ccgo_ts + 2200
  10719. case int32(106):
  10720. return __ccgo_ts + 2202
  10721. case int32(107):
  10722. return __ccgo_ts + 2204
  10723. case int32(108):
  10724. return __ccgo_ts + 2206
  10725. case int32(109):
  10726. return __ccgo_ts + 2208
  10727. case int32(110):
  10728. return __ccgo_ts + 2210
  10729. case int32(111):
  10730. return __ccgo_ts + 2212
  10731. case int32(112):
  10732. return __ccgo_ts + 2214
  10733. case int32(113):
  10734. return __ccgo_ts + 2216
  10735. case int32(114):
  10736. return __ccgo_ts + 2218
  10737. case int32(115):
  10738. return __ccgo_ts + 2220
  10739. case int32(116):
  10740. return __ccgo_ts + 2222
  10741. case int32(117):
  10742. return __ccgo_ts + 2224
  10743. case int32(118):
  10744. return __ccgo_ts + 2226
  10745. case int32(119):
  10746. return __ccgo_ts + 2228
  10747. case int32(120):
  10748. return __ccgo_ts + 2230
  10749. case int32(121):
  10750. return __ccgo_ts + 2232
  10751. case int32(122):
  10752. return __ccgo_ts + 2234
  10753. case int32(123):
  10754. return __ccgo_ts + 2236
  10755. case int32(124):
  10756. return __ccgo_ts + 2238
  10757. case int32(125):
  10758. return __ccgo_ts + 2240
  10759. case int32(126):
  10760. return __ccgo_ts + 2242
  10761. case int32(127):
  10762. return __ccgo_ts + 2244
  10763. case int32(128):
  10764. return __ccgo_ts + 2249
  10765. case int32(129):
  10766. return __ccgo_ts + 2254
  10767. case int32(130):
  10768. return __ccgo_ts + 2259
  10769. case int32(131):
  10770. return __ccgo_ts + 2264
  10771. case int32(132):
  10772. return __ccgo_ts + 2269
  10773. case int32(133):
  10774. return __ccgo_ts + 2274
  10775. case int32(134):
  10776. return __ccgo_ts + 2279
  10777. case int32(135):
  10778. return __ccgo_ts + 2284
  10779. case int32(136):
  10780. return __ccgo_ts + 2289
  10781. case int32(137):
  10782. return __ccgo_ts + 2294
  10783. case int32(138):
  10784. return __ccgo_ts + 2299
  10785. case int32(139):
  10786. return __ccgo_ts + 2304
  10787. case int32(140):
  10788. return __ccgo_ts + 2309
  10789. case int32(141):
  10790. return __ccgo_ts + 2314
  10791. case int32(142):
  10792. return __ccgo_ts + 2319
  10793. case int32(143):
  10794. return __ccgo_ts + 2324
  10795. case int32(144):
  10796. return __ccgo_ts + 2329
  10797. case int32(145):
  10798. return __ccgo_ts + 2334
  10799. case int32(146):
  10800. return __ccgo_ts + 2339
  10801. case int32(147):
  10802. return __ccgo_ts + 2344
  10803. case int32(148):
  10804. return __ccgo_ts + 2349
  10805. case int32(149):
  10806. return __ccgo_ts + 2354
  10807. case int32(150):
  10808. return __ccgo_ts + 2359
  10809. case int32(151):
  10810. return __ccgo_ts + 2364
  10811. case int32(152):
  10812. return __ccgo_ts + 2369
  10813. case int32(153):
  10814. return __ccgo_ts + 2374
  10815. case int32(154):
  10816. return __ccgo_ts + 2379
  10817. case int32(155):
  10818. return __ccgo_ts + 2384
  10819. case int32(156):
  10820. return __ccgo_ts + 2389
  10821. case int32(157):
  10822. return __ccgo_ts + 2394
  10823. case int32(158):
  10824. return __ccgo_ts + 2399
  10825. case int32(159):
  10826. return __ccgo_ts + 2404
  10827. case int32(160):
  10828. return __ccgo_ts + 2409
  10829. case int32(161):
  10830. return __ccgo_ts + 2414
  10831. case int32(162):
  10832. return __ccgo_ts + 2419
  10833. case int32(163):
  10834. return __ccgo_ts + 2424
  10835. case int32(164):
  10836. return __ccgo_ts + 2429
  10837. case int32(165):
  10838. return __ccgo_ts + 2434
  10839. case int32(166):
  10840. return __ccgo_ts + 2439
  10841. case int32(167):
  10842. return __ccgo_ts + 2444
  10843. case int32(168):
  10844. return __ccgo_ts + 2449
  10845. case int32(169):
  10846. return __ccgo_ts + 2454
  10847. case int32(170):
  10848. return __ccgo_ts + 2459
  10849. case int32(171):
  10850. return __ccgo_ts + 2464
  10851. case int32(172):
  10852. return __ccgo_ts + 2469
  10853. case int32(173):
  10854. return __ccgo_ts + 2474
  10855. case int32(174):
  10856. return __ccgo_ts + 2479
  10857. case int32(175):
  10858. return __ccgo_ts + 2484
  10859. case int32(176):
  10860. return __ccgo_ts + 2489
  10861. case int32(177):
  10862. return __ccgo_ts + 2494
  10863. case int32(178):
  10864. return __ccgo_ts + 2499
  10865. case int32(179):
  10866. return __ccgo_ts + 2504
  10867. case int32(180):
  10868. return __ccgo_ts + 2509
  10869. case int32(181):
  10870. return __ccgo_ts + 2514
  10871. case int32(182):
  10872. return __ccgo_ts + 2519
  10873. case int32(183):
  10874. return __ccgo_ts + 2524
  10875. case int32(184):
  10876. return __ccgo_ts + 2529
  10877. case int32(185):
  10878. return __ccgo_ts + 2534
  10879. case int32(186):
  10880. return __ccgo_ts + 2539
  10881. case int32(187):
  10882. return __ccgo_ts + 2544
  10883. case int32(188):
  10884. return __ccgo_ts + 2549
  10885. case int32(189):
  10886. return __ccgo_ts + 2554
  10887. case int32(190):
  10888. return __ccgo_ts + 2559
  10889. case int32(191):
  10890. return __ccgo_ts + 2564
  10891. case int32(192):
  10892. return __ccgo_ts + 2569
  10893. case int32(193):
  10894. return __ccgo_ts + 2574
  10895. case int32(194):
  10896. return __ccgo_ts + 2579
  10897. case int32(195):
  10898. return __ccgo_ts + 2584
  10899. case int32(196):
  10900. return __ccgo_ts + 2589
  10901. case int32(197):
  10902. return __ccgo_ts + 2594
  10903. case int32(198):
  10904. return __ccgo_ts + 2599
  10905. case int32(199):
  10906. return __ccgo_ts + 2604
  10907. case int32(200):
  10908. return __ccgo_ts + 2609
  10909. case int32(201):
  10910. return __ccgo_ts + 2614
  10911. case int32(202):
  10912. return __ccgo_ts + 2619
  10913. case int32(203):
  10914. return __ccgo_ts + 2624
  10915. case int32(204):
  10916. return __ccgo_ts + 2629
  10917. case int32(205):
  10918. return __ccgo_ts + 2634
  10919. case int32(206):
  10920. return __ccgo_ts + 2639
  10921. case int32(207):
  10922. return __ccgo_ts + 2644
  10923. case int32(208):
  10924. return __ccgo_ts + 2649
  10925. case int32(209):
  10926. return __ccgo_ts + 2654
  10927. case int32(210):
  10928. return __ccgo_ts + 2659
  10929. case int32(211):
  10930. return __ccgo_ts + 2664
  10931. case int32(212):
  10932. return __ccgo_ts + 2669
  10933. case int32(213):
  10934. return __ccgo_ts + 2674
  10935. case int32(214):
  10936. return __ccgo_ts + 2679
  10937. case int32(215):
  10938. return __ccgo_ts + 2684
  10939. case int32(216):
  10940. return __ccgo_ts + 2689
  10941. case int32(217):
  10942. return __ccgo_ts + 2694
  10943. case int32(218):
  10944. return __ccgo_ts + 2699
  10945. case int32(219):
  10946. return __ccgo_ts + 2704
  10947. case int32(220):
  10948. return __ccgo_ts + 2709
  10949. case int32(221):
  10950. return __ccgo_ts + 2714
  10951. case int32(222):
  10952. return __ccgo_ts + 2719
  10953. case int32(223):
  10954. return __ccgo_ts + 2724
  10955. case int32(224):
  10956. return __ccgo_ts + 2729
  10957. case int32(225):
  10958. return __ccgo_ts + 2734
  10959. case int32(226):
  10960. return __ccgo_ts + 2739
  10961. case int32(227):
  10962. return __ccgo_ts + 2744
  10963. case int32(228):
  10964. return __ccgo_ts + 2749
  10965. case int32(229):
  10966. return __ccgo_ts + 2754
  10967. case int32(230):
  10968. return __ccgo_ts + 2759
  10969. case int32(231):
  10970. return __ccgo_ts + 2764
  10971. case int32(232):
  10972. return __ccgo_ts + 2769
  10973. case int32(233):
  10974. return __ccgo_ts + 2774
  10975. case int32(234):
  10976. return __ccgo_ts + 2779
  10977. case int32(235):
  10978. return __ccgo_ts + 2784
  10979. case int32(236):
  10980. return __ccgo_ts + 2789
  10981. case int32(237):
  10982. return __ccgo_ts + 2794
  10983. case int32(238):
  10984. return __ccgo_ts + 2799
  10985. case int32(239):
  10986. return __ccgo_ts + 2804
  10987. case int32(240):
  10988. return __ccgo_ts + 2809
  10989. case int32(241):
  10990. return __ccgo_ts + 2814
  10991. case int32(242):
  10992. return __ccgo_ts + 2819
  10993. case int32(243):
  10994. return __ccgo_ts + 2824
  10995. case int32(244):
  10996. return __ccgo_ts + 2829
  10997. case int32(245):
  10998. return __ccgo_ts + 2834
  10999. case int32(246):
  11000. return __ccgo_ts + 2839
  11001. case int32(247):
  11002. return __ccgo_ts + 2844
  11003. case int32(248):
  11004. return __ccgo_ts + 2849
  11005. case int32(249):
  11006. return __ccgo_ts + 2854
  11007. case int32(250):
  11008. return __ccgo_ts + 2859
  11009. case int32(251):
  11010. return __ccgo_ts + 2864
  11011. case int32(252):
  11012. return __ccgo_ts + 2869
  11013. case int32(253):
  11014. return __ccgo_ts + 2874
  11015. case int32(254):
  11016. return __ccgo_ts + 2879
  11017. case int32(255):
  11018. return __ccgo_ts + 2884
  11019. default:
  11020. /* never gets here */
  11021. return __ccgo_ts + 2889
  11022. }
  11023. /* never gets here */
  11024. return r
  11025. }
  11026. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint64) (r uint64) {
  11027. bp := tls.Alloc(16)
  11028. defer tls.Free(16)
  11029. var debugLevel uint64
  11030. var value, valueOrNull uintptr
  11031. var _ /* afterValue at bp+0 */ uintptr
  11032. _, _, _ = debugLevel, value, valueOrNull
  11033. valueOrNull = libc.Xgetenv(tls, variableName)
  11034. if valueOrNull == libc.UintptrFromInt32(0) {
  11035. return defaultDebugLevel
  11036. }
  11037. value = valueOrNull
  11038. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11039. *(*uintptr)(unsafe.Pointer(bp)) = value
  11040. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11041. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11042. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11043. return defaultDebugLevel
  11044. }
  11045. return debugLevel
  11046. }
  11047. const m_ASCII_01 = 0x30
  11048. const m_ASCII_11 = 0x31
  11049. const m_ASCII_21 = 0x32
  11050. const m_ASCII_31 = 0x33
  11051. const m_ASCII_81 = 0x38
  11052. const m_ASCII_91 = 0x39
  11053. const m_ASCII_B1 = 66
  11054. const m_ASCII_COLON1 = 0x3A
  11055. const m_ASCII_COMMA1 = 0x2C
  11056. const m_ASCII_EQUALS1 = 0x3D
  11057. const m_ASCII_EXCL1 = 0x21
  11058. const m_ASCII_FF1 = 0x0C
  11059. const m_ASCII_G1 = 71
  11060. const m_ASCII_HASH1 = 0x23
  11061. const m_ASCII_LPAREN1 = 0x28
  11062. const m_ASCII_P1 = 80
  11063. const m_ASCII_PERIOD1 = 0x2E
  11064. const m_ASCII_PIPE1 = 0x7C
  11065. const m_ASCII_Q1 = 81
  11066. const m_ASCII_RPAREN1 = 0x29
  11067. const m_ASCII_SLASH1 = 0x2F
  11068. const m_ASCII_U1 = 85
  11069. const m_ASCII_a1 = 0x61
  11070. const m_ASCII_c1 = 0x63
  11071. const m_ASCII_e1 = 0x65
  11072. const m_ASCII_g1 = 0x67
  11073. const m_ASCII_h1 = 0x68
  11074. const m_ASCII_l1 = 0x6C
  11075. const m_ASCII_m1 = 0x6D
  11076. const m_ASCII_n1 = 0x6E
  11077. const m_ASCII_o1 = 0x6F
  11078. const m_ASCII_p1 = 0x70
  11079. const m_ASCII_r1 = 0x72
  11080. const m_ASCII_s1 = 0x73
  11081. const m_ASCII_t1 = 0x74
  11082. const m_ASCII_w1 = 0x77
  11083. const m_ASCII_x1 = 0x78
  11084. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11085. const m_INT_MAX1 = 0x7fffffff
  11086. const m_UINT_MAX1 = 0xffffffff
  11087. /*
  11088. __ __ _
  11089. ___\ \/ /_ __ __ _| |_
  11090. / _ \\ /| '_ \ / _` | __|
  11091. | __// \| |_) | (_| | |_
  11092. \___/_/\_\ .__/ \__,_|\__|
  11093. |_| XML parser
  11094. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11095. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11096. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11097. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11098. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11099. Licensed under the MIT license:
  11100. Permission is hereby granted, free of charge, to any person obtaining
  11101. a copy of this software and associated documentation files (the
  11102. "Software"), to deal in the Software without restriction, including
  11103. without limitation the rights to use, copy, modify, merge, publish,
  11104. distribute, sublicense, and/or sell copies of the Software, and to permit
  11105. persons to whom the Software is furnished to do so, subject to the
  11106. following conditions:
  11107. The above copyright notice and this permission notice shall be included
  11108. in all copies or substantial portions of the Software.
  11109. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11110. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11111. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11112. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11113. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11114. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11115. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11116. */
  11117. /* Doesn't check:
  11118. that ,| are not mixed in a model group
  11119. content of literals
  11120. */
  11121. var _KW_ANY = [4]uint8{
  11122. 0: uint8(m_ASCII_A),
  11123. 1: uint8(m_ASCII_N),
  11124. 2: uint8(m_ASCII_Y),
  11125. }
  11126. var _KW_ATTLIST = [8]uint8{
  11127. 0: uint8(m_ASCII_A),
  11128. 1: uint8(m_ASCII_T),
  11129. 2: uint8(m_ASCII_T),
  11130. 3: uint8(m_ASCII_L),
  11131. 4: uint8(m_ASCII_I),
  11132. 5: uint8(m_ASCII_S),
  11133. 6: uint8(m_ASCII_T),
  11134. }
  11135. var _KW_CDATA = [6]uint8{
  11136. 0: uint8(m_ASCII_C),
  11137. 1: uint8(m_ASCII_D),
  11138. 2: uint8(m_ASCII_A),
  11139. 3: uint8(m_ASCII_T),
  11140. 4: uint8(m_ASCII_A),
  11141. }
  11142. var _KW_DOCTYPE = [8]uint8{
  11143. 0: uint8(m_ASCII_D),
  11144. 1: uint8(m_ASCII_O),
  11145. 2: uint8(m_ASCII_C),
  11146. 3: uint8(m_ASCII_T),
  11147. 4: uint8(m_ASCII_Y),
  11148. 5: uint8(m_ASCII_P1),
  11149. 6: uint8(m_ASCII_E),
  11150. }
  11151. var _KW_ELEMENT = [8]uint8{
  11152. 0: uint8(m_ASCII_E),
  11153. 1: uint8(m_ASCII_L),
  11154. 2: uint8(m_ASCII_E),
  11155. 3: uint8(m_ASCII_M),
  11156. 4: uint8(m_ASCII_E),
  11157. 5: uint8(m_ASCII_N),
  11158. 6: uint8(m_ASCII_T),
  11159. }
  11160. var _KW_EMPTY = [6]uint8{
  11161. 0: uint8(m_ASCII_E),
  11162. 1: uint8(m_ASCII_M),
  11163. 2: uint8(m_ASCII_P1),
  11164. 3: uint8(m_ASCII_T),
  11165. 4: uint8(m_ASCII_Y),
  11166. }
  11167. var _KW_ENTITIES = [9]uint8{
  11168. 0: uint8(m_ASCII_E),
  11169. 1: uint8(m_ASCII_N),
  11170. 2: uint8(m_ASCII_T),
  11171. 3: uint8(m_ASCII_I),
  11172. 4: uint8(m_ASCII_T),
  11173. 5: uint8(m_ASCII_I),
  11174. 6: uint8(m_ASCII_E),
  11175. 7: uint8(m_ASCII_S),
  11176. }
  11177. var _KW_ENTITY = [7]uint8{
  11178. 0: uint8(m_ASCII_E),
  11179. 1: uint8(m_ASCII_N),
  11180. 2: uint8(m_ASCII_T),
  11181. 3: uint8(m_ASCII_I),
  11182. 4: uint8(m_ASCII_T),
  11183. 5: uint8(m_ASCII_Y),
  11184. }
  11185. var _KW_FIXED = [6]uint8{
  11186. 0: uint8(m_ASCII_F),
  11187. 1: uint8(m_ASCII_I),
  11188. 2: uint8(m_ASCII_X),
  11189. 3: uint8(m_ASCII_E),
  11190. 4: uint8(m_ASCII_D),
  11191. }
  11192. var _KW_ID = [3]uint8{
  11193. 0: uint8(m_ASCII_I),
  11194. 1: uint8(m_ASCII_D),
  11195. }
  11196. var _KW_IDREF = [6]uint8{
  11197. 0: uint8(m_ASCII_I),
  11198. 1: uint8(m_ASCII_D),
  11199. 2: uint8(m_ASCII_R),
  11200. 3: uint8(m_ASCII_E),
  11201. 4: uint8(m_ASCII_F),
  11202. }
  11203. var _KW_IDREFS = [7]uint8{
  11204. 0: uint8(m_ASCII_I),
  11205. 1: uint8(m_ASCII_D),
  11206. 2: uint8(m_ASCII_R),
  11207. 3: uint8(m_ASCII_E),
  11208. 4: uint8(m_ASCII_F),
  11209. 5: uint8(m_ASCII_S),
  11210. }
  11211. var _KW_IGNORE = [7]uint8{
  11212. 0: uint8(m_ASCII_I),
  11213. 1: uint8(m_ASCII_G1),
  11214. 2: uint8(m_ASCII_N),
  11215. 3: uint8(m_ASCII_O),
  11216. 4: uint8(m_ASCII_R),
  11217. 5: uint8(m_ASCII_E),
  11218. }
  11219. var _KW_IMPLIED = [8]uint8{
  11220. 0: uint8(m_ASCII_I),
  11221. 1: uint8(m_ASCII_M),
  11222. 2: uint8(m_ASCII_P1),
  11223. 3: uint8(m_ASCII_L),
  11224. 4: uint8(m_ASCII_I),
  11225. 5: uint8(m_ASCII_E),
  11226. 6: uint8(m_ASCII_D),
  11227. }
  11228. var _KW_INCLUDE = [8]uint8{
  11229. 0: uint8(m_ASCII_I),
  11230. 1: uint8(m_ASCII_N),
  11231. 2: uint8(m_ASCII_C),
  11232. 3: uint8(m_ASCII_L),
  11233. 4: uint8(m_ASCII_U1),
  11234. 5: uint8(m_ASCII_D),
  11235. 6: uint8(m_ASCII_E),
  11236. }
  11237. var _KW_NDATA = [6]uint8{
  11238. 0: uint8(m_ASCII_N),
  11239. 1: uint8(m_ASCII_D),
  11240. 2: uint8(m_ASCII_A),
  11241. 3: uint8(m_ASCII_T),
  11242. 4: uint8(m_ASCII_A),
  11243. }
  11244. var _KW_NMTOKEN = [8]uint8{
  11245. 0: uint8(m_ASCII_N),
  11246. 1: uint8(m_ASCII_M),
  11247. 2: uint8(m_ASCII_T),
  11248. 3: uint8(m_ASCII_O),
  11249. 4: uint8(m_ASCII_K),
  11250. 5: uint8(m_ASCII_E),
  11251. 6: uint8(m_ASCII_N),
  11252. }
  11253. var _KW_NMTOKENS = [9]uint8{
  11254. 0: uint8(m_ASCII_N),
  11255. 1: uint8(m_ASCII_M),
  11256. 2: uint8(m_ASCII_T),
  11257. 3: uint8(m_ASCII_O),
  11258. 4: uint8(m_ASCII_K),
  11259. 5: uint8(m_ASCII_E),
  11260. 6: uint8(m_ASCII_N),
  11261. 7: uint8(m_ASCII_S),
  11262. }
  11263. var _KW_NOTATION = [9]uint8{
  11264. 0: uint8(m_ASCII_N),
  11265. 1: uint8(m_ASCII_O),
  11266. 2: uint8(m_ASCII_T),
  11267. 3: uint8(m_ASCII_A),
  11268. 4: uint8(m_ASCII_T),
  11269. 5: uint8(m_ASCII_I),
  11270. 6: uint8(m_ASCII_O),
  11271. 7: uint8(m_ASCII_N),
  11272. }
  11273. var _KW_PCDATA = [7]uint8{
  11274. 0: uint8(m_ASCII_P1),
  11275. 1: uint8(m_ASCII_C),
  11276. 2: uint8(m_ASCII_D),
  11277. 3: uint8(m_ASCII_A),
  11278. 4: uint8(m_ASCII_T),
  11279. 5: uint8(m_ASCII_A),
  11280. }
  11281. var _KW_PUBLIC = [7]uint8{
  11282. 0: uint8(m_ASCII_P1),
  11283. 1: uint8(m_ASCII_U1),
  11284. 2: uint8(m_ASCII_B1),
  11285. 3: uint8(m_ASCII_L),
  11286. 4: uint8(m_ASCII_I),
  11287. 5: uint8(m_ASCII_C),
  11288. }
  11289. var _KW_REQUIRED = [9]uint8{
  11290. 0: uint8(m_ASCII_R),
  11291. 1: uint8(m_ASCII_E),
  11292. 2: uint8(m_ASCII_Q1),
  11293. 3: uint8(m_ASCII_U1),
  11294. 4: uint8(m_ASCII_I),
  11295. 5: uint8(m_ASCII_R),
  11296. 6: uint8(m_ASCII_E),
  11297. 7: uint8(m_ASCII_D),
  11298. }
  11299. var _KW_SYSTEM = [7]uint8{
  11300. 0: uint8(m_ASCII_S),
  11301. 1: uint8(m_ASCII_Y),
  11302. 2: uint8(m_ASCII_S),
  11303. 3: uint8(m_ASCII_T),
  11304. 4: uint8(m_ASCII_E),
  11305. 5: uint8(m_ASCII_M),
  11306. }
  11307. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11308. switch tok {
  11309. case int32(m_XML_TOK_PROLOG_S):
  11310. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11311. return int32(_XML_ROLE_NONE)
  11312. case int32(m_XML_TOK_XML_DECL):
  11313. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11314. return int32(_XML_ROLE_XML_DECL)
  11315. case int32(m_XML_TOK_PI):
  11316. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11317. return int32(_XML_ROLE_PI)
  11318. case int32(m_XML_TOK_COMMENT):
  11319. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11320. return int32(_XML_ROLE_COMMENT)
  11321. case int32(m_XML_TOK_BOM):
  11322. return int32(_XML_ROLE_NONE)
  11323. case int32(m_XML_TOK_DECL_OPEN):
  11324. 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) {
  11325. break
  11326. }
  11327. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11328. return int32(_XML_ROLE_DOCTYPE_NONE)
  11329. case int32(m_XML_TOK_INSTANCE_START):
  11330. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11331. return int32(_XML_ROLE_INSTANCE_START)
  11332. }
  11333. return _common(tls, state, tok)
  11334. }
  11335. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11336. switch tok {
  11337. case int32(m_XML_TOK_PROLOG_S):
  11338. return int32(_XML_ROLE_NONE)
  11339. case int32(m_XML_TOK_PI):
  11340. return int32(_XML_ROLE_PI)
  11341. case int32(m_XML_TOK_COMMENT):
  11342. return int32(_XML_ROLE_COMMENT)
  11343. case int32(m_XML_TOK_BOM):
  11344. /* This case can never arise. To reach this role function, the
  11345. * parse must have passed through prolog0 and therefore have had
  11346. * some form of input, even if only a space. At that point, a
  11347. * byte order mark is no longer a valid character (though
  11348. * technically it should be interpreted as a non-breaking space),
  11349. * so will be rejected by the tokenizing stages.
  11350. */
  11351. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11352. case int32(m_XML_TOK_DECL_OPEN):
  11353. 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) {
  11354. break
  11355. }
  11356. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11357. return int32(_XML_ROLE_DOCTYPE_NONE)
  11358. case int32(m_XML_TOK_INSTANCE_START):
  11359. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11360. return int32(_XML_ROLE_INSTANCE_START)
  11361. }
  11362. return _common(tls, state, tok)
  11363. }
  11364. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11365. _ = ptr
  11366. _ = end
  11367. _ = enc
  11368. switch tok {
  11369. case int32(m_XML_TOK_PROLOG_S):
  11370. return int32(_XML_ROLE_NONE)
  11371. case int32(m_XML_TOK_PI):
  11372. return int32(_XML_ROLE_PI)
  11373. case int32(m_XML_TOK_COMMENT):
  11374. return int32(_XML_ROLE_COMMENT)
  11375. case int32(m_XML_TOK_INSTANCE_START):
  11376. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11377. return int32(_XML_ROLE_INSTANCE_START)
  11378. }
  11379. return _common(tls, state, tok)
  11380. }
  11381. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11382. _ = ptr
  11383. _ = end
  11384. _ = enc
  11385. switch tok {
  11386. case int32(m_XML_TOK_PROLOG_S):
  11387. return int32(_XML_ROLE_DOCTYPE_NONE)
  11388. case int32(m_XML_TOK_NAME):
  11389. fallthrough
  11390. case int32(m_XML_TOK_PREFIXED_NAME):
  11391. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11392. return int32(_XML_ROLE_DOCTYPE_NAME)
  11393. }
  11394. return _common(tls, state, tok)
  11395. }
  11396. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11397. switch tok {
  11398. case int32(m_XML_TOK_PROLOG_S):
  11399. return int32(_XML_ROLE_DOCTYPE_NONE)
  11400. case int32(m_XML_TOK_OPEN_BRACKET):
  11401. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11402. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11403. case int32(m_XML_TOK_DECL_CLOSE):
  11404. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11405. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11406. case int32(m_XML_TOK_NAME):
  11407. 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 {
  11408. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11409. return int32(_XML_ROLE_DOCTYPE_NONE)
  11410. }
  11411. 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 {
  11412. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11413. return int32(_XML_ROLE_DOCTYPE_NONE)
  11414. }
  11415. break
  11416. }
  11417. return _common(tls, state, tok)
  11418. }
  11419. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11420. _ = ptr
  11421. _ = end
  11422. _ = enc
  11423. switch tok {
  11424. case int32(m_XML_TOK_PROLOG_S):
  11425. return int32(_XML_ROLE_DOCTYPE_NONE)
  11426. case int32(m_XML_TOK_LITERAL):
  11427. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11428. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11429. }
  11430. return _common(tls, state, tok)
  11431. }
  11432. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11433. _ = ptr
  11434. _ = end
  11435. _ = enc
  11436. switch tok {
  11437. case int32(m_XML_TOK_PROLOG_S):
  11438. return int32(_XML_ROLE_DOCTYPE_NONE)
  11439. case int32(m_XML_TOK_LITERAL):
  11440. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11441. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11442. }
  11443. return _common(tls, state, tok)
  11444. }
  11445. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11446. _ = ptr
  11447. _ = end
  11448. _ = enc
  11449. switch tok {
  11450. case int32(m_XML_TOK_PROLOG_S):
  11451. return int32(_XML_ROLE_DOCTYPE_NONE)
  11452. case int32(m_XML_TOK_OPEN_BRACKET):
  11453. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11454. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11455. case int32(m_XML_TOK_DECL_CLOSE):
  11456. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11457. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11458. }
  11459. return _common(tls, state, tok)
  11460. }
  11461. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11462. _ = ptr
  11463. _ = end
  11464. _ = enc
  11465. switch tok {
  11466. case int32(m_XML_TOK_PROLOG_S):
  11467. return int32(_XML_ROLE_DOCTYPE_NONE)
  11468. case int32(m_XML_TOK_DECL_CLOSE):
  11469. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11470. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11471. }
  11472. return _common(tls, state, tok)
  11473. }
  11474. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11475. switch tok {
  11476. case int32(m_XML_TOK_PROLOG_S):
  11477. return int32(_XML_ROLE_NONE)
  11478. case int32(m_XML_TOK_DECL_OPEN):
  11479. 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 {
  11480. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11481. return int32(_XML_ROLE_ENTITY_NONE)
  11482. }
  11483. 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 {
  11484. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11485. return int32(_XML_ROLE_ATTLIST_NONE)
  11486. }
  11487. 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 {
  11488. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11489. return int32(_XML_ROLE_ELEMENT_NONE)
  11490. }
  11491. 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 {
  11492. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11493. return int32(_XML_ROLE_NOTATION_NONE)
  11494. }
  11495. case int32(m_XML_TOK_PI):
  11496. return int32(_XML_ROLE_PI)
  11497. case int32(m_XML_TOK_COMMENT):
  11498. return int32(_XML_ROLE_COMMENT)
  11499. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11500. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11501. case int32(m_XML_TOK_CLOSE_BRACKET):
  11502. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11503. return int32(_XML_ROLE_DOCTYPE_NONE)
  11504. case -int32(4):
  11505. return int32(_XML_ROLE_NONE)
  11506. }
  11507. return _common(tls, state, tok)
  11508. }
  11509. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11510. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11511. if tok == int32(m_XML_TOK_XML_DECL) {
  11512. return int32(_XML_ROLE_TEXT_DECL)
  11513. }
  11514. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11515. }
  11516. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11517. switch tok {
  11518. case int32(m_XML_TOK_COND_SECT_OPEN):
  11519. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11520. return int32(_XML_ROLE_NONE)
  11521. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11522. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11523. break
  11524. }
  11525. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  11526. return int32(_XML_ROLE_NONE)
  11527. case int32(m_XML_TOK_PROLOG_S):
  11528. return int32(_XML_ROLE_NONE)
  11529. case int32(m_XML_TOK_CLOSE_BRACKET):
  11530. case -int32(4):
  11531. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11532. break
  11533. }
  11534. return int32(_XML_ROLE_NONE)
  11535. default:
  11536. return _internalSubset(tls, state, tok, ptr, end, enc)
  11537. }
  11538. return _common(tls, state, tok)
  11539. }
  11540. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11541. _ = ptr
  11542. _ = end
  11543. _ = enc
  11544. switch tok {
  11545. case int32(m_XML_TOK_PROLOG_S):
  11546. return int32(_XML_ROLE_ENTITY_NONE)
  11547. case int32(m_XML_TOK_PERCENT):
  11548. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11549. return int32(_XML_ROLE_ENTITY_NONE)
  11550. case int32(m_XML_TOK_NAME):
  11551. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11552. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11553. }
  11554. return _common(tls, state, tok)
  11555. }
  11556. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11557. _ = ptr
  11558. _ = end
  11559. _ = enc
  11560. switch tok {
  11561. case int32(m_XML_TOK_PROLOG_S):
  11562. return int32(_XML_ROLE_ENTITY_NONE)
  11563. case int32(m_XML_TOK_NAME):
  11564. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11565. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11566. }
  11567. return _common(tls, state, tok)
  11568. }
  11569. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11570. switch tok {
  11571. case int32(m_XML_TOK_PROLOG_S):
  11572. return int32(_XML_ROLE_ENTITY_NONE)
  11573. case int32(m_XML_TOK_NAME):
  11574. 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 {
  11575. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11576. return int32(_XML_ROLE_ENTITY_NONE)
  11577. }
  11578. 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 {
  11579. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11580. return int32(_XML_ROLE_ENTITY_NONE)
  11581. }
  11582. case int32(m_XML_TOK_LITERAL):
  11583. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11584. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11585. return int32(_XML_ROLE_ENTITY_VALUE)
  11586. }
  11587. return _common(tls, state, tok)
  11588. }
  11589. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11590. _ = ptr
  11591. _ = end
  11592. _ = enc
  11593. switch tok {
  11594. case int32(m_XML_TOK_PROLOG_S):
  11595. return int32(_XML_ROLE_ENTITY_NONE)
  11596. case int32(m_XML_TOK_LITERAL):
  11597. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11598. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11599. }
  11600. return _common(tls, state, tok)
  11601. }
  11602. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11603. _ = ptr
  11604. _ = end
  11605. _ = enc
  11606. switch tok {
  11607. case int32(m_XML_TOK_PROLOG_S):
  11608. return int32(_XML_ROLE_ENTITY_NONE)
  11609. case int32(m_XML_TOK_LITERAL):
  11610. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11611. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11612. }
  11613. return _common(tls, state, tok)
  11614. }
  11615. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11616. var v1 uintptr
  11617. _ = v1
  11618. switch tok {
  11619. case int32(m_XML_TOK_PROLOG_S):
  11620. return int32(_XML_ROLE_ENTITY_NONE)
  11621. case int32(m_XML_TOK_DECL_CLOSE):
  11622. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11623. v1 = __ccgo_fp(_internalSubset)
  11624. } else {
  11625. v1 = __ccgo_fp(_externalSubset1)
  11626. }
  11627. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11628. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11629. case int32(m_XML_TOK_NAME):
  11630. 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 {
  11631. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11632. return int32(_XML_ROLE_ENTITY_NONE)
  11633. }
  11634. break
  11635. }
  11636. return _common(tls, state, tok)
  11637. }
  11638. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11639. _ = ptr
  11640. _ = end
  11641. _ = enc
  11642. switch tok {
  11643. case int32(m_XML_TOK_PROLOG_S):
  11644. return int32(_XML_ROLE_ENTITY_NONE)
  11645. case int32(m_XML_TOK_NAME):
  11646. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11647. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11648. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11649. }
  11650. return _common(tls, state, tok)
  11651. }
  11652. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11653. switch tok {
  11654. case int32(m_XML_TOK_PROLOG_S):
  11655. return int32(_XML_ROLE_ENTITY_NONE)
  11656. case int32(m_XML_TOK_NAME):
  11657. 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 {
  11658. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11659. return int32(_XML_ROLE_ENTITY_NONE)
  11660. }
  11661. 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 {
  11662. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11663. return int32(_XML_ROLE_ENTITY_NONE)
  11664. }
  11665. case int32(m_XML_TOK_LITERAL):
  11666. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11667. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11668. return int32(_XML_ROLE_ENTITY_VALUE)
  11669. }
  11670. return _common(tls, state, tok)
  11671. }
  11672. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11673. _ = ptr
  11674. _ = end
  11675. _ = enc
  11676. switch tok {
  11677. case int32(m_XML_TOK_PROLOG_S):
  11678. return int32(_XML_ROLE_ENTITY_NONE)
  11679. case int32(m_XML_TOK_LITERAL):
  11680. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11681. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11682. }
  11683. return _common(tls, state, tok)
  11684. }
  11685. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11686. _ = ptr
  11687. _ = end
  11688. _ = enc
  11689. switch tok {
  11690. case int32(m_XML_TOK_PROLOG_S):
  11691. return int32(_XML_ROLE_ENTITY_NONE)
  11692. case int32(m_XML_TOK_LITERAL):
  11693. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11694. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11695. }
  11696. return _common(tls, state, tok)
  11697. }
  11698. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11699. var v1 uintptr
  11700. _ = v1
  11701. _ = ptr
  11702. _ = end
  11703. _ = enc
  11704. switch tok {
  11705. case int32(m_XML_TOK_PROLOG_S):
  11706. return int32(_XML_ROLE_ENTITY_NONE)
  11707. case int32(m_XML_TOK_DECL_CLOSE):
  11708. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11709. v1 = __ccgo_fp(_internalSubset)
  11710. } else {
  11711. v1 = __ccgo_fp(_externalSubset1)
  11712. }
  11713. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11714. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11715. }
  11716. return _common(tls, state, tok)
  11717. }
  11718. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11719. _ = ptr
  11720. _ = end
  11721. _ = enc
  11722. switch tok {
  11723. case int32(m_XML_TOK_PROLOG_S):
  11724. return int32(_XML_ROLE_NOTATION_NONE)
  11725. case int32(m_XML_TOK_NAME):
  11726. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11727. return int32(_XML_ROLE_NOTATION_NAME)
  11728. }
  11729. return _common(tls, state, tok)
  11730. }
  11731. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11732. switch tok {
  11733. case int32(m_XML_TOK_PROLOG_S):
  11734. return int32(_XML_ROLE_NOTATION_NONE)
  11735. case int32(m_XML_TOK_NAME):
  11736. 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 {
  11737. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11738. return int32(_XML_ROLE_NOTATION_NONE)
  11739. }
  11740. 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 {
  11741. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11742. return int32(_XML_ROLE_NOTATION_NONE)
  11743. }
  11744. break
  11745. }
  11746. return _common(tls, state, tok)
  11747. }
  11748. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11749. _ = ptr
  11750. _ = end
  11751. _ = enc
  11752. switch tok {
  11753. case int32(m_XML_TOK_PROLOG_S):
  11754. return int32(_XML_ROLE_NOTATION_NONE)
  11755. case int32(m_XML_TOK_LITERAL):
  11756. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11757. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11758. }
  11759. return _common(tls, state, tok)
  11760. }
  11761. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11762. _ = ptr
  11763. _ = end
  11764. _ = enc
  11765. switch tok {
  11766. case int32(m_XML_TOK_PROLOG_S):
  11767. return int32(_XML_ROLE_NOTATION_NONE)
  11768. case int32(m_XML_TOK_LITERAL):
  11769. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11770. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11771. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11772. }
  11773. return _common(tls, state, tok)
  11774. }
  11775. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11776. var v1 uintptr
  11777. _ = v1
  11778. _ = ptr
  11779. _ = end
  11780. _ = enc
  11781. switch tok {
  11782. case int32(m_XML_TOK_PROLOG_S):
  11783. return int32(_XML_ROLE_NOTATION_NONE)
  11784. case int32(m_XML_TOK_LITERAL):
  11785. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11786. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11787. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11788. case int32(m_XML_TOK_DECL_CLOSE):
  11789. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11790. v1 = __ccgo_fp(_internalSubset)
  11791. } else {
  11792. v1 = __ccgo_fp(_externalSubset1)
  11793. }
  11794. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11795. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  11796. }
  11797. return _common(tls, state, tok)
  11798. }
  11799. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11800. _ = ptr
  11801. _ = end
  11802. _ = enc
  11803. switch tok {
  11804. case int32(m_XML_TOK_PROLOG_S):
  11805. return int32(_XML_ROLE_ATTLIST_NONE)
  11806. case int32(m_XML_TOK_NAME):
  11807. fallthrough
  11808. case int32(m_XML_TOK_PREFIXED_NAME):
  11809. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11810. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  11811. }
  11812. return _common(tls, state, tok)
  11813. }
  11814. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11815. var v1 uintptr
  11816. _ = v1
  11817. _ = ptr
  11818. _ = end
  11819. _ = enc
  11820. switch tok {
  11821. case int32(m_XML_TOK_PROLOG_S):
  11822. return int32(_XML_ROLE_ATTLIST_NONE)
  11823. case int32(m_XML_TOK_DECL_CLOSE):
  11824. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11825. v1 = __ccgo_fp(_internalSubset)
  11826. } else {
  11827. v1 = __ccgo_fp(_externalSubset1)
  11828. }
  11829. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11830. return int32(_XML_ROLE_ATTLIST_NONE)
  11831. case int32(m_XML_TOK_NAME):
  11832. fallthrough
  11833. case int32(m_XML_TOK_PREFIXED_NAME):
  11834. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  11835. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  11836. }
  11837. return _common(tls, state, tok)
  11838. }
  11839. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11840. var i int32
  11841. _ = i
  11842. switch tok {
  11843. case int32(m_XML_TOK_PROLOG_S):
  11844. return int32(_XML_ROLE_ATTLIST_NONE)
  11845. case int32(m_XML_TOK_NAME):
  11846. i = 0
  11847. for {
  11848. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  11849. break
  11850. }
  11851. 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 {
  11852. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11853. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  11854. }
  11855. goto _1
  11856. _1:
  11857. ;
  11858. i++
  11859. }
  11860. 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 {
  11861. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  11862. return int32(_XML_ROLE_ATTLIST_NONE)
  11863. }
  11864. case int32(m_XML_TOK_OPEN_PAREN):
  11865. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11866. return int32(_XML_ROLE_ATTLIST_NONE)
  11867. }
  11868. return _common(tls, state, tok)
  11869. }
  11870. var _types = [8]uintptr{
  11871. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  11872. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  11873. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  11874. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  11875. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  11876. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  11877. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  11878. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  11879. }
  11880. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11881. _ = ptr
  11882. _ = end
  11883. _ = enc
  11884. switch tok {
  11885. case int32(m_XML_TOK_PROLOG_S):
  11886. return int32(_XML_ROLE_ATTLIST_NONE)
  11887. case int32(m_XML_TOK_NMTOKEN):
  11888. fallthrough
  11889. case int32(m_XML_TOK_NAME):
  11890. fallthrough
  11891. case int32(m_XML_TOK_PREFIXED_NAME):
  11892. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  11893. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  11894. }
  11895. return _common(tls, state, tok)
  11896. }
  11897. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11898. _ = ptr
  11899. _ = end
  11900. _ = enc
  11901. switch tok {
  11902. case int32(m_XML_TOK_PROLOG_S):
  11903. return int32(_XML_ROLE_ATTLIST_NONE)
  11904. case int32(m_XML_TOK_CLOSE_PAREN):
  11905. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11906. return int32(_XML_ROLE_ATTLIST_NONE)
  11907. case int32(m_XML_TOK_OR):
  11908. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11909. return int32(_XML_ROLE_ATTLIST_NONE)
  11910. }
  11911. return _common(tls, state, tok)
  11912. }
  11913. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11914. _ = ptr
  11915. _ = end
  11916. _ = enc
  11917. switch tok {
  11918. case int32(m_XML_TOK_PROLOG_S):
  11919. return int32(_XML_ROLE_ATTLIST_NONE)
  11920. case int32(m_XML_TOK_OPEN_PAREN):
  11921. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11922. return int32(_XML_ROLE_ATTLIST_NONE)
  11923. }
  11924. return _common(tls, state, tok)
  11925. }
  11926. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11927. _ = ptr
  11928. _ = end
  11929. _ = enc
  11930. switch tok {
  11931. case int32(m_XML_TOK_PROLOG_S):
  11932. return int32(_XML_ROLE_ATTLIST_NONE)
  11933. case int32(m_XML_TOK_NAME):
  11934. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  11935. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  11936. }
  11937. return _common(tls, state, tok)
  11938. }
  11939. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11940. _ = ptr
  11941. _ = end
  11942. _ = enc
  11943. switch tok {
  11944. case int32(m_XML_TOK_PROLOG_S):
  11945. return int32(_XML_ROLE_ATTLIST_NONE)
  11946. case int32(m_XML_TOK_CLOSE_PAREN):
  11947. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11948. return int32(_XML_ROLE_ATTLIST_NONE)
  11949. case int32(m_XML_TOK_OR):
  11950. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11951. return int32(_XML_ROLE_ATTLIST_NONE)
  11952. }
  11953. return _common(tls, state, tok)
  11954. }
  11955. // C documentation
  11956. //
  11957. // /* default value */
  11958. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11959. switch tok {
  11960. case int32(m_XML_TOK_PROLOG_S):
  11961. return int32(_XML_ROLE_ATTLIST_NONE)
  11962. case int32(m_XML_TOK_POUND_NAME):
  11963. 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 {
  11964. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11965. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  11966. }
  11967. 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 {
  11968. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11969. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  11970. }
  11971. 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 {
  11972. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  11973. return int32(_XML_ROLE_ATTLIST_NONE)
  11974. }
  11975. case int32(m_XML_TOK_LITERAL):
  11976. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11977. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  11978. }
  11979. return _common(tls, state, tok)
  11980. }
  11981. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11982. _ = ptr
  11983. _ = end
  11984. _ = enc
  11985. switch tok {
  11986. case int32(m_XML_TOK_PROLOG_S):
  11987. return int32(_XML_ROLE_ATTLIST_NONE)
  11988. case int32(m_XML_TOK_LITERAL):
  11989. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11990. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  11991. }
  11992. return _common(tls, state, tok)
  11993. }
  11994. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11995. _ = ptr
  11996. _ = end
  11997. _ = enc
  11998. switch tok {
  11999. case int32(m_XML_TOK_PROLOG_S):
  12000. return int32(_XML_ROLE_ELEMENT_NONE)
  12001. case int32(m_XML_TOK_NAME):
  12002. fallthrough
  12003. case int32(m_XML_TOK_PREFIXED_NAME):
  12004. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12005. return int32(_XML_ROLE_ELEMENT_NAME)
  12006. }
  12007. return _common(tls, state, tok)
  12008. }
  12009. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12010. switch tok {
  12011. case int32(m_XML_TOK_PROLOG_S):
  12012. return int32(_XML_ROLE_ELEMENT_NONE)
  12013. case int32(m_XML_TOK_NAME):
  12014. 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 {
  12015. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12016. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12017. return int32(_XML_ROLE_CONTENT_EMPTY)
  12018. }
  12019. 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 {
  12020. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12021. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12022. return int32(_XML_ROLE_CONTENT_ANY)
  12023. }
  12024. case int32(m_XML_TOK_OPEN_PAREN):
  12025. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12026. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12027. return int32(_XML_ROLE_GROUP_OPEN)
  12028. }
  12029. return _common(tls, state, tok)
  12030. }
  12031. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12032. switch tok {
  12033. case int32(m_XML_TOK_PROLOG_S):
  12034. return int32(_XML_ROLE_ELEMENT_NONE)
  12035. case int32(m_XML_TOK_POUND_NAME):
  12036. 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 {
  12037. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12038. return int32(_XML_ROLE_CONTENT_PCDATA)
  12039. }
  12040. case int32(m_XML_TOK_OPEN_PAREN):
  12041. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12042. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12043. return int32(_XML_ROLE_GROUP_OPEN)
  12044. case int32(m_XML_TOK_NAME):
  12045. fallthrough
  12046. case int32(m_XML_TOK_PREFIXED_NAME):
  12047. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12048. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12049. case int32(m_XML_TOK_NAME_QUESTION):
  12050. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12051. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12052. case int32(m_XML_TOK_NAME_ASTERISK):
  12053. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12054. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12055. case int32(m_XML_TOK_NAME_PLUS):
  12056. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12057. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12058. }
  12059. return _common(tls, state, tok)
  12060. }
  12061. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12062. _ = ptr
  12063. _ = end
  12064. _ = enc
  12065. switch tok {
  12066. case int32(m_XML_TOK_PROLOG_S):
  12067. return int32(_XML_ROLE_ELEMENT_NONE)
  12068. case int32(m_XML_TOK_CLOSE_PAREN):
  12069. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12070. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12071. return int32(_XML_ROLE_GROUP_CLOSE)
  12072. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12073. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12074. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12075. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12076. case int32(m_XML_TOK_OR):
  12077. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12078. return int32(_XML_ROLE_ELEMENT_NONE)
  12079. }
  12080. return _common(tls, state, tok)
  12081. }
  12082. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12083. _ = ptr
  12084. _ = end
  12085. _ = enc
  12086. switch tok {
  12087. case int32(m_XML_TOK_PROLOG_S):
  12088. return int32(_XML_ROLE_ELEMENT_NONE)
  12089. case int32(m_XML_TOK_NAME):
  12090. fallthrough
  12091. case int32(m_XML_TOK_PREFIXED_NAME):
  12092. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12093. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12094. }
  12095. return _common(tls, state, tok)
  12096. }
  12097. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12098. _ = ptr
  12099. _ = end
  12100. _ = enc
  12101. switch tok {
  12102. case int32(m_XML_TOK_PROLOG_S):
  12103. return int32(_XML_ROLE_ELEMENT_NONE)
  12104. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12105. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12106. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12107. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12108. case int32(m_XML_TOK_OR):
  12109. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12110. return int32(_XML_ROLE_ELEMENT_NONE)
  12111. }
  12112. return _common(tls, state, tok)
  12113. }
  12114. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12115. _ = ptr
  12116. _ = end
  12117. _ = enc
  12118. switch tok {
  12119. case int32(m_XML_TOK_PROLOG_S):
  12120. return int32(_XML_ROLE_ELEMENT_NONE)
  12121. case int32(m_XML_TOK_OPEN_PAREN):
  12122. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  12123. return int32(_XML_ROLE_GROUP_OPEN)
  12124. case int32(m_XML_TOK_NAME):
  12125. fallthrough
  12126. case int32(m_XML_TOK_PREFIXED_NAME):
  12127. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12128. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12129. case int32(m_XML_TOK_NAME_QUESTION):
  12130. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12131. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12132. case int32(m_XML_TOK_NAME_ASTERISK):
  12133. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12134. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12135. case int32(m_XML_TOK_NAME_PLUS):
  12136. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12137. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12138. }
  12139. return _common(tls, state, tok)
  12140. }
  12141. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12142. _ = ptr
  12143. _ = end
  12144. _ = enc
  12145. switch tok {
  12146. case int32(m_XML_TOK_PROLOG_S):
  12147. return int32(_XML_ROLE_ELEMENT_NONE)
  12148. case int32(m_XML_TOK_CLOSE_PAREN):
  12149. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12150. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12151. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12152. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12153. }
  12154. return int32(_XML_ROLE_GROUP_CLOSE)
  12155. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12156. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12157. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12158. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12159. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12160. }
  12161. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12162. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12163. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12164. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12165. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12166. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12167. }
  12168. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12169. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12170. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  12171. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12172. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12173. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12174. }
  12175. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12176. case int32(m_XML_TOK_COMMA):
  12177. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12178. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12179. case int32(m_XML_TOK_OR):
  12180. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12181. return int32(_XML_ROLE_GROUP_CHOICE)
  12182. }
  12183. return _common(tls, state, tok)
  12184. }
  12185. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12186. switch tok {
  12187. case int32(m_XML_TOK_PROLOG_S):
  12188. return int32(_XML_ROLE_NONE)
  12189. case int32(m_XML_TOK_NAME):
  12190. 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 {
  12191. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12192. return int32(_XML_ROLE_NONE)
  12193. }
  12194. 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 {
  12195. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12196. return int32(_XML_ROLE_NONE)
  12197. }
  12198. break
  12199. }
  12200. return _common(tls, state, tok)
  12201. }
  12202. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12203. _ = ptr
  12204. _ = end
  12205. _ = enc
  12206. switch tok {
  12207. case int32(m_XML_TOK_PROLOG_S):
  12208. return int32(_XML_ROLE_NONE)
  12209. case int32(m_XML_TOK_OPEN_BRACKET):
  12210. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12211. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  12212. return int32(_XML_ROLE_NONE)
  12213. }
  12214. return _common(tls, state, tok)
  12215. }
  12216. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12217. _ = ptr
  12218. _ = end
  12219. _ = enc
  12220. switch tok {
  12221. case int32(m_XML_TOK_PROLOG_S):
  12222. return int32(_XML_ROLE_NONE)
  12223. case int32(m_XML_TOK_OPEN_BRACKET):
  12224. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12225. return int32(_XML_ROLE_IGNORE_SECT)
  12226. }
  12227. return _common(tls, state, tok)
  12228. }
  12229. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12230. var v1 uintptr
  12231. _ = v1
  12232. _ = ptr
  12233. _ = end
  12234. _ = enc
  12235. switch tok {
  12236. case int32(m_XML_TOK_PROLOG_S):
  12237. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12238. case int32(m_XML_TOK_DECL_CLOSE):
  12239. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12240. v1 = __ccgo_fp(_internalSubset)
  12241. } else {
  12242. v1 = __ccgo_fp(_externalSubset1)
  12243. }
  12244. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12245. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12246. }
  12247. return _common(tls, state, tok)
  12248. }
  12249. // C documentation
  12250. //
  12251. // /* This function will only be invoked if the internal logic of the
  12252. // * parser has broken down. It is used in two cases:
  12253. // *
  12254. // * 1: When the XML prolog has been finished. At this point the
  12255. // * processor (the parser level above these role handlers) should
  12256. // * switch from prologProcessor to contentProcessor and reinitialise
  12257. // * the handler function.
  12258. // *
  12259. // * 2: When an error has been detected (via common() below). At this
  12260. // * point again the processor should be switched to errorProcessor,
  12261. // * which will never call a handler.
  12262. // *
  12263. // * The result of this is that error() can only be called if the
  12264. // * processor switch failed to happen, which is an internal error and
  12265. // * therefore we shouldn't be able to provoke it simply by using the
  12266. // * library. It is a necessary backstop, however, so we merely exclude
  12267. // * it from the coverage statistics.
  12268. // *
  12269. // * LCOV_EXCL_START
  12270. // */
  12271. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12272. _ = state
  12273. _ = tok
  12274. _ = ptr
  12275. _ = end
  12276. _ = enc
  12277. return int32(_XML_ROLE_NONE)
  12278. }
  12279. /* LCOV_EXCL_STOP */
  12280. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12281. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12282. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12283. }
  12284. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12285. return int32(_XML_ROLE_ERROR)
  12286. }
  12287. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12288. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12289. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12290. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12291. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12292. }
  12293. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12294. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12295. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12296. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12297. }
  12298. const m_ASCII_02 = 48
  12299. const m_ASCII_12 = 49
  12300. const m_ASCII_22 = 50
  12301. const m_ASCII_32 = 51
  12302. const m_ASCII_41 = 52
  12303. const m_ASCII_51 = 53
  12304. const m_ASCII_61 = 54
  12305. const m_ASCII_71 = 55
  12306. const m_ASCII_82 = 56
  12307. const m_ASCII_92 = 57
  12308. const m_ASCII_AMP1 = 38
  12309. const m_ASCII_APOS1 = 39
  12310. const m_ASCII_COLON2 = 58
  12311. const m_ASCII_EQUALS2 = 61
  12312. const m_ASCII_EXCL2 = 33
  12313. const m_ASCII_G2 = 0x47
  12314. const m_ASCII_GT1 = 62
  12315. const m_ASCII_K1 = 0x4B
  12316. const m_ASCII_LSQB1 = 91
  12317. const m_ASCII_LT1 = 60
  12318. const m_ASCII_MINUS1 = 45
  12319. const m_ASCII_N1 = 0x4E
  12320. const m_ASCII_P2 = 0x50
  12321. const m_ASCII_PERIOD2 = 46
  12322. const m_ASCII_Q2 = 0x51
  12323. const m_ASCII_QUOT1 = 34
  12324. const m_ASCII_R1 = 0x52
  12325. const m_ASCII_RSQB1 = 93
  12326. const m_ASCII_SEMI1 = 59
  12327. const m_ASCII_SPACE1 = 32
  12328. const m_ASCII_TAB1 = 9
  12329. const m_ASCII_UNDERSCORE1 = 95
  12330. const m_ASCII_Y1 = 0x59
  12331. const m_ASCII_Z1 = 90
  12332. const m_ASCII_a2 = 97
  12333. const m_ASCII_b1 = 98
  12334. const m_ASCII_c2 = 99
  12335. const m_ASCII_d1 = 100
  12336. const m_ASCII_e2 = 101
  12337. const m_ASCII_f1 = 102
  12338. const m_ASCII_g2 = 103
  12339. const m_ASCII_i1 = 105
  12340. const m_ASCII_l2 = 108
  12341. const m_ASCII_m2 = 109
  12342. const m_ASCII_n2 = 110
  12343. const m_ASCII_o2 = 111
  12344. const m_ASCII_p2 = 112
  12345. const m_ASCII_q1 = 113
  12346. const m_ASCII_r2 = 114
  12347. const m_ASCII_s2 = 115
  12348. const m_ASCII_t2 = 116
  12349. const m_ASCII_u1 = 117
  12350. const m_ASCII_v1 = 118
  12351. const m_ASCII_x2 = 120
  12352. const m_ASCII_y1 = 121
  12353. const m_ASCII_z1 = 122
  12354. const m_ENCODING_MAX = 128
  12355. const m___bool_true_false_are_defined = 1
  12356. const m_bool = "_Bool"
  12357. const m_false = 0
  12358. const m_true = 1
  12359. const m_utf8_isName4 = "isNever"
  12360. const m_utf8_isNmstrt4 = "isNever"
  12361. var _namingBitmap = [320]uint32{
  12362. 8: uint32(0xFFFFFFFF),
  12363. 9: uint32(0xFFFFFFFF),
  12364. 10: uint32(0xFFFFFFFF),
  12365. 11: uint32(0xFFFFFFFF),
  12366. 12: uint32(0xFFFFFFFF),
  12367. 13: uint32(0xFFFFFFFF),
  12368. 14: uint32(0xFFFFFFFF),
  12369. 15: uint32(0xFFFFFFFF),
  12370. 17: uint32(0x04000000),
  12371. 18: uint32(0x87FFFFFE),
  12372. 19: uint32(0x07FFFFFE),
  12373. 22: uint32(0xFF7FFFFF),
  12374. 23: uint32(0xFF7FFFFF),
  12375. 24: uint32(0xFFFFFFFF),
  12376. 25: uint32(0x7FF3FFFF),
  12377. 26: uint32(0xFFFFFDFE),
  12378. 27: uint32(0x7FFFFFFF),
  12379. 28: uint32(0xFFFFFFFF),
  12380. 29: uint32(0xFFFFFFFF),
  12381. 30: uint32(0xFFFFE00F),
  12382. 31: uint32(0xFC31FFFF),
  12383. 32: uint32(0x00FFFFFF),
  12384. 34: uint32(0xFFFF0000),
  12385. 35: uint32(0xFFFFFFFF),
  12386. 36: uint32(0xFFFFFFFF),
  12387. 37: uint32(0xF80001FF),
  12388. 38: uint32(0x00000003),
  12389. 44: uint32(0xFFFFD740),
  12390. 45: uint32(0xFFFFFFFB),
  12391. 46: uint32(0x547F7FFF),
  12392. 47: uint32(0x000FFFFD),
  12393. 48: uint32(0xFFFFDFFE),
  12394. 49: uint32(0xFFFFFFFF),
  12395. 50: uint32(0xDFFEFFFF),
  12396. 51: uint32(0xFFFFFFFF),
  12397. 52: uint32(0xFFFF0003),
  12398. 53: uint32(0xFFFFFFFF),
  12399. 54: uint32(0xFFFF199F),
  12400. 55: uint32(0x033FCFFF),
  12401. 57: uint32(0xFFFE0000),
  12402. 58: uint32(0x027FFFFF),
  12403. 59: uint32(0xFFFFFFFE),
  12404. 60: uint32(0x0000007F),
  12405. 62: uint32(0xFFFF0000),
  12406. 63: uint32(0x000707FF),
  12407. 65: uint32(0x07FFFFFE),
  12408. 66: uint32(0x000007FE),
  12409. 67: uint32(0xFFFE0000),
  12410. 68: uint32(0xFFFFFFFF),
  12411. 69: uint32(0x7CFFFFFF),
  12412. 70: uint32(0x002F7FFF),
  12413. 71: uint32(0x00000060),
  12414. 72: uint32(0xFFFFFFE0),
  12415. 73: uint32(0x23FFFFFF),
  12416. 74: uint32(0xFF000000),
  12417. 75: uint32(0x00000003),
  12418. 76: uint32(0xFFF99FE0),
  12419. 77: uint32(0x03C5FDFF),
  12420. 78: uint32(0xB0000000),
  12421. 79: uint32(0x00030003),
  12422. 80: uint32(0xFFF987E0),
  12423. 81: uint32(0x036DFDFF),
  12424. 82: uint32(0x5E000000),
  12425. 83: uint32(0x001C0000),
  12426. 84: uint32(0xFFFBAFE0),
  12427. 85: uint32(0x23EDFDFF),
  12428. 87: uint32(0x00000001),
  12429. 88: uint32(0xFFF99FE0),
  12430. 89: uint32(0x23CDFDFF),
  12431. 90: uint32(0xB0000000),
  12432. 91: uint32(0x00000003),
  12433. 92: uint32(0xD63DC7E0),
  12434. 93: uint32(0x03BFC718),
  12435. 96: uint32(0xFFFDDFE0),
  12436. 97: uint32(0x03EFFDFF),
  12437. 99: uint32(0x00000003),
  12438. 100: uint32(0xFFFDDFE0),
  12439. 101: uint32(0x03EFFDFF),
  12440. 102: uint32(0x40000000),
  12441. 103: uint32(0x00000003),
  12442. 104: uint32(0xFFFDDFE0),
  12443. 105: uint32(0x03FFFDFF),
  12444. 107: uint32(0x00000003),
  12445. 112: uint32(0xFFFFFFFE),
  12446. 113: uint32(0x000D7FFF),
  12447. 114: uint32(0x0000003F),
  12448. 116: uint32(0xFEF02596),
  12449. 117: uint32(0x200D6CAE),
  12450. 118: uint32(0x0000001F),
  12451. 122: uint32(0xFFFFFEFF),
  12452. 123: uint32(0x000003FF),
  12453. 133: uint32(0xFFFFFFFF),
  12454. 134: uint32(0xFFFF003F),
  12455. 135: uint32(0x007FFFFF),
  12456. 136: uint32(0x0007DAED),
  12457. 137: uint32(0x50000000),
  12458. 138: uint32(0x82315001),
  12459. 139: uint32(0x002C62AB),
  12460. 140: uint32(0x40000000),
  12461. 141: uint32(0xF580C900),
  12462. 142: uint32(0x00000007),
  12463. 143: uint32(0x02010800),
  12464. 144: uint32(0xFFFFFFFF),
  12465. 145: uint32(0xFFFFFFFF),
  12466. 146: uint32(0xFFFFFFFF),
  12467. 147: uint32(0xFFFFFFFF),
  12468. 148: uint32(0x0FFFFFFF),
  12469. 149: uint32(0xFFFFFFFF),
  12470. 150: uint32(0xFFFFFFFF),
  12471. 151: uint32(0x03FFFFFF),
  12472. 152: uint32(0x3F3FFFFF),
  12473. 153: uint32(0xFFFFFFFF),
  12474. 154: uint32(0xAAFF3F3F),
  12475. 155: uint32(0x3FFFFFFF),
  12476. 156: uint32(0xFFFFFFFF),
  12477. 157: uint32(0x5FDFFFFF),
  12478. 158: uint32(0x0FCF1FDC),
  12479. 159: uint32(0x1FDC1FFF),
  12480. 161: uint32(0x00004C40),
  12481. 164: uint32(0x00000007),
  12482. 168: uint32(0x00000080),
  12483. 169: uint32(0x000003FE),
  12484. 170: uint32(0xFFFFFFFE),
  12485. 171: uint32(0xFFFFFFFF),
  12486. 172: uint32(0x001FFFFF),
  12487. 173: uint32(0xFFFFFFFE),
  12488. 174: uint32(0xFFFFFFFF),
  12489. 175: uint32(0x07FFFFFF),
  12490. 176: uint32(0xFFFFFFE0),
  12491. 177: uint32(0x00001FFF),
  12492. 184: uint32(0xFFFFFFFF),
  12493. 185: uint32(0xFFFFFFFF),
  12494. 186: uint32(0xFFFFFFFF),
  12495. 187: uint32(0xFFFFFFFF),
  12496. 188: uint32(0xFFFFFFFF),
  12497. 189: uint32(0x0000003F),
  12498. 192: uint32(0xFFFFFFFF),
  12499. 193: uint32(0xFFFFFFFF),
  12500. 194: uint32(0xFFFFFFFF),
  12501. 195: uint32(0xFFFFFFFF),
  12502. 196: uint32(0xFFFFFFFF),
  12503. 197: uint32(0x0000000F),
  12504. 201: uint32(0x07FF6000),
  12505. 202: uint32(0x87FFFFFE),
  12506. 203: uint32(0x07FFFFFE),
  12507. 205: uint32(0x00800000),
  12508. 206: uint32(0xFF7FFFFF),
  12509. 207: uint32(0xFF7FFFFF),
  12510. 208: uint32(0x00FFFFFF),
  12511. 210: uint32(0xFFFF0000),
  12512. 211: uint32(0xFFFFFFFF),
  12513. 212: uint32(0xFFFFFFFF),
  12514. 213: uint32(0xF80001FF),
  12515. 214: uint32(0x00030003),
  12516. 216: uint32(0xFFFFFFFF),
  12517. 217: uint32(0xFFFFFFFF),
  12518. 218: uint32(0x0000003F),
  12519. 219: uint32(0x00000003),
  12520. 220: uint32(0xFFFFD7C0),
  12521. 221: uint32(0xFFFFFFFB),
  12522. 222: uint32(0x547F7FFF),
  12523. 223: uint32(0x000FFFFD),
  12524. 224: uint32(0xFFFFDFFE),
  12525. 225: uint32(0xFFFFFFFF),
  12526. 226: uint32(0xDFFEFFFF),
  12527. 227: uint32(0xFFFFFFFF),
  12528. 228: uint32(0xFFFF007B),
  12529. 229: uint32(0xFFFFFFFF),
  12530. 230: uint32(0xFFFF199F),
  12531. 231: uint32(0x033FCFFF),
  12532. 233: uint32(0xFFFE0000),
  12533. 234: uint32(0x027FFFFF),
  12534. 235: uint32(0xFFFFFFFE),
  12535. 236: uint32(0xFFFE007F),
  12536. 237: uint32(0xBBFFFFFB),
  12537. 238: uint32(0xFFFF0016),
  12538. 239: uint32(0x000707FF),
  12539. 241: uint32(0x07FFFFFE),
  12540. 242: uint32(0x0007FFFF),
  12541. 243: uint32(0xFFFF03FF),
  12542. 244: uint32(0xFFFFFFFF),
  12543. 245: uint32(0x7CFFFFFF),
  12544. 246: uint32(0xFFEF7FFF),
  12545. 247: uint32(0x03FF3DFF),
  12546. 248: uint32(0xFFFFFFEE),
  12547. 249: uint32(0xF3FFFFFF),
  12548. 250: uint32(0xFF1E3FFF),
  12549. 251: uint32(0x0000FFCF),
  12550. 252: uint32(0xFFF99FEE),
  12551. 253: uint32(0xD3C5FDFF),
  12552. 254: uint32(0xB080399F),
  12553. 255: uint32(0x0003FFCF),
  12554. 256: uint32(0xFFF987E4),
  12555. 257: uint32(0xD36DFDFF),
  12556. 258: uint32(0x5E003987),
  12557. 259: uint32(0x001FFFC0),
  12558. 260: uint32(0xFFFBAFEE),
  12559. 261: uint32(0xF3EDFDFF),
  12560. 262: uint32(0x00003BBF),
  12561. 263: uint32(0x0000FFC1),
  12562. 264: uint32(0xFFF99FEE),
  12563. 265: uint32(0xF3CDFDFF),
  12564. 266: uint32(0xB0C0398F),
  12565. 267: uint32(0x0000FFC3),
  12566. 268: uint32(0xD63DC7EC),
  12567. 269: uint32(0xC3BFC718),
  12568. 270: uint32(0x00803DC7),
  12569. 271: uint32(0x0000FF80),
  12570. 272: uint32(0xFFFDDFEE),
  12571. 273: uint32(0xC3EFFDFF),
  12572. 274: uint32(0x00603DDF),
  12573. 275: uint32(0x0000FFC3),
  12574. 276: uint32(0xFFFDDFEC),
  12575. 277: uint32(0xC3EFFDFF),
  12576. 278: uint32(0x40603DDF),
  12577. 279: uint32(0x0000FFC3),
  12578. 280: uint32(0xFFFDDFEC),
  12579. 281: uint32(0xC3FFFDFF),
  12580. 282: uint32(0x00803DCF),
  12581. 283: uint32(0x0000FFC3),
  12582. 288: uint32(0xFFFFFFFE),
  12583. 289: uint32(0x07FF7FFF),
  12584. 290: uint32(0x03FF7FFF),
  12585. 292: uint32(0xFEF02596),
  12586. 293: uint32(0x3BFF6CAE),
  12587. 294: uint32(0x03FF3F5F),
  12588. 296: uint32(0x03000000),
  12589. 297: uint32(0xC2A003FF),
  12590. 298: uint32(0xFFFFFEFF),
  12591. 299: uint32(0xFFFE03FF),
  12592. 300: uint32(0xFEBF0FDF),
  12593. 301: uint32(0x02FE3FFF),
  12594. 310: uint32(0x1FFF0000),
  12595. 311: uint32(0x00000002),
  12596. 312: uint32(0x000000A0),
  12597. 313: uint32(0x003EFFFE),
  12598. 314: uint32(0xFFFFFFFE),
  12599. 315: uint32(0xFFFFFFFF),
  12600. 316: uint32(0x661FFFFF),
  12601. 317: uint32(0xFFFFFFFE),
  12602. 318: uint32(0xFFFFFFFF),
  12603. 319: uint32(0x77FFFFFF),
  12604. }
  12605. var _nmstrtPages = [256]uint8{
  12606. 0: uint8(0x02),
  12607. 1: uint8(0x03),
  12608. 2: uint8(0x04),
  12609. 3: uint8(0x05),
  12610. 4: uint8(0x06),
  12611. 5: uint8(0x07),
  12612. 6: uint8(0x08),
  12613. 9: uint8(0x09),
  12614. 10: uint8(0x0A),
  12615. 11: uint8(0x0B),
  12616. 12: uint8(0x0C),
  12617. 13: uint8(0x0D),
  12618. 14: uint8(0x0E),
  12619. 15: uint8(0x0F),
  12620. 16: uint8(0x10),
  12621. 17: uint8(0x11),
  12622. 30: uint8(0x12),
  12623. 31: uint8(0x13),
  12624. 33: uint8(0x14),
  12625. 48: uint8(0x15),
  12626. 49: uint8(0x16),
  12627. 78: uint8(0x01),
  12628. 79: uint8(0x01),
  12629. 80: uint8(0x01),
  12630. 81: uint8(0x01),
  12631. 82: uint8(0x01),
  12632. 83: uint8(0x01),
  12633. 84: uint8(0x01),
  12634. 85: uint8(0x01),
  12635. 86: uint8(0x01),
  12636. 87: uint8(0x01),
  12637. 88: uint8(0x01),
  12638. 89: uint8(0x01),
  12639. 90: uint8(0x01),
  12640. 91: uint8(0x01),
  12641. 92: uint8(0x01),
  12642. 93: uint8(0x01),
  12643. 94: uint8(0x01),
  12644. 95: uint8(0x01),
  12645. 96: uint8(0x01),
  12646. 97: uint8(0x01),
  12647. 98: uint8(0x01),
  12648. 99: uint8(0x01),
  12649. 100: uint8(0x01),
  12650. 101: uint8(0x01),
  12651. 102: uint8(0x01),
  12652. 103: uint8(0x01),
  12653. 104: uint8(0x01),
  12654. 105: uint8(0x01),
  12655. 106: uint8(0x01),
  12656. 107: uint8(0x01),
  12657. 108: uint8(0x01),
  12658. 109: uint8(0x01),
  12659. 110: uint8(0x01),
  12660. 111: uint8(0x01),
  12661. 112: uint8(0x01),
  12662. 113: uint8(0x01),
  12663. 114: uint8(0x01),
  12664. 115: uint8(0x01),
  12665. 116: uint8(0x01),
  12666. 117: uint8(0x01),
  12667. 118: uint8(0x01),
  12668. 119: uint8(0x01),
  12669. 120: uint8(0x01),
  12670. 121: uint8(0x01),
  12671. 122: uint8(0x01),
  12672. 123: uint8(0x01),
  12673. 124: uint8(0x01),
  12674. 125: uint8(0x01),
  12675. 126: uint8(0x01),
  12676. 127: uint8(0x01),
  12677. 128: uint8(0x01),
  12678. 129: uint8(0x01),
  12679. 130: uint8(0x01),
  12680. 131: uint8(0x01),
  12681. 132: uint8(0x01),
  12682. 133: uint8(0x01),
  12683. 134: uint8(0x01),
  12684. 135: uint8(0x01),
  12685. 136: uint8(0x01),
  12686. 137: uint8(0x01),
  12687. 138: uint8(0x01),
  12688. 139: uint8(0x01),
  12689. 140: uint8(0x01),
  12690. 141: uint8(0x01),
  12691. 142: uint8(0x01),
  12692. 143: uint8(0x01),
  12693. 144: uint8(0x01),
  12694. 145: uint8(0x01),
  12695. 146: uint8(0x01),
  12696. 147: uint8(0x01),
  12697. 148: uint8(0x01),
  12698. 149: uint8(0x01),
  12699. 150: uint8(0x01),
  12700. 151: uint8(0x01),
  12701. 152: uint8(0x01),
  12702. 153: uint8(0x01),
  12703. 154: uint8(0x01),
  12704. 155: uint8(0x01),
  12705. 156: uint8(0x01),
  12706. 157: uint8(0x01),
  12707. 158: uint8(0x01),
  12708. 159: uint8(0x17),
  12709. 172: uint8(0x01),
  12710. 173: uint8(0x01),
  12711. 174: uint8(0x01),
  12712. 175: uint8(0x01),
  12713. 176: uint8(0x01),
  12714. 177: uint8(0x01),
  12715. 178: uint8(0x01),
  12716. 179: uint8(0x01),
  12717. 180: uint8(0x01),
  12718. 181: uint8(0x01),
  12719. 182: uint8(0x01),
  12720. 183: uint8(0x01),
  12721. 184: uint8(0x01),
  12722. 185: uint8(0x01),
  12723. 186: uint8(0x01),
  12724. 187: uint8(0x01),
  12725. 188: uint8(0x01),
  12726. 189: uint8(0x01),
  12727. 190: uint8(0x01),
  12728. 191: uint8(0x01),
  12729. 192: uint8(0x01),
  12730. 193: uint8(0x01),
  12731. 194: uint8(0x01),
  12732. 195: uint8(0x01),
  12733. 196: uint8(0x01),
  12734. 197: uint8(0x01),
  12735. 198: uint8(0x01),
  12736. 199: uint8(0x01),
  12737. 200: uint8(0x01),
  12738. 201: uint8(0x01),
  12739. 202: uint8(0x01),
  12740. 203: uint8(0x01),
  12741. 204: uint8(0x01),
  12742. 205: uint8(0x01),
  12743. 206: uint8(0x01),
  12744. 207: uint8(0x01),
  12745. 208: uint8(0x01),
  12746. 209: uint8(0x01),
  12747. 210: uint8(0x01),
  12748. 211: uint8(0x01),
  12749. 212: uint8(0x01),
  12750. 213: uint8(0x01),
  12751. 214: uint8(0x01),
  12752. 215: uint8(0x18),
  12753. }
  12754. var _namePages = [256]uint8{
  12755. 0: uint8(0x19),
  12756. 1: uint8(0x03),
  12757. 2: uint8(0x1A),
  12758. 3: uint8(0x1B),
  12759. 4: uint8(0x1C),
  12760. 5: uint8(0x1D),
  12761. 6: uint8(0x1E),
  12762. 9: uint8(0x1F),
  12763. 10: uint8(0x20),
  12764. 11: uint8(0x21),
  12765. 12: uint8(0x22),
  12766. 13: uint8(0x23),
  12767. 14: uint8(0x24),
  12768. 15: uint8(0x25),
  12769. 16: uint8(0x10),
  12770. 17: uint8(0x11),
  12771. 30: uint8(0x12),
  12772. 31: uint8(0x13),
  12773. 32: uint8(0x26),
  12774. 33: uint8(0x14),
  12775. 48: uint8(0x27),
  12776. 49: uint8(0x16),
  12777. 78: uint8(0x01),
  12778. 79: uint8(0x01),
  12779. 80: uint8(0x01),
  12780. 81: uint8(0x01),
  12781. 82: uint8(0x01),
  12782. 83: uint8(0x01),
  12783. 84: uint8(0x01),
  12784. 85: uint8(0x01),
  12785. 86: uint8(0x01),
  12786. 87: uint8(0x01),
  12787. 88: uint8(0x01),
  12788. 89: uint8(0x01),
  12789. 90: uint8(0x01),
  12790. 91: uint8(0x01),
  12791. 92: uint8(0x01),
  12792. 93: uint8(0x01),
  12793. 94: uint8(0x01),
  12794. 95: uint8(0x01),
  12795. 96: uint8(0x01),
  12796. 97: uint8(0x01),
  12797. 98: uint8(0x01),
  12798. 99: uint8(0x01),
  12799. 100: uint8(0x01),
  12800. 101: uint8(0x01),
  12801. 102: uint8(0x01),
  12802. 103: uint8(0x01),
  12803. 104: uint8(0x01),
  12804. 105: uint8(0x01),
  12805. 106: uint8(0x01),
  12806. 107: uint8(0x01),
  12807. 108: uint8(0x01),
  12808. 109: uint8(0x01),
  12809. 110: uint8(0x01),
  12810. 111: uint8(0x01),
  12811. 112: uint8(0x01),
  12812. 113: uint8(0x01),
  12813. 114: uint8(0x01),
  12814. 115: uint8(0x01),
  12815. 116: uint8(0x01),
  12816. 117: uint8(0x01),
  12817. 118: uint8(0x01),
  12818. 119: uint8(0x01),
  12819. 120: uint8(0x01),
  12820. 121: uint8(0x01),
  12821. 122: uint8(0x01),
  12822. 123: uint8(0x01),
  12823. 124: uint8(0x01),
  12824. 125: uint8(0x01),
  12825. 126: uint8(0x01),
  12826. 127: uint8(0x01),
  12827. 128: uint8(0x01),
  12828. 129: uint8(0x01),
  12829. 130: uint8(0x01),
  12830. 131: uint8(0x01),
  12831. 132: uint8(0x01),
  12832. 133: uint8(0x01),
  12833. 134: uint8(0x01),
  12834. 135: uint8(0x01),
  12835. 136: uint8(0x01),
  12836. 137: uint8(0x01),
  12837. 138: uint8(0x01),
  12838. 139: uint8(0x01),
  12839. 140: uint8(0x01),
  12840. 141: uint8(0x01),
  12841. 142: uint8(0x01),
  12842. 143: uint8(0x01),
  12843. 144: uint8(0x01),
  12844. 145: uint8(0x01),
  12845. 146: uint8(0x01),
  12846. 147: uint8(0x01),
  12847. 148: uint8(0x01),
  12848. 149: uint8(0x01),
  12849. 150: uint8(0x01),
  12850. 151: uint8(0x01),
  12851. 152: uint8(0x01),
  12852. 153: uint8(0x01),
  12853. 154: uint8(0x01),
  12854. 155: uint8(0x01),
  12855. 156: uint8(0x01),
  12856. 157: uint8(0x01),
  12857. 158: uint8(0x01),
  12858. 159: uint8(0x17),
  12859. 172: uint8(0x01),
  12860. 173: uint8(0x01),
  12861. 174: uint8(0x01),
  12862. 175: uint8(0x01),
  12863. 176: uint8(0x01),
  12864. 177: uint8(0x01),
  12865. 178: uint8(0x01),
  12866. 179: uint8(0x01),
  12867. 180: uint8(0x01),
  12868. 181: uint8(0x01),
  12869. 182: uint8(0x01),
  12870. 183: uint8(0x01),
  12871. 184: uint8(0x01),
  12872. 185: uint8(0x01),
  12873. 186: uint8(0x01),
  12874. 187: uint8(0x01),
  12875. 188: uint8(0x01),
  12876. 189: uint8(0x01),
  12877. 190: uint8(0x01),
  12878. 191: uint8(0x01),
  12879. 192: uint8(0x01),
  12880. 193: uint8(0x01),
  12881. 194: uint8(0x01),
  12882. 195: uint8(0x01),
  12883. 196: uint8(0x01),
  12884. 197: uint8(0x01),
  12885. 198: uint8(0x01),
  12886. 199: uint8(0x01),
  12887. 200: uint8(0x01),
  12888. 201: uint8(0x01),
  12889. 202: uint8(0x01),
  12890. 203: uint8(0x01),
  12891. 204: uint8(0x01),
  12892. 205: uint8(0x01),
  12893. 206: uint8(0x01),
  12894. 207: uint8(0x01),
  12895. 208: uint8(0x01),
  12896. 209: uint8(0x01),
  12897. 210: uint8(0x01),
  12898. 211: uint8(0x01),
  12899. 212: uint8(0x01),
  12900. 213: uint8(0x01),
  12901. 214: uint8(0x01),
  12902. 215: uint8(0x18),
  12903. }
  12904. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  12905. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  12906. pages, 3 bits to add to that index and 5 bits to generate the mask.
  12907. */
  12908. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  12909. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  12910. into pages, 3 bits to add to that index and 5 bits to generate the
  12911. mask.
  12912. */
  12913. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  12914. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  12915. with the additional restriction of not allowing the Unicode
  12916. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  12917. Implementation details:
  12918. (A & 0x80) == 0 means A < 0x80
  12919. and
  12920. (A & 0xC0) == 0xC0 means A > 0xBF
  12921. */
  12922. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12923. _ = enc
  12924. _ = p
  12925. return 0
  12926. }
  12927. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12928. _ = enc
  12929. 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))))
  12930. }
  12931. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12932. _ = enc
  12933. 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))))
  12934. }
  12935. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12936. _ = enc
  12937. 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))))
  12938. }
  12939. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12940. _ = enc
  12941. 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))))
  12942. }
  12943. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12944. _ = enc
  12945. 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))
  12946. }
  12947. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12948. var v1, v3, v4 int32
  12949. var v2, v5, v6 bool
  12950. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  12951. _ = enc
  12952. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  12953. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  12954. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  12955. } else {
  12956. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  12957. }
  12958. }
  12959. if v6 = v2 || v1 != 0; !v6 {
  12960. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  12961. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12962. } else {
  12963. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  12964. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  12965. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  12966. } else {
  12967. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12968. }
  12969. }
  12970. v3 = libc.BoolInt32(v5 || v4 != 0)
  12971. }
  12972. }
  12973. return libc.BoolInt32(v6 || v3 != 0)
  12974. }
  12975. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12976. var v1, v2 int32
  12977. var v3, v4 bool
  12978. _, _, _, _ = v1, v2, v3, v4
  12979. _ = enc
  12980. 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 {
  12981. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  12982. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12983. } else {
  12984. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  12985. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  12986. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  12987. } else {
  12988. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12989. }
  12990. }
  12991. v1 = libc.BoolInt32(v3 || v2 != 0)
  12992. }
  12993. }
  12994. return libc.BoolInt32(v4 || v1 != 0)
  12995. }
  12996. type Tnormal_encoding = struct {
  12997. Fenc TENCODING
  12998. Ftype1 [256]uint8
  12999. FisName2 uintptr
  13000. FisName3 uintptr
  13001. FisName4 uintptr
  13002. FisNmstrt2 uintptr
  13003. FisNmstrt3 uintptr
  13004. FisNmstrt4 uintptr
  13005. FisInvalid2 uintptr
  13006. FisInvalid3 uintptr
  13007. FisInvalid4 uintptr
  13008. }
  13009. const _BT_NONXML = 0
  13010. const _BT_MALFORM = 1
  13011. const _BT_LT = 2
  13012. const _BT_AMP = 3
  13013. const _BT_RSQB = 4
  13014. const _BT_LEAD2 = 5
  13015. const _BT_LEAD3 = 6
  13016. const _BT_LEAD4 = 7
  13017. const _BT_TRAIL = 8
  13018. const _BT_CR = 9
  13019. const _BT_LF = 10
  13020. const _BT_GT = 11
  13021. const _BT_QUOT = 12
  13022. const _BT_APOS = 13
  13023. const _BT_EQUALS = 14
  13024. const _BT_QUEST = 15
  13025. const _BT_EXCL = 16
  13026. const _BT_SOL = 17
  13027. const _BT_SEMI = 18
  13028. const _BT_NUM = 19
  13029. const _BT_LSQB = 20
  13030. const _BT_S = 21
  13031. const _BT_NMSTRT = 22
  13032. const _BT_COLON = 23
  13033. const _BT_HEX = 24
  13034. const _BT_DIGIT = 25
  13035. const _BT_NAME = 26
  13036. const _BT_MINUS = 27
  13037. const _BT_OTHER = 28
  13038. const _BT_NONASCII = 29
  13039. const _BT_PERCNT = 30
  13040. const _BT_LPAR = 31
  13041. const _BT_RPAR = 32
  13042. const _BT_AST = 33
  13043. const _BT_PLUS = 34
  13044. const _BT_COMMA = 35
  13045. const _BT_VERBAR = 36
  13046. /*
  13047. __ __ _
  13048. ___\ \/ /_ __ __ _| |_
  13049. / _ \\ /| '_ \ / _` | __|
  13050. | __// \| |_) | (_| | |_
  13051. \___/_/\_\ .__/ \__,_|\__|
  13052. |_| XML parser
  13053. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13054. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13055. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13056. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13057. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13058. Licensed under the MIT license:
  13059. Permission is hereby granted, free of charge, to any person obtaining
  13060. a copy of this software and associated documentation files (the
  13061. "Software"), to deal in the Software without restriction, including
  13062. without limitation the rights to use, copy, modify, merge, publish,
  13063. distribute, sublicense, and/or sell copies of the Software, and to permit
  13064. persons to whom the Software is furnished to do so, subject to the
  13065. following conditions:
  13066. The above copyright notice and this permission notice shall be included
  13067. in all copies or substantial portions of the Software.
  13068. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13069. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13070. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13071. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13072. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13073. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13074. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13075. */
  13076. /* minimum bytes per character */
  13077. /* c is an ASCII character */
  13078. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13079. __ __ _
  13080. ___\ \/ /_ __ __ _| |_
  13081. / _ \\ /| '_ \ / _` | __|
  13082. | __// \| |_) | (_| | |_
  13083. \___/_/\_\ .__/ \__,_|\__|
  13084. |_| XML parser
  13085. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13086. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13087. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13088. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13089. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13090. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13091. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13092. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13093. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13094. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13095. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13096. Licensed under the MIT license:
  13097. Permission is hereby granted, free of charge, to any person obtaining
  13098. a copy of this software and associated documentation files (the
  13099. "Software"), to deal in the Software without restriction, including
  13100. without limitation the rights to use, copy, modify, merge, publish,
  13101. distribute, sublicense, and/or sell copies of the Software, and to permit
  13102. persons to whom the Software is furnished to do so, subject to the
  13103. following conditions:
  13104. The above copyright notice and this permission notice shall be included
  13105. in all copies or substantial portions of the Software.
  13106. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13107. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13108. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13109. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13110. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13111. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13112. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13113. */
  13114. /* ptr points to character following "<!-" */
  13115. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13116. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13117. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13119. return m_XML_TOK_INVALID
  13120. }
  13121. ptr += uintptr(1)
  13122. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13123. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13124. case int32(_BT_LEAD2):
  13125. if int64(end)-int64(ptr) < int64(2) {
  13126. return -int32(2)
  13127. }
  13128. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13130. return m_XML_TOK_INVALID
  13131. }
  13132. ptr += uintptr(2)
  13133. case int32(_BT_LEAD3):
  13134. if int64(end)-int64(ptr) < int64(3) {
  13135. return -int32(2)
  13136. }
  13137. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13139. return m_XML_TOK_INVALID
  13140. }
  13141. ptr += uintptr(3)
  13142. case int32(_BT_LEAD4):
  13143. if int64(end)-int64(ptr) < int64(4) {
  13144. return -int32(2)
  13145. }
  13146. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13148. return m_XML_TOK_INVALID
  13149. }
  13150. ptr += uintptr(4)
  13151. case int32(_BT_NONXML):
  13152. fallthrough
  13153. case int32(_BT_MALFORM):
  13154. fallthrough
  13155. case int32(_BT_TRAIL):
  13156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13157. return m_XML_TOK_INVALID
  13158. case int32(_BT_MINUS):
  13159. ptr += uintptr(1)
  13160. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13161. return -int32(1)
  13162. }
  13163. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13164. ptr += uintptr(1)
  13165. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13166. return -int32(1)
  13167. }
  13168. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13169. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13170. return m_XML_TOK_INVALID
  13171. }
  13172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13173. return int32(m_XML_TOK_COMMENT)
  13174. }
  13175. default:
  13176. ptr += uintptr(1)
  13177. break
  13178. }
  13179. }
  13180. }
  13181. return -int32(1)
  13182. }
  13183. /* ptr points to character following "<!" */
  13184. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13185. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13186. return -int32(1)
  13187. }
  13188. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13189. case int32(_BT_MINUS):
  13190. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13191. case int32(_BT_LSQB):
  13192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13193. return int32(m_XML_TOK_COND_SECT_OPEN)
  13194. case int32(_BT_NMSTRT):
  13195. fallthrough
  13196. case int32(_BT_HEX):
  13197. ptr += uintptr(1)
  13198. default:
  13199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13200. return m_XML_TOK_INVALID
  13201. }
  13202. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13203. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13204. case int32(_BT_PERCNT):
  13205. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  13206. return -int32(1)
  13207. }
  13208. /* don't allow <!ENTITY% foo "whatever"> */
  13209. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) {
  13210. case int32(_BT_S):
  13211. fallthrough
  13212. case int32(_BT_CR):
  13213. fallthrough
  13214. case int32(_BT_LF):
  13215. fallthrough
  13216. case int32(_BT_PERCNT):
  13217. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13218. return m_XML_TOK_INVALID
  13219. }
  13220. /* fall through */
  13221. fallthrough
  13222. case int32(_BT_S):
  13223. fallthrough
  13224. case int32(_BT_CR):
  13225. fallthrough
  13226. case int32(_BT_LF):
  13227. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13228. return int32(m_XML_TOK_DECL_OPEN)
  13229. case int32(_BT_NMSTRT):
  13230. fallthrough
  13231. case int32(_BT_HEX):
  13232. ptr += uintptr(1)
  13233. default:
  13234. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13235. return m_XML_TOK_INVALID
  13236. }
  13237. }
  13238. return -int32(1)
  13239. }
  13240. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13241. var upper int32
  13242. _ = upper
  13243. upper = 0
  13244. _ = enc
  13245. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13246. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  13247. return int32(1)
  13248. }
  13249. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13250. case int32(m_ASCII_x2):
  13251. case int32(m_ASCII_X):
  13252. upper = int32(1)
  13253. default:
  13254. return int32(1)
  13255. }
  13256. ptr += uintptr(1)
  13257. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13258. case int32(m_ASCII_m2):
  13259. case int32(m_ASCII_M):
  13260. upper = int32(1)
  13261. default:
  13262. return int32(1)
  13263. }
  13264. ptr += uintptr(1)
  13265. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13266. case int32(m_ASCII_l2):
  13267. case int32(m_ASCII_L):
  13268. upper = int32(1)
  13269. default:
  13270. return int32(1)
  13271. }
  13272. if upper != 0 {
  13273. return 0
  13274. }
  13275. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13276. return int32(1)
  13277. }
  13278. /* ptr points to character following "<?" */
  13279. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13280. bp := tls.Alloc(16)
  13281. defer tls.Free(16)
  13282. var target uintptr
  13283. var _ /* tok at bp+0 */ int32
  13284. _ = target
  13285. target = ptr
  13286. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13287. return -int32(1)
  13288. }
  13289. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13290. case int32(_BT_NONASCII):
  13291. if !(libc.Int32FromInt32(0) != 0) {
  13292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13293. return m_XML_TOK_INVALID
  13294. } /* fall through */
  13295. fallthrough
  13296. case int32(_BT_NMSTRT):
  13297. fallthrough
  13298. case int32(_BT_HEX):
  13299. ptr += uintptr(1)
  13300. case int32(_BT_LEAD2):
  13301. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13302. return -int32(2)
  13303. }
  13304. 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) {
  13305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13306. return m_XML_TOK_INVALID
  13307. }
  13308. ptr += uintptr(2)
  13309. case int32(_BT_LEAD3):
  13310. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13311. return -int32(2)
  13312. }
  13313. 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) {
  13314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13315. return m_XML_TOK_INVALID
  13316. }
  13317. ptr += uintptr(3)
  13318. case int32(_BT_LEAD4):
  13319. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13320. return -int32(2)
  13321. }
  13322. 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) {
  13323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13324. return m_XML_TOK_INVALID
  13325. }
  13326. ptr += uintptr(4)
  13327. default:
  13328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13329. return m_XML_TOK_INVALID
  13330. }
  13331. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13332. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13333. case int32(_BT_NONASCII):
  13334. if !(libc.Int32FromInt32(0) != 0) {
  13335. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13336. return m_XML_TOK_INVALID
  13337. } /* fall through */
  13338. fallthrough
  13339. case int32(_BT_NMSTRT):
  13340. fallthrough
  13341. case int32(_BT_HEX):
  13342. fallthrough
  13343. case int32(_BT_DIGIT):
  13344. fallthrough
  13345. case int32(_BT_NAME):
  13346. fallthrough
  13347. case int32(_BT_MINUS):
  13348. ptr += uintptr(1)
  13349. case int32(_BT_LEAD2):
  13350. if int64(end)-int64(ptr) < int64(2) {
  13351. return -int32(2)
  13352. }
  13353. 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) {
  13354. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13355. return m_XML_TOK_INVALID
  13356. }
  13357. ptr += uintptr(2)
  13358. case int32(_BT_LEAD3):
  13359. if int64(end)-int64(ptr) < int64(3) {
  13360. return -int32(2)
  13361. }
  13362. 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) {
  13363. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13364. return m_XML_TOK_INVALID
  13365. }
  13366. ptr += uintptr(3)
  13367. case int32(_BT_LEAD4):
  13368. if int64(end)-int64(ptr) < int64(4) {
  13369. return -int32(2)
  13370. }
  13371. 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) {
  13372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13373. return m_XML_TOK_INVALID
  13374. }
  13375. ptr += uintptr(4)
  13376. case int32(_BT_S):
  13377. fallthrough
  13378. case int32(_BT_CR):
  13379. fallthrough
  13380. case int32(_BT_LF):
  13381. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13383. return m_XML_TOK_INVALID
  13384. }
  13385. ptr += uintptr(1)
  13386. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13387. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13388. case int32(_BT_LEAD2):
  13389. if int64(end)-int64(ptr) < int64(2) {
  13390. return -int32(2)
  13391. }
  13392. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13394. return m_XML_TOK_INVALID
  13395. }
  13396. ptr += uintptr(2)
  13397. case int32(_BT_LEAD3):
  13398. if int64(end)-int64(ptr) < int64(3) {
  13399. return -int32(2)
  13400. }
  13401. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13402. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13403. return m_XML_TOK_INVALID
  13404. }
  13405. ptr += uintptr(3)
  13406. case int32(_BT_LEAD4):
  13407. if int64(end)-int64(ptr) < int64(4) {
  13408. return -int32(2)
  13409. }
  13410. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13412. return m_XML_TOK_INVALID
  13413. }
  13414. ptr += uintptr(4)
  13415. case int32(_BT_NONXML):
  13416. fallthrough
  13417. case int32(_BT_MALFORM):
  13418. fallthrough
  13419. case int32(_BT_TRAIL):
  13420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13421. return m_XML_TOK_INVALID
  13422. case int32(_BT_QUEST):
  13423. ptr += uintptr(1)
  13424. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13425. return -int32(1)
  13426. }
  13427. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13429. return *(*int32)(unsafe.Pointer(bp))
  13430. }
  13431. default:
  13432. ptr += uintptr(1)
  13433. break
  13434. }
  13435. }
  13436. return -int32(1)
  13437. case int32(_BT_QUEST):
  13438. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13439. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13440. return m_XML_TOK_INVALID
  13441. }
  13442. ptr += uintptr(1)
  13443. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13444. return -int32(1)
  13445. }
  13446. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13447. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13448. return *(*int32)(unsafe.Pointer(bp))
  13449. }
  13450. /* fall through */
  13451. fallthrough
  13452. default:
  13453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13454. return m_XML_TOK_INVALID
  13455. }
  13456. }
  13457. return -int32(1)
  13458. }
  13459. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13460. var i int32
  13461. _ = i
  13462. _ = enc
  13463. /* CDATA[ */
  13464. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  13465. return -int32(1)
  13466. }
  13467. i = 0
  13468. for {
  13469. if !(i < int32(6)) {
  13470. break
  13471. }
  13472. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB[i])) {
  13473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13474. return m_XML_TOK_INVALID
  13475. }
  13476. goto _1
  13477. _1:
  13478. ;
  13479. i++
  13480. ptr += uintptr(1)
  13481. }
  13482. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13483. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13484. }
  13485. var _CDATA_LSQB = [6]uint8{
  13486. 0: uint8(m_ASCII_C),
  13487. 1: uint8(m_ASCII_D),
  13488. 2: uint8(m_ASCII_A),
  13489. 3: uint8(m_ASCII_T),
  13490. 4: uint8(m_ASCII_A),
  13491. 5: uint8(m_ASCII_LSQB1),
  13492. }
  13493. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13494. var n Tsize_t
  13495. _ = n
  13496. if ptr >= end {
  13497. return -int32(4)
  13498. }
  13499. if int32(1) > int32(1) {
  13500. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13501. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13502. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13503. if n == uint64(0) {
  13504. return -int32(1)
  13505. }
  13506. end = ptr + uintptr(n)
  13507. }
  13508. }
  13509. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13510. case int32(_BT_RSQB):
  13511. ptr += uintptr(1)
  13512. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13513. return -int32(1)
  13514. }
  13515. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13516. break
  13517. }
  13518. ptr += uintptr(1)
  13519. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13520. return -int32(1)
  13521. }
  13522. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13523. ptr -= uintptr(1)
  13524. break
  13525. }
  13526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13527. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13528. case int32(_BT_CR):
  13529. ptr += uintptr(1)
  13530. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13531. return -int32(1)
  13532. }
  13533. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13534. ptr += uintptr(1)
  13535. }
  13536. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13537. return int32(m_XML_TOK_DATA_NEWLINE)
  13538. case int32(_BT_LF):
  13539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13540. return int32(m_XML_TOK_DATA_NEWLINE)
  13541. case int32(_BT_LEAD2):
  13542. if int64(end)-int64(ptr) < int64(2) {
  13543. return -int32(2)
  13544. }
  13545. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13547. return m_XML_TOK_INVALID
  13548. }
  13549. ptr += uintptr(2)
  13550. case int32(_BT_LEAD3):
  13551. if int64(end)-int64(ptr) < int64(3) {
  13552. return -int32(2)
  13553. }
  13554. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13556. return m_XML_TOK_INVALID
  13557. }
  13558. ptr += uintptr(3)
  13559. case int32(_BT_LEAD4):
  13560. if int64(end)-int64(ptr) < int64(4) {
  13561. return -int32(2)
  13562. }
  13563. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13564. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13565. return m_XML_TOK_INVALID
  13566. }
  13567. ptr += uintptr(4)
  13568. case int32(_BT_NONXML):
  13569. fallthrough
  13570. case int32(_BT_MALFORM):
  13571. fallthrough
  13572. case int32(_BT_TRAIL):
  13573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13574. return m_XML_TOK_INVALID
  13575. default:
  13576. ptr += uintptr(1)
  13577. break
  13578. }
  13579. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13580. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13581. case int32(_BT_LEAD2):
  13582. 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 {
  13583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13584. return int32(m_XML_TOK_DATA_CHARS)
  13585. }
  13586. ptr += uintptr(2)
  13587. case int32(_BT_LEAD3):
  13588. 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 {
  13589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13590. return int32(m_XML_TOK_DATA_CHARS)
  13591. }
  13592. ptr += uintptr(3)
  13593. case int32(_BT_LEAD4):
  13594. 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 {
  13595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13596. return int32(m_XML_TOK_DATA_CHARS)
  13597. }
  13598. ptr += uintptr(4)
  13599. case int32(_BT_NONXML):
  13600. fallthrough
  13601. case int32(_BT_MALFORM):
  13602. fallthrough
  13603. case int32(_BT_TRAIL):
  13604. fallthrough
  13605. case int32(_BT_CR):
  13606. fallthrough
  13607. case int32(_BT_LF):
  13608. fallthrough
  13609. case int32(_BT_RSQB):
  13610. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13611. return int32(m_XML_TOK_DATA_CHARS)
  13612. default:
  13613. ptr += uintptr(1)
  13614. break
  13615. }
  13616. }
  13617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13618. return int32(m_XML_TOK_DATA_CHARS)
  13619. }
  13620. /* ptr points to character following "</" */
  13621. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13622. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13623. return -int32(1)
  13624. }
  13625. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13626. case int32(_BT_NONASCII):
  13627. if !(libc.Int32FromInt32(0) != 0) {
  13628. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13629. return m_XML_TOK_INVALID
  13630. } /* fall through */
  13631. fallthrough
  13632. case int32(_BT_NMSTRT):
  13633. fallthrough
  13634. case int32(_BT_HEX):
  13635. ptr += uintptr(1)
  13636. case int32(_BT_LEAD2):
  13637. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13638. return -int32(2)
  13639. }
  13640. 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) {
  13641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13642. return m_XML_TOK_INVALID
  13643. }
  13644. ptr += uintptr(2)
  13645. case int32(_BT_LEAD3):
  13646. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13647. return -int32(2)
  13648. }
  13649. 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) {
  13650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13651. return m_XML_TOK_INVALID
  13652. }
  13653. ptr += uintptr(3)
  13654. case int32(_BT_LEAD4):
  13655. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13656. return -int32(2)
  13657. }
  13658. 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) {
  13659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13660. return m_XML_TOK_INVALID
  13661. }
  13662. ptr += uintptr(4)
  13663. default:
  13664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13665. return m_XML_TOK_INVALID
  13666. }
  13667. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13668. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13669. case int32(_BT_NONASCII):
  13670. goto _1
  13671. case int32(_BT_MINUS):
  13672. goto _2
  13673. case int32(_BT_NAME):
  13674. goto _3
  13675. case int32(_BT_DIGIT):
  13676. goto _4
  13677. case int32(_BT_HEX):
  13678. goto _5
  13679. case int32(_BT_NMSTRT):
  13680. goto _6
  13681. case int32(_BT_LEAD2):
  13682. goto _7
  13683. case int32(_BT_LEAD3):
  13684. goto _8
  13685. case int32(_BT_LEAD4):
  13686. goto _9
  13687. case int32(_BT_LF):
  13688. goto _10
  13689. case int32(_BT_CR):
  13690. goto _11
  13691. case int32(_BT_S):
  13692. goto _12
  13693. case int32(_BT_COLON):
  13694. goto _13
  13695. case int32(_BT_GT):
  13696. goto _14
  13697. default:
  13698. goto _15
  13699. }
  13700. goto _16
  13701. _1:
  13702. ;
  13703. if !(libc.Int32FromInt32(0) != 0) {
  13704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13705. return m_XML_TOK_INVALID
  13706. } /* fall through */
  13707. _6:
  13708. ;
  13709. _5:
  13710. ;
  13711. _4:
  13712. ;
  13713. _3:
  13714. ;
  13715. _2:
  13716. ;
  13717. ptr += uintptr(1)
  13718. goto _16
  13719. _7:
  13720. ;
  13721. if int64(end)-int64(ptr) < int64(2) {
  13722. return -int32(2)
  13723. }
  13724. 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) {
  13725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13726. return m_XML_TOK_INVALID
  13727. }
  13728. ptr += uintptr(2)
  13729. goto _16
  13730. _8:
  13731. ;
  13732. if int64(end)-int64(ptr) < int64(3) {
  13733. return -int32(2)
  13734. }
  13735. 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) {
  13736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13737. return m_XML_TOK_INVALID
  13738. }
  13739. ptr += uintptr(3)
  13740. goto _16
  13741. _9:
  13742. ;
  13743. if int64(end)-int64(ptr) < int64(4) {
  13744. return -int32(2)
  13745. }
  13746. 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) {
  13747. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13748. return m_XML_TOK_INVALID
  13749. }
  13750. ptr += uintptr(4)
  13751. goto _16
  13752. _12:
  13753. ;
  13754. _11:
  13755. ;
  13756. _10:
  13757. ;
  13758. ptr += uintptr(1)
  13759. _19:
  13760. ;
  13761. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13762. goto _17
  13763. }
  13764. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13765. case int32(_BT_S):
  13766. fallthrough
  13767. case int32(_BT_CR):
  13768. fallthrough
  13769. case int32(_BT_LF):
  13770. case int32(_BT_GT):
  13771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13772. return int32(m_XML_TOK_END_TAG)
  13773. default:
  13774. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13775. return m_XML_TOK_INVALID
  13776. }
  13777. goto _18
  13778. _18:
  13779. ;
  13780. ptr += uintptr(1)
  13781. goto _19
  13782. goto _17
  13783. _17:
  13784. ;
  13785. return -int32(1)
  13786. _13:
  13787. ;
  13788. /* no need to check qname syntax here,
  13789. since end-tag must match exactly */
  13790. ptr += uintptr(1)
  13791. goto _16
  13792. _14:
  13793. ;
  13794. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13795. return int32(m_XML_TOK_END_TAG)
  13796. _15:
  13797. ;
  13798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13799. return m_XML_TOK_INVALID
  13800. _16:
  13801. }
  13802. return -int32(1)
  13803. }
  13804. /* ptr points to character following "&#X" */
  13805. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13806. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13807. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13808. case int32(_BT_DIGIT):
  13809. fallthrough
  13810. case int32(_BT_HEX):
  13811. default:
  13812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13813. return m_XML_TOK_INVALID
  13814. }
  13815. ptr += uintptr(1)
  13816. for {
  13817. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13818. break
  13819. }
  13820. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13821. case int32(_BT_DIGIT):
  13822. fallthrough
  13823. case int32(_BT_HEX):
  13824. case int32(_BT_SEMI):
  13825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13826. return int32(m_XML_TOK_CHAR_REF)
  13827. default:
  13828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13829. return m_XML_TOK_INVALID
  13830. }
  13831. goto _1
  13832. _1:
  13833. ;
  13834. ptr += uintptr(1)
  13835. }
  13836. }
  13837. return -int32(1)
  13838. }
  13839. /* ptr points to character following "&#" */
  13840. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13841. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13842. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  13843. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13844. }
  13845. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13846. case int32(_BT_DIGIT):
  13847. default:
  13848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13849. return m_XML_TOK_INVALID
  13850. }
  13851. ptr += uintptr(1)
  13852. for {
  13853. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13854. break
  13855. }
  13856. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13857. case int32(_BT_DIGIT):
  13858. case int32(_BT_SEMI):
  13859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13860. return int32(m_XML_TOK_CHAR_REF)
  13861. default:
  13862. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13863. return m_XML_TOK_INVALID
  13864. }
  13865. goto _1
  13866. _1:
  13867. ;
  13868. ptr += uintptr(1)
  13869. }
  13870. }
  13871. return -int32(1)
  13872. }
  13873. /* ptr points to character following "&" */
  13874. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13875. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13876. return -int32(1)
  13877. }
  13878. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13879. case int32(_BT_NONASCII):
  13880. if !(libc.Int32FromInt32(0) != 0) {
  13881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13882. return m_XML_TOK_INVALID
  13883. } /* fall through */
  13884. fallthrough
  13885. case int32(_BT_NMSTRT):
  13886. fallthrough
  13887. case int32(_BT_HEX):
  13888. ptr += uintptr(1)
  13889. case int32(_BT_LEAD2):
  13890. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  13891. return -int32(2)
  13892. }
  13893. 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) {
  13894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13895. return m_XML_TOK_INVALID
  13896. }
  13897. ptr += uintptr(2)
  13898. case int32(_BT_LEAD3):
  13899. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  13900. return -int32(2)
  13901. }
  13902. 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) {
  13903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13904. return m_XML_TOK_INVALID
  13905. }
  13906. ptr += uintptr(3)
  13907. case int32(_BT_LEAD4):
  13908. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  13909. return -int32(2)
  13910. }
  13911. 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) {
  13912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13913. return m_XML_TOK_INVALID
  13914. }
  13915. ptr += uintptr(4)
  13916. case int32(_BT_NUM):
  13917. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13918. default:
  13919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13920. return m_XML_TOK_INVALID
  13921. }
  13922. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13923. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13924. case int32(_BT_NONASCII):
  13925. if !(libc.Int32FromInt32(0) != 0) {
  13926. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13927. return m_XML_TOK_INVALID
  13928. } /* fall through */
  13929. fallthrough
  13930. case int32(_BT_NMSTRT):
  13931. fallthrough
  13932. case int32(_BT_HEX):
  13933. fallthrough
  13934. case int32(_BT_DIGIT):
  13935. fallthrough
  13936. case int32(_BT_NAME):
  13937. fallthrough
  13938. case int32(_BT_MINUS):
  13939. ptr += uintptr(1)
  13940. case int32(_BT_LEAD2):
  13941. if int64(end)-int64(ptr) < int64(2) {
  13942. return -int32(2)
  13943. }
  13944. 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) {
  13945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13946. return m_XML_TOK_INVALID
  13947. }
  13948. ptr += uintptr(2)
  13949. case int32(_BT_LEAD3):
  13950. if int64(end)-int64(ptr) < int64(3) {
  13951. return -int32(2)
  13952. }
  13953. 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) {
  13954. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13955. return m_XML_TOK_INVALID
  13956. }
  13957. ptr += uintptr(3)
  13958. case int32(_BT_LEAD4):
  13959. if int64(end)-int64(ptr) < int64(4) {
  13960. return -int32(2)
  13961. }
  13962. 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) {
  13963. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13964. return m_XML_TOK_INVALID
  13965. }
  13966. ptr += uintptr(4)
  13967. case int32(_BT_SEMI):
  13968. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13969. return int32(m_XML_TOK_ENTITY_REF)
  13970. default:
  13971. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13972. return m_XML_TOK_INVALID
  13973. }
  13974. }
  13975. return -int32(1)
  13976. }
  13977. /* ptr points to character following first character of attribute name */
  13978. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13979. bp := tls.Alloc(16)
  13980. defer tls.Free(16)
  13981. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  13982. var hadColon, open, t, t1, tok int32
  13983. _, _, _, _, _ = hadColon, open, t, t1, tok
  13984. hadColon = 0
  13985. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13986. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  13987. case int32(_BT_NONASCII):
  13988. goto _1
  13989. case int32(_BT_MINUS):
  13990. goto _2
  13991. case int32(_BT_NAME):
  13992. goto _3
  13993. case int32(_BT_DIGIT):
  13994. goto _4
  13995. case int32(_BT_HEX):
  13996. goto _5
  13997. case int32(_BT_NMSTRT):
  13998. goto _6
  13999. case int32(_BT_LEAD2):
  14000. goto _7
  14001. case int32(_BT_LEAD3):
  14002. goto _8
  14003. case int32(_BT_LEAD4):
  14004. goto _9
  14005. case int32(_BT_COLON):
  14006. goto _10
  14007. case int32(_BT_LF):
  14008. goto _11
  14009. case int32(_BT_CR):
  14010. goto _12
  14011. case int32(_BT_S):
  14012. goto _13
  14013. case int32(_BT_EQUALS):
  14014. goto _14
  14015. default:
  14016. goto _15
  14017. }
  14018. goto _16
  14019. _1:
  14020. ;
  14021. if !(libc.Int32FromInt32(0) != 0) {
  14022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14023. return m_XML_TOK_INVALID
  14024. } /* fall through */
  14025. _6:
  14026. ;
  14027. _5:
  14028. ;
  14029. _4:
  14030. ;
  14031. _3:
  14032. ;
  14033. _2:
  14034. ;
  14035. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14036. goto _16
  14037. _7:
  14038. ;
  14039. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14040. return -int32(2)
  14041. }
  14042. 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) {
  14043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14044. return m_XML_TOK_INVALID
  14045. }
  14046. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14047. goto _16
  14048. _8:
  14049. ;
  14050. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < 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, *(*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) {
  14054. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14055. return m_XML_TOK_INVALID
  14056. }
  14057. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14058. goto _16
  14059. _9:
  14060. ;
  14061. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14062. return -int32(2)
  14063. }
  14064. 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) {
  14065. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14066. return m_XML_TOK_INVALID
  14067. }
  14068. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14069. goto _16
  14070. _10:
  14071. ;
  14072. if hadColon != 0 {
  14073. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14074. return m_XML_TOK_INVALID
  14075. }
  14076. hadColon = int32(1)
  14077. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14078. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14079. return -int32(1)
  14080. }
  14081. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14082. case int32(_BT_NONASCII):
  14083. if !(libc.Int32FromInt32(0) != 0) {
  14084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14085. return m_XML_TOK_INVALID
  14086. } /* fall through */
  14087. fallthrough
  14088. case int32(_BT_NMSTRT):
  14089. fallthrough
  14090. case int32(_BT_HEX):
  14091. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14092. case int32(_BT_LEAD2):
  14093. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14094. return -int32(2)
  14095. }
  14096. 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) {
  14097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14098. return m_XML_TOK_INVALID
  14099. }
  14100. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14101. case int32(_BT_LEAD3):
  14102. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14103. return -int32(2)
  14104. }
  14105. 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) {
  14106. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14107. return m_XML_TOK_INVALID
  14108. }
  14109. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14110. case int32(_BT_LEAD4):
  14111. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14112. return -int32(2)
  14113. }
  14114. 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) {
  14115. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14116. return m_XML_TOK_INVALID
  14117. }
  14118. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14119. default:
  14120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14121. return m_XML_TOK_INVALID
  14122. }
  14123. goto _16
  14124. _13:
  14125. ;
  14126. _12:
  14127. ;
  14128. _11:
  14129. ;
  14130. _19:
  14131. ;
  14132. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14133. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14134. return -int32(1)
  14135. }
  14136. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14137. if t == int32(_BT_EQUALS) {
  14138. goto _17
  14139. }
  14140. switch t {
  14141. case int32(_BT_S):
  14142. fallthrough
  14143. case int32(_BT_LF):
  14144. fallthrough
  14145. case int32(_BT_CR):
  14146. default:
  14147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14148. return m_XML_TOK_INVALID
  14149. }
  14150. goto _18
  14151. _18:
  14152. ;
  14153. goto _19
  14154. goto _17
  14155. _17:
  14156. ;
  14157. /* fall through */
  14158. _14:
  14159. ;
  14160. hadColon = 0
  14161. for {
  14162. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14163. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14164. return -int32(1)
  14165. }
  14166. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14167. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14168. break
  14169. }
  14170. switch open {
  14171. case int32(_BT_S):
  14172. fallthrough
  14173. case int32(_BT_LF):
  14174. fallthrough
  14175. case int32(_BT_CR):
  14176. default:
  14177. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14178. return m_XML_TOK_INVALID
  14179. }
  14180. goto _20
  14181. _20:
  14182. }
  14183. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14184. /* in attribute value */
  14185. for {
  14186. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14187. return -int32(1)
  14188. }
  14189. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  14190. if t1 == open {
  14191. break
  14192. }
  14193. switch t1 {
  14194. case int32(_BT_LEAD2):
  14195. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  14196. return -int32(2)
  14197. }
  14198. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14200. return m_XML_TOK_INVALID
  14201. }
  14202. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14203. case int32(_BT_LEAD3):
  14204. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  14205. return -int32(2)
  14206. }
  14207. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14209. return m_XML_TOK_INVALID
  14210. }
  14211. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14212. case int32(_BT_LEAD4):
  14213. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  14214. return -int32(2)
  14215. }
  14216. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14217. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14218. return m_XML_TOK_INVALID
  14219. }
  14220. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14221. case int32(_BT_NONXML):
  14222. fallthrough
  14223. case int32(_BT_MALFORM):
  14224. fallthrough
  14225. case int32(_BT_TRAIL):
  14226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14227. return m_XML_TOK_INVALID
  14228. case int32(_BT_AMP):
  14229. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14230. if tok <= 0 {
  14231. if tok == m_XML_TOK_INVALID {
  14232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14233. }
  14234. return tok
  14235. }
  14236. case int32(_BT_LT):
  14237. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14238. return m_XML_TOK_INVALID
  14239. default:
  14240. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14241. break
  14242. }
  14243. goto _21
  14244. _21:
  14245. }
  14246. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14247. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14248. return -int32(1)
  14249. }
  14250. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14251. case int32(_BT_S):
  14252. fallthrough
  14253. case int32(_BT_CR):
  14254. fallthrough
  14255. case int32(_BT_LF):
  14256. case int32(_BT_SOL):
  14257. goto sol
  14258. case int32(_BT_GT):
  14259. goto gt
  14260. default:
  14261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14262. return m_XML_TOK_INVALID
  14263. }
  14264. /* ptr points to closing quote */
  14265. _24:
  14266. ;
  14267. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14268. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14269. return -int32(1)
  14270. }
  14271. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  14272. case int32(_BT_NONASCII):
  14273. goto _25
  14274. case int32(_BT_HEX):
  14275. goto _26
  14276. case int32(_BT_NMSTRT):
  14277. goto _27
  14278. case int32(_BT_LEAD2):
  14279. goto _28
  14280. case int32(_BT_LEAD3):
  14281. goto _29
  14282. case int32(_BT_LEAD4):
  14283. goto _30
  14284. case int32(_BT_LF):
  14285. goto _31
  14286. case int32(_BT_CR):
  14287. goto _32
  14288. case int32(_BT_S):
  14289. goto _33
  14290. case int32(_BT_GT):
  14291. goto _34
  14292. case int32(_BT_SOL):
  14293. goto _35
  14294. default:
  14295. goto _36
  14296. }
  14297. goto _37
  14298. _25:
  14299. ;
  14300. if !(libc.Int32FromInt32(0) != 0) {
  14301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14302. return m_XML_TOK_INVALID
  14303. } /* fall through */
  14304. _27:
  14305. ;
  14306. _26:
  14307. ;
  14308. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14309. goto _37
  14310. _28:
  14311. ;
  14312. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  14313. return -int32(2)
  14314. }
  14315. 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) {
  14316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14317. return m_XML_TOK_INVALID
  14318. }
  14319. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14320. goto _37
  14321. _29:
  14322. ;
  14323. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  14324. return -int32(2)
  14325. }
  14326. 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) {
  14327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14328. return m_XML_TOK_INVALID
  14329. }
  14330. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14331. goto _37
  14332. _30:
  14333. ;
  14334. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  14335. return -int32(2)
  14336. }
  14337. 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) {
  14338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14339. return m_XML_TOK_INVALID
  14340. }
  14341. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14342. goto _37
  14343. _33:
  14344. ;
  14345. _32:
  14346. ;
  14347. _31:
  14348. ;
  14349. goto _23
  14350. _34:
  14351. ;
  14352. goto gt
  14353. gt:
  14354. ;
  14355. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14356. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14357. _35:
  14358. ;
  14359. goto sol
  14360. sol:
  14361. ;
  14362. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14363. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14364. return -int32(1)
  14365. }
  14366. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14368. return m_XML_TOK_INVALID
  14369. }
  14370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14371. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14372. _36:
  14373. ;
  14374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14375. return m_XML_TOK_INVALID
  14376. _37:
  14377. ;
  14378. goto _22
  14379. goto _23
  14380. _23:
  14381. ;
  14382. goto _24
  14383. goto _22
  14384. _22:
  14385. ;
  14386. goto _16
  14387. _15:
  14388. ;
  14389. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14390. return m_XML_TOK_INVALID
  14391. _16:
  14392. }
  14393. return -int32(1)
  14394. }
  14395. /* ptr points to character following "<" */
  14396. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14397. var hadColon int32
  14398. _ = hadColon
  14399. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14400. return -int32(1)
  14401. }
  14402. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14403. case int32(_BT_NONASCII):
  14404. if !(libc.Int32FromInt32(0) != 0) {
  14405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14406. return m_XML_TOK_INVALID
  14407. } /* fall through */
  14408. fallthrough
  14409. case int32(_BT_NMSTRT):
  14410. fallthrough
  14411. case int32(_BT_HEX):
  14412. ptr += uintptr(1)
  14413. case int32(_BT_LEAD2):
  14414. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14415. return -int32(2)
  14416. }
  14417. 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) {
  14418. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14419. return m_XML_TOK_INVALID
  14420. }
  14421. ptr += uintptr(2)
  14422. case int32(_BT_LEAD3):
  14423. if int64(end)-int64(ptr) < 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, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14428. return m_XML_TOK_INVALID
  14429. }
  14430. ptr += uintptr(3)
  14431. case int32(_BT_LEAD4):
  14432. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14433. return -int32(2)
  14434. }
  14435. 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) {
  14436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14437. return m_XML_TOK_INVALID
  14438. }
  14439. ptr += uintptr(4)
  14440. case int32(_BT_EXCL):
  14441. ptr += uintptr(1)
  14442. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14443. return -int32(1)
  14444. }
  14445. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14446. case int32(_BT_MINUS):
  14447. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14448. case int32(_BT_LSQB):
  14449. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14450. }
  14451. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14452. return m_XML_TOK_INVALID
  14453. case int32(_BT_QUEST):
  14454. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14455. case int32(_BT_SOL):
  14456. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14457. default:
  14458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14459. return m_XML_TOK_INVALID
  14460. }
  14461. hadColon = 0
  14462. /* we have a start-tag */
  14463. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14464. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14465. case int32(_BT_NONASCII):
  14466. goto _1
  14467. case int32(_BT_MINUS):
  14468. goto _2
  14469. case int32(_BT_NAME):
  14470. goto _3
  14471. case int32(_BT_DIGIT):
  14472. goto _4
  14473. case int32(_BT_HEX):
  14474. goto _5
  14475. case int32(_BT_NMSTRT):
  14476. goto _6
  14477. case int32(_BT_LEAD2):
  14478. goto _7
  14479. case int32(_BT_LEAD3):
  14480. goto _8
  14481. case int32(_BT_LEAD4):
  14482. goto _9
  14483. case int32(_BT_COLON):
  14484. goto _10
  14485. case int32(_BT_LF):
  14486. goto _11
  14487. case int32(_BT_CR):
  14488. goto _12
  14489. case int32(_BT_S):
  14490. goto _13
  14491. case int32(_BT_GT):
  14492. goto _14
  14493. case int32(_BT_SOL):
  14494. goto _15
  14495. default:
  14496. goto _16
  14497. }
  14498. goto _17
  14499. _1:
  14500. ;
  14501. if !(libc.Int32FromInt32(0) != 0) {
  14502. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14503. return m_XML_TOK_INVALID
  14504. } /* fall through */
  14505. _6:
  14506. ;
  14507. _5:
  14508. ;
  14509. _4:
  14510. ;
  14511. _3:
  14512. ;
  14513. _2:
  14514. ;
  14515. ptr += uintptr(1)
  14516. goto _17
  14517. _7:
  14518. ;
  14519. if int64(end)-int64(ptr) < int64(2) {
  14520. return -int32(2)
  14521. }
  14522. 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) {
  14523. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14524. return m_XML_TOK_INVALID
  14525. }
  14526. ptr += uintptr(2)
  14527. goto _17
  14528. _8:
  14529. ;
  14530. if int64(end)-int64(ptr) < int64(3) {
  14531. return -int32(2)
  14532. }
  14533. 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) {
  14534. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14535. return m_XML_TOK_INVALID
  14536. }
  14537. ptr += uintptr(3)
  14538. goto _17
  14539. _9:
  14540. ;
  14541. if int64(end)-int64(ptr) < int64(4) {
  14542. return -int32(2)
  14543. }
  14544. 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) {
  14545. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14546. return m_XML_TOK_INVALID
  14547. }
  14548. ptr += uintptr(4)
  14549. goto _17
  14550. _10:
  14551. ;
  14552. if hadColon != 0 {
  14553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14554. return m_XML_TOK_INVALID
  14555. }
  14556. hadColon = int32(1)
  14557. ptr += uintptr(1)
  14558. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14559. return -int32(1)
  14560. }
  14561. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14562. case int32(_BT_NONASCII):
  14563. if !(libc.Int32FromInt32(0) != 0) {
  14564. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14565. return m_XML_TOK_INVALID
  14566. } /* fall through */
  14567. fallthrough
  14568. case int32(_BT_NMSTRT):
  14569. fallthrough
  14570. case int32(_BT_HEX):
  14571. ptr += uintptr(1)
  14572. case int32(_BT_LEAD2):
  14573. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14574. return -int32(2)
  14575. }
  14576. 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) {
  14577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14578. return m_XML_TOK_INVALID
  14579. }
  14580. ptr += uintptr(2)
  14581. case int32(_BT_LEAD3):
  14582. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14583. return -int32(2)
  14584. }
  14585. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  14586. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14587. return m_XML_TOK_INVALID
  14588. }
  14589. ptr += uintptr(3)
  14590. case int32(_BT_LEAD4):
  14591. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14592. return -int32(2)
  14593. }
  14594. 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) {
  14595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14596. return m_XML_TOK_INVALID
  14597. }
  14598. ptr += uintptr(4)
  14599. default:
  14600. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14601. return m_XML_TOK_INVALID
  14602. }
  14603. goto _17
  14604. _13:
  14605. ;
  14606. _12:
  14607. ;
  14608. _11:
  14609. ;
  14610. ptr += uintptr(1)
  14611. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14612. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14613. case int32(_BT_NONASCII):
  14614. if !(libc.Int32FromInt32(0) != 0) {
  14615. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14616. return m_XML_TOK_INVALID
  14617. } /* fall through */
  14618. fallthrough
  14619. case int32(_BT_NMSTRT):
  14620. fallthrough
  14621. case int32(_BT_HEX):
  14622. ptr += uintptr(1)
  14623. case int32(_BT_LEAD2):
  14624. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14625. return -int32(2)
  14626. }
  14627. 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) {
  14628. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14629. return m_XML_TOK_INVALID
  14630. }
  14631. ptr += uintptr(2)
  14632. case int32(_BT_LEAD3):
  14633. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14634. return -int32(2)
  14635. }
  14636. 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) {
  14637. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14638. return m_XML_TOK_INVALID
  14639. }
  14640. ptr += uintptr(3)
  14641. case int32(_BT_LEAD4):
  14642. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14643. return -int32(2)
  14644. }
  14645. 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) {
  14646. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14647. return m_XML_TOK_INVALID
  14648. }
  14649. ptr += uintptr(4)
  14650. case int32(_BT_GT):
  14651. goto gt
  14652. case int32(_BT_SOL):
  14653. goto sol
  14654. case int32(_BT_S):
  14655. fallthrough
  14656. case int32(_BT_CR):
  14657. fallthrough
  14658. case int32(_BT_LF):
  14659. ptr += uintptr(1)
  14660. continue
  14661. default:
  14662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14663. return m_XML_TOK_INVALID
  14664. }
  14665. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14666. }
  14667. return -int32(1)
  14668. _14:
  14669. ;
  14670. goto gt
  14671. gt:
  14672. ;
  14673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14674. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14675. _15:
  14676. ;
  14677. goto sol
  14678. sol:
  14679. ;
  14680. ptr += uintptr(1)
  14681. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14682. return -int32(1)
  14683. }
  14684. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14686. return m_XML_TOK_INVALID
  14687. }
  14688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14689. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14690. _16:
  14691. ;
  14692. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14693. return m_XML_TOK_INVALID
  14694. _17:
  14695. }
  14696. return -int32(1)
  14697. }
  14698. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14699. var n Tsize_t
  14700. _ = n
  14701. if ptr >= end {
  14702. return -int32(4)
  14703. }
  14704. if int32(1) > int32(1) {
  14705. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  14706. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14707. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14708. if n == uint64(0) {
  14709. return -int32(1)
  14710. }
  14711. end = ptr + uintptr(n)
  14712. }
  14713. }
  14714. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14715. case int32(_BT_LT):
  14716. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14717. case int32(_BT_AMP):
  14718. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14719. case int32(_BT_CR):
  14720. ptr += uintptr(1)
  14721. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14722. return -int32(3)
  14723. }
  14724. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  14725. ptr += uintptr(1)
  14726. }
  14727. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14728. return int32(m_XML_TOK_DATA_NEWLINE)
  14729. case int32(_BT_LF):
  14730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14731. return int32(m_XML_TOK_DATA_NEWLINE)
  14732. case int32(_BT_RSQB):
  14733. ptr += uintptr(1)
  14734. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14735. return -int32(5)
  14736. }
  14737. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14738. break
  14739. }
  14740. ptr += uintptr(1)
  14741. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14742. return -int32(5)
  14743. }
  14744. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14745. ptr -= uintptr(1)
  14746. break
  14747. }
  14748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14749. return m_XML_TOK_INVALID
  14750. case int32(_BT_LEAD2):
  14751. if int64(end)-int64(ptr) < int64(2) {
  14752. return -int32(2)
  14753. }
  14754. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14756. return m_XML_TOK_INVALID
  14757. }
  14758. ptr += uintptr(2)
  14759. case int32(_BT_LEAD3):
  14760. if int64(end)-int64(ptr) < int64(3) {
  14761. return -int32(2)
  14762. }
  14763. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14765. return m_XML_TOK_INVALID
  14766. }
  14767. ptr += uintptr(3)
  14768. case int32(_BT_LEAD4):
  14769. if int64(end)-int64(ptr) < int64(4) {
  14770. return -int32(2)
  14771. }
  14772. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14774. return m_XML_TOK_INVALID
  14775. }
  14776. ptr += uintptr(4)
  14777. case int32(_BT_NONXML):
  14778. fallthrough
  14779. case int32(_BT_MALFORM):
  14780. fallthrough
  14781. case int32(_BT_TRAIL):
  14782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14783. return m_XML_TOK_INVALID
  14784. default:
  14785. ptr += uintptr(1)
  14786. break
  14787. }
  14788. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14789. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14790. case int32(_BT_LEAD2):
  14791. 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 {
  14792. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14793. return int32(m_XML_TOK_DATA_CHARS)
  14794. }
  14795. ptr += uintptr(2)
  14796. case int32(_BT_LEAD3):
  14797. 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 {
  14798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14799. return int32(m_XML_TOK_DATA_CHARS)
  14800. }
  14801. ptr += uintptr(3)
  14802. case int32(_BT_LEAD4):
  14803. 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 {
  14804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14805. return int32(m_XML_TOK_DATA_CHARS)
  14806. }
  14807. ptr += uintptr(4)
  14808. case int32(_BT_RSQB):
  14809. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  14810. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14811. ptr += uintptr(1)
  14812. break
  14813. }
  14814. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  14815. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14816. ptr += uintptr(1)
  14817. break
  14818. }
  14819. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  14820. return m_XML_TOK_INVALID
  14821. }
  14822. }
  14823. /* fall through */
  14824. fallthrough
  14825. case int32(_BT_AMP):
  14826. fallthrough
  14827. case int32(_BT_LT):
  14828. fallthrough
  14829. case int32(_BT_NONXML):
  14830. fallthrough
  14831. case int32(_BT_MALFORM):
  14832. fallthrough
  14833. case int32(_BT_TRAIL):
  14834. fallthrough
  14835. case int32(_BT_CR):
  14836. fallthrough
  14837. case int32(_BT_LF):
  14838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14839. return int32(m_XML_TOK_DATA_CHARS)
  14840. default:
  14841. ptr += uintptr(1)
  14842. break
  14843. }
  14844. }
  14845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14846. return int32(m_XML_TOK_DATA_CHARS)
  14847. }
  14848. /* ptr points to character following "%" */
  14849. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14850. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14851. return -int32(1)
  14852. }
  14853. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14854. case int32(_BT_NONASCII):
  14855. if !(libc.Int32FromInt32(0) != 0) {
  14856. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14857. return m_XML_TOK_INVALID
  14858. } /* fall through */
  14859. fallthrough
  14860. case int32(_BT_NMSTRT):
  14861. fallthrough
  14862. case int32(_BT_HEX):
  14863. ptr += uintptr(1)
  14864. case int32(_BT_LEAD2):
  14865. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14866. return -int32(2)
  14867. }
  14868. 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) {
  14869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14870. return m_XML_TOK_INVALID
  14871. }
  14872. ptr += uintptr(2)
  14873. case int32(_BT_LEAD3):
  14874. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14875. return -int32(2)
  14876. }
  14877. 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) {
  14878. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14879. return m_XML_TOK_INVALID
  14880. }
  14881. ptr += uintptr(3)
  14882. case int32(_BT_LEAD4):
  14883. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14884. return -int32(2)
  14885. }
  14886. 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) {
  14887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14888. return m_XML_TOK_INVALID
  14889. }
  14890. ptr += uintptr(4)
  14891. case int32(_BT_S):
  14892. fallthrough
  14893. case int32(_BT_LF):
  14894. fallthrough
  14895. case int32(_BT_CR):
  14896. fallthrough
  14897. case int32(_BT_PERCNT):
  14898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14899. return int32(m_XML_TOK_PERCENT)
  14900. default:
  14901. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14902. return m_XML_TOK_INVALID
  14903. }
  14904. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14905. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14906. case int32(_BT_NONASCII):
  14907. if !(libc.Int32FromInt32(0) != 0) {
  14908. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14909. return m_XML_TOK_INVALID
  14910. } /* fall through */
  14911. fallthrough
  14912. case int32(_BT_NMSTRT):
  14913. fallthrough
  14914. case int32(_BT_HEX):
  14915. fallthrough
  14916. case int32(_BT_DIGIT):
  14917. fallthrough
  14918. case int32(_BT_NAME):
  14919. fallthrough
  14920. case int32(_BT_MINUS):
  14921. ptr += uintptr(1)
  14922. case int32(_BT_LEAD2):
  14923. if int64(end)-int64(ptr) < int64(2) {
  14924. return -int32(2)
  14925. }
  14926. 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) {
  14927. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14928. return m_XML_TOK_INVALID
  14929. }
  14930. ptr += uintptr(2)
  14931. case int32(_BT_LEAD3):
  14932. if int64(end)-int64(ptr) < int64(3) {
  14933. return -int32(2)
  14934. }
  14935. 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) {
  14936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14937. return m_XML_TOK_INVALID
  14938. }
  14939. ptr += uintptr(3)
  14940. case int32(_BT_LEAD4):
  14941. if int64(end)-int64(ptr) < int64(4) {
  14942. return -int32(2)
  14943. }
  14944. 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) {
  14945. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14946. return m_XML_TOK_INVALID
  14947. }
  14948. ptr += uintptr(4)
  14949. case int32(_BT_SEMI):
  14950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14951. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  14952. default:
  14953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14954. return m_XML_TOK_INVALID
  14955. }
  14956. }
  14957. return -int32(1)
  14958. }
  14959. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14960. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  14961. return -int32(1)
  14962. }
  14963. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  14964. case int32(_BT_NONASCII):
  14965. if !(libc.Int32FromInt32(0) != 0) {
  14966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14967. return m_XML_TOK_INVALID
  14968. } /* fall through */
  14969. fallthrough
  14970. case int32(_BT_NMSTRT):
  14971. fallthrough
  14972. case int32(_BT_HEX):
  14973. ptr += uintptr(1)
  14974. case int32(_BT_LEAD2):
  14975. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  14976. return -int32(2)
  14977. }
  14978. 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) {
  14979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14980. return m_XML_TOK_INVALID
  14981. }
  14982. ptr += uintptr(2)
  14983. case int32(_BT_LEAD3):
  14984. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  14985. return -int32(2)
  14986. }
  14987. 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) {
  14988. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14989. return m_XML_TOK_INVALID
  14990. }
  14991. ptr += uintptr(3)
  14992. case int32(_BT_LEAD4):
  14993. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  14994. return -int32(2)
  14995. }
  14996. 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) {
  14997. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14998. return m_XML_TOK_INVALID
  14999. }
  15000. ptr += uintptr(4)
  15001. default:
  15002. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15003. return m_XML_TOK_INVALID
  15004. }
  15005. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15006. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15007. case int32(_BT_NONASCII):
  15008. if !(libc.Int32FromInt32(0) != 0) {
  15009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15010. return m_XML_TOK_INVALID
  15011. } /* fall through */
  15012. fallthrough
  15013. case int32(_BT_NMSTRT):
  15014. fallthrough
  15015. case int32(_BT_HEX):
  15016. fallthrough
  15017. case int32(_BT_DIGIT):
  15018. fallthrough
  15019. case int32(_BT_NAME):
  15020. fallthrough
  15021. case int32(_BT_MINUS):
  15022. ptr += uintptr(1)
  15023. case int32(_BT_LEAD2):
  15024. if int64(end)-int64(ptr) < int64(2) {
  15025. return -int32(2)
  15026. }
  15027. 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) {
  15028. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15029. return m_XML_TOK_INVALID
  15030. }
  15031. ptr += uintptr(2)
  15032. case int32(_BT_LEAD3):
  15033. if int64(end)-int64(ptr) < int64(3) {
  15034. return -int32(2)
  15035. }
  15036. 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) {
  15037. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15038. return m_XML_TOK_INVALID
  15039. }
  15040. ptr += uintptr(3)
  15041. case int32(_BT_LEAD4):
  15042. if int64(end)-int64(ptr) < int64(4) {
  15043. return -int32(2)
  15044. }
  15045. 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) {
  15046. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15047. return m_XML_TOK_INVALID
  15048. }
  15049. ptr += uintptr(4)
  15050. case int32(_BT_CR):
  15051. fallthrough
  15052. case int32(_BT_LF):
  15053. fallthrough
  15054. case int32(_BT_S):
  15055. fallthrough
  15056. case int32(_BT_RPAR):
  15057. fallthrough
  15058. case int32(_BT_GT):
  15059. fallthrough
  15060. case int32(_BT_PERCNT):
  15061. fallthrough
  15062. case int32(_BT_VERBAR):
  15063. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15064. return int32(m_XML_TOK_POUND_NAME)
  15065. default:
  15066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15067. return m_XML_TOK_INVALID
  15068. }
  15069. }
  15070. return -int32(m_XML_TOK_POUND_NAME)
  15071. }
  15072. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15073. var t int32
  15074. _ = t
  15075. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15076. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  15077. switch t {
  15078. case int32(_BT_LEAD2):
  15079. if int64(end)-int64(ptr) < int64(2) {
  15080. return -int32(2)
  15081. }
  15082. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15083. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15084. return m_XML_TOK_INVALID
  15085. }
  15086. ptr += uintptr(2)
  15087. case int32(_BT_LEAD3):
  15088. if int64(end)-int64(ptr) < int64(3) {
  15089. return -int32(2)
  15090. }
  15091. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15092. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15093. return m_XML_TOK_INVALID
  15094. }
  15095. ptr += uintptr(3)
  15096. case int32(_BT_LEAD4):
  15097. if int64(end)-int64(ptr) < int64(4) {
  15098. return -int32(2)
  15099. }
  15100. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15101. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15102. return m_XML_TOK_INVALID
  15103. }
  15104. ptr += uintptr(4)
  15105. case int32(_BT_NONXML):
  15106. fallthrough
  15107. case int32(_BT_MALFORM):
  15108. fallthrough
  15109. case int32(_BT_TRAIL):
  15110. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15111. return m_XML_TOK_INVALID
  15112. case int32(_BT_QUOT):
  15113. fallthrough
  15114. case int32(_BT_APOS):
  15115. ptr += uintptr(1)
  15116. if t != open {
  15117. break
  15118. }
  15119. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15120. return -int32(m_XML_TOK_LITERAL)
  15121. }
  15122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15123. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15124. case int32(_BT_S):
  15125. fallthrough
  15126. case int32(_BT_CR):
  15127. fallthrough
  15128. case int32(_BT_LF):
  15129. fallthrough
  15130. case int32(_BT_GT):
  15131. fallthrough
  15132. case int32(_BT_PERCNT):
  15133. fallthrough
  15134. case int32(_BT_LSQB):
  15135. return int32(m_XML_TOK_LITERAL)
  15136. default:
  15137. return m_XML_TOK_INVALID
  15138. }
  15139. fallthrough
  15140. default:
  15141. ptr += uintptr(1)
  15142. break
  15143. }
  15144. }
  15145. return -int32(1)
  15146. }
  15147. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15148. var n Tsize_t
  15149. var tok int32
  15150. _, _ = n, tok
  15151. if ptr >= end {
  15152. return -int32(4)
  15153. }
  15154. if int32(1) > int32(1) {
  15155. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15156. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15157. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15158. if n == uint64(0) {
  15159. return -int32(1)
  15160. }
  15161. end = ptr + uintptr(n)
  15162. }
  15163. }
  15164. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15165. case int32(_BT_QUOT):
  15166. goto _1
  15167. case int32(_BT_APOS):
  15168. goto _2
  15169. case int32(_BT_LT):
  15170. goto _3
  15171. case int32(_BT_CR):
  15172. goto _4
  15173. case int32(_BT_LF):
  15174. goto _5
  15175. case int32(_BT_S):
  15176. goto _6
  15177. case int32(_BT_PERCNT):
  15178. goto _7
  15179. case int32(_BT_COMMA):
  15180. goto _8
  15181. case int32(_BT_LSQB):
  15182. goto _9
  15183. case int32(_BT_RSQB):
  15184. goto _10
  15185. case int32(_BT_LPAR):
  15186. goto _11
  15187. case int32(_BT_RPAR):
  15188. goto _12
  15189. case int32(_BT_VERBAR):
  15190. goto _13
  15191. case int32(_BT_GT):
  15192. goto _14
  15193. case int32(_BT_NUM):
  15194. goto _15
  15195. case int32(_BT_LEAD2):
  15196. goto _16
  15197. case int32(_BT_LEAD3):
  15198. goto _17
  15199. case int32(_BT_LEAD4):
  15200. goto _18
  15201. case int32(_BT_HEX):
  15202. goto _19
  15203. case int32(_BT_NMSTRT):
  15204. goto _20
  15205. case int32(_BT_COLON):
  15206. goto _21
  15207. case int32(_BT_MINUS):
  15208. goto _22
  15209. case int32(_BT_NAME):
  15210. goto _23
  15211. case int32(_BT_DIGIT):
  15212. goto _24
  15213. case int32(_BT_NONASCII):
  15214. goto _25
  15215. default:
  15216. goto _26
  15217. }
  15218. goto _27
  15219. _1:
  15220. ;
  15221. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15222. _2:
  15223. ;
  15224. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15225. _3:
  15226. ;
  15227. ptr += uintptr(1)
  15228. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15229. return -int32(1)
  15230. }
  15231. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15232. case int32(_BT_EXCL):
  15233. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15234. case int32(_BT_QUEST):
  15235. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15236. case int32(_BT_NMSTRT):
  15237. fallthrough
  15238. case int32(_BT_HEX):
  15239. fallthrough
  15240. case int32(_BT_NONASCII):
  15241. fallthrough
  15242. case int32(_BT_LEAD2):
  15243. fallthrough
  15244. case int32(_BT_LEAD3):
  15245. fallthrough
  15246. case int32(_BT_LEAD4):
  15247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15248. return int32(m_XML_TOK_INSTANCE_START)
  15249. }
  15250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15251. return m_XML_TOK_INVALID
  15252. _4:
  15253. ;
  15254. if ptr+uintptr(1) == end {
  15255. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15256. /* indicate that this might be part of a CR/LF pair */
  15257. return -int32(m_XML_TOK_PROLOG_S)
  15258. }
  15259. /* fall through */
  15260. _6:
  15261. ;
  15262. _5:
  15263. ;
  15264. _30:
  15265. ;
  15266. ptr += uintptr(1)
  15267. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15268. goto _28
  15269. }
  15270. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15271. case int32(_BT_S):
  15272. fallthrough
  15273. case int32(_BT_LF):
  15274. case int32(_BT_CR):
  15275. /* don't split CR/LF pair */
  15276. if ptr+uintptr(1) != end {
  15277. break
  15278. }
  15279. /* fall through */
  15280. fallthrough
  15281. default:
  15282. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15283. return int32(m_XML_TOK_PROLOG_S)
  15284. }
  15285. goto _29
  15286. _29:
  15287. ;
  15288. goto _30
  15289. goto _28
  15290. _28:
  15291. ;
  15292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15293. return int32(m_XML_TOK_PROLOG_S)
  15294. _7:
  15295. ;
  15296. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15297. _8:
  15298. ;
  15299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15300. return int32(m_XML_TOK_COMMA)
  15301. _9:
  15302. ;
  15303. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15304. return int32(m_XML_TOK_OPEN_BRACKET)
  15305. _10:
  15306. ;
  15307. ptr += uintptr(1)
  15308. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15309. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15310. }
  15311. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15312. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  15313. return -int32(1)
  15314. }
  15315. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15317. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15318. }
  15319. }
  15320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15321. return int32(m_XML_TOK_CLOSE_BRACKET)
  15322. _11:
  15323. ;
  15324. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15325. return int32(m_XML_TOK_OPEN_PAREN)
  15326. _12:
  15327. ;
  15328. ptr += uintptr(1)
  15329. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15330. return -int32(m_XML_TOK_CLOSE_PAREN)
  15331. }
  15332. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15333. case int32(_BT_AST):
  15334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15335. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15336. case int32(_BT_QUEST):
  15337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15338. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15339. case int32(_BT_PLUS):
  15340. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15341. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15342. case int32(_BT_CR):
  15343. fallthrough
  15344. case int32(_BT_LF):
  15345. fallthrough
  15346. case int32(_BT_S):
  15347. fallthrough
  15348. case int32(_BT_GT):
  15349. fallthrough
  15350. case int32(_BT_COMMA):
  15351. fallthrough
  15352. case int32(_BT_VERBAR):
  15353. fallthrough
  15354. case int32(_BT_RPAR):
  15355. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15356. return int32(m_XML_TOK_CLOSE_PAREN)
  15357. }
  15358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15359. return m_XML_TOK_INVALID
  15360. _13:
  15361. ;
  15362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15363. return int32(m_XML_TOK_OR)
  15364. _14:
  15365. ;
  15366. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15367. return int32(m_XML_TOK_DECL_CLOSE)
  15368. _15:
  15369. ;
  15370. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15371. _16:
  15372. ;
  15373. if int64(end)-int64(ptr) < int64(2) {
  15374. return -int32(2)
  15375. }
  15376. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15378. return m_XML_TOK_INVALID
  15379. }
  15380. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15381. ptr += uintptr(2)
  15382. tok = int32(m_XML_TOK_NAME)
  15383. goto _27
  15384. }
  15385. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15386. ptr += uintptr(2)
  15387. tok = int32(m_XML_TOK_NMTOKEN)
  15388. goto _27
  15389. }
  15390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15391. return m_XML_TOK_INVALID
  15392. _17:
  15393. ;
  15394. if int64(end)-int64(ptr) < int64(3) {
  15395. return -int32(2)
  15396. }
  15397. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15399. return m_XML_TOK_INVALID
  15400. }
  15401. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15402. ptr += uintptr(3)
  15403. tok = int32(m_XML_TOK_NAME)
  15404. goto _27
  15405. }
  15406. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15407. ptr += uintptr(3)
  15408. tok = int32(m_XML_TOK_NMTOKEN)
  15409. goto _27
  15410. }
  15411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15412. return m_XML_TOK_INVALID
  15413. _18:
  15414. ;
  15415. if int64(end)-int64(ptr) < int64(4) {
  15416. return -int32(2)
  15417. }
  15418. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15420. return m_XML_TOK_INVALID
  15421. }
  15422. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15423. ptr += uintptr(4)
  15424. tok = int32(m_XML_TOK_NAME)
  15425. goto _27
  15426. }
  15427. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15428. ptr += uintptr(4)
  15429. tok = int32(m_XML_TOK_NMTOKEN)
  15430. goto _27
  15431. }
  15432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15433. return m_XML_TOK_INVALID
  15434. _20:
  15435. ;
  15436. _19:
  15437. ;
  15438. tok = int32(m_XML_TOK_NAME)
  15439. ptr += uintptr(1)
  15440. goto _27
  15441. _24:
  15442. ;
  15443. _23:
  15444. ;
  15445. _22:
  15446. ;
  15447. _21:
  15448. ;
  15449. tok = int32(m_XML_TOK_NMTOKEN)
  15450. ptr += uintptr(1)
  15451. goto _27
  15452. _25:
  15453. ;
  15454. if 0 != 0 {
  15455. ptr += uintptr(1)
  15456. tok = int32(m_XML_TOK_NAME)
  15457. goto _27
  15458. }
  15459. if 0 != 0 {
  15460. ptr += uintptr(1)
  15461. tok = int32(m_XML_TOK_NMTOKEN)
  15462. goto _27
  15463. }
  15464. /* fall through */
  15465. _26:
  15466. ;
  15467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15468. return m_XML_TOK_INVALID
  15469. _27:
  15470. ;
  15471. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15472. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15473. case int32(_BT_NONASCII):
  15474. if !(libc.Int32FromInt32(0) != 0) {
  15475. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15476. return m_XML_TOK_INVALID
  15477. } /* fall through */
  15478. fallthrough
  15479. case int32(_BT_NMSTRT):
  15480. fallthrough
  15481. case int32(_BT_HEX):
  15482. fallthrough
  15483. case int32(_BT_DIGIT):
  15484. fallthrough
  15485. case int32(_BT_NAME):
  15486. fallthrough
  15487. case int32(_BT_MINUS):
  15488. ptr += uintptr(1)
  15489. case int32(_BT_LEAD2):
  15490. if int64(end)-int64(ptr) < int64(2) {
  15491. return -int32(2)
  15492. }
  15493. 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) {
  15494. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15495. return m_XML_TOK_INVALID
  15496. }
  15497. ptr += uintptr(2)
  15498. case int32(_BT_LEAD3):
  15499. if int64(end)-int64(ptr) < int64(3) {
  15500. return -int32(2)
  15501. }
  15502. 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) {
  15503. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15504. return m_XML_TOK_INVALID
  15505. }
  15506. ptr += uintptr(3)
  15507. case int32(_BT_LEAD4):
  15508. if int64(end)-int64(ptr) < int64(4) {
  15509. return -int32(2)
  15510. }
  15511. 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) {
  15512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15513. return m_XML_TOK_INVALID
  15514. }
  15515. ptr += uintptr(4)
  15516. case int32(_BT_GT):
  15517. fallthrough
  15518. case int32(_BT_RPAR):
  15519. fallthrough
  15520. case int32(_BT_COMMA):
  15521. fallthrough
  15522. case int32(_BT_VERBAR):
  15523. fallthrough
  15524. case int32(_BT_LSQB):
  15525. fallthrough
  15526. case int32(_BT_PERCNT):
  15527. fallthrough
  15528. case int32(_BT_S):
  15529. fallthrough
  15530. case int32(_BT_CR):
  15531. fallthrough
  15532. case int32(_BT_LF):
  15533. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15534. return tok
  15535. case int32(_BT_COLON):
  15536. ptr += uintptr(1)
  15537. switch tok {
  15538. case int32(m_XML_TOK_NAME):
  15539. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15540. return -int32(1)
  15541. }
  15542. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15543. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15544. case int32(_BT_NONASCII):
  15545. if !(libc.Int32FromInt32(0) != 0) {
  15546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15547. return m_XML_TOK_INVALID
  15548. } /* fall through */
  15549. fallthrough
  15550. case int32(_BT_NMSTRT):
  15551. fallthrough
  15552. case int32(_BT_HEX):
  15553. fallthrough
  15554. case int32(_BT_DIGIT):
  15555. fallthrough
  15556. case int32(_BT_NAME):
  15557. fallthrough
  15558. case int32(_BT_MINUS):
  15559. ptr += uintptr(1)
  15560. case int32(_BT_LEAD2):
  15561. if int64(end)-int64(ptr) < int64(2) {
  15562. return -int32(2)
  15563. }
  15564. 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) {
  15565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15566. return m_XML_TOK_INVALID
  15567. }
  15568. ptr += uintptr(2)
  15569. case int32(_BT_LEAD3):
  15570. if int64(end)-int64(ptr) < int64(3) {
  15571. return -int32(2)
  15572. }
  15573. 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) {
  15574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15575. return m_XML_TOK_INVALID
  15576. }
  15577. ptr += uintptr(3)
  15578. case int32(_BT_LEAD4):
  15579. if int64(end)-int64(ptr) < int64(4) {
  15580. return -int32(2)
  15581. }
  15582. 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) {
  15583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15584. return m_XML_TOK_INVALID
  15585. }
  15586. ptr += uintptr(4)
  15587. default:
  15588. tok = int32(m_XML_TOK_NMTOKEN)
  15589. break
  15590. }
  15591. case int32(m_XML_TOK_PREFIXED_NAME):
  15592. tok = int32(m_XML_TOK_NMTOKEN)
  15593. break
  15594. }
  15595. case int32(_BT_PLUS):
  15596. if tok == int32(m_XML_TOK_NMTOKEN) {
  15597. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15598. return m_XML_TOK_INVALID
  15599. }
  15600. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15601. return int32(m_XML_TOK_NAME_PLUS)
  15602. case int32(_BT_AST):
  15603. if tok == int32(m_XML_TOK_NMTOKEN) {
  15604. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15605. return m_XML_TOK_INVALID
  15606. }
  15607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15608. return int32(m_XML_TOK_NAME_ASTERISK)
  15609. case int32(_BT_QUEST):
  15610. if tok == int32(m_XML_TOK_NMTOKEN) {
  15611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15612. return m_XML_TOK_INVALID
  15613. }
  15614. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15615. return int32(m_XML_TOK_NAME_QUESTION)
  15616. default:
  15617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15618. return m_XML_TOK_INVALID
  15619. }
  15620. }
  15621. return -tok
  15622. }
  15623. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15624. var start uintptr
  15625. _ = start
  15626. if ptr >= end {
  15627. return -int32(4)
  15628. } else {
  15629. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15630. /* This line cannot be executed. The incoming data has already
  15631. * been tokenized once, so incomplete characters like this have
  15632. * already been eliminated from the input. Retaining the paranoia
  15633. * check is still valuable, however.
  15634. */
  15635. return -int32(1) /* LCOV_EXCL_LINE */
  15636. }
  15637. }
  15638. start = ptr
  15639. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15640. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15641. case int32(_BT_LEAD2):
  15642. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15643. case int32(_BT_LEAD3):
  15644. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15645. case int32(_BT_LEAD4):
  15646. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15647. case int32(_BT_AMP):
  15648. if ptr == start {
  15649. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15650. }
  15651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15652. return int32(m_XML_TOK_DATA_CHARS)
  15653. case int32(_BT_LT):
  15654. /* this is for inside entity references */
  15655. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15656. return m_XML_TOK_INVALID
  15657. case int32(_BT_LF):
  15658. if ptr == start {
  15659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15660. return int32(m_XML_TOK_DATA_NEWLINE)
  15661. }
  15662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15663. return int32(m_XML_TOK_DATA_CHARS)
  15664. case int32(_BT_CR):
  15665. if ptr == start {
  15666. ptr += uintptr(1)
  15667. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15668. return -int32(3)
  15669. }
  15670. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  15671. ptr += uintptr(1)
  15672. }
  15673. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15674. return int32(m_XML_TOK_DATA_NEWLINE)
  15675. }
  15676. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15677. return int32(m_XML_TOK_DATA_CHARS)
  15678. case int32(_BT_S):
  15679. if ptr == start {
  15680. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15681. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15682. }
  15683. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15684. return int32(m_XML_TOK_DATA_CHARS)
  15685. default:
  15686. ptr += uintptr(1)
  15687. break
  15688. }
  15689. }
  15690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15691. return int32(m_XML_TOK_DATA_CHARS)
  15692. }
  15693. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15694. var start uintptr
  15695. var tok, v1 int32
  15696. _, _, _ = start, tok, v1
  15697. if ptr >= end {
  15698. return -int32(4)
  15699. } else {
  15700. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15701. /* This line cannot be executed. The incoming data has already
  15702. * been tokenized once, so incomplete characters like this have
  15703. * already been eliminated from the input. Retaining the paranoia
  15704. * check is still valuable, however.
  15705. */
  15706. return -int32(1) /* LCOV_EXCL_LINE */
  15707. }
  15708. }
  15709. start = ptr
  15710. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15711. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15712. case int32(_BT_LEAD2):
  15713. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15714. case int32(_BT_LEAD3):
  15715. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15716. case int32(_BT_LEAD4):
  15717. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15718. case int32(_BT_AMP):
  15719. if ptr == start {
  15720. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15721. }
  15722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15723. return int32(m_XML_TOK_DATA_CHARS)
  15724. case int32(_BT_PERCNT):
  15725. if ptr == start {
  15726. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15727. if tok == int32(m_XML_TOK_PERCENT) {
  15728. v1 = m_XML_TOK_INVALID
  15729. } else {
  15730. v1 = tok
  15731. }
  15732. return v1
  15733. }
  15734. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15735. return int32(m_XML_TOK_DATA_CHARS)
  15736. case int32(_BT_LF):
  15737. if ptr == start {
  15738. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15739. return int32(m_XML_TOK_DATA_NEWLINE)
  15740. }
  15741. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15742. return int32(m_XML_TOK_DATA_CHARS)
  15743. case int32(_BT_CR):
  15744. if ptr == start {
  15745. ptr += uintptr(1)
  15746. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15747. return -int32(3)
  15748. }
  15749. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  15750. ptr += uintptr(1)
  15751. }
  15752. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15753. return int32(m_XML_TOK_DATA_NEWLINE)
  15754. }
  15755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15756. return int32(m_XML_TOK_DATA_CHARS)
  15757. default:
  15758. ptr += uintptr(1)
  15759. break
  15760. }
  15761. }
  15762. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15763. return int32(m_XML_TOK_DATA_CHARS)
  15764. }
  15765. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15766. var level int32
  15767. var n Tsize_t
  15768. _, _ = level, n
  15769. level = 0
  15770. if int32(1) > int32(1) {
  15771. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  15772. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15773. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15774. end = ptr + uintptr(n)
  15775. }
  15776. }
  15777. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15778. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15779. case int32(_BT_LEAD2):
  15780. if int64(end)-int64(ptr) < int64(2) {
  15781. return -int32(2)
  15782. }
  15783. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15785. return m_XML_TOK_INVALID
  15786. }
  15787. ptr += uintptr(2)
  15788. case int32(_BT_LEAD3):
  15789. if int64(end)-int64(ptr) < int64(3) {
  15790. return -int32(2)
  15791. }
  15792. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15794. return m_XML_TOK_INVALID
  15795. }
  15796. ptr += uintptr(3)
  15797. case int32(_BT_LEAD4):
  15798. if int64(end)-int64(ptr) < int64(4) {
  15799. return -int32(2)
  15800. }
  15801. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15802. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15803. return m_XML_TOK_INVALID
  15804. }
  15805. ptr += uintptr(4)
  15806. case int32(_BT_NONXML):
  15807. fallthrough
  15808. case int32(_BT_MALFORM):
  15809. fallthrough
  15810. case int32(_BT_TRAIL):
  15811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15812. return m_XML_TOK_INVALID
  15813. case int32(_BT_LT):
  15814. ptr += uintptr(1)
  15815. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15816. return -int32(1)
  15817. }
  15818. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  15819. ptr += uintptr(1)
  15820. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15821. return -int32(1)
  15822. }
  15823. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  15824. level++
  15825. ptr += uintptr(1)
  15826. }
  15827. }
  15828. case int32(_BT_RSQB):
  15829. ptr += uintptr(1)
  15830. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15831. return -int32(1)
  15832. }
  15833. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15834. ptr += uintptr(1)
  15835. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15836. return -int32(1)
  15837. }
  15838. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15839. ptr += uintptr(1)
  15840. if level == 0 {
  15841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15842. return int32(m_XML_TOK_IGNORE_SECT)
  15843. }
  15844. level--
  15845. }
  15846. }
  15847. default:
  15848. ptr += uintptr(1)
  15849. break
  15850. }
  15851. }
  15852. return -int32(1)
  15853. }
  15854. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  15855. ptr += uintptr(1)
  15856. end -= uintptr(1)
  15857. for {
  15858. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  15859. break
  15860. }
  15861. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15862. case int32(_BT_DIGIT):
  15863. fallthrough
  15864. case int32(_BT_HEX):
  15865. fallthrough
  15866. case int32(_BT_MINUS):
  15867. fallthrough
  15868. case int32(_BT_APOS):
  15869. fallthrough
  15870. case int32(_BT_LPAR):
  15871. fallthrough
  15872. case int32(_BT_RPAR):
  15873. fallthrough
  15874. case int32(_BT_PLUS):
  15875. fallthrough
  15876. case int32(_BT_COMMA):
  15877. fallthrough
  15878. case int32(_BT_SOL):
  15879. fallthrough
  15880. case int32(_BT_EQUALS):
  15881. fallthrough
  15882. case int32(_BT_QUEST):
  15883. fallthrough
  15884. case int32(_BT_CR):
  15885. fallthrough
  15886. case int32(_BT_LF):
  15887. fallthrough
  15888. case int32(_BT_SEMI):
  15889. fallthrough
  15890. case int32(_BT_EXCL):
  15891. fallthrough
  15892. case int32(_BT_AST):
  15893. fallthrough
  15894. case int32(_BT_PERCNT):
  15895. fallthrough
  15896. case int32(_BT_NUM):
  15897. fallthrough
  15898. case int32(_BT_COLON):
  15899. case int32(_BT_S):
  15900. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  15901. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15902. return 0
  15903. }
  15904. case int32(_BT_NAME):
  15905. fallthrough
  15906. case int32(_BT_NMSTRT):
  15907. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  15908. break
  15909. }
  15910. /* fall through */
  15911. fallthrough
  15912. default:
  15913. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  15914. case int32(0x24): /* $ */
  15915. fallthrough
  15916. case int32(0x40): /* @ */
  15917. default:
  15918. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15919. return 0
  15920. }
  15921. break
  15922. }
  15923. goto _1
  15924. _1:
  15925. ;
  15926. ptr += uintptr(1)
  15927. }
  15928. return int32(1)
  15929. }
  15930. /* This must only be called for a well-formed start-tag or empty
  15931. element tag. Returns the number of attributes. Pointers to the
  15932. first attsMax attributes are stored in atts.
  15933. */
  15934. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  15935. var nAtts, open, state int32
  15936. _, _, _ = nAtts, open, state
  15937. state = 1
  15938. nAtts = 0
  15939. open = 0 /* defined when state == inValue;
  15940. initialization just to shut up compilers */
  15941. ptr += uintptr(1)
  15942. for {
  15943. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  15944. case int32(_BT_LEAD2):
  15945. if state == 0 {
  15946. if nAtts < attsMax {
  15947. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15948. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15949. }
  15950. state = 1
  15951. }
  15952. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  15953. case int32(_BT_LEAD3):
  15954. if state == 0 {
  15955. if nAtts < attsMax {
  15956. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15957. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15958. }
  15959. state = 1
  15960. }
  15961. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  15962. case int32(_BT_LEAD4):
  15963. if state == 0 {
  15964. if nAtts < attsMax {
  15965. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15966. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15967. }
  15968. state = 1
  15969. }
  15970. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  15971. case int32(_BT_NONASCII):
  15972. fallthrough
  15973. case int32(_BT_NMSTRT):
  15974. fallthrough
  15975. case int32(_BT_HEX):
  15976. if state == 0 {
  15977. if nAtts < attsMax {
  15978. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  15979. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  15980. }
  15981. state = 1
  15982. }
  15983. case int32(_BT_QUOT):
  15984. if state != 2 {
  15985. if nAtts < attsMax {
  15986. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  15987. }
  15988. state = 2
  15989. open = int32(_BT_QUOT)
  15990. } else {
  15991. if open == int32(_BT_QUOT) {
  15992. state = 0
  15993. if nAtts < attsMax {
  15994. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  15995. }
  15996. nAtts++
  15997. }
  15998. }
  15999. case int32(_BT_APOS):
  16000. if state != 2 {
  16001. if nAtts < attsMax {
  16002. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  16003. }
  16004. state = 2
  16005. open = int32(_BT_APOS)
  16006. } else {
  16007. if open == int32(_BT_APOS) {
  16008. state = 0
  16009. if nAtts < attsMax {
  16010. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  16011. }
  16012. nAtts++
  16013. }
  16014. }
  16015. case int32(_BT_AMP):
  16016. if nAtts < attsMax {
  16017. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  16018. }
  16019. case int32(_BT_S):
  16020. if state == 1 {
  16021. state = 0
  16022. } else {
  16023. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) == open) {
  16024. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  16025. }
  16026. }
  16027. case int32(_BT_CR):
  16028. fallthrough
  16029. case int32(_BT_LF):
  16030. /* This case ensures that the first attribute name is counted
  16031. Apart from that we could just change state on the quote. */
  16032. if state == 1 {
  16033. state = 0
  16034. } else {
  16035. if state == 2 && nAtts < attsMax {
  16036. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  16037. }
  16038. }
  16039. case int32(_BT_GT):
  16040. fallthrough
  16041. case int32(_BT_SOL):
  16042. if state != 2 {
  16043. return nAtts
  16044. }
  16045. default:
  16046. break
  16047. }
  16048. goto _1
  16049. _1:
  16050. ;
  16051. ptr += uintptr(1)
  16052. }
  16053. /* not reached */
  16054. return r
  16055. }
  16056. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16057. var c, c1, result int32
  16058. _, _, _ = c, c1, result
  16059. result = 0
  16060. /* skip &# */
  16061. _ = enc
  16062. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16063. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16064. ptr += uintptr(1)
  16065. for {
  16066. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16067. break
  16068. }
  16069. c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16070. switch c {
  16071. case int32(m_ASCII_02):
  16072. fallthrough
  16073. case int32(m_ASCII_12):
  16074. fallthrough
  16075. case int32(m_ASCII_22):
  16076. fallthrough
  16077. case int32(m_ASCII_32):
  16078. fallthrough
  16079. case int32(m_ASCII_41):
  16080. fallthrough
  16081. case int32(m_ASCII_51):
  16082. fallthrough
  16083. case int32(m_ASCII_61):
  16084. fallthrough
  16085. case int32(m_ASCII_71):
  16086. fallthrough
  16087. case int32(m_ASCII_82):
  16088. fallthrough
  16089. case int32(m_ASCII_92):
  16090. result <<= int32(4)
  16091. result |= c - int32(m_ASCII_02)
  16092. case int32(m_ASCII_A):
  16093. fallthrough
  16094. case int32(m_ASCII_B1):
  16095. fallthrough
  16096. case int32(m_ASCII_C):
  16097. fallthrough
  16098. case int32(m_ASCII_D):
  16099. fallthrough
  16100. case int32(m_ASCII_E):
  16101. fallthrough
  16102. case int32(m_ASCII_F):
  16103. result <<= int32(4)
  16104. result += int32(10) + (c - int32(m_ASCII_A))
  16105. case int32(m_ASCII_a2):
  16106. fallthrough
  16107. case int32(m_ASCII_b1):
  16108. fallthrough
  16109. case int32(m_ASCII_c2):
  16110. fallthrough
  16111. case int32(m_ASCII_d1):
  16112. fallthrough
  16113. case int32(m_ASCII_e2):
  16114. fallthrough
  16115. case int32(m_ASCII_f1):
  16116. result <<= int32(4)
  16117. result += int32(10) + (c - int32(m_ASCII_a2))
  16118. break
  16119. }
  16120. if result >= int32(0x110000) {
  16121. return -int32(1)
  16122. }
  16123. goto _1
  16124. _1:
  16125. ;
  16126. ptr += uintptr(1)
  16127. }
  16128. } else {
  16129. for {
  16130. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16131. break
  16132. }
  16133. c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16134. result *= int32(10)
  16135. result += c1 - int32(m_ASCII_02)
  16136. if result >= int32(0x110000) {
  16137. return -int32(1)
  16138. }
  16139. goto _2
  16140. _2:
  16141. ;
  16142. ptr += uintptr(1)
  16143. }
  16144. }
  16145. return _checkCharRefNumber(tls, result)
  16146. }
  16147. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16148. _ = enc
  16149. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  16150. case int64(2):
  16151. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16152. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16153. case int32(m_ASCII_l2):
  16154. return int32(m_ASCII_LT1)
  16155. case int32(m_ASCII_g2):
  16156. return int32(m_ASCII_GT1)
  16157. }
  16158. }
  16159. case int64(3):
  16160. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16161. ptr += uintptr(1)
  16162. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16163. ptr += uintptr(1)
  16164. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16165. return int32(m_ASCII_AMP1)
  16166. }
  16167. }
  16168. }
  16169. case int64(4):
  16170. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  16171. case int32(m_ASCII_q1):
  16172. ptr += uintptr(1)
  16173. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16174. ptr += uintptr(1)
  16175. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16176. ptr += uintptr(1)
  16177. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16178. return int32(m_ASCII_QUOT1)
  16179. }
  16180. }
  16181. }
  16182. case int32(m_ASCII_a2):
  16183. ptr += uintptr(1)
  16184. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16185. ptr += uintptr(1)
  16186. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16187. ptr += uintptr(1)
  16188. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16189. return int32(m_ASCII_APOS1)
  16190. }
  16191. }
  16192. }
  16193. break
  16194. }
  16195. }
  16196. return 0
  16197. }
  16198. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16199. _ = enc
  16200. for {
  16201. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  16202. break
  16203. }
  16204. if int64(end1)-int64(ptr1) < int64(1) {
  16205. /* This line cannot be executed. The incoming data has already
  16206. * been tokenized once, so incomplete characters like this have
  16207. * already been eliminated from the input. Retaining the
  16208. * paranoia check is still valuable, however.
  16209. */
  16210. return 0 /* LCOV_EXCL_LINE */
  16211. }
  16212. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  16213. return 0
  16214. }
  16215. goto _1
  16216. _1:
  16217. ;
  16218. ptr1 += uintptr(1)
  16219. ptr2++
  16220. }
  16221. return libc.BoolInt32(ptr1 == end1)
  16222. }
  16223. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16224. var start uintptr
  16225. _ = start
  16226. start = ptr
  16227. for {
  16228. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16229. case int32(_BT_LEAD2):
  16230. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16231. case int32(_BT_LEAD3):
  16232. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16233. case int32(_BT_LEAD4):
  16234. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16235. case int32(_BT_NONASCII):
  16236. fallthrough
  16237. case int32(_BT_NMSTRT):
  16238. fallthrough
  16239. case int32(_BT_COLON):
  16240. fallthrough
  16241. case int32(_BT_HEX):
  16242. fallthrough
  16243. case int32(_BT_DIGIT):
  16244. fallthrough
  16245. case int32(_BT_NAME):
  16246. fallthrough
  16247. case int32(_BT_MINUS):
  16248. ptr += uintptr(1)
  16249. default:
  16250. return int32(int64(ptr) - int64(start))
  16251. }
  16252. goto _1
  16253. _1:
  16254. }
  16255. return r
  16256. }
  16257. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16258. for {
  16259. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16260. case int32(_BT_LF):
  16261. fallthrough
  16262. case int32(_BT_CR):
  16263. fallthrough
  16264. case int32(_BT_S):
  16265. ptr += uintptr(1)
  16266. default:
  16267. return ptr
  16268. }
  16269. goto _1
  16270. _1:
  16271. }
  16272. return r
  16273. }
  16274. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16275. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  16276. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  16277. case int32(_BT_LEAD2):
  16278. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16279. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16280. case int32(_BT_LEAD3):
  16281. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16282. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16283. case int32(_BT_LEAD4):
  16284. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16285. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16286. case int32(_BT_LF):
  16287. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16288. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16289. ptr += uintptr(1)
  16290. case int32(_BT_CR):
  16291. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16292. ptr += uintptr(1)
  16293. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  16294. ptr += uintptr(1)
  16295. }
  16296. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  16297. default:
  16298. ptr += uintptr(1)
  16299. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16300. break
  16301. }
  16302. }
  16303. }
  16304. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16305. _UTF8_cval1 = 0
  16306. const _UTF8_cval2 = 192
  16307. const _UTF8_cval3 = 224
  16308. const _UTF8_cval4 = 240
  16309. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16310. var fromLim uintptr
  16311. var prev uint8
  16312. var walked Tsize_t
  16313. _, _, _ = fromLim, prev, walked
  16314. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16315. walked = uint64(0)
  16316. for {
  16317. if !(fromLim > from) {
  16318. break
  16319. }
  16320. prev = *(*uint8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1))))
  16321. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16322. if walked+uint64(1) >= uint64(4) {
  16323. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16324. break
  16325. } else {
  16326. walked = uint64(0)
  16327. }
  16328. } else {
  16329. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16330. if walked+uint64(1) >= uint64(3) {
  16331. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16332. break
  16333. } else {
  16334. walked = uint64(0)
  16335. }
  16336. } else {
  16337. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16338. if walked+uint64(1) >= uint64(2) {
  16339. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16340. break
  16341. } else {
  16342. walked = uint64(0)
  16343. }
  16344. } else {
  16345. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16346. break
  16347. }
  16348. }
  16349. }
  16350. }
  16351. goto _1
  16352. _1:
  16353. ;
  16354. fromLim--
  16355. walked++
  16356. }
  16357. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16358. }
  16359. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16360. bp := tls.Alloc(16)
  16361. defer tls.Free(16)
  16362. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16363. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16364. var fromLimBefore uintptr
  16365. var input_incomplete, output_exhausted uint8
  16366. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16367. input_incomplete = uint8(m_false)
  16368. output_exhausted = uint8(m_false)
  16369. /* Avoid copying partial characters (due to limited space). */
  16370. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16371. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  16372. _ = enc
  16373. if bytesAvailable > bytesStorable {
  16374. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16375. output_exhausted = uint8(m_true)
  16376. }
  16377. /* Avoid copying partial characters (from incomplete input). */
  16378. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16379. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16380. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16381. input_incomplete = uint8(m_true)
  16382. }
  16383. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  16384. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  16385. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16386. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16387. if output_exhausted != 0 { /* needs to go first */
  16388. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16389. } else {
  16390. if input_incomplete != 0 {
  16391. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16392. } else {
  16393. return int32(_XML_CONVERT_COMPLETED)
  16394. }
  16395. }
  16396. return r
  16397. }
  16398. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16399. var from, to, v1, v2, v3, v4 uintptr
  16400. var n uint64
  16401. var res _XML_Convert_Result
  16402. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16403. res = int32(_XML_CONVERT_COMPLETED)
  16404. to = *(*uintptr)(unsafe.Pointer(toP))
  16405. from = *(*uintptr)(unsafe.Pointer(fromP))
  16406. for from < fromLim && to < toLim {
  16407. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(from)))))) {
  16408. case int32(_BT_LEAD2):
  16409. if int64(fromLim)-int64(from) < int64(2) {
  16410. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16411. goto after
  16412. }
  16413. v1 = to
  16414. to += 2
  16415. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  16416. from += uintptr(2)
  16417. case int32(_BT_LEAD3):
  16418. if int64(fromLim)-int64(from) < int64(3) {
  16419. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16420. goto after
  16421. }
  16422. v2 = to
  16423. to += 2
  16424. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  16425. from += uintptr(3)
  16426. case int32(_BT_LEAD4):
  16427. if (int64(toLim)-int64(to))/2 < int64(2) {
  16428. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16429. goto after
  16430. }
  16431. if int64(fromLim)-int64(from) < int64(4) {
  16432. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16433. goto after
  16434. }
  16435. n = libc.Uint64FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  16436. n -= uint64(0x10000)
  16437. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  16438. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  16439. to += uintptr(2) * 2
  16440. from += uintptr(4)
  16441. default:
  16442. v3 = to
  16443. to += 2
  16444. v4 = from
  16445. from++
  16446. *(*uint16)(unsafe.Pointer(v3)) = uint16(*(*uint8)(unsafe.Pointer(v4)))
  16447. break
  16448. }
  16449. }
  16450. if from < fromLim {
  16451. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16452. }
  16453. goto after
  16454. after:
  16455. ;
  16456. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16457. *(*uintptr)(unsafe.Pointer(toP)) = to
  16458. return res
  16459. }
  16460. var _utf8_encoding_ns = Tnormal_encoding{
  16461. Fenc: TENCODING{
  16462. Fscanners: [4]TSCANNER{},
  16463. FliteralScanners: [2]TSCANNER{},
  16464. FminBytesPerChar: int32(1),
  16465. FisUtf8: uint8(1),
  16466. },
  16467. Ftype1: [256]uint8{
  16468. 9: uint8(_BT_S),
  16469. 10: uint8(_BT_LF),
  16470. 13: uint8(_BT_CR),
  16471. 32: uint8(_BT_S),
  16472. 33: uint8(_BT_EXCL),
  16473. 34: uint8(_BT_QUOT),
  16474. 35: uint8(_BT_NUM),
  16475. 36: uint8(_BT_OTHER),
  16476. 37: uint8(_BT_PERCNT),
  16477. 38: uint8(_BT_AMP),
  16478. 39: uint8(_BT_APOS),
  16479. 40: uint8(_BT_LPAR),
  16480. 41: uint8(_BT_RPAR),
  16481. 42: uint8(_BT_AST),
  16482. 43: uint8(_BT_PLUS),
  16483. 44: uint8(_BT_COMMA),
  16484. 45: uint8(_BT_MINUS),
  16485. 46: uint8(_BT_NAME),
  16486. 47: uint8(_BT_SOL),
  16487. 48: uint8(_BT_DIGIT),
  16488. 49: uint8(_BT_DIGIT),
  16489. 50: uint8(_BT_DIGIT),
  16490. 51: uint8(_BT_DIGIT),
  16491. 52: uint8(_BT_DIGIT),
  16492. 53: uint8(_BT_DIGIT),
  16493. 54: uint8(_BT_DIGIT),
  16494. 55: uint8(_BT_DIGIT),
  16495. 56: uint8(_BT_DIGIT),
  16496. 57: uint8(_BT_DIGIT),
  16497. 58: uint8(_BT_COLON),
  16498. 59: uint8(_BT_SEMI),
  16499. 60: uint8(_BT_LT),
  16500. 61: uint8(_BT_EQUALS),
  16501. 62: uint8(_BT_GT),
  16502. 63: uint8(_BT_QUEST),
  16503. 64: uint8(_BT_OTHER),
  16504. 65: uint8(_BT_HEX),
  16505. 66: uint8(_BT_HEX),
  16506. 67: uint8(_BT_HEX),
  16507. 68: uint8(_BT_HEX),
  16508. 69: uint8(_BT_HEX),
  16509. 70: uint8(_BT_HEX),
  16510. 71: uint8(_BT_NMSTRT),
  16511. 72: uint8(_BT_NMSTRT),
  16512. 73: uint8(_BT_NMSTRT),
  16513. 74: uint8(_BT_NMSTRT),
  16514. 75: uint8(_BT_NMSTRT),
  16515. 76: uint8(_BT_NMSTRT),
  16516. 77: uint8(_BT_NMSTRT),
  16517. 78: uint8(_BT_NMSTRT),
  16518. 79: uint8(_BT_NMSTRT),
  16519. 80: uint8(_BT_NMSTRT),
  16520. 81: uint8(_BT_NMSTRT),
  16521. 82: uint8(_BT_NMSTRT),
  16522. 83: uint8(_BT_NMSTRT),
  16523. 84: uint8(_BT_NMSTRT),
  16524. 85: uint8(_BT_NMSTRT),
  16525. 86: uint8(_BT_NMSTRT),
  16526. 87: uint8(_BT_NMSTRT),
  16527. 88: uint8(_BT_NMSTRT),
  16528. 89: uint8(_BT_NMSTRT),
  16529. 90: uint8(_BT_NMSTRT),
  16530. 91: uint8(_BT_LSQB),
  16531. 92: uint8(_BT_OTHER),
  16532. 93: uint8(_BT_RSQB),
  16533. 94: uint8(_BT_OTHER),
  16534. 95: uint8(_BT_NMSTRT),
  16535. 96: uint8(_BT_OTHER),
  16536. 97: uint8(_BT_HEX),
  16537. 98: uint8(_BT_HEX),
  16538. 99: uint8(_BT_HEX),
  16539. 100: uint8(_BT_HEX),
  16540. 101: uint8(_BT_HEX),
  16541. 102: uint8(_BT_HEX),
  16542. 103: uint8(_BT_NMSTRT),
  16543. 104: uint8(_BT_NMSTRT),
  16544. 105: uint8(_BT_NMSTRT),
  16545. 106: uint8(_BT_NMSTRT),
  16546. 107: uint8(_BT_NMSTRT),
  16547. 108: uint8(_BT_NMSTRT),
  16548. 109: uint8(_BT_NMSTRT),
  16549. 110: uint8(_BT_NMSTRT),
  16550. 111: uint8(_BT_NMSTRT),
  16551. 112: uint8(_BT_NMSTRT),
  16552. 113: uint8(_BT_NMSTRT),
  16553. 114: uint8(_BT_NMSTRT),
  16554. 115: uint8(_BT_NMSTRT),
  16555. 116: uint8(_BT_NMSTRT),
  16556. 117: uint8(_BT_NMSTRT),
  16557. 118: uint8(_BT_NMSTRT),
  16558. 119: uint8(_BT_NMSTRT),
  16559. 120: uint8(_BT_NMSTRT),
  16560. 121: uint8(_BT_NMSTRT),
  16561. 122: uint8(_BT_NMSTRT),
  16562. 123: uint8(_BT_OTHER),
  16563. 124: uint8(_BT_VERBAR),
  16564. 125: uint8(_BT_OTHER),
  16565. 126: uint8(_BT_OTHER),
  16566. 127: uint8(_BT_OTHER),
  16567. 128: uint8(_BT_TRAIL),
  16568. 129: uint8(_BT_TRAIL),
  16569. 130: uint8(_BT_TRAIL),
  16570. 131: uint8(_BT_TRAIL),
  16571. 132: uint8(_BT_TRAIL),
  16572. 133: uint8(_BT_TRAIL),
  16573. 134: uint8(_BT_TRAIL),
  16574. 135: uint8(_BT_TRAIL),
  16575. 136: uint8(_BT_TRAIL),
  16576. 137: uint8(_BT_TRAIL),
  16577. 138: uint8(_BT_TRAIL),
  16578. 139: uint8(_BT_TRAIL),
  16579. 140: uint8(_BT_TRAIL),
  16580. 141: uint8(_BT_TRAIL),
  16581. 142: uint8(_BT_TRAIL),
  16582. 143: uint8(_BT_TRAIL),
  16583. 144: uint8(_BT_TRAIL),
  16584. 145: uint8(_BT_TRAIL),
  16585. 146: uint8(_BT_TRAIL),
  16586. 147: uint8(_BT_TRAIL),
  16587. 148: uint8(_BT_TRAIL),
  16588. 149: uint8(_BT_TRAIL),
  16589. 150: uint8(_BT_TRAIL),
  16590. 151: uint8(_BT_TRAIL),
  16591. 152: uint8(_BT_TRAIL),
  16592. 153: uint8(_BT_TRAIL),
  16593. 154: uint8(_BT_TRAIL),
  16594. 155: uint8(_BT_TRAIL),
  16595. 156: uint8(_BT_TRAIL),
  16596. 157: uint8(_BT_TRAIL),
  16597. 158: uint8(_BT_TRAIL),
  16598. 159: uint8(_BT_TRAIL),
  16599. 160: uint8(_BT_TRAIL),
  16600. 161: uint8(_BT_TRAIL),
  16601. 162: uint8(_BT_TRAIL),
  16602. 163: uint8(_BT_TRAIL),
  16603. 164: uint8(_BT_TRAIL),
  16604. 165: uint8(_BT_TRAIL),
  16605. 166: uint8(_BT_TRAIL),
  16606. 167: uint8(_BT_TRAIL),
  16607. 168: uint8(_BT_TRAIL),
  16608. 169: uint8(_BT_TRAIL),
  16609. 170: uint8(_BT_TRAIL),
  16610. 171: uint8(_BT_TRAIL),
  16611. 172: uint8(_BT_TRAIL),
  16612. 173: uint8(_BT_TRAIL),
  16613. 174: uint8(_BT_TRAIL),
  16614. 175: uint8(_BT_TRAIL),
  16615. 176: uint8(_BT_TRAIL),
  16616. 177: uint8(_BT_TRAIL),
  16617. 178: uint8(_BT_TRAIL),
  16618. 179: uint8(_BT_TRAIL),
  16619. 180: uint8(_BT_TRAIL),
  16620. 181: uint8(_BT_TRAIL),
  16621. 182: uint8(_BT_TRAIL),
  16622. 183: uint8(_BT_TRAIL),
  16623. 184: uint8(_BT_TRAIL),
  16624. 185: uint8(_BT_TRAIL),
  16625. 186: uint8(_BT_TRAIL),
  16626. 187: uint8(_BT_TRAIL),
  16627. 188: uint8(_BT_TRAIL),
  16628. 189: uint8(_BT_TRAIL),
  16629. 190: uint8(_BT_TRAIL),
  16630. 191: uint8(_BT_TRAIL),
  16631. 192: uint8(_BT_LEAD2),
  16632. 193: uint8(_BT_LEAD2),
  16633. 194: uint8(_BT_LEAD2),
  16634. 195: uint8(_BT_LEAD2),
  16635. 196: uint8(_BT_LEAD2),
  16636. 197: uint8(_BT_LEAD2),
  16637. 198: uint8(_BT_LEAD2),
  16638. 199: uint8(_BT_LEAD2),
  16639. 200: uint8(_BT_LEAD2),
  16640. 201: uint8(_BT_LEAD2),
  16641. 202: uint8(_BT_LEAD2),
  16642. 203: uint8(_BT_LEAD2),
  16643. 204: uint8(_BT_LEAD2),
  16644. 205: uint8(_BT_LEAD2),
  16645. 206: uint8(_BT_LEAD2),
  16646. 207: uint8(_BT_LEAD2),
  16647. 208: uint8(_BT_LEAD2),
  16648. 209: uint8(_BT_LEAD2),
  16649. 210: uint8(_BT_LEAD2),
  16650. 211: uint8(_BT_LEAD2),
  16651. 212: uint8(_BT_LEAD2),
  16652. 213: uint8(_BT_LEAD2),
  16653. 214: uint8(_BT_LEAD2),
  16654. 215: uint8(_BT_LEAD2),
  16655. 216: uint8(_BT_LEAD2),
  16656. 217: uint8(_BT_LEAD2),
  16657. 218: uint8(_BT_LEAD2),
  16658. 219: uint8(_BT_LEAD2),
  16659. 220: uint8(_BT_LEAD2),
  16660. 221: uint8(_BT_LEAD2),
  16661. 222: uint8(_BT_LEAD2),
  16662. 223: uint8(_BT_LEAD2),
  16663. 224: uint8(_BT_LEAD3),
  16664. 225: uint8(_BT_LEAD3),
  16665. 226: uint8(_BT_LEAD3),
  16666. 227: uint8(_BT_LEAD3),
  16667. 228: uint8(_BT_LEAD3),
  16668. 229: uint8(_BT_LEAD3),
  16669. 230: uint8(_BT_LEAD3),
  16670. 231: uint8(_BT_LEAD3),
  16671. 232: uint8(_BT_LEAD3),
  16672. 233: uint8(_BT_LEAD3),
  16673. 234: uint8(_BT_LEAD3),
  16674. 235: uint8(_BT_LEAD3),
  16675. 236: uint8(_BT_LEAD3),
  16676. 237: uint8(_BT_LEAD3),
  16677. 238: uint8(_BT_LEAD3),
  16678. 239: uint8(_BT_LEAD3),
  16679. 240: uint8(_BT_LEAD4),
  16680. 241: uint8(_BT_LEAD4),
  16681. 242: uint8(_BT_LEAD4),
  16682. 243: uint8(_BT_LEAD4),
  16683. 244: uint8(_BT_LEAD4),
  16684. 254: uint8(_BT_MALFORM),
  16685. 255: uint8(_BT_MALFORM),
  16686. },
  16687. }
  16688. func init() {
  16689. p := unsafe.Pointer(&_utf8_encoding_ns)
  16690. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16691. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16692. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16693. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16694. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16695. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16696. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16697. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16698. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16699. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16700. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16701. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16702. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16703. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16704. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16705. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16706. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16707. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16708. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16709. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16710. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16711. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16712. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16713. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16714. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16715. }
  16716. var _utf8_encoding = Tnormal_encoding{
  16717. Fenc: TENCODING{
  16718. Fscanners: [4]TSCANNER{},
  16719. FliteralScanners: [2]TSCANNER{},
  16720. FminBytesPerChar: int32(1),
  16721. FisUtf8: uint8(1),
  16722. },
  16723. Ftype1: [256]uint8{
  16724. 9: uint8(_BT_S),
  16725. 10: uint8(_BT_LF),
  16726. 13: uint8(_BT_CR),
  16727. 32: uint8(_BT_S),
  16728. 33: uint8(_BT_EXCL),
  16729. 34: uint8(_BT_QUOT),
  16730. 35: uint8(_BT_NUM),
  16731. 36: uint8(_BT_OTHER),
  16732. 37: uint8(_BT_PERCNT),
  16733. 38: uint8(_BT_AMP),
  16734. 39: uint8(_BT_APOS),
  16735. 40: uint8(_BT_LPAR),
  16736. 41: uint8(_BT_RPAR),
  16737. 42: uint8(_BT_AST),
  16738. 43: uint8(_BT_PLUS),
  16739. 44: uint8(_BT_COMMA),
  16740. 45: uint8(_BT_MINUS),
  16741. 46: uint8(_BT_NAME),
  16742. 47: uint8(_BT_SOL),
  16743. 48: uint8(_BT_DIGIT),
  16744. 49: uint8(_BT_DIGIT),
  16745. 50: uint8(_BT_DIGIT),
  16746. 51: uint8(_BT_DIGIT),
  16747. 52: uint8(_BT_DIGIT),
  16748. 53: uint8(_BT_DIGIT),
  16749. 54: uint8(_BT_DIGIT),
  16750. 55: uint8(_BT_DIGIT),
  16751. 56: uint8(_BT_DIGIT),
  16752. 57: uint8(_BT_DIGIT),
  16753. 58: uint8(_BT_NMSTRT),
  16754. 59: uint8(_BT_SEMI),
  16755. 60: uint8(_BT_LT),
  16756. 61: uint8(_BT_EQUALS),
  16757. 62: uint8(_BT_GT),
  16758. 63: uint8(_BT_QUEST),
  16759. 64: uint8(_BT_OTHER),
  16760. 65: uint8(_BT_HEX),
  16761. 66: uint8(_BT_HEX),
  16762. 67: uint8(_BT_HEX),
  16763. 68: uint8(_BT_HEX),
  16764. 69: uint8(_BT_HEX),
  16765. 70: uint8(_BT_HEX),
  16766. 71: uint8(_BT_NMSTRT),
  16767. 72: uint8(_BT_NMSTRT),
  16768. 73: uint8(_BT_NMSTRT),
  16769. 74: uint8(_BT_NMSTRT),
  16770. 75: uint8(_BT_NMSTRT),
  16771. 76: uint8(_BT_NMSTRT),
  16772. 77: uint8(_BT_NMSTRT),
  16773. 78: uint8(_BT_NMSTRT),
  16774. 79: uint8(_BT_NMSTRT),
  16775. 80: uint8(_BT_NMSTRT),
  16776. 81: uint8(_BT_NMSTRT),
  16777. 82: uint8(_BT_NMSTRT),
  16778. 83: uint8(_BT_NMSTRT),
  16779. 84: uint8(_BT_NMSTRT),
  16780. 85: uint8(_BT_NMSTRT),
  16781. 86: uint8(_BT_NMSTRT),
  16782. 87: uint8(_BT_NMSTRT),
  16783. 88: uint8(_BT_NMSTRT),
  16784. 89: uint8(_BT_NMSTRT),
  16785. 90: uint8(_BT_NMSTRT),
  16786. 91: uint8(_BT_LSQB),
  16787. 92: uint8(_BT_OTHER),
  16788. 93: uint8(_BT_RSQB),
  16789. 94: uint8(_BT_OTHER),
  16790. 95: uint8(_BT_NMSTRT),
  16791. 96: uint8(_BT_OTHER),
  16792. 97: uint8(_BT_HEX),
  16793. 98: uint8(_BT_HEX),
  16794. 99: uint8(_BT_HEX),
  16795. 100: uint8(_BT_HEX),
  16796. 101: uint8(_BT_HEX),
  16797. 102: uint8(_BT_HEX),
  16798. 103: uint8(_BT_NMSTRT),
  16799. 104: uint8(_BT_NMSTRT),
  16800. 105: uint8(_BT_NMSTRT),
  16801. 106: uint8(_BT_NMSTRT),
  16802. 107: uint8(_BT_NMSTRT),
  16803. 108: uint8(_BT_NMSTRT),
  16804. 109: uint8(_BT_NMSTRT),
  16805. 110: uint8(_BT_NMSTRT),
  16806. 111: uint8(_BT_NMSTRT),
  16807. 112: uint8(_BT_NMSTRT),
  16808. 113: uint8(_BT_NMSTRT),
  16809. 114: uint8(_BT_NMSTRT),
  16810. 115: uint8(_BT_NMSTRT),
  16811. 116: uint8(_BT_NMSTRT),
  16812. 117: uint8(_BT_NMSTRT),
  16813. 118: uint8(_BT_NMSTRT),
  16814. 119: uint8(_BT_NMSTRT),
  16815. 120: uint8(_BT_NMSTRT),
  16816. 121: uint8(_BT_NMSTRT),
  16817. 122: uint8(_BT_NMSTRT),
  16818. 123: uint8(_BT_OTHER),
  16819. 124: uint8(_BT_VERBAR),
  16820. 125: uint8(_BT_OTHER),
  16821. 126: uint8(_BT_OTHER),
  16822. 127: uint8(_BT_OTHER),
  16823. 128: uint8(_BT_TRAIL),
  16824. 129: uint8(_BT_TRAIL),
  16825. 130: uint8(_BT_TRAIL),
  16826. 131: uint8(_BT_TRAIL),
  16827. 132: uint8(_BT_TRAIL),
  16828. 133: uint8(_BT_TRAIL),
  16829. 134: uint8(_BT_TRAIL),
  16830. 135: uint8(_BT_TRAIL),
  16831. 136: uint8(_BT_TRAIL),
  16832. 137: uint8(_BT_TRAIL),
  16833. 138: uint8(_BT_TRAIL),
  16834. 139: uint8(_BT_TRAIL),
  16835. 140: uint8(_BT_TRAIL),
  16836. 141: uint8(_BT_TRAIL),
  16837. 142: uint8(_BT_TRAIL),
  16838. 143: uint8(_BT_TRAIL),
  16839. 144: uint8(_BT_TRAIL),
  16840. 145: uint8(_BT_TRAIL),
  16841. 146: uint8(_BT_TRAIL),
  16842. 147: uint8(_BT_TRAIL),
  16843. 148: uint8(_BT_TRAIL),
  16844. 149: uint8(_BT_TRAIL),
  16845. 150: uint8(_BT_TRAIL),
  16846. 151: uint8(_BT_TRAIL),
  16847. 152: uint8(_BT_TRAIL),
  16848. 153: uint8(_BT_TRAIL),
  16849. 154: uint8(_BT_TRAIL),
  16850. 155: uint8(_BT_TRAIL),
  16851. 156: uint8(_BT_TRAIL),
  16852. 157: uint8(_BT_TRAIL),
  16853. 158: uint8(_BT_TRAIL),
  16854. 159: uint8(_BT_TRAIL),
  16855. 160: uint8(_BT_TRAIL),
  16856. 161: uint8(_BT_TRAIL),
  16857. 162: uint8(_BT_TRAIL),
  16858. 163: uint8(_BT_TRAIL),
  16859. 164: uint8(_BT_TRAIL),
  16860. 165: uint8(_BT_TRAIL),
  16861. 166: uint8(_BT_TRAIL),
  16862. 167: uint8(_BT_TRAIL),
  16863. 168: uint8(_BT_TRAIL),
  16864. 169: uint8(_BT_TRAIL),
  16865. 170: uint8(_BT_TRAIL),
  16866. 171: uint8(_BT_TRAIL),
  16867. 172: uint8(_BT_TRAIL),
  16868. 173: uint8(_BT_TRAIL),
  16869. 174: uint8(_BT_TRAIL),
  16870. 175: uint8(_BT_TRAIL),
  16871. 176: uint8(_BT_TRAIL),
  16872. 177: uint8(_BT_TRAIL),
  16873. 178: uint8(_BT_TRAIL),
  16874. 179: uint8(_BT_TRAIL),
  16875. 180: uint8(_BT_TRAIL),
  16876. 181: uint8(_BT_TRAIL),
  16877. 182: uint8(_BT_TRAIL),
  16878. 183: uint8(_BT_TRAIL),
  16879. 184: uint8(_BT_TRAIL),
  16880. 185: uint8(_BT_TRAIL),
  16881. 186: uint8(_BT_TRAIL),
  16882. 187: uint8(_BT_TRAIL),
  16883. 188: uint8(_BT_TRAIL),
  16884. 189: uint8(_BT_TRAIL),
  16885. 190: uint8(_BT_TRAIL),
  16886. 191: uint8(_BT_TRAIL),
  16887. 192: uint8(_BT_LEAD2),
  16888. 193: uint8(_BT_LEAD2),
  16889. 194: uint8(_BT_LEAD2),
  16890. 195: uint8(_BT_LEAD2),
  16891. 196: uint8(_BT_LEAD2),
  16892. 197: uint8(_BT_LEAD2),
  16893. 198: uint8(_BT_LEAD2),
  16894. 199: uint8(_BT_LEAD2),
  16895. 200: uint8(_BT_LEAD2),
  16896. 201: uint8(_BT_LEAD2),
  16897. 202: uint8(_BT_LEAD2),
  16898. 203: uint8(_BT_LEAD2),
  16899. 204: uint8(_BT_LEAD2),
  16900. 205: uint8(_BT_LEAD2),
  16901. 206: uint8(_BT_LEAD2),
  16902. 207: uint8(_BT_LEAD2),
  16903. 208: uint8(_BT_LEAD2),
  16904. 209: uint8(_BT_LEAD2),
  16905. 210: uint8(_BT_LEAD2),
  16906. 211: uint8(_BT_LEAD2),
  16907. 212: uint8(_BT_LEAD2),
  16908. 213: uint8(_BT_LEAD2),
  16909. 214: uint8(_BT_LEAD2),
  16910. 215: uint8(_BT_LEAD2),
  16911. 216: uint8(_BT_LEAD2),
  16912. 217: uint8(_BT_LEAD2),
  16913. 218: uint8(_BT_LEAD2),
  16914. 219: uint8(_BT_LEAD2),
  16915. 220: uint8(_BT_LEAD2),
  16916. 221: uint8(_BT_LEAD2),
  16917. 222: uint8(_BT_LEAD2),
  16918. 223: uint8(_BT_LEAD2),
  16919. 224: uint8(_BT_LEAD3),
  16920. 225: uint8(_BT_LEAD3),
  16921. 226: uint8(_BT_LEAD3),
  16922. 227: uint8(_BT_LEAD3),
  16923. 228: uint8(_BT_LEAD3),
  16924. 229: uint8(_BT_LEAD3),
  16925. 230: uint8(_BT_LEAD3),
  16926. 231: uint8(_BT_LEAD3),
  16927. 232: uint8(_BT_LEAD3),
  16928. 233: uint8(_BT_LEAD3),
  16929. 234: uint8(_BT_LEAD3),
  16930. 235: uint8(_BT_LEAD3),
  16931. 236: uint8(_BT_LEAD3),
  16932. 237: uint8(_BT_LEAD3),
  16933. 238: uint8(_BT_LEAD3),
  16934. 239: uint8(_BT_LEAD3),
  16935. 240: uint8(_BT_LEAD4),
  16936. 241: uint8(_BT_LEAD4),
  16937. 242: uint8(_BT_LEAD4),
  16938. 243: uint8(_BT_LEAD4),
  16939. 244: uint8(_BT_LEAD4),
  16940. 254: uint8(_BT_MALFORM),
  16941. 255: uint8(_BT_MALFORM),
  16942. },
  16943. }
  16944. func init() {
  16945. p := unsafe.Pointer(&_utf8_encoding)
  16946. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16947. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  16948. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  16949. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  16950. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  16951. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  16952. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  16953. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  16954. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  16955. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  16956. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  16957. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  16958. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  16959. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  16960. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  16961. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  16962. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  16963. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  16964. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  16965. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  16966. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  16967. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  16968. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  16969. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  16970. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  16971. }
  16972. var _internal_utf8_encoding_ns = Tnormal_encoding{
  16973. Fenc: TENCODING{
  16974. Fscanners: [4]TSCANNER{},
  16975. FliteralScanners: [2]TSCANNER{},
  16976. FminBytesPerChar: int32(1),
  16977. FisUtf8: uint8(1),
  16978. },
  16979. Ftype1: [256]uint8{
  16980. 9: uint8(_BT_S),
  16981. 10: uint8(_BT_LF),
  16982. 13: uint8(_BT_S),
  16983. 32: uint8(_BT_S),
  16984. 33: uint8(_BT_EXCL),
  16985. 34: uint8(_BT_QUOT),
  16986. 35: uint8(_BT_NUM),
  16987. 36: uint8(_BT_OTHER),
  16988. 37: uint8(_BT_PERCNT),
  16989. 38: uint8(_BT_AMP),
  16990. 39: uint8(_BT_APOS),
  16991. 40: uint8(_BT_LPAR),
  16992. 41: uint8(_BT_RPAR),
  16993. 42: uint8(_BT_AST),
  16994. 43: uint8(_BT_PLUS),
  16995. 44: uint8(_BT_COMMA),
  16996. 45: uint8(_BT_MINUS),
  16997. 46: uint8(_BT_NAME),
  16998. 47: uint8(_BT_SOL),
  16999. 48: uint8(_BT_DIGIT),
  17000. 49: uint8(_BT_DIGIT),
  17001. 50: uint8(_BT_DIGIT),
  17002. 51: uint8(_BT_DIGIT),
  17003. 52: uint8(_BT_DIGIT),
  17004. 53: uint8(_BT_DIGIT),
  17005. 54: uint8(_BT_DIGIT),
  17006. 55: uint8(_BT_DIGIT),
  17007. 56: uint8(_BT_DIGIT),
  17008. 57: uint8(_BT_DIGIT),
  17009. 58: uint8(_BT_COLON),
  17010. 59: uint8(_BT_SEMI),
  17011. 60: uint8(_BT_LT),
  17012. 61: uint8(_BT_EQUALS),
  17013. 62: uint8(_BT_GT),
  17014. 63: uint8(_BT_QUEST),
  17015. 64: uint8(_BT_OTHER),
  17016. 65: uint8(_BT_HEX),
  17017. 66: uint8(_BT_HEX),
  17018. 67: uint8(_BT_HEX),
  17019. 68: uint8(_BT_HEX),
  17020. 69: uint8(_BT_HEX),
  17021. 70: uint8(_BT_HEX),
  17022. 71: uint8(_BT_NMSTRT),
  17023. 72: uint8(_BT_NMSTRT),
  17024. 73: uint8(_BT_NMSTRT),
  17025. 74: uint8(_BT_NMSTRT),
  17026. 75: uint8(_BT_NMSTRT),
  17027. 76: uint8(_BT_NMSTRT),
  17028. 77: uint8(_BT_NMSTRT),
  17029. 78: uint8(_BT_NMSTRT),
  17030. 79: uint8(_BT_NMSTRT),
  17031. 80: uint8(_BT_NMSTRT),
  17032. 81: uint8(_BT_NMSTRT),
  17033. 82: uint8(_BT_NMSTRT),
  17034. 83: uint8(_BT_NMSTRT),
  17035. 84: uint8(_BT_NMSTRT),
  17036. 85: uint8(_BT_NMSTRT),
  17037. 86: uint8(_BT_NMSTRT),
  17038. 87: uint8(_BT_NMSTRT),
  17039. 88: uint8(_BT_NMSTRT),
  17040. 89: uint8(_BT_NMSTRT),
  17041. 90: uint8(_BT_NMSTRT),
  17042. 91: uint8(_BT_LSQB),
  17043. 92: uint8(_BT_OTHER),
  17044. 93: uint8(_BT_RSQB),
  17045. 94: uint8(_BT_OTHER),
  17046. 95: uint8(_BT_NMSTRT),
  17047. 96: uint8(_BT_OTHER),
  17048. 97: uint8(_BT_HEX),
  17049. 98: uint8(_BT_HEX),
  17050. 99: uint8(_BT_HEX),
  17051. 100: uint8(_BT_HEX),
  17052. 101: uint8(_BT_HEX),
  17053. 102: uint8(_BT_HEX),
  17054. 103: uint8(_BT_NMSTRT),
  17055. 104: uint8(_BT_NMSTRT),
  17056. 105: uint8(_BT_NMSTRT),
  17057. 106: uint8(_BT_NMSTRT),
  17058. 107: uint8(_BT_NMSTRT),
  17059. 108: uint8(_BT_NMSTRT),
  17060. 109: uint8(_BT_NMSTRT),
  17061. 110: uint8(_BT_NMSTRT),
  17062. 111: uint8(_BT_NMSTRT),
  17063. 112: uint8(_BT_NMSTRT),
  17064. 113: uint8(_BT_NMSTRT),
  17065. 114: uint8(_BT_NMSTRT),
  17066. 115: uint8(_BT_NMSTRT),
  17067. 116: uint8(_BT_NMSTRT),
  17068. 117: uint8(_BT_NMSTRT),
  17069. 118: uint8(_BT_NMSTRT),
  17070. 119: uint8(_BT_NMSTRT),
  17071. 120: uint8(_BT_NMSTRT),
  17072. 121: uint8(_BT_NMSTRT),
  17073. 122: uint8(_BT_NMSTRT),
  17074. 123: uint8(_BT_OTHER),
  17075. 124: uint8(_BT_VERBAR),
  17076. 125: uint8(_BT_OTHER),
  17077. 126: uint8(_BT_OTHER),
  17078. 127: uint8(_BT_OTHER),
  17079. 128: uint8(_BT_TRAIL),
  17080. 129: uint8(_BT_TRAIL),
  17081. 130: uint8(_BT_TRAIL),
  17082. 131: uint8(_BT_TRAIL),
  17083. 132: uint8(_BT_TRAIL),
  17084. 133: uint8(_BT_TRAIL),
  17085. 134: uint8(_BT_TRAIL),
  17086. 135: uint8(_BT_TRAIL),
  17087. 136: uint8(_BT_TRAIL),
  17088. 137: uint8(_BT_TRAIL),
  17089. 138: uint8(_BT_TRAIL),
  17090. 139: uint8(_BT_TRAIL),
  17091. 140: uint8(_BT_TRAIL),
  17092. 141: uint8(_BT_TRAIL),
  17093. 142: uint8(_BT_TRAIL),
  17094. 143: uint8(_BT_TRAIL),
  17095. 144: uint8(_BT_TRAIL),
  17096. 145: uint8(_BT_TRAIL),
  17097. 146: uint8(_BT_TRAIL),
  17098. 147: uint8(_BT_TRAIL),
  17099. 148: uint8(_BT_TRAIL),
  17100. 149: uint8(_BT_TRAIL),
  17101. 150: uint8(_BT_TRAIL),
  17102. 151: uint8(_BT_TRAIL),
  17103. 152: uint8(_BT_TRAIL),
  17104. 153: uint8(_BT_TRAIL),
  17105. 154: uint8(_BT_TRAIL),
  17106. 155: uint8(_BT_TRAIL),
  17107. 156: uint8(_BT_TRAIL),
  17108. 157: uint8(_BT_TRAIL),
  17109. 158: uint8(_BT_TRAIL),
  17110. 159: uint8(_BT_TRAIL),
  17111. 160: uint8(_BT_TRAIL),
  17112. 161: uint8(_BT_TRAIL),
  17113. 162: uint8(_BT_TRAIL),
  17114. 163: uint8(_BT_TRAIL),
  17115. 164: uint8(_BT_TRAIL),
  17116. 165: uint8(_BT_TRAIL),
  17117. 166: uint8(_BT_TRAIL),
  17118. 167: uint8(_BT_TRAIL),
  17119. 168: uint8(_BT_TRAIL),
  17120. 169: uint8(_BT_TRAIL),
  17121. 170: uint8(_BT_TRAIL),
  17122. 171: uint8(_BT_TRAIL),
  17123. 172: uint8(_BT_TRAIL),
  17124. 173: uint8(_BT_TRAIL),
  17125. 174: uint8(_BT_TRAIL),
  17126. 175: uint8(_BT_TRAIL),
  17127. 176: uint8(_BT_TRAIL),
  17128. 177: uint8(_BT_TRAIL),
  17129. 178: uint8(_BT_TRAIL),
  17130. 179: uint8(_BT_TRAIL),
  17131. 180: uint8(_BT_TRAIL),
  17132. 181: uint8(_BT_TRAIL),
  17133. 182: uint8(_BT_TRAIL),
  17134. 183: uint8(_BT_TRAIL),
  17135. 184: uint8(_BT_TRAIL),
  17136. 185: uint8(_BT_TRAIL),
  17137. 186: uint8(_BT_TRAIL),
  17138. 187: uint8(_BT_TRAIL),
  17139. 188: uint8(_BT_TRAIL),
  17140. 189: uint8(_BT_TRAIL),
  17141. 190: uint8(_BT_TRAIL),
  17142. 191: uint8(_BT_TRAIL),
  17143. 192: uint8(_BT_LEAD2),
  17144. 193: uint8(_BT_LEAD2),
  17145. 194: uint8(_BT_LEAD2),
  17146. 195: uint8(_BT_LEAD2),
  17147. 196: uint8(_BT_LEAD2),
  17148. 197: uint8(_BT_LEAD2),
  17149. 198: uint8(_BT_LEAD2),
  17150. 199: uint8(_BT_LEAD2),
  17151. 200: uint8(_BT_LEAD2),
  17152. 201: uint8(_BT_LEAD2),
  17153. 202: uint8(_BT_LEAD2),
  17154. 203: uint8(_BT_LEAD2),
  17155. 204: uint8(_BT_LEAD2),
  17156. 205: uint8(_BT_LEAD2),
  17157. 206: uint8(_BT_LEAD2),
  17158. 207: uint8(_BT_LEAD2),
  17159. 208: uint8(_BT_LEAD2),
  17160. 209: uint8(_BT_LEAD2),
  17161. 210: uint8(_BT_LEAD2),
  17162. 211: uint8(_BT_LEAD2),
  17163. 212: uint8(_BT_LEAD2),
  17164. 213: uint8(_BT_LEAD2),
  17165. 214: uint8(_BT_LEAD2),
  17166. 215: uint8(_BT_LEAD2),
  17167. 216: uint8(_BT_LEAD2),
  17168. 217: uint8(_BT_LEAD2),
  17169. 218: uint8(_BT_LEAD2),
  17170. 219: uint8(_BT_LEAD2),
  17171. 220: uint8(_BT_LEAD2),
  17172. 221: uint8(_BT_LEAD2),
  17173. 222: uint8(_BT_LEAD2),
  17174. 223: uint8(_BT_LEAD2),
  17175. 224: uint8(_BT_LEAD3),
  17176. 225: uint8(_BT_LEAD3),
  17177. 226: uint8(_BT_LEAD3),
  17178. 227: uint8(_BT_LEAD3),
  17179. 228: uint8(_BT_LEAD3),
  17180. 229: uint8(_BT_LEAD3),
  17181. 230: uint8(_BT_LEAD3),
  17182. 231: uint8(_BT_LEAD3),
  17183. 232: uint8(_BT_LEAD3),
  17184. 233: uint8(_BT_LEAD3),
  17185. 234: uint8(_BT_LEAD3),
  17186. 235: uint8(_BT_LEAD3),
  17187. 236: uint8(_BT_LEAD3),
  17188. 237: uint8(_BT_LEAD3),
  17189. 238: uint8(_BT_LEAD3),
  17190. 239: uint8(_BT_LEAD3),
  17191. 240: uint8(_BT_LEAD4),
  17192. 241: uint8(_BT_LEAD4),
  17193. 242: uint8(_BT_LEAD4),
  17194. 243: uint8(_BT_LEAD4),
  17195. 244: uint8(_BT_LEAD4),
  17196. 254: uint8(_BT_MALFORM),
  17197. 255: uint8(_BT_MALFORM),
  17198. },
  17199. }
  17200. func init() {
  17201. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17202. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17203. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17204. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17205. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17206. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17207. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17208. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17209. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17210. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17211. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17212. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17213. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17214. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17215. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17216. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17217. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17218. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17219. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17220. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17221. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17222. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17223. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17224. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17225. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17226. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17227. }
  17228. var _internal_utf8_encoding = Tnormal_encoding{
  17229. Fenc: TENCODING{
  17230. Fscanners: [4]TSCANNER{},
  17231. FliteralScanners: [2]TSCANNER{},
  17232. FminBytesPerChar: int32(1),
  17233. FisUtf8: uint8(1),
  17234. },
  17235. Ftype1: [256]uint8{
  17236. 9: uint8(_BT_S),
  17237. 10: uint8(_BT_LF),
  17238. 13: uint8(_BT_S),
  17239. 32: uint8(_BT_S),
  17240. 33: uint8(_BT_EXCL),
  17241. 34: uint8(_BT_QUOT),
  17242. 35: uint8(_BT_NUM),
  17243. 36: uint8(_BT_OTHER),
  17244. 37: uint8(_BT_PERCNT),
  17245. 38: uint8(_BT_AMP),
  17246. 39: uint8(_BT_APOS),
  17247. 40: uint8(_BT_LPAR),
  17248. 41: uint8(_BT_RPAR),
  17249. 42: uint8(_BT_AST),
  17250. 43: uint8(_BT_PLUS),
  17251. 44: uint8(_BT_COMMA),
  17252. 45: uint8(_BT_MINUS),
  17253. 46: uint8(_BT_NAME),
  17254. 47: uint8(_BT_SOL),
  17255. 48: uint8(_BT_DIGIT),
  17256. 49: uint8(_BT_DIGIT),
  17257. 50: uint8(_BT_DIGIT),
  17258. 51: uint8(_BT_DIGIT),
  17259. 52: uint8(_BT_DIGIT),
  17260. 53: uint8(_BT_DIGIT),
  17261. 54: uint8(_BT_DIGIT),
  17262. 55: uint8(_BT_DIGIT),
  17263. 56: uint8(_BT_DIGIT),
  17264. 57: uint8(_BT_DIGIT),
  17265. 58: uint8(_BT_NMSTRT),
  17266. 59: uint8(_BT_SEMI),
  17267. 60: uint8(_BT_LT),
  17268. 61: uint8(_BT_EQUALS),
  17269. 62: uint8(_BT_GT),
  17270. 63: uint8(_BT_QUEST),
  17271. 64: uint8(_BT_OTHER),
  17272. 65: uint8(_BT_HEX),
  17273. 66: uint8(_BT_HEX),
  17274. 67: uint8(_BT_HEX),
  17275. 68: uint8(_BT_HEX),
  17276. 69: uint8(_BT_HEX),
  17277. 70: uint8(_BT_HEX),
  17278. 71: uint8(_BT_NMSTRT),
  17279. 72: uint8(_BT_NMSTRT),
  17280. 73: uint8(_BT_NMSTRT),
  17281. 74: uint8(_BT_NMSTRT),
  17282. 75: uint8(_BT_NMSTRT),
  17283. 76: uint8(_BT_NMSTRT),
  17284. 77: uint8(_BT_NMSTRT),
  17285. 78: uint8(_BT_NMSTRT),
  17286. 79: uint8(_BT_NMSTRT),
  17287. 80: uint8(_BT_NMSTRT),
  17288. 81: uint8(_BT_NMSTRT),
  17289. 82: uint8(_BT_NMSTRT),
  17290. 83: uint8(_BT_NMSTRT),
  17291. 84: uint8(_BT_NMSTRT),
  17292. 85: uint8(_BT_NMSTRT),
  17293. 86: uint8(_BT_NMSTRT),
  17294. 87: uint8(_BT_NMSTRT),
  17295. 88: uint8(_BT_NMSTRT),
  17296. 89: uint8(_BT_NMSTRT),
  17297. 90: uint8(_BT_NMSTRT),
  17298. 91: uint8(_BT_LSQB),
  17299. 92: uint8(_BT_OTHER),
  17300. 93: uint8(_BT_RSQB),
  17301. 94: uint8(_BT_OTHER),
  17302. 95: uint8(_BT_NMSTRT),
  17303. 96: uint8(_BT_OTHER),
  17304. 97: uint8(_BT_HEX),
  17305. 98: uint8(_BT_HEX),
  17306. 99: uint8(_BT_HEX),
  17307. 100: uint8(_BT_HEX),
  17308. 101: uint8(_BT_HEX),
  17309. 102: uint8(_BT_HEX),
  17310. 103: uint8(_BT_NMSTRT),
  17311. 104: uint8(_BT_NMSTRT),
  17312. 105: uint8(_BT_NMSTRT),
  17313. 106: uint8(_BT_NMSTRT),
  17314. 107: uint8(_BT_NMSTRT),
  17315. 108: uint8(_BT_NMSTRT),
  17316. 109: uint8(_BT_NMSTRT),
  17317. 110: uint8(_BT_NMSTRT),
  17318. 111: uint8(_BT_NMSTRT),
  17319. 112: uint8(_BT_NMSTRT),
  17320. 113: uint8(_BT_NMSTRT),
  17321. 114: uint8(_BT_NMSTRT),
  17322. 115: uint8(_BT_NMSTRT),
  17323. 116: uint8(_BT_NMSTRT),
  17324. 117: uint8(_BT_NMSTRT),
  17325. 118: uint8(_BT_NMSTRT),
  17326. 119: uint8(_BT_NMSTRT),
  17327. 120: uint8(_BT_NMSTRT),
  17328. 121: uint8(_BT_NMSTRT),
  17329. 122: uint8(_BT_NMSTRT),
  17330. 123: uint8(_BT_OTHER),
  17331. 124: uint8(_BT_VERBAR),
  17332. 125: uint8(_BT_OTHER),
  17333. 126: uint8(_BT_OTHER),
  17334. 127: uint8(_BT_OTHER),
  17335. 128: uint8(_BT_TRAIL),
  17336. 129: uint8(_BT_TRAIL),
  17337. 130: uint8(_BT_TRAIL),
  17338. 131: uint8(_BT_TRAIL),
  17339. 132: uint8(_BT_TRAIL),
  17340. 133: uint8(_BT_TRAIL),
  17341. 134: uint8(_BT_TRAIL),
  17342. 135: uint8(_BT_TRAIL),
  17343. 136: uint8(_BT_TRAIL),
  17344. 137: uint8(_BT_TRAIL),
  17345. 138: uint8(_BT_TRAIL),
  17346. 139: uint8(_BT_TRAIL),
  17347. 140: uint8(_BT_TRAIL),
  17348. 141: uint8(_BT_TRAIL),
  17349. 142: uint8(_BT_TRAIL),
  17350. 143: uint8(_BT_TRAIL),
  17351. 144: uint8(_BT_TRAIL),
  17352. 145: uint8(_BT_TRAIL),
  17353. 146: uint8(_BT_TRAIL),
  17354. 147: uint8(_BT_TRAIL),
  17355. 148: uint8(_BT_TRAIL),
  17356. 149: uint8(_BT_TRAIL),
  17357. 150: uint8(_BT_TRAIL),
  17358. 151: uint8(_BT_TRAIL),
  17359. 152: uint8(_BT_TRAIL),
  17360. 153: uint8(_BT_TRAIL),
  17361. 154: uint8(_BT_TRAIL),
  17362. 155: uint8(_BT_TRAIL),
  17363. 156: uint8(_BT_TRAIL),
  17364. 157: uint8(_BT_TRAIL),
  17365. 158: uint8(_BT_TRAIL),
  17366. 159: uint8(_BT_TRAIL),
  17367. 160: uint8(_BT_TRAIL),
  17368. 161: uint8(_BT_TRAIL),
  17369. 162: uint8(_BT_TRAIL),
  17370. 163: uint8(_BT_TRAIL),
  17371. 164: uint8(_BT_TRAIL),
  17372. 165: uint8(_BT_TRAIL),
  17373. 166: uint8(_BT_TRAIL),
  17374. 167: uint8(_BT_TRAIL),
  17375. 168: uint8(_BT_TRAIL),
  17376. 169: uint8(_BT_TRAIL),
  17377. 170: uint8(_BT_TRAIL),
  17378. 171: uint8(_BT_TRAIL),
  17379. 172: uint8(_BT_TRAIL),
  17380. 173: uint8(_BT_TRAIL),
  17381. 174: uint8(_BT_TRAIL),
  17382. 175: uint8(_BT_TRAIL),
  17383. 176: uint8(_BT_TRAIL),
  17384. 177: uint8(_BT_TRAIL),
  17385. 178: uint8(_BT_TRAIL),
  17386. 179: uint8(_BT_TRAIL),
  17387. 180: uint8(_BT_TRAIL),
  17388. 181: uint8(_BT_TRAIL),
  17389. 182: uint8(_BT_TRAIL),
  17390. 183: uint8(_BT_TRAIL),
  17391. 184: uint8(_BT_TRAIL),
  17392. 185: uint8(_BT_TRAIL),
  17393. 186: uint8(_BT_TRAIL),
  17394. 187: uint8(_BT_TRAIL),
  17395. 188: uint8(_BT_TRAIL),
  17396. 189: uint8(_BT_TRAIL),
  17397. 190: uint8(_BT_TRAIL),
  17398. 191: uint8(_BT_TRAIL),
  17399. 192: uint8(_BT_LEAD2),
  17400. 193: uint8(_BT_LEAD2),
  17401. 194: uint8(_BT_LEAD2),
  17402. 195: uint8(_BT_LEAD2),
  17403. 196: uint8(_BT_LEAD2),
  17404. 197: uint8(_BT_LEAD2),
  17405. 198: uint8(_BT_LEAD2),
  17406. 199: uint8(_BT_LEAD2),
  17407. 200: uint8(_BT_LEAD2),
  17408. 201: uint8(_BT_LEAD2),
  17409. 202: uint8(_BT_LEAD2),
  17410. 203: uint8(_BT_LEAD2),
  17411. 204: uint8(_BT_LEAD2),
  17412. 205: uint8(_BT_LEAD2),
  17413. 206: uint8(_BT_LEAD2),
  17414. 207: uint8(_BT_LEAD2),
  17415. 208: uint8(_BT_LEAD2),
  17416. 209: uint8(_BT_LEAD2),
  17417. 210: uint8(_BT_LEAD2),
  17418. 211: uint8(_BT_LEAD2),
  17419. 212: uint8(_BT_LEAD2),
  17420. 213: uint8(_BT_LEAD2),
  17421. 214: uint8(_BT_LEAD2),
  17422. 215: uint8(_BT_LEAD2),
  17423. 216: uint8(_BT_LEAD2),
  17424. 217: uint8(_BT_LEAD2),
  17425. 218: uint8(_BT_LEAD2),
  17426. 219: uint8(_BT_LEAD2),
  17427. 220: uint8(_BT_LEAD2),
  17428. 221: uint8(_BT_LEAD2),
  17429. 222: uint8(_BT_LEAD2),
  17430. 223: uint8(_BT_LEAD2),
  17431. 224: uint8(_BT_LEAD3),
  17432. 225: uint8(_BT_LEAD3),
  17433. 226: uint8(_BT_LEAD3),
  17434. 227: uint8(_BT_LEAD3),
  17435. 228: uint8(_BT_LEAD3),
  17436. 229: uint8(_BT_LEAD3),
  17437. 230: uint8(_BT_LEAD3),
  17438. 231: uint8(_BT_LEAD3),
  17439. 232: uint8(_BT_LEAD3),
  17440. 233: uint8(_BT_LEAD3),
  17441. 234: uint8(_BT_LEAD3),
  17442. 235: uint8(_BT_LEAD3),
  17443. 236: uint8(_BT_LEAD3),
  17444. 237: uint8(_BT_LEAD3),
  17445. 238: uint8(_BT_LEAD3),
  17446. 239: uint8(_BT_LEAD3),
  17447. 240: uint8(_BT_LEAD4),
  17448. 241: uint8(_BT_LEAD4),
  17449. 242: uint8(_BT_LEAD4),
  17450. 243: uint8(_BT_LEAD4),
  17451. 244: uint8(_BT_LEAD4),
  17452. 254: uint8(_BT_MALFORM),
  17453. 255: uint8(_BT_MALFORM),
  17454. },
  17455. }
  17456. func init() {
  17457. p := unsafe.Pointer(&_internal_utf8_encoding)
  17458. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17459. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17460. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17461. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17462. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17463. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17464. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17465. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17466. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17467. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17468. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17469. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17470. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17471. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17472. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  17473. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  17474. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  17475. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  17476. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  17477. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  17478. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  17479. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  17480. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  17481. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  17482. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  17483. }
  17484. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17485. var c uint8
  17486. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17487. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17488. _ = enc
  17489. for {
  17490. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17491. return int32(_XML_CONVERT_COMPLETED)
  17492. }
  17493. c = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))
  17494. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17495. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  17496. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17497. }
  17498. v3 = toP
  17499. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17500. *(*uintptr)(unsafe.Pointer(v3))++
  17501. *(*uint8)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17502. v5 = toP
  17503. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17504. *(*uintptr)(unsafe.Pointer(v5))++
  17505. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17506. *(*uintptr)(unsafe.Pointer(fromP))++
  17507. } else {
  17508. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17509. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17510. }
  17511. v7 = toP
  17512. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17513. *(*uintptr)(unsafe.Pointer(v7))++
  17514. v9 = fromP
  17515. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17516. *(*uintptr)(unsafe.Pointer(v9))++
  17517. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v8))
  17518. }
  17519. goto _1
  17520. _1:
  17521. }
  17522. return r
  17523. }
  17524. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17525. var v1, v2, v3, v4 uintptr
  17526. _, _, _, _ = v1, v2, v3, v4
  17527. _ = enc
  17528. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17529. v2 = toP
  17530. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17531. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17532. v4 = fromP
  17533. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17534. *(*uintptr)(unsafe.Pointer(v4))++
  17535. *(*uint16)(unsafe.Pointer(v1)) = uint16(*(*uint8)(unsafe.Pointer(v3)))
  17536. }
  17537. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17538. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17539. } else {
  17540. return int32(_XML_CONVERT_COMPLETED)
  17541. }
  17542. return r
  17543. }
  17544. var _latin1_encoding_ns = Tnormal_encoding{
  17545. Fenc: TENCODING{
  17546. Fscanners: [4]TSCANNER{},
  17547. FliteralScanners: [2]TSCANNER{},
  17548. FminBytesPerChar: int32(1),
  17549. },
  17550. Ftype1: [256]uint8{
  17551. 9: uint8(_BT_S),
  17552. 10: uint8(_BT_LF),
  17553. 13: uint8(_BT_CR),
  17554. 32: uint8(_BT_S),
  17555. 33: uint8(_BT_EXCL),
  17556. 34: uint8(_BT_QUOT),
  17557. 35: uint8(_BT_NUM),
  17558. 36: uint8(_BT_OTHER),
  17559. 37: uint8(_BT_PERCNT),
  17560. 38: uint8(_BT_AMP),
  17561. 39: uint8(_BT_APOS),
  17562. 40: uint8(_BT_LPAR),
  17563. 41: uint8(_BT_RPAR),
  17564. 42: uint8(_BT_AST),
  17565. 43: uint8(_BT_PLUS),
  17566. 44: uint8(_BT_COMMA),
  17567. 45: uint8(_BT_MINUS),
  17568. 46: uint8(_BT_NAME),
  17569. 47: uint8(_BT_SOL),
  17570. 48: uint8(_BT_DIGIT),
  17571. 49: uint8(_BT_DIGIT),
  17572. 50: uint8(_BT_DIGIT),
  17573. 51: uint8(_BT_DIGIT),
  17574. 52: uint8(_BT_DIGIT),
  17575. 53: uint8(_BT_DIGIT),
  17576. 54: uint8(_BT_DIGIT),
  17577. 55: uint8(_BT_DIGIT),
  17578. 56: uint8(_BT_DIGIT),
  17579. 57: uint8(_BT_DIGIT),
  17580. 58: uint8(_BT_COLON),
  17581. 59: uint8(_BT_SEMI),
  17582. 60: uint8(_BT_LT),
  17583. 61: uint8(_BT_EQUALS),
  17584. 62: uint8(_BT_GT),
  17585. 63: uint8(_BT_QUEST),
  17586. 64: uint8(_BT_OTHER),
  17587. 65: uint8(_BT_HEX),
  17588. 66: uint8(_BT_HEX),
  17589. 67: uint8(_BT_HEX),
  17590. 68: uint8(_BT_HEX),
  17591. 69: uint8(_BT_HEX),
  17592. 70: uint8(_BT_HEX),
  17593. 71: uint8(_BT_NMSTRT),
  17594. 72: uint8(_BT_NMSTRT),
  17595. 73: uint8(_BT_NMSTRT),
  17596. 74: uint8(_BT_NMSTRT),
  17597. 75: uint8(_BT_NMSTRT),
  17598. 76: uint8(_BT_NMSTRT),
  17599. 77: uint8(_BT_NMSTRT),
  17600. 78: uint8(_BT_NMSTRT),
  17601. 79: uint8(_BT_NMSTRT),
  17602. 80: uint8(_BT_NMSTRT),
  17603. 81: uint8(_BT_NMSTRT),
  17604. 82: uint8(_BT_NMSTRT),
  17605. 83: uint8(_BT_NMSTRT),
  17606. 84: uint8(_BT_NMSTRT),
  17607. 85: uint8(_BT_NMSTRT),
  17608. 86: uint8(_BT_NMSTRT),
  17609. 87: uint8(_BT_NMSTRT),
  17610. 88: uint8(_BT_NMSTRT),
  17611. 89: uint8(_BT_NMSTRT),
  17612. 90: uint8(_BT_NMSTRT),
  17613. 91: uint8(_BT_LSQB),
  17614. 92: uint8(_BT_OTHER),
  17615. 93: uint8(_BT_RSQB),
  17616. 94: uint8(_BT_OTHER),
  17617. 95: uint8(_BT_NMSTRT),
  17618. 96: uint8(_BT_OTHER),
  17619. 97: uint8(_BT_HEX),
  17620. 98: uint8(_BT_HEX),
  17621. 99: uint8(_BT_HEX),
  17622. 100: uint8(_BT_HEX),
  17623. 101: uint8(_BT_HEX),
  17624. 102: uint8(_BT_HEX),
  17625. 103: uint8(_BT_NMSTRT),
  17626. 104: uint8(_BT_NMSTRT),
  17627. 105: uint8(_BT_NMSTRT),
  17628. 106: uint8(_BT_NMSTRT),
  17629. 107: uint8(_BT_NMSTRT),
  17630. 108: uint8(_BT_NMSTRT),
  17631. 109: uint8(_BT_NMSTRT),
  17632. 110: uint8(_BT_NMSTRT),
  17633. 111: uint8(_BT_NMSTRT),
  17634. 112: uint8(_BT_NMSTRT),
  17635. 113: uint8(_BT_NMSTRT),
  17636. 114: uint8(_BT_NMSTRT),
  17637. 115: uint8(_BT_NMSTRT),
  17638. 116: uint8(_BT_NMSTRT),
  17639. 117: uint8(_BT_NMSTRT),
  17640. 118: uint8(_BT_NMSTRT),
  17641. 119: uint8(_BT_NMSTRT),
  17642. 120: uint8(_BT_NMSTRT),
  17643. 121: uint8(_BT_NMSTRT),
  17644. 122: uint8(_BT_NMSTRT),
  17645. 123: uint8(_BT_OTHER),
  17646. 124: uint8(_BT_VERBAR),
  17647. 125: uint8(_BT_OTHER),
  17648. 126: uint8(_BT_OTHER),
  17649. 127: uint8(_BT_OTHER),
  17650. 128: uint8(_BT_OTHER),
  17651. 129: uint8(_BT_OTHER),
  17652. 130: uint8(_BT_OTHER),
  17653. 131: uint8(_BT_OTHER),
  17654. 132: uint8(_BT_OTHER),
  17655. 133: uint8(_BT_OTHER),
  17656. 134: uint8(_BT_OTHER),
  17657. 135: uint8(_BT_OTHER),
  17658. 136: uint8(_BT_OTHER),
  17659. 137: uint8(_BT_OTHER),
  17660. 138: uint8(_BT_OTHER),
  17661. 139: uint8(_BT_OTHER),
  17662. 140: uint8(_BT_OTHER),
  17663. 141: uint8(_BT_OTHER),
  17664. 142: uint8(_BT_OTHER),
  17665. 143: uint8(_BT_OTHER),
  17666. 144: uint8(_BT_OTHER),
  17667. 145: uint8(_BT_OTHER),
  17668. 146: uint8(_BT_OTHER),
  17669. 147: uint8(_BT_OTHER),
  17670. 148: uint8(_BT_OTHER),
  17671. 149: uint8(_BT_OTHER),
  17672. 150: uint8(_BT_OTHER),
  17673. 151: uint8(_BT_OTHER),
  17674. 152: uint8(_BT_OTHER),
  17675. 153: uint8(_BT_OTHER),
  17676. 154: uint8(_BT_OTHER),
  17677. 155: uint8(_BT_OTHER),
  17678. 156: uint8(_BT_OTHER),
  17679. 157: uint8(_BT_OTHER),
  17680. 158: uint8(_BT_OTHER),
  17681. 159: uint8(_BT_OTHER),
  17682. 160: uint8(_BT_OTHER),
  17683. 161: uint8(_BT_OTHER),
  17684. 162: uint8(_BT_OTHER),
  17685. 163: uint8(_BT_OTHER),
  17686. 164: uint8(_BT_OTHER),
  17687. 165: uint8(_BT_OTHER),
  17688. 166: uint8(_BT_OTHER),
  17689. 167: uint8(_BT_OTHER),
  17690. 168: uint8(_BT_OTHER),
  17691. 169: uint8(_BT_OTHER),
  17692. 170: uint8(_BT_NMSTRT),
  17693. 171: uint8(_BT_OTHER),
  17694. 172: uint8(_BT_OTHER),
  17695. 173: uint8(_BT_OTHER),
  17696. 174: uint8(_BT_OTHER),
  17697. 175: uint8(_BT_OTHER),
  17698. 176: uint8(_BT_OTHER),
  17699. 177: uint8(_BT_OTHER),
  17700. 178: uint8(_BT_OTHER),
  17701. 179: uint8(_BT_OTHER),
  17702. 180: uint8(_BT_OTHER),
  17703. 181: uint8(_BT_NMSTRT),
  17704. 182: uint8(_BT_OTHER),
  17705. 183: uint8(_BT_NAME),
  17706. 184: uint8(_BT_OTHER),
  17707. 185: uint8(_BT_OTHER),
  17708. 186: uint8(_BT_NMSTRT),
  17709. 187: uint8(_BT_OTHER),
  17710. 188: uint8(_BT_OTHER),
  17711. 189: uint8(_BT_OTHER),
  17712. 190: uint8(_BT_OTHER),
  17713. 191: uint8(_BT_OTHER),
  17714. 192: uint8(_BT_NMSTRT),
  17715. 193: uint8(_BT_NMSTRT),
  17716. 194: uint8(_BT_NMSTRT),
  17717. 195: uint8(_BT_NMSTRT),
  17718. 196: uint8(_BT_NMSTRT),
  17719. 197: uint8(_BT_NMSTRT),
  17720. 198: uint8(_BT_NMSTRT),
  17721. 199: uint8(_BT_NMSTRT),
  17722. 200: uint8(_BT_NMSTRT),
  17723. 201: uint8(_BT_NMSTRT),
  17724. 202: uint8(_BT_NMSTRT),
  17725. 203: uint8(_BT_NMSTRT),
  17726. 204: uint8(_BT_NMSTRT),
  17727. 205: uint8(_BT_NMSTRT),
  17728. 206: uint8(_BT_NMSTRT),
  17729. 207: uint8(_BT_NMSTRT),
  17730. 208: uint8(_BT_NMSTRT),
  17731. 209: uint8(_BT_NMSTRT),
  17732. 210: uint8(_BT_NMSTRT),
  17733. 211: uint8(_BT_NMSTRT),
  17734. 212: uint8(_BT_NMSTRT),
  17735. 213: uint8(_BT_NMSTRT),
  17736. 214: uint8(_BT_NMSTRT),
  17737. 215: uint8(_BT_OTHER),
  17738. 216: uint8(_BT_NMSTRT),
  17739. 217: uint8(_BT_NMSTRT),
  17740. 218: uint8(_BT_NMSTRT),
  17741. 219: uint8(_BT_NMSTRT),
  17742. 220: uint8(_BT_NMSTRT),
  17743. 221: uint8(_BT_NMSTRT),
  17744. 222: uint8(_BT_NMSTRT),
  17745. 223: uint8(_BT_NMSTRT),
  17746. 224: uint8(_BT_NMSTRT),
  17747. 225: uint8(_BT_NMSTRT),
  17748. 226: uint8(_BT_NMSTRT),
  17749. 227: uint8(_BT_NMSTRT),
  17750. 228: uint8(_BT_NMSTRT),
  17751. 229: uint8(_BT_NMSTRT),
  17752. 230: uint8(_BT_NMSTRT),
  17753. 231: uint8(_BT_NMSTRT),
  17754. 232: uint8(_BT_NMSTRT),
  17755. 233: uint8(_BT_NMSTRT),
  17756. 234: uint8(_BT_NMSTRT),
  17757. 235: uint8(_BT_NMSTRT),
  17758. 236: uint8(_BT_NMSTRT),
  17759. 237: uint8(_BT_NMSTRT),
  17760. 238: uint8(_BT_NMSTRT),
  17761. 239: uint8(_BT_NMSTRT),
  17762. 240: uint8(_BT_NMSTRT),
  17763. 241: uint8(_BT_NMSTRT),
  17764. 242: uint8(_BT_NMSTRT),
  17765. 243: uint8(_BT_NMSTRT),
  17766. 244: uint8(_BT_NMSTRT),
  17767. 245: uint8(_BT_NMSTRT),
  17768. 246: uint8(_BT_NMSTRT),
  17769. 247: uint8(_BT_OTHER),
  17770. 248: uint8(_BT_NMSTRT),
  17771. 249: uint8(_BT_NMSTRT),
  17772. 250: uint8(_BT_NMSTRT),
  17773. 251: uint8(_BT_NMSTRT),
  17774. 252: uint8(_BT_NMSTRT),
  17775. 253: uint8(_BT_NMSTRT),
  17776. 254: uint8(_BT_NMSTRT),
  17777. 255: uint8(_BT_NMSTRT),
  17778. },
  17779. }
  17780. func init() {
  17781. p := unsafe.Pointer(&_latin1_encoding_ns)
  17782. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17783. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  17784. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  17785. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  17786. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  17787. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  17788. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  17789. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  17790. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  17791. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  17792. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  17793. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  17794. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  17795. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  17796. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  17797. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  17798. }
  17799. var _latin1_encoding = Tnormal_encoding{
  17800. Fenc: TENCODING{
  17801. Fscanners: [4]TSCANNER{},
  17802. FliteralScanners: [2]TSCANNER{},
  17803. FminBytesPerChar: int32(1),
  17804. },
  17805. Ftype1: [256]uint8{
  17806. 9: uint8(_BT_S),
  17807. 10: uint8(_BT_LF),
  17808. 13: uint8(_BT_CR),
  17809. 32: uint8(_BT_S),
  17810. 33: uint8(_BT_EXCL),
  17811. 34: uint8(_BT_QUOT),
  17812. 35: uint8(_BT_NUM),
  17813. 36: uint8(_BT_OTHER),
  17814. 37: uint8(_BT_PERCNT),
  17815. 38: uint8(_BT_AMP),
  17816. 39: uint8(_BT_APOS),
  17817. 40: uint8(_BT_LPAR),
  17818. 41: uint8(_BT_RPAR),
  17819. 42: uint8(_BT_AST),
  17820. 43: uint8(_BT_PLUS),
  17821. 44: uint8(_BT_COMMA),
  17822. 45: uint8(_BT_MINUS),
  17823. 46: uint8(_BT_NAME),
  17824. 47: uint8(_BT_SOL),
  17825. 48: uint8(_BT_DIGIT),
  17826. 49: uint8(_BT_DIGIT),
  17827. 50: uint8(_BT_DIGIT),
  17828. 51: uint8(_BT_DIGIT),
  17829. 52: uint8(_BT_DIGIT),
  17830. 53: uint8(_BT_DIGIT),
  17831. 54: uint8(_BT_DIGIT),
  17832. 55: uint8(_BT_DIGIT),
  17833. 56: uint8(_BT_DIGIT),
  17834. 57: uint8(_BT_DIGIT),
  17835. 58: uint8(_BT_NMSTRT),
  17836. 59: uint8(_BT_SEMI),
  17837. 60: uint8(_BT_LT),
  17838. 61: uint8(_BT_EQUALS),
  17839. 62: uint8(_BT_GT),
  17840. 63: uint8(_BT_QUEST),
  17841. 64: uint8(_BT_OTHER),
  17842. 65: uint8(_BT_HEX),
  17843. 66: uint8(_BT_HEX),
  17844. 67: uint8(_BT_HEX),
  17845. 68: uint8(_BT_HEX),
  17846. 69: uint8(_BT_HEX),
  17847. 70: uint8(_BT_HEX),
  17848. 71: uint8(_BT_NMSTRT),
  17849. 72: uint8(_BT_NMSTRT),
  17850. 73: uint8(_BT_NMSTRT),
  17851. 74: uint8(_BT_NMSTRT),
  17852. 75: uint8(_BT_NMSTRT),
  17853. 76: uint8(_BT_NMSTRT),
  17854. 77: uint8(_BT_NMSTRT),
  17855. 78: uint8(_BT_NMSTRT),
  17856. 79: uint8(_BT_NMSTRT),
  17857. 80: uint8(_BT_NMSTRT),
  17858. 81: uint8(_BT_NMSTRT),
  17859. 82: uint8(_BT_NMSTRT),
  17860. 83: uint8(_BT_NMSTRT),
  17861. 84: uint8(_BT_NMSTRT),
  17862. 85: uint8(_BT_NMSTRT),
  17863. 86: uint8(_BT_NMSTRT),
  17864. 87: uint8(_BT_NMSTRT),
  17865. 88: uint8(_BT_NMSTRT),
  17866. 89: uint8(_BT_NMSTRT),
  17867. 90: uint8(_BT_NMSTRT),
  17868. 91: uint8(_BT_LSQB),
  17869. 92: uint8(_BT_OTHER),
  17870. 93: uint8(_BT_RSQB),
  17871. 94: uint8(_BT_OTHER),
  17872. 95: uint8(_BT_NMSTRT),
  17873. 96: uint8(_BT_OTHER),
  17874. 97: uint8(_BT_HEX),
  17875. 98: uint8(_BT_HEX),
  17876. 99: uint8(_BT_HEX),
  17877. 100: uint8(_BT_HEX),
  17878. 101: uint8(_BT_HEX),
  17879. 102: uint8(_BT_HEX),
  17880. 103: uint8(_BT_NMSTRT),
  17881. 104: uint8(_BT_NMSTRT),
  17882. 105: uint8(_BT_NMSTRT),
  17883. 106: uint8(_BT_NMSTRT),
  17884. 107: uint8(_BT_NMSTRT),
  17885. 108: uint8(_BT_NMSTRT),
  17886. 109: uint8(_BT_NMSTRT),
  17887. 110: uint8(_BT_NMSTRT),
  17888. 111: uint8(_BT_NMSTRT),
  17889. 112: uint8(_BT_NMSTRT),
  17890. 113: uint8(_BT_NMSTRT),
  17891. 114: uint8(_BT_NMSTRT),
  17892. 115: uint8(_BT_NMSTRT),
  17893. 116: uint8(_BT_NMSTRT),
  17894. 117: uint8(_BT_NMSTRT),
  17895. 118: uint8(_BT_NMSTRT),
  17896. 119: uint8(_BT_NMSTRT),
  17897. 120: uint8(_BT_NMSTRT),
  17898. 121: uint8(_BT_NMSTRT),
  17899. 122: uint8(_BT_NMSTRT),
  17900. 123: uint8(_BT_OTHER),
  17901. 124: uint8(_BT_VERBAR),
  17902. 125: uint8(_BT_OTHER),
  17903. 126: uint8(_BT_OTHER),
  17904. 127: uint8(_BT_OTHER),
  17905. 128: uint8(_BT_OTHER),
  17906. 129: uint8(_BT_OTHER),
  17907. 130: uint8(_BT_OTHER),
  17908. 131: uint8(_BT_OTHER),
  17909. 132: uint8(_BT_OTHER),
  17910. 133: uint8(_BT_OTHER),
  17911. 134: uint8(_BT_OTHER),
  17912. 135: uint8(_BT_OTHER),
  17913. 136: uint8(_BT_OTHER),
  17914. 137: uint8(_BT_OTHER),
  17915. 138: uint8(_BT_OTHER),
  17916. 139: uint8(_BT_OTHER),
  17917. 140: uint8(_BT_OTHER),
  17918. 141: uint8(_BT_OTHER),
  17919. 142: uint8(_BT_OTHER),
  17920. 143: uint8(_BT_OTHER),
  17921. 144: uint8(_BT_OTHER),
  17922. 145: uint8(_BT_OTHER),
  17923. 146: uint8(_BT_OTHER),
  17924. 147: uint8(_BT_OTHER),
  17925. 148: uint8(_BT_OTHER),
  17926. 149: uint8(_BT_OTHER),
  17927. 150: uint8(_BT_OTHER),
  17928. 151: uint8(_BT_OTHER),
  17929. 152: uint8(_BT_OTHER),
  17930. 153: uint8(_BT_OTHER),
  17931. 154: uint8(_BT_OTHER),
  17932. 155: uint8(_BT_OTHER),
  17933. 156: uint8(_BT_OTHER),
  17934. 157: uint8(_BT_OTHER),
  17935. 158: uint8(_BT_OTHER),
  17936. 159: uint8(_BT_OTHER),
  17937. 160: uint8(_BT_OTHER),
  17938. 161: uint8(_BT_OTHER),
  17939. 162: uint8(_BT_OTHER),
  17940. 163: uint8(_BT_OTHER),
  17941. 164: uint8(_BT_OTHER),
  17942. 165: uint8(_BT_OTHER),
  17943. 166: uint8(_BT_OTHER),
  17944. 167: uint8(_BT_OTHER),
  17945. 168: uint8(_BT_OTHER),
  17946. 169: uint8(_BT_OTHER),
  17947. 170: uint8(_BT_NMSTRT),
  17948. 171: uint8(_BT_OTHER),
  17949. 172: uint8(_BT_OTHER),
  17950. 173: uint8(_BT_OTHER),
  17951. 174: uint8(_BT_OTHER),
  17952. 175: uint8(_BT_OTHER),
  17953. 176: uint8(_BT_OTHER),
  17954. 177: uint8(_BT_OTHER),
  17955. 178: uint8(_BT_OTHER),
  17956. 179: uint8(_BT_OTHER),
  17957. 180: uint8(_BT_OTHER),
  17958. 181: uint8(_BT_NMSTRT),
  17959. 182: uint8(_BT_OTHER),
  17960. 183: uint8(_BT_NAME),
  17961. 184: uint8(_BT_OTHER),
  17962. 185: uint8(_BT_OTHER),
  17963. 186: uint8(_BT_NMSTRT),
  17964. 187: uint8(_BT_OTHER),
  17965. 188: uint8(_BT_OTHER),
  17966. 189: uint8(_BT_OTHER),
  17967. 190: uint8(_BT_OTHER),
  17968. 191: uint8(_BT_OTHER),
  17969. 192: uint8(_BT_NMSTRT),
  17970. 193: uint8(_BT_NMSTRT),
  17971. 194: uint8(_BT_NMSTRT),
  17972. 195: uint8(_BT_NMSTRT),
  17973. 196: uint8(_BT_NMSTRT),
  17974. 197: uint8(_BT_NMSTRT),
  17975. 198: uint8(_BT_NMSTRT),
  17976. 199: uint8(_BT_NMSTRT),
  17977. 200: uint8(_BT_NMSTRT),
  17978. 201: uint8(_BT_NMSTRT),
  17979. 202: uint8(_BT_NMSTRT),
  17980. 203: uint8(_BT_NMSTRT),
  17981. 204: uint8(_BT_NMSTRT),
  17982. 205: uint8(_BT_NMSTRT),
  17983. 206: uint8(_BT_NMSTRT),
  17984. 207: uint8(_BT_NMSTRT),
  17985. 208: uint8(_BT_NMSTRT),
  17986. 209: uint8(_BT_NMSTRT),
  17987. 210: uint8(_BT_NMSTRT),
  17988. 211: uint8(_BT_NMSTRT),
  17989. 212: uint8(_BT_NMSTRT),
  17990. 213: uint8(_BT_NMSTRT),
  17991. 214: uint8(_BT_NMSTRT),
  17992. 215: uint8(_BT_OTHER),
  17993. 216: uint8(_BT_NMSTRT),
  17994. 217: uint8(_BT_NMSTRT),
  17995. 218: uint8(_BT_NMSTRT),
  17996. 219: uint8(_BT_NMSTRT),
  17997. 220: uint8(_BT_NMSTRT),
  17998. 221: uint8(_BT_NMSTRT),
  17999. 222: uint8(_BT_NMSTRT),
  18000. 223: uint8(_BT_NMSTRT),
  18001. 224: uint8(_BT_NMSTRT),
  18002. 225: uint8(_BT_NMSTRT),
  18003. 226: uint8(_BT_NMSTRT),
  18004. 227: uint8(_BT_NMSTRT),
  18005. 228: uint8(_BT_NMSTRT),
  18006. 229: uint8(_BT_NMSTRT),
  18007. 230: uint8(_BT_NMSTRT),
  18008. 231: uint8(_BT_NMSTRT),
  18009. 232: uint8(_BT_NMSTRT),
  18010. 233: uint8(_BT_NMSTRT),
  18011. 234: uint8(_BT_NMSTRT),
  18012. 235: uint8(_BT_NMSTRT),
  18013. 236: uint8(_BT_NMSTRT),
  18014. 237: uint8(_BT_NMSTRT),
  18015. 238: uint8(_BT_NMSTRT),
  18016. 239: uint8(_BT_NMSTRT),
  18017. 240: uint8(_BT_NMSTRT),
  18018. 241: uint8(_BT_NMSTRT),
  18019. 242: uint8(_BT_NMSTRT),
  18020. 243: uint8(_BT_NMSTRT),
  18021. 244: uint8(_BT_NMSTRT),
  18022. 245: uint8(_BT_NMSTRT),
  18023. 246: uint8(_BT_NMSTRT),
  18024. 247: uint8(_BT_OTHER),
  18025. 248: uint8(_BT_NMSTRT),
  18026. 249: uint8(_BT_NMSTRT),
  18027. 250: uint8(_BT_NMSTRT),
  18028. 251: uint8(_BT_NMSTRT),
  18029. 252: uint8(_BT_NMSTRT),
  18030. 253: uint8(_BT_NMSTRT),
  18031. 254: uint8(_BT_NMSTRT),
  18032. 255: uint8(_BT_NMSTRT),
  18033. },
  18034. }
  18035. func init() {
  18036. p := unsafe.Pointer(&_latin1_encoding)
  18037. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18038. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18039. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18040. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18041. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18042. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18043. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18044. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18045. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18046. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18047. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18048. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18049. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18050. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18051. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  18052. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18053. }
  18054. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18055. var v1, v2, v3, v4 uintptr
  18056. _, _, _, _ = v1, v2, v3, v4
  18057. _ = enc
  18058. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18059. v2 = toP
  18060. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18061. *(*uintptr)(unsafe.Pointer(v2))++
  18062. v4 = fromP
  18063. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18064. *(*uintptr)(unsafe.Pointer(v4))++
  18065. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  18066. }
  18067. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18068. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18069. } else {
  18070. return int32(_XML_CONVERT_COMPLETED)
  18071. }
  18072. return r
  18073. }
  18074. var _ascii_encoding_ns = Tnormal_encoding{
  18075. Fenc: TENCODING{
  18076. Fscanners: [4]TSCANNER{},
  18077. FliteralScanners: [2]TSCANNER{},
  18078. FminBytesPerChar: int32(1),
  18079. FisUtf8: uint8(1),
  18080. },
  18081. Ftype1: [256]uint8{
  18082. 9: uint8(_BT_S),
  18083. 10: uint8(_BT_LF),
  18084. 13: uint8(_BT_CR),
  18085. 32: uint8(_BT_S),
  18086. 33: uint8(_BT_EXCL),
  18087. 34: uint8(_BT_QUOT),
  18088. 35: uint8(_BT_NUM),
  18089. 36: uint8(_BT_OTHER),
  18090. 37: uint8(_BT_PERCNT),
  18091. 38: uint8(_BT_AMP),
  18092. 39: uint8(_BT_APOS),
  18093. 40: uint8(_BT_LPAR),
  18094. 41: uint8(_BT_RPAR),
  18095. 42: uint8(_BT_AST),
  18096. 43: uint8(_BT_PLUS),
  18097. 44: uint8(_BT_COMMA),
  18098. 45: uint8(_BT_MINUS),
  18099. 46: uint8(_BT_NAME),
  18100. 47: uint8(_BT_SOL),
  18101. 48: uint8(_BT_DIGIT),
  18102. 49: uint8(_BT_DIGIT),
  18103. 50: uint8(_BT_DIGIT),
  18104. 51: uint8(_BT_DIGIT),
  18105. 52: uint8(_BT_DIGIT),
  18106. 53: uint8(_BT_DIGIT),
  18107. 54: uint8(_BT_DIGIT),
  18108. 55: uint8(_BT_DIGIT),
  18109. 56: uint8(_BT_DIGIT),
  18110. 57: uint8(_BT_DIGIT),
  18111. 58: uint8(_BT_COLON),
  18112. 59: uint8(_BT_SEMI),
  18113. 60: uint8(_BT_LT),
  18114. 61: uint8(_BT_EQUALS),
  18115. 62: uint8(_BT_GT),
  18116. 63: uint8(_BT_QUEST),
  18117. 64: uint8(_BT_OTHER),
  18118. 65: uint8(_BT_HEX),
  18119. 66: uint8(_BT_HEX),
  18120. 67: uint8(_BT_HEX),
  18121. 68: uint8(_BT_HEX),
  18122. 69: uint8(_BT_HEX),
  18123. 70: uint8(_BT_HEX),
  18124. 71: uint8(_BT_NMSTRT),
  18125. 72: uint8(_BT_NMSTRT),
  18126. 73: uint8(_BT_NMSTRT),
  18127. 74: uint8(_BT_NMSTRT),
  18128. 75: uint8(_BT_NMSTRT),
  18129. 76: uint8(_BT_NMSTRT),
  18130. 77: uint8(_BT_NMSTRT),
  18131. 78: uint8(_BT_NMSTRT),
  18132. 79: uint8(_BT_NMSTRT),
  18133. 80: uint8(_BT_NMSTRT),
  18134. 81: uint8(_BT_NMSTRT),
  18135. 82: uint8(_BT_NMSTRT),
  18136. 83: uint8(_BT_NMSTRT),
  18137. 84: uint8(_BT_NMSTRT),
  18138. 85: uint8(_BT_NMSTRT),
  18139. 86: uint8(_BT_NMSTRT),
  18140. 87: uint8(_BT_NMSTRT),
  18141. 88: uint8(_BT_NMSTRT),
  18142. 89: uint8(_BT_NMSTRT),
  18143. 90: uint8(_BT_NMSTRT),
  18144. 91: uint8(_BT_LSQB),
  18145. 92: uint8(_BT_OTHER),
  18146. 93: uint8(_BT_RSQB),
  18147. 94: uint8(_BT_OTHER),
  18148. 95: uint8(_BT_NMSTRT),
  18149. 96: uint8(_BT_OTHER),
  18150. 97: uint8(_BT_HEX),
  18151. 98: uint8(_BT_HEX),
  18152. 99: uint8(_BT_HEX),
  18153. 100: uint8(_BT_HEX),
  18154. 101: uint8(_BT_HEX),
  18155. 102: uint8(_BT_HEX),
  18156. 103: uint8(_BT_NMSTRT),
  18157. 104: uint8(_BT_NMSTRT),
  18158. 105: uint8(_BT_NMSTRT),
  18159. 106: uint8(_BT_NMSTRT),
  18160. 107: uint8(_BT_NMSTRT),
  18161. 108: uint8(_BT_NMSTRT),
  18162. 109: uint8(_BT_NMSTRT),
  18163. 110: uint8(_BT_NMSTRT),
  18164. 111: uint8(_BT_NMSTRT),
  18165. 112: uint8(_BT_NMSTRT),
  18166. 113: uint8(_BT_NMSTRT),
  18167. 114: uint8(_BT_NMSTRT),
  18168. 115: uint8(_BT_NMSTRT),
  18169. 116: uint8(_BT_NMSTRT),
  18170. 117: uint8(_BT_NMSTRT),
  18171. 118: uint8(_BT_NMSTRT),
  18172. 119: uint8(_BT_NMSTRT),
  18173. 120: uint8(_BT_NMSTRT),
  18174. 121: uint8(_BT_NMSTRT),
  18175. 122: uint8(_BT_NMSTRT),
  18176. 123: uint8(_BT_OTHER),
  18177. 124: uint8(_BT_VERBAR),
  18178. 125: uint8(_BT_OTHER),
  18179. 126: uint8(_BT_OTHER),
  18180. 127: uint8(_BT_OTHER),
  18181. },
  18182. }
  18183. func init() {
  18184. p := unsafe.Pointer(&_ascii_encoding_ns)
  18185. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18186. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18187. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18188. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18189. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18190. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18191. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18192. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18193. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18194. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18195. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18196. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18197. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18198. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18199. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18200. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18201. }
  18202. var _ascii_encoding = Tnormal_encoding{
  18203. Fenc: TENCODING{
  18204. Fscanners: [4]TSCANNER{},
  18205. FliteralScanners: [2]TSCANNER{},
  18206. FminBytesPerChar: int32(1),
  18207. FisUtf8: uint8(1),
  18208. },
  18209. Ftype1: [256]uint8{
  18210. 9: uint8(_BT_S),
  18211. 10: uint8(_BT_LF),
  18212. 13: uint8(_BT_CR),
  18213. 32: uint8(_BT_S),
  18214. 33: uint8(_BT_EXCL),
  18215. 34: uint8(_BT_QUOT),
  18216. 35: uint8(_BT_NUM),
  18217. 36: uint8(_BT_OTHER),
  18218. 37: uint8(_BT_PERCNT),
  18219. 38: uint8(_BT_AMP),
  18220. 39: uint8(_BT_APOS),
  18221. 40: uint8(_BT_LPAR),
  18222. 41: uint8(_BT_RPAR),
  18223. 42: uint8(_BT_AST),
  18224. 43: uint8(_BT_PLUS),
  18225. 44: uint8(_BT_COMMA),
  18226. 45: uint8(_BT_MINUS),
  18227. 46: uint8(_BT_NAME),
  18228. 47: uint8(_BT_SOL),
  18229. 48: uint8(_BT_DIGIT),
  18230. 49: uint8(_BT_DIGIT),
  18231. 50: uint8(_BT_DIGIT),
  18232. 51: uint8(_BT_DIGIT),
  18233. 52: uint8(_BT_DIGIT),
  18234. 53: uint8(_BT_DIGIT),
  18235. 54: uint8(_BT_DIGIT),
  18236. 55: uint8(_BT_DIGIT),
  18237. 56: uint8(_BT_DIGIT),
  18238. 57: uint8(_BT_DIGIT),
  18239. 58: uint8(_BT_NMSTRT),
  18240. 59: uint8(_BT_SEMI),
  18241. 60: uint8(_BT_LT),
  18242. 61: uint8(_BT_EQUALS),
  18243. 62: uint8(_BT_GT),
  18244. 63: uint8(_BT_QUEST),
  18245. 64: uint8(_BT_OTHER),
  18246. 65: uint8(_BT_HEX),
  18247. 66: uint8(_BT_HEX),
  18248. 67: uint8(_BT_HEX),
  18249. 68: uint8(_BT_HEX),
  18250. 69: uint8(_BT_HEX),
  18251. 70: uint8(_BT_HEX),
  18252. 71: uint8(_BT_NMSTRT),
  18253. 72: uint8(_BT_NMSTRT),
  18254. 73: uint8(_BT_NMSTRT),
  18255. 74: uint8(_BT_NMSTRT),
  18256. 75: uint8(_BT_NMSTRT),
  18257. 76: uint8(_BT_NMSTRT),
  18258. 77: uint8(_BT_NMSTRT),
  18259. 78: uint8(_BT_NMSTRT),
  18260. 79: uint8(_BT_NMSTRT),
  18261. 80: uint8(_BT_NMSTRT),
  18262. 81: uint8(_BT_NMSTRT),
  18263. 82: uint8(_BT_NMSTRT),
  18264. 83: uint8(_BT_NMSTRT),
  18265. 84: uint8(_BT_NMSTRT),
  18266. 85: uint8(_BT_NMSTRT),
  18267. 86: uint8(_BT_NMSTRT),
  18268. 87: uint8(_BT_NMSTRT),
  18269. 88: uint8(_BT_NMSTRT),
  18270. 89: uint8(_BT_NMSTRT),
  18271. 90: uint8(_BT_NMSTRT),
  18272. 91: uint8(_BT_LSQB),
  18273. 92: uint8(_BT_OTHER),
  18274. 93: uint8(_BT_RSQB),
  18275. 94: uint8(_BT_OTHER),
  18276. 95: uint8(_BT_NMSTRT),
  18277. 96: uint8(_BT_OTHER),
  18278. 97: uint8(_BT_HEX),
  18279. 98: uint8(_BT_HEX),
  18280. 99: uint8(_BT_HEX),
  18281. 100: uint8(_BT_HEX),
  18282. 101: uint8(_BT_HEX),
  18283. 102: uint8(_BT_HEX),
  18284. 103: uint8(_BT_NMSTRT),
  18285. 104: uint8(_BT_NMSTRT),
  18286. 105: uint8(_BT_NMSTRT),
  18287. 106: uint8(_BT_NMSTRT),
  18288. 107: uint8(_BT_NMSTRT),
  18289. 108: uint8(_BT_NMSTRT),
  18290. 109: uint8(_BT_NMSTRT),
  18291. 110: uint8(_BT_NMSTRT),
  18292. 111: uint8(_BT_NMSTRT),
  18293. 112: uint8(_BT_NMSTRT),
  18294. 113: uint8(_BT_NMSTRT),
  18295. 114: uint8(_BT_NMSTRT),
  18296. 115: uint8(_BT_NMSTRT),
  18297. 116: uint8(_BT_NMSTRT),
  18298. 117: uint8(_BT_NMSTRT),
  18299. 118: uint8(_BT_NMSTRT),
  18300. 119: uint8(_BT_NMSTRT),
  18301. 120: uint8(_BT_NMSTRT),
  18302. 121: uint8(_BT_NMSTRT),
  18303. 122: uint8(_BT_NMSTRT),
  18304. 123: uint8(_BT_OTHER),
  18305. 124: uint8(_BT_VERBAR),
  18306. 125: uint8(_BT_OTHER),
  18307. 126: uint8(_BT_OTHER),
  18308. 127: uint8(_BT_OTHER),
  18309. },
  18310. }
  18311. func init() {
  18312. p := unsafe.Pointer(&_ascii_encoding)
  18313. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18314. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  18315. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  18316. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  18317. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  18318. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  18319. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  18320. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  18321. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  18322. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  18323. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  18324. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  18325. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  18326. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  18327. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  18328. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  18329. }
  18330. func _unicode_byte_type(tls *libc.TLS, hi uint8, lo uint8) (r int32) {
  18331. switch libc.Int32FromUint8(hi) {
  18332. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18333. case int32(0xD8):
  18334. fallthrough
  18335. case int32(0xD9):
  18336. fallthrough
  18337. case int32(0xDA):
  18338. fallthrough
  18339. case int32(0xDB):
  18340. return int32(_BT_LEAD4)
  18341. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18342. fallthrough
  18343. case int32(0xDC):
  18344. fallthrough
  18345. case int32(0xDD):
  18346. fallthrough
  18347. case int32(0xDE):
  18348. fallthrough
  18349. case int32(0xDF):
  18350. return int32(_BT_TRAIL)
  18351. case int32(0xFF):
  18352. switch libc.Int32FromUint8(lo) {
  18353. case int32(0xFF): /* noncharacter-FFFF */
  18354. fallthrough
  18355. case int32(0xFE): /* noncharacter-FFFE */
  18356. return int32(_BT_NONXML)
  18357. }
  18358. break
  18359. }
  18360. return int32(_BT_NONASCII)
  18361. }
  18362. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18363. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18364. var hi, lo, lo2 uint8
  18365. var plane int32
  18366. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18367. from = *(*uintptr)(unsafe.Pointer(fromP))
  18368. _ = enc
  18369. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18370. for {
  18371. if !(from < fromLim) {
  18372. break
  18373. }
  18374. lo = *(*uint8)(unsafe.Pointer(from))
  18375. hi = *(*uint8)(unsafe.Pointer(from + 1))
  18376. switch libc.Int32FromUint8(hi) {
  18377. case 0:
  18378. if libc.Int32FromUint8(lo) < int32(0x80) {
  18379. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18380. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18381. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18382. }
  18383. v3 = toP
  18384. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18385. *(*uintptr)(unsafe.Pointer(v3))++
  18386. *(*uint8)(unsafe.Pointer(v2)) = lo
  18387. break
  18388. } /* fall through */
  18389. fallthrough
  18390. case int32(0x1):
  18391. fallthrough
  18392. case int32(0x2):
  18393. fallthrough
  18394. case int32(0x3):
  18395. fallthrough
  18396. case int32(0x4):
  18397. fallthrough
  18398. case int32(0x5):
  18399. fallthrough
  18400. case int32(0x6):
  18401. fallthrough
  18402. case int32(0x7):
  18403. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18404. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18405. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18406. }
  18407. v5 = toP
  18408. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18409. *(*uintptr)(unsafe.Pointer(v5))++
  18410. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18411. v7 = toP
  18412. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18413. *(*uintptr)(unsafe.Pointer(v7))++
  18414. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18415. default:
  18416. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18417. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18418. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18419. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18420. v9 = toP
  18421. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18422. *(*uintptr)(unsafe.Pointer(v9))++
  18423. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18424. v11 = toP
  18425. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18426. *(*uintptr)(unsafe.Pointer(v11))++
  18427. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18428. v13 = toP
  18429. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18430. *(*uintptr)(unsafe.Pointer(v13))++
  18431. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18432. case int32(0xD8):
  18433. fallthrough
  18434. case int32(0xD9):
  18435. fallthrough
  18436. case int32(0xDA):
  18437. fallthrough
  18438. case int32(0xDB):
  18439. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18440. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18441. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18442. }
  18443. if int64(fromLim)-int64(from) < int64(4) {
  18444. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18445. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18446. }
  18447. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18448. v15 = toP
  18449. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18450. *(*uintptr)(unsafe.Pointer(v15))++
  18451. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18452. v17 = toP
  18453. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18454. *(*uintptr)(unsafe.Pointer(v17))++
  18455. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18456. from += uintptr(2)
  18457. lo2 = *(*uint8)(unsafe.Pointer(from))
  18458. v19 = toP
  18459. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18460. *(*uintptr)(unsafe.Pointer(v19))++
  18461. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18462. v21 = toP
  18463. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18464. *(*uintptr)(unsafe.Pointer(v21))++
  18465. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18466. break
  18467. }
  18468. goto _1
  18469. _1:
  18470. ;
  18471. from += uintptr(2)
  18472. }
  18473. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18474. if from < fromLim {
  18475. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18476. } else {
  18477. return int32(_XML_CONVERT_COMPLETED)
  18478. }
  18479. return r
  18480. }
  18481. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18482. var res _XML_Convert_Result
  18483. var v2, v3 uintptr
  18484. _, _, _ = res, v2, v3
  18485. res = int32(_XML_CONVERT_COMPLETED)
  18486. _ = enc
  18487. 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 */
  18488. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1)))&int32(0xF8) == int32(0xD8) {
  18489. fromLim -= uintptr(2)
  18490. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18491. }
  18492. for {
  18493. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18494. break
  18495. }
  18496. v3 = toP
  18497. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18498. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18499. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))
  18500. goto _1
  18501. _1:
  18502. ;
  18503. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18504. }
  18505. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18506. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18507. } else {
  18508. return res
  18509. }
  18510. return r
  18511. }
  18512. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18513. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18514. var hi, lo, lo2 uint8
  18515. var plane int32
  18516. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18517. from = *(*uintptr)(unsafe.Pointer(fromP))
  18518. _ = enc
  18519. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18520. for {
  18521. if !(from < fromLim) {
  18522. break
  18523. }
  18524. lo = *(*uint8)(unsafe.Pointer(from + 1))
  18525. hi = *(*uint8)(unsafe.Pointer(from))
  18526. switch libc.Int32FromUint8(hi) {
  18527. case 0:
  18528. if libc.Int32FromUint8(lo) < int32(0x80) {
  18529. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18530. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18531. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18532. }
  18533. v3 = toP
  18534. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18535. *(*uintptr)(unsafe.Pointer(v3))++
  18536. *(*uint8)(unsafe.Pointer(v2)) = lo
  18537. break
  18538. } /* fall through */
  18539. fallthrough
  18540. case int32(0x1):
  18541. fallthrough
  18542. case int32(0x2):
  18543. fallthrough
  18544. case int32(0x3):
  18545. fallthrough
  18546. case int32(0x4):
  18547. fallthrough
  18548. case int32(0x5):
  18549. fallthrough
  18550. case int32(0x6):
  18551. fallthrough
  18552. case int32(0x7):
  18553. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  18554. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18555. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18556. }
  18557. v5 = toP
  18558. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18559. *(*uintptr)(unsafe.Pointer(v5))++
  18560. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18561. v7 = toP
  18562. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18563. *(*uintptr)(unsafe.Pointer(v7))++
  18564. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18565. default:
  18566. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  18567. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18568. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18569. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18570. v9 = toP
  18571. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18572. *(*uintptr)(unsafe.Pointer(v9))++
  18573. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18574. v11 = toP
  18575. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18576. *(*uintptr)(unsafe.Pointer(v11))++
  18577. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18578. v13 = toP
  18579. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18580. *(*uintptr)(unsafe.Pointer(v13))++
  18581. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18582. case int32(0xD8):
  18583. fallthrough
  18584. case int32(0xD9):
  18585. fallthrough
  18586. case int32(0xDA):
  18587. fallthrough
  18588. case int32(0xDB):
  18589. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  18590. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18591. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18592. }
  18593. if int64(fromLim)-int64(from) < int64(4) {
  18594. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18595. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18596. }
  18597. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18598. v15 = toP
  18599. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18600. *(*uintptr)(unsafe.Pointer(v15))++
  18601. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18602. v17 = toP
  18603. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18604. *(*uintptr)(unsafe.Pointer(v17))++
  18605. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18606. from += uintptr(2)
  18607. lo2 = *(*uint8)(unsafe.Pointer(from + 1))
  18608. v19 = toP
  18609. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18610. *(*uintptr)(unsafe.Pointer(v19))++
  18611. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18612. v21 = toP
  18613. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18614. *(*uintptr)(unsafe.Pointer(v21))++
  18615. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18616. break
  18617. }
  18618. goto _1
  18619. _1:
  18620. ;
  18621. from += uintptr(2)
  18622. }
  18623. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18624. if from < fromLim {
  18625. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18626. } else {
  18627. return int32(_XML_CONVERT_COMPLETED)
  18628. }
  18629. return r
  18630. }
  18631. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18632. var res _XML_Convert_Result
  18633. var v2, v3 uintptr
  18634. _, _, _ = res, v2, v3
  18635. res = int32(_XML_CONVERT_COMPLETED)
  18636. _ = enc
  18637. 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 */
  18638. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2))))&int32(0xF8) == int32(0xD8) {
  18639. fromLim -= uintptr(2)
  18640. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18641. }
  18642. for {
  18643. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18644. break
  18645. }
  18646. v3 = toP
  18647. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18648. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18649. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))
  18650. goto _1
  18651. _1:
  18652. ;
  18653. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18654. }
  18655. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18656. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18657. } else {
  18658. return res
  18659. }
  18660. return r
  18661. }
  18662. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18663. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18664. __ __ _
  18665. ___\ \/ /_ __ __ _| |_
  18666. / _ \\ /| '_ \ / _` | __|
  18667. | __// \| |_) | (_| | |_
  18668. \___/_/\_\ .__/ \__,_|\__|
  18669. |_| XML parser
  18670. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18671. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18672. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18673. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18674. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18675. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18676. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18677. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18678. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18679. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18680. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18681. Licensed under the MIT license:
  18682. Permission is hereby granted, free of charge, to any person obtaining
  18683. a copy of this software and associated documentation files (the
  18684. "Software"), to deal in the Software without restriction, including
  18685. without limitation the rights to use, copy, modify, merge, publish,
  18686. distribute, sublicense, and/or sell copies of the Software, and to permit
  18687. persons to whom the Software is furnished to do so, subject to the
  18688. following conditions:
  18689. The above copyright notice and this permission notice shall be included
  18690. in all copies or substantial portions of the Software.
  18691. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18692. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18693. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18694. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18695. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18696. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18697. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18698. */
  18699. /* ptr points to character following "<!-" */
  18700. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18701. var v1 int32
  18702. _ = v1
  18703. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18704. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18705. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18706. return m_XML_TOK_INVALID
  18707. }
  18708. ptr += uintptr(2)
  18709. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18710. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18711. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18712. } else {
  18713. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18714. }
  18715. switch v1 {
  18716. case int32(_BT_LEAD2):
  18717. if int64(end)-int64(ptr) < int64(2) {
  18718. return -int32(2)
  18719. }
  18720. if 0 != 0 {
  18721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18722. return m_XML_TOK_INVALID
  18723. }
  18724. ptr += uintptr(2)
  18725. case int32(_BT_LEAD3):
  18726. if int64(end)-int64(ptr) < int64(3) {
  18727. return -int32(2)
  18728. }
  18729. if 0 != 0 {
  18730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18731. return m_XML_TOK_INVALID
  18732. }
  18733. ptr += uintptr(3)
  18734. case int32(_BT_LEAD4):
  18735. if int64(end)-int64(ptr) < int64(4) {
  18736. return -int32(2)
  18737. }
  18738. if 0 != 0 {
  18739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18740. return m_XML_TOK_INVALID
  18741. }
  18742. ptr += uintptr(4)
  18743. case int32(_BT_NONXML):
  18744. fallthrough
  18745. case int32(_BT_MALFORM):
  18746. fallthrough
  18747. case int32(_BT_TRAIL):
  18748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18749. return m_XML_TOK_INVALID
  18750. case int32(_BT_MINUS):
  18751. ptr += uintptr(2)
  18752. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18753. return -int32(1)
  18754. }
  18755. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  18756. ptr += uintptr(2)
  18757. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18758. return -int32(1)
  18759. }
  18760. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  18761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18762. return m_XML_TOK_INVALID
  18763. }
  18764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18765. return int32(m_XML_TOK_COMMENT)
  18766. }
  18767. default:
  18768. ptr += uintptr(2)
  18769. break
  18770. }
  18771. }
  18772. }
  18773. return -int32(1)
  18774. }
  18775. /* ptr points to character following "<!" */
  18776. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18777. var v1, v2, v3 int32
  18778. _, _, _ = v1, v2, v3
  18779. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18780. return -int32(1)
  18781. }
  18782. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18783. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18784. } else {
  18785. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18786. }
  18787. switch v1 {
  18788. case int32(_BT_MINUS):
  18789. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18790. case int32(_BT_LSQB):
  18791. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18792. return int32(m_XML_TOK_COND_SECT_OPEN)
  18793. case int32(_BT_NMSTRT):
  18794. fallthrough
  18795. case int32(_BT_HEX):
  18796. ptr += uintptr(2)
  18797. default:
  18798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18799. return m_XML_TOK_INVALID
  18800. }
  18801. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18802. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18803. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18804. } else {
  18805. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18806. }
  18807. switch v2 {
  18808. case int32(_BT_PERCNT):
  18809. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  18810. return -int32(1)
  18811. }
  18812. /* don't allow <!ENTITY% foo "whatever"> */
  18813. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  18814. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  18815. } else {
  18816. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  18817. }
  18818. switch v3 {
  18819. case int32(_BT_S):
  18820. fallthrough
  18821. case int32(_BT_CR):
  18822. fallthrough
  18823. case int32(_BT_LF):
  18824. fallthrough
  18825. case int32(_BT_PERCNT):
  18826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18827. return m_XML_TOK_INVALID
  18828. }
  18829. /* fall through */
  18830. fallthrough
  18831. case int32(_BT_S):
  18832. fallthrough
  18833. case int32(_BT_CR):
  18834. fallthrough
  18835. case int32(_BT_LF):
  18836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18837. return int32(m_XML_TOK_DECL_OPEN)
  18838. case int32(_BT_NMSTRT):
  18839. fallthrough
  18840. case int32(_BT_HEX):
  18841. ptr += uintptr(2)
  18842. default:
  18843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18844. return m_XML_TOK_INVALID
  18845. }
  18846. }
  18847. return -int32(1)
  18848. }
  18849. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  18850. var upper, v1, v2, v3 int32
  18851. _, _, _, _ = upper, v1, v2, v3
  18852. upper = 0
  18853. _ = enc
  18854. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  18855. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  18856. return int32(1)
  18857. }
  18858. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18859. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18860. } else {
  18861. v1 = -int32(1)
  18862. }
  18863. switch v1 {
  18864. case int32(m_ASCII_x2):
  18865. case int32(m_ASCII_X):
  18866. upper = int32(1)
  18867. default:
  18868. return int32(1)
  18869. }
  18870. ptr += uintptr(2)
  18871. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18872. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18873. } else {
  18874. v2 = -int32(1)
  18875. }
  18876. switch v2 {
  18877. case int32(m_ASCII_m2):
  18878. case int32(m_ASCII_M):
  18879. upper = int32(1)
  18880. default:
  18881. return int32(1)
  18882. }
  18883. ptr += uintptr(2)
  18884. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18885. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  18886. } else {
  18887. v3 = -int32(1)
  18888. }
  18889. switch v3 {
  18890. case int32(m_ASCII_l2):
  18891. case int32(m_ASCII_L):
  18892. upper = int32(1)
  18893. default:
  18894. return int32(1)
  18895. }
  18896. if upper != 0 {
  18897. return 0
  18898. }
  18899. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  18900. return int32(1)
  18901. }
  18902. /* ptr points to character following "<?" */
  18903. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18904. bp := tls.Alloc(16)
  18905. defer tls.Free(16)
  18906. var target uintptr
  18907. var v1, v2, v3 int32
  18908. var _ /* tok at bp+0 */ int32
  18909. _, _, _, _ = target, v1, v2, v3
  18910. target = ptr
  18911. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18912. return -int32(1)
  18913. }
  18914. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18915. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18916. } else {
  18917. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18918. }
  18919. switch v1 {
  18920. case int32(_BT_NONASCII):
  18921. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18923. return m_XML_TOK_INVALID
  18924. } /* fall through */
  18925. fallthrough
  18926. case int32(_BT_NMSTRT):
  18927. fallthrough
  18928. case int32(_BT_HEX):
  18929. ptr += uintptr(2)
  18930. case int32(_BT_LEAD2):
  18931. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  18932. return -int32(2)
  18933. }
  18934. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18936. return m_XML_TOK_INVALID
  18937. }
  18938. ptr += uintptr(2)
  18939. case int32(_BT_LEAD3):
  18940. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  18941. return -int32(2)
  18942. }
  18943. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18944. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18945. return m_XML_TOK_INVALID
  18946. }
  18947. ptr += uintptr(3)
  18948. case int32(_BT_LEAD4):
  18949. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  18950. return -int32(2)
  18951. }
  18952. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18954. return m_XML_TOK_INVALID
  18955. }
  18956. ptr += uintptr(4)
  18957. default:
  18958. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18959. return m_XML_TOK_INVALID
  18960. }
  18961. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18962. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18963. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18964. } else {
  18965. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18966. }
  18967. switch v2 {
  18968. case int32(_BT_NONASCII):
  18969. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18970. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18971. return m_XML_TOK_INVALID
  18972. } /* fall through */
  18973. fallthrough
  18974. case int32(_BT_NMSTRT):
  18975. fallthrough
  18976. case int32(_BT_HEX):
  18977. fallthrough
  18978. case int32(_BT_DIGIT):
  18979. fallthrough
  18980. case int32(_BT_NAME):
  18981. fallthrough
  18982. case int32(_BT_MINUS):
  18983. ptr += uintptr(2)
  18984. case int32(_BT_LEAD2):
  18985. if int64(end)-int64(ptr) < int64(2) {
  18986. return -int32(2)
  18987. }
  18988. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18989. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18990. return m_XML_TOK_INVALID
  18991. }
  18992. ptr += uintptr(2)
  18993. case int32(_BT_LEAD3):
  18994. if int64(end)-int64(ptr) < int64(3) {
  18995. return -int32(2)
  18996. }
  18997. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18999. return m_XML_TOK_INVALID
  19000. }
  19001. ptr += uintptr(3)
  19002. case int32(_BT_LEAD4):
  19003. if int64(end)-int64(ptr) < int64(4) {
  19004. return -int32(2)
  19005. }
  19006. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19007. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19008. return m_XML_TOK_INVALID
  19009. }
  19010. ptr += uintptr(4)
  19011. case int32(_BT_S):
  19012. fallthrough
  19013. case int32(_BT_CR):
  19014. fallthrough
  19015. case int32(_BT_LF):
  19016. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19018. return m_XML_TOK_INVALID
  19019. }
  19020. ptr += uintptr(2)
  19021. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19022. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19023. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19024. } else {
  19025. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19026. }
  19027. switch v3 {
  19028. case int32(_BT_LEAD2):
  19029. if int64(end)-int64(ptr) < int64(2) {
  19030. return -int32(2)
  19031. }
  19032. if 0 != 0 {
  19033. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19034. return m_XML_TOK_INVALID
  19035. }
  19036. ptr += uintptr(2)
  19037. case int32(_BT_LEAD3):
  19038. if int64(end)-int64(ptr) < int64(3) {
  19039. return -int32(2)
  19040. }
  19041. if 0 != 0 {
  19042. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19043. return m_XML_TOK_INVALID
  19044. }
  19045. ptr += uintptr(3)
  19046. case int32(_BT_LEAD4):
  19047. if int64(end)-int64(ptr) < int64(4) {
  19048. return -int32(2)
  19049. }
  19050. if 0 != 0 {
  19051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19052. return m_XML_TOK_INVALID
  19053. }
  19054. ptr += uintptr(4)
  19055. case int32(_BT_NONXML):
  19056. fallthrough
  19057. case int32(_BT_MALFORM):
  19058. fallthrough
  19059. case int32(_BT_TRAIL):
  19060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19061. return m_XML_TOK_INVALID
  19062. case int32(_BT_QUEST):
  19063. ptr += uintptr(2)
  19064. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19065. return -int32(1)
  19066. }
  19067. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19069. return *(*int32)(unsafe.Pointer(bp))
  19070. }
  19071. default:
  19072. ptr += uintptr(2)
  19073. break
  19074. }
  19075. }
  19076. return -int32(1)
  19077. case int32(_BT_QUEST):
  19078. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19080. return m_XML_TOK_INVALID
  19081. }
  19082. ptr += uintptr(2)
  19083. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19084. return -int32(1)
  19085. }
  19086. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19087. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19088. return *(*int32)(unsafe.Pointer(bp))
  19089. }
  19090. /* fall through */
  19091. fallthrough
  19092. default:
  19093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19094. return m_XML_TOK_INVALID
  19095. }
  19096. }
  19097. return -int32(1)
  19098. }
  19099. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19100. var i int32
  19101. _ = i
  19102. _ = enc
  19103. /* CDATA[ */
  19104. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  19105. return -int32(1)
  19106. }
  19107. i = 0
  19108. for {
  19109. if !(i < int32(6)) {
  19110. break
  19111. }
  19112. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB1[i])) {
  19113. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19114. return m_XML_TOK_INVALID
  19115. }
  19116. goto _1
  19117. _1:
  19118. ;
  19119. i++
  19120. ptr += uintptr(2)
  19121. }
  19122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19123. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19124. }
  19125. var _CDATA_LSQB1 = [6]uint8{
  19126. 0: uint8(m_ASCII_C),
  19127. 1: uint8(m_ASCII_D),
  19128. 2: uint8(m_ASCII_A),
  19129. 3: uint8(m_ASCII_T),
  19130. 4: uint8(m_ASCII_A),
  19131. 5: uint8(m_ASCII_LSQB1),
  19132. }
  19133. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19134. var n Tsize_t
  19135. var v1, v2, v3 int32
  19136. _, _, _, _ = n, v1, v2, v3
  19137. if ptr >= end {
  19138. return -int32(4)
  19139. }
  19140. if int32(2) > int32(1) {
  19141. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19142. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19143. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19144. if n == uint64(0) {
  19145. return -int32(1)
  19146. }
  19147. end = ptr + uintptr(n)
  19148. }
  19149. }
  19150. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19151. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19152. } else {
  19153. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19154. }
  19155. switch v1 {
  19156. case int32(_BT_RSQB):
  19157. ptr += uintptr(2)
  19158. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19159. return -int32(1)
  19160. }
  19161. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19162. break
  19163. }
  19164. ptr += uintptr(2)
  19165. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19166. return -int32(1)
  19167. }
  19168. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19169. ptr -= uintptr(2)
  19170. break
  19171. }
  19172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19173. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19174. case int32(_BT_CR):
  19175. ptr += uintptr(2)
  19176. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19177. return -int32(1)
  19178. }
  19179. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19180. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19181. } else {
  19182. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19183. }
  19184. if v2 == int32(_BT_LF) {
  19185. ptr += uintptr(2)
  19186. }
  19187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19188. return int32(m_XML_TOK_DATA_NEWLINE)
  19189. case int32(_BT_LF):
  19190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19191. return int32(m_XML_TOK_DATA_NEWLINE)
  19192. case int32(_BT_LEAD2):
  19193. if int64(end)-int64(ptr) < int64(2) {
  19194. return -int32(2)
  19195. }
  19196. if 0 != 0 {
  19197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19198. return m_XML_TOK_INVALID
  19199. }
  19200. ptr += uintptr(2)
  19201. case int32(_BT_LEAD3):
  19202. if int64(end)-int64(ptr) < int64(3) {
  19203. return -int32(2)
  19204. }
  19205. if 0 != 0 {
  19206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19207. return m_XML_TOK_INVALID
  19208. }
  19209. ptr += uintptr(3)
  19210. case int32(_BT_LEAD4):
  19211. if int64(end)-int64(ptr) < int64(4) {
  19212. return -int32(2)
  19213. }
  19214. if 0 != 0 {
  19215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19216. return m_XML_TOK_INVALID
  19217. }
  19218. ptr += uintptr(4)
  19219. case int32(_BT_NONXML):
  19220. fallthrough
  19221. case int32(_BT_MALFORM):
  19222. fallthrough
  19223. case int32(_BT_TRAIL):
  19224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19225. return m_XML_TOK_INVALID
  19226. default:
  19227. ptr += uintptr(2)
  19228. break
  19229. }
  19230. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19231. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19232. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19233. } else {
  19234. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19235. }
  19236. switch v3 {
  19237. case int32(_BT_LEAD2):
  19238. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  19239. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19240. return int32(m_XML_TOK_DATA_CHARS)
  19241. }
  19242. ptr += uintptr(2)
  19243. case int32(_BT_LEAD3):
  19244. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  19245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19246. return int32(m_XML_TOK_DATA_CHARS)
  19247. }
  19248. ptr += uintptr(3)
  19249. case int32(_BT_LEAD4):
  19250. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  19251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19252. return int32(m_XML_TOK_DATA_CHARS)
  19253. }
  19254. ptr += uintptr(4)
  19255. case int32(_BT_NONXML):
  19256. fallthrough
  19257. case int32(_BT_MALFORM):
  19258. fallthrough
  19259. case int32(_BT_TRAIL):
  19260. fallthrough
  19261. case int32(_BT_CR):
  19262. fallthrough
  19263. case int32(_BT_LF):
  19264. fallthrough
  19265. case int32(_BT_RSQB):
  19266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19267. return int32(m_XML_TOK_DATA_CHARS)
  19268. default:
  19269. ptr += uintptr(2)
  19270. break
  19271. }
  19272. }
  19273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19274. return int32(m_XML_TOK_DATA_CHARS)
  19275. }
  19276. /* ptr points to character following "</" */
  19277. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19278. var v1, v2, v22 int32
  19279. _, _, _ = v1, v2, v22
  19280. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19281. return -int32(1)
  19282. }
  19283. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19284. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19285. } else {
  19286. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19287. }
  19288. switch v1 {
  19289. case int32(_BT_NONASCII):
  19290. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19291. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19292. return m_XML_TOK_INVALID
  19293. } /* fall through */
  19294. fallthrough
  19295. case int32(_BT_NMSTRT):
  19296. fallthrough
  19297. case int32(_BT_HEX):
  19298. ptr += uintptr(2)
  19299. case int32(_BT_LEAD2):
  19300. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19301. return -int32(2)
  19302. }
  19303. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19305. return m_XML_TOK_INVALID
  19306. }
  19307. ptr += uintptr(2)
  19308. case int32(_BT_LEAD3):
  19309. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19310. return -int32(2)
  19311. }
  19312. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19313. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19314. return m_XML_TOK_INVALID
  19315. }
  19316. ptr += uintptr(3)
  19317. case int32(_BT_LEAD4):
  19318. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19319. return -int32(2)
  19320. }
  19321. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19322. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19323. return m_XML_TOK_INVALID
  19324. }
  19325. ptr += uintptr(4)
  19326. default:
  19327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19328. return m_XML_TOK_INVALID
  19329. }
  19330. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19331. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19332. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19333. } else {
  19334. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19335. }
  19336. switch v2 {
  19337. case int32(_BT_NONASCII):
  19338. goto _3
  19339. case int32(_BT_MINUS):
  19340. goto _4
  19341. case int32(_BT_NAME):
  19342. goto _5
  19343. case int32(_BT_DIGIT):
  19344. goto _6
  19345. case int32(_BT_HEX):
  19346. goto _7
  19347. case int32(_BT_NMSTRT):
  19348. goto _8
  19349. case int32(_BT_LEAD2):
  19350. goto _9
  19351. case int32(_BT_LEAD3):
  19352. goto _10
  19353. case int32(_BT_LEAD4):
  19354. goto _11
  19355. case int32(_BT_LF):
  19356. goto _12
  19357. case int32(_BT_CR):
  19358. goto _13
  19359. case int32(_BT_S):
  19360. goto _14
  19361. case int32(_BT_COLON):
  19362. goto _15
  19363. case int32(_BT_GT):
  19364. goto _16
  19365. default:
  19366. goto _17
  19367. }
  19368. goto _18
  19369. _3:
  19370. ;
  19371. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19373. return m_XML_TOK_INVALID
  19374. } /* fall through */
  19375. _8:
  19376. ;
  19377. _7:
  19378. ;
  19379. _6:
  19380. ;
  19381. _5:
  19382. ;
  19383. _4:
  19384. ;
  19385. ptr += uintptr(2)
  19386. goto _18
  19387. _9:
  19388. ;
  19389. if int64(end)-int64(ptr) < int64(2) {
  19390. return -int32(2)
  19391. }
  19392. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19394. return m_XML_TOK_INVALID
  19395. }
  19396. ptr += uintptr(2)
  19397. goto _18
  19398. _10:
  19399. ;
  19400. if int64(end)-int64(ptr) < int64(3) {
  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(3)
  19408. goto _18
  19409. _11:
  19410. ;
  19411. if int64(end)-int64(ptr) < int64(4) {
  19412. return -int32(2)
  19413. }
  19414. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19415. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19416. return m_XML_TOK_INVALID
  19417. }
  19418. ptr += uintptr(4)
  19419. goto _18
  19420. _14:
  19421. ;
  19422. _13:
  19423. ;
  19424. _12:
  19425. ;
  19426. ptr += uintptr(2)
  19427. _21:
  19428. ;
  19429. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19430. goto _19
  19431. }
  19432. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19433. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19434. } else {
  19435. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19436. }
  19437. switch v22 {
  19438. case int32(_BT_S):
  19439. fallthrough
  19440. case int32(_BT_CR):
  19441. fallthrough
  19442. case int32(_BT_LF):
  19443. case int32(_BT_GT):
  19444. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19445. return int32(m_XML_TOK_END_TAG)
  19446. default:
  19447. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19448. return m_XML_TOK_INVALID
  19449. }
  19450. goto _20
  19451. _20:
  19452. ;
  19453. ptr += uintptr(2)
  19454. goto _21
  19455. goto _19
  19456. _19:
  19457. ;
  19458. return -int32(1)
  19459. _15:
  19460. ;
  19461. /* no need to check qname syntax here,
  19462. since end-tag must match exactly */
  19463. ptr += uintptr(2)
  19464. goto _18
  19465. _16:
  19466. ;
  19467. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19468. return int32(m_XML_TOK_END_TAG)
  19469. _17:
  19470. ;
  19471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19472. return m_XML_TOK_INVALID
  19473. _18:
  19474. }
  19475. return -int32(1)
  19476. }
  19477. /* ptr points to character following "&#X" */
  19478. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19479. var v1, v3 int32
  19480. _, _ = v1, v3
  19481. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19482. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19483. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19484. } else {
  19485. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19486. }
  19487. switch v1 {
  19488. case int32(_BT_DIGIT):
  19489. fallthrough
  19490. case int32(_BT_HEX):
  19491. default:
  19492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19493. return m_XML_TOK_INVALID
  19494. }
  19495. ptr += uintptr(2)
  19496. for {
  19497. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19498. break
  19499. }
  19500. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19501. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19502. } else {
  19503. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19504. }
  19505. switch v3 {
  19506. case int32(_BT_DIGIT):
  19507. fallthrough
  19508. case int32(_BT_HEX):
  19509. case int32(_BT_SEMI):
  19510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19511. return int32(m_XML_TOK_CHAR_REF)
  19512. default:
  19513. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19514. return m_XML_TOK_INVALID
  19515. }
  19516. goto _2
  19517. _2:
  19518. ;
  19519. ptr += uintptr(2)
  19520. }
  19521. }
  19522. return -int32(1)
  19523. }
  19524. /* ptr points to character following "&#" */
  19525. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19526. var v1, v3 int32
  19527. _, _ = v1, v3
  19528. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19529. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19530. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19531. }
  19532. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19533. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19534. } else {
  19535. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19536. }
  19537. switch v1 {
  19538. case int32(_BT_DIGIT):
  19539. default:
  19540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19541. return m_XML_TOK_INVALID
  19542. }
  19543. ptr += uintptr(2)
  19544. for {
  19545. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19546. break
  19547. }
  19548. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19549. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19550. } else {
  19551. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19552. }
  19553. switch v3 {
  19554. case int32(_BT_DIGIT):
  19555. case int32(_BT_SEMI):
  19556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19557. return int32(m_XML_TOK_CHAR_REF)
  19558. default:
  19559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19560. return m_XML_TOK_INVALID
  19561. }
  19562. goto _2
  19563. _2:
  19564. ;
  19565. ptr += uintptr(2)
  19566. }
  19567. }
  19568. return -int32(1)
  19569. }
  19570. /* ptr points to character following "&" */
  19571. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19572. var v1, v2 int32
  19573. _, _ = v1, v2
  19574. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19575. return -int32(1)
  19576. }
  19577. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19578. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19579. } else {
  19580. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19581. }
  19582. switch v1 {
  19583. case int32(_BT_NONASCII):
  19584. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19585. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19586. return m_XML_TOK_INVALID
  19587. } /* fall through */
  19588. fallthrough
  19589. case int32(_BT_NMSTRT):
  19590. fallthrough
  19591. case int32(_BT_HEX):
  19592. ptr += uintptr(2)
  19593. case int32(_BT_LEAD2):
  19594. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  19595. return -int32(2)
  19596. }
  19597. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19598. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19599. return m_XML_TOK_INVALID
  19600. }
  19601. ptr += uintptr(2)
  19602. case int32(_BT_LEAD3):
  19603. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  19604. return -int32(2)
  19605. }
  19606. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19608. return m_XML_TOK_INVALID
  19609. }
  19610. ptr += uintptr(3)
  19611. case int32(_BT_LEAD4):
  19612. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  19613. return -int32(2)
  19614. }
  19615. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19617. return m_XML_TOK_INVALID
  19618. }
  19619. ptr += uintptr(4)
  19620. case int32(_BT_NUM):
  19621. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19622. default:
  19623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19624. return m_XML_TOK_INVALID
  19625. }
  19626. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19627. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19628. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19629. } else {
  19630. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19631. }
  19632. switch v2 {
  19633. case int32(_BT_NONASCII):
  19634. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  19635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19636. return m_XML_TOK_INVALID
  19637. } /* fall through */
  19638. fallthrough
  19639. case int32(_BT_NMSTRT):
  19640. fallthrough
  19641. case int32(_BT_HEX):
  19642. fallthrough
  19643. case int32(_BT_DIGIT):
  19644. fallthrough
  19645. case int32(_BT_NAME):
  19646. fallthrough
  19647. case int32(_BT_MINUS):
  19648. ptr += uintptr(2)
  19649. case int32(_BT_LEAD2):
  19650. if int64(end)-int64(ptr) < int64(2) {
  19651. return -int32(2)
  19652. }
  19653. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19654. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19655. return m_XML_TOK_INVALID
  19656. }
  19657. ptr += uintptr(2)
  19658. case int32(_BT_LEAD3):
  19659. if int64(end)-int64(ptr) < int64(3) {
  19660. return -int32(2)
  19661. }
  19662. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19663. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19664. return m_XML_TOK_INVALID
  19665. }
  19666. ptr += uintptr(3)
  19667. case int32(_BT_LEAD4):
  19668. if int64(end)-int64(ptr) < int64(4) {
  19669. return -int32(2)
  19670. }
  19671. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19672. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19673. return m_XML_TOK_INVALID
  19674. }
  19675. ptr += uintptr(4)
  19676. case int32(_BT_SEMI):
  19677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19678. return int32(m_XML_TOK_ENTITY_REF)
  19679. default:
  19680. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19681. return m_XML_TOK_INVALID
  19682. }
  19683. }
  19684. return -int32(1)
  19685. }
  19686. /* ptr points to character following first character of attribute name */
  19687. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19688. bp := tls.Alloc(16)
  19689. defer tls.Free(16)
  19690. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19691. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19692. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19693. hadColon = 0
  19694. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19695. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19696. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19697. } else {
  19698. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19699. }
  19700. switch v1 {
  19701. case int32(_BT_NONASCII):
  19702. goto _2
  19703. case int32(_BT_MINUS):
  19704. goto _3
  19705. case int32(_BT_NAME):
  19706. goto _4
  19707. case int32(_BT_DIGIT):
  19708. goto _5
  19709. case int32(_BT_HEX):
  19710. goto _6
  19711. case int32(_BT_NMSTRT):
  19712. goto _7
  19713. case int32(_BT_LEAD2):
  19714. goto _8
  19715. case int32(_BT_LEAD3):
  19716. goto _9
  19717. case int32(_BT_LEAD4):
  19718. goto _10
  19719. case int32(_BT_COLON):
  19720. goto _11
  19721. case int32(_BT_LF):
  19722. goto _12
  19723. case int32(_BT_CR):
  19724. goto _13
  19725. case int32(_BT_S):
  19726. goto _14
  19727. case int32(_BT_EQUALS):
  19728. goto _15
  19729. default:
  19730. goto _16
  19731. }
  19732. goto _17
  19733. _2:
  19734. ;
  19735. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  19736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19737. return m_XML_TOK_INVALID
  19738. } /* fall through */
  19739. _7:
  19740. ;
  19741. _6:
  19742. ;
  19743. _5:
  19744. ;
  19745. _4:
  19746. ;
  19747. _3:
  19748. ;
  19749. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19750. goto _17
  19751. _8:
  19752. ;
  19753. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19754. return -int32(2)
  19755. }
  19756. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19757. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19758. return m_XML_TOK_INVALID
  19759. }
  19760. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19761. goto _17
  19762. _9:
  19763. ;
  19764. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19765. return -int32(2)
  19766. }
  19767. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19769. return m_XML_TOK_INVALID
  19770. }
  19771. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19772. goto _17
  19773. _10:
  19774. ;
  19775. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19776. return -int32(2)
  19777. }
  19778. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19779. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19780. return m_XML_TOK_INVALID
  19781. }
  19782. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19783. goto _17
  19784. _11:
  19785. ;
  19786. if hadColon != 0 {
  19787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19788. return m_XML_TOK_INVALID
  19789. }
  19790. hadColon = int32(1)
  19791. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19792. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19793. return -int32(1)
  19794. }
  19795. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19796. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19797. } else {
  19798. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19799. }
  19800. switch v18 {
  19801. case int32(_BT_NONASCII):
  19802. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  19803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19804. return m_XML_TOK_INVALID
  19805. } /* fall through */
  19806. fallthrough
  19807. case int32(_BT_NMSTRT):
  19808. fallthrough
  19809. case int32(_BT_HEX):
  19810. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19811. case int32(_BT_LEAD2):
  19812. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  19813. return -int32(2)
  19814. }
  19815. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19817. return m_XML_TOK_INVALID
  19818. }
  19819. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19820. case int32(_BT_LEAD3):
  19821. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  19822. return -int32(2)
  19823. }
  19824. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19826. return m_XML_TOK_INVALID
  19827. }
  19828. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19829. case int32(_BT_LEAD4):
  19830. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  19831. return -int32(2)
  19832. }
  19833. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19835. return m_XML_TOK_INVALID
  19836. }
  19837. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19838. default:
  19839. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19840. return m_XML_TOK_INVALID
  19841. }
  19842. goto _17
  19843. _14:
  19844. ;
  19845. _13:
  19846. ;
  19847. _12:
  19848. ;
  19849. _21:
  19850. ;
  19851. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19852. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19853. return -int32(1)
  19854. }
  19855. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19856. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19857. } else {
  19858. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19859. }
  19860. t = v22
  19861. if t == int32(_BT_EQUALS) {
  19862. goto _19
  19863. }
  19864. switch t {
  19865. case int32(_BT_S):
  19866. fallthrough
  19867. case int32(_BT_LF):
  19868. fallthrough
  19869. case int32(_BT_CR):
  19870. default:
  19871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19872. return m_XML_TOK_INVALID
  19873. }
  19874. goto _20
  19875. _20:
  19876. ;
  19877. goto _21
  19878. goto _19
  19879. _19:
  19880. ;
  19881. /* fall through */
  19882. _15:
  19883. ;
  19884. hadColon = 0
  19885. for {
  19886. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19887. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19888. return -int32(1)
  19889. }
  19890. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19891. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19892. } else {
  19893. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19894. }
  19895. open = v24
  19896. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  19897. break
  19898. }
  19899. switch open {
  19900. case int32(_BT_S):
  19901. fallthrough
  19902. case int32(_BT_LF):
  19903. fallthrough
  19904. case int32(_BT_CR):
  19905. default:
  19906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19907. return m_XML_TOK_INVALID
  19908. }
  19909. goto _23
  19910. _23:
  19911. }
  19912. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19913. /* in attribute value */
  19914. for {
  19915. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19916. return -int32(1)
  19917. }
  19918. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19919. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19920. } else {
  19921. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19922. }
  19923. t1 = v26
  19924. if t1 == open {
  19925. break
  19926. }
  19927. switch t1 {
  19928. case int32(_BT_LEAD2):
  19929. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  19930. return -int32(2)
  19931. }
  19932. if 0 != 0 {
  19933. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19934. return m_XML_TOK_INVALID
  19935. }
  19936. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19937. case int32(_BT_LEAD3):
  19938. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  19939. return -int32(2)
  19940. }
  19941. if 0 != 0 {
  19942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19943. return m_XML_TOK_INVALID
  19944. }
  19945. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19946. case int32(_BT_LEAD4):
  19947. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  19948. return -int32(2)
  19949. }
  19950. if 0 != 0 {
  19951. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19952. return m_XML_TOK_INVALID
  19953. }
  19954. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19955. case int32(_BT_NONXML):
  19956. fallthrough
  19957. case int32(_BT_MALFORM):
  19958. fallthrough
  19959. case int32(_BT_TRAIL):
  19960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19961. return m_XML_TOK_INVALID
  19962. case int32(_BT_AMP):
  19963. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  19964. if tok <= 0 {
  19965. if tok == m_XML_TOK_INVALID {
  19966. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19967. }
  19968. return tok
  19969. }
  19970. case int32(_BT_LT):
  19971. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19972. return m_XML_TOK_INVALID
  19973. default:
  19974. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19975. break
  19976. }
  19977. goto _25
  19978. _25:
  19979. }
  19980. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19981. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19982. return -int32(1)
  19983. }
  19984. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19985. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  19986. } else {
  19987. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19988. }
  19989. switch v27 {
  19990. case int32(_BT_S):
  19991. fallthrough
  19992. case int32(_BT_CR):
  19993. fallthrough
  19994. case int32(_BT_LF):
  19995. case int32(_BT_SOL):
  19996. goto sol
  19997. case int32(_BT_GT):
  19998. goto gt
  19999. default:
  20000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20001. return m_XML_TOK_INVALID
  20002. }
  20003. /* ptr points to closing quote */
  20004. _30:
  20005. ;
  20006. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20007. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20008. return -int32(1)
  20009. }
  20010. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20011. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  20012. } else {
  20013. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20014. }
  20015. switch v31 {
  20016. case int32(_BT_NONASCII):
  20017. goto _32
  20018. case int32(_BT_HEX):
  20019. goto _33
  20020. case int32(_BT_NMSTRT):
  20021. goto _34
  20022. case int32(_BT_LEAD2):
  20023. goto _35
  20024. case int32(_BT_LEAD3):
  20025. goto _36
  20026. case int32(_BT_LEAD4):
  20027. goto _37
  20028. case int32(_BT_LF):
  20029. goto _38
  20030. case int32(_BT_CR):
  20031. goto _39
  20032. case int32(_BT_S):
  20033. goto _40
  20034. case int32(_BT_GT):
  20035. goto _41
  20036. case int32(_BT_SOL):
  20037. goto _42
  20038. default:
  20039. goto _43
  20040. }
  20041. goto _44
  20042. _32:
  20043. ;
  20044. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  20045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20046. return m_XML_TOK_INVALID
  20047. } /* fall through */
  20048. _34:
  20049. ;
  20050. _33:
  20051. ;
  20052. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20053. goto _44
  20054. _35:
  20055. ;
  20056. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  20057. return -int32(2)
  20058. }
  20059. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20061. return m_XML_TOK_INVALID
  20062. }
  20063. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20064. goto _44
  20065. _36:
  20066. ;
  20067. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  20068. return -int32(2)
  20069. }
  20070. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20072. return m_XML_TOK_INVALID
  20073. }
  20074. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20075. goto _44
  20076. _37:
  20077. ;
  20078. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  20079. return -int32(2)
  20080. }
  20081. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20082. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20083. return m_XML_TOK_INVALID
  20084. }
  20085. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20086. goto _44
  20087. _40:
  20088. ;
  20089. _39:
  20090. ;
  20091. _38:
  20092. ;
  20093. goto _29
  20094. _41:
  20095. ;
  20096. goto gt
  20097. gt:
  20098. ;
  20099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20100. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20101. _42:
  20102. ;
  20103. goto sol
  20104. sol:
  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 !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  20111. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20112. return m_XML_TOK_INVALID
  20113. }
  20114. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20115. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20116. _43:
  20117. ;
  20118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20119. return m_XML_TOK_INVALID
  20120. _44:
  20121. ;
  20122. goto _28
  20123. goto _29
  20124. _29:
  20125. ;
  20126. goto _30
  20127. goto _28
  20128. _28:
  20129. ;
  20130. goto _17
  20131. _16:
  20132. ;
  20133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20134. return m_XML_TOK_INVALID
  20135. _17:
  20136. }
  20137. return -int32(1)
  20138. }
  20139. /* ptr points to character following "<" */
  20140. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20141. var hadColon, v1, v2, v21, v22, v3 int32
  20142. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20143. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20144. return -int32(1)
  20145. }
  20146. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20147. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20148. } else {
  20149. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20150. }
  20151. switch v1 {
  20152. case int32(_BT_NONASCII):
  20153. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20155. return m_XML_TOK_INVALID
  20156. } /* fall through */
  20157. fallthrough
  20158. case int32(_BT_NMSTRT):
  20159. fallthrough
  20160. case int32(_BT_HEX):
  20161. ptr += uintptr(2)
  20162. case int32(_BT_LEAD2):
  20163. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20164. return -int32(2)
  20165. }
  20166. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20168. return m_XML_TOK_INVALID
  20169. }
  20170. ptr += uintptr(2)
  20171. case int32(_BT_LEAD3):
  20172. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20173. return -int32(2)
  20174. }
  20175. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20177. return m_XML_TOK_INVALID
  20178. }
  20179. ptr += uintptr(3)
  20180. case int32(_BT_LEAD4):
  20181. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20182. return -int32(2)
  20183. }
  20184. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20185. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20186. return m_XML_TOK_INVALID
  20187. }
  20188. ptr += uintptr(4)
  20189. case int32(_BT_EXCL):
  20190. ptr += uintptr(2)
  20191. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20192. return -int32(1)
  20193. }
  20194. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20195. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20196. } else {
  20197. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20198. }
  20199. switch v2 {
  20200. case int32(_BT_MINUS):
  20201. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20202. case int32(_BT_LSQB):
  20203. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20204. }
  20205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20206. return m_XML_TOK_INVALID
  20207. case int32(_BT_QUEST):
  20208. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20209. case int32(_BT_SOL):
  20210. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20211. default:
  20212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20213. return m_XML_TOK_INVALID
  20214. }
  20215. hadColon = 0
  20216. /* we have a start-tag */
  20217. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20218. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20219. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20220. } else {
  20221. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20222. }
  20223. switch v3 {
  20224. case int32(_BT_NONASCII):
  20225. goto _4
  20226. case int32(_BT_MINUS):
  20227. goto _5
  20228. case int32(_BT_NAME):
  20229. goto _6
  20230. case int32(_BT_DIGIT):
  20231. goto _7
  20232. case int32(_BT_HEX):
  20233. goto _8
  20234. case int32(_BT_NMSTRT):
  20235. goto _9
  20236. case int32(_BT_LEAD2):
  20237. goto _10
  20238. case int32(_BT_LEAD3):
  20239. goto _11
  20240. case int32(_BT_LEAD4):
  20241. goto _12
  20242. case int32(_BT_COLON):
  20243. goto _13
  20244. case int32(_BT_LF):
  20245. goto _14
  20246. case int32(_BT_CR):
  20247. goto _15
  20248. case int32(_BT_S):
  20249. goto _16
  20250. case int32(_BT_GT):
  20251. goto _17
  20252. case int32(_BT_SOL):
  20253. goto _18
  20254. default:
  20255. goto _19
  20256. }
  20257. goto _20
  20258. _4:
  20259. ;
  20260. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20262. return m_XML_TOK_INVALID
  20263. } /* fall through */
  20264. _9:
  20265. ;
  20266. _8:
  20267. ;
  20268. _7:
  20269. ;
  20270. _6:
  20271. ;
  20272. _5:
  20273. ;
  20274. ptr += uintptr(2)
  20275. goto _20
  20276. _10:
  20277. ;
  20278. if int64(end)-int64(ptr) < int64(2) {
  20279. return -int32(2)
  20280. }
  20281. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20282. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20283. return m_XML_TOK_INVALID
  20284. }
  20285. ptr += uintptr(2)
  20286. goto _20
  20287. _11:
  20288. ;
  20289. if int64(end)-int64(ptr) < int64(3) {
  20290. return -int32(2)
  20291. }
  20292. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20294. return m_XML_TOK_INVALID
  20295. }
  20296. ptr += uintptr(3)
  20297. goto _20
  20298. _12:
  20299. ;
  20300. if int64(end)-int64(ptr) < int64(4) {
  20301. return -int32(2)
  20302. }
  20303. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20304. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20305. return m_XML_TOK_INVALID
  20306. }
  20307. ptr += uintptr(4)
  20308. goto _20
  20309. _13:
  20310. ;
  20311. if hadColon != 0 {
  20312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20313. return m_XML_TOK_INVALID
  20314. }
  20315. hadColon = int32(1)
  20316. ptr += uintptr(2)
  20317. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20318. return -int32(1)
  20319. }
  20320. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20321. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20322. } else {
  20323. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20324. }
  20325. switch v21 {
  20326. case int32(_BT_NONASCII):
  20327. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20329. return m_XML_TOK_INVALID
  20330. } /* fall through */
  20331. fallthrough
  20332. case int32(_BT_NMSTRT):
  20333. fallthrough
  20334. case int32(_BT_HEX):
  20335. ptr += uintptr(2)
  20336. case int32(_BT_LEAD2):
  20337. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20338. return -int32(2)
  20339. }
  20340. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20342. return m_XML_TOK_INVALID
  20343. }
  20344. ptr += uintptr(2)
  20345. case int32(_BT_LEAD3):
  20346. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20347. return -int32(2)
  20348. }
  20349. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20351. return m_XML_TOK_INVALID
  20352. }
  20353. ptr += uintptr(3)
  20354. case int32(_BT_LEAD4):
  20355. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20356. return -int32(2)
  20357. }
  20358. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20360. return m_XML_TOK_INVALID
  20361. }
  20362. ptr += uintptr(4)
  20363. default:
  20364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20365. return m_XML_TOK_INVALID
  20366. }
  20367. goto _20
  20368. _16:
  20369. ;
  20370. _15:
  20371. ;
  20372. _14:
  20373. ;
  20374. ptr += uintptr(2)
  20375. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20376. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20377. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20378. } else {
  20379. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20380. }
  20381. switch v22 {
  20382. case int32(_BT_NONASCII):
  20383. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20385. return m_XML_TOK_INVALID
  20386. } /* fall through */
  20387. fallthrough
  20388. case int32(_BT_NMSTRT):
  20389. fallthrough
  20390. case int32(_BT_HEX):
  20391. ptr += uintptr(2)
  20392. case int32(_BT_LEAD2):
  20393. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20394. return -int32(2)
  20395. }
  20396. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20397. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20398. return m_XML_TOK_INVALID
  20399. }
  20400. ptr += uintptr(2)
  20401. case int32(_BT_LEAD3):
  20402. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20403. return -int32(2)
  20404. }
  20405. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20407. return m_XML_TOK_INVALID
  20408. }
  20409. ptr += uintptr(3)
  20410. case int32(_BT_LEAD4):
  20411. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20412. return -int32(2)
  20413. }
  20414. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20415. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20416. return m_XML_TOK_INVALID
  20417. }
  20418. ptr += uintptr(4)
  20419. case int32(_BT_GT):
  20420. goto gt
  20421. case int32(_BT_SOL):
  20422. goto sol
  20423. case int32(_BT_S):
  20424. fallthrough
  20425. case int32(_BT_CR):
  20426. fallthrough
  20427. case int32(_BT_LF):
  20428. ptr += uintptr(2)
  20429. continue
  20430. default:
  20431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20432. return m_XML_TOK_INVALID
  20433. }
  20434. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20435. }
  20436. return -int32(1)
  20437. _17:
  20438. ;
  20439. goto gt
  20440. gt:
  20441. ;
  20442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20443. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20444. _18:
  20445. ;
  20446. goto sol
  20447. sol:
  20448. ;
  20449. ptr += uintptr(2)
  20450. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20451. return -int32(1)
  20452. }
  20453. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20455. return m_XML_TOK_INVALID
  20456. }
  20457. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20458. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20459. _19:
  20460. ;
  20461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20462. return m_XML_TOK_INVALID
  20463. _20:
  20464. }
  20465. return -int32(1)
  20466. }
  20467. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20468. var n Tsize_t
  20469. var v1, v2, v3 int32
  20470. _, _, _, _ = n, v1, v2, v3
  20471. if ptr >= end {
  20472. return -int32(4)
  20473. }
  20474. if int32(2) > int32(1) {
  20475. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20476. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20477. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20478. if n == uint64(0) {
  20479. return -int32(1)
  20480. }
  20481. end = ptr + uintptr(n)
  20482. }
  20483. }
  20484. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20485. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20486. } else {
  20487. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20488. }
  20489. switch v1 {
  20490. case int32(_BT_LT):
  20491. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20492. case int32(_BT_AMP):
  20493. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20494. case int32(_BT_CR):
  20495. ptr += uintptr(2)
  20496. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20497. return -int32(3)
  20498. }
  20499. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20500. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20501. } else {
  20502. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20503. }
  20504. if v2 == int32(_BT_LF) {
  20505. ptr += uintptr(2)
  20506. }
  20507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20508. return int32(m_XML_TOK_DATA_NEWLINE)
  20509. case int32(_BT_LF):
  20510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20511. return int32(m_XML_TOK_DATA_NEWLINE)
  20512. case int32(_BT_RSQB):
  20513. ptr += uintptr(2)
  20514. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20515. return -int32(5)
  20516. }
  20517. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20518. break
  20519. }
  20520. ptr += uintptr(2)
  20521. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20522. return -int32(5)
  20523. }
  20524. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20525. ptr -= uintptr(2)
  20526. break
  20527. }
  20528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20529. return m_XML_TOK_INVALID
  20530. case int32(_BT_LEAD2):
  20531. if int64(end)-int64(ptr) < int64(2) {
  20532. return -int32(2)
  20533. }
  20534. if 0 != 0 {
  20535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20536. return m_XML_TOK_INVALID
  20537. }
  20538. ptr += uintptr(2)
  20539. case int32(_BT_LEAD3):
  20540. if int64(end)-int64(ptr) < int64(3) {
  20541. return -int32(2)
  20542. }
  20543. if 0 != 0 {
  20544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20545. return m_XML_TOK_INVALID
  20546. }
  20547. ptr += uintptr(3)
  20548. case int32(_BT_LEAD4):
  20549. if int64(end)-int64(ptr) < int64(4) {
  20550. return -int32(2)
  20551. }
  20552. if 0 != 0 {
  20553. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20554. return m_XML_TOK_INVALID
  20555. }
  20556. ptr += uintptr(4)
  20557. case int32(_BT_NONXML):
  20558. fallthrough
  20559. case int32(_BT_MALFORM):
  20560. fallthrough
  20561. case int32(_BT_TRAIL):
  20562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20563. return m_XML_TOK_INVALID
  20564. default:
  20565. ptr += uintptr(2)
  20566. break
  20567. }
  20568. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20569. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20570. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20571. } else {
  20572. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20573. }
  20574. switch v3 {
  20575. case int32(_BT_LEAD2):
  20576. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  20577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20578. return int32(m_XML_TOK_DATA_CHARS)
  20579. }
  20580. ptr += uintptr(2)
  20581. case int32(_BT_LEAD3):
  20582. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  20583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20584. return int32(m_XML_TOK_DATA_CHARS)
  20585. }
  20586. ptr += uintptr(3)
  20587. case int32(_BT_LEAD4):
  20588. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  20589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20590. return int32(m_XML_TOK_DATA_CHARS)
  20591. }
  20592. ptr += uintptr(4)
  20593. case int32(_BT_RSQB):
  20594. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  20595. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  20596. ptr += uintptr(2)
  20597. break
  20598. }
  20599. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  20600. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  20601. ptr += uintptr(2)
  20602. break
  20603. }
  20604. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20605. return m_XML_TOK_INVALID
  20606. }
  20607. }
  20608. /* fall through */
  20609. fallthrough
  20610. case int32(_BT_AMP):
  20611. fallthrough
  20612. case int32(_BT_LT):
  20613. fallthrough
  20614. case int32(_BT_NONXML):
  20615. fallthrough
  20616. case int32(_BT_MALFORM):
  20617. fallthrough
  20618. case int32(_BT_TRAIL):
  20619. fallthrough
  20620. case int32(_BT_CR):
  20621. fallthrough
  20622. case int32(_BT_LF):
  20623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20624. return int32(m_XML_TOK_DATA_CHARS)
  20625. default:
  20626. ptr += uintptr(2)
  20627. break
  20628. }
  20629. }
  20630. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20631. return int32(m_XML_TOK_DATA_CHARS)
  20632. }
  20633. /* ptr points to character following "%" */
  20634. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20635. var v1, v2 int32
  20636. _, _ = v1, v2
  20637. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20638. return -int32(1)
  20639. }
  20640. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20641. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20642. } else {
  20643. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20644. }
  20645. switch v1 {
  20646. case int32(_BT_NONASCII):
  20647. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20648. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20649. return m_XML_TOK_INVALID
  20650. } /* fall through */
  20651. fallthrough
  20652. case int32(_BT_NMSTRT):
  20653. fallthrough
  20654. case int32(_BT_HEX):
  20655. ptr += uintptr(2)
  20656. case int32(_BT_LEAD2):
  20657. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20658. return -int32(2)
  20659. }
  20660. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20661. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20662. return m_XML_TOK_INVALID
  20663. }
  20664. ptr += uintptr(2)
  20665. case int32(_BT_LEAD3):
  20666. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20667. return -int32(2)
  20668. }
  20669. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20671. return m_XML_TOK_INVALID
  20672. }
  20673. ptr += uintptr(3)
  20674. case int32(_BT_LEAD4):
  20675. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20676. return -int32(2)
  20677. }
  20678. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20680. return m_XML_TOK_INVALID
  20681. }
  20682. ptr += uintptr(4)
  20683. case int32(_BT_S):
  20684. fallthrough
  20685. case int32(_BT_LF):
  20686. fallthrough
  20687. case int32(_BT_CR):
  20688. fallthrough
  20689. case int32(_BT_PERCNT):
  20690. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20691. return int32(m_XML_TOK_PERCENT)
  20692. default:
  20693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20694. return m_XML_TOK_INVALID
  20695. }
  20696. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20697. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20698. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20699. } else {
  20700. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20701. }
  20702. switch v2 {
  20703. case int32(_BT_NONASCII):
  20704. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20705. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20706. return m_XML_TOK_INVALID
  20707. } /* fall through */
  20708. fallthrough
  20709. case int32(_BT_NMSTRT):
  20710. fallthrough
  20711. case int32(_BT_HEX):
  20712. fallthrough
  20713. case int32(_BT_DIGIT):
  20714. fallthrough
  20715. case int32(_BT_NAME):
  20716. fallthrough
  20717. case int32(_BT_MINUS):
  20718. ptr += uintptr(2)
  20719. case int32(_BT_LEAD2):
  20720. if int64(end)-int64(ptr) < int64(2) {
  20721. return -int32(2)
  20722. }
  20723. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20725. return m_XML_TOK_INVALID
  20726. }
  20727. ptr += uintptr(2)
  20728. case int32(_BT_LEAD3):
  20729. if int64(end)-int64(ptr) < int64(3) {
  20730. return -int32(2)
  20731. }
  20732. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20733. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20734. return m_XML_TOK_INVALID
  20735. }
  20736. ptr += uintptr(3)
  20737. case int32(_BT_LEAD4):
  20738. if int64(end)-int64(ptr) < int64(4) {
  20739. return -int32(2)
  20740. }
  20741. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20743. return m_XML_TOK_INVALID
  20744. }
  20745. ptr += uintptr(4)
  20746. case int32(_BT_SEMI):
  20747. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20748. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  20749. default:
  20750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20751. return m_XML_TOK_INVALID
  20752. }
  20753. }
  20754. return -int32(1)
  20755. }
  20756. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20757. var v1, v2 int32
  20758. _, _ = v1, v2
  20759. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20760. return -int32(1)
  20761. }
  20762. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20763. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20764. } else {
  20765. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20766. }
  20767. switch v1 {
  20768. case int32(_BT_NONASCII):
  20769. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20771. return m_XML_TOK_INVALID
  20772. } /* fall through */
  20773. fallthrough
  20774. case int32(_BT_NMSTRT):
  20775. fallthrough
  20776. case int32(_BT_HEX):
  20777. ptr += uintptr(2)
  20778. case int32(_BT_LEAD2):
  20779. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  20780. return -int32(2)
  20781. }
  20782. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20783. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20784. return m_XML_TOK_INVALID
  20785. }
  20786. ptr += uintptr(2)
  20787. case int32(_BT_LEAD3):
  20788. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  20789. return -int32(2)
  20790. }
  20791. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20792. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20793. return m_XML_TOK_INVALID
  20794. }
  20795. ptr += uintptr(3)
  20796. case int32(_BT_LEAD4):
  20797. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  20798. return -int32(2)
  20799. }
  20800. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20801. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20802. return m_XML_TOK_INVALID
  20803. }
  20804. ptr += uintptr(4)
  20805. default:
  20806. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20807. return m_XML_TOK_INVALID
  20808. }
  20809. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20810. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20811. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20812. } else {
  20813. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20814. }
  20815. switch v2 {
  20816. case int32(_BT_NONASCII):
  20817. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  20818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20819. return m_XML_TOK_INVALID
  20820. } /* fall through */
  20821. fallthrough
  20822. case int32(_BT_NMSTRT):
  20823. fallthrough
  20824. case int32(_BT_HEX):
  20825. fallthrough
  20826. case int32(_BT_DIGIT):
  20827. fallthrough
  20828. case int32(_BT_NAME):
  20829. fallthrough
  20830. case int32(_BT_MINUS):
  20831. ptr += uintptr(2)
  20832. case int32(_BT_LEAD2):
  20833. if int64(end)-int64(ptr) < int64(2) {
  20834. return -int32(2)
  20835. }
  20836. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20838. return m_XML_TOK_INVALID
  20839. }
  20840. ptr += uintptr(2)
  20841. case int32(_BT_LEAD3):
  20842. if int64(end)-int64(ptr) < int64(3) {
  20843. return -int32(2)
  20844. }
  20845. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20847. return m_XML_TOK_INVALID
  20848. }
  20849. ptr += uintptr(3)
  20850. case int32(_BT_LEAD4):
  20851. if int64(end)-int64(ptr) < int64(4) {
  20852. return -int32(2)
  20853. }
  20854. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20856. return m_XML_TOK_INVALID
  20857. }
  20858. ptr += uintptr(4)
  20859. case int32(_BT_CR):
  20860. fallthrough
  20861. case int32(_BT_LF):
  20862. fallthrough
  20863. case int32(_BT_S):
  20864. fallthrough
  20865. case int32(_BT_RPAR):
  20866. fallthrough
  20867. case int32(_BT_GT):
  20868. fallthrough
  20869. case int32(_BT_PERCNT):
  20870. fallthrough
  20871. case int32(_BT_VERBAR):
  20872. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20873. return int32(m_XML_TOK_POUND_NAME)
  20874. default:
  20875. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20876. return m_XML_TOK_INVALID
  20877. }
  20878. }
  20879. return -int32(m_XML_TOK_POUND_NAME)
  20880. }
  20881. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20882. var t, v1, v2 int32
  20883. _, _, _ = t, v1, v2
  20884. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20885. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20886. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20887. } else {
  20888. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20889. }
  20890. t = v1
  20891. switch t {
  20892. case int32(_BT_LEAD2):
  20893. if int64(end)-int64(ptr) < int64(2) {
  20894. return -int32(2)
  20895. }
  20896. if 0 != 0 {
  20897. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20898. return m_XML_TOK_INVALID
  20899. }
  20900. ptr += uintptr(2)
  20901. case int32(_BT_LEAD3):
  20902. if int64(end)-int64(ptr) < int64(3) {
  20903. return -int32(2)
  20904. }
  20905. if 0 != 0 {
  20906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20907. return m_XML_TOK_INVALID
  20908. }
  20909. ptr += uintptr(3)
  20910. case int32(_BT_LEAD4):
  20911. if int64(end)-int64(ptr) < int64(4) {
  20912. return -int32(2)
  20913. }
  20914. if 0 != 0 {
  20915. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20916. return m_XML_TOK_INVALID
  20917. }
  20918. ptr += uintptr(4)
  20919. case int32(_BT_NONXML):
  20920. fallthrough
  20921. case int32(_BT_MALFORM):
  20922. fallthrough
  20923. case int32(_BT_TRAIL):
  20924. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20925. return m_XML_TOK_INVALID
  20926. case int32(_BT_QUOT):
  20927. fallthrough
  20928. case int32(_BT_APOS):
  20929. ptr += uintptr(2)
  20930. if t != open {
  20931. break
  20932. }
  20933. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20934. return -int32(m_XML_TOK_LITERAL)
  20935. }
  20936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20937. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20938. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20939. } else {
  20940. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20941. }
  20942. switch v2 {
  20943. case int32(_BT_S):
  20944. fallthrough
  20945. case int32(_BT_CR):
  20946. fallthrough
  20947. case int32(_BT_LF):
  20948. fallthrough
  20949. case int32(_BT_GT):
  20950. fallthrough
  20951. case int32(_BT_PERCNT):
  20952. fallthrough
  20953. case int32(_BT_LSQB):
  20954. return int32(m_XML_TOK_LITERAL)
  20955. default:
  20956. return m_XML_TOK_INVALID
  20957. }
  20958. fallthrough
  20959. default:
  20960. ptr += uintptr(2)
  20961. break
  20962. }
  20963. }
  20964. return -int32(1)
  20965. }
  20966. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20967. var n Tsize_t
  20968. var tok, v1, v29, v33, v34, v35, v36 int32
  20969. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  20970. if ptr >= end {
  20971. return -int32(4)
  20972. }
  20973. if int32(2) > int32(1) {
  20974. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  20975. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20976. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20977. if n == uint64(0) {
  20978. return -int32(1)
  20979. }
  20980. end = ptr + uintptr(n)
  20981. }
  20982. }
  20983. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  20984. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  20985. } else {
  20986. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  20987. }
  20988. switch v1 {
  20989. case int32(_BT_QUOT):
  20990. goto _2
  20991. case int32(_BT_APOS):
  20992. goto _3
  20993. case int32(_BT_LT):
  20994. goto _4
  20995. case int32(_BT_CR):
  20996. goto _5
  20997. case int32(_BT_LF):
  20998. goto _6
  20999. case int32(_BT_S):
  21000. goto _7
  21001. case int32(_BT_PERCNT):
  21002. goto _8
  21003. case int32(_BT_COMMA):
  21004. goto _9
  21005. case int32(_BT_LSQB):
  21006. goto _10
  21007. case int32(_BT_RSQB):
  21008. goto _11
  21009. case int32(_BT_LPAR):
  21010. goto _12
  21011. case int32(_BT_RPAR):
  21012. goto _13
  21013. case int32(_BT_VERBAR):
  21014. goto _14
  21015. case int32(_BT_GT):
  21016. goto _15
  21017. case int32(_BT_NUM):
  21018. goto _16
  21019. case int32(_BT_LEAD2):
  21020. goto _17
  21021. case int32(_BT_LEAD3):
  21022. goto _18
  21023. case int32(_BT_LEAD4):
  21024. goto _19
  21025. case int32(_BT_HEX):
  21026. goto _20
  21027. case int32(_BT_NMSTRT):
  21028. goto _21
  21029. case int32(_BT_COLON):
  21030. goto _22
  21031. case int32(_BT_MINUS):
  21032. goto _23
  21033. case int32(_BT_NAME):
  21034. goto _24
  21035. case int32(_BT_DIGIT):
  21036. goto _25
  21037. case int32(_BT_NONASCII):
  21038. goto _26
  21039. default:
  21040. goto _27
  21041. }
  21042. goto _28
  21043. _2:
  21044. ;
  21045. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21046. _3:
  21047. ;
  21048. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21049. _4:
  21050. ;
  21051. ptr += uintptr(2)
  21052. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21053. return -int32(1)
  21054. }
  21055. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21056. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21057. } else {
  21058. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21059. }
  21060. switch v29 {
  21061. case int32(_BT_EXCL):
  21062. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21063. case int32(_BT_QUEST):
  21064. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21065. case int32(_BT_NMSTRT):
  21066. fallthrough
  21067. case int32(_BT_HEX):
  21068. fallthrough
  21069. case int32(_BT_NONASCII):
  21070. fallthrough
  21071. case int32(_BT_LEAD2):
  21072. fallthrough
  21073. case int32(_BT_LEAD3):
  21074. fallthrough
  21075. case int32(_BT_LEAD4):
  21076. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21077. return int32(m_XML_TOK_INSTANCE_START)
  21078. }
  21079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21080. return m_XML_TOK_INVALID
  21081. _5:
  21082. ;
  21083. if ptr+uintptr(2) == end {
  21084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21085. /* indicate that this might be part of a CR/LF pair */
  21086. return -int32(m_XML_TOK_PROLOG_S)
  21087. }
  21088. /* fall through */
  21089. _7:
  21090. ;
  21091. _6:
  21092. ;
  21093. _32:
  21094. ;
  21095. ptr += uintptr(2)
  21096. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21097. goto _30
  21098. }
  21099. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21100. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21101. } else {
  21102. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21103. }
  21104. switch v33 {
  21105. case int32(_BT_S):
  21106. fallthrough
  21107. case int32(_BT_LF):
  21108. case int32(_BT_CR):
  21109. /* don't split CR/LF pair */
  21110. if ptr+uintptr(2) != end {
  21111. break
  21112. }
  21113. /* fall through */
  21114. fallthrough
  21115. default:
  21116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21117. return int32(m_XML_TOK_PROLOG_S)
  21118. }
  21119. goto _31
  21120. _31:
  21121. ;
  21122. goto _32
  21123. goto _30
  21124. _30:
  21125. ;
  21126. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21127. return int32(m_XML_TOK_PROLOG_S)
  21128. _8:
  21129. ;
  21130. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21131. _9:
  21132. ;
  21133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21134. return int32(m_XML_TOK_COMMA)
  21135. _10:
  21136. ;
  21137. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21138. return int32(m_XML_TOK_OPEN_BRACKET)
  21139. _11:
  21140. ;
  21141. ptr += uintptr(2)
  21142. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21143. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21144. }
  21145. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21146. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  21147. return -int32(1)
  21148. }
  21149. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  21150. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21151. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21152. }
  21153. }
  21154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21155. return int32(m_XML_TOK_CLOSE_BRACKET)
  21156. _12:
  21157. ;
  21158. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21159. return int32(m_XML_TOK_OPEN_PAREN)
  21160. _13:
  21161. ;
  21162. ptr += uintptr(2)
  21163. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21164. return -int32(m_XML_TOK_CLOSE_PAREN)
  21165. }
  21166. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21167. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21168. } else {
  21169. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21170. }
  21171. switch v34 {
  21172. case int32(_BT_AST):
  21173. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21174. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21175. case int32(_BT_QUEST):
  21176. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21177. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21178. case int32(_BT_PLUS):
  21179. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21180. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21181. case int32(_BT_CR):
  21182. fallthrough
  21183. case int32(_BT_LF):
  21184. fallthrough
  21185. case int32(_BT_S):
  21186. fallthrough
  21187. case int32(_BT_GT):
  21188. fallthrough
  21189. case int32(_BT_COMMA):
  21190. fallthrough
  21191. case int32(_BT_VERBAR):
  21192. fallthrough
  21193. case int32(_BT_RPAR):
  21194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21195. return int32(m_XML_TOK_CLOSE_PAREN)
  21196. }
  21197. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21198. return m_XML_TOK_INVALID
  21199. _14:
  21200. ;
  21201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21202. return int32(m_XML_TOK_OR)
  21203. _15:
  21204. ;
  21205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21206. return int32(m_XML_TOK_DECL_CLOSE)
  21207. _16:
  21208. ;
  21209. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21210. _17:
  21211. ;
  21212. if int64(end)-int64(ptr) < int64(2) {
  21213. return -int32(2)
  21214. }
  21215. if 0 != 0 {
  21216. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21217. return m_XML_TOK_INVALID
  21218. }
  21219. if 0 != 0 {
  21220. ptr += uintptr(2)
  21221. tok = int32(m_XML_TOK_NAME)
  21222. goto _28
  21223. }
  21224. if 0 != 0 {
  21225. ptr += uintptr(2)
  21226. tok = int32(m_XML_TOK_NMTOKEN)
  21227. goto _28
  21228. }
  21229. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21230. return m_XML_TOK_INVALID
  21231. _18:
  21232. ;
  21233. if int64(end)-int64(ptr) < int64(3) {
  21234. return -int32(2)
  21235. }
  21236. if 0 != 0 {
  21237. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21238. return m_XML_TOK_INVALID
  21239. }
  21240. if 0 != 0 {
  21241. ptr += uintptr(3)
  21242. tok = int32(m_XML_TOK_NAME)
  21243. goto _28
  21244. }
  21245. if 0 != 0 {
  21246. ptr += uintptr(3)
  21247. tok = int32(m_XML_TOK_NMTOKEN)
  21248. goto _28
  21249. }
  21250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21251. return m_XML_TOK_INVALID
  21252. _19:
  21253. ;
  21254. if int64(end)-int64(ptr) < int64(4) {
  21255. return -int32(2)
  21256. }
  21257. if 0 != 0 {
  21258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21259. return m_XML_TOK_INVALID
  21260. }
  21261. if 0 != 0 {
  21262. ptr += uintptr(4)
  21263. tok = int32(m_XML_TOK_NAME)
  21264. goto _28
  21265. }
  21266. if 0 != 0 {
  21267. ptr += uintptr(4)
  21268. tok = int32(m_XML_TOK_NMTOKEN)
  21269. goto _28
  21270. }
  21271. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21272. return m_XML_TOK_INVALID
  21273. _21:
  21274. ;
  21275. _20:
  21276. ;
  21277. tok = int32(m_XML_TOK_NAME)
  21278. ptr += uintptr(2)
  21279. goto _28
  21280. _25:
  21281. ;
  21282. _24:
  21283. ;
  21284. _23:
  21285. ;
  21286. _22:
  21287. ;
  21288. tok = int32(m_XML_TOK_NMTOKEN)
  21289. ptr += uintptr(2)
  21290. goto _28
  21291. _26:
  21292. ;
  21293. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  21294. ptr += uintptr(2)
  21295. tok = int32(m_XML_TOK_NAME)
  21296. goto _28
  21297. }
  21298. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  21299. ptr += uintptr(2)
  21300. tok = int32(m_XML_TOK_NMTOKEN)
  21301. goto _28
  21302. }
  21303. /* fall through */
  21304. _27:
  21305. ;
  21306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21307. return m_XML_TOK_INVALID
  21308. _28:
  21309. ;
  21310. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21311. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21312. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21313. } else {
  21314. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21315. }
  21316. switch v35 {
  21317. case int32(_BT_NONASCII):
  21318. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  21319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21320. return m_XML_TOK_INVALID
  21321. } /* fall through */
  21322. fallthrough
  21323. case int32(_BT_NMSTRT):
  21324. fallthrough
  21325. case int32(_BT_HEX):
  21326. fallthrough
  21327. case int32(_BT_DIGIT):
  21328. fallthrough
  21329. case int32(_BT_NAME):
  21330. fallthrough
  21331. case int32(_BT_MINUS):
  21332. ptr += uintptr(2)
  21333. case int32(_BT_LEAD2):
  21334. if int64(end)-int64(ptr) < int64(2) {
  21335. return -int32(2)
  21336. }
  21337. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21339. return m_XML_TOK_INVALID
  21340. }
  21341. ptr += uintptr(2)
  21342. case int32(_BT_LEAD3):
  21343. if int64(end)-int64(ptr) < int64(3) {
  21344. return -int32(2)
  21345. }
  21346. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21347. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21348. return m_XML_TOK_INVALID
  21349. }
  21350. ptr += uintptr(3)
  21351. case int32(_BT_LEAD4):
  21352. if int64(end)-int64(ptr) < int64(4) {
  21353. return -int32(2)
  21354. }
  21355. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21357. return m_XML_TOK_INVALID
  21358. }
  21359. ptr += uintptr(4)
  21360. case int32(_BT_GT):
  21361. fallthrough
  21362. case int32(_BT_RPAR):
  21363. fallthrough
  21364. case int32(_BT_COMMA):
  21365. fallthrough
  21366. case int32(_BT_VERBAR):
  21367. fallthrough
  21368. case int32(_BT_LSQB):
  21369. fallthrough
  21370. case int32(_BT_PERCNT):
  21371. fallthrough
  21372. case int32(_BT_S):
  21373. fallthrough
  21374. case int32(_BT_CR):
  21375. fallthrough
  21376. case int32(_BT_LF):
  21377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21378. return tok
  21379. case int32(_BT_COLON):
  21380. ptr += uintptr(2)
  21381. switch tok {
  21382. case int32(m_XML_TOK_NAME):
  21383. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21384. return -int32(1)
  21385. }
  21386. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21387. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21388. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21389. } else {
  21390. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21391. }
  21392. switch v36 {
  21393. case int32(_BT_NONASCII):
  21394. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  21395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21396. return m_XML_TOK_INVALID
  21397. } /* fall through */
  21398. fallthrough
  21399. case int32(_BT_NMSTRT):
  21400. fallthrough
  21401. case int32(_BT_HEX):
  21402. fallthrough
  21403. case int32(_BT_DIGIT):
  21404. fallthrough
  21405. case int32(_BT_NAME):
  21406. fallthrough
  21407. case int32(_BT_MINUS):
  21408. ptr += uintptr(2)
  21409. case int32(_BT_LEAD2):
  21410. if int64(end)-int64(ptr) < int64(2) {
  21411. return -int32(2)
  21412. }
  21413. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21414. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21415. return m_XML_TOK_INVALID
  21416. }
  21417. ptr += uintptr(2)
  21418. case int32(_BT_LEAD3):
  21419. if int64(end)-int64(ptr) < int64(3) {
  21420. return -int32(2)
  21421. }
  21422. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21424. return m_XML_TOK_INVALID
  21425. }
  21426. ptr += uintptr(3)
  21427. case int32(_BT_LEAD4):
  21428. if int64(end)-int64(ptr) < int64(4) {
  21429. return -int32(2)
  21430. }
  21431. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21433. return m_XML_TOK_INVALID
  21434. }
  21435. ptr += uintptr(4)
  21436. default:
  21437. tok = int32(m_XML_TOK_NMTOKEN)
  21438. break
  21439. }
  21440. case int32(m_XML_TOK_PREFIXED_NAME):
  21441. tok = int32(m_XML_TOK_NMTOKEN)
  21442. break
  21443. }
  21444. case int32(_BT_PLUS):
  21445. if tok == int32(m_XML_TOK_NMTOKEN) {
  21446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21447. return m_XML_TOK_INVALID
  21448. }
  21449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21450. return int32(m_XML_TOK_NAME_PLUS)
  21451. case int32(_BT_AST):
  21452. if tok == int32(m_XML_TOK_NMTOKEN) {
  21453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21454. return m_XML_TOK_INVALID
  21455. }
  21456. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21457. return int32(m_XML_TOK_NAME_ASTERISK)
  21458. case int32(_BT_QUEST):
  21459. if tok == int32(m_XML_TOK_NMTOKEN) {
  21460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21461. return m_XML_TOK_INVALID
  21462. }
  21463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21464. return int32(m_XML_TOK_NAME_QUESTION)
  21465. default:
  21466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21467. return m_XML_TOK_INVALID
  21468. }
  21469. }
  21470. return -tok
  21471. }
  21472. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21473. var start uintptr
  21474. var v1, v2 int32
  21475. _, _, _ = start, v1, v2
  21476. if ptr >= end {
  21477. return -int32(4)
  21478. } else {
  21479. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21480. /* This line cannot be executed. The incoming data has already
  21481. * been tokenized once, so incomplete characters like this have
  21482. * already been eliminated from the input. Retaining the paranoia
  21483. * check is still valuable, however.
  21484. */
  21485. return -int32(1) /* LCOV_EXCL_LINE */
  21486. }
  21487. }
  21488. start = ptr
  21489. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21490. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21491. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21492. } else {
  21493. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21494. }
  21495. switch v1 {
  21496. case int32(_BT_LEAD2):
  21497. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21498. case int32(_BT_LEAD3):
  21499. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21500. case int32(_BT_LEAD4):
  21501. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21502. case int32(_BT_AMP):
  21503. if ptr == start {
  21504. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21505. }
  21506. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21507. return int32(m_XML_TOK_DATA_CHARS)
  21508. case int32(_BT_LT):
  21509. /* this is for inside entity references */
  21510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21511. return m_XML_TOK_INVALID
  21512. case int32(_BT_LF):
  21513. if ptr == start {
  21514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21515. return int32(m_XML_TOK_DATA_NEWLINE)
  21516. }
  21517. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21518. return int32(m_XML_TOK_DATA_CHARS)
  21519. case int32(_BT_CR):
  21520. if ptr == start {
  21521. ptr += uintptr(2)
  21522. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21523. return -int32(3)
  21524. }
  21525. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21526. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21527. } else {
  21528. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21529. }
  21530. if v2 == int32(_BT_LF) {
  21531. ptr += uintptr(2)
  21532. }
  21533. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21534. return int32(m_XML_TOK_DATA_NEWLINE)
  21535. }
  21536. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21537. return int32(m_XML_TOK_DATA_CHARS)
  21538. case int32(_BT_S):
  21539. if ptr == start {
  21540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21541. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21542. }
  21543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21544. return int32(m_XML_TOK_DATA_CHARS)
  21545. default:
  21546. ptr += uintptr(2)
  21547. break
  21548. }
  21549. }
  21550. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21551. return int32(m_XML_TOK_DATA_CHARS)
  21552. }
  21553. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21554. var start uintptr
  21555. var tok, v1, v2, v3 int32
  21556. _, _, _, _, _ = start, tok, v1, v2, v3
  21557. if ptr >= end {
  21558. return -int32(4)
  21559. } else {
  21560. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21561. /* This line cannot be executed. The incoming data has already
  21562. * been tokenized once, so incomplete characters like this have
  21563. * already been eliminated from the input. Retaining the paranoia
  21564. * check is still valuable, however.
  21565. */
  21566. return -int32(1) /* LCOV_EXCL_LINE */
  21567. }
  21568. }
  21569. start = ptr
  21570. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21571. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21572. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21573. } else {
  21574. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21575. }
  21576. switch v1 {
  21577. case int32(_BT_LEAD2):
  21578. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21579. case int32(_BT_LEAD3):
  21580. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21581. case int32(_BT_LEAD4):
  21582. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21583. case int32(_BT_AMP):
  21584. if ptr == start {
  21585. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21586. }
  21587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21588. return int32(m_XML_TOK_DATA_CHARS)
  21589. case int32(_BT_PERCNT):
  21590. if ptr == start {
  21591. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21592. if tok == int32(m_XML_TOK_PERCENT) {
  21593. v2 = m_XML_TOK_INVALID
  21594. } else {
  21595. v2 = tok
  21596. }
  21597. return v2
  21598. }
  21599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21600. return int32(m_XML_TOK_DATA_CHARS)
  21601. case int32(_BT_LF):
  21602. if ptr == start {
  21603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21604. return int32(m_XML_TOK_DATA_NEWLINE)
  21605. }
  21606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21607. return int32(m_XML_TOK_DATA_CHARS)
  21608. case int32(_BT_CR):
  21609. if ptr == start {
  21610. ptr += uintptr(2)
  21611. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21612. return -int32(3)
  21613. }
  21614. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21615. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21616. } else {
  21617. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21618. }
  21619. if v3 == int32(_BT_LF) {
  21620. ptr += uintptr(2)
  21621. }
  21622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21623. return int32(m_XML_TOK_DATA_NEWLINE)
  21624. }
  21625. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21626. return int32(m_XML_TOK_DATA_CHARS)
  21627. default:
  21628. ptr += uintptr(2)
  21629. break
  21630. }
  21631. }
  21632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21633. return int32(m_XML_TOK_DATA_CHARS)
  21634. }
  21635. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21636. var level, v1 int32
  21637. var n Tsize_t
  21638. _, _, _ = level, n, v1
  21639. level = 0
  21640. if int32(2) > int32(1) {
  21641. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21642. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21643. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21644. end = ptr + uintptr(n)
  21645. }
  21646. }
  21647. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21648. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21649. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21650. } else {
  21651. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21652. }
  21653. switch v1 {
  21654. case int32(_BT_LEAD2):
  21655. if int64(end)-int64(ptr) < int64(2) {
  21656. return -int32(2)
  21657. }
  21658. if 0 != 0 {
  21659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21660. return m_XML_TOK_INVALID
  21661. }
  21662. ptr += uintptr(2)
  21663. case int32(_BT_LEAD3):
  21664. if int64(end)-int64(ptr) < int64(3) {
  21665. return -int32(2)
  21666. }
  21667. if 0 != 0 {
  21668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21669. return m_XML_TOK_INVALID
  21670. }
  21671. ptr += uintptr(3)
  21672. case int32(_BT_LEAD4):
  21673. if int64(end)-int64(ptr) < int64(4) {
  21674. return -int32(2)
  21675. }
  21676. if 0 != 0 {
  21677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21678. return m_XML_TOK_INVALID
  21679. }
  21680. ptr += uintptr(4)
  21681. case int32(_BT_NONXML):
  21682. fallthrough
  21683. case int32(_BT_MALFORM):
  21684. fallthrough
  21685. case int32(_BT_TRAIL):
  21686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21687. return m_XML_TOK_INVALID
  21688. case int32(_BT_LT):
  21689. ptr += uintptr(2)
  21690. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21691. return -int32(1)
  21692. }
  21693. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21694. ptr += uintptr(2)
  21695. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21696. return -int32(1)
  21697. }
  21698. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21699. level++
  21700. ptr += uintptr(2)
  21701. }
  21702. }
  21703. case int32(_BT_RSQB):
  21704. ptr += uintptr(2)
  21705. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21706. return -int32(1)
  21707. }
  21708. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21709. ptr += uintptr(2)
  21710. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21711. return -int32(1)
  21712. }
  21713. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21714. ptr += uintptr(2)
  21715. if level == 0 {
  21716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21717. return int32(m_XML_TOK_IGNORE_SECT)
  21718. }
  21719. level--
  21720. }
  21721. }
  21722. default:
  21723. ptr += uintptr(2)
  21724. break
  21725. }
  21726. }
  21727. return -int32(1)
  21728. }
  21729. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21730. var v2, v3, v4 int32
  21731. _, _, _ = v2, v3, v4
  21732. ptr += uintptr(2)
  21733. end -= uintptr(2)
  21734. for {
  21735. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21736. break
  21737. }
  21738. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21739. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21740. } else {
  21741. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21742. }
  21743. switch v2 {
  21744. case int32(_BT_DIGIT):
  21745. fallthrough
  21746. case int32(_BT_HEX):
  21747. fallthrough
  21748. case int32(_BT_MINUS):
  21749. fallthrough
  21750. case int32(_BT_APOS):
  21751. fallthrough
  21752. case int32(_BT_LPAR):
  21753. fallthrough
  21754. case int32(_BT_RPAR):
  21755. fallthrough
  21756. case int32(_BT_PLUS):
  21757. fallthrough
  21758. case int32(_BT_COMMA):
  21759. fallthrough
  21760. case int32(_BT_SOL):
  21761. fallthrough
  21762. case int32(_BT_EQUALS):
  21763. fallthrough
  21764. case int32(_BT_QUEST):
  21765. fallthrough
  21766. case int32(_BT_CR):
  21767. fallthrough
  21768. case int32(_BT_LF):
  21769. fallthrough
  21770. case int32(_BT_SEMI):
  21771. fallthrough
  21772. case int32(_BT_EXCL):
  21773. fallthrough
  21774. case int32(_BT_AST):
  21775. fallthrough
  21776. case int32(_BT_PERCNT):
  21777. fallthrough
  21778. case int32(_BT_NUM):
  21779. fallthrough
  21780. case int32(_BT_COLON):
  21781. case int32(_BT_S):
  21782. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  21783. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21784. return 0
  21785. }
  21786. case int32(_BT_NAME):
  21787. fallthrough
  21788. case int32(_BT_NMSTRT):
  21789. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21790. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21791. } else {
  21792. v3 = -int32(1)
  21793. }
  21794. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  21795. break
  21796. }
  21797. /* fall through */
  21798. fallthrough
  21799. default:
  21800. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21801. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21802. } else {
  21803. v4 = -int32(1)
  21804. }
  21805. switch v4 {
  21806. case int32(0x24): /* $ */
  21807. fallthrough
  21808. case int32(0x40): /* @ */
  21809. default:
  21810. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21811. return 0
  21812. }
  21813. break
  21814. }
  21815. goto _1
  21816. _1:
  21817. ;
  21818. ptr += uintptr(2)
  21819. }
  21820. return int32(1)
  21821. }
  21822. /* This must only be called for a well-formed start-tag or empty
  21823. element tag. Returns the number of attributes. Pointers to the
  21824. first attsMax attributes are stored in atts.
  21825. */
  21826. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  21827. var nAtts, open, state, v2, v3, v5, v7 int32
  21828. var v4, v6, v8, v9 bool
  21829. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  21830. state = 1
  21831. nAtts = 0
  21832. open = 0 /* defined when state == inValue;
  21833. initialization just to shut up compilers */
  21834. ptr += uintptr(2)
  21835. for {
  21836. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21837. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  21838. } else {
  21839. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  21840. }
  21841. switch v2 {
  21842. case int32(_BT_LEAD2):
  21843. if state == 0 {
  21844. if nAtts < attsMax {
  21845. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21846. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21847. }
  21848. state = 1
  21849. }
  21850. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  21851. case int32(_BT_LEAD3):
  21852. if state == 0 {
  21853. if nAtts < attsMax {
  21854. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21855. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21856. }
  21857. state = 1
  21858. }
  21859. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  21860. case int32(_BT_LEAD4):
  21861. if state == 0 {
  21862. if nAtts < attsMax {
  21863. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21864. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21865. }
  21866. state = 1
  21867. }
  21868. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  21869. case int32(_BT_NONASCII):
  21870. fallthrough
  21871. case int32(_BT_NMSTRT):
  21872. fallthrough
  21873. case int32(_BT_HEX):
  21874. if state == 0 {
  21875. if nAtts < attsMax {
  21876. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  21877. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  21878. }
  21879. state = 1
  21880. }
  21881. case int32(_BT_QUOT):
  21882. if state != 2 {
  21883. if nAtts < attsMax {
  21884. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21885. }
  21886. state = 2
  21887. open = int32(_BT_QUOT)
  21888. } else {
  21889. if open == int32(_BT_QUOT) {
  21890. state = 0
  21891. if nAtts < attsMax {
  21892. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21893. }
  21894. nAtts++
  21895. }
  21896. }
  21897. case int32(_BT_APOS):
  21898. if state != 2 {
  21899. if nAtts < attsMax {
  21900. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  21901. }
  21902. state = 2
  21903. open = int32(_BT_APOS)
  21904. } else {
  21905. if open == int32(_BT_APOS) {
  21906. state = 0
  21907. if nAtts < attsMax {
  21908. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  21909. }
  21910. nAtts++
  21911. }
  21912. }
  21913. case int32(_BT_AMP):
  21914. if nAtts < attsMax {
  21915. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  21916. }
  21917. case int32(_BT_S):
  21918. if state == 1 {
  21919. state = 0
  21920. } else {
  21921. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  21922. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  21923. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21924. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21925. } else {
  21926. v3 = -int32(1)
  21927. }
  21928. }
  21929. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  21930. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21931. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21932. } else {
  21933. v5 = -int32(1)
  21934. }
  21935. }
  21936. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  21937. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21938. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  21939. } else {
  21940. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21941. }
  21942. }
  21943. }
  21944. if v9 && (v8 || v7 == open) {
  21945. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  21946. }
  21947. }
  21948. case int32(_BT_CR):
  21949. fallthrough
  21950. case int32(_BT_LF):
  21951. /* This case ensures that the first attribute name is counted
  21952. Apart from that we could just change state on the quote. */
  21953. if state == 1 {
  21954. state = 0
  21955. } else {
  21956. if state == 2 && nAtts < attsMax {
  21957. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  21958. }
  21959. }
  21960. case int32(_BT_GT):
  21961. fallthrough
  21962. case int32(_BT_SOL):
  21963. if state != 2 {
  21964. return nAtts
  21965. }
  21966. default:
  21967. break
  21968. }
  21969. goto _1
  21970. _1:
  21971. ;
  21972. ptr += uintptr(2)
  21973. }
  21974. /* not reached */
  21975. return r
  21976. }
  21977. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  21978. var c, c1, result, v2, v4 int32
  21979. _, _, _, _, _ = c, c1, result, v2, v4
  21980. result = 0
  21981. /* skip &# */
  21982. _ = enc
  21983. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  21984. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  21985. ptr += uintptr(2)
  21986. for {
  21987. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  21988. break
  21989. }
  21990. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  21991. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  21992. } else {
  21993. v2 = -int32(1)
  21994. }
  21995. c = v2
  21996. switch c {
  21997. case int32(m_ASCII_02):
  21998. fallthrough
  21999. case int32(m_ASCII_12):
  22000. fallthrough
  22001. case int32(m_ASCII_22):
  22002. fallthrough
  22003. case int32(m_ASCII_32):
  22004. fallthrough
  22005. case int32(m_ASCII_41):
  22006. fallthrough
  22007. case int32(m_ASCII_51):
  22008. fallthrough
  22009. case int32(m_ASCII_61):
  22010. fallthrough
  22011. case int32(m_ASCII_71):
  22012. fallthrough
  22013. case int32(m_ASCII_82):
  22014. fallthrough
  22015. case int32(m_ASCII_92):
  22016. result <<= int32(4)
  22017. result |= c - int32(m_ASCII_02)
  22018. case int32(m_ASCII_A):
  22019. fallthrough
  22020. case int32(m_ASCII_B1):
  22021. fallthrough
  22022. case int32(m_ASCII_C):
  22023. fallthrough
  22024. case int32(m_ASCII_D):
  22025. fallthrough
  22026. case int32(m_ASCII_E):
  22027. fallthrough
  22028. case int32(m_ASCII_F):
  22029. result <<= int32(4)
  22030. result += int32(10) + (c - int32(m_ASCII_A))
  22031. case int32(m_ASCII_a2):
  22032. fallthrough
  22033. case int32(m_ASCII_b1):
  22034. fallthrough
  22035. case int32(m_ASCII_c2):
  22036. fallthrough
  22037. case int32(m_ASCII_d1):
  22038. fallthrough
  22039. case int32(m_ASCII_e2):
  22040. fallthrough
  22041. case int32(m_ASCII_f1):
  22042. result <<= int32(4)
  22043. result += int32(10) + (c - int32(m_ASCII_a2))
  22044. break
  22045. }
  22046. if result >= int32(0x110000) {
  22047. return -int32(1)
  22048. }
  22049. goto _1
  22050. _1:
  22051. ;
  22052. ptr += uintptr(2)
  22053. }
  22054. } else {
  22055. for {
  22056. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22057. break
  22058. }
  22059. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22060. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22061. } else {
  22062. v4 = -int32(1)
  22063. }
  22064. c1 = v4
  22065. result *= int32(10)
  22066. result += c1 - int32(m_ASCII_02)
  22067. if result >= int32(0x110000) {
  22068. return -int32(1)
  22069. }
  22070. goto _3
  22071. _3:
  22072. ;
  22073. ptr += uintptr(2)
  22074. }
  22075. }
  22076. return _checkCharRefNumber(tls, result)
  22077. }
  22078. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22079. var v1, v2 int32
  22080. _, _ = v1, v2
  22081. _ = enc
  22082. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  22083. case int64(2):
  22084. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22085. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22086. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22087. } else {
  22088. v1 = -int32(1)
  22089. }
  22090. switch v1 {
  22091. case int32(m_ASCII_l2):
  22092. return int32(m_ASCII_LT1)
  22093. case int32(m_ASCII_g2):
  22094. return int32(m_ASCII_GT1)
  22095. }
  22096. }
  22097. case int64(3):
  22098. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22099. ptr += uintptr(2)
  22100. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22101. ptr += uintptr(2)
  22102. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22103. return int32(m_ASCII_AMP1)
  22104. }
  22105. }
  22106. }
  22107. case int64(4):
  22108. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22109. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  22110. } else {
  22111. v2 = -int32(1)
  22112. }
  22113. switch v2 {
  22114. case int32(m_ASCII_q1):
  22115. ptr += uintptr(2)
  22116. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22117. ptr += uintptr(2)
  22118. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22119. ptr += uintptr(2)
  22120. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22121. return int32(m_ASCII_QUOT1)
  22122. }
  22123. }
  22124. }
  22125. case int32(m_ASCII_a2):
  22126. ptr += uintptr(2)
  22127. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22128. ptr += uintptr(2)
  22129. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22130. ptr += uintptr(2)
  22131. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22132. return int32(m_ASCII_APOS1)
  22133. }
  22134. }
  22135. }
  22136. break
  22137. }
  22138. }
  22139. return 0
  22140. }
  22141. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22142. _ = enc
  22143. for {
  22144. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  22145. break
  22146. }
  22147. if int64(end1)-int64(ptr1) < int64(2) {
  22148. /* This line cannot be executed. The incoming data has already
  22149. * been tokenized once, so incomplete characters like this have
  22150. * already been eliminated from the input. Retaining the
  22151. * paranoia check is still valuable, however.
  22152. */
  22153. return 0 /* LCOV_EXCL_LINE */
  22154. }
  22155. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  22156. return 0
  22157. }
  22158. goto _1
  22159. _1:
  22160. ;
  22161. ptr1 += uintptr(2)
  22162. ptr2++
  22163. }
  22164. return libc.BoolInt32(ptr1 == end1)
  22165. }
  22166. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22167. var start uintptr
  22168. var v2 int32
  22169. _, _ = start, v2
  22170. start = ptr
  22171. for {
  22172. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22173. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22174. } else {
  22175. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22176. }
  22177. switch v2 {
  22178. case int32(_BT_LEAD2):
  22179. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22180. case int32(_BT_LEAD3):
  22181. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22182. case int32(_BT_LEAD4):
  22183. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22184. case int32(_BT_NONASCII):
  22185. fallthrough
  22186. case int32(_BT_NMSTRT):
  22187. fallthrough
  22188. case int32(_BT_COLON):
  22189. fallthrough
  22190. case int32(_BT_HEX):
  22191. fallthrough
  22192. case int32(_BT_DIGIT):
  22193. fallthrough
  22194. case int32(_BT_NAME):
  22195. fallthrough
  22196. case int32(_BT_MINUS):
  22197. ptr += uintptr(2)
  22198. default:
  22199. return int32(int64(ptr) - int64(start))
  22200. }
  22201. goto _1
  22202. _1:
  22203. }
  22204. return r
  22205. }
  22206. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22207. var v2 int32
  22208. _ = v2
  22209. for {
  22210. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22211. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22212. } else {
  22213. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22214. }
  22215. switch v2 {
  22216. case int32(_BT_LF):
  22217. fallthrough
  22218. case int32(_BT_CR):
  22219. fallthrough
  22220. case int32(_BT_S):
  22221. ptr += uintptr(2)
  22222. default:
  22223. return ptr
  22224. }
  22225. goto _1
  22226. _1:
  22227. }
  22228. return r
  22229. }
  22230. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22231. var v1, v2 int32
  22232. var v3 bool
  22233. _, _, _ = v1, v2, v3
  22234. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22235. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22236. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22237. } else {
  22238. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22239. }
  22240. switch v1 {
  22241. case int32(_BT_LEAD2):
  22242. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22243. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22244. case int32(_BT_LEAD3):
  22245. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22246. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22247. case int32(_BT_LEAD4):
  22248. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22249. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22250. case int32(_BT_LF):
  22251. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22252. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22253. ptr += uintptr(2)
  22254. case int32(_BT_CR):
  22255. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22256. ptr += uintptr(2)
  22257. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  22258. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  22259. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  22260. } else {
  22261. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  22262. }
  22263. }
  22264. if v3 && v2 == int32(_BT_LF) {
  22265. ptr += uintptr(2)
  22266. }
  22267. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  22268. default:
  22269. ptr += uintptr(2)
  22270. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22271. break
  22272. }
  22273. }
  22274. }
  22275. var _little2_encoding_ns = Tnormal_encoding{
  22276. Fenc: TENCODING{
  22277. Fscanners: [4]TSCANNER{},
  22278. FliteralScanners: [2]TSCANNER{},
  22279. FminBytesPerChar: int32(2),
  22280. FisUtf16: uint8(1),
  22281. },
  22282. Ftype1: [256]uint8{
  22283. 9: uint8(_BT_S),
  22284. 10: uint8(_BT_LF),
  22285. 13: uint8(_BT_CR),
  22286. 32: uint8(_BT_S),
  22287. 33: uint8(_BT_EXCL),
  22288. 34: uint8(_BT_QUOT),
  22289. 35: uint8(_BT_NUM),
  22290. 36: uint8(_BT_OTHER),
  22291. 37: uint8(_BT_PERCNT),
  22292. 38: uint8(_BT_AMP),
  22293. 39: uint8(_BT_APOS),
  22294. 40: uint8(_BT_LPAR),
  22295. 41: uint8(_BT_RPAR),
  22296. 42: uint8(_BT_AST),
  22297. 43: uint8(_BT_PLUS),
  22298. 44: uint8(_BT_COMMA),
  22299. 45: uint8(_BT_MINUS),
  22300. 46: uint8(_BT_NAME),
  22301. 47: uint8(_BT_SOL),
  22302. 48: uint8(_BT_DIGIT),
  22303. 49: uint8(_BT_DIGIT),
  22304. 50: uint8(_BT_DIGIT),
  22305. 51: uint8(_BT_DIGIT),
  22306. 52: uint8(_BT_DIGIT),
  22307. 53: uint8(_BT_DIGIT),
  22308. 54: uint8(_BT_DIGIT),
  22309. 55: uint8(_BT_DIGIT),
  22310. 56: uint8(_BT_DIGIT),
  22311. 57: uint8(_BT_DIGIT),
  22312. 58: uint8(_BT_COLON),
  22313. 59: uint8(_BT_SEMI),
  22314. 60: uint8(_BT_LT),
  22315. 61: uint8(_BT_EQUALS),
  22316. 62: uint8(_BT_GT),
  22317. 63: uint8(_BT_QUEST),
  22318. 64: uint8(_BT_OTHER),
  22319. 65: uint8(_BT_HEX),
  22320. 66: uint8(_BT_HEX),
  22321. 67: uint8(_BT_HEX),
  22322. 68: uint8(_BT_HEX),
  22323. 69: uint8(_BT_HEX),
  22324. 70: uint8(_BT_HEX),
  22325. 71: uint8(_BT_NMSTRT),
  22326. 72: uint8(_BT_NMSTRT),
  22327. 73: uint8(_BT_NMSTRT),
  22328. 74: uint8(_BT_NMSTRT),
  22329. 75: uint8(_BT_NMSTRT),
  22330. 76: uint8(_BT_NMSTRT),
  22331. 77: uint8(_BT_NMSTRT),
  22332. 78: uint8(_BT_NMSTRT),
  22333. 79: uint8(_BT_NMSTRT),
  22334. 80: uint8(_BT_NMSTRT),
  22335. 81: uint8(_BT_NMSTRT),
  22336. 82: uint8(_BT_NMSTRT),
  22337. 83: uint8(_BT_NMSTRT),
  22338. 84: uint8(_BT_NMSTRT),
  22339. 85: uint8(_BT_NMSTRT),
  22340. 86: uint8(_BT_NMSTRT),
  22341. 87: uint8(_BT_NMSTRT),
  22342. 88: uint8(_BT_NMSTRT),
  22343. 89: uint8(_BT_NMSTRT),
  22344. 90: uint8(_BT_NMSTRT),
  22345. 91: uint8(_BT_LSQB),
  22346. 92: uint8(_BT_OTHER),
  22347. 93: uint8(_BT_RSQB),
  22348. 94: uint8(_BT_OTHER),
  22349. 95: uint8(_BT_NMSTRT),
  22350. 96: uint8(_BT_OTHER),
  22351. 97: uint8(_BT_HEX),
  22352. 98: uint8(_BT_HEX),
  22353. 99: uint8(_BT_HEX),
  22354. 100: uint8(_BT_HEX),
  22355. 101: uint8(_BT_HEX),
  22356. 102: uint8(_BT_HEX),
  22357. 103: uint8(_BT_NMSTRT),
  22358. 104: uint8(_BT_NMSTRT),
  22359. 105: uint8(_BT_NMSTRT),
  22360. 106: uint8(_BT_NMSTRT),
  22361. 107: uint8(_BT_NMSTRT),
  22362. 108: uint8(_BT_NMSTRT),
  22363. 109: uint8(_BT_NMSTRT),
  22364. 110: uint8(_BT_NMSTRT),
  22365. 111: uint8(_BT_NMSTRT),
  22366. 112: uint8(_BT_NMSTRT),
  22367. 113: uint8(_BT_NMSTRT),
  22368. 114: uint8(_BT_NMSTRT),
  22369. 115: uint8(_BT_NMSTRT),
  22370. 116: uint8(_BT_NMSTRT),
  22371. 117: uint8(_BT_NMSTRT),
  22372. 118: uint8(_BT_NMSTRT),
  22373. 119: uint8(_BT_NMSTRT),
  22374. 120: uint8(_BT_NMSTRT),
  22375. 121: uint8(_BT_NMSTRT),
  22376. 122: uint8(_BT_NMSTRT),
  22377. 123: uint8(_BT_OTHER),
  22378. 124: uint8(_BT_VERBAR),
  22379. 125: uint8(_BT_OTHER),
  22380. 126: uint8(_BT_OTHER),
  22381. 127: uint8(_BT_OTHER),
  22382. 128: uint8(_BT_OTHER),
  22383. 129: uint8(_BT_OTHER),
  22384. 130: uint8(_BT_OTHER),
  22385. 131: uint8(_BT_OTHER),
  22386. 132: uint8(_BT_OTHER),
  22387. 133: uint8(_BT_OTHER),
  22388. 134: uint8(_BT_OTHER),
  22389. 135: uint8(_BT_OTHER),
  22390. 136: uint8(_BT_OTHER),
  22391. 137: uint8(_BT_OTHER),
  22392. 138: uint8(_BT_OTHER),
  22393. 139: uint8(_BT_OTHER),
  22394. 140: uint8(_BT_OTHER),
  22395. 141: uint8(_BT_OTHER),
  22396. 142: uint8(_BT_OTHER),
  22397. 143: uint8(_BT_OTHER),
  22398. 144: uint8(_BT_OTHER),
  22399. 145: uint8(_BT_OTHER),
  22400. 146: uint8(_BT_OTHER),
  22401. 147: uint8(_BT_OTHER),
  22402. 148: uint8(_BT_OTHER),
  22403. 149: uint8(_BT_OTHER),
  22404. 150: uint8(_BT_OTHER),
  22405. 151: uint8(_BT_OTHER),
  22406. 152: uint8(_BT_OTHER),
  22407. 153: uint8(_BT_OTHER),
  22408. 154: uint8(_BT_OTHER),
  22409. 155: uint8(_BT_OTHER),
  22410. 156: uint8(_BT_OTHER),
  22411. 157: uint8(_BT_OTHER),
  22412. 158: uint8(_BT_OTHER),
  22413. 159: uint8(_BT_OTHER),
  22414. 160: uint8(_BT_OTHER),
  22415. 161: uint8(_BT_OTHER),
  22416. 162: uint8(_BT_OTHER),
  22417. 163: uint8(_BT_OTHER),
  22418. 164: uint8(_BT_OTHER),
  22419. 165: uint8(_BT_OTHER),
  22420. 166: uint8(_BT_OTHER),
  22421. 167: uint8(_BT_OTHER),
  22422. 168: uint8(_BT_OTHER),
  22423. 169: uint8(_BT_OTHER),
  22424. 170: uint8(_BT_NMSTRT),
  22425. 171: uint8(_BT_OTHER),
  22426. 172: uint8(_BT_OTHER),
  22427. 173: uint8(_BT_OTHER),
  22428. 174: uint8(_BT_OTHER),
  22429. 175: uint8(_BT_OTHER),
  22430. 176: uint8(_BT_OTHER),
  22431. 177: uint8(_BT_OTHER),
  22432. 178: uint8(_BT_OTHER),
  22433. 179: uint8(_BT_OTHER),
  22434. 180: uint8(_BT_OTHER),
  22435. 181: uint8(_BT_NMSTRT),
  22436. 182: uint8(_BT_OTHER),
  22437. 183: uint8(_BT_NAME),
  22438. 184: uint8(_BT_OTHER),
  22439. 185: uint8(_BT_OTHER),
  22440. 186: uint8(_BT_NMSTRT),
  22441. 187: uint8(_BT_OTHER),
  22442. 188: uint8(_BT_OTHER),
  22443. 189: uint8(_BT_OTHER),
  22444. 190: uint8(_BT_OTHER),
  22445. 191: uint8(_BT_OTHER),
  22446. 192: uint8(_BT_NMSTRT),
  22447. 193: uint8(_BT_NMSTRT),
  22448. 194: uint8(_BT_NMSTRT),
  22449. 195: uint8(_BT_NMSTRT),
  22450. 196: uint8(_BT_NMSTRT),
  22451. 197: uint8(_BT_NMSTRT),
  22452. 198: uint8(_BT_NMSTRT),
  22453. 199: uint8(_BT_NMSTRT),
  22454. 200: uint8(_BT_NMSTRT),
  22455. 201: uint8(_BT_NMSTRT),
  22456. 202: uint8(_BT_NMSTRT),
  22457. 203: uint8(_BT_NMSTRT),
  22458. 204: uint8(_BT_NMSTRT),
  22459. 205: uint8(_BT_NMSTRT),
  22460. 206: uint8(_BT_NMSTRT),
  22461. 207: uint8(_BT_NMSTRT),
  22462. 208: uint8(_BT_NMSTRT),
  22463. 209: uint8(_BT_NMSTRT),
  22464. 210: uint8(_BT_NMSTRT),
  22465. 211: uint8(_BT_NMSTRT),
  22466. 212: uint8(_BT_NMSTRT),
  22467. 213: uint8(_BT_NMSTRT),
  22468. 214: uint8(_BT_NMSTRT),
  22469. 215: uint8(_BT_OTHER),
  22470. 216: uint8(_BT_NMSTRT),
  22471. 217: uint8(_BT_NMSTRT),
  22472. 218: uint8(_BT_NMSTRT),
  22473. 219: uint8(_BT_NMSTRT),
  22474. 220: uint8(_BT_NMSTRT),
  22475. 221: uint8(_BT_NMSTRT),
  22476. 222: uint8(_BT_NMSTRT),
  22477. 223: uint8(_BT_NMSTRT),
  22478. 224: uint8(_BT_NMSTRT),
  22479. 225: uint8(_BT_NMSTRT),
  22480. 226: uint8(_BT_NMSTRT),
  22481. 227: uint8(_BT_NMSTRT),
  22482. 228: uint8(_BT_NMSTRT),
  22483. 229: uint8(_BT_NMSTRT),
  22484. 230: uint8(_BT_NMSTRT),
  22485. 231: uint8(_BT_NMSTRT),
  22486. 232: uint8(_BT_NMSTRT),
  22487. 233: uint8(_BT_NMSTRT),
  22488. 234: uint8(_BT_NMSTRT),
  22489. 235: uint8(_BT_NMSTRT),
  22490. 236: uint8(_BT_NMSTRT),
  22491. 237: uint8(_BT_NMSTRT),
  22492. 238: uint8(_BT_NMSTRT),
  22493. 239: uint8(_BT_NMSTRT),
  22494. 240: uint8(_BT_NMSTRT),
  22495. 241: uint8(_BT_NMSTRT),
  22496. 242: uint8(_BT_NMSTRT),
  22497. 243: uint8(_BT_NMSTRT),
  22498. 244: uint8(_BT_NMSTRT),
  22499. 245: uint8(_BT_NMSTRT),
  22500. 246: uint8(_BT_NMSTRT),
  22501. 247: uint8(_BT_OTHER),
  22502. 248: uint8(_BT_NMSTRT),
  22503. 249: uint8(_BT_NMSTRT),
  22504. 250: uint8(_BT_NMSTRT),
  22505. 251: uint8(_BT_NMSTRT),
  22506. 252: uint8(_BT_NMSTRT),
  22507. 253: uint8(_BT_NMSTRT),
  22508. 254: uint8(_BT_NMSTRT),
  22509. 255: uint8(_BT_NMSTRT),
  22510. },
  22511. }
  22512. func init() {
  22513. p := unsafe.Pointer(&_little2_encoding_ns)
  22514. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22515. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22516. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22517. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22518. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22519. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22520. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22521. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22522. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22523. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22524. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22525. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22526. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22527. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22528. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22529. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22530. }
  22531. var _little2_encoding = Tnormal_encoding{
  22532. Fenc: TENCODING{
  22533. Fscanners: [4]TSCANNER{},
  22534. FliteralScanners: [2]TSCANNER{},
  22535. FminBytesPerChar: int32(2),
  22536. FisUtf16: uint8(1),
  22537. },
  22538. Ftype1: [256]uint8{
  22539. 9: uint8(_BT_S),
  22540. 10: uint8(_BT_LF),
  22541. 13: uint8(_BT_CR),
  22542. 32: uint8(_BT_S),
  22543. 33: uint8(_BT_EXCL),
  22544. 34: uint8(_BT_QUOT),
  22545. 35: uint8(_BT_NUM),
  22546. 36: uint8(_BT_OTHER),
  22547. 37: uint8(_BT_PERCNT),
  22548. 38: uint8(_BT_AMP),
  22549. 39: uint8(_BT_APOS),
  22550. 40: uint8(_BT_LPAR),
  22551. 41: uint8(_BT_RPAR),
  22552. 42: uint8(_BT_AST),
  22553. 43: uint8(_BT_PLUS),
  22554. 44: uint8(_BT_COMMA),
  22555. 45: uint8(_BT_MINUS),
  22556. 46: uint8(_BT_NAME),
  22557. 47: uint8(_BT_SOL),
  22558. 48: uint8(_BT_DIGIT),
  22559. 49: uint8(_BT_DIGIT),
  22560. 50: uint8(_BT_DIGIT),
  22561. 51: uint8(_BT_DIGIT),
  22562. 52: uint8(_BT_DIGIT),
  22563. 53: uint8(_BT_DIGIT),
  22564. 54: uint8(_BT_DIGIT),
  22565. 55: uint8(_BT_DIGIT),
  22566. 56: uint8(_BT_DIGIT),
  22567. 57: uint8(_BT_DIGIT),
  22568. 58: uint8(_BT_NMSTRT),
  22569. 59: uint8(_BT_SEMI),
  22570. 60: uint8(_BT_LT),
  22571. 61: uint8(_BT_EQUALS),
  22572. 62: uint8(_BT_GT),
  22573. 63: uint8(_BT_QUEST),
  22574. 64: uint8(_BT_OTHER),
  22575. 65: uint8(_BT_HEX),
  22576. 66: uint8(_BT_HEX),
  22577. 67: uint8(_BT_HEX),
  22578. 68: uint8(_BT_HEX),
  22579. 69: uint8(_BT_HEX),
  22580. 70: uint8(_BT_HEX),
  22581. 71: uint8(_BT_NMSTRT),
  22582. 72: uint8(_BT_NMSTRT),
  22583. 73: uint8(_BT_NMSTRT),
  22584. 74: uint8(_BT_NMSTRT),
  22585. 75: uint8(_BT_NMSTRT),
  22586. 76: uint8(_BT_NMSTRT),
  22587. 77: uint8(_BT_NMSTRT),
  22588. 78: uint8(_BT_NMSTRT),
  22589. 79: uint8(_BT_NMSTRT),
  22590. 80: uint8(_BT_NMSTRT),
  22591. 81: uint8(_BT_NMSTRT),
  22592. 82: uint8(_BT_NMSTRT),
  22593. 83: uint8(_BT_NMSTRT),
  22594. 84: uint8(_BT_NMSTRT),
  22595. 85: uint8(_BT_NMSTRT),
  22596. 86: uint8(_BT_NMSTRT),
  22597. 87: uint8(_BT_NMSTRT),
  22598. 88: uint8(_BT_NMSTRT),
  22599. 89: uint8(_BT_NMSTRT),
  22600. 90: uint8(_BT_NMSTRT),
  22601. 91: uint8(_BT_LSQB),
  22602. 92: uint8(_BT_OTHER),
  22603. 93: uint8(_BT_RSQB),
  22604. 94: uint8(_BT_OTHER),
  22605. 95: uint8(_BT_NMSTRT),
  22606. 96: uint8(_BT_OTHER),
  22607. 97: uint8(_BT_HEX),
  22608. 98: uint8(_BT_HEX),
  22609. 99: uint8(_BT_HEX),
  22610. 100: uint8(_BT_HEX),
  22611. 101: uint8(_BT_HEX),
  22612. 102: uint8(_BT_HEX),
  22613. 103: uint8(_BT_NMSTRT),
  22614. 104: uint8(_BT_NMSTRT),
  22615. 105: uint8(_BT_NMSTRT),
  22616. 106: uint8(_BT_NMSTRT),
  22617. 107: uint8(_BT_NMSTRT),
  22618. 108: uint8(_BT_NMSTRT),
  22619. 109: uint8(_BT_NMSTRT),
  22620. 110: uint8(_BT_NMSTRT),
  22621. 111: uint8(_BT_NMSTRT),
  22622. 112: uint8(_BT_NMSTRT),
  22623. 113: uint8(_BT_NMSTRT),
  22624. 114: uint8(_BT_NMSTRT),
  22625. 115: uint8(_BT_NMSTRT),
  22626. 116: uint8(_BT_NMSTRT),
  22627. 117: uint8(_BT_NMSTRT),
  22628. 118: uint8(_BT_NMSTRT),
  22629. 119: uint8(_BT_NMSTRT),
  22630. 120: uint8(_BT_NMSTRT),
  22631. 121: uint8(_BT_NMSTRT),
  22632. 122: uint8(_BT_NMSTRT),
  22633. 123: uint8(_BT_OTHER),
  22634. 124: uint8(_BT_VERBAR),
  22635. 125: uint8(_BT_OTHER),
  22636. 126: uint8(_BT_OTHER),
  22637. 127: uint8(_BT_OTHER),
  22638. 128: uint8(_BT_OTHER),
  22639. 129: uint8(_BT_OTHER),
  22640. 130: uint8(_BT_OTHER),
  22641. 131: uint8(_BT_OTHER),
  22642. 132: uint8(_BT_OTHER),
  22643. 133: uint8(_BT_OTHER),
  22644. 134: uint8(_BT_OTHER),
  22645. 135: uint8(_BT_OTHER),
  22646. 136: uint8(_BT_OTHER),
  22647. 137: uint8(_BT_OTHER),
  22648. 138: uint8(_BT_OTHER),
  22649. 139: uint8(_BT_OTHER),
  22650. 140: uint8(_BT_OTHER),
  22651. 141: uint8(_BT_OTHER),
  22652. 142: uint8(_BT_OTHER),
  22653. 143: uint8(_BT_OTHER),
  22654. 144: uint8(_BT_OTHER),
  22655. 145: uint8(_BT_OTHER),
  22656. 146: uint8(_BT_OTHER),
  22657. 147: uint8(_BT_OTHER),
  22658. 148: uint8(_BT_OTHER),
  22659. 149: uint8(_BT_OTHER),
  22660. 150: uint8(_BT_OTHER),
  22661. 151: uint8(_BT_OTHER),
  22662. 152: uint8(_BT_OTHER),
  22663. 153: uint8(_BT_OTHER),
  22664. 154: uint8(_BT_OTHER),
  22665. 155: uint8(_BT_OTHER),
  22666. 156: uint8(_BT_OTHER),
  22667. 157: uint8(_BT_OTHER),
  22668. 158: uint8(_BT_OTHER),
  22669. 159: uint8(_BT_OTHER),
  22670. 160: uint8(_BT_OTHER),
  22671. 161: uint8(_BT_OTHER),
  22672. 162: uint8(_BT_OTHER),
  22673. 163: uint8(_BT_OTHER),
  22674. 164: uint8(_BT_OTHER),
  22675. 165: uint8(_BT_OTHER),
  22676. 166: uint8(_BT_OTHER),
  22677. 167: uint8(_BT_OTHER),
  22678. 168: uint8(_BT_OTHER),
  22679. 169: uint8(_BT_OTHER),
  22680. 170: uint8(_BT_NMSTRT),
  22681. 171: uint8(_BT_OTHER),
  22682. 172: uint8(_BT_OTHER),
  22683. 173: uint8(_BT_OTHER),
  22684. 174: uint8(_BT_OTHER),
  22685. 175: uint8(_BT_OTHER),
  22686. 176: uint8(_BT_OTHER),
  22687. 177: uint8(_BT_OTHER),
  22688. 178: uint8(_BT_OTHER),
  22689. 179: uint8(_BT_OTHER),
  22690. 180: uint8(_BT_OTHER),
  22691. 181: uint8(_BT_NMSTRT),
  22692. 182: uint8(_BT_OTHER),
  22693. 183: uint8(_BT_NAME),
  22694. 184: uint8(_BT_OTHER),
  22695. 185: uint8(_BT_OTHER),
  22696. 186: uint8(_BT_NMSTRT),
  22697. 187: uint8(_BT_OTHER),
  22698. 188: uint8(_BT_OTHER),
  22699. 189: uint8(_BT_OTHER),
  22700. 190: uint8(_BT_OTHER),
  22701. 191: uint8(_BT_OTHER),
  22702. 192: uint8(_BT_NMSTRT),
  22703. 193: uint8(_BT_NMSTRT),
  22704. 194: uint8(_BT_NMSTRT),
  22705. 195: uint8(_BT_NMSTRT),
  22706. 196: uint8(_BT_NMSTRT),
  22707. 197: uint8(_BT_NMSTRT),
  22708. 198: uint8(_BT_NMSTRT),
  22709. 199: uint8(_BT_NMSTRT),
  22710. 200: uint8(_BT_NMSTRT),
  22711. 201: uint8(_BT_NMSTRT),
  22712. 202: uint8(_BT_NMSTRT),
  22713. 203: uint8(_BT_NMSTRT),
  22714. 204: uint8(_BT_NMSTRT),
  22715. 205: uint8(_BT_NMSTRT),
  22716. 206: uint8(_BT_NMSTRT),
  22717. 207: uint8(_BT_NMSTRT),
  22718. 208: uint8(_BT_NMSTRT),
  22719. 209: uint8(_BT_NMSTRT),
  22720. 210: uint8(_BT_NMSTRT),
  22721. 211: uint8(_BT_NMSTRT),
  22722. 212: uint8(_BT_NMSTRT),
  22723. 213: uint8(_BT_NMSTRT),
  22724. 214: uint8(_BT_NMSTRT),
  22725. 215: uint8(_BT_OTHER),
  22726. 216: uint8(_BT_NMSTRT),
  22727. 217: uint8(_BT_NMSTRT),
  22728. 218: uint8(_BT_NMSTRT),
  22729. 219: uint8(_BT_NMSTRT),
  22730. 220: uint8(_BT_NMSTRT),
  22731. 221: uint8(_BT_NMSTRT),
  22732. 222: uint8(_BT_NMSTRT),
  22733. 223: uint8(_BT_NMSTRT),
  22734. 224: uint8(_BT_NMSTRT),
  22735. 225: uint8(_BT_NMSTRT),
  22736. 226: uint8(_BT_NMSTRT),
  22737. 227: uint8(_BT_NMSTRT),
  22738. 228: uint8(_BT_NMSTRT),
  22739. 229: uint8(_BT_NMSTRT),
  22740. 230: uint8(_BT_NMSTRT),
  22741. 231: uint8(_BT_NMSTRT),
  22742. 232: uint8(_BT_NMSTRT),
  22743. 233: uint8(_BT_NMSTRT),
  22744. 234: uint8(_BT_NMSTRT),
  22745. 235: uint8(_BT_NMSTRT),
  22746. 236: uint8(_BT_NMSTRT),
  22747. 237: uint8(_BT_NMSTRT),
  22748. 238: uint8(_BT_NMSTRT),
  22749. 239: uint8(_BT_NMSTRT),
  22750. 240: uint8(_BT_NMSTRT),
  22751. 241: uint8(_BT_NMSTRT),
  22752. 242: uint8(_BT_NMSTRT),
  22753. 243: uint8(_BT_NMSTRT),
  22754. 244: uint8(_BT_NMSTRT),
  22755. 245: uint8(_BT_NMSTRT),
  22756. 246: uint8(_BT_NMSTRT),
  22757. 247: uint8(_BT_OTHER),
  22758. 248: uint8(_BT_NMSTRT),
  22759. 249: uint8(_BT_NMSTRT),
  22760. 250: uint8(_BT_NMSTRT),
  22761. 251: uint8(_BT_NMSTRT),
  22762. 252: uint8(_BT_NMSTRT),
  22763. 253: uint8(_BT_NMSTRT),
  22764. 254: uint8(_BT_NMSTRT),
  22765. 255: uint8(_BT_NMSTRT),
  22766. },
  22767. }
  22768. func init() {
  22769. p := unsafe.Pointer(&_little2_encoding)
  22770. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22771. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  22772. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  22773. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  22774. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  22775. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  22776. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  22777. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  22778. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  22779. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  22780. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  22781. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  22782. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  22783. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  22784. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  22785. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  22786. }
  22787. var _internal_little2_encoding_ns = Tnormal_encoding{
  22788. Fenc: TENCODING{
  22789. Fscanners: [4]TSCANNER{},
  22790. FliteralScanners: [2]TSCANNER{},
  22791. FminBytesPerChar: int32(2),
  22792. FisUtf16: uint8(1),
  22793. },
  22794. Ftype1: [256]uint8{
  22795. 9: uint8(_BT_S),
  22796. 10: uint8(_BT_LF),
  22797. 13: uint8(_BT_S),
  22798. 32: uint8(_BT_S),
  22799. 33: uint8(_BT_EXCL),
  22800. 34: uint8(_BT_QUOT),
  22801. 35: uint8(_BT_NUM),
  22802. 36: uint8(_BT_OTHER),
  22803. 37: uint8(_BT_PERCNT),
  22804. 38: uint8(_BT_AMP),
  22805. 39: uint8(_BT_APOS),
  22806. 40: uint8(_BT_LPAR),
  22807. 41: uint8(_BT_RPAR),
  22808. 42: uint8(_BT_AST),
  22809. 43: uint8(_BT_PLUS),
  22810. 44: uint8(_BT_COMMA),
  22811. 45: uint8(_BT_MINUS),
  22812. 46: uint8(_BT_NAME),
  22813. 47: uint8(_BT_SOL),
  22814. 48: uint8(_BT_DIGIT),
  22815. 49: uint8(_BT_DIGIT),
  22816. 50: uint8(_BT_DIGIT),
  22817. 51: uint8(_BT_DIGIT),
  22818. 52: uint8(_BT_DIGIT),
  22819. 53: uint8(_BT_DIGIT),
  22820. 54: uint8(_BT_DIGIT),
  22821. 55: uint8(_BT_DIGIT),
  22822. 56: uint8(_BT_DIGIT),
  22823. 57: uint8(_BT_DIGIT),
  22824. 58: uint8(_BT_COLON),
  22825. 59: uint8(_BT_SEMI),
  22826. 60: uint8(_BT_LT),
  22827. 61: uint8(_BT_EQUALS),
  22828. 62: uint8(_BT_GT),
  22829. 63: uint8(_BT_QUEST),
  22830. 64: uint8(_BT_OTHER),
  22831. 65: uint8(_BT_HEX),
  22832. 66: uint8(_BT_HEX),
  22833. 67: uint8(_BT_HEX),
  22834. 68: uint8(_BT_HEX),
  22835. 69: uint8(_BT_HEX),
  22836. 70: uint8(_BT_HEX),
  22837. 71: uint8(_BT_NMSTRT),
  22838. 72: uint8(_BT_NMSTRT),
  22839. 73: uint8(_BT_NMSTRT),
  22840. 74: uint8(_BT_NMSTRT),
  22841. 75: uint8(_BT_NMSTRT),
  22842. 76: uint8(_BT_NMSTRT),
  22843. 77: uint8(_BT_NMSTRT),
  22844. 78: uint8(_BT_NMSTRT),
  22845. 79: uint8(_BT_NMSTRT),
  22846. 80: uint8(_BT_NMSTRT),
  22847. 81: uint8(_BT_NMSTRT),
  22848. 82: uint8(_BT_NMSTRT),
  22849. 83: uint8(_BT_NMSTRT),
  22850. 84: uint8(_BT_NMSTRT),
  22851. 85: uint8(_BT_NMSTRT),
  22852. 86: uint8(_BT_NMSTRT),
  22853. 87: uint8(_BT_NMSTRT),
  22854. 88: uint8(_BT_NMSTRT),
  22855. 89: uint8(_BT_NMSTRT),
  22856. 90: uint8(_BT_NMSTRT),
  22857. 91: uint8(_BT_LSQB),
  22858. 92: uint8(_BT_OTHER),
  22859. 93: uint8(_BT_RSQB),
  22860. 94: uint8(_BT_OTHER),
  22861. 95: uint8(_BT_NMSTRT),
  22862. 96: uint8(_BT_OTHER),
  22863. 97: uint8(_BT_HEX),
  22864. 98: uint8(_BT_HEX),
  22865. 99: uint8(_BT_HEX),
  22866. 100: uint8(_BT_HEX),
  22867. 101: uint8(_BT_HEX),
  22868. 102: uint8(_BT_HEX),
  22869. 103: uint8(_BT_NMSTRT),
  22870. 104: uint8(_BT_NMSTRT),
  22871. 105: uint8(_BT_NMSTRT),
  22872. 106: uint8(_BT_NMSTRT),
  22873. 107: uint8(_BT_NMSTRT),
  22874. 108: uint8(_BT_NMSTRT),
  22875. 109: uint8(_BT_NMSTRT),
  22876. 110: uint8(_BT_NMSTRT),
  22877. 111: uint8(_BT_NMSTRT),
  22878. 112: uint8(_BT_NMSTRT),
  22879. 113: uint8(_BT_NMSTRT),
  22880. 114: uint8(_BT_NMSTRT),
  22881. 115: uint8(_BT_NMSTRT),
  22882. 116: uint8(_BT_NMSTRT),
  22883. 117: uint8(_BT_NMSTRT),
  22884. 118: uint8(_BT_NMSTRT),
  22885. 119: uint8(_BT_NMSTRT),
  22886. 120: uint8(_BT_NMSTRT),
  22887. 121: uint8(_BT_NMSTRT),
  22888. 122: uint8(_BT_NMSTRT),
  22889. 123: uint8(_BT_OTHER),
  22890. 124: uint8(_BT_VERBAR),
  22891. 125: uint8(_BT_OTHER),
  22892. 126: uint8(_BT_OTHER),
  22893. 127: uint8(_BT_OTHER),
  22894. 128: uint8(_BT_OTHER),
  22895. 129: uint8(_BT_OTHER),
  22896. 130: uint8(_BT_OTHER),
  22897. 131: uint8(_BT_OTHER),
  22898. 132: uint8(_BT_OTHER),
  22899. 133: uint8(_BT_OTHER),
  22900. 134: uint8(_BT_OTHER),
  22901. 135: uint8(_BT_OTHER),
  22902. 136: uint8(_BT_OTHER),
  22903. 137: uint8(_BT_OTHER),
  22904. 138: uint8(_BT_OTHER),
  22905. 139: uint8(_BT_OTHER),
  22906. 140: uint8(_BT_OTHER),
  22907. 141: uint8(_BT_OTHER),
  22908. 142: uint8(_BT_OTHER),
  22909. 143: uint8(_BT_OTHER),
  22910. 144: uint8(_BT_OTHER),
  22911. 145: uint8(_BT_OTHER),
  22912. 146: uint8(_BT_OTHER),
  22913. 147: uint8(_BT_OTHER),
  22914. 148: uint8(_BT_OTHER),
  22915. 149: uint8(_BT_OTHER),
  22916. 150: uint8(_BT_OTHER),
  22917. 151: uint8(_BT_OTHER),
  22918. 152: uint8(_BT_OTHER),
  22919. 153: uint8(_BT_OTHER),
  22920. 154: uint8(_BT_OTHER),
  22921. 155: uint8(_BT_OTHER),
  22922. 156: uint8(_BT_OTHER),
  22923. 157: uint8(_BT_OTHER),
  22924. 158: uint8(_BT_OTHER),
  22925. 159: uint8(_BT_OTHER),
  22926. 160: uint8(_BT_OTHER),
  22927. 161: uint8(_BT_OTHER),
  22928. 162: uint8(_BT_OTHER),
  22929. 163: uint8(_BT_OTHER),
  22930. 164: uint8(_BT_OTHER),
  22931. 165: uint8(_BT_OTHER),
  22932. 166: uint8(_BT_OTHER),
  22933. 167: uint8(_BT_OTHER),
  22934. 168: uint8(_BT_OTHER),
  22935. 169: uint8(_BT_OTHER),
  22936. 170: uint8(_BT_NMSTRT),
  22937. 171: uint8(_BT_OTHER),
  22938. 172: uint8(_BT_OTHER),
  22939. 173: uint8(_BT_OTHER),
  22940. 174: uint8(_BT_OTHER),
  22941. 175: uint8(_BT_OTHER),
  22942. 176: uint8(_BT_OTHER),
  22943. 177: uint8(_BT_OTHER),
  22944. 178: uint8(_BT_OTHER),
  22945. 179: uint8(_BT_OTHER),
  22946. 180: uint8(_BT_OTHER),
  22947. 181: uint8(_BT_NMSTRT),
  22948. 182: uint8(_BT_OTHER),
  22949. 183: uint8(_BT_NAME),
  22950. 184: uint8(_BT_OTHER),
  22951. 185: uint8(_BT_OTHER),
  22952. 186: uint8(_BT_NMSTRT),
  22953. 187: uint8(_BT_OTHER),
  22954. 188: uint8(_BT_OTHER),
  22955. 189: uint8(_BT_OTHER),
  22956. 190: uint8(_BT_OTHER),
  22957. 191: uint8(_BT_OTHER),
  22958. 192: uint8(_BT_NMSTRT),
  22959. 193: uint8(_BT_NMSTRT),
  22960. 194: uint8(_BT_NMSTRT),
  22961. 195: uint8(_BT_NMSTRT),
  22962. 196: uint8(_BT_NMSTRT),
  22963. 197: uint8(_BT_NMSTRT),
  22964. 198: uint8(_BT_NMSTRT),
  22965. 199: uint8(_BT_NMSTRT),
  22966. 200: uint8(_BT_NMSTRT),
  22967. 201: uint8(_BT_NMSTRT),
  22968. 202: uint8(_BT_NMSTRT),
  22969. 203: uint8(_BT_NMSTRT),
  22970. 204: uint8(_BT_NMSTRT),
  22971. 205: uint8(_BT_NMSTRT),
  22972. 206: uint8(_BT_NMSTRT),
  22973. 207: uint8(_BT_NMSTRT),
  22974. 208: uint8(_BT_NMSTRT),
  22975. 209: uint8(_BT_NMSTRT),
  22976. 210: uint8(_BT_NMSTRT),
  22977. 211: uint8(_BT_NMSTRT),
  22978. 212: uint8(_BT_NMSTRT),
  22979. 213: uint8(_BT_NMSTRT),
  22980. 214: uint8(_BT_NMSTRT),
  22981. 215: uint8(_BT_OTHER),
  22982. 216: uint8(_BT_NMSTRT),
  22983. 217: uint8(_BT_NMSTRT),
  22984. 218: uint8(_BT_NMSTRT),
  22985. 219: uint8(_BT_NMSTRT),
  22986. 220: uint8(_BT_NMSTRT),
  22987. 221: uint8(_BT_NMSTRT),
  22988. 222: uint8(_BT_NMSTRT),
  22989. 223: uint8(_BT_NMSTRT),
  22990. 224: uint8(_BT_NMSTRT),
  22991. 225: uint8(_BT_NMSTRT),
  22992. 226: uint8(_BT_NMSTRT),
  22993. 227: uint8(_BT_NMSTRT),
  22994. 228: uint8(_BT_NMSTRT),
  22995. 229: uint8(_BT_NMSTRT),
  22996. 230: uint8(_BT_NMSTRT),
  22997. 231: uint8(_BT_NMSTRT),
  22998. 232: uint8(_BT_NMSTRT),
  22999. 233: uint8(_BT_NMSTRT),
  23000. 234: uint8(_BT_NMSTRT),
  23001. 235: uint8(_BT_NMSTRT),
  23002. 236: uint8(_BT_NMSTRT),
  23003. 237: uint8(_BT_NMSTRT),
  23004. 238: uint8(_BT_NMSTRT),
  23005. 239: uint8(_BT_NMSTRT),
  23006. 240: uint8(_BT_NMSTRT),
  23007. 241: uint8(_BT_NMSTRT),
  23008. 242: uint8(_BT_NMSTRT),
  23009. 243: uint8(_BT_NMSTRT),
  23010. 244: uint8(_BT_NMSTRT),
  23011. 245: uint8(_BT_NMSTRT),
  23012. 246: uint8(_BT_NMSTRT),
  23013. 247: uint8(_BT_OTHER),
  23014. 248: uint8(_BT_NMSTRT),
  23015. 249: uint8(_BT_NMSTRT),
  23016. 250: uint8(_BT_NMSTRT),
  23017. 251: uint8(_BT_NMSTRT),
  23018. 252: uint8(_BT_NMSTRT),
  23019. 253: uint8(_BT_NMSTRT),
  23020. 254: uint8(_BT_NMSTRT),
  23021. 255: uint8(_BT_NMSTRT),
  23022. },
  23023. }
  23024. func init() {
  23025. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23026. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23027. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23028. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23029. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23030. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23031. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23032. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23033. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23034. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23035. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23036. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23037. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23038. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23039. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23040. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23041. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23042. }
  23043. var _internal_little2_encoding = Tnormal_encoding{
  23044. Fenc: TENCODING{
  23045. Fscanners: [4]TSCANNER{},
  23046. FliteralScanners: [2]TSCANNER{},
  23047. FminBytesPerChar: int32(2),
  23048. FisUtf16: uint8(1),
  23049. },
  23050. Ftype1: [256]uint8{
  23051. 9: uint8(_BT_S),
  23052. 10: uint8(_BT_LF),
  23053. 13: uint8(_BT_S),
  23054. 32: uint8(_BT_S),
  23055. 33: uint8(_BT_EXCL),
  23056. 34: uint8(_BT_QUOT),
  23057. 35: uint8(_BT_NUM),
  23058. 36: uint8(_BT_OTHER),
  23059. 37: uint8(_BT_PERCNT),
  23060. 38: uint8(_BT_AMP),
  23061. 39: uint8(_BT_APOS),
  23062. 40: uint8(_BT_LPAR),
  23063. 41: uint8(_BT_RPAR),
  23064. 42: uint8(_BT_AST),
  23065. 43: uint8(_BT_PLUS),
  23066. 44: uint8(_BT_COMMA),
  23067. 45: uint8(_BT_MINUS),
  23068. 46: uint8(_BT_NAME),
  23069. 47: uint8(_BT_SOL),
  23070. 48: uint8(_BT_DIGIT),
  23071. 49: uint8(_BT_DIGIT),
  23072. 50: uint8(_BT_DIGIT),
  23073. 51: uint8(_BT_DIGIT),
  23074. 52: uint8(_BT_DIGIT),
  23075. 53: uint8(_BT_DIGIT),
  23076. 54: uint8(_BT_DIGIT),
  23077. 55: uint8(_BT_DIGIT),
  23078. 56: uint8(_BT_DIGIT),
  23079. 57: uint8(_BT_DIGIT),
  23080. 58: uint8(_BT_NMSTRT),
  23081. 59: uint8(_BT_SEMI),
  23082. 60: uint8(_BT_LT),
  23083. 61: uint8(_BT_EQUALS),
  23084. 62: uint8(_BT_GT),
  23085. 63: uint8(_BT_QUEST),
  23086. 64: uint8(_BT_OTHER),
  23087. 65: uint8(_BT_HEX),
  23088. 66: uint8(_BT_HEX),
  23089. 67: uint8(_BT_HEX),
  23090. 68: uint8(_BT_HEX),
  23091. 69: uint8(_BT_HEX),
  23092. 70: uint8(_BT_HEX),
  23093. 71: uint8(_BT_NMSTRT),
  23094. 72: uint8(_BT_NMSTRT),
  23095. 73: uint8(_BT_NMSTRT),
  23096. 74: uint8(_BT_NMSTRT),
  23097. 75: uint8(_BT_NMSTRT),
  23098. 76: uint8(_BT_NMSTRT),
  23099. 77: uint8(_BT_NMSTRT),
  23100. 78: uint8(_BT_NMSTRT),
  23101. 79: uint8(_BT_NMSTRT),
  23102. 80: uint8(_BT_NMSTRT),
  23103. 81: uint8(_BT_NMSTRT),
  23104. 82: uint8(_BT_NMSTRT),
  23105. 83: uint8(_BT_NMSTRT),
  23106. 84: uint8(_BT_NMSTRT),
  23107. 85: uint8(_BT_NMSTRT),
  23108. 86: uint8(_BT_NMSTRT),
  23109. 87: uint8(_BT_NMSTRT),
  23110. 88: uint8(_BT_NMSTRT),
  23111. 89: uint8(_BT_NMSTRT),
  23112. 90: uint8(_BT_NMSTRT),
  23113. 91: uint8(_BT_LSQB),
  23114. 92: uint8(_BT_OTHER),
  23115. 93: uint8(_BT_RSQB),
  23116. 94: uint8(_BT_OTHER),
  23117. 95: uint8(_BT_NMSTRT),
  23118. 96: uint8(_BT_OTHER),
  23119. 97: uint8(_BT_HEX),
  23120. 98: uint8(_BT_HEX),
  23121. 99: uint8(_BT_HEX),
  23122. 100: uint8(_BT_HEX),
  23123. 101: uint8(_BT_HEX),
  23124. 102: uint8(_BT_HEX),
  23125. 103: uint8(_BT_NMSTRT),
  23126. 104: uint8(_BT_NMSTRT),
  23127. 105: uint8(_BT_NMSTRT),
  23128. 106: uint8(_BT_NMSTRT),
  23129. 107: uint8(_BT_NMSTRT),
  23130. 108: uint8(_BT_NMSTRT),
  23131. 109: uint8(_BT_NMSTRT),
  23132. 110: uint8(_BT_NMSTRT),
  23133. 111: uint8(_BT_NMSTRT),
  23134. 112: uint8(_BT_NMSTRT),
  23135. 113: uint8(_BT_NMSTRT),
  23136. 114: uint8(_BT_NMSTRT),
  23137. 115: uint8(_BT_NMSTRT),
  23138. 116: uint8(_BT_NMSTRT),
  23139. 117: uint8(_BT_NMSTRT),
  23140. 118: uint8(_BT_NMSTRT),
  23141. 119: uint8(_BT_NMSTRT),
  23142. 120: uint8(_BT_NMSTRT),
  23143. 121: uint8(_BT_NMSTRT),
  23144. 122: uint8(_BT_NMSTRT),
  23145. 123: uint8(_BT_OTHER),
  23146. 124: uint8(_BT_VERBAR),
  23147. 125: uint8(_BT_OTHER),
  23148. 126: uint8(_BT_OTHER),
  23149. 127: uint8(_BT_OTHER),
  23150. 128: uint8(_BT_OTHER),
  23151. 129: uint8(_BT_OTHER),
  23152. 130: uint8(_BT_OTHER),
  23153. 131: uint8(_BT_OTHER),
  23154. 132: uint8(_BT_OTHER),
  23155. 133: uint8(_BT_OTHER),
  23156. 134: uint8(_BT_OTHER),
  23157. 135: uint8(_BT_OTHER),
  23158. 136: uint8(_BT_OTHER),
  23159. 137: uint8(_BT_OTHER),
  23160. 138: uint8(_BT_OTHER),
  23161. 139: uint8(_BT_OTHER),
  23162. 140: uint8(_BT_OTHER),
  23163. 141: uint8(_BT_OTHER),
  23164. 142: uint8(_BT_OTHER),
  23165. 143: uint8(_BT_OTHER),
  23166. 144: uint8(_BT_OTHER),
  23167. 145: uint8(_BT_OTHER),
  23168. 146: uint8(_BT_OTHER),
  23169. 147: uint8(_BT_OTHER),
  23170. 148: uint8(_BT_OTHER),
  23171. 149: uint8(_BT_OTHER),
  23172. 150: uint8(_BT_OTHER),
  23173. 151: uint8(_BT_OTHER),
  23174. 152: uint8(_BT_OTHER),
  23175. 153: uint8(_BT_OTHER),
  23176. 154: uint8(_BT_OTHER),
  23177. 155: uint8(_BT_OTHER),
  23178. 156: uint8(_BT_OTHER),
  23179. 157: uint8(_BT_OTHER),
  23180. 158: uint8(_BT_OTHER),
  23181. 159: uint8(_BT_OTHER),
  23182. 160: uint8(_BT_OTHER),
  23183. 161: uint8(_BT_OTHER),
  23184. 162: uint8(_BT_OTHER),
  23185. 163: uint8(_BT_OTHER),
  23186. 164: uint8(_BT_OTHER),
  23187. 165: uint8(_BT_OTHER),
  23188. 166: uint8(_BT_OTHER),
  23189. 167: uint8(_BT_OTHER),
  23190. 168: uint8(_BT_OTHER),
  23191. 169: uint8(_BT_OTHER),
  23192. 170: uint8(_BT_NMSTRT),
  23193. 171: uint8(_BT_OTHER),
  23194. 172: uint8(_BT_OTHER),
  23195. 173: uint8(_BT_OTHER),
  23196. 174: uint8(_BT_OTHER),
  23197. 175: uint8(_BT_OTHER),
  23198. 176: uint8(_BT_OTHER),
  23199. 177: uint8(_BT_OTHER),
  23200. 178: uint8(_BT_OTHER),
  23201. 179: uint8(_BT_OTHER),
  23202. 180: uint8(_BT_OTHER),
  23203. 181: uint8(_BT_NMSTRT),
  23204. 182: uint8(_BT_OTHER),
  23205. 183: uint8(_BT_NAME),
  23206. 184: uint8(_BT_OTHER),
  23207. 185: uint8(_BT_OTHER),
  23208. 186: uint8(_BT_NMSTRT),
  23209. 187: uint8(_BT_OTHER),
  23210. 188: uint8(_BT_OTHER),
  23211. 189: uint8(_BT_OTHER),
  23212. 190: uint8(_BT_OTHER),
  23213. 191: uint8(_BT_OTHER),
  23214. 192: uint8(_BT_NMSTRT),
  23215. 193: uint8(_BT_NMSTRT),
  23216. 194: uint8(_BT_NMSTRT),
  23217. 195: uint8(_BT_NMSTRT),
  23218. 196: uint8(_BT_NMSTRT),
  23219. 197: uint8(_BT_NMSTRT),
  23220. 198: uint8(_BT_NMSTRT),
  23221. 199: uint8(_BT_NMSTRT),
  23222. 200: uint8(_BT_NMSTRT),
  23223. 201: uint8(_BT_NMSTRT),
  23224. 202: uint8(_BT_NMSTRT),
  23225. 203: uint8(_BT_NMSTRT),
  23226. 204: uint8(_BT_NMSTRT),
  23227. 205: uint8(_BT_NMSTRT),
  23228. 206: uint8(_BT_NMSTRT),
  23229. 207: uint8(_BT_NMSTRT),
  23230. 208: uint8(_BT_NMSTRT),
  23231. 209: uint8(_BT_NMSTRT),
  23232. 210: uint8(_BT_NMSTRT),
  23233. 211: uint8(_BT_NMSTRT),
  23234. 212: uint8(_BT_NMSTRT),
  23235. 213: uint8(_BT_NMSTRT),
  23236. 214: uint8(_BT_NMSTRT),
  23237. 215: uint8(_BT_OTHER),
  23238. 216: uint8(_BT_NMSTRT),
  23239. 217: uint8(_BT_NMSTRT),
  23240. 218: uint8(_BT_NMSTRT),
  23241. 219: uint8(_BT_NMSTRT),
  23242. 220: uint8(_BT_NMSTRT),
  23243. 221: uint8(_BT_NMSTRT),
  23244. 222: uint8(_BT_NMSTRT),
  23245. 223: uint8(_BT_NMSTRT),
  23246. 224: uint8(_BT_NMSTRT),
  23247. 225: uint8(_BT_NMSTRT),
  23248. 226: uint8(_BT_NMSTRT),
  23249. 227: uint8(_BT_NMSTRT),
  23250. 228: uint8(_BT_NMSTRT),
  23251. 229: uint8(_BT_NMSTRT),
  23252. 230: uint8(_BT_NMSTRT),
  23253. 231: uint8(_BT_NMSTRT),
  23254. 232: uint8(_BT_NMSTRT),
  23255. 233: uint8(_BT_NMSTRT),
  23256. 234: uint8(_BT_NMSTRT),
  23257. 235: uint8(_BT_NMSTRT),
  23258. 236: uint8(_BT_NMSTRT),
  23259. 237: uint8(_BT_NMSTRT),
  23260. 238: uint8(_BT_NMSTRT),
  23261. 239: uint8(_BT_NMSTRT),
  23262. 240: uint8(_BT_NMSTRT),
  23263. 241: uint8(_BT_NMSTRT),
  23264. 242: uint8(_BT_NMSTRT),
  23265. 243: uint8(_BT_NMSTRT),
  23266. 244: uint8(_BT_NMSTRT),
  23267. 245: uint8(_BT_NMSTRT),
  23268. 246: uint8(_BT_NMSTRT),
  23269. 247: uint8(_BT_OTHER),
  23270. 248: uint8(_BT_NMSTRT),
  23271. 249: uint8(_BT_NMSTRT),
  23272. 250: uint8(_BT_NMSTRT),
  23273. 251: uint8(_BT_NMSTRT),
  23274. 252: uint8(_BT_NMSTRT),
  23275. 253: uint8(_BT_NMSTRT),
  23276. 254: uint8(_BT_NMSTRT),
  23277. 255: uint8(_BT_NMSTRT),
  23278. },
  23279. }
  23280. func init() {
  23281. p := unsafe.Pointer(&_internal_little2_encoding)
  23282. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23283. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  23284. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  23285. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  23286. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  23287. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  23288. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  23289. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  23290. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  23291. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  23292. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  23293. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  23294. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  23295. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  23296. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  23297. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  23298. }
  23299. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23300. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23301. __ __ _
  23302. ___\ \/ /_ __ __ _| |_
  23303. / _ \\ /| '_ \ / _` | __|
  23304. | __// \| |_) | (_| | |_
  23305. \___/_/\_\ .__/ \__,_|\__|
  23306. |_| XML parser
  23307. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23308. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23309. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23310. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23311. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23312. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23313. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23314. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23315. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23316. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23317. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23318. Licensed under the MIT license:
  23319. Permission is hereby granted, free of charge, to any person obtaining
  23320. a copy of this software and associated documentation files (the
  23321. "Software"), to deal in the Software without restriction, including
  23322. without limitation the rights to use, copy, modify, merge, publish,
  23323. distribute, sublicense, and/or sell copies of the Software, and to permit
  23324. persons to whom the Software is furnished to do so, subject to the
  23325. following conditions:
  23326. The above copyright notice and this permission notice shall be included
  23327. in all copies or substantial portions of the Software.
  23328. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23329. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23330. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23331. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23332. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23333. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23334. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23335. */
  23336. /* ptr points to character following "<!-" */
  23337. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23338. var v1 int32
  23339. _ = v1
  23340. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23341. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23343. return m_XML_TOK_INVALID
  23344. }
  23345. ptr += uintptr(2)
  23346. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23347. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23348. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23349. } else {
  23350. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23351. }
  23352. switch v1 {
  23353. case int32(_BT_LEAD2):
  23354. if int64(end)-int64(ptr) < int64(2) {
  23355. return -int32(2)
  23356. }
  23357. if 0 != 0 {
  23358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23359. return m_XML_TOK_INVALID
  23360. }
  23361. ptr += uintptr(2)
  23362. case int32(_BT_LEAD3):
  23363. if int64(end)-int64(ptr) < int64(3) {
  23364. return -int32(2)
  23365. }
  23366. if 0 != 0 {
  23367. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23368. return m_XML_TOK_INVALID
  23369. }
  23370. ptr += uintptr(3)
  23371. case int32(_BT_LEAD4):
  23372. if int64(end)-int64(ptr) < int64(4) {
  23373. return -int32(2)
  23374. }
  23375. if 0 != 0 {
  23376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23377. return m_XML_TOK_INVALID
  23378. }
  23379. ptr += uintptr(4)
  23380. case int32(_BT_NONXML):
  23381. fallthrough
  23382. case int32(_BT_MALFORM):
  23383. fallthrough
  23384. case int32(_BT_TRAIL):
  23385. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23386. return m_XML_TOK_INVALID
  23387. case int32(_BT_MINUS):
  23388. ptr += uintptr(2)
  23389. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23390. return -int32(1)
  23391. }
  23392. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23393. ptr += uintptr(2)
  23394. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23395. return -int32(1)
  23396. }
  23397. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23399. return m_XML_TOK_INVALID
  23400. }
  23401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23402. return int32(m_XML_TOK_COMMENT)
  23403. }
  23404. default:
  23405. ptr += uintptr(2)
  23406. break
  23407. }
  23408. }
  23409. }
  23410. return -int32(1)
  23411. }
  23412. /* ptr points to character following "<!" */
  23413. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23414. var v1, v2, v3 int32
  23415. _, _, _ = v1, v2, v3
  23416. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23417. return -int32(1)
  23418. }
  23419. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23420. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23421. } else {
  23422. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23423. }
  23424. switch v1 {
  23425. case int32(_BT_MINUS):
  23426. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23427. case int32(_BT_LSQB):
  23428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23429. return int32(m_XML_TOK_COND_SECT_OPEN)
  23430. case int32(_BT_NMSTRT):
  23431. fallthrough
  23432. case int32(_BT_HEX):
  23433. ptr += uintptr(2)
  23434. default:
  23435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23436. return m_XML_TOK_INVALID
  23437. }
  23438. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23439. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23440. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23441. } else {
  23442. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23443. }
  23444. switch v2 {
  23445. case int32(_BT_PERCNT):
  23446. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23447. return -int32(1)
  23448. }
  23449. /* don't allow <!ENTITY% foo "whatever"> */
  23450. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23451. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  23452. } else {
  23453. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23454. }
  23455. switch v3 {
  23456. case int32(_BT_S):
  23457. fallthrough
  23458. case int32(_BT_CR):
  23459. fallthrough
  23460. case int32(_BT_LF):
  23461. fallthrough
  23462. case int32(_BT_PERCNT):
  23463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23464. return m_XML_TOK_INVALID
  23465. }
  23466. /* fall through */
  23467. fallthrough
  23468. case int32(_BT_S):
  23469. fallthrough
  23470. case int32(_BT_CR):
  23471. fallthrough
  23472. case int32(_BT_LF):
  23473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23474. return int32(m_XML_TOK_DECL_OPEN)
  23475. case int32(_BT_NMSTRT):
  23476. fallthrough
  23477. case int32(_BT_HEX):
  23478. ptr += uintptr(2)
  23479. default:
  23480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23481. return m_XML_TOK_INVALID
  23482. }
  23483. }
  23484. return -int32(1)
  23485. }
  23486. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23487. var upper, v1, v2, v3 int32
  23488. _, _, _, _ = upper, v1, v2, v3
  23489. upper = 0
  23490. _ = enc
  23491. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23492. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  23493. return int32(1)
  23494. }
  23495. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23496. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23497. } else {
  23498. v1 = -int32(1)
  23499. }
  23500. switch v1 {
  23501. case int32(m_ASCII_x2):
  23502. case int32(m_ASCII_X):
  23503. upper = int32(1)
  23504. default:
  23505. return int32(1)
  23506. }
  23507. ptr += uintptr(2)
  23508. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23509. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23510. } else {
  23511. v2 = -int32(1)
  23512. }
  23513. switch v2 {
  23514. case int32(m_ASCII_m2):
  23515. case int32(m_ASCII_M):
  23516. upper = int32(1)
  23517. default:
  23518. return int32(1)
  23519. }
  23520. ptr += uintptr(2)
  23521. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23522. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23523. } else {
  23524. v3 = -int32(1)
  23525. }
  23526. switch v3 {
  23527. case int32(m_ASCII_l2):
  23528. case int32(m_ASCII_L):
  23529. upper = int32(1)
  23530. default:
  23531. return int32(1)
  23532. }
  23533. if upper != 0 {
  23534. return 0
  23535. }
  23536. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23537. return int32(1)
  23538. }
  23539. /* ptr points to character following "<?" */
  23540. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23541. bp := tls.Alloc(16)
  23542. defer tls.Free(16)
  23543. var target uintptr
  23544. var v1, v2, v3 int32
  23545. var _ /* tok at bp+0 */ int32
  23546. _, _, _, _ = target, v1, v2, v3
  23547. target = ptr
  23548. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23549. return -int32(1)
  23550. }
  23551. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23552. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23553. } else {
  23554. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23555. }
  23556. switch v1 {
  23557. case int32(_BT_NONASCII):
  23558. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23559. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23560. return m_XML_TOK_INVALID
  23561. } /* fall through */
  23562. fallthrough
  23563. case int32(_BT_NMSTRT):
  23564. fallthrough
  23565. case int32(_BT_HEX):
  23566. ptr += uintptr(2)
  23567. case int32(_BT_LEAD2):
  23568. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23569. return -int32(2)
  23570. }
  23571. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23572. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23573. return m_XML_TOK_INVALID
  23574. }
  23575. ptr += uintptr(2)
  23576. case int32(_BT_LEAD3):
  23577. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23578. return -int32(2)
  23579. }
  23580. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23581. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23582. return m_XML_TOK_INVALID
  23583. }
  23584. ptr += uintptr(3)
  23585. case int32(_BT_LEAD4):
  23586. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23587. return -int32(2)
  23588. }
  23589. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23590. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23591. return m_XML_TOK_INVALID
  23592. }
  23593. ptr += uintptr(4)
  23594. default:
  23595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23596. return m_XML_TOK_INVALID
  23597. }
  23598. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23599. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23600. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23601. } else {
  23602. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23603. }
  23604. switch v2 {
  23605. case int32(_BT_NONASCII):
  23606. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23608. return m_XML_TOK_INVALID
  23609. } /* fall through */
  23610. fallthrough
  23611. case int32(_BT_NMSTRT):
  23612. fallthrough
  23613. case int32(_BT_HEX):
  23614. fallthrough
  23615. case int32(_BT_DIGIT):
  23616. fallthrough
  23617. case int32(_BT_NAME):
  23618. fallthrough
  23619. case int32(_BT_MINUS):
  23620. ptr += uintptr(2)
  23621. case int32(_BT_LEAD2):
  23622. if int64(end)-int64(ptr) < int64(2) {
  23623. return -int32(2)
  23624. }
  23625. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23626. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23627. return m_XML_TOK_INVALID
  23628. }
  23629. ptr += uintptr(2)
  23630. case int32(_BT_LEAD3):
  23631. if int64(end)-int64(ptr) < int64(3) {
  23632. return -int32(2)
  23633. }
  23634. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23636. return m_XML_TOK_INVALID
  23637. }
  23638. ptr += uintptr(3)
  23639. case int32(_BT_LEAD4):
  23640. if int64(end)-int64(ptr) < int64(4) {
  23641. return -int32(2)
  23642. }
  23643. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23645. return m_XML_TOK_INVALID
  23646. }
  23647. ptr += uintptr(4)
  23648. case int32(_BT_S):
  23649. fallthrough
  23650. case int32(_BT_CR):
  23651. fallthrough
  23652. case int32(_BT_LF):
  23653. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23654. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23655. return m_XML_TOK_INVALID
  23656. }
  23657. ptr += uintptr(2)
  23658. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23659. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23660. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23661. } else {
  23662. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23663. }
  23664. switch v3 {
  23665. case int32(_BT_LEAD2):
  23666. if int64(end)-int64(ptr) < int64(2) {
  23667. return -int32(2)
  23668. }
  23669. if 0 != 0 {
  23670. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23671. return m_XML_TOK_INVALID
  23672. }
  23673. ptr += uintptr(2)
  23674. case int32(_BT_LEAD3):
  23675. if int64(end)-int64(ptr) < int64(3) {
  23676. return -int32(2)
  23677. }
  23678. if 0 != 0 {
  23679. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23680. return m_XML_TOK_INVALID
  23681. }
  23682. ptr += uintptr(3)
  23683. case int32(_BT_LEAD4):
  23684. if int64(end)-int64(ptr) < int64(4) {
  23685. return -int32(2)
  23686. }
  23687. if 0 != 0 {
  23688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23689. return m_XML_TOK_INVALID
  23690. }
  23691. ptr += uintptr(4)
  23692. case int32(_BT_NONXML):
  23693. fallthrough
  23694. case int32(_BT_MALFORM):
  23695. fallthrough
  23696. case int32(_BT_TRAIL):
  23697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23698. return m_XML_TOK_INVALID
  23699. case int32(_BT_QUEST):
  23700. ptr += uintptr(2)
  23701. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23702. return -int32(1)
  23703. }
  23704. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23705. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23706. return *(*int32)(unsafe.Pointer(bp))
  23707. }
  23708. default:
  23709. ptr += uintptr(2)
  23710. break
  23711. }
  23712. }
  23713. return -int32(1)
  23714. case int32(_BT_QUEST):
  23715. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23717. return m_XML_TOK_INVALID
  23718. }
  23719. ptr += uintptr(2)
  23720. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23721. return -int32(1)
  23722. }
  23723. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23725. return *(*int32)(unsafe.Pointer(bp))
  23726. }
  23727. /* fall through */
  23728. fallthrough
  23729. default:
  23730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23731. return m_XML_TOK_INVALID
  23732. }
  23733. }
  23734. return -int32(1)
  23735. }
  23736. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23737. var i int32
  23738. _ = i
  23739. _ = enc
  23740. /* CDATA[ */
  23741. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  23742. return -int32(1)
  23743. }
  23744. i = 0
  23745. for {
  23746. if !(i < int32(6)) {
  23747. break
  23748. }
  23749. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == libc.Int32FromUint8(_CDATA_LSQB2[i])) {
  23750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23751. return m_XML_TOK_INVALID
  23752. }
  23753. goto _1
  23754. _1:
  23755. ;
  23756. i++
  23757. ptr += uintptr(2)
  23758. }
  23759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23760. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  23761. }
  23762. var _CDATA_LSQB2 = [6]uint8{
  23763. 0: uint8(m_ASCII_C),
  23764. 1: uint8(m_ASCII_D),
  23765. 2: uint8(m_ASCII_A),
  23766. 3: uint8(m_ASCII_T),
  23767. 4: uint8(m_ASCII_A),
  23768. 5: uint8(m_ASCII_LSQB1),
  23769. }
  23770. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23771. var n Tsize_t
  23772. var v1, v2, v3 int32
  23773. _, _, _, _ = n, v1, v2, v3
  23774. if ptr >= end {
  23775. return -int32(4)
  23776. }
  23777. if int32(2) > int32(1) {
  23778. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23779. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23780. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23781. if n == uint64(0) {
  23782. return -int32(1)
  23783. }
  23784. end = ptr + uintptr(n)
  23785. }
  23786. }
  23787. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23788. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23789. } else {
  23790. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23791. }
  23792. switch v1 {
  23793. case int32(_BT_RSQB):
  23794. ptr += uintptr(2)
  23795. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23796. return -int32(1)
  23797. }
  23798. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  23799. break
  23800. }
  23801. ptr += uintptr(2)
  23802. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23803. return -int32(1)
  23804. }
  23805. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23806. ptr -= uintptr(2)
  23807. break
  23808. }
  23809. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23810. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  23811. case int32(_BT_CR):
  23812. ptr += uintptr(2)
  23813. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23814. return -int32(1)
  23815. }
  23816. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23817. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23818. } else {
  23819. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23820. }
  23821. if v2 == int32(_BT_LF) {
  23822. ptr += uintptr(2)
  23823. }
  23824. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23825. return int32(m_XML_TOK_DATA_NEWLINE)
  23826. case int32(_BT_LF):
  23827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23828. return int32(m_XML_TOK_DATA_NEWLINE)
  23829. case int32(_BT_LEAD2):
  23830. if int64(end)-int64(ptr) < int64(2) {
  23831. return -int32(2)
  23832. }
  23833. if 0 != 0 {
  23834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23835. return m_XML_TOK_INVALID
  23836. }
  23837. ptr += uintptr(2)
  23838. case int32(_BT_LEAD3):
  23839. if int64(end)-int64(ptr) < int64(3) {
  23840. return -int32(2)
  23841. }
  23842. if 0 != 0 {
  23843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23844. return m_XML_TOK_INVALID
  23845. }
  23846. ptr += uintptr(3)
  23847. case int32(_BT_LEAD4):
  23848. if int64(end)-int64(ptr) < int64(4) {
  23849. return -int32(2)
  23850. }
  23851. if 0 != 0 {
  23852. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23853. return m_XML_TOK_INVALID
  23854. }
  23855. ptr += uintptr(4)
  23856. case int32(_BT_NONXML):
  23857. fallthrough
  23858. case int32(_BT_MALFORM):
  23859. fallthrough
  23860. case int32(_BT_TRAIL):
  23861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23862. return m_XML_TOK_INVALID
  23863. default:
  23864. ptr += uintptr(2)
  23865. break
  23866. }
  23867. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23868. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23869. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23870. } else {
  23871. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23872. }
  23873. switch v3 {
  23874. case int32(_BT_LEAD2):
  23875. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  23876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23877. return int32(m_XML_TOK_DATA_CHARS)
  23878. }
  23879. ptr += uintptr(2)
  23880. case int32(_BT_LEAD3):
  23881. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  23882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23883. return int32(m_XML_TOK_DATA_CHARS)
  23884. }
  23885. ptr += uintptr(3)
  23886. case int32(_BT_LEAD4):
  23887. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  23888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23889. return int32(m_XML_TOK_DATA_CHARS)
  23890. }
  23891. ptr += uintptr(4)
  23892. case int32(_BT_NONXML):
  23893. fallthrough
  23894. case int32(_BT_MALFORM):
  23895. fallthrough
  23896. case int32(_BT_TRAIL):
  23897. fallthrough
  23898. case int32(_BT_CR):
  23899. fallthrough
  23900. case int32(_BT_LF):
  23901. fallthrough
  23902. case int32(_BT_RSQB):
  23903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23904. return int32(m_XML_TOK_DATA_CHARS)
  23905. default:
  23906. ptr += uintptr(2)
  23907. break
  23908. }
  23909. }
  23910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23911. return int32(m_XML_TOK_DATA_CHARS)
  23912. }
  23913. /* ptr points to character following "</" */
  23914. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23915. var v1, v2, v22 int32
  23916. _, _, _ = v1, v2, v22
  23917. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23918. return -int32(1)
  23919. }
  23920. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23921. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23922. } else {
  23923. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23924. }
  23925. switch v1 {
  23926. case int32(_BT_NONASCII):
  23927. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23929. return m_XML_TOK_INVALID
  23930. } /* fall through */
  23931. fallthrough
  23932. case int32(_BT_NMSTRT):
  23933. fallthrough
  23934. case int32(_BT_HEX):
  23935. ptr += uintptr(2)
  23936. case int32(_BT_LEAD2):
  23937. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  23938. return -int32(2)
  23939. }
  23940. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23942. return m_XML_TOK_INVALID
  23943. }
  23944. ptr += uintptr(2)
  23945. case int32(_BT_LEAD3):
  23946. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  23947. return -int32(2)
  23948. }
  23949. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23951. return m_XML_TOK_INVALID
  23952. }
  23953. ptr += uintptr(3)
  23954. case int32(_BT_LEAD4):
  23955. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  23956. return -int32(2)
  23957. }
  23958. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23959. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23960. return m_XML_TOK_INVALID
  23961. }
  23962. ptr += uintptr(4)
  23963. default:
  23964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23965. return m_XML_TOK_INVALID
  23966. }
  23967. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23968. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23969. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23970. } else {
  23971. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23972. }
  23973. switch v2 {
  23974. case int32(_BT_NONASCII):
  23975. goto _3
  23976. case int32(_BT_MINUS):
  23977. goto _4
  23978. case int32(_BT_NAME):
  23979. goto _5
  23980. case int32(_BT_DIGIT):
  23981. goto _6
  23982. case int32(_BT_HEX):
  23983. goto _7
  23984. case int32(_BT_NMSTRT):
  23985. goto _8
  23986. case int32(_BT_LEAD2):
  23987. goto _9
  23988. case int32(_BT_LEAD3):
  23989. goto _10
  23990. case int32(_BT_LEAD4):
  23991. goto _11
  23992. case int32(_BT_LF):
  23993. goto _12
  23994. case int32(_BT_CR):
  23995. goto _13
  23996. case int32(_BT_S):
  23997. goto _14
  23998. case int32(_BT_COLON):
  23999. goto _15
  24000. case int32(_BT_GT):
  24001. goto _16
  24002. default:
  24003. goto _17
  24004. }
  24005. goto _18
  24006. _3:
  24007. ;
  24008. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24010. return m_XML_TOK_INVALID
  24011. } /* fall through */
  24012. _8:
  24013. ;
  24014. _7:
  24015. ;
  24016. _6:
  24017. ;
  24018. _5:
  24019. ;
  24020. _4:
  24021. ;
  24022. ptr += uintptr(2)
  24023. goto _18
  24024. _9:
  24025. ;
  24026. if int64(end)-int64(ptr) < int64(2) {
  24027. return -int32(2)
  24028. }
  24029. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24030. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24031. return m_XML_TOK_INVALID
  24032. }
  24033. ptr += uintptr(2)
  24034. goto _18
  24035. _10:
  24036. ;
  24037. if int64(end)-int64(ptr) < int64(3) {
  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(3)
  24045. goto _18
  24046. _11:
  24047. ;
  24048. if int64(end)-int64(ptr) < int64(4) {
  24049. return -int32(2)
  24050. }
  24051. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24053. return m_XML_TOK_INVALID
  24054. }
  24055. ptr += uintptr(4)
  24056. goto _18
  24057. _14:
  24058. ;
  24059. _13:
  24060. ;
  24061. _12:
  24062. ;
  24063. ptr += uintptr(2)
  24064. _21:
  24065. ;
  24066. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24067. goto _19
  24068. }
  24069. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24070. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24071. } else {
  24072. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24073. }
  24074. switch v22 {
  24075. case int32(_BT_S):
  24076. fallthrough
  24077. case int32(_BT_CR):
  24078. fallthrough
  24079. case int32(_BT_LF):
  24080. case int32(_BT_GT):
  24081. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24082. return int32(m_XML_TOK_END_TAG)
  24083. default:
  24084. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24085. return m_XML_TOK_INVALID
  24086. }
  24087. goto _20
  24088. _20:
  24089. ;
  24090. ptr += uintptr(2)
  24091. goto _21
  24092. goto _19
  24093. _19:
  24094. ;
  24095. return -int32(1)
  24096. _15:
  24097. ;
  24098. /* no need to check qname syntax here,
  24099. since end-tag must match exactly */
  24100. ptr += uintptr(2)
  24101. goto _18
  24102. _16:
  24103. ;
  24104. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24105. return int32(m_XML_TOK_END_TAG)
  24106. _17:
  24107. ;
  24108. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24109. return m_XML_TOK_INVALID
  24110. _18:
  24111. }
  24112. return -int32(1)
  24113. }
  24114. /* ptr points to character following "&#X" */
  24115. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24116. var v1, v3 int32
  24117. _, _ = v1, v3
  24118. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24119. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24120. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24121. } else {
  24122. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24123. }
  24124. switch v1 {
  24125. case int32(_BT_DIGIT):
  24126. fallthrough
  24127. case int32(_BT_HEX):
  24128. default:
  24129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24130. return m_XML_TOK_INVALID
  24131. }
  24132. ptr += uintptr(2)
  24133. for {
  24134. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24135. break
  24136. }
  24137. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24138. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24139. } else {
  24140. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24141. }
  24142. switch v3 {
  24143. case int32(_BT_DIGIT):
  24144. fallthrough
  24145. case int32(_BT_HEX):
  24146. case int32(_BT_SEMI):
  24147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24148. return int32(m_XML_TOK_CHAR_REF)
  24149. default:
  24150. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24151. return m_XML_TOK_INVALID
  24152. }
  24153. goto _2
  24154. _2:
  24155. ;
  24156. ptr += uintptr(2)
  24157. }
  24158. }
  24159. return -int32(1)
  24160. }
  24161. /* ptr points to character following "&#" */
  24162. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24163. var v1, v3 int32
  24164. _, _ = v1, v3
  24165. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24166. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24167. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24168. }
  24169. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24170. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24171. } else {
  24172. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24173. }
  24174. switch v1 {
  24175. case int32(_BT_DIGIT):
  24176. default:
  24177. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24178. return m_XML_TOK_INVALID
  24179. }
  24180. ptr += uintptr(2)
  24181. for {
  24182. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24183. break
  24184. }
  24185. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24186. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24187. } else {
  24188. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24189. }
  24190. switch v3 {
  24191. case int32(_BT_DIGIT):
  24192. case int32(_BT_SEMI):
  24193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24194. return int32(m_XML_TOK_CHAR_REF)
  24195. default:
  24196. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24197. return m_XML_TOK_INVALID
  24198. }
  24199. goto _2
  24200. _2:
  24201. ;
  24202. ptr += uintptr(2)
  24203. }
  24204. }
  24205. return -int32(1)
  24206. }
  24207. /* ptr points to character following "&" */
  24208. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24209. var v1, v2 int32
  24210. _, _ = v1, v2
  24211. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24212. return -int32(1)
  24213. }
  24214. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24215. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24216. } else {
  24217. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24218. }
  24219. switch v1 {
  24220. case int32(_BT_NONASCII):
  24221. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24222. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24223. return m_XML_TOK_INVALID
  24224. } /* fall through */
  24225. fallthrough
  24226. case int32(_BT_NMSTRT):
  24227. fallthrough
  24228. case int32(_BT_HEX):
  24229. ptr += uintptr(2)
  24230. case int32(_BT_LEAD2):
  24231. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24232. return -int32(2)
  24233. }
  24234. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24235. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24236. return m_XML_TOK_INVALID
  24237. }
  24238. ptr += uintptr(2)
  24239. case int32(_BT_LEAD3):
  24240. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24241. return -int32(2)
  24242. }
  24243. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24244. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24245. return m_XML_TOK_INVALID
  24246. }
  24247. ptr += uintptr(3)
  24248. case int32(_BT_LEAD4):
  24249. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24250. return -int32(2)
  24251. }
  24252. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24253. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24254. return m_XML_TOK_INVALID
  24255. }
  24256. ptr += uintptr(4)
  24257. case int32(_BT_NUM):
  24258. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24259. default:
  24260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24261. return m_XML_TOK_INVALID
  24262. }
  24263. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24264. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24265. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24266. } else {
  24267. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24268. }
  24269. switch v2 {
  24270. case int32(_BT_NONASCII):
  24271. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24273. return m_XML_TOK_INVALID
  24274. } /* fall through */
  24275. fallthrough
  24276. case int32(_BT_NMSTRT):
  24277. fallthrough
  24278. case int32(_BT_HEX):
  24279. fallthrough
  24280. case int32(_BT_DIGIT):
  24281. fallthrough
  24282. case int32(_BT_NAME):
  24283. fallthrough
  24284. case int32(_BT_MINUS):
  24285. ptr += uintptr(2)
  24286. case int32(_BT_LEAD2):
  24287. if int64(end)-int64(ptr) < int64(2) {
  24288. return -int32(2)
  24289. }
  24290. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24291. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24292. return m_XML_TOK_INVALID
  24293. }
  24294. ptr += uintptr(2)
  24295. case int32(_BT_LEAD3):
  24296. if int64(end)-int64(ptr) < int64(3) {
  24297. return -int32(2)
  24298. }
  24299. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24300. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24301. return m_XML_TOK_INVALID
  24302. }
  24303. ptr += uintptr(3)
  24304. case int32(_BT_LEAD4):
  24305. if int64(end)-int64(ptr) < int64(4) {
  24306. return -int32(2)
  24307. }
  24308. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24309. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24310. return m_XML_TOK_INVALID
  24311. }
  24312. ptr += uintptr(4)
  24313. case int32(_BT_SEMI):
  24314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24315. return int32(m_XML_TOK_ENTITY_REF)
  24316. default:
  24317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24318. return m_XML_TOK_INVALID
  24319. }
  24320. }
  24321. return -int32(1)
  24322. }
  24323. /* ptr points to character following first character of attribute name */
  24324. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24325. bp := tls.Alloc(16)
  24326. defer tls.Free(16)
  24327. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24328. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24329. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24330. hadColon = 0
  24331. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24332. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24333. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24334. } else {
  24335. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24336. }
  24337. switch v1 {
  24338. case int32(_BT_NONASCII):
  24339. goto _2
  24340. case int32(_BT_MINUS):
  24341. goto _3
  24342. case int32(_BT_NAME):
  24343. goto _4
  24344. case int32(_BT_DIGIT):
  24345. goto _5
  24346. case int32(_BT_HEX):
  24347. goto _6
  24348. case int32(_BT_NMSTRT):
  24349. goto _7
  24350. case int32(_BT_LEAD2):
  24351. goto _8
  24352. case int32(_BT_LEAD3):
  24353. goto _9
  24354. case int32(_BT_LEAD4):
  24355. goto _10
  24356. case int32(_BT_COLON):
  24357. goto _11
  24358. case int32(_BT_LF):
  24359. goto _12
  24360. case int32(_BT_CR):
  24361. goto _13
  24362. case int32(_BT_S):
  24363. goto _14
  24364. case int32(_BT_EQUALS):
  24365. goto _15
  24366. default:
  24367. goto _16
  24368. }
  24369. goto _17
  24370. _2:
  24371. ;
  24372. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24373. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24374. return m_XML_TOK_INVALID
  24375. } /* fall through */
  24376. _7:
  24377. ;
  24378. _6:
  24379. ;
  24380. _5:
  24381. ;
  24382. _4:
  24383. ;
  24384. _3:
  24385. ;
  24386. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24387. goto _17
  24388. _8:
  24389. ;
  24390. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24391. return -int32(2)
  24392. }
  24393. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24394. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24395. return m_XML_TOK_INVALID
  24396. }
  24397. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24398. goto _17
  24399. _9:
  24400. ;
  24401. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24402. return -int32(2)
  24403. }
  24404. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24406. return m_XML_TOK_INVALID
  24407. }
  24408. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24409. goto _17
  24410. _10:
  24411. ;
  24412. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24413. return -int32(2)
  24414. }
  24415. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24416. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24417. return m_XML_TOK_INVALID
  24418. }
  24419. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24420. goto _17
  24421. _11:
  24422. ;
  24423. if hadColon != 0 {
  24424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24425. return m_XML_TOK_INVALID
  24426. }
  24427. hadColon = int32(1)
  24428. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24429. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24430. return -int32(1)
  24431. }
  24432. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24433. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24434. } else {
  24435. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24436. }
  24437. switch v18 {
  24438. case int32(_BT_NONASCII):
  24439. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24440. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24441. return m_XML_TOK_INVALID
  24442. } /* fall through */
  24443. fallthrough
  24444. case int32(_BT_NMSTRT):
  24445. fallthrough
  24446. case int32(_BT_HEX):
  24447. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24448. case int32(_BT_LEAD2):
  24449. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24450. return -int32(2)
  24451. }
  24452. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24454. return m_XML_TOK_INVALID
  24455. }
  24456. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24457. case int32(_BT_LEAD3):
  24458. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24459. return -int32(2)
  24460. }
  24461. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24463. return m_XML_TOK_INVALID
  24464. }
  24465. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24466. case int32(_BT_LEAD4):
  24467. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24468. return -int32(2)
  24469. }
  24470. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24472. return m_XML_TOK_INVALID
  24473. }
  24474. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24475. default:
  24476. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24477. return m_XML_TOK_INVALID
  24478. }
  24479. goto _17
  24480. _14:
  24481. ;
  24482. _13:
  24483. ;
  24484. _12:
  24485. ;
  24486. _21:
  24487. ;
  24488. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24489. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24490. return -int32(1)
  24491. }
  24492. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24493. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24494. } else {
  24495. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24496. }
  24497. t = v22
  24498. if t == int32(_BT_EQUALS) {
  24499. goto _19
  24500. }
  24501. switch t {
  24502. case int32(_BT_S):
  24503. fallthrough
  24504. case int32(_BT_LF):
  24505. fallthrough
  24506. case int32(_BT_CR):
  24507. default:
  24508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24509. return m_XML_TOK_INVALID
  24510. }
  24511. goto _20
  24512. _20:
  24513. ;
  24514. goto _21
  24515. goto _19
  24516. _19:
  24517. ;
  24518. /* fall through */
  24519. _15:
  24520. ;
  24521. hadColon = 0
  24522. for {
  24523. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24524. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24525. return -int32(1)
  24526. }
  24527. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24528. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24529. } else {
  24530. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24531. }
  24532. open = v24
  24533. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24534. break
  24535. }
  24536. switch open {
  24537. case int32(_BT_S):
  24538. fallthrough
  24539. case int32(_BT_LF):
  24540. fallthrough
  24541. case int32(_BT_CR):
  24542. default:
  24543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24544. return m_XML_TOK_INVALID
  24545. }
  24546. goto _23
  24547. _23:
  24548. }
  24549. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24550. /* in attribute value */
  24551. for {
  24552. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24553. return -int32(1)
  24554. }
  24555. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24556. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24557. } else {
  24558. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24559. }
  24560. t1 = v26
  24561. if t1 == open {
  24562. break
  24563. }
  24564. switch t1 {
  24565. case int32(_BT_LEAD2):
  24566. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  24567. return -int32(2)
  24568. }
  24569. if 0 != 0 {
  24570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24571. return m_XML_TOK_INVALID
  24572. }
  24573. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24574. case int32(_BT_LEAD3):
  24575. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  24576. return -int32(2)
  24577. }
  24578. if 0 != 0 {
  24579. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24580. return m_XML_TOK_INVALID
  24581. }
  24582. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24583. case int32(_BT_LEAD4):
  24584. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  24585. return -int32(2)
  24586. }
  24587. if 0 != 0 {
  24588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24589. return m_XML_TOK_INVALID
  24590. }
  24591. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24592. case int32(_BT_NONXML):
  24593. fallthrough
  24594. case int32(_BT_MALFORM):
  24595. fallthrough
  24596. case int32(_BT_TRAIL):
  24597. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24598. return m_XML_TOK_INVALID
  24599. case int32(_BT_AMP):
  24600. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24601. if tok <= 0 {
  24602. if tok == m_XML_TOK_INVALID {
  24603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24604. }
  24605. return tok
  24606. }
  24607. case int32(_BT_LT):
  24608. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24609. return m_XML_TOK_INVALID
  24610. default:
  24611. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24612. break
  24613. }
  24614. goto _25
  24615. _25:
  24616. }
  24617. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24618. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24619. return -int32(1)
  24620. }
  24621. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24622. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24623. } else {
  24624. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24625. }
  24626. switch v27 {
  24627. case int32(_BT_S):
  24628. fallthrough
  24629. case int32(_BT_CR):
  24630. fallthrough
  24631. case int32(_BT_LF):
  24632. case int32(_BT_SOL):
  24633. goto sol
  24634. case int32(_BT_GT):
  24635. goto gt
  24636. default:
  24637. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24638. return m_XML_TOK_INVALID
  24639. }
  24640. /* ptr points to closing quote */
  24641. _30:
  24642. ;
  24643. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24644. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24645. return -int32(1)
  24646. }
  24647. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24648. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  24649. } else {
  24650. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24651. }
  24652. switch v31 {
  24653. case int32(_BT_NONASCII):
  24654. goto _32
  24655. case int32(_BT_HEX):
  24656. goto _33
  24657. case int32(_BT_NMSTRT):
  24658. goto _34
  24659. case int32(_BT_LEAD2):
  24660. goto _35
  24661. case int32(_BT_LEAD3):
  24662. goto _36
  24663. case int32(_BT_LEAD4):
  24664. goto _37
  24665. case int32(_BT_LF):
  24666. goto _38
  24667. case int32(_BT_CR):
  24668. goto _39
  24669. case int32(_BT_S):
  24670. goto _40
  24671. case int32(_BT_GT):
  24672. goto _41
  24673. case int32(_BT_SOL):
  24674. goto _42
  24675. default:
  24676. goto _43
  24677. }
  24678. goto _44
  24679. _32:
  24680. ;
  24681. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24683. return m_XML_TOK_INVALID
  24684. } /* fall through */
  24685. _34:
  24686. ;
  24687. _33:
  24688. ;
  24689. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24690. goto _44
  24691. _35:
  24692. ;
  24693. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(2)) {
  24694. return -int32(2)
  24695. }
  24696. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24698. return m_XML_TOK_INVALID
  24699. }
  24700. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24701. goto _44
  24702. _36:
  24703. ;
  24704. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(3)) {
  24705. return -int32(2)
  24706. }
  24707. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24708. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24709. return m_XML_TOK_INVALID
  24710. }
  24711. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24712. goto _44
  24713. _37:
  24714. ;
  24715. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(libc.Int32FromInt32(4)) {
  24716. return -int32(2)
  24717. }
  24718. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24720. return m_XML_TOK_INVALID
  24721. }
  24722. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24723. goto _44
  24724. _40:
  24725. ;
  24726. _39:
  24727. ;
  24728. _38:
  24729. ;
  24730. goto _29
  24731. _41:
  24732. ;
  24733. goto gt
  24734. gt:
  24735. ;
  24736. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24737. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24738. _42:
  24739. ;
  24740. goto sol
  24741. sol:
  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 !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  24748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24749. return m_XML_TOK_INVALID
  24750. }
  24751. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24752. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  24753. _43:
  24754. ;
  24755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24756. return m_XML_TOK_INVALID
  24757. _44:
  24758. ;
  24759. goto _28
  24760. goto _29
  24761. _29:
  24762. ;
  24763. goto _30
  24764. goto _28
  24765. _28:
  24766. ;
  24767. goto _17
  24768. _16:
  24769. ;
  24770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24771. return m_XML_TOK_INVALID
  24772. _17:
  24773. }
  24774. return -int32(1)
  24775. }
  24776. /* ptr points to character following "<" */
  24777. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24778. var hadColon, v1, v2, v21, v22, v3 int32
  24779. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  24780. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24781. return -int32(1)
  24782. }
  24783. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24784. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24785. } else {
  24786. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24787. }
  24788. switch v1 {
  24789. case int32(_BT_NONASCII):
  24790. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24791. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24792. return m_XML_TOK_INVALID
  24793. } /* fall through */
  24794. fallthrough
  24795. case int32(_BT_NMSTRT):
  24796. fallthrough
  24797. case int32(_BT_HEX):
  24798. ptr += uintptr(2)
  24799. case int32(_BT_LEAD2):
  24800. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24801. return -int32(2)
  24802. }
  24803. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24805. return m_XML_TOK_INVALID
  24806. }
  24807. ptr += uintptr(2)
  24808. case int32(_BT_LEAD3):
  24809. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24810. return -int32(2)
  24811. }
  24812. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24813. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24814. return m_XML_TOK_INVALID
  24815. }
  24816. ptr += uintptr(3)
  24817. case int32(_BT_LEAD4):
  24818. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24819. return -int32(2)
  24820. }
  24821. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24822. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24823. return m_XML_TOK_INVALID
  24824. }
  24825. ptr += uintptr(4)
  24826. case int32(_BT_EXCL):
  24827. ptr += uintptr(2)
  24828. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24829. return -int32(1)
  24830. }
  24831. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24832. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24833. } else {
  24834. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24835. }
  24836. switch v2 {
  24837. case int32(_BT_MINUS):
  24838. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24839. case int32(_BT_LSQB):
  24840. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24841. }
  24842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24843. return m_XML_TOK_INVALID
  24844. case int32(_BT_QUEST):
  24845. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24846. case int32(_BT_SOL):
  24847. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24848. default:
  24849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24850. return m_XML_TOK_INVALID
  24851. }
  24852. hadColon = 0
  24853. /* we have a start-tag */
  24854. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24855. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24856. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24857. } else {
  24858. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24859. }
  24860. switch v3 {
  24861. case int32(_BT_NONASCII):
  24862. goto _4
  24863. case int32(_BT_MINUS):
  24864. goto _5
  24865. case int32(_BT_NAME):
  24866. goto _6
  24867. case int32(_BT_DIGIT):
  24868. goto _7
  24869. case int32(_BT_HEX):
  24870. goto _8
  24871. case int32(_BT_NMSTRT):
  24872. goto _9
  24873. case int32(_BT_LEAD2):
  24874. goto _10
  24875. case int32(_BT_LEAD3):
  24876. goto _11
  24877. case int32(_BT_LEAD4):
  24878. goto _12
  24879. case int32(_BT_COLON):
  24880. goto _13
  24881. case int32(_BT_LF):
  24882. goto _14
  24883. case int32(_BT_CR):
  24884. goto _15
  24885. case int32(_BT_S):
  24886. goto _16
  24887. case int32(_BT_GT):
  24888. goto _17
  24889. case int32(_BT_SOL):
  24890. goto _18
  24891. default:
  24892. goto _19
  24893. }
  24894. goto _20
  24895. _4:
  24896. ;
  24897. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24898. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24899. return m_XML_TOK_INVALID
  24900. } /* fall through */
  24901. _9:
  24902. ;
  24903. _8:
  24904. ;
  24905. _7:
  24906. ;
  24907. _6:
  24908. ;
  24909. _5:
  24910. ;
  24911. ptr += uintptr(2)
  24912. goto _20
  24913. _10:
  24914. ;
  24915. if int64(end)-int64(ptr) < int64(2) {
  24916. return -int32(2)
  24917. }
  24918. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24920. return m_XML_TOK_INVALID
  24921. }
  24922. ptr += uintptr(2)
  24923. goto _20
  24924. _11:
  24925. ;
  24926. if int64(end)-int64(ptr) < int64(3) {
  24927. return -int32(2)
  24928. }
  24929. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24930. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24931. return m_XML_TOK_INVALID
  24932. }
  24933. ptr += uintptr(3)
  24934. goto _20
  24935. _12:
  24936. ;
  24937. if int64(end)-int64(ptr) < int64(4) {
  24938. return -int32(2)
  24939. }
  24940. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24942. return m_XML_TOK_INVALID
  24943. }
  24944. ptr += uintptr(4)
  24945. goto _20
  24946. _13:
  24947. ;
  24948. if hadColon != 0 {
  24949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24950. return m_XML_TOK_INVALID
  24951. }
  24952. hadColon = int32(1)
  24953. ptr += uintptr(2)
  24954. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  24955. return -int32(1)
  24956. }
  24957. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24958. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24959. } else {
  24960. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24961. }
  24962. switch v21 {
  24963. case int32(_BT_NONASCII):
  24964. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  24965. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24966. return m_XML_TOK_INVALID
  24967. } /* fall through */
  24968. fallthrough
  24969. case int32(_BT_NMSTRT):
  24970. fallthrough
  24971. case int32(_BT_HEX):
  24972. ptr += uintptr(2)
  24973. case int32(_BT_LEAD2):
  24974. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  24975. return -int32(2)
  24976. }
  24977. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24978. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24979. return m_XML_TOK_INVALID
  24980. }
  24981. ptr += uintptr(2)
  24982. case int32(_BT_LEAD3):
  24983. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  24984. return -int32(2)
  24985. }
  24986. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24988. return m_XML_TOK_INVALID
  24989. }
  24990. ptr += uintptr(3)
  24991. case int32(_BT_LEAD4):
  24992. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  24993. return -int32(2)
  24994. }
  24995. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24996. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24997. return m_XML_TOK_INVALID
  24998. }
  24999. ptr += uintptr(4)
  25000. default:
  25001. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25002. return m_XML_TOK_INVALID
  25003. }
  25004. goto _20
  25005. _16:
  25006. ;
  25007. _15:
  25008. ;
  25009. _14:
  25010. ;
  25011. ptr += uintptr(2)
  25012. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25013. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25014. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25015. } else {
  25016. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25017. }
  25018. switch v22 {
  25019. case int32(_BT_NONASCII):
  25020. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25021. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25022. return m_XML_TOK_INVALID
  25023. } /* fall through */
  25024. fallthrough
  25025. case int32(_BT_NMSTRT):
  25026. fallthrough
  25027. case int32(_BT_HEX):
  25028. ptr += uintptr(2)
  25029. case int32(_BT_LEAD2):
  25030. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25031. return -int32(2)
  25032. }
  25033. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25034. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25035. return m_XML_TOK_INVALID
  25036. }
  25037. ptr += uintptr(2)
  25038. case int32(_BT_LEAD3):
  25039. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25040. return -int32(2)
  25041. }
  25042. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25044. return m_XML_TOK_INVALID
  25045. }
  25046. ptr += uintptr(3)
  25047. case int32(_BT_LEAD4):
  25048. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25049. return -int32(2)
  25050. }
  25051. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25052. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25053. return m_XML_TOK_INVALID
  25054. }
  25055. ptr += uintptr(4)
  25056. case int32(_BT_GT):
  25057. goto gt
  25058. case int32(_BT_SOL):
  25059. goto sol
  25060. case int32(_BT_S):
  25061. fallthrough
  25062. case int32(_BT_CR):
  25063. fallthrough
  25064. case int32(_BT_LF):
  25065. ptr += uintptr(2)
  25066. continue
  25067. default:
  25068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25069. return m_XML_TOK_INVALID
  25070. }
  25071. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25072. }
  25073. return -int32(1)
  25074. _17:
  25075. ;
  25076. goto gt
  25077. gt:
  25078. ;
  25079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25080. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25081. _18:
  25082. ;
  25083. goto sol
  25084. sol:
  25085. ;
  25086. ptr += uintptr(2)
  25087. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25088. return -int32(1)
  25089. }
  25090. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25091. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25092. return m_XML_TOK_INVALID
  25093. }
  25094. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25095. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25096. _19:
  25097. ;
  25098. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25099. return m_XML_TOK_INVALID
  25100. _20:
  25101. }
  25102. return -int32(1)
  25103. }
  25104. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25105. var n Tsize_t
  25106. var v1, v2, v3 int32
  25107. _, _, _, _ = n, v1, v2, v3
  25108. if ptr >= end {
  25109. return -int32(4)
  25110. }
  25111. if int32(2) > int32(1) {
  25112. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25113. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25114. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25115. if n == uint64(0) {
  25116. return -int32(1)
  25117. }
  25118. end = ptr + uintptr(n)
  25119. }
  25120. }
  25121. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25122. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25123. } else {
  25124. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25125. }
  25126. switch v1 {
  25127. case int32(_BT_LT):
  25128. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25129. case int32(_BT_AMP):
  25130. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25131. case int32(_BT_CR):
  25132. ptr += uintptr(2)
  25133. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25134. return -int32(3)
  25135. }
  25136. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25137. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25138. } else {
  25139. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25140. }
  25141. if v2 == int32(_BT_LF) {
  25142. ptr += uintptr(2)
  25143. }
  25144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25145. return int32(m_XML_TOK_DATA_NEWLINE)
  25146. case int32(_BT_LF):
  25147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25148. return int32(m_XML_TOK_DATA_NEWLINE)
  25149. case int32(_BT_RSQB):
  25150. ptr += uintptr(2)
  25151. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25152. return -int32(5)
  25153. }
  25154. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25155. break
  25156. }
  25157. ptr += uintptr(2)
  25158. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25159. return -int32(5)
  25160. }
  25161. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25162. ptr -= uintptr(2)
  25163. break
  25164. }
  25165. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25166. return m_XML_TOK_INVALID
  25167. case int32(_BT_LEAD2):
  25168. if int64(end)-int64(ptr) < int64(2) {
  25169. return -int32(2)
  25170. }
  25171. if 0 != 0 {
  25172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25173. return m_XML_TOK_INVALID
  25174. }
  25175. ptr += uintptr(2)
  25176. case int32(_BT_LEAD3):
  25177. if int64(end)-int64(ptr) < int64(3) {
  25178. return -int32(2)
  25179. }
  25180. if 0 != 0 {
  25181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25182. return m_XML_TOK_INVALID
  25183. }
  25184. ptr += uintptr(3)
  25185. case int32(_BT_LEAD4):
  25186. if int64(end)-int64(ptr) < int64(4) {
  25187. return -int32(2)
  25188. }
  25189. if 0 != 0 {
  25190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25191. return m_XML_TOK_INVALID
  25192. }
  25193. ptr += uintptr(4)
  25194. case int32(_BT_NONXML):
  25195. fallthrough
  25196. case int32(_BT_MALFORM):
  25197. fallthrough
  25198. case int32(_BT_TRAIL):
  25199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25200. return m_XML_TOK_INVALID
  25201. default:
  25202. ptr += uintptr(2)
  25203. break
  25204. }
  25205. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25206. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25207. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25208. } else {
  25209. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25210. }
  25211. switch v3 {
  25212. case int32(_BT_LEAD2):
  25213. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  25214. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25215. return int32(m_XML_TOK_DATA_CHARS)
  25216. }
  25217. ptr += uintptr(2)
  25218. case int32(_BT_LEAD3):
  25219. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  25220. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25221. return int32(m_XML_TOK_DATA_CHARS)
  25222. }
  25223. ptr += uintptr(3)
  25224. case int32(_BT_LEAD4):
  25225. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  25226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25227. return int32(m_XML_TOK_DATA_CHARS)
  25228. }
  25229. ptr += uintptr(4)
  25230. case int32(_BT_RSQB):
  25231. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25232. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  25233. ptr += uintptr(2)
  25234. break
  25235. }
  25236. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  25237. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  25238. ptr += uintptr(2)
  25239. break
  25240. }
  25241. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25242. return m_XML_TOK_INVALID
  25243. }
  25244. }
  25245. /* fall through */
  25246. fallthrough
  25247. case int32(_BT_AMP):
  25248. fallthrough
  25249. case int32(_BT_LT):
  25250. fallthrough
  25251. case int32(_BT_NONXML):
  25252. fallthrough
  25253. case int32(_BT_MALFORM):
  25254. fallthrough
  25255. case int32(_BT_TRAIL):
  25256. fallthrough
  25257. case int32(_BT_CR):
  25258. fallthrough
  25259. case int32(_BT_LF):
  25260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25261. return int32(m_XML_TOK_DATA_CHARS)
  25262. default:
  25263. ptr += uintptr(2)
  25264. break
  25265. }
  25266. }
  25267. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25268. return int32(m_XML_TOK_DATA_CHARS)
  25269. }
  25270. /* ptr points to character following "%" */
  25271. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25272. var v1, v2 int32
  25273. _, _ = v1, v2
  25274. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25275. return -int32(1)
  25276. }
  25277. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25278. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25279. } else {
  25280. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25281. }
  25282. switch v1 {
  25283. case int32(_BT_NONASCII):
  25284. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25285. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25286. return m_XML_TOK_INVALID
  25287. } /* fall through */
  25288. fallthrough
  25289. case int32(_BT_NMSTRT):
  25290. fallthrough
  25291. case int32(_BT_HEX):
  25292. ptr += uintptr(2)
  25293. case int32(_BT_LEAD2):
  25294. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25295. return -int32(2)
  25296. }
  25297. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25298. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25299. return m_XML_TOK_INVALID
  25300. }
  25301. ptr += uintptr(2)
  25302. case int32(_BT_LEAD3):
  25303. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25304. return -int32(2)
  25305. }
  25306. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25308. return m_XML_TOK_INVALID
  25309. }
  25310. ptr += uintptr(3)
  25311. case int32(_BT_LEAD4):
  25312. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25313. return -int32(2)
  25314. }
  25315. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25317. return m_XML_TOK_INVALID
  25318. }
  25319. ptr += uintptr(4)
  25320. case int32(_BT_S):
  25321. fallthrough
  25322. case int32(_BT_LF):
  25323. fallthrough
  25324. case int32(_BT_CR):
  25325. fallthrough
  25326. case int32(_BT_PERCNT):
  25327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25328. return int32(m_XML_TOK_PERCENT)
  25329. default:
  25330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25331. return m_XML_TOK_INVALID
  25332. }
  25333. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25334. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25335. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25336. } else {
  25337. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25338. }
  25339. switch v2 {
  25340. case int32(_BT_NONASCII):
  25341. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25343. return m_XML_TOK_INVALID
  25344. } /* fall through */
  25345. fallthrough
  25346. case int32(_BT_NMSTRT):
  25347. fallthrough
  25348. case int32(_BT_HEX):
  25349. fallthrough
  25350. case int32(_BT_DIGIT):
  25351. fallthrough
  25352. case int32(_BT_NAME):
  25353. fallthrough
  25354. case int32(_BT_MINUS):
  25355. ptr += uintptr(2)
  25356. case int32(_BT_LEAD2):
  25357. if int64(end)-int64(ptr) < int64(2) {
  25358. return -int32(2)
  25359. }
  25360. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25362. return m_XML_TOK_INVALID
  25363. }
  25364. ptr += uintptr(2)
  25365. case int32(_BT_LEAD3):
  25366. if int64(end)-int64(ptr) < int64(3) {
  25367. return -int32(2)
  25368. }
  25369. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25371. return m_XML_TOK_INVALID
  25372. }
  25373. ptr += uintptr(3)
  25374. case int32(_BT_LEAD4):
  25375. if int64(end)-int64(ptr) < int64(4) {
  25376. return -int32(2)
  25377. }
  25378. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25379. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25380. return m_XML_TOK_INVALID
  25381. }
  25382. ptr += uintptr(4)
  25383. case int32(_BT_SEMI):
  25384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25385. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25386. default:
  25387. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25388. return m_XML_TOK_INVALID
  25389. }
  25390. }
  25391. return -int32(1)
  25392. }
  25393. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25394. var v1, v2 int32
  25395. _, _ = v1, v2
  25396. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25397. return -int32(1)
  25398. }
  25399. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25400. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25401. } else {
  25402. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25403. }
  25404. switch v1 {
  25405. case int32(_BT_NONASCII):
  25406. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25407. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25408. return m_XML_TOK_INVALID
  25409. } /* fall through */
  25410. fallthrough
  25411. case int32(_BT_NMSTRT):
  25412. fallthrough
  25413. case int32(_BT_HEX):
  25414. ptr += uintptr(2)
  25415. case int32(_BT_LEAD2):
  25416. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(2)) {
  25417. return -int32(2)
  25418. }
  25419. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25421. return m_XML_TOK_INVALID
  25422. }
  25423. ptr += uintptr(2)
  25424. case int32(_BT_LEAD3):
  25425. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(3)) {
  25426. return -int32(2)
  25427. }
  25428. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25429. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25430. return m_XML_TOK_INVALID
  25431. }
  25432. ptr += uintptr(3)
  25433. case int32(_BT_LEAD4):
  25434. if int64(end)-int64(ptr) < int64(libc.Int32FromInt32(4)) {
  25435. return -int32(2)
  25436. }
  25437. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25439. return m_XML_TOK_INVALID
  25440. }
  25441. ptr += uintptr(4)
  25442. default:
  25443. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25444. return m_XML_TOK_INVALID
  25445. }
  25446. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25447. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25448. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25449. } else {
  25450. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25451. }
  25452. switch v2 {
  25453. case int32(_BT_NONASCII):
  25454. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25455. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25456. return m_XML_TOK_INVALID
  25457. } /* fall through */
  25458. fallthrough
  25459. case int32(_BT_NMSTRT):
  25460. fallthrough
  25461. case int32(_BT_HEX):
  25462. fallthrough
  25463. case int32(_BT_DIGIT):
  25464. fallthrough
  25465. case int32(_BT_NAME):
  25466. fallthrough
  25467. case int32(_BT_MINUS):
  25468. ptr += uintptr(2)
  25469. case int32(_BT_LEAD2):
  25470. if int64(end)-int64(ptr) < int64(2) {
  25471. return -int32(2)
  25472. }
  25473. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25475. return m_XML_TOK_INVALID
  25476. }
  25477. ptr += uintptr(2)
  25478. case int32(_BT_LEAD3):
  25479. if int64(end)-int64(ptr) < int64(3) {
  25480. return -int32(2)
  25481. }
  25482. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25484. return m_XML_TOK_INVALID
  25485. }
  25486. ptr += uintptr(3)
  25487. case int32(_BT_LEAD4):
  25488. if int64(end)-int64(ptr) < int64(4) {
  25489. return -int32(2)
  25490. }
  25491. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25493. return m_XML_TOK_INVALID
  25494. }
  25495. ptr += uintptr(4)
  25496. case int32(_BT_CR):
  25497. fallthrough
  25498. case int32(_BT_LF):
  25499. fallthrough
  25500. case int32(_BT_S):
  25501. fallthrough
  25502. case int32(_BT_RPAR):
  25503. fallthrough
  25504. case int32(_BT_GT):
  25505. fallthrough
  25506. case int32(_BT_PERCNT):
  25507. fallthrough
  25508. case int32(_BT_VERBAR):
  25509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25510. return int32(m_XML_TOK_POUND_NAME)
  25511. default:
  25512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25513. return m_XML_TOK_INVALID
  25514. }
  25515. }
  25516. return -int32(m_XML_TOK_POUND_NAME)
  25517. }
  25518. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25519. var t, v1, v2 int32
  25520. _, _, _ = t, v1, v2
  25521. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25522. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25523. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25524. } else {
  25525. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25526. }
  25527. t = v1
  25528. switch t {
  25529. case int32(_BT_LEAD2):
  25530. if int64(end)-int64(ptr) < int64(2) {
  25531. return -int32(2)
  25532. }
  25533. if 0 != 0 {
  25534. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25535. return m_XML_TOK_INVALID
  25536. }
  25537. ptr += uintptr(2)
  25538. case int32(_BT_LEAD3):
  25539. if int64(end)-int64(ptr) < int64(3) {
  25540. return -int32(2)
  25541. }
  25542. if 0 != 0 {
  25543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25544. return m_XML_TOK_INVALID
  25545. }
  25546. ptr += uintptr(3)
  25547. case int32(_BT_LEAD4):
  25548. if int64(end)-int64(ptr) < int64(4) {
  25549. return -int32(2)
  25550. }
  25551. if 0 != 0 {
  25552. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25553. return m_XML_TOK_INVALID
  25554. }
  25555. ptr += uintptr(4)
  25556. case int32(_BT_NONXML):
  25557. fallthrough
  25558. case int32(_BT_MALFORM):
  25559. fallthrough
  25560. case int32(_BT_TRAIL):
  25561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25562. return m_XML_TOK_INVALID
  25563. case int32(_BT_QUOT):
  25564. fallthrough
  25565. case int32(_BT_APOS):
  25566. ptr += uintptr(2)
  25567. if t != open {
  25568. break
  25569. }
  25570. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25571. return -int32(m_XML_TOK_LITERAL)
  25572. }
  25573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25574. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25575. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25576. } else {
  25577. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25578. }
  25579. switch v2 {
  25580. case int32(_BT_S):
  25581. fallthrough
  25582. case int32(_BT_CR):
  25583. fallthrough
  25584. case int32(_BT_LF):
  25585. fallthrough
  25586. case int32(_BT_GT):
  25587. fallthrough
  25588. case int32(_BT_PERCNT):
  25589. fallthrough
  25590. case int32(_BT_LSQB):
  25591. return int32(m_XML_TOK_LITERAL)
  25592. default:
  25593. return m_XML_TOK_INVALID
  25594. }
  25595. fallthrough
  25596. default:
  25597. ptr += uintptr(2)
  25598. break
  25599. }
  25600. }
  25601. return -int32(1)
  25602. }
  25603. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25604. var n Tsize_t
  25605. var tok, v1, v29, v33, v34, v35, v36 int32
  25606. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25607. if ptr >= end {
  25608. return -int32(4)
  25609. }
  25610. if int32(2) > int32(1) {
  25611. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  25612. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25613. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25614. if n == uint64(0) {
  25615. return -int32(1)
  25616. }
  25617. end = ptr + uintptr(n)
  25618. }
  25619. }
  25620. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25621. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25622. } else {
  25623. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25624. }
  25625. switch v1 {
  25626. case int32(_BT_QUOT):
  25627. goto _2
  25628. case int32(_BT_APOS):
  25629. goto _3
  25630. case int32(_BT_LT):
  25631. goto _4
  25632. case int32(_BT_CR):
  25633. goto _5
  25634. case int32(_BT_LF):
  25635. goto _6
  25636. case int32(_BT_S):
  25637. goto _7
  25638. case int32(_BT_PERCNT):
  25639. goto _8
  25640. case int32(_BT_COMMA):
  25641. goto _9
  25642. case int32(_BT_LSQB):
  25643. goto _10
  25644. case int32(_BT_RSQB):
  25645. goto _11
  25646. case int32(_BT_LPAR):
  25647. goto _12
  25648. case int32(_BT_RPAR):
  25649. goto _13
  25650. case int32(_BT_VERBAR):
  25651. goto _14
  25652. case int32(_BT_GT):
  25653. goto _15
  25654. case int32(_BT_NUM):
  25655. goto _16
  25656. case int32(_BT_LEAD2):
  25657. goto _17
  25658. case int32(_BT_LEAD3):
  25659. goto _18
  25660. case int32(_BT_LEAD4):
  25661. goto _19
  25662. case int32(_BT_HEX):
  25663. goto _20
  25664. case int32(_BT_NMSTRT):
  25665. goto _21
  25666. case int32(_BT_COLON):
  25667. goto _22
  25668. case int32(_BT_MINUS):
  25669. goto _23
  25670. case int32(_BT_NAME):
  25671. goto _24
  25672. case int32(_BT_DIGIT):
  25673. goto _25
  25674. case int32(_BT_NONASCII):
  25675. goto _26
  25676. default:
  25677. goto _27
  25678. }
  25679. goto _28
  25680. _2:
  25681. ;
  25682. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25683. _3:
  25684. ;
  25685. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25686. _4:
  25687. ;
  25688. ptr += uintptr(2)
  25689. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25690. return -int32(1)
  25691. }
  25692. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25693. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25694. } else {
  25695. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25696. }
  25697. switch v29 {
  25698. case int32(_BT_EXCL):
  25699. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25700. case int32(_BT_QUEST):
  25701. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25702. case int32(_BT_NMSTRT):
  25703. fallthrough
  25704. case int32(_BT_HEX):
  25705. fallthrough
  25706. case int32(_BT_NONASCII):
  25707. fallthrough
  25708. case int32(_BT_LEAD2):
  25709. fallthrough
  25710. case int32(_BT_LEAD3):
  25711. fallthrough
  25712. case int32(_BT_LEAD4):
  25713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25714. return int32(m_XML_TOK_INSTANCE_START)
  25715. }
  25716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25717. return m_XML_TOK_INVALID
  25718. _5:
  25719. ;
  25720. if ptr+uintptr(2) == end {
  25721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25722. /* indicate that this might be part of a CR/LF pair */
  25723. return -int32(m_XML_TOK_PROLOG_S)
  25724. }
  25725. /* fall through */
  25726. _7:
  25727. ;
  25728. _6:
  25729. ;
  25730. _32:
  25731. ;
  25732. ptr += uintptr(2)
  25733. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25734. goto _30
  25735. }
  25736. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25737. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25738. } else {
  25739. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25740. }
  25741. switch v33 {
  25742. case int32(_BT_S):
  25743. fallthrough
  25744. case int32(_BT_LF):
  25745. case int32(_BT_CR):
  25746. /* don't split CR/LF pair */
  25747. if ptr+uintptr(2) != end {
  25748. break
  25749. }
  25750. /* fall through */
  25751. fallthrough
  25752. default:
  25753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25754. return int32(m_XML_TOK_PROLOG_S)
  25755. }
  25756. goto _31
  25757. _31:
  25758. ;
  25759. goto _32
  25760. goto _30
  25761. _30:
  25762. ;
  25763. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25764. return int32(m_XML_TOK_PROLOG_S)
  25765. _8:
  25766. ;
  25767. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25768. _9:
  25769. ;
  25770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25771. return int32(m_XML_TOK_COMMA)
  25772. _10:
  25773. ;
  25774. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25775. return int32(m_XML_TOK_OPEN_BRACKET)
  25776. _11:
  25777. ;
  25778. ptr += uintptr(2)
  25779. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25780. return -int32(m_XML_TOK_CLOSE_BRACKET)
  25781. }
  25782. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  25783. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  25784. return -int32(1)
  25785. }
  25786. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  25787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25788. return int32(m_XML_TOK_COND_SECT_CLOSE)
  25789. }
  25790. }
  25791. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25792. return int32(m_XML_TOK_CLOSE_BRACKET)
  25793. _12:
  25794. ;
  25795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25796. return int32(m_XML_TOK_OPEN_PAREN)
  25797. _13:
  25798. ;
  25799. ptr += uintptr(2)
  25800. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  25801. return -int32(m_XML_TOK_CLOSE_PAREN)
  25802. }
  25803. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25804. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25805. } else {
  25806. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25807. }
  25808. switch v34 {
  25809. case int32(_BT_AST):
  25810. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25811. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  25812. case int32(_BT_QUEST):
  25813. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25814. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  25815. case int32(_BT_PLUS):
  25816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25817. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  25818. case int32(_BT_CR):
  25819. fallthrough
  25820. case int32(_BT_LF):
  25821. fallthrough
  25822. case int32(_BT_S):
  25823. fallthrough
  25824. case int32(_BT_GT):
  25825. fallthrough
  25826. case int32(_BT_COMMA):
  25827. fallthrough
  25828. case int32(_BT_VERBAR):
  25829. fallthrough
  25830. case int32(_BT_RPAR):
  25831. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25832. return int32(m_XML_TOK_CLOSE_PAREN)
  25833. }
  25834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25835. return m_XML_TOK_INVALID
  25836. _14:
  25837. ;
  25838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25839. return int32(m_XML_TOK_OR)
  25840. _15:
  25841. ;
  25842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25843. return int32(m_XML_TOK_DECL_CLOSE)
  25844. _16:
  25845. ;
  25846. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25847. _17:
  25848. ;
  25849. if int64(end)-int64(ptr) < int64(2) {
  25850. return -int32(2)
  25851. }
  25852. if 0 != 0 {
  25853. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25854. return m_XML_TOK_INVALID
  25855. }
  25856. if 0 != 0 {
  25857. ptr += uintptr(2)
  25858. tok = int32(m_XML_TOK_NAME)
  25859. goto _28
  25860. }
  25861. if 0 != 0 {
  25862. ptr += uintptr(2)
  25863. tok = int32(m_XML_TOK_NMTOKEN)
  25864. goto _28
  25865. }
  25866. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25867. return m_XML_TOK_INVALID
  25868. _18:
  25869. ;
  25870. if int64(end)-int64(ptr) < int64(3) {
  25871. return -int32(2)
  25872. }
  25873. if 0 != 0 {
  25874. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25875. return m_XML_TOK_INVALID
  25876. }
  25877. if 0 != 0 {
  25878. ptr += uintptr(3)
  25879. tok = int32(m_XML_TOK_NAME)
  25880. goto _28
  25881. }
  25882. if 0 != 0 {
  25883. ptr += uintptr(3)
  25884. tok = int32(m_XML_TOK_NMTOKEN)
  25885. goto _28
  25886. }
  25887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25888. return m_XML_TOK_INVALID
  25889. _19:
  25890. ;
  25891. if int64(end)-int64(ptr) < int64(4) {
  25892. return -int32(2)
  25893. }
  25894. if 0 != 0 {
  25895. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25896. return m_XML_TOK_INVALID
  25897. }
  25898. if 0 != 0 {
  25899. ptr += uintptr(4)
  25900. tok = int32(m_XML_TOK_NAME)
  25901. goto _28
  25902. }
  25903. if 0 != 0 {
  25904. ptr += uintptr(4)
  25905. tok = int32(m_XML_TOK_NMTOKEN)
  25906. goto _28
  25907. }
  25908. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25909. return m_XML_TOK_INVALID
  25910. _21:
  25911. ;
  25912. _20:
  25913. ;
  25914. tok = int32(m_XML_TOK_NAME)
  25915. ptr += uintptr(2)
  25916. goto _28
  25917. _25:
  25918. ;
  25919. _24:
  25920. ;
  25921. _23:
  25922. ;
  25923. _22:
  25924. ;
  25925. tok = int32(m_XML_TOK_NMTOKEN)
  25926. ptr += uintptr(2)
  25927. goto _28
  25928. _26:
  25929. ;
  25930. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  25931. ptr += uintptr(2)
  25932. tok = int32(m_XML_TOK_NAME)
  25933. goto _28
  25934. }
  25935. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  25936. ptr += uintptr(2)
  25937. tok = int32(m_XML_TOK_NMTOKEN)
  25938. goto _28
  25939. }
  25940. /* fall through */
  25941. _27:
  25942. ;
  25943. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25944. return m_XML_TOK_INVALID
  25945. _28:
  25946. ;
  25947. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25948. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  25949. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  25950. } else {
  25951. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  25952. }
  25953. switch v35 {
  25954. case int32(_BT_NONASCII):
  25955. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  25956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25957. return m_XML_TOK_INVALID
  25958. } /* fall through */
  25959. fallthrough
  25960. case int32(_BT_NMSTRT):
  25961. fallthrough
  25962. case int32(_BT_HEX):
  25963. fallthrough
  25964. case int32(_BT_DIGIT):
  25965. fallthrough
  25966. case int32(_BT_NAME):
  25967. fallthrough
  25968. case int32(_BT_MINUS):
  25969. ptr += uintptr(2)
  25970. case int32(_BT_LEAD2):
  25971. if int64(end)-int64(ptr) < int64(2) {
  25972. return -int32(2)
  25973. }
  25974. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25976. return m_XML_TOK_INVALID
  25977. }
  25978. ptr += uintptr(2)
  25979. case int32(_BT_LEAD3):
  25980. if int64(end)-int64(ptr) < int64(3) {
  25981. return -int32(2)
  25982. }
  25983. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25985. return m_XML_TOK_INVALID
  25986. }
  25987. ptr += uintptr(3)
  25988. case int32(_BT_LEAD4):
  25989. if int64(end)-int64(ptr) < int64(4) {
  25990. return -int32(2)
  25991. }
  25992. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25994. return m_XML_TOK_INVALID
  25995. }
  25996. ptr += uintptr(4)
  25997. case int32(_BT_GT):
  25998. fallthrough
  25999. case int32(_BT_RPAR):
  26000. fallthrough
  26001. case int32(_BT_COMMA):
  26002. fallthrough
  26003. case int32(_BT_VERBAR):
  26004. fallthrough
  26005. case int32(_BT_LSQB):
  26006. fallthrough
  26007. case int32(_BT_PERCNT):
  26008. fallthrough
  26009. case int32(_BT_S):
  26010. fallthrough
  26011. case int32(_BT_CR):
  26012. fallthrough
  26013. case int32(_BT_LF):
  26014. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26015. return tok
  26016. case int32(_BT_COLON):
  26017. ptr += uintptr(2)
  26018. switch tok {
  26019. case int32(m_XML_TOK_NAME):
  26020. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26021. return -int32(1)
  26022. }
  26023. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26024. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26025. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26026. } else {
  26027. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26028. }
  26029. switch v36 {
  26030. case int32(_BT_NONASCII):
  26031. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  26032. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26033. return m_XML_TOK_INVALID
  26034. } /* fall through */
  26035. fallthrough
  26036. case int32(_BT_NMSTRT):
  26037. fallthrough
  26038. case int32(_BT_HEX):
  26039. fallthrough
  26040. case int32(_BT_DIGIT):
  26041. fallthrough
  26042. case int32(_BT_NAME):
  26043. fallthrough
  26044. case int32(_BT_MINUS):
  26045. ptr += uintptr(2)
  26046. case int32(_BT_LEAD2):
  26047. if int64(end)-int64(ptr) < int64(2) {
  26048. return -int32(2)
  26049. }
  26050. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26052. return m_XML_TOK_INVALID
  26053. }
  26054. ptr += uintptr(2)
  26055. case int32(_BT_LEAD3):
  26056. if int64(end)-int64(ptr) < int64(3) {
  26057. return -int32(2)
  26058. }
  26059. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26061. return m_XML_TOK_INVALID
  26062. }
  26063. ptr += uintptr(3)
  26064. case int32(_BT_LEAD4):
  26065. if int64(end)-int64(ptr) < int64(4) {
  26066. return -int32(2)
  26067. }
  26068. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26069. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26070. return m_XML_TOK_INVALID
  26071. }
  26072. ptr += uintptr(4)
  26073. default:
  26074. tok = int32(m_XML_TOK_NMTOKEN)
  26075. break
  26076. }
  26077. case int32(m_XML_TOK_PREFIXED_NAME):
  26078. tok = int32(m_XML_TOK_NMTOKEN)
  26079. break
  26080. }
  26081. case int32(_BT_PLUS):
  26082. if tok == int32(m_XML_TOK_NMTOKEN) {
  26083. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26084. return m_XML_TOK_INVALID
  26085. }
  26086. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26087. return int32(m_XML_TOK_NAME_PLUS)
  26088. case int32(_BT_AST):
  26089. if tok == int32(m_XML_TOK_NMTOKEN) {
  26090. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26091. return m_XML_TOK_INVALID
  26092. }
  26093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26094. return int32(m_XML_TOK_NAME_ASTERISK)
  26095. case int32(_BT_QUEST):
  26096. if tok == int32(m_XML_TOK_NMTOKEN) {
  26097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26098. return m_XML_TOK_INVALID
  26099. }
  26100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26101. return int32(m_XML_TOK_NAME_QUESTION)
  26102. default:
  26103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26104. return m_XML_TOK_INVALID
  26105. }
  26106. }
  26107. return -tok
  26108. }
  26109. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26110. var start uintptr
  26111. var v1, v2 int32
  26112. _, _, _ = start, v1, v2
  26113. if ptr >= end {
  26114. return -int32(4)
  26115. } else {
  26116. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26117. /* This line cannot be executed. The incoming data has already
  26118. * been tokenized once, so incomplete characters like this have
  26119. * already been eliminated from the input. Retaining the paranoia
  26120. * check is still valuable, however.
  26121. */
  26122. return -int32(1) /* LCOV_EXCL_LINE */
  26123. }
  26124. }
  26125. start = ptr
  26126. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26127. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26128. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26129. } else {
  26130. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26131. }
  26132. switch v1 {
  26133. case int32(_BT_LEAD2):
  26134. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26135. case int32(_BT_LEAD3):
  26136. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26137. case int32(_BT_LEAD4):
  26138. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26139. case int32(_BT_AMP):
  26140. if ptr == start {
  26141. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26142. }
  26143. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26144. return int32(m_XML_TOK_DATA_CHARS)
  26145. case int32(_BT_LT):
  26146. /* this is for inside entity references */
  26147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26148. return m_XML_TOK_INVALID
  26149. case int32(_BT_LF):
  26150. if ptr == start {
  26151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26152. return int32(m_XML_TOK_DATA_NEWLINE)
  26153. }
  26154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26155. return int32(m_XML_TOK_DATA_CHARS)
  26156. case int32(_BT_CR):
  26157. if ptr == start {
  26158. ptr += uintptr(2)
  26159. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26160. return -int32(3)
  26161. }
  26162. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26163. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26164. } else {
  26165. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26166. }
  26167. if v2 == int32(_BT_LF) {
  26168. ptr += uintptr(2)
  26169. }
  26170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26171. return int32(m_XML_TOK_DATA_NEWLINE)
  26172. }
  26173. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26174. return int32(m_XML_TOK_DATA_CHARS)
  26175. case int32(_BT_S):
  26176. if ptr == start {
  26177. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26178. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26179. }
  26180. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26181. return int32(m_XML_TOK_DATA_CHARS)
  26182. default:
  26183. ptr += uintptr(2)
  26184. break
  26185. }
  26186. }
  26187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26188. return int32(m_XML_TOK_DATA_CHARS)
  26189. }
  26190. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26191. var start uintptr
  26192. var tok, v1, v2, v3 int32
  26193. _, _, _, _, _ = start, tok, v1, v2, v3
  26194. if ptr >= end {
  26195. return -int32(4)
  26196. } else {
  26197. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26198. /* This line cannot be executed. The incoming data has already
  26199. * been tokenized once, so incomplete characters like this have
  26200. * already been eliminated from the input. Retaining the paranoia
  26201. * check is still valuable, however.
  26202. */
  26203. return -int32(1) /* LCOV_EXCL_LINE */
  26204. }
  26205. }
  26206. start = ptr
  26207. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26208. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26209. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26210. } else {
  26211. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26212. }
  26213. switch v1 {
  26214. case int32(_BT_LEAD2):
  26215. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26216. case int32(_BT_LEAD3):
  26217. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26218. case int32(_BT_LEAD4):
  26219. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26220. case int32(_BT_AMP):
  26221. if ptr == start {
  26222. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26223. }
  26224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26225. return int32(m_XML_TOK_DATA_CHARS)
  26226. case int32(_BT_PERCNT):
  26227. if ptr == start {
  26228. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26229. if tok == int32(m_XML_TOK_PERCENT) {
  26230. v2 = m_XML_TOK_INVALID
  26231. } else {
  26232. v2 = tok
  26233. }
  26234. return v2
  26235. }
  26236. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26237. return int32(m_XML_TOK_DATA_CHARS)
  26238. case int32(_BT_LF):
  26239. if ptr == start {
  26240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26241. return int32(m_XML_TOK_DATA_NEWLINE)
  26242. }
  26243. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26244. return int32(m_XML_TOK_DATA_CHARS)
  26245. case int32(_BT_CR):
  26246. if ptr == start {
  26247. ptr += uintptr(2)
  26248. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26249. return -int32(3)
  26250. }
  26251. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26252. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26253. } else {
  26254. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26255. }
  26256. if v3 == int32(_BT_LF) {
  26257. ptr += uintptr(2)
  26258. }
  26259. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26260. return int32(m_XML_TOK_DATA_NEWLINE)
  26261. }
  26262. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26263. return int32(m_XML_TOK_DATA_CHARS)
  26264. default:
  26265. ptr += uintptr(2)
  26266. break
  26267. }
  26268. }
  26269. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26270. return int32(m_XML_TOK_DATA_CHARS)
  26271. }
  26272. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26273. var level, v1 int32
  26274. var n Tsize_t
  26275. _, _, _ = level, n, v1
  26276. level = 0
  26277. if int32(2) > int32(1) {
  26278. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  26279. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26280. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26281. end = ptr + uintptr(n)
  26282. }
  26283. }
  26284. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26285. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26286. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26287. } else {
  26288. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26289. }
  26290. switch v1 {
  26291. case int32(_BT_LEAD2):
  26292. if int64(end)-int64(ptr) < int64(2) {
  26293. return -int32(2)
  26294. }
  26295. if 0 != 0 {
  26296. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26297. return m_XML_TOK_INVALID
  26298. }
  26299. ptr += uintptr(2)
  26300. case int32(_BT_LEAD3):
  26301. if int64(end)-int64(ptr) < int64(3) {
  26302. return -int32(2)
  26303. }
  26304. if 0 != 0 {
  26305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26306. return m_XML_TOK_INVALID
  26307. }
  26308. ptr += uintptr(3)
  26309. case int32(_BT_LEAD4):
  26310. if int64(end)-int64(ptr) < int64(4) {
  26311. return -int32(2)
  26312. }
  26313. if 0 != 0 {
  26314. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26315. return m_XML_TOK_INVALID
  26316. }
  26317. ptr += uintptr(4)
  26318. case int32(_BT_NONXML):
  26319. fallthrough
  26320. case int32(_BT_MALFORM):
  26321. fallthrough
  26322. case int32(_BT_TRAIL):
  26323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26324. return m_XML_TOK_INVALID
  26325. case int32(_BT_LT):
  26326. ptr += uintptr(2)
  26327. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26328. return -int32(1)
  26329. }
  26330. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26331. ptr += uintptr(2)
  26332. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26333. return -int32(1)
  26334. }
  26335. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26336. level++
  26337. ptr += uintptr(2)
  26338. }
  26339. }
  26340. case int32(_BT_RSQB):
  26341. ptr += uintptr(2)
  26342. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26343. return -int32(1)
  26344. }
  26345. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26346. ptr += uintptr(2)
  26347. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26348. return -int32(1)
  26349. }
  26350. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26351. ptr += uintptr(2)
  26352. if level == 0 {
  26353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26354. return int32(m_XML_TOK_IGNORE_SECT)
  26355. }
  26356. level--
  26357. }
  26358. }
  26359. default:
  26360. ptr += uintptr(2)
  26361. break
  26362. }
  26363. }
  26364. return -int32(1)
  26365. }
  26366. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26367. var v2, v3, v4 int32
  26368. _, _, _ = v2, v3, v4
  26369. ptr += uintptr(2)
  26370. end -= uintptr(2)
  26371. for {
  26372. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  26373. break
  26374. }
  26375. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26376. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26377. } else {
  26378. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26379. }
  26380. switch v2 {
  26381. case int32(_BT_DIGIT):
  26382. fallthrough
  26383. case int32(_BT_HEX):
  26384. fallthrough
  26385. case int32(_BT_MINUS):
  26386. fallthrough
  26387. case int32(_BT_APOS):
  26388. fallthrough
  26389. case int32(_BT_LPAR):
  26390. fallthrough
  26391. case int32(_BT_RPAR):
  26392. fallthrough
  26393. case int32(_BT_PLUS):
  26394. fallthrough
  26395. case int32(_BT_COMMA):
  26396. fallthrough
  26397. case int32(_BT_SOL):
  26398. fallthrough
  26399. case int32(_BT_EQUALS):
  26400. fallthrough
  26401. case int32(_BT_QUEST):
  26402. fallthrough
  26403. case int32(_BT_CR):
  26404. fallthrough
  26405. case int32(_BT_LF):
  26406. fallthrough
  26407. case int32(_BT_SEMI):
  26408. fallthrough
  26409. case int32(_BT_EXCL):
  26410. fallthrough
  26411. case int32(_BT_AST):
  26412. fallthrough
  26413. case int32(_BT_PERCNT):
  26414. fallthrough
  26415. case int32(_BT_NUM):
  26416. fallthrough
  26417. case int32(_BT_COLON):
  26418. case int32(_BT_S):
  26419. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26420. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26421. return 0
  26422. }
  26423. case int32(_BT_NAME):
  26424. fallthrough
  26425. case int32(_BT_NMSTRT):
  26426. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26427. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26428. } else {
  26429. v3 = -int32(1)
  26430. }
  26431. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26432. break
  26433. }
  26434. /* fall through */
  26435. fallthrough
  26436. default:
  26437. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26438. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26439. } else {
  26440. v4 = -int32(1)
  26441. }
  26442. switch v4 {
  26443. case int32(0x24): /* $ */
  26444. fallthrough
  26445. case int32(0x40): /* @ */
  26446. default:
  26447. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26448. return 0
  26449. }
  26450. break
  26451. }
  26452. goto _1
  26453. _1:
  26454. ;
  26455. ptr += uintptr(2)
  26456. }
  26457. return int32(1)
  26458. }
  26459. /* This must only be called for a well-formed start-tag or empty
  26460. element tag. Returns the number of attributes. Pointers to the
  26461. first attsMax attributes are stored in atts.
  26462. */
  26463. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26464. var nAtts, open, state, v2, v3, v5, v7 int32
  26465. var v4, v6, v8, v9 bool
  26466. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26467. state = 1
  26468. nAtts = 0
  26469. open = 0 /* defined when state == inValue;
  26470. initialization just to shut up compilers */
  26471. ptr += uintptr(2)
  26472. for {
  26473. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26474. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26475. } else {
  26476. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26477. }
  26478. switch v2 {
  26479. case int32(_BT_LEAD2):
  26480. if state == 0 {
  26481. if nAtts < attsMax {
  26482. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26483. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26484. }
  26485. state = 1
  26486. }
  26487. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26488. case int32(_BT_LEAD3):
  26489. if state == 0 {
  26490. if nAtts < attsMax {
  26491. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26492. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26493. }
  26494. state = 1
  26495. }
  26496. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26497. case int32(_BT_LEAD4):
  26498. if state == 0 {
  26499. if nAtts < attsMax {
  26500. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26501. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26502. }
  26503. state = 1
  26504. }
  26505. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26506. case int32(_BT_NONASCII):
  26507. fallthrough
  26508. case int32(_BT_NMSTRT):
  26509. fallthrough
  26510. case int32(_BT_HEX):
  26511. if state == 0 {
  26512. if nAtts < attsMax {
  26513. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  26514. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  26515. }
  26516. state = 1
  26517. }
  26518. case int32(_BT_QUOT):
  26519. if state != 2 {
  26520. if nAtts < attsMax {
  26521. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26522. }
  26523. state = 2
  26524. open = int32(_BT_QUOT)
  26525. } else {
  26526. if open == int32(_BT_QUOT) {
  26527. state = 0
  26528. if nAtts < attsMax {
  26529. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26530. }
  26531. nAtts++
  26532. }
  26533. }
  26534. case int32(_BT_APOS):
  26535. if state != 2 {
  26536. if nAtts < attsMax {
  26537. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  26538. }
  26539. state = 2
  26540. open = int32(_BT_APOS)
  26541. } else {
  26542. if open == int32(_BT_APOS) {
  26543. state = 0
  26544. if nAtts < attsMax {
  26545. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  26546. }
  26547. nAtts++
  26548. }
  26549. }
  26550. case int32(_BT_AMP):
  26551. if nAtts < attsMax {
  26552. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  26553. }
  26554. case int32(_BT_S):
  26555. if state == 1 {
  26556. state = 0
  26557. } else {
  26558. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  26559. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  26560. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26561. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26562. } else {
  26563. v3 = -int32(1)
  26564. }
  26565. }
  26566. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26567. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26568. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26569. } else {
  26570. v5 = -int32(1)
  26571. }
  26572. }
  26573. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26574. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26575. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  26576. } else {
  26577. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26578. }
  26579. }
  26580. }
  26581. if v9 && (v8 || v7 == open) {
  26582. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  26583. }
  26584. }
  26585. case int32(_BT_CR):
  26586. fallthrough
  26587. case int32(_BT_LF):
  26588. /* This case ensures that the first attribute name is counted
  26589. Apart from that we could just change state on the quote. */
  26590. if state == 1 {
  26591. state = 0
  26592. } else {
  26593. if state == 2 && nAtts < attsMax {
  26594. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  26595. }
  26596. }
  26597. case int32(_BT_GT):
  26598. fallthrough
  26599. case int32(_BT_SOL):
  26600. if state != 2 {
  26601. return nAtts
  26602. }
  26603. default:
  26604. break
  26605. }
  26606. goto _1
  26607. _1:
  26608. ;
  26609. ptr += uintptr(2)
  26610. }
  26611. /* not reached */
  26612. return r
  26613. }
  26614. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26615. var c, c1, result, v2, v4 int32
  26616. _, _, _, _, _ = c, c1, result, v2, v4
  26617. result = 0
  26618. /* skip &# */
  26619. _ = enc
  26620. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26621. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26622. ptr += uintptr(2)
  26623. for {
  26624. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26625. break
  26626. }
  26627. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26628. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26629. } else {
  26630. v2 = -int32(1)
  26631. }
  26632. c = v2
  26633. switch c {
  26634. case int32(m_ASCII_02):
  26635. fallthrough
  26636. case int32(m_ASCII_12):
  26637. fallthrough
  26638. case int32(m_ASCII_22):
  26639. fallthrough
  26640. case int32(m_ASCII_32):
  26641. fallthrough
  26642. case int32(m_ASCII_41):
  26643. fallthrough
  26644. case int32(m_ASCII_51):
  26645. fallthrough
  26646. case int32(m_ASCII_61):
  26647. fallthrough
  26648. case int32(m_ASCII_71):
  26649. fallthrough
  26650. case int32(m_ASCII_82):
  26651. fallthrough
  26652. case int32(m_ASCII_92):
  26653. result <<= int32(4)
  26654. result |= c - int32(m_ASCII_02)
  26655. case int32(m_ASCII_A):
  26656. fallthrough
  26657. case int32(m_ASCII_B1):
  26658. fallthrough
  26659. case int32(m_ASCII_C):
  26660. fallthrough
  26661. case int32(m_ASCII_D):
  26662. fallthrough
  26663. case int32(m_ASCII_E):
  26664. fallthrough
  26665. case int32(m_ASCII_F):
  26666. result <<= int32(4)
  26667. result += int32(10) + (c - int32(m_ASCII_A))
  26668. case int32(m_ASCII_a2):
  26669. fallthrough
  26670. case int32(m_ASCII_b1):
  26671. fallthrough
  26672. case int32(m_ASCII_c2):
  26673. fallthrough
  26674. case int32(m_ASCII_d1):
  26675. fallthrough
  26676. case int32(m_ASCII_e2):
  26677. fallthrough
  26678. case int32(m_ASCII_f1):
  26679. result <<= int32(4)
  26680. result += int32(10) + (c - int32(m_ASCII_a2))
  26681. break
  26682. }
  26683. if result >= int32(0x110000) {
  26684. return -int32(1)
  26685. }
  26686. goto _1
  26687. _1:
  26688. ;
  26689. ptr += uintptr(2)
  26690. }
  26691. } else {
  26692. for {
  26693. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26694. break
  26695. }
  26696. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26697. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26698. } else {
  26699. v4 = -int32(1)
  26700. }
  26701. c1 = v4
  26702. result *= int32(10)
  26703. result += c1 - int32(m_ASCII_02)
  26704. if result >= int32(0x110000) {
  26705. return -int32(1)
  26706. }
  26707. goto _3
  26708. _3:
  26709. ;
  26710. ptr += uintptr(2)
  26711. }
  26712. }
  26713. return _checkCharRefNumber(tls, result)
  26714. }
  26715. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26716. var v1, v2 int32
  26717. _, _ = v1, v2
  26718. _ = enc
  26719. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  26720. case int64(2):
  26721. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26722. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26723. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26724. } else {
  26725. v1 = -int32(1)
  26726. }
  26727. switch v1 {
  26728. case int32(m_ASCII_l2):
  26729. return int32(m_ASCII_LT1)
  26730. case int32(m_ASCII_g2):
  26731. return int32(m_ASCII_GT1)
  26732. }
  26733. }
  26734. case int64(3):
  26735. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26736. ptr += uintptr(2)
  26737. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26738. ptr += uintptr(2)
  26739. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26740. return int32(m_ASCII_AMP1)
  26741. }
  26742. }
  26743. }
  26744. case int64(4):
  26745. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26746. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  26747. } else {
  26748. v2 = -int32(1)
  26749. }
  26750. switch v2 {
  26751. case int32(m_ASCII_q1):
  26752. ptr += uintptr(2)
  26753. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  26754. ptr += uintptr(2)
  26755. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26756. ptr += uintptr(2)
  26757. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  26758. return int32(m_ASCII_QUOT1)
  26759. }
  26760. }
  26761. }
  26762. case int32(m_ASCII_a2):
  26763. ptr += uintptr(2)
  26764. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26765. ptr += uintptr(2)
  26766. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26767. ptr += uintptr(2)
  26768. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  26769. return int32(m_ASCII_APOS1)
  26770. }
  26771. }
  26772. }
  26773. break
  26774. }
  26775. }
  26776. return 0
  26777. }
  26778. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  26779. _ = enc
  26780. for {
  26781. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  26782. break
  26783. }
  26784. if int64(end1)-int64(ptr1) < int64(2) {
  26785. /* This line cannot be executed. The incoming data has already
  26786. * been tokenized once, so incomplete characters like this have
  26787. * already been eliminated from the input. Retaining the
  26788. * paranoia check is still valuable, however.
  26789. */
  26790. return 0 /* LCOV_EXCL_LINE */
  26791. }
  26792. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  26793. return 0
  26794. }
  26795. goto _1
  26796. _1:
  26797. ;
  26798. ptr1 += uintptr(2)
  26799. ptr2++
  26800. }
  26801. return libc.BoolInt32(ptr1 == end1)
  26802. }
  26803. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26804. var start uintptr
  26805. var v2 int32
  26806. _, _ = start, v2
  26807. start = ptr
  26808. for {
  26809. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26810. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26811. } else {
  26812. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26813. }
  26814. switch v2 {
  26815. case int32(_BT_LEAD2):
  26816. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26817. case int32(_BT_LEAD3):
  26818. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26819. case int32(_BT_LEAD4):
  26820. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26821. case int32(_BT_NONASCII):
  26822. fallthrough
  26823. case int32(_BT_NMSTRT):
  26824. fallthrough
  26825. case int32(_BT_COLON):
  26826. fallthrough
  26827. case int32(_BT_HEX):
  26828. fallthrough
  26829. case int32(_BT_DIGIT):
  26830. fallthrough
  26831. case int32(_BT_NAME):
  26832. fallthrough
  26833. case int32(_BT_MINUS):
  26834. ptr += uintptr(2)
  26835. default:
  26836. return int32(int64(ptr) - int64(start))
  26837. }
  26838. goto _1
  26839. _1:
  26840. }
  26841. return r
  26842. }
  26843. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  26844. var v2 int32
  26845. _ = v2
  26846. for {
  26847. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26848. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26849. } else {
  26850. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26851. }
  26852. switch v2 {
  26853. case int32(_BT_LF):
  26854. fallthrough
  26855. case int32(_BT_CR):
  26856. fallthrough
  26857. case int32(_BT_S):
  26858. ptr += uintptr(2)
  26859. default:
  26860. return ptr
  26861. }
  26862. goto _1
  26863. _1:
  26864. }
  26865. return r
  26866. }
  26867. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  26868. var v1, v2 int32
  26869. var v3 bool
  26870. _, _, _ = v1, v2, v3
  26871. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26872. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26873. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26874. } else {
  26875. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26876. }
  26877. switch v1 {
  26878. case int32(_BT_LEAD2):
  26879. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26880. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26881. case int32(_BT_LEAD3):
  26882. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26883. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26884. case int32(_BT_LEAD4):
  26885. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26886. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26887. case int32(_BT_LF):
  26888. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26889. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26890. ptr += uintptr(2)
  26891. case int32(_BT_CR):
  26892. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26893. ptr += uintptr(2)
  26894. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  26895. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  26896. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  26897. } else {
  26898. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  26899. }
  26900. }
  26901. if v3 && v2 == int32(_BT_LF) {
  26902. ptr += uintptr(2)
  26903. }
  26904. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  26905. default:
  26906. ptr += uintptr(2)
  26907. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26908. break
  26909. }
  26910. }
  26911. }
  26912. var _big2_encoding_ns = Tnormal_encoding{
  26913. Fenc: TENCODING{
  26914. Fscanners: [4]TSCANNER{},
  26915. FliteralScanners: [2]TSCANNER{},
  26916. FminBytesPerChar: int32(2),
  26917. },
  26918. Ftype1: [256]uint8{
  26919. 9: uint8(_BT_S),
  26920. 10: uint8(_BT_LF),
  26921. 13: uint8(_BT_CR),
  26922. 32: uint8(_BT_S),
  26923. 33: uint8(_BT_EXCL),
  26924. 34: uint8(_BT_QUOT),
  26925. 35: uint8(_BT_NUM),
  26926. 36: uint8(_BT_OTHER),
  26927. 37: uint8(_BT_PERCNT),
  26928. 38: uint8(_BT_AMP),
  26929. 39: uint8(_BT_APOS),
  26930. 40: uint8(_BT_LPAR),
  26931. 41: uint8(_BT_RPAR),
  26932. 42: uint8(_BT_AST),
  26933. 43: uint8(_BT_PLUS),
  26934. 44: uint8(_BT_COMMA),
  26935. 45: uint8(_BT_MINUS),
  26936. 46: uint8(_BT_NAME),
  26937. 47: uint8(_BT_SOL),
  26938. 48: uint8(_BT_DIGIT),
  26939. 49: uint8(_BT_DIGIT),
  26940. 50: uint8(_BT_DIGIT),
  26941. 51: uint8(_BT_DIGIT),
  26942. 52: uint8(_BT_DIGIT),
  26943. 53: uint8(_BT_DIGIT),
  26944. 54: uint8(_BT_DIGIT),
  26945. 55: uint8(_BT_DIGIT),
  26946. 56: uint8(_BT_DIGIT),
  26947. 57: uint8(_BT_DIGIT),
  26948. 58: uint8(_BT_COLON),
  26949. 59: uint8(_BT_SEMI),
  26950. 60: uint8(_BT_LT),
  26951. 61: uint8(_BT_EQUALS),
  26952. 62: uint8(_BT_GT),
  26953. 63: uint8(_BT_QUEST),
  26954. 64: uint8(_BT_OTHER),
  26955. 65: uint8(_BT_HEX),
  26956. 66: uint8(_BT_HEX),
  26957. 67: uint8(_BT_HEX),
  26958. 68: uint8(_BT_HEX),
  26959. 69: uint8(_BT_HEX),
  26960. 70: uint8(_BT_HEX),
  26961. 71: uint8(_BT_NMSTRT),
  26962. 72: uint8(_BT_NMSTRT),
  26963. 73: uint8(_BT_NMSTRT),
  26964. 74: uint8(_BT_NMSTRT),
  26965. 75: uint8(_BT_NMSTRT),
  26966. 76: uint8(_BT_NMSTRT),
  26967. 77: uint8(_BT_NMSTRT),
  26968. 78: uint8(_BT_NMSTRT),
  26969. 79: uint8(_BT_NMSTRT),
  26970. 80: uint8(_BT_NMSTRT),
  26971. 81: uint8(_BT_NMSTRT),
  26972. 82: uint8(_BT_NMSTRT),
  26973. 83: uint8(_BT_NMSTRT),
  26974. 84: uint8(_BT_NMSTRT),
  26975. 85: uint8(_BT_NMSTRT),
  26976. 86: uint8(_BT_NMSTRT),
  26977. 87: uint8(_BT_NMSTRT),
  26978. 88: uint8(_BT_NMSTRT),
  26979. 89: uint8(_BT_NMSTRT),
  26980. 90: uint8(_BT_NMSTRT),
  26981. 91: uint8(_BT_LSQB),
  26982. 92: uint8(_BT_OTHER),
  26983. 93: uint8(_BT_RSQB),
  26984. 94: uint8(_BT_OTHER),
  26985. 95: uint8(_BT_NMSTRT),
  26986. 96: uint8(_BT_OTHER),
  26987. 97: uint8(_BT_HEX),
  26988. 98: uint8(_BT_HEX),
  26989. 99: uint8(_BT_HEX),
  26990. 100: uint8(_BT_HEX),
  26991. 101: uint8(_BT_HEX),
  26992. 102: uint8(_BT_HEX),
  26993. 103: uint8(_BT_NMSTRT),
  26994. 104: uint8(_BT_NMSTRT),
  26995. 105: uint8(_BT_NMSTRT),
  26996. 106: uint8(_BT_NMSTRT),
  26997. 107: uint8(_BT_NMSTRT),
  26998. 108: uint8(_BT_NMSTRT),
  26999. 109: uint8(_BT_NMSTRT),
  27000. 110: uint8(_BT_NMSTRT),
  27001. 111: uint8(_BT_NMSTRT),
  27002. 112: uint8(_BT_NMSTRT),
  27003. 113: uint8(_BT_NMSTRT),
  27004. 114: uint8(_BT_NMSTRT),
  27005. 115: uint8(_BT_NMSTRT),
  27006. 116: uint8(_BT_NMSTRT),
  27007. 117: uint8(_BT_NMSTRT),
  27008. 118: uint8(_BT_NMSTRT),
  27009. 119: uint8(_BT_NMSTRT),
  27010. 120: uint8(_BT_NMSTRT),
  27011. 121: uint8(_BT_NMSTRT),
  27012. 122: uint8(_BT_NMSTRT),
  27013. 123: uint8(_BT_OTHER),
  27014. 124: uint8(_BT_VERBAR),
  27015. 125: uint8(_BT_OTHER),
  27016. 126: uint8(_BT_OTHER),
  27017. 127: uint8(_BT_OTHER),
  27018. 128: uint8(_BT_OTHER),
  27019. 129: uint8(_BT_OTHER),
  27020. 130: uint8(_BT_OTHER),
  27021. 131: uint8(_BT_OTHER),
  27022. 132: uint8(_BT_OTHER),
  27023. 133: uint8(_BT_OTHER),
  27024. 134: uint8(_BT_OTHER),
  27025. 135: uint8(_BT_OTHER),
  27026. 136: uint8(_BT_OTHER),
  27027. 137: uint8(_BT_OTHER),
  27028. 138: uint8(_BT_OTHER),
  27029. 139: uint8(_BT_OTHER),
  27030. 140: uint8(_BT_OTHER),
  27031. 141: uint8(_BT_OTHER),
  27032. 142: uint8(_BT_OTHER),
  27033. 143: uint8(_BT_OTHER),
  27034. 144: uint8(_BT_OTHER),
  27035. 145: uint8(_BT_OTHER),
  27036. 146: uint8(_BT_OTHER),
  27037. 147: uint8(_BT_OTHER),
  27038. 148: uint8(_BT_OTHER),
  27039. 149: uint8(_BT_OTHER),
  27040. 150: uint8(_BT_OTHER),
  27041. 151: uint8(_BT_OTHER),
  27042. 152: uint8(_BT_OTHER),
  27043. 153: uint8(_BT_OTHER),
  27044. 154: uint8(_BT_OTHER),
  27045. 155: uint8(_BT_OTHER),
  27046. 156: uint8(_BT_OTHER),
  27047. 157: uint8(_BT_OTHER),
  27048. 158: uint8(_BT_OTHER),
  27049. 159: uint8(_BT_OTHER),
  27050. 160: uint8(_BT_OTHER),
  27051. 161: uint8(_BT_OTHER),
  27052. 162: uint8(_BT_OTHER),
  27053. 163: uint8(_BT_OTHER),
  27054. 164: uint8(_BT_OTHER),
  27055. 165: uint8(_BT_OTHER),
  27056. 166: uint8(_BT_OTHER),
  27057. 167: uint8(_BT_OTHER),
  27058. 168: uint8(_BT_OTHER),
  27059. 169: uint8(_BT_OTHER),
  27060. 170: uint8(_BT_NMSTRT),
  27061. 171: uint8(_BT_OTHER),
  27062. 172: uint8(_BT_OTHER),
  27063. 173: uint8(_BT_OTHER),
  27064. 174: uint8(_BT_OTHER),
  27065. 175: uint8(_BT_OTHER),
  27066. 176: uint8(_BT_OTHER),
  27067. 177: uint8(_BT_OTHER),
  27068. 178: uint8(_BT_OTHER),
  27069. 179: uint8(_BT_OTHER),
  27070. 180: uint8(_BT_OTHER),
  27071. 181: uint8(_BT_NMSTRT),
  27072. 182: uint8(_BT_OTHER),
  27073. 183: uint8(_BT_NAME),
  27074. 184: uint8(_BT_OTHER),
  27075. 185: uint8(_BT_OTHER),
  27076. 186: uint8(_BT_NMSTRT),
  27077. 187: uint8(_BT_OTHER),
  27078. 188: uint8(_BT_OTHER),
  27079. 189: uint8(_BT_OTHER),
  27080. 190: uint8(_BT_OTHER),
  27081. 191: uint8(_BT_OTHER),
  27082. 192: uint8(_BT_NMSTRT),
  27083. 193: uint8(_BT_NMSTRT),
  27084. 194: uint8(_BT_NMSTRT),
  27085. 195: uint8(_BT_NMSTRT),
  27086. 196: uint8(_BT_NMSTRT),
  27087. 197: uint8(_BT_NMSTRT),
  27088. 198: uint8(_BT_NMSTRT),
  27089. 199: uint8(_BT_NMSTRT),
  27090. 200: uint8(_BT_NMSTRT),
  27091. 201: uint8(_BT_NMSTRT),
  27092. 202: uint8(_BT_NMSTRT),
  27093. 203: uint8(_BT_NMSTRT),
  27094. 204: uint8(_BT_NMSTRT),
  27095. 205: uint8(_BT_NMSTRT),
  27096. 206: uint8(_BT_NMSTRT),
  27097. 207: uint8(_BT_NMSTRT),
  27098. 208: uint8(_BT_NMSTRT),
  27099. 209: uint8(_BT_NMSTRT),
  27100. 210: uint8(_BT_NMSTRT),
  27101. 211: uint8(_BT_NMSTRT),
  27102. 212: uint8(_BT_NMSTRT),
  27103. 213: uint8(_BT_NMSTRT),
  27104. 214: uint8(_BT_NMSTRT),
  27105. 215: uint8(_BT_OTHER),
  27106. 216: uint8(_BT_NMSTRT),
  27107. 217: uint8(_BT_NMSTRT),
  27108. 218: uint8(_BT_NMSTRT),
  27109. 219: uint8(_BT_NMSTRT),
  27110. 220: uint8(_BT_NMSTRT),
  27111. 221: uint8(_BT_NMSTRT),
  27112. 222: uint8(_BT_NMSTRT),
  27113. 223: uint8(_BT_NMSTRT),
  27114. 224: uint8(_BT_NMSTRT),
  27115. 225: uint8(_BT_NMSTRT),
  27116. 226: uint8(_BT_NMSTRT),
  27117. 227: uint8(_BT_NMSTRT),
  27118. 228: uint8(_BT_NMSTRT),
  27119. 229: uint8(_BT_NMSTRT),
  27120. 230: uint8(_BT_NMSTRT),
  27121. 231: uint8(_BT_NMSTRT),
  27122. 232: uint8(_BT_NMSTRT),
  27123. 233: uint8(_BT_NMSTRT),
  27124. 234: uint8(_BT_NMSTRT),
  27125. 235: uint8(_BT_NMSTRT),
  27126. 236: uint8(_BT_NMSTRT),
  27127. 237: uint8(_BT_NMSTRT),
  27128. 238: uint8(_BT_NMSTRT),
  27129. 239: uint8(_BT_NMSTRT),
  27130. 240: uint8(_BT_NMSTRT),
  27131. 241: uint8(_BT_NMSTRT),
  27132. 242: uint8(_BT_NMSTRT),
  27133. 243: uint8(_BT_NMSTRT),
  27134. 244: uint8(_BT_NMSTRT),
  27135. 245: uint8(_BT_NMSTRT),
  27136. 246: uint8(_BT_NMSTRT),
  27137. 247: uint8(_BT_OTHER),
  27138. 248: uint8(_BT_NMSTRT),
  27139. 249: uint8(_BT_NMSTRT),
  27140. 250: uint8(_BT_NMSTRT),
  27141. 251: uint8(_BT_NMSTRT),
  27142. 252: uint8(_BT_NMSTRT),
  27143. 253: uint8(_BT_NMSTRT),
  27144. 254: uint8(_BT_NMSTRT),
  27145. 255: uint8(_BT_NMSTRT),
  27146. },
  27147. }
  27148. func init() {
  27149. p := unsafe.Pointer(&_big2_encoding_ns)
  27150. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27151. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27152. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27153. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27154. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27155. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27156. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27157. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27158. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27159. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27160. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27161. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27162. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27163. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27164. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27165. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27166. }
  27167. var _big2_encoding = Tnormal_encoding{
  27168. Fenc: TENCODING{
  27169. Fscanners: [4]TSCANNER{},
  27170. FliteralScanners: [2]TSCANNER{},
  27171. FminBytesPerChar: int32(2),
  27172. },
  27173. Ftype1: [256]uint8{
  27174. 9: uint8(_BT_S),
  27175. 10: uint8(_BT_LF),
  27176. 13: uint8(_BT_CR),
  27177. 32: uint8(_BT_S),
  27178. 33: uint8(_BT_EXCL),
  27179. 34: uint8(_BT_QUOT),
  27180. 35: uint8(_BT_NUM),
  27181. 36: uint8(_BT_OTHER),
  27182. 37: uint8(_BT_PERCNT),
  27183. 38: uint8(_BT_AMP),
  27184. 39: uint8(_BT_APOS),
  27185. 40: uint8(_BT_LPAR),
  27186. 41: uint8(_BT_RPAR),
  27187. 42: uint8(_BT_AST),
  27188. 43: uint8(_BT_PLUS),
  27189. 44: uint8(_BT_COMMA),
  27190. 45: uint8(_BT_MINUS),
  27191. 46: uint8(_BT_NAME),
  27192. 47: uint8(_BT_SOL),
  27193. 48: uint8(_BT_DIGIT),
  27194. 49: uint8(_BT_DIGIT),
  27195. 50: uint8(_BT_DIGIT),
  27196. 51: uint8(_BT_DIGIT),
  27197. 52: uint8(_BT_DIGIT),
  27198. 53: uint8(_BT_DIGIT),
  27199. 54: uint8(_BT_DIGIT),
  27200. 55: uint8(_BT_DIGIT),
  27201. 56: uint8(_BT_DIGIT),
  27202. 57: uint8(_BT_DIGIT),
  27203. 58: uint8(_BT_NMSTRT),
  27204. 59: uint8(_BT_SEMI),
  27205. 60: uint8(_BT_LT),
  27206. 61: uint8(_BT_EQUALS),
  27207. 62: uint8(_BT_GT),
  27208. 63: uint8(_BT_QUEST),
  27209. 64: uint8(_BT_OTHER),
  27210. 65: uint8(_BT_HEX),
  27211. 66: uint8(_BT_HEX),
  27212. 67: uint8(_BT_HEX),
  27213. 68: uint8(_BT_HEX),
  27214. 69: uint8(_BT_HEX),
  27215. 70: uint8(_BT_HEX),
  27216. 71: uint8(_BT_NMSTRT),
  27217. 72: uint8(_BT_NMSTRT),
  27218. 73: uint8(_BT_NMSTRT),
  27219. 74: uint8(_BT_NMSTRT),
  27220. 75: uint8(_BT_NMSTRT),
  27221. 76: uint8(_BT_NMSTRT),
  27222. 77: uint8(_BT_NMSTRT),
  27223. 78: uint8(_BT_NMSTRT),
  27224. 79: uint8(_BT_NMSTRT),
  27225. 80: uint8(_BT_NMSTRT),
  27226. 81: uint8(_BT_NMSTRT),
  27227. 82: uint8(_BT_NMSTRT),
  27228. 83: uint8(_BT_NMSTRT),
  27229. 84: uint8(_BT_NMSTRT),
  27230. 85: uint8(_BT_NMSTRT),
  27231. 86: uint8(_BT_NMSTRT),
  27232. 87: uint8(_BT_NMSTRT),
  27233. 88: uint8(_BT_NMSTRT),
  27234. 89: uint8(_BT_NMSTRT),
  27235. 90: uint8(_BT_NMSTRT),
  27236. 91: uint8(_BT_LSQB),
  27237. 92: uint8(_BT_OTHER),
  27238. 93: uint8(_BT_RSQB),
  27239. 94: uint8(_BT_OTHER),
  27240. 95: uint8(_BT_NMSTRT),
  27241. 96: uint8(_BT_OTHER),
  27242. 97: uint8(_BT_HEX),
  27243. 98: uint8(_BT_HEX),
  27244. 99: uint8(_BT_HEX),
  27245. 100: uint8(_BT_HEX),
  27246. 101: uint8(_BT_HEX),
  27247. 102: uint8(_BT_HEX),
  27248. 103: uint8(_BT_NMSTRT),
  27249. 104: uint8(_BT_NMSTRT),
  27250. 105: uint8(_BT_NMSTRT),
  27251. 106: uint8(_BT_NMSTRT),
  27252. 107: uint8(_BT_NMSTRT),
  27253. 108: uint8(_BT_NMSTRT),
  27254. 109: uint8(_BT_NMSTRT),
  27255. 110: uint8(_BT_NMSTRT),
  27256. 111: uint8(_BT_NMSTRT),
  27257. 112: uint8(_BT_NMSTRT),
  27258. 113: uint8(_BT_NMSTRT),
  27259. 114: uint8(_BT_NMSTRT),
  27260. 115: uint8(_BT_NMSTRT),
  27261. 116: uint8(_BT_NMSTRT),
  27262. 117: uint8(_BT_NMSTRT),
  27263. 118: uint8(_BT_NMSTRT),
  27264. 119: uint8(_BT_NMSTRT),
  27265. 120: uint8(_BT_NMSTRT),
  27266. 121: uint8(_BT_NMSTRT),
  27267. 122: uint8(_BT_NMSTRT),
  27268. 123: uint8(_BT_OTHER),
  27269. 124: uint8(_BT_VERBAR),
  27270. 125: uint8(_BT_OTHER),
  27271. 126: uint8(_BT_OTHER),
  27272. 127: uint8(_BT_OTHER),
  27273. 128: uint8(_BT_OTHER),
  27274. 129: uint8(_BT_OTHER),
  27275. 130: uint8(_BT_OTHER),
  27276. 131: uint8(_BT_OTHER),
  27277. 132: uint8(_BT_OTHER),
  27278. 133: uint8(_BT_OTHER),
  27279. 134: uint8(_BT_OTHER),
  27280. 135: uint8(_BT_OTHER),
  27281. 136: uint8(_BT_OTHER),
  27282. 137: uint8(_BT_OTHER),
  27283. 138: uint8(_BT_OTHER),
  27284. 139: uint8(_BT_OTHER),
  27285. 140: uint8(_BT_OTHER),
  27286. 141: uint8(_BT_OTHER),
  27287. 142: uint8(_BT_OTHER),
  27288. 143: uint8(_BT_OTHER),
  27289. 144: uint8(_BT_OTHER),
  27290. 145: uint8(_BT_OTHER),
  27291. 146: uint8(_BT_OTHER),
  27292. 147: uint8(_BT_OTHER),
  27293. 148: uint8(_BT_OTHER),
  27294. 149: uint8(_BT_OTHER),
  27295. 150: uint8(_BT_OTHER),
  27296. 151: uint8(_BT_OTHER),
  27297. 152: uint8(_BT_OTHER),
  27298. 153: uint8(_BT_OTHER),
  27299. 154: uint8(_BT_OTHER),
  27300. 155: uint8(_BT_OTHER),
  27301. 156: uint8(_BT_OTHER),
  27302. 157: uint8(_BT_OTHER),
  27303. 158: uint8(_BT_OTHER),
  27304. 159: uint8(_BT_OTHER),
  27305. 160: uint8(_BT_OTHER),
  27306. 161: uint8(_BT_OTHER),
  27307. 162: uint8(_BT_OTHER),
  27308. 163: uint8(_BT_OTHER),
  27309. 164: uint8(_BT_OTHER),
  27310. 165: uint8(_BT_OTHER),
  27311. 166: uint8(_BT_OTHER),
  27312. 167: uint8(_BT_OTHER),
  27313. 168: uint8(_BT_OTHER),
  27314. 169: uint8(_BT_OTHER),
  27315. 170: uint8(_BT_NMSTRT),
  27316. 171: uint8(_BT_OTHER),
  27317. 172: uint8(_BT_OTHER),
  27318. 173: uint8(_BT_OTHER),
  27319. 174: uint8(_BT_OTHER),
  27320. 175: uint8(_BT_OTHER),
  27321. 176: uint8(_BT_OTHER),
  27322. 177: uint8(_BT_OTHER),
  27323. 178: uint8(_BT_OTHER),
  27324. 179: uint8(_BT_OTHER),
  27325. 180: uint8(_BT_OTHER),
  27326. 181: uint8(_BT_NMSTRT),
  27327. 182: uint8(_BT_OTHER),
  27328. 183: uint8(_BT_NAME),
  27329. 184: uint8(_BT_OTHER),
  27330. 185: uint8(_BT_OTHER),
  27331. 186: uint8(_BT_NMSTRT),
  27332. 187: uint8(_BT_OTHER),
  27333. 188: uint8(_BT_OTHER),
  27334. 189: uint8(_BT_OTHER),
  27335. 190: uint8(_BT_OTHER),
  27336. 191: uint8(_BT_OTHER),
  27337. 192: uint8(_BT_NMSTRT),
  27338. 193: uint8(_BT_NMSTRT),
  27339. 194: uint8(_BT_NMSTRT),
  27340. 195: uint8(_BT_NMSTRT),
  27341. 196: uint8(_BT_NMSTRT),
  27342. 197: uint8(_BT_NMSTRT),
  27343. 198: uint8(_BT_NMSTRT),
  27344. 199: uint8(_BT_NMSTRT),
  27345. 200: uint8(_BT_NMSTRT),
  27346. 201: uint8(_BT_NMSTRT),
  27347. 202: uint8(_BT_NMSTRT),
  27348. 203: uint8(_BT_NMSTRT),
  27349. 204: uint8(_BT_NMSTRT),
  27350. 205: uint8(_BT_NMSTRT),
  27351. 206: uint8(_BT_NMSTRT),
  27352. 207: uint8(_BT_NMSTRT),
  27353. 208: uint8(_BT_NMSTRT),
  27354. 209: uint8(_BT_NMSTRT),
  27355. 210: uint8(_BT_NMSTRT),
  27356. 211: uint8(_BT_NMSTRT),
  27357. 212: uint8(_BT_NMSTRT),
  27358. 213: uint8(_BT_NMSTRT),
  27359. 214: uint8(_BT_NMSTRT),
  27360. 215: uint8(_BT_OTHER),
  27361. 216: uint8(_BT_NMSTRT),
  27362. 217: uint8(_BT_NMSTRT),
  27363. 218: uint8(_BT_NMSTRT),
  27364. 219: uint8(_BT_NMSTRT),
  27365. 220: uint8(_BT_NMSTRT),
  27366. 221: uint8(_BT_NMSTRT),
  27367. 222: uint8(_BT_NMSTRT),
  27368. 223: uint8(_BT_NMSTRT),
  27369. 224: uint8(_BT_NMSTRT),
  27370. 225: uint8(_BT_NMSTRT),
  27371. 226: uint8(_BT_NMSTRT),
  27372. 227: uint8(_BT_NMSTRT),
  27373. 228: uint8(_BT_NMSTRT),
  27374. 229: uint8(_BT_NMSTRT),
  27375. 230: uint8(_BT_NMSTRT),
  27376. 231: uint8(_BT_NMSTRT),
  27377. 232: uint8(_BT_NMSTRT),
  27378. 233: uint8(_BT_NMSTRT),
  27379. 234: uint8(_BT_NMSTRT),
  27380. 235: uint8(_BT_NMSTRT),
  27381. 236: uint8(_BT_NMSTRT),
  27382. 237: uint8(_BT_NMSTRT),
  27383. 238: uint8(_BT_NMSTRT),
  27384. 239: uint8(_BT_NMSTRT),
  27385. 240: uint8(_BT_NMSTRT),
  27386. 241: uint8(_BT_NMSTRT),
  27387. 242: uint8(_BT_NMSTRT),
  27388. 243: uint8(_BT_NMSTRT),
  27389. 244: uint8(_BT_NMSTRT),
  27390. 245: uint8(_BT_NMSTRT),
  27391. 246: uint8(_BT_NMSTRT),
  27392. 247: uint8(_BT_OTHER),
  27393. 248: uint8(_BT_NMSTRT),
  27394. 249: uint8(_BT_NMSTRT),
  27395. 250: uint8(_BT_NMSTRT),
  27396. 251: uint8(_BT_NMSTRT),
  27397. 252: uint8(_BT_NMSTRT),
  27398. 253: uint8(_BT_NMSTRT),
  27399. 254: uint8(_BT_NMSTRT),
  27400. 255: uint8(_BT_NMSTRT),
  27401. },
  27402. }
  27403. func init() {
  27404. p := unsafe.Pointer(&_big2_encoding)
  27405. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27406. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  27407. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  27408. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  27409. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  27410. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  27411. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  27412. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  27413. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  27414. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  27415. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  27416. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  27417. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  27418. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  27419. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  27420. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  27421. }
  27422. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27423. var c1, c2 uint8
  27424. var v2, v3 uintptr
  27425. _, _, _, _ = c1, c2, v2, v3
  27426. for {
  27427. v2 = s1
  27428. s1++
  27429. c1 = *(*uint8)(unsafe.Pointer(v2))
  27430. v3 = s2
  27431. s2++
  27432. c2 = *(*uint8)(unsafe.Pointer(v3))
  27433. if int32(m_ASCII_a2) <= libc.Int32FromUint8(c1) && libc.Int32FromUint8(c1) <= int32(m_ASCII_z1) {
  27434. c1 = uint8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27435. }
  27436. if int32(m_ASCII_a2) <= libc.Int32FromUint8(c2) && libc.Int32FromUint8(c2) <= int32(m_ASCII_z1) {
  27437. /* The following line will never get executed. streqci() is
  27438. * only called from two places, both of which guarantee to put
  27439. * upper-case strings into s2.
  27440. */
  27441. c2 = uint8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27442. } /* LCOV_EXCL_LINE */
  27443. if libc.Int32FromUint8(c1) != libc.Int32FromUint8(c2) {
  27444. return 0
  27445. }
  27446. if !(c1 != 0) {
  27447. break
  27448. }
  27449. goto _1
  27450. _1:
  27451. }
  27452. return int32(1)
  27453. }
  27454. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27455. _ = enc
  27456. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27457. }
  27458. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27459. bp := tls.Alloc(32)
  27460. defer tls.Free(32)
  27461. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27462. var _ /* buf at bp+8 */ [1]uint8
  27463. var _ /* p at bp+16 */ uintptr
  27464. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  27465. (*(*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))
  27466. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  27467. return -int32(1)
  27468. } else {
  27469. return libc.Int32FromUint8((*(*[1]uint8)(unsafe.Pointer(bp + 8)))[0])
  27470. }
  27471. return r
  27472. }
  27473. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27474. switch c {
  27475. case int32(0x20):
  27476. fallthrough
  27477. case int32(0xD):
  27478. fallthrough
  27479. case int32(0xA):
  27480. fallthrough
  27481. case int32(0x9):
  27482. return int32(1)
  27483. }
  27484. return 0
  27485. }
  27486. // C documentation
  27487. //
  27488. // /* Return 1 if there's just optional white space or there's an S
  27489. // followed by name=val.
  27490. // */
  27491. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27492. var c, v2 int32
  27493. var open uint8
  27494. _, _, _ = c, open, v2
  27495. if ptr == end {
  27496. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27497. return int32(1)
  27498. }
  27499. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27500. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27501. return 0
  27502. }
  27503. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27504. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27505. }
  27506. if ptr == end {
  27507. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27508. return int32(1)
  27509. }
  27510. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27511. for {
  27512. c = _toAscii(tls, enc, ptr, end)
  27513. if c == -int32(1) {
  27514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27515. return 0
  27516. }
  27517. if c == int32(m_ASCII_EQUALS2) {
  27518. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27519. break
  27520. }
  27521. if _isSpace(tls, c) != 0 {
  27522. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27523. for {
  27524. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27525. goto _3
  27526. _3:
  27527. ;
  27528. v2 = _toAscii(tls, enc, ptr, end)
  27529. c = v2
  27530. if !(_isSpace(tls, v2) != 0) {
  27531. break
  27532. }
  27533. }
  27534. if c != int32(m_ASCII_EQUALS2) {
  27535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27536. return 0
  27537. }
  27538. break
  27539. }
  27540. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27541. goto _1
  27542. _1:
  27543. }
  27544. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27545. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27546. return 0
  27547. }
  27548. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27549. c = _toAscii(tls, enc, ptr, end)
  27550. for _isSpace(tls, c) != 0 {
  27551. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27552. c = _toAscii(tls, enc, ptr, end)
  27553. }
  27554. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27556. return 0
  27557. }
  27558. open = libc.Uint8FromInt32(c)
  27559. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27560. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27561. for {
  27562. c = _toAscii(tls, enc, ptr, end)
  27563. if c == libc.Int32FromUint8(open) {
  27564. break
  27565. }
  27566. 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) {
  27567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27568. return 0
  27569. }
  27570. goto _4
  27571. _4:
  27572. ;
  27573. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27574. }
  27575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27576. return int32(1)
  27577. }
  27578. var _KW_version = [8]uint8{
  27579. 0: uint8(m_ASCII_v1),
  27580. 1: uint8(m_ASCII_e2),
  27581. 2: uint8(m_ASCII_r2),
  27582. 3: uint8(m_ASCII_s2),
  27583. 4: uint8(m_ASCII_i1),
  27584. 5: uint8(m_ASCII_o2),
  27585. 6: uint8(m_ASCII_n2),
  27586. }
  27587. var _KW_encoding = [9]uint8{
  27588. 0: uint8(m_ASCII_e2),
  27589. 1: uint8(m_ASCII_n2),
  27590. 2: uint8(m_ASCII_c2),
  27591. 3: uint8(m_ASCII_o2),
  27592. 4: uint8(m_ASCII_d1),
  27593. 5: uint8(m_ASCII_i1),
  27594. 6: uint8(m_ASCII_n2),
  27595. 7: uint8(m_ASCII_g2),
  27596. }
  27597. var _KW_standalone = [11]uint8{
  27598. 0: uint8(m_ASCII_s2),
  27599. 1: uint8(m_ASCII_t2),
  27600. 2: uint8(m_ASCII_a2),
  27601. 3: uint8(m_ASCII_n2),
  27602. 4: uint8(m_ASCII_d1),
  27603. 5: uint8(m_ASCII_a2),
  27604. 6: uint8(m_ASCII_l2),
  27605. 7: uint8(m_ASCII_o2),
  27606. 8: uint8(m_ASCII_n2),
  27607. 9: uint8(m_ASCII_e2),
  27608. }
  27609. var _KW_yes = [4]uint8{
  27610. 0: uint8(m_ASCII_y1),
  27611. 1: uint8(m_ASCII_e2),
  27612. 2: uint8(m_ASCII_s2),
  27613. }
  27614. var _KW_no = [3]uint8{
  27615. 0: uint8(m_ASCII_n2),
  27616. 1: uint8(m_ASCII_o2),
  27617. }
  27618. 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) {
  27619. bp := tls.Alloc(32)
  27620. defer tls.Free(32)
  27621. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27622. var c int32
  27623. var _ /* name at bp+16 */ uintptr
  27624. var _ /* nameEnd at bp+24 */ uintptr
  27625. var _ /* val at bp+8 */ uintptr
  27626. _ = c
  27627. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27628. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  27629. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  27630. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27631. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27632. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27633. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27634. return 0
  27635. }
  27636. 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) {
  27637. if !(isGeneralTextEntity != 0) {
  27638. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27639. return 0
  27640. }
  27641. } else {
  27642. if versionPtr != 0 {
  27643. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27644. }
  27645. if versionEndPtr != 0 {
  27646. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27647. }
  27648. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27649. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27650. return 0
  27651. }
  27652. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27653. if isGeneralTextEntity != 0 {
  27654. /* a TextDecl must have an EncodingDecl */
  27655. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27656. return 0
  27657. }
  27658. return int32(1)
  27659. }
  27660. }
  27661. 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 {
  27662. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  27663. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27664. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27665. return 0
  27666. }
  27667. if encodingName != 0 {
  27668. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27669. }
  27670. if encoding != 0 {
  27671. *(*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))
  27672. }
  27673. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  27674. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27675. return 0
  27676. }
  27677. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  27678. return int32(1)
  27679. }
  27680. }
  27681. 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 {
  27682. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  27683. return 0
  27684. }
  27685. 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 {
  27686. if standalone != 0 {
  27687. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27688. }
  27689. } else {
  27690. 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 {
  27691. if standalone != 0 {
  27692. *(*int32)(unsafe.Pointer(standalone)) = 0
  27693. }
  27694. } else {
  27695. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27696. return 0
  27697. }
  27698. }
  27699. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27700. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27701. }
  27702. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27703. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27704. return 0
  27705. }
  27706. return int32(1)
  27707. }
  27708. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27709. switch result >> libc.Int32FromInt32(8) {
  27710. case int32(0xD8):
  27711. fallthrough
  27712. case int32(0xD9):
  27713. fallthrough
  27714. case int32(0xDA):
  27715. fallthrough
  27716. case int32(0xDB):
  27717. fallthrough
  27718. case int32(0xDC):
  27719. fallthrough
  27720. case int32(0xDD):
  27721. fallthrough
  27722. case int32(0xDE):
  27723. fallthrough
  27724. case int32(0xDF):
  27725. return -int32(1)
  27726. case 0:
  27727. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  27728. return -int32(1)
  27729. }
  27730. case int32(0xFF):
  27731. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27732. return -int32(1)
  27733. }
  27734. break
  27735. }
  27736. return result
  27737. }
  27738. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27739. if c < 0 {
  27740. return 0
  27741. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  27742. if c < 128 {
  27743. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c | int32(_UTF8_cval1))
  27744. return int32(1)
  27745. }
  27746. if c < 2048 {
  27747. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  27748. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27749. return int32(2)
  27750. }
  27751. if c < 65536 {
  27752. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  27753. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27754. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27755. return int32(3)
  27756. }
  27757. if c < int32(0x110000) {
  27758. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  27759. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27760. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27761. *(*uint8)(unsafe.Pointer(buf + 3)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27762. return int32(4)
  27763. }
  27764. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  27765. }
  27766. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  27767. if charNum < 0 {
  27768. return 0
  27769. }
  27770. if charNum < int32(0x10000) {
  27771. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  27772. return int32(1)
  27773. }
  27774. if charNum < int32(0x110000) {
  27775. charNum -= int32(0x10000)
  27776. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  27777. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  27778. return int32(2)
  27779. }
  27780. return 0
  27781. }
  27782. type Tunknown_encoding = struct {
  27783. Fnormal Tnormal_encoding
  27784. Fconvert TCONVERTER
  27785. FuserData uintptr
  27786. Futf16 [256]uint16
  27787. Futf8 [256][4]uint8
  27788. }
  27789. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  27790. return int32(2016)
  27791. }
  27792. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27793. var c int32
  27794. var uenc uintptr
  27795. _, _ = c, uenc
  27796. uenc = enc
  27797. 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)
  27798. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27799. return 0
  27800. }
  27801. 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))))
  27802. }
  27803. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27804. var c int32
  27805. var uenc uintptr
  27806. _, _ = c, uenc
  27807. uenc = enc
  27808. 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)
  27809. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27810. return 0
  27811. }
  27812. 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))))
  27813. }
  27814. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27815. var c int32
  27816. var uenc uintptr
  27817. _, _ = c, uenc
  27818. uenc = enc
  27819. 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)
  27820. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  27821. }
  27822. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27823. bp := tls.Alloc(16)
  27824. defer tls.Free(16)
  27825. var c, n int32
  27826. var uenc, utf8, v2 uintptr
  27827. var _ /* buf at bp+0 */ [4]uint8
  27828. _, _, _, _, _ = c, n, uenc, utf8, v2
  27829. uenc = enc
  27830. for {
  27831. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  27832. return int32(_XML_CONVERT_COMPLETED)
  27833. }
  27834. utf8 = uenc + 992 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*4
  27835. v2 = utf8
  27836. utf8++
  27837. n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2)))
  27838. if n == 0 {
  27839. 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)))
  27840. n = XXmlUtf8Encode(tls, c, bp)
  27841. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27842. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27843. }
  27844. utf8 = bp
  27845. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27846. } else {
  27847. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  27848. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27849. }
  27850. *(*uintptr)(unsafe.Pointer(fromP))++
  27851. }
  27852. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  27853. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  27854. goto _1
  27855. _1:
  27856. }
  27857. return r
  27858. }
  27859. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27860. var c uint16
  27861. var uenc, v1, v2 uintptr
  27862. _, _, _, _ = c, uenc, v1, v2
  27863. uenc = enc
  27864. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  27865. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*2))
  27866. if libc.Int32FromUint16(c) == 0 {
  27867. 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))))
  27868. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27869. } else {
  27870. *(*uintptr)(unsafe.Pointer(fromP))++
  27871. }
  27872. v2 = toP
  27873. v1 = *(*uintptr)(unsafe.Pointer(v2))
  27874. *(*uintptr)(unsafe.Pointer(v2)) += 2
  27875. *(*uint16)(unsafe.Pointer(v1)) = c
  27876. }
  27877. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  27878. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27879. } else {
  27880. return int32(_XML_CONVERT_COMPLETED)
  27881. }
  27882. return r
  27883. }
  27884. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  27885. var c, i, v3 int32
  27886. var e uintptr
  27887. _, _, _, _ = c, e, i, v3
  27888. e = mem
  27889. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  27890. i = 0
  27891. for {
  27892. if !(i < int32(128)) {
  27893. break
  27894. }
  27895. 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 {
  27896. return uintptr(0)
  27897. }
  27898. goto _1
  27899. _1:
  27900. ;
  27901. i++
  27902. }
  27903. i = 0
  27904. for {
  27905. if !(i < int32(256)) {
  27906. break
  27907. }
  27908. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  27909. if c == -int32(1) {
  27910. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  27911. /* This shouldn't really get used. */
  27912. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  27913. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  27914. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  27915. } else {
  27916. if c < 0 {
  27917. if c < -int32(4) {
  27918. return uintptr(0)
  27919. }
  27920. /* Multi-byte sequences need a converter function */
  27921. if !(convert != 0) {
  27922. return uintptr(0)
  27923. }
  27924. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  27925. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(0)
  27926. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  27927. } else {
  27928. if c < int32(0x80) {
  27929. 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 {
  27930. return uintptr(0)
  27931. }
  27932. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  27933. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  27934. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = libc.Uint8FromInt32(c)
  27935. if c == 0 {
  27936. v3 = int32(0xFFFF)
  27937. } else {
  27938. v3 = c
  27939. }
  27940. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  27941. } else {
  27942. if _checkCharRefNumber(tls, c) < 0 {
  27943. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  27944. /* This shouldn't really get used. */
  27945. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  27946. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  27947. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  27948. } else {
  27949. if c > int32(0xFFFF) {
  27950. return uintptr(0)
  27951. }
  27952. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27953. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  27954. } else {
  27955. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27956. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  27957. } else {
  27958. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  27959. }
  27960. }
  27961. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = libc.Uint8FromInt32(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  27962. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  27963. }
  27964. }
  27965. }
  27966. }
  27967. goto _2
  27968. _2:
  27969. ;
  27970. i++
  27971. }
  27972. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  27973. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  27974. if convert != 0 {
  27975. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  27976. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  27977. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  27978. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  27979. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  27980. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  27981. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  27982. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  27983. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  27984. }
  27985. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  27986. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  27987. return e
  27988. }
  27989. const _UNKNOWN_ENC = -1
  27990. const _ISO_8859_1_ENC = 0
  27991. const _US_ASCII_ENC = 1
  27992. const _UTF_8_ENC = 2
  27993. const _UTF_16_ENC = 3
  27994. const _UTF_16BE_ENC = 4
  27995. const _UTF_16LE_ENC = 5
  27996. const
  27997. /* must match encodingNames up to here */
  27998. _NO_ENC = 6
  27999. var _KW_ISO_8859_1 = [11]uint8{
  28000. 0: uint8(m_ASCII_I),
  28001. 1: uint8(m_ASCII_S),
  28002. 2: uint8(m_ASCII_O),
  28003. 3: uint8(m_ASCII_MINUS1),
  28004. 4: uint8(m_ASCII_82),
  28005. 5: uint8(m_ASCII_82),
  28006. 6: uint8(m_ASCII_51),
  28007. 7: uint8(m_ASCII_92),
  28008. 8: uint8(m_ASCII_MINUS1),
  28009. 9: uint8(m_ASCII_12),
  28010. }
  28011. var _KW_US_ASCII = [9]uint8{
  28012. 0: uint8(m_ASCII_U1),
  28013. 1: uint8(m_ASCII_S),
  28014. 2: uint8(m_ASCII_MINUS1),
  28015. 3: uint8(m_ASCII_A),
  28016. 4: uint8(m_ASCII_S),
  28017. 5: uint8(m_ASCII_C),
  28018. 6: uint8(m_ASCII_I),
  28019. 7: uint8(m_ASCII_I),
  28020. }
  28021. var _KW_UTF_8 = [6]uint8{
  28022. 0: uint8(m_ASCII_U1),
  28023. 1: uint8(m_ASCII_T),
  28024. 2: uint8(m_ASCII_F),
  28025. 3: uint8(m_ASCII_MINUS1),
  28026. 4: uint8(m_ASCII_82),
  28027. }
  28028. var _KW_UTF_16 = [7]uint8{
  28029. 0: uint8(m_ASCII_U1),
  28030. 1: uint8(m_ASCII_T),
  28031. 2: uint8(m_ASCII_F),
  28032. 3: uint8(m_ASCII_MINUS1),
  28033. 4: uint8(m_ASCII_12),
  28034. 5: uint8(m_ASCII_61),
  28035. }
  28036. var _KW_UTF_16BE = [9]uint8{
  28037. 0: uint8(m_ASCII_U1),
  28038. 1: uint8(m_ASCII_T),
  28039. 2: uint8(m_ASCII_F),
  28040. 3: uint8(m_ASCII_MINUS1),
  28041. 4: uint8(m_ASCII_12),
  28042. 5: uint8(m_ASCII_61),
  28043. 6: uint8(m_ASCII_B1),
  28044. 7: uint8(m_ASCII_E),
  28045. }
  28046. var _KW_UTF_16LE = [9]uint8{
  28047. 0: uint8(m_ASCII_U1),
  28048. 1: uint8(m_ASCII_T),
  28049. 2: uint8(m_ASCII_F),
  28050. 3: uint8(m_ASCII_MINUS1),
  28051. 4: uint8(m_ASCII_12),
  28052. 5: uint8(m_ASCII_61),
  28053. 6: uint8(m_ASCII_L),
  28054. 7: uint8(m_ASCII_E),
  28055. }
  28056. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28057. var i int32
  28058. _ = i
  28059. if name == libc.UintptrFromInt32(0) {
  28060. return int32(_NO_ENC)
  28061. }
  28062. i = 0
  28063. for {
  28064. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  28065. break
  28066. }
  28067. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28068. return i
  28069. }
  28070. goto _1
  28071. _1:
  28072. ;
  28073. i++
  28074. }
  28075. return int32(_UNKNOWN_ENC)
  28076. }
  28077. var _encodingNames = [6]uintptr{
  28078. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28079. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28080. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28081. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28082. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28083. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28084. }
  28085. /* For binary compatibility, we store the index of the encoding
  28086. specified at initialization in the isUtf16 member.
  28087. */
  28088. /* This is what detects the encoding. encodingTable maps from
  28089. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28090. the external (protocol) specified encoding; state is
  28091. XML_CONTENT_STATE if we're parsing an external text entity, and
  28092. XML_PROLOG_STATE otherwise.
  28093. */
  28094. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28095. var e int32
  28096. var encPtr uintptr
  28097. _, _ = e, encPtr
  28098. if ptr >= end {
  28099. return -int32(4)
  28100. }
  28101. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28102. if ptr+uintptr(1) == end {
  28103. /* only a single byte available for auto-detection */
  28104. /* so we're parsing an external text entity... */
  28105. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28106. switch libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28107. case int32(_UTF_16_ENC):
  28108. fallthrough
  28109. case int32(_UTF_16LE_ENC):
  28110. fallthrough
  28111. case int32(_UTF_16BE_ENC):
  28112. return -int32(1)
  28113. }
  28114. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  28115. case int32(0xFE):
  28116. fallthrough
  28117. case int32(0xFF):
  28118. fallthrough
  28119. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28120. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28121. break
  28122. }
  28123. /* fall through */
  28124. fallthrough
  28125. case 0x00:
  28126. fallthrough
  28127. case int32(0x3C):
  28128. return -int32(1)
  28129. }
  28130. } else {
  28131. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) {
  28132. case int32(0xFEFF):
  28133. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28134. break
  28135. }
  28136. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28137. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28138. return int32(m_XML_TOK_BOM)
  28139. /* 00 3C is handled in the default case */
  28140. fallthrough
  28141. case int32(0x3C00):
  28142. if (libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  28143. break
  28144. }
  28145. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28146. 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)
  28147. case int32(0xFFFE):
  28148. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28149. break
  28150. }
  28151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28152. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28153. return int32(m_XML_TOK_BOM)
  28154. case int32(0xEFBB):
  28155. /* Maybe a UTF-8 BOM (EF BB BF) */
  28156. /* If there's an explicitly specified (external) encoding
  28157. of ISO-8859-1 or some flavour of UTF-16
  28158. and this is an external text entity,
  28159. don't look for the BOM,
  28160. because it might be a legal data.
  28161. */
  28162. if state == int32(m_XML_CONTENT_STATE) {
  28163. e = libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28164. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28165. break
  28166. }
  28167. }
  28168. if ptr+uintptr(2) == end {
  28169. return -int32(1)
  28170. }
  28171. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 2))) == int32(0xBF) {
  28172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28173. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  28174. return int32(m_XML_TOK_BOM)
  28175. }
  28176. default:
  28177. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32('\000') {
  28178. /* 0 isn't a legal data character. Furthermore a document
  28179. entity can only start with ASCII characters. So the only
  28180. way this can fail to be big-endian UTF-16 if it it's an
  28181. external parsed general entity that's labelled as
  28182. UTF-16LE.
  28183. */
  28184. if state == int32(m_XML_CONTENT_STATE) && libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28185. break
  28186. }
  28187. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  28188. 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)
  28189. } else {
  28190. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28191. /* We could recover here in the case:
  28192. - parsing an external entity
  28193. - second byte is 0
  28194. - no externally specified encoding
  28195. - no encoding declaration
  28196. by assuming UTF-16LE. But we don't, because this would mean when
  28197. presented just with a single byte, we couldn't reliably determine
  28198. whether we needed further bytes.
  28199. */
  28200. if state == int32(m_XML_CONTENT_STATE) {
  28201. break
  28202. }
  28203. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  28204. 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)
  28205. }
  28206. }
  28207. break
  28208. }
  28209. }
  28210. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  28211. 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)
  28212. }
  28213. /* This file is included!
  28214. __ __ _
  28215. ___\ \/ /_ __ __ _| |_
  28216. / _ \\ /| '_ \ / _` | __|
  28217. | __// \| |_) | (_| | |_
  28218. \___/_/\_\ .__/ \__,_|\__|
  28219. |_| XML parser
  28220. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28221. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28222. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28223. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28224. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28225. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28226. Licensed under the MIT license:
  28227. Permission is hereby granted, free of charge, to any person obtaining
  28228. a copy of this software and associated documentation files (the
  28229. "Software"), to deal in the Software without restriction, including
  28230. without limitation the rights to use, copy, modify, merge, publish,
  28231. distribute, sublicense, and/or sell copies of the Software, and to permit
  28232. persons to whom the Software is furnished to do so, subject to the
  28233. following conditions:
  28234. The above copyright notice and this permission notice shall be included
  28235. in all copies or substantial portions of the Software.
  28236. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28237. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28238. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28239. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28240. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28241. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28242. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28243. */
  28244. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28245. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28246. }
  28247. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28248. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28249. }
  28250. var _encodings = [7]uintptr{
  28251. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28252. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28253. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28254. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28255. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28256. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28257. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28258. }
  28259. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28260. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28261. }
  28262. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28263. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28264. }
  28265. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28266. var i int32
  28267. _ = i
  28268. i = _getEncodingIndex(tls, name)
  28269. if i == int32(_UNKNOWN_ENC) {
  28270. return 0
  28271. }
  28272. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  28273. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28274. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  28275. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28276. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28277. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28278. return int32(1)
  28279. }
  28280. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28281. bp := tls.Alloc(144)
  28282. defer tls.Free(144)
  28283. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28284. var i int32
  28285. var _ /* buf at bp+8 */ [128]uint8
  28286. var _ /* p at bp+136 */ uintptr
  28287. _ = i
  28288. *(*[128]uint8)(unsafe.Pointer(bp + 8)) = [128]uint8{}
  28289. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28290. (*(*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))
  28291. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28292. return uintptr(0)
  28293. }
  28294. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  28295. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28296. return enc
  28297. }
  28298. i = _getEncodingIndex(tls, bp+8)
  28299. if i == int32(_UNKNOWN_ENC) {
  28300. return uintptr(0)
  28301. }
  28302. return _encodings[i]
  28303. }
  28304. 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) {
  28305. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28306. }
  28307. /* This file is included!
  28308. __ __ _
  28309. ___\ \/ /_ __ __ _| |_
  28310. / _ \\ /| '_ \ / _` | __|
  28311. | __// \| |_) | (_| | |_
  28312. \___/_/\_\ .__/ \__,_|\__|
  28313. |_| XML parser
  28314. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28315. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28316. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28317. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28318. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28319. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28320. Licensed under the MIT license:
  28321. Permission is hereby granted, free of charge, to any person obtaining
  28322. a copy of this software and associated documentation files (the
  28323. "Software"), to deal in the Software without restriction, including
  28324. without limitation the rights to use, copy, modify, merge, publish,
  28325. distribute, sublicense, and/or sell copies of the Software, and to permit
  28326. persons to whom the Software is furnished to do so, subject to the
  28327. following conditions:
  28328. The above copyright notice and this permission notice shall be included
  28329. in all copies or substantial portions of the Software.
  28330. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28331. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28332. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28333. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28334. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28335. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28336. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28337. */
  28338. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28339. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28340. }
  28341. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28342. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28343. }
  28344. var _encodingsNS = [7]uintptr{
  28345. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28346. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28347. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28348. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28349. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28350. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28351. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28352. }
  28353. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28354. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28355. }
  28356. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28357. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28358. }
  28359. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28360. var i int32
  28361. _ = i
  28362. i = _getEncodingIndex(tls, name)
  28363. if i == int32(_UNKNOWN_ENC) {
  28364. return 0
  28365. }
  28366. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  28367. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28368. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  28369. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28370. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28371. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28372. return int32(1)
  28373. }
  28374. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28375. bp := tls.Alloc(144)
  28376. defer tls.Free(144)
  28377. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28378. var i int32
  28379. var _ /* buf at bp+8 */ [128]uint8
  28380. var _ /* p at bp+136 */ uintptr
  28381. _ = i
  28382. *(*[128]uint8)(unsafe.Pointer(bp + 8)) = [128]uint8{}
  28383. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  28384. (*(*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))
  28385. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28386. return uintptr(0)
  28387. }
  28388. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  28389. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28390. return enc
  28391. }
  28392. i = _getEncodingIndex(tls, bp+8)
  28393. if i == int32(_UNKNOWN_ENC) {
  28394. return uintptr(0)
  28395. }
  28396. return _encodingsNS[i]
  28397. }
  28398. 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) {
  28399. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28400. }
  28401. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28402. var enc uintptr
  28403. _ = enc
  28404. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28405. if enc != 0 {
  28406. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  28407. }
  28408. return enc
  28409. }
  28410. func __ccgo_fp(f interface{}) uintptr {
  28411. type iface [2]uintptr
  28412. return (*iface)(unsafe.Pointer(&f))[1]
  28413. }
  28414. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28415. 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"