ccgo_linux_386.go 1022 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174
  1. // Code generated for linux/386 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/386 -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 && 386
  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_ILOGB0 = "FP_ILOGBNAN"
  286. const m_FP_INFINITE = 1
  287. const m_FP_NAN = 0
  288. const m_FP_NORMAL = 4
  289. const m_FP_SUBNORMAL = 3
  290. const m_FP_ZERO = 2
  291. const m_F_ADD_SEALS = 1033
  292. const m_F_CANCELLK = 1029
  293. const m_F_DUPFD = 0
  294. const m_F_DUPFD_CLOEXEC = 1030
  295. const m_F_GETFD = 1
  296. const m_F_GETFL = 3
  297. const m_F_GETLEASE = 1025
  298. const m_F_GETLK = 12
  299. const m_F_GETOWN = 9
  300. const m_F_GETOWNER_UIDS = 17
  301. const m_F_GETOWN_EX = 16
  302. const m_F_GETPIPE_SZ = 1032
  303. const m_F_GETSIG = 11
  304. const m_F_GET_FILE_RW_HINT = 1037
  305. const m_F_GET_RW_HINT = 1035
  306. const m_F_GET_SEALS = 1034
  307. const m_F_LOCK = 1
  308. const m_F_NOTIFY = 1026
  309. const m_F_OFD_GETLK = 36
  310. const m_F_OFD_SETLK = 37
  311. const m_F_OFD_SETLKW = 38
  312. const m_F_OK = 0
  313. const m_F_OWNER_GID = 2
  314. const m_F_OWNER_PGRP = 2
  315. const m_F_OWNER_PID = 1
  316. const m_F_OWNER_TID = 0
  317. const m_F_RDLCK = 0
  318. const m_F_SEAL_FUTURE_WRITE = 0x0010
  319. const m_F_SEAL_GROW = 0x0004
  320. const m_F_SEAL_SEAL = 0x0001
  321. const m_F_SEAL_SHRINK = 0x0002
  322. const m_F_SEAL_WRITE = 0x0008
  323. const m_F_SETFD = 2
  324. const m_F_SETFL = 4
  325. const m_F_SETLEASE = 1024
  326. const m_F_SETLK = 13
  327. const m_F_SETLKW = 14
  328. const m_F_SETOWN = 8
  329. const m_F_SETOWN_EX = 15
  330. const m_F_SETPIPE_SZ = 1031
  331. const m_F_SETSIG = 10
  332. const m_F_SET_FILE_RW_HINT = 1038
  333. const m_F_SET_RW_HINT = 1036
  334. const m_F_TEST = 3
  335. const m_F_TLOCK = 2
  336. const m_F_ULOCK = 0
  337. const m_F_UNLCK = 2
  338. const m_F_WRLCK = 1
  339. const m_GRND_INSECURE = 0x0004
  340. const m_GRND_NONBLOCK = 0x0001
  341. const m_GRND_RANDOM = 0x0002
  342. const m_HAVE_ARC4RANDOM_BUF = 1
  343. const m_HAVE_CONFIG_H = 1
  344. const m_HAVE_DLFCN_H = 1
  345. const m_HAVE_FCNTL_H = 1
  346. const m_HAVE_GETPAGESIZE = 1
  347. const m_HAVE_GETRANDOM = 1
  348. const m_HAVE_INTTYPES_H = 1
  349. const m_HAVE_MMAP = 1
  350. const m_HAVE_STDINT_H = 1
  351. const m_HAVE_STDIO_H = 1
  352. const m_HAVE_STDLIB_H = 1
  353. const m_HAVE_STRINGS_H = 1
  354. const m_HAVE_STRING_H = 1
  355. const m_HAVE_SYSCALL_GETRANDOM = 1
  356. const m_HAVE_SYS_PARAM_H = 1
  357. const m_HAVE_SYS_STAT_H = 1
  358. const m_HAVE_SYS_TYPES_H = 1
  359. const m_HAVE_UNISTD_H = 1
  360. const m_HOST_NAME_MAX = 255
  361. const m_HUGE = 3.40282346638528859812e+38
  362. const m_HUGE_VALF = "INFINITY"
  363. const m_INIT_ATTS_SIZE = 16
  364. const m_INIT_ATTS_VERSION = 4294967295
  365. const m_INIT_BLOCK_SIZE = 1024
  366. const m_INIT_BUFFER_SIZE = 1024
  367. const m_INIT_DATA_BUF_SIZE = 1024
  368. const m_INIT_POWER = 6
  369. const m_INIT_SCAFFOLD_ELEMENTS = 32
  370. const m_INIT_TAG_BUF_SIZE = 32
  371. const m_INT16_MAX = 0x7fff
  372. const m_INT32_MAX = 0x7fffffff
  373. const m_INT64_MAX = 0x7fffffffffffffff
  374. const m_INT8_MAX = 0x7f
  375. const m_INTMAX_MAX = "INT64_MAX"
  376. const m_INTMAX_MIN = "INT64_MIN"
  377. const m_INTPTR_MAX = "INT32_MAX"
  378. const m_INTPTR_MIN = "INT32_MIN"
  379. const m_INT_FAST16_MAX = "INT32_MAX"
  380. const m_INT_FAST16_MIN = "INT32_MIN"
  381. const m_INT_FAST32_MAX = "INT32_MAX"
  382. const m_INT_FAST32_MIN = "INT32_MIN"
  383. const m_INT_FAST64_MAX = "INT64_MAX"
  384. const m_INT_FAST64_MIN = "INT64_MIN"
  385. const m_INT_FAST8_MAX = "INT8_MAX"
  386. const m_INT_FAST8_MIN = "INT8_MIN"
  387. const m_INT_LEAST16_MAX = "INT16_MAX"
  388. const m_INT_LEAST16_MIN = "INT16_MIN"
  389. const m_INT_LEAST32_MAX = "INT32_MAX"
  390. const m_INT_LEAST32_MIN = "INT32_MIN"
  391. const m_INT_LEAST64_MAX = "INT64_MAX"
  392. const m_INT_LEAST64_MIN = "INT64_MIN"
  393. const m_INT_LEAST8_MAX = "INT8_MAX"
  394. const m_INT_LEAST8_MIN = "INT8_MIN"
  395. const m_INT_MAX = 2147483647
  396. const m_IOV_MAX = 1024
  397. const m_ITIMER_PROF = 2
  398. const m_ITIMER_REAL = 0
  399. const m_ITIMER_VIRTUAL = 1
  400. const m_LINE_MAX = 4096
  401. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  402. const m_LLONG_MAX = 0x7fffffffffffffff
  403. const m_LOGIN_NAME_MAX = 256
  404. const m_LONG_BIT = 32
  405. const m_LONG_MAX = "__LONG_MAX"
  406. const m_LT_OBJDIR = ".libs/"
  407. const m_L_INCR = 1
  408. const m_L_SET = 0
  409. const m_L_XTND = 2
  410. const m_L_ctermid = 20
  411. const m_L_cuserid = 20
  412. const m_L_tmpnam = 20
  413. const m_MATH_ERREXCEPT = 2
  414. const m_MATH_ERRNO = 1
  415. const m_MAX_HANDLE_SZ = 128
  416. const m_MB_LEN_MAX = 4
  417. const m_MQ_PRIO_MAX = 32768
  418. const m_M_1_PI = 0.31830988618379067154
  419. const m_M_2_PI = 0.63661977236758134308
  420. const m_M_2_SQRTPI = 1.12837916709551257390
  421. const m_M_E = 2.7182818284590452354
  422. const m_M_LN10 = 2.30258509299404568402
  423. const m_M_LN2 = 0.69314718055994530942
  424. const m_M_LOG10E = 0.43429448190325182765
  425. const m_M_LOG2E = 1.4426950408889634074
  426. const m_M_PI = 3.14159265358979323846
  427. const m_M_PI_2 = 1.57079632679489661923
  428. const m_M_PI_4 = 0.78539816339744830962
  429. const m_M_SQRT1_2 = 0.70710678118654752440
  430. const m_M_SQRT2 = 1.41421356237309504880
  431. const m_NAME_MAX = 255
  432. const m_NDEBUG = 1
  433. const m_NGROUPS_MAX = 32
  434. const m_NL_ARGMAX = 9
  435. const m_NL_LANGMAX = 32
  436. const m_NL_MSGMAX = 32767
  437. const m_NL_NMAX = 16
  438. const m_NL_SETMAX = 255
  439. const m_NL_TEXTMAX = 2048
  440. const m_NZERO = 20
  441. const m_O_APPEND = 02000
  442. const m_O_ASYNC = 020000
  443. const m_O_CLOEXEC = 02000000
  444. const m_O_CREAT = 0100
  445. const m_O_DIRECT = 040000
  446. const m_O_DIRECTORY = 0200000
  447. const m_O_DSYNC = 010000
  448. const m_O_EXCL = 0200
  449. const m_O_EXEC = "O_PATH"
  450. const m_O_LARGEFILE = 0100000
  451. const m_O_NDELAY = "O_NONBLOCK"
  452. const m_O_NOATIME = 01000000
  453. const m_O_NOCTTY = 0400
  454. const m_O_NOFOLLOW = 0400000
  455. const m_O_NONBLOCK = 04000
  456. const m_O_PATH = 010000000
  457. const m_O_RDONLY = 00
  458. const m_O_RDWR = 02
  459. const m_O_RSYNC = 04010000
  460. const m_O_SEARCH = "O_PATH"
  461. const m_O_SYNC = 04010000
  462. const m_O_TMPFILE = 020200000
  463. const m_O_TRUNC = 01000
  464. const m_O_TTY_INIT = 0
  465. const m_O_WRONLY = 01
  466. const m_PACKAGE = "expat"
  467. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  468. const m_PACKAGE_NAME = "expat"
  469. const m_PACKAGE_STRING = "expat 2.5.0"
  470. const m_PACKAGE_TARNAME = "expat"
  471. const m_PACKAGE_URL = ""
  472. const m_PACKAGE_VERSION = "2.5.0"
  473. const m_PAGESIZE = 4096
  474. const m_PAGE_SIZE = "PAGESIZE"
  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 = "INT32_MAX"
  489. const m_PTRDIFF_MIN = "INT32_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 = "UINT32_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 = "UINT32_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__FILE_OFFSET_BITS = 64
  681. const m__GNU_SOURCE = 1
  682. const m__ILP32 = 1
  683. const m__IOFBF = 0
  684. const m__IOLBF = 1
  685. const m__IONBF = 2
  686. const m__PC_2_SYMLINKS = 20
  687. const m__PC_ALLOC_SIZE_MIN = 18
  688. const m__PC_ASYNC_IO = 10
  689. const m__PC_CHOWN_RESTRICTED = 6
  690. const m__PC_FILESIZEBITS = 13
  691. const m__PC_LINK_MAX = 0
  692. const m__PC_MAX_CANON = 1
  693. const m__PC_MAX_INPUT = 2
  694. const m__PC_NAME_MAX = 3
  695. const m__PC_NO_TRUNC = 7
  696. const m__PC_PATH_MAX = 4
  697. const m__PC_PIPE_BUF = 5
  698. const m__PC_PRIO_IO = 11
  699. const m__PC_REC_INCR_XFER_SIZE = 14
  700. const m__PC_REC_MAX_XFER_SIZE = 15
  701. const m__PC_REC_MIN_XFER_SIZE = 16
  702. const m__PC_REC_XFER_ALIGN = 17
  703. const m__PC_SOCK_MAXBUF = 12
  704. const m__PC_SYMLINK_MAX = 19
  705. const m__PC_SYNC_IO = 9
  706. const m__PC_VDISABLE = 8
  707. const m__POSIX2_BC_BASE_MAX = 99
  708. const m__POSIX2_BC_DIM_MAX = 2048
  709. const m__POSIX2_BC_SCALE_MAX = 99
  710. const m__POSIX2_BC_STRING_MAX = 1000
  711. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  712. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  713. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  714. const m__POSIX2_EXPR_NEST_MAX = 32
  715. const m__POSIX2_LINE_MAX = 2048
  716. const m__POSIX2_RE_DUP_MAX = 255
  717. const m__POSIX2_VERSION = "_POSIX_VERSION"
  718. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  719. const m__POSIX_AIO_LISTIO_MAX = 2
  720. const m__POSIX_AIO_MAX = 1
  721. const m__POSIX_ARG_MAX = 4096
  722. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  723. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  724. const m__POSIX_CHILD_MAX = 25
  725. const m__POSIX_CHOWN_RESTRICTED = 1
  726. const m__POSIX_CLOCKRES_MIN = 20000000
  727. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  728. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  729. const m__POSIX_DELAYTIMER_MAX = 32
  730. const m__POSIX_FSYNC = "_POSIX_VERSION"
  731. const m__POSIX_HOST_NAME_MAX = 255
  732. const m__POSIX_IPV6 = "_POSIX_VERSION"
  733. const m__POSIX_JOB_CONTROL = 1
  734. const m__POSIX_LINK_MAX = 8
  735. const m__POSIX_LOGIN_NAME_MAX = 9
  736. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  737. const m__POSIX_MAX_CANON = 255
  738. const m__POSIX_MAX_INPUT = 255
  739. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  740. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  741. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  742. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  743. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  744. const m__POSIX_MQ_OPEN_MAX = 8
  745. const m__POSIX_MQ_PRIO_MAX = 32
  746. const m__POSIX_NAME_MAX = 14
  747. const m__POSIX_NGROUPS_MAX = 8
  748. const m__POSIX_NO_TRUNC = 1
  749. const m__POSIX_OPEN_MAX = 20
  750. const m__POSIX_PATH_MAX = 256
  751. const m__POSIX_PIPE_BUF = 512
  752. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  753. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  754. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  755. const m__POSIX_REGEXP = 1
  756. const m__POSIX_RE_DUP_MAX = 255
  757. const m__POSIX_RTSIG_MAX = 8
  758. const m__POSIX_SAVED_IDS = 1
  759. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  760. const m__POSIX_SEM_NSEMS_MAX = 256
  761. const m__POSIX_SEM_VALUE_MAX = 32767
  762. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  763. const m__POSIX_SHELL = 1
  764. const m__POSIX_SIGQUEUE_MAX = 32
  765. const m__POSIX_SPAWN = "_POSIX_VERSION"
  766. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  767. const m__POSIX_SSIZE_MAX = 32767
  768. const m__POSIX_SS_REPL_MAX = 4
  769. const m__POSIX_STREAM_MAX = 8
  770. const m__POSIX_SYMLINK_MAX = 255
  771. const m__POSIX_SYMLOOP_MAX = 8
  772. const m__POSIX_THREADS = "_POSIX_VERSION"
  773. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  774. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  775. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  776. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  777. const m__POSIX_THREAD_KEYS_MAX = 128
  778. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  779. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  780. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  781. const m__POSIX_THREAD_THREADS_MAX = 64
  782. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  783. const m__POSIX_TIMERS = "_POSIX_VERSION"
  784. const m__POSIX_TIMER_MAX = 32
  785. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  786. const m__POSIX_TRACE_NAME_MAX = 8
  787. const m__POSIX_TRACE_SYS_MAX = 8
  788. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  789. const m__POSIX_TTY_NAME_MAX = 9
  790. const m__POSIX_TZNAME_MAX = 6
  791. const m__POSIX_V6_ILP32_OFFBIG = 1
  792. const m__POSIX_V7_ILP32_OFFBIG = 1
  793. const m__POSIX_VDISABLE = 0
  794. const m__POSIX_VERSION = 200809
  795. const m__REDIR_TIME64 = 1
  796. const m__SC_2_CHAR_TERM = 95
  797. const m__SC_2_C_BIND = 47
  798. const m__SC_2_C_DEV = 48
  799. const m__SC_2_FORT_DEV = 49
  800. const m__SC_2_FORT_RUN = 50
  801. const m__SC_2_LOCALEDEF = 52
  802. const m__SC_2_PBS = 168
  803. const m__SC_2_PBS_ACCOUNTING = 169
  804. const m__SC_2_PBS_CHECKPOINT = 175
  805. const m__SC_2_PBS_LOCATE = 170
  806. const m__SC_2_PBS_MESSAGE = 171
  807. const m__SC_2_PBS_TRACK = 172
  808. const m__SC_2_SW_DEV = 51
  809. const m__SC_2_UPE = 97
  810. const m__SC_2_VERSION = 46
  811. const m__SC_ADVISORY_INFO = 132
  812. const m__SC_AIO_LISTIO_MAX = 23
  813. const m__SC_AIO_MAX = 24
  814. const m__SC_AIO_PRIO_DELTA_MAX = 25
  815. const m__SC_ARG_MAX = 0
  816. const m__SC_ASYNCHRONOUS_IO = 12
  817. const m__SC_ATEXIT_MAX = 87
  818. const m__SC_AVPHYS_PAGES = 86
  819. const m__SC_BARRIERS = 133
  820. const m__SC_BC_BASE_MAX = 36
  821. const m__SC_BC_DIM_MAX = 37
  822. const m__SC_BC_SCALE_MAX = 38
  823. const m__SC_BC_STRING_MAX = 39
  824. const m__SC_CHILD_MAX = 1
  825. const m__SC_CLK_TCK = 2
  826. const m__SC_CLOCK_SELECTION = 137
  827. const m__SC_COLL_WEIGHTS_MAX = 40
  828. const m__SC_CPUTIME = 138
  829. const m__SC_DELAYTIMER_MAX = 26
  830. const m__SC_EXPR_NEST_MAX = 42
  831. const m__SC_FSYNC = 15
  832. const m__SC_GETGR_R_SIZE_MAX = 69
  833. const m__SC_GETPW_R_SIZE_MAX = 70
  834. const m__SC_HOST_NAME_MAX = 180
  835. const m__SC_IOV_MAX = 60
  836. const m__SC_IPV6 = 235
  837. const m__SC_JOB_CONTROL = 7
  838. const m__SC_LINE_MAX = 43
  839. const m__SC_LOGIN_NAME_MAX = 71
  840. const m__SC_MAPPED_FILES = 16
  841. const m__SC_MEMLOCK = 17
  842. const m__SC_MEMLOCK_RANGE = 18
  843. const m__SC_MEMORY_PROTECTION = 19
  844. const m__SC_MESSAGE_PASSING = 20
  845. const m__SC_MINSIGSTKSZ = 249
  846. const m__SC_MONOTONIC_CLOCK = 149
  847. const m__SC_MQ_OPEN_MAX = 27
  848. const m__SC_MQ_PRIO_MAX = 28
  849. const m__SC_NGROUPS_MAX = 3
  850. const m__SC_NPROCESSORS_CONF = 83
  851. const m__SC_NPROCESSORS_ONLN = 84
  852. const m__SC_NZERO = 109
  853. const m__SC_OPEN_MAX = 4
  854. const m__SC_PAGESIZE = 30
  855. const m__SC_PAGE_SIZE = 30
  856. const m__SC_PASS_MAX = 88
  857. const m__SC_PHYS_PAGES = 85
  858. const m__SC_PRIORITIZED_IO = 13
  859. const m__SC_PRIORITY_SCHEDULING = 10
  860. const m__SC_RAW_SOCKETS = 236
  861. const m__SC_READER_WRITER_LOCKS = 153
  862. const m__SC_REALTIME_SIGNALS = 9
  863. const m__SC_REGEXP = 155
  864. const m__SC_RE_DUP_MAX = 44
  865. const m__SC_RTSIG_MAX = 31
  866. const m__SC_SAVED_IDS = 8
  867. const m__SC_SEMAPHORES = 21
  868. const m__SC_SEM_NSEMS_MAX = 32
  869. const m__SC_SEM_VALUE_MAX = 33
  870. const m__SC_SHARED_MEMORY_OBJECTS = 22
  871. const m__SC_SHELL = 157
  872. const m__SC_SIGQUEUE_MAX = 34
  873. const m__SC_SIGSTKSZ = 250
  874. const m__SC_SPAWN = 159
  875. const m__SC_SPIN_LOCKS = 154
  876. const m__SC_SPORADIC_SERVER = 160
  877. const m__SC_SS_REPL_MAX = 241
  878. const m__SC_STREAMS = 174
  879. const m__SC_STREAM_MAX = 5
  880. const m__SC_SYMLOOP_MAX = 173
  881. const m__SC_SYNCHRONIZED_IO = 14
  882. const m__SC_THREADS = 67
  883. const m__SC_THREAD_ATTR_STACKADDR = 77
  884. const m__SC_THREAD_ATTR_STACKSIZE = 78
  885. const m__SC_THREAD_CPUTIME = 139
  886. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  887. const m__SC_THREAD_KEYS_MAX = 74
  888. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  889. const m__SC_THREAD_PRIO_INHERIT = 80
  890. const m__SC_THREAD_PRIO_PROTECT = 81
  891. const m__SC_THREAD_PROCESS_SHARED = 82
  892. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  893. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  894. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  895. const m__SC_THREAD_SPORADIC_SERVER = 161
  896. const m__SC_THREAD_STACK_MIN = 75
  897. const m__SC_THREAD_THREADS_MAX = 76
  898. const m__SC_TIMEOUTS = 164
  899. const m__SC_TIMERS = 11
  900. const m__SC_TIMER_MAX = 35
  901. const m__SC_TRACE = 181
  902. const m__SC_TRACE_EVENT_FILTER = 182
  903. const m__SC_TRACE_EVENT_NAME_MAX = 242
  904. const m__SC_TRACE_INHERIT = 183
  905. const m__SC_TRACE_LOG = 184
  906. const m__SC_TRACE_NAME_MAX = 243
  907. const m__SC_TRACE_SYS_MAX = 244
  908. const m__SC_TRACE_USER_EVENT_MAX = 245
  909. const m__SC_TTY_NAME_MAX = 72
  910. const m__SC_TYPED_MEMORY_OBJECTS = 165
  911. const m__SC_TZNAME_MAX = 6
  912. const m__SC_UIO_MAXIOV = 60
  913. const m__SC_V6_ILP32_OFF32 = 176
  914. const m__SC_V6_ILP32_OFFBIG = 177
  915. const m__SC_V6_LP64_OFF64 = 178
  916. const m__SC_V6_LPBIG_OFFBIG = 179
  917. const m__SC_V7_ILP32_OFF32 = 237
  918. const m__SC_V7_ILP32_OFFBIG = 238
  919. const m__SC_V7_LP64_OFF64 = 239
  920. const m__SC_V7_LPBIG_OFFBIG = 240
  921. const m__SC_VERSION = 29
  922. const m__SC_XBS5_ILP32_OFF32 = 125
  923. const m__SC_XBS5_ILP32_OFFBIG = 126
  924. const m__SC_XBS5_LP64_OFF64 = 127
  925. const m__SC_XBS5_LPBIG_OFFBIG = 128
  926. const m__SC_XOPEN_CRYPT = 92
  927. const m__SC_XOPEN_ENH_I18N = 93
  928. const m__SC_XOPEN_LEGACY = 129
  929. const m__SC_XOPEN_REALTIME = 130
  930. const m__SC_XOPEN_REALTIME_THREADS = 131
  931. const m__SC_XOPEN_SHM = 94
  932. const m__SC_XOPEN_STREAMS = 246
  933. const m__SC_XOPEN_UNIX = 91
  934. const m__SC_XOPEN_VERSION = 89
  935. const m__SC_XOPEN_XCU_VERSION = 90
  936. const m__SC_XOPEN_XPG2 = 98
  937. const m__SC_XOPEN_XPG3 = 99
  938. const m__SC_XOPEN_XPG4 = 100
  939. const m__STDC_PREDEF_H = 1
  940. const m__XOPEN_ENH_I18N = 1
  941. const m__XOPEN_IOV_MAX = 16
  942. const m__XOPEN_NAME_MAX = 255
  943. const m__XOPEN_PATH_MAX = 1024
  944. const m__XOPEN_UNIX = 1
  945. const m__XOPEN_VERSION = 700
  946. const m___ATOMIC_ACQUIRE = 2
  947. const m___ATOMIC_ACQ_REL = 4
  948. const m___ATOMIC_CONSUME = 1
  949. const m___ATOMIC_HLE_ACQUIRE = 65536
  950. const m___ATOMIC_HLE_RELEASE = 131072
  951. const m___ATOMIC_RELAXED = 0
  952. const m___ATOMIC_RELEASE = 3
  953. const m___ATOMIC_SEQ_CST = 5
  954. const m___BIGGEST_ALIGNMENT__ = 16
  955. const m___BIG_ENDIAN = 4321
  956. const m___BYTE_ORDER = 1234
  957. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  958. const m___CCGO__ = 1
  959. const m___CHAR_BIT__ = 8
  960. const m___DBL_DECIMAL_DIG__ = 17
  961. const m___DBL_DIG__ = 15
  962. const m___DBL_HAS_DENORM__ = 1
  963. const m___DBL_HAS_INFINITY__ = 1
  964. const m___DBL_HAS_QUIET_NAN__ = 1
  965. const m___DBL_IS_IEC_60559__ = 2
  966. const m___DBL_MANT_DIG__ = 53
  967. const m___DBL_MAX_10_EXP__ = 308
  968. const m___DBL_MAX_EXP__ = 1024
  969. const m___DEC128_EPSILON__ = 1e-33
  970. const m___DEC128_MANT_DIG__ = 34
  971. const m___DEC128_MAX_EXP__ = 6145
  972. const m___DEC128_MAX__ = "9.999999999999999999999999999999999E6144"
  973. const m___DEC128_MIN__ = 1e-6143
  974. const m___DEC128_SUBNORMAL_MIN__ = 0.000000000000000000000000000000001e-6143
  975. const m___DEC32_EPSILON__ = 1e-6
  976. const m___DEC32_MANT_DIG__ = 7
  977. const m___DEC32_MAX_EXP__ = 97
  978. const m___DEC32_MAX__ = 9.999999e96
  979. const m___DEC32_MIN__ = 1e-95
  980. const m___DEC32_SUBNORMAL_MIN__ = 0.000001e-95
  981. const m___DEC64_EPSILON__ = 1e-15
  982. const m___DEC64_MANT_DIG__ = 16
  983. const m___DEC64_MAX_EXP__ = 385
  984. const m___DEC64_MAX__ = "9.999999999999999E384"
  985. const m___DEC64_MIN__ = 1e-383
  986. const m___DEC64_SUBNORMAL_MIN__ = 0.000000000000001e-383
  987. const m___DECIMAL_BID_FORMAT__ = 1
  988. const m___DECIMAL_DIG__ = 17
  989. const m___DEC_EVAL_METHOD__ = 2
  990. const m___ELF__ = 1
  991. const m___FINITE_MATH_ONLY__ = 0
  992. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  993. const m___FLT128_DECIMAL_DIG__ = 36
  994. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  995. const m___FLT128_DIG__ = 33
  996. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  997. const m___FLT128_HAS_DENORM__ = 1
  998. const m___FLT128_HAS_INFINITY__ = 1
  999. const m___FLT128_HAS_QUIET_NAN__ = 1
  1000. const m___FLT128_IS_IEC_60559__ = 2
  1001. const m___FLT128_MANT_DIG__ = 113
  1002. const m___FLT128_MAX_10_EXP__ = 4932
  1003. const m___FLT128_MAX_EXP__ = 16384
  1004. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1005. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  1006. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1007. const m___FLT32X_DECIMAL_DIG__ = 17
  1008. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1009. const m___FLT32X_DIG__ = 15
  1010. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1011. const m___FLT32X_HAS_DENORM__ = 1
  1012. const m___FLT32X_HAS_INFINITY__ = 1
  1013. const m___FLT32X_HAS_QUIET_NAN__ = 1
  1014. const m___FLT32X_IS_IEC_60559__ = 2
  1015. const m___FLT32X_MANT_DIG__ = 53
  1016. const m___FLT32X_MAX_10_EXP__ = 308
  1017. const m___FLT32X_MAX_EXP__ = 1024
  1018. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1019. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1020. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1021. const m___FLT32_DECIMAL_DIG__ = 9
  1022. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1023. const m___FLT32_DIG__ = 6
  1024. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1025. const m___FLT32_HAS_DENORM__ = 1
  1026. const m___FLT32_HAS_INFINITY__ = 1
  1027. const m___FLT32_HAS_QUIET_NAN__ = 1
  1028. const m___FLT32_IS_IEC_60559__ = 2
  1029. const m___FLT32_MANT_DIG__ = 24
  1030. const m___FLT32_MAX_10_EXP__ = 38
  1031. const m___FLT32_MAX_EXP__ = 128
  1032. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1033. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1034. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1035. const m___FLT64X_DECIMAL_DIG__ = 36
  1036. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1037. const m___FLT64X_DIG__ = 33
  1038. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1039. const m___FLT64X_HAS_DENORM__ = 1
  1040. const m___FLT64X_HAS_INFINITY__ = 1
  1041. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1042. const m___FLT64X_IS_IEC_60559__ = 2
  1043. const m___FLT64X_MANT_DIG__ = 113
  1044. const m___FLT64X_MAX_10_EXP__ = 4932
  1045. const m___FLT64X_MAX_EXP__ = 16384
  1046. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1047. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1048. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1049. const m___FLT64_DECIMAL_DIG__ = 17
  1050. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1051. const m___FLT64_DIG__ = 15
  1052. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1053. const m___FLT64_HAS_DENORM__ = 1
  1054. const m___FLT64_HAS_INFINITY__ = 1
  1055. const m___FLT64_HAS_QUIET_NAN__ = 1
  1056. const m___FLT64_IS_IEC_60559__ = 2
  1057. const m___FLT64_MANT_DIG__ = 53
  1058. const m___FLT64_MAX_10_EXP__ = 308
  1059. const m___FLT64_MAX_EXP__ = 1024
  1060. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1061. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1062. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1063. const m___FLT_DECIMAL_DIG__ = 9
  1064. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1065. const m___FLT_DIG__ = 6
  1066. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1067. const m___FLT_EVAL_METHOD_TS_18661_3__ = 2
  1068. const m___FLT_EVAL_METHOD__ = 2
  1069. const m___FLT_HAS_DENORM__ = 1
  1070. const m___FLT_HAS_INFINITY__ = 1
  1071. const m___FLT_HAS_QUIET_NAN__ = 1
  1072. const m___FLT_IS_IEC_60559__ = 2
  1073. const m___FLT_MANT_DIG__ = 24
  1074. const m___FLT_MAX_10_EXP__ = 38
  1075. const m___FLT_MAX_EXP__ = 128
  1076. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1077. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1078. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1079. const m___FLT_RADIX__ = 2
  1080. const m___FUNCTION__ = "__func__"
  1081. const m___GCC_ASM_FLAG_OUTPUTS__ = 1
  1082. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1083. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1084. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1085. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1086. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1087. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1088. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1089. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1090. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1091. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1092. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1093. const m___GCC_CONSTRUCTIVE_SIZE = 64
  1094. const m___GCC_DESTRUCTIVE_SIZE = 64
  1095. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1096. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1097. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1098. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1099. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1100. const m___GCC_IEC_559 = 2
  1101. const m___GCC_IEC_559_COMPLEX = 2
  1102. const m___GNUC_EXECUTION_CHARSET_NAME = "UTF-8"
  1103. const m___GNUC_MINOR__ = 2
  1104. const m___GNUC_PATCHLEVEL__ = 0
  1105. const m___GNUC_STDC_INLINE__ = 1
  1106. const m___GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE"
  1107. const m___GNUC__ = 12
  1108. const m___GXX_ABI_VERSION = 1017
  1109. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1110. const m___ILP32__ = 1
  1111. const m___INT16_MAX__ = 0x7fff
  1112. const m___INT32_MAX__ = 0x7fffffff
  1113. const m___INT32_TYPE__ = "int"
  1114. const m___INT64_MAX__ = 0x7fffffffffffffff
  1115. const m___INT8_MAX__ = 0x7f
  1116. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1117. const m___INTMAX_WIDTH__ = 64
  1118. const m___INTPTR_MAX__ = 0x7fffffff
  1119. const m___INTPTR_TYPE__ = "int"
  1120. const m___INTPTR_WIDTH__ = 32
  1121. const m___INT_FAST16_MAX__ = 0x7fffffff
  1122. const m___INT_FAST16_TYPE__ = "int"
  1123. const m___INT_FAST16_WIDTH__ = 32
  1124. const m___INT_FAST32_MAX__ = 0x7fffffff
  1125. const m___INT_FAST32_TYPE__ = "int"
  1126. const m___INT_FAST32_WIDTH__ = 32
  1127. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1128. const m___INT_FAST64_WIDTH__ = 64
  1129. const m___INT_FAST8_MAX__ = 0x7f
  1130. const m___INT_FAST8_WIDTH__ = 8
  1131. const m___INT_LEAST16_MAX__ = 0x7fff
  1132. const m___INT_LEAST16_WIDTH__ = 16
  1133. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1134. const m___INT_LEAST32_TYPE__ = "int"
  1135. const m___INT_LEAST32_WIDTH__ = 32
  1136. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1137. const m___INT_LEAST64_WIDTH__ = 64
  1138. const m___INT_LEAST8_MAX__ = 0x7f
  1139. const m___INT_LEAST8_WIDTH__ = 8
  1140. const m___INT_MAX__ = 0x7fffffff
  1141. const m___INT_WIDTH__ = 32
  1142. const m___LAHF_SAHF__ = 1
  1143. const m___LDBL_DECIMAL_DIG__ = 17
  1144. const m___LDBL_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1145. const m___LDBL_DIG__ = 15
  1146. const m___LDBL_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1147. const m___LDBL_HAS_DENORM__ = 1
  1148. const m___LDBL_HAS_INFINITY__ = 1
  1149. const m___LDBL_HAS_QUIET_NAN__ = 1
  1150. const m___LDBL_IS_IEC_60559__ = 2
  1151. const m___LDBL_MANT_DIG__ = 53
  1152. const m___LDBL_MAX_10_EXP__ = 308
  1153. const m___LDBL_MAX_EXP__ = 1024
  1154. const m___LDBL_MAX__ = 1.79769313486231570814527423731704357e+308
  1155. const m___LDBL_MIN__ = 2.22507385850720138309023271733240406e-308
  1156. const m___LDBL_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1157. const m___LITTLE_ENDIAN = 1234
  1158. const m___LONG_DOUBLE_64__ = 1
  1159. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1160. const m___LONG_LONG_WIDTH__ = 64
  1161. const m___LONG_MAX = 0x7fffffff
  1162. const m___LONG_MAX__ = 0x7fffffff
  1163. const m___LONG_WIDTH__ = 32
  1164. const m___NO_INLINE__ = 1
  1165. const m___ORDER_BIG_ENDIAN__ = 4321
  1166. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1167. const m___ORDER_PDP_ENDIAN__ = 3412
  1168. const m___PDP_ENDIAN = 3412
  1169. const m___PIC__ = 2
  1170. const m___PIE__ = 2
  1171. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1172. const m___PRETTY_FUNCTION__ = "__func__"
  1173. const m___PTRDIFF_MAX__ = 0x7fffffff
  1174. const m___PTRDIFF_TYPE__ = "int"
  1175. const m___PTRDIFF_WIDTH__ = 32
  1176. const m___SCHAR_MAX__ = 0x7f
  1177. const m___SCHAR_WIDTH__ = 8
  1178. const m___SEG_FS = 1
  1179. const m___SEG_GS = 1
  1180. const m___SHRT_MAX__ = 0x7fff
  1181. const m___SHRT_WIDTH__ = 16
  1182. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1183. const m___SIG_ATOMIC_TYPE__ = "int"
  1184. const m___SIG_ATOMIC_WIDTH__ = 32
  1185. const m___SIZEOF_DOUBLE__ = 8
  1186. const m___SIZEOF_FLOAT128__ = 16
  1187. const m___SIZEOF_FLOAT80__ = 12
  1188. const m___SIZEOF_FLOAT__ = 4
  1189. const m___SIZEOF_INT__ = 4
  1190. const m___SIZEOF_LONG_DOUBLE__ = 8
  1191. const m___SIZEOF_LONG_LONG__ = 8
  1192. const m___SIZEOF_LONG__ = 4
  1193. const m___SIZEOF_POINTER__ = 4
  1194. const m___SIZEOF_PTRDIFF_T__ = 4
  1195. const m___SIZEOF_SHORT__ = 2
  1196. const m___SIZEOF_SIZE_T__ = 4
  1197. const m___SIZEOF_WCHAR_T__ = 4
  1198. const m___SIZEOF_WINT_T__ = 4
  1199. const m___SIZE_MAX__ = 0xffffffff
  1200. const m___SIZE_WIDTH__ = 32
  1201. const m___STDC_HOSTED__ = 1
  1202. const m___STDC_IEC_559_COMPLEX__ = 1
  1203. const m___STDC_IEC_559__ = 1
  1204. const m___STDC_IEC_60559_BFP__ = 201404
  1205. const m___STDC_IEC_60559_COMPLEX__ = 201404
  1206. const m___STDC_ISO_10646__ = 201706
  1207. const m___STDC_UTF_16__ = 1
  1208. const m___STDC_UTF_32__ = 1
  1209. const m___STDC_VERSION__ = 201710
  1210. const m___STDC__ = 1
  1211. const m___UINT16_MAX__ = 0xffff
  1212. const m___UINT32_MAX__ = 0xffffffff
  1213. const m___UINT64_MAX__ = "0xffffffffffffffffU"
  1214. const m___UINT8_MAX__ = 0xff
  1215. const m___UINTMAX_MAX__ = "0xffffffffffffffffU"
  1216. const m___UINTPTR_MAX__ = 0xffffffff
  1217. const m___UINT_FAST16_MAX__ = 0xffffffff
  1218. const m___UINT_FAST32_MAX__ = 0xffffffff
  1219. const m___UINT_FAST64_MAX__ = "0xffffffffffffffffU"
  1220. const m___UINT_FAST8_MAX__ = 0xff
  1221. const m___UINT_LEAST16_MAX__ = 0xffff
  1222. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1223. const m___UINT_LEAST64_MAX__ = "0xffffffffffffffffU"
  1224. const m___UINT_LEAST8_MAX__ = 0xff
  1225. const m___USE_TIME_BITS64 = 1
  1226. const m___VERSION__ = "12.2.0"
  1227. const m___WCHAR_MAX__ = 0x7fffffff
  1228. const m___WCHAR_WIDTH__ = 32
  1229. const m___WINT_MAX__ = 0xffffffff
  1230. const m___WINT_MIN__ = 0
  1231. const m___WINT_WIDTH__ = 32
  1232. const m___code_model_32__ = 1
  1233. const m___gnu_linux__ = 1
  1234. const m___i386 = 1
  1235. const m___i386__ = 1
  1236. const m___i686 = 1
  1237. const m___i686__ = 1
  1238. const m___inline = "inline"
  1239. const m___linux = 1
  1240. const m___linux__ = 1
  1241. const m___pentiumpro = 1
  1242. const m___pentiumpro__ = 1
  1243. const m___pic__ = 2
  1244. const m___pie__ = 2
  1245. const m___restrict = "restrict"
  1246. const m___restrict_arr = "restrict"
  1247. const m___unix = 1
  1248. const m___unix__ = 1
  1249. const m_alloca = "__builtin_alloca"
  1250. const m_i386 = 1
  1251. const m_inline = "__inline"
  1252. const m_linux = 1
  1253. const m_loff_t = "off_t"
  1254. const m_math_errhandling = 2
  1255. const m_static_assert = "_Static_assert"
  1256. const m_unix = 1
  1257. type t__builtin_va_list = uintptr
  1258. type t__predefined_size_t = uint32
  1259. type t__predefined_wchar_t = int32
  1260. type t__predefined_ptrdiff_t = int32
  1261. type Twchar_t = int32
  1262. type Tmax_align_t = struct {
  1263. F__ll int64
  1264. F__ld float64
  1265. }
  1266. type Tsize_t = uint32
  1267. type Tptrdiff_t = int32
  1268. type Tlocale_t = uintptr
  1269. type Tssize_t = int32
  1270. type Toff_t = int64
  1271. type Tva_list = uintptr
  1272. type t__isoc_va_list = uintptr
  1273. type Tfpos_t = struct {
  1274. F__lldata [0]int64
  1275. F__align [0]float64
  1276. F__opaque [16]int8
  1277. }
  1278. type T_G_fpos64_t = Tfpos_t
  1279. type Tcookie_io_functions_t = struct {
  1280. Fread uintptr
  1281. Fwrite uintptr
  1282. Fseek uintptr
  1283. Fclose1 uintptr
  1284. }
  1285. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1286. type Tdiv_t = struct {
  1287. Fquot int32
  1288. Frem int32
  1289. }
  1290. type Tldiv_t = struct {
  1291. Fquot int32
  1292. Frem int32
  1293. }
  1294. type Tlldiv_t = struct {
  1295. Fquot int64
  1296. Frem int64
  1297. }
  1298. type Tuintptr_t = uint32
  1299. type Tintptr_t = int32
  1300. type Tint8_t = int8
  1301. type Tint16_t = int16
  1302. type Tint32_t = int32
  1303. type Tint64_t = int64
  1304. type Tintmax_t = int64
  1305. type Tuint8_t = uint8
  1306. type Tuint16_t = uint16
  1307. type Tuint32_t = uint32
  1308. type Tuint64_t = uint64
  1309. type Tuintmax_t = uint64
  1310. type Tint_fast8_t = int8
  1311. type Tint_fast64_t = int64
  1312. type Tint_least8_t = int8
  1313. type Tint_least16_t = int16
  1314. type Tint_least32_t = int32
  1315. type Tint_least64_t = int64
  1316. type Tuint_fast8_t = uint8
  1317. type Tuint_fast64_t = uint64
  1318. type Tuint_least8_t = uint8
  1319. type Tuint_least16_t = uint16
  1320. type Tuint_least32_t = uint32
  1321. type Tuint_least64_t = uint64
  1322. type Tint_fast16_t = int32
  1323. type Tint_fast32_t = int32
  1324. type Tuint_fast16_t = uint32
  1325. type Tuint_fast32_t = uint32
  1326. type Tfloat_t = float64
  1327. type Tdouble_t = float64
  1328. type Ttime_t = int64
  1329. type Tsuseconds_t = int64
  1330. type Ttimeval = struct {
  1331. Ftv_sec Ttime_t
  1332. Ftv_usec Tsuseconds_t
  1333. }
  1334. type Ttimespec = struct {
  1335. Ftv_sec Ttime_t
  1336. Ftv_nsec int32
  1337. F__ccgo12 uint32
  1338. }
  1339. type Tsigset_t = struct {
  1340. F__bits [32]uint32
  1341. }
  1342. type t__sigset_t = Tsigset_t
  1343. type Tfd_mask = uint32
  1344. type Tfd_set = struct {
  1345. Ffds_bits [32]uint32
  1346. }
  1347. type Titimerval = struct {
  1348. Fit_interval Ttimeval
  1349. Fit_value Ttimeval
  1350. }
  1351. type Ttimezone = struct {
  1352. Ftz_minuteswest int32
  1353. Ftz_dsttime int32
  1354. }
  1355. type Tregister_t = int32
  1356. type Tu_int64_t = uint64
  1357. type Tmode_t = uint32
  1358. type Tnlink_t = uint32
  1359. type Tino_t = uint64
  1360. type Tdev_t = uint64
  1361. type Tblksize_t = int32
  1362. type Tblkcnt_t = int64
  1363. type Tfsblkcnt_t = uint64
  1364. type Tfsfilcnt_t = uint64
  1365. type Ttimer_t = uintptr
  1366. type Tclockid_t = int32
  1367. type Tclock_t = int32
  1368. type Tpid_t = int32
  1369. type Tid_t = uint32
  1370. type Tuid_t = uint32
  1371. type Tgid_t = uint32
  1372. type Tkey_t = int32
  1373. type Tuseconds_t = uint32
  1374. type Tpthread_t = uintptr
  1375. type Tpthread_once_t = int32
  1376. type Tpthread_key_t = uint32
  1377. type Tpthread_spinlock_t = int32
  1378. type Tpthread_mutexattr_t = struct {
  1379. F__attr uint32
  1380. }
  1381. type Tpthread_condattr_t = struct {
  1382. F__attr uint32
  1383. }
  1384. type Tpthread_barrierattr_t = struct {
  1385. F__attr uint32
  1386. }
  1387. type Tpthread_rwlockattr_t = struct {
  1388. F__attr [2]uint32
  1389. }
  1390. type Tpthread_attr_t = struct {
  1391. F__u struct {
  1392. F__vi [0][9]int32
  1393. F__s [0][9]uint32
  1394. F__i [9]int32
  1395. }
  1396. }
  1397. type Tpthread_mutex_t = struct {
  1398. F__u struct {
  1399. F__vi [0][6]int32
  1400. F__p [0][6]uintptr
  1401. F__i [6]int32
  1402. }
  1403. F__ccgo_room int32
  1404. }
  1405. type Tpthread_cond_t = struct {
  1406. F__u struct {
  1407. F__vi [0][12]int32
  1408. F__p [0][12]uintptr
  1409. F__i [12]int32
  1410. }
  1411. }
  1412. type Tpthread_rwlock_t = struct {
  1413. F__u struct {
  1414. F__vi [0][8]int32
  1415. F__p [0][8]uintptr
  1416. F__i [8]int32
  1417. }
  1418. }
  1419. type Tpthread_barrier_t = struct {
  1420. F__u struct {
  1421. F__vi [0][5]int32
  1422. F__p [0][5]uintptr
  1423. F__i [5]int32
  1424. }
  1425. }
  1426. type Tu_int8_t = uint8
  1427. type Tu_int16_t = uint16
  1428. type Tu_int32_t = uint32
  1429. type Tcaddr_t = uintptr
  1430. type Tu_char = uint8
  1431. type Tu_short = uint16
  1432. type Tushort = uint16
  1433. type Tu_int = uint32
  1434. type Tuint = uint32
  1435. type Tu_long = uint32
  1436. type Tulong = uint32
  1437. type Tquad_t = int64
  1438. type Tu_quad_t = uint64
  1439. type Tiovec = struct {
  1440. Fiov_base uintptr
  1441. Fiov_len Tsize_t
  1442. }
  1443. type Tflock = struct {
  1444. Fl_type int16
  1445. Fl_whence int16
  1446. Fl_start Toff_t
  1447. Fl_len Toff_t
  1448. Fl_pid Tpid_t
  1449. }
  1450. type Tfile_handle = struct {
  1451. Fhandle_bytes uint32
  1452. Fhandle_type int32
  1453. }
  1454. type Tf_owner_ex = struct {
  1455. Ftype1 int32
  1456. Fpid Tpid_t
  1457. }
  1458. type TXML_Char = int8
  1459. type TXML_LChar = int8
  1460. type TXML_Index = int32
  1461. type TXML_Size = uint32
  1462. type TXML_ParserStruct = struct {
  1463. Fm_userData uintptr
  1464. Fm_handlerArg uintptr
  1465. Fm_buffer uintptr
  1466. Fm_mem TXML_Memory_Handling_Suite
  1467. Fm_bufferPtr uintptr
  1468. Fm_bufferEnd uintptr
  1469. Fm_bufferLim uintptr
  1470. Fm_parseEndByteIndex TXML_Index
  1471. Fm_parseEndPtr uintptr
  1472. Fm_dataBuf uintptr
  1473. Fm_dataBufEnd uintptr
  1474. Fm_startElementHandler TXML_StartElementHandler
  1475. Fm_endElementHandler TXML_EndElementHandler
  1476. Fm_characterDataHandler TXML_CharacterDataHandler
  1477. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1478. Fm_commentHandler TXML_CommentHandler
  1479. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1480. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1481. Fm_defaultHandler TXML_DefaultHandler
  1482. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1483. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1484. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1485. Fm_notationDeclHandler TXML_NotationDeclHandler
  1486. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1487. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1488. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1489. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1490. Fm_externalEntityRefHandlerArg TXML_Parser
  1491. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1492. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1493. Fm_elementDeclHandler TXML_ElementDeclHandler
  1494. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1495. Fm_entityDeclHandler TXML_EntityDeclHandler
  1496. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1497. Fm_encoding uintptr
  1498. Fm_initEncoding TINIT_ENCODING
  1499. Fm_internalEncoding uintptr
  1500. Fm_protocolEncodingName uintptr
  1501. Fm_ns TXML_Bool
  1502. Fm_ns_triplets TXML_Bool
  1503. Fm_unknownEncodingMem uintptr
  1504. Fm_unknownEncodingData uintptr
  1505. Fm_unknownEncodingHandlerData uintptr
  1506. Fm_unknownEncodingRelease uintptr
  1507. Fm_prologState TPROLOG_STATE
  1508. Fm_processor uintptr
  1509. Fm_errorCode _XML_Error
  1510. Fm_eventPtr uintptr
  1511. Fm_eventEndPtr uintptr
  1512. Fm_positionPtr uintptr
  1513. Fm_openInternalEntities uintptr
  1514. Fm_freeInternalEntities uintptr
  1515. Fm_defaultExpandInternalEntities TXML_Bool
  1516. Fm_tagLevel int32
  1517. Fm_declEntity uintptr
  1518. Fm_doctypeName uintptr
  1519. Fm_doctypeSysid uintptr
  1520. Fm_doctypePubid uintptr
  1521. Fm_declAttributeType uintptr
  1522. Fm_declNotationName uintptr
  1523. Fm_declNotationPublicId uintptr
  1524. Fm_declElementType uintptr
  1525. Fm_declAttributeId uintptr
  1526. Fm_declAttributeIsCdata TXML_Bool
  1527. Fm_declAttributeIsId TXML_Bool
  1528. Fm_dtd uintptr
  1529. Fm_curBase uintptr
  1530. Fm_tagStack uintptr
  1531. Fm_freeTagList uintptr
  1532. Fm_inheritedBindings uintptr
  1533. Fm_freeBindingList uintptr
  1534. Fm_attsSize int32
  1535. Fm_nSpecifiedAtts int32
  1536. Fm_idAttIndex int32
  1537. Fm_atts uintptr
  1538. Fm_nsAtts uintptr
  1539. Fm_nsAttsVersion uint32
  1540. Fm_nsAttsPower uint8
  1541. Fm_position TPOSITION
  1542. Fm_tempPool TSTRING_POOL
  1543. Fm_temp2Pool TSTRING_POOL
  1544. Fm_groupConnector uintptr
  1545. Fm_groupSize uint32
  1546. Fm_namespaceSeparator TXML_Char
  1547. Fm_parentParser TXML_Parser
  1548. Fm_parsingStatus TXML_ParsingStatus
  1549. Fm_isParamEntity TXML_Bool
  1550. Fm_useForeignDTD TXML_Bool
  1551. Fm_paramEntityParsing _XML_ParamEntityParsing
  1552. Fm_hash_secret_salt uint32
  1553. Fm_accounting TACCOUNTING
  1554. Fm_entity_stats TENTITY_STATS
  1555. }
  1556. type _XML_Error = int32
  1557. const _XML_ERROR_NONE = 0
  1558. const _XML_ERROR_NO_MEMORY = 1
  1559. const _XML_ERROR_SYNTAX = 2
  1560. const _XML_ERROR_NO_ELEMENTS = 3
  1561. const _XML_ERROR_INVALID_TOKEN = 4
  1562. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1563. const _XML_ERROR_PARTIAL_CHAR = 6
  1564. const _XML_ERROR_TAG_MISMATCH = 7
  1565. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1566. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1567. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1568. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1569. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1570. const _XML_ERROR_ASYNC_ENTITY = 13
  1571. const _XML_ERROR_BAD_CHAR_REF = 14
  1572. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1573. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1574. const _XML_ERROR_MISPLACED_XML_PI = 17
  1575. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1576. const _XML_ERROR_INCORRECT_ENCODING = 19
  1577. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1578. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1579. const _XML_ERROR_NOT_STANDALONE = 22
  1580. const _XML_ERROR_UNEXPECTED_STATE = 23
  1581. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1582. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1583. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1584. const _XML_ERROR_UNBOUND_PREFIX = 27
  1585. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1586. const _XML_ERROR_INCOMPLETE_PE = 29
  1587. const _XML_ERROR_XML_DECL = 30
  1588. const _XML_ERROR_TEXT_DECL = 31
  1589. const _XML_ERROR_PUBLICID = 32
  1590. const _XML_ERROR_SUSPENDED = 33
  1591. const _XML_ERROR_NOT_SUSPENDED = 34
  1592. const _XML_ERROR_ABORTED = 35
  1593. const _XML_ERROR_FINISHED = 36
  1594. const _XML_ERROR_SUSPEND_PE = 37
  1595. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1596. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1597. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1598. const _XML_ERROR_INVALID_ARGUMENT = 41
  1599. const _XML_ERROR_NO_BUFFER = 42
  1600. const _XML_ERROR_AMPLIFICATION_LIMIT_BREACH = 43
  1601. type _XML_ParamEntityParsing = int32
  1602. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1603. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1604. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1605. type TXML_Parser = uintptr
  1606. type TXML_Bool = uint8
  1607. type _XML_Status = int32
  1608. const _XML_STATUS_ERROR = 0
  1609. const _XML_STATUS_OK = 1
  1610. const _XML_STATUS_SUSPENDED = 2
  1611. type _XML_Content_Type = int32
  1612. const _XML_CTYPE_EMPTY = 1
  1613. const _XML_CTYPE_ANY = 2
  1614. const _XML_CTYPE_MIXED = 3
  1615. const _XML_CTYPE_NAME = 4
  1616. const _XML_CTYPE_CHOICE = 5
  1617. const _XML_CTYPE_SEQ = 6
  1618. type _XML_Content_Quant = int32
  1619. const _XML_CQUANT_NONE = 0
  1620. const _XML_CQUANT_OPT = 1
  1621. const _XML_CQUANT_REP = 2
  1622. const _XML_CQUANT_PLUS = 3
  1623. type TXML_Content = struct {
  1624. Ftype1 _XML_Content_Type
  1625. Fquant _XML_Content_Quant
  1626. Fname uintptr
  1627. Fnumchildren uint32
  1628. Fchildren uintptr
  1629. }
  1630. type TXML_cp = TXML_Content
  1631. type TXML_ElementDeclHandler = uintptr
  1632. type TXML_AttlistDeclHandler = uintptr
  1633. type TXML_XmlDeclHandler = uintptr
  1634. type TXML_Memory_Handling_Suite = struct {
  1635. Fmalloc_fcn uintptr
  1636. Frealloc_fcn uintptr
  1637. Ffree_fcn uintptr
  1638. }
  1639. type TXML_StartElementHandler = uintptr
  1640. type TXML_EndElementHandler = uintptr
  1641. type TXML_CharacterDataHandler = uintptr
  1642. type TXML_ProcessingInstructionHandler = uintptr
  1643. type TXML_CommentHandler = uintptr
  1644. type TXML_StartCdataSectionHandler = uintptr
  1645. type TXML_EndCdataSectionHandler = uintptr
  1646. type TXML_DefaultHandler = uintptr
  1647. type TXML_StartDoctypeDeclHandler = uintptr
  1648. type TXML_EndDoctypeDeclHandler = uintptr
  1649. type TXML_EntityDeclHandler = uintptr
  1650. type TXML_UnparsedEntityDeclHandler = uintptr
  1651. type TXML_NotationDeclHandler = uintptr
  1652. type TXML_StartNamespaceDeclHandler = uintptr
  1653. type TXML_EndNamespaceDeclHandler = uintptr
  1654. type TXML_NotStandaloneHandler = uintptr
  1655. type TXML_ExternalEntityRefHandler = uintptr
  1656. type TXML_SkippedEntityHandler = uintptr
  1657. type TXML_Encoding = struct {
  1658. Fmap1 [256]int32
  1659. Fdata uintptr
  1660. Fconvert uintptr
  1661. Frelease uintptr
  1662. }
  1663. type TXML_UnknownEncodingHandler = uintptr
  1664. type _XML_Parsing = int32
  1665. const _XML_INITIALIZED = 0
  1666. const _XML_PARSING = 1
  1667. const _XML_FINISHED = 2
  1668. const _XML_SUSPENDED = 3
  1669. type TXML_ParsingStatus = struct {
  1670. Fparsing _XML_Parsing
  1671. FfinalBuffer TXML_Bool
  1672. }
  1673. type TXML_Expat_Version = struct {
  1674. Fmajor int32
  1675. Fminor int32
  1676. Fmicro int32
  1677. }
  1678. type _XML_FeatureEnum = int32
  1679. const _XML_FEATURE_END = 0
  1680. const _XML_FEATURE_UNICODE = 1
  1681. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1682. const _XML_FEATURE_DTD = 3
  1683. const _XML_FEATURE_CONTEXT_BYTES = 4
  1684. const _XML_FEATURE_MIN_SIZE = 5
  1685. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1686. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1687. const _XML_FEATURE_NS = 8
  1688. const _XML_FEATURE_LARGE_SIZE = 9
  1689. const _XML_FEATURE_ATTR_INFO = 10
  1690. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT = 11
  1691. const _XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT = 12
  1692. type TXML_Feature = struct {
  1693. Ffeature _XML_FeatureEnum
  1694. Fname uintptr
  1695. Fvalue int32
  1696. }
  1697. type Tsiphash = struct {
  1698. Fv0 Tuint64_t
  1699. Fv1 Tuint64_t
  1700. Fv2 Tuint64_t
  1701. Fv3 Tuint64_t
  1702. Fbuf [8]uint8
  1703. Fp uintptr
  1704. Fc Tuint64_t
  1705. }
  1706. type Tsipkey = struct {
  1707. Fk [2]Tuint64_t
  1708. }
  1709. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1710. *(*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)
  1711. *(*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)
  1712. return key
  1713. }
  1714. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1715. var i int32
  1716. _ = i
  1717. i = 0
  1718. for {
  1719. if !(i < rounds) {
  1720. break
  1721. }
  1722. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1723. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1724. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1725. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1726. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1727. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1728. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1729. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1730. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1731. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1732. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1733. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1734. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1735. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1736. goto _1
  1737. _1:
  1738. ;
  1739. i++
  1740. }
  1741. }
  1742. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1743. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x70736575)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1744. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e646f6d)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1745. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x6e657261)) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1746. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | uint64(libc.Uint32FromUint32(0x79746573)) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1747. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1748. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1749. return H
  1750. }
  1751. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1752. var m Tuint64_t
  1753. var p, pe, v1, v2, v3 uintptr
  1754. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1755. p = src
  1756. pe = p + uintptr(len1)
  1757. for cond := true; cond; cond = p < pe {
  1758. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint32FromInt64(8)/libc.Uint32FromInt64(1)) {
  1759. v2 = H + 40
  1760. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1761. *(*uintptr)(unsafe.Pointer(v2))++
  1762. v3 = p
  1763. p++
  1764. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1765. }
  1766. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint32FromInt64(8)/libc.Uint32FromInt64(1)) {
  1767. break
  1768. }
  1769. 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)
  1770. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1771. _sip_round(tls, H, int32(2))
  1772. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1773. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1774. *(*Tuint64_t)(unsafe.Pointer(H + 44)) += uint64(8)
  1775. }
  1776. return H
  1777. }
  1778. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1779. var b Tuint64_t
  1780. var left int8
  1781. _, _ = b, left
  1782. left = int8(int32((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1783. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + libc.Uint64FromInt8(left)) << int32(56)
  1784. switch int32(left) {
  1785. case int32(7):
  1786. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1787. fallthrough
  1788. case int32(6):
  1789. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1790. fallthrough
  1791. case int32(5):
  1792. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1793. fallthrough
  1794. case int32(4):
  1795. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1796. fallthrough
  1797. case int32(3):
  1798. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1799. fallthrough
  1800. case int32(2):
  1801. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1802. fallthrough
  1803. case int32(1):
  1804. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1805. fallthrough
  1806. case 0:
  1807. break
  1808. }
  1809. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1810. _sip_round(tls, H, int32(2))
  1811. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1812. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1813. _sip_round(tls, H, int32(4))
  1814. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1815. }
  1816. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1817. bp := tls.Alloc(64)
  1818. defer tls.Free(64)
  1819. var _ /* state at bp+0 */ Tsiphash
  1820. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1821. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1822. }
  1823. func _sip24_valid(tls *libc.TLS) (r int32) {
  1824. bp := tls.Alloc(80)
  1825. defer tls.Free(80)
  1826. var i Tsize_t
  1827. var _ /* in at bp+0 */ [64]uint8
  1828. var _ /* k at bp+64 */ Tsipkey
  1829. _ = i
  1830. _sip_tokey(tls, bp+64, __ccgo_ts)
  1831. i = uint32(0)
  1832. for {
  1833. if !(i < uint32(64)) {
  1834. break
  1835. }
  1836. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1837. 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) {
  1838. return 0
  1839. }
  1840. goto _1
  1841. _1:
  1842. ;
  1843. i++
  1844. }
  1845. return int32(1)
  1846. }
  1847. var _vectors = [64][8]uint8{
  1848. 0: {
  1849. 0: uint8(0x31),
  1850. 1: uint8(0x0e),
  1851. 2: uint8(0x0e),
  1852. 3: uint8(0xdd),
  1853. 4: uint8(0x47),
  1854. 5: uint8(0xdb),
  1855. 6: uint8(0x6f),
  1856. 7: uint8(0x72),
  1857. },
  1858. 1: {
  1859. 0: uint8(0xfd),
  1860. 1: uint8(0x67),
  1861. 2: uint8(0xdc),
  1862. 3: uint8(0x93),
  1863. 4: uint8(0xc5),
  1864. 5: uint8(0x39),
  1865. 6: uint8(0xf8),
  1866. 7: uint8(0x74),
  1867. },
  1868. 2: {
  1869. 0: uint8(0x5a),
  1870. 1: uint8(0x4f),
  1871. 2: uint8(0xa9),
  1872. 3: uint8(0xd9),
  1873. 4: uint8(0x09),
  1874. 5: uint8(0x80),
  1875. 6: uint8(0x6c),
  1876. 7: uint8(0x0d),
  1877. },
  1878. 3: {
  1879. 0: uint8(0x2d),
  1880. 1: uint8(0x7e),
  1881. 2: uint8(0xfb),
  1882. 3: uint8(0xd7),
  1883. 4: uint8(0x96),
  1884. 5: uint8(0x66),
  1885. 6: uint8(0x67),
  1886. 7: uint8(0x85),
  1887. },
  1888. 4: {
  1889. 0: uint8(0xb7),
  1890. 1: uint8(0x87),
  1891. 2: uint8(0x71),
  1892. 3: uint8(0x27),
  1893. 4: uint8(0xe0),
  1894. 5: uint8(0x94),
  1895. 6: uint8(0x27),
  1896. 7: uint8(0xcf),
  1897. },
  1898. 5: {
  1899. 0: uint8(0x8d),
  1900. 1: uint8(0xa6),
  1901. 2: uint8(0x99),
  1902. 3: uint8(0xcd),
  1903. 4: uint8(0x64),
  1904. 5: uint8(0x55),
  1905. 6: uint8(0x76),
  1906. 7: uint8(0x18),
  1907. },
  1908. 6: {
  1909. 0: uint8(0xce),
  1910. 1: uint8(0xe3),
  1911. 2: uint8(0xfe),
  1912. 3: uint8(0x58),
  1913. 4: uint8(0x6e),
  1914. 5: uint8(0x46),
  1915. 6: uint8(0xc9),
  1916. 7: uint8(0xcb),
  1917. },
  1918. 7: {
  1919. 0: uint8(0x37),
  1920. 1: uint8(0xd1),
  1921. 2: uint8(0x01),
  1922. 3: uint8(0x8b),
  1923. 4: uint8(0xf5),
  1924. 6: uint8(0x02),
  1925. 7: uint8(0xab),
  1926. },
  1927. 8: {
  1928. 0: uint8(0x62),
  1929. 1: uint8(0x24),
  1930. 2: uint8(0x93),
  1931. 3: uint8(0x9a),
  1932. 4: uint8(0x79),
  1933. 5: uint8(0xf5),
  1934. 6: uint8(0xf5),
  1935. 7: uint8(0x93),
  1936. },
  1937. 9: {
  1938. 0: uint8(0xb0),
  1939. 1: uint8(0xe4),
  1940. 2: uint8(0xa9),
  1941. 3: uint8(0x0b),
  1942. 4: uint8(0xdf),
  1943. 5: uint8(0x82),
  1944. 7: uint8(0x9e),
  1945. },
  1946. 10: {
  1947. 0: uint8(0xf3),
  1948. 1: uint8(0xb9),
  1949. 2: uint8(0xdd),
  1950. 3: uint8(0x94),
  1951. 4: uint8(0xc5),
  1952. 5: uint8(0xbb),
  1953. 6: uint8(0x5d),
  1954. 7: uint8(0x7a),
  1955. },
  1956. 11: {
  1957. 0: uint8(0xa7),
  1958. 1: uint8(0xad),
  1959. 2: uint8(0x6b),
  1960. 3: uint8(0x22),
  1961. 4: uint8(0x46),
  1962. 5: uint8(0x2f),
  1963. 6: uint8(0xb3),
  1964. 7: uint8(0xf4),
  1965. },
  1966. 12: {
  1967. 0: uint8(0xfb),
  1968. 1: uint8(0xe5),
  1969. 2: uint8(0x0e),
  1970. 3: uint8(0x86),
  1971. 4: uint8(0xbc),
  1972. 5: uint8(0x8f),
  1973. 6: uint8(0x1e),
  1974. 7: uint8(0x75),
  1975. },
  1976. 13: {
  1977. 0: uint8(0x90),
  1978. 1: uint8(0x3d),
  1979. 2: uint8(0x84),
  1980. 3: uint8(0xc0),
  1981. 4: uint8(0x27),
  1982. 5: uint8(0x56),
  1983. 6: uint8(0xea),
  1984. 7: uint8(0x14),
  1985. },
  1986. 14: {
  1987. 0: uint8(0xee),
  1988. 1: uint8(0xf2),
  1989. 2: uint8(0x7a),
  1990. 3: uint8(0x8e),
  1991. 4: uint8(0x90),
  1992. 5: uint8(0xca),
  1993. 6: uint8(0x23),
  1994. 7: uint8(0xf7),
  1995. },
  1996. 15: {
  1997. 0: uint8(0xe5),
  1998. 1: uint8(0x45),
  1999. 2: uint8(0xbe),
  2000. 3: uint8(0x49),
  2001. 4: uint8(0x61),
  2002. 5: uint8(0xca),
  2003. 6: uint8(0x29),
  2004. 7: uint8(0xa1),
  2005. },
  2006. 16: {
  2007. 0: uint8(0xdb),
  2008. 1: uint8(0x9b),
  2009. 2: uint8(0xc2),
  2010. 3: uint8(0x57),
  2011. 4: uint8(0x7f),
  2012. 5: uint8(0xcc),
  2013. 6: uint8(0x2a),
  2014. 7: uint8(0x3f),
  2015. },
  2016. 17: {
  2017. 0: uint8(0x94),
  2018. 1: uint8(0x47),
  2019. 2: uint8(0xbe),
  2020. 3: uint8(0x2c),
  2021. 4: uint8(0xf5),
  2022. 5: uint8(0xe9),
  2023. 6: uint8(0x9a),
  2024. 7: uint8(0x69),
  2025. },
  2026. 18: {
  2027. 0: uint8(0x9c),
  2028. 1: uint8(0xd3),
  2029. 2: uint8(0x8d),
  2030. 3: uint8(0x96),
  2031. 4: uint8(0xf0),
  2032. 5: uint8(0xb3),
  2033. 6: uint8(0xc1),
  2034. 7: uint8(0x4b),
  2035. },
  2036. 19: {
  2037. 0: uint8(0xbd),
  2038. 1: uint8(0x61),
  2039. 2: uint8(0x79),
  2040. 3: uint8(0xa7),
  2041. 4: uint8(0x1d),
  2042. 5: uint8(0xc9),
  2043. 6: uint8(0x6d),
  2044. 7: uint8(0xbb),
  2045. },
  2046. 20: {
  2047. 0: uint8(0x98),
  2048. 1: uint8(0xee),
  2049. 2: uint8(0xa2),
  2050. 3: uint8(0x1a),
  2051. 4: uint8(0xf2),
  2052. 5: uint8(0x5c),
  2053. 6: uint8(0xd6),
  2054. 7: uint8(0xbe),
  2055. },
  2056. 21: {
  2057. 0: uint8(0xc7),
  2058. 1: uint8(0x67),
  2059. 2: uint8(0x3b),
  2060. 3: uint8(0x2e),
  2061. 4: uint8(0xb0),
  2062. 5: uint8(0xcb),
  2063. 6: uint8(0xf2),
  2064. 7: uint8(0xd0),
  2065. },
  2066. 22: {
  2067. 0: uint8(0x88),
  2068. 1: uint8(0x3e),
  2069. 2: uint8(0xa3),
  2070. 3: uint8(0xe3),
  2071. 4: uint8(0x95),
  2072. 5: uint8(0x67),
  2073. 6: uint8(0x53),
  2074. 7: uint8(0x93),
  2075. },
  2076. 23: {
  2077. 0: uint8(0xc8),
  2078. 1: uint8(0xce),
  2079. 2: uint8(0x5c),
  2080. 3: uint8(0xcd),
  2081. 4: uint8(0x8c),
  2082. 5: uint8(0x03),
  2083. 6: uint8(0x0c),
  2084. 7: uint8(0xa8),
  2085. },
  2086. 24: {
  2087. 0: uint8(0x94),
  2088. 1: uint8(0xaf),
  2089. 2: uint8(0x49),
  2090. 3: uint8(0xf6),
  2091. 4: uint8(0xc6),
  2092. 5: uint8(0x50),
  2093. 6: uint8(0xad),
  2094. 7: uint8(0xb8),
  2095. },
  2096. 25: {
  2097. 0: uint8(0xea),
  2098. 1: uint8(0xb8),
  2099. 2: uint8(0x85),
  2100. 3: uint8(0x8a),
  2101. 4: uint8(0xde),
  2102. 5: uint8(0x92),
  2103. 6: uint8(0xe1),
  2104. 7: uint8(0xbc),
  2105. },
  2106. 26: {
  2107. 0: uint8(0xf3),
  2108. 1: uint8(0x15),
  2109. 2: uint8(0xbb),
  2110. 3: uint8(0x5b),
  2111. 4: uint8(0xb8),
  2112. 5: uint8(0x35),
  2113. 6: uint8(0xd8),
  2114. 7: uint8(0x17),
  2115. },
  2116. 27: {
  2117. 0: uint8(0xad),
  2118. 1: uint8(0xcf),
  2119. 2: uint8(0x6b),
  2120. 3: uint8(0x07),
  2121. 4: uint8(0x63),
  2122. 5: uint8(0x61),
  2123. 6: uint8(0x2e),
  2124. 7: uint8(0x2f),
  2125. },
  2126. 28: {
  2127. 0: uint8(0xa5),
  2128. 1: uint8(0xc9),
  2129. 2: uint8(0x1d),
  2130. 3: uint8(0xa7),
  2131. 4: uint8(0xac),
  2132. 5: uint8(0xaa),
  2133. 6: uint8(0x4d),
  2134. 7: uint8(0xde),
  2135. },
  2136. 29: {
  2137. 0: uint8(0x71),
  2138. 1: uint8(0x65),
  2139. 2: uint8(0x95),
  2140. 3: uint8(0x87),
  2141. 4: uint8(0x66),
  2142. 5: uint8(0x50),
  2143. 6: uint8(0xa2),
  2144. 7: uint8(0xa6),
  2145. },
  2146. 30: {
  2147. 0: uint8(0x28),
  2148. 1: uint8(0xef),
  2149. 2: uint8(0x49),
  2150. 3: uint8(0x5c),
  2151. 4: uint8(0x53),
  2152. 5: uint8(0xa3),
  2153. 6: uint8(0x87),
  2154. 7: uint8(0xad),
  2155. },
  2156. 31: {
  2157. 0: uint8(0x42),
  2158. 1: uint8(0xc3),
  2159. 2: uint8(0x41),
  2160. 3: uint8(0xd8),
  2161. 4: uint8(0xfa),
  2162. 5: uint8(0x92),
  2163. 6: uint8(0xd8),
  2164. 7: uint8(0x32),
  2165. },
  2166. 32: {
  2167. 0: uint8(0xce),
  2168. 1: uint8(0x7c),
  2169. 2: uint8(0xf2),
  2170. 3: uint8(0x72),
  2171. 4: uint8(0x2f),
  2172. 5: uint8(0x51),
  2173. 6: uint8(0x27),
  2174. 7: uint8(0x71),
  2175. },
  2176. 33: {
  2177. 0: uint8(0xe3),
  2178. 1: uint8(0x78),
  2179. 2: uint8(0x59),
  2180. 3: uint8(0xf9),
  2181. 4: uint8(0x46),
  2182. 5: uint8(0x23),
  2183. 6: uint8(0xf3),
  2184. 7: uint8(0xa7),
  2185. },
  2186. 34: {
  2187. 0: uint8(0x38),
  2188. 1: uint8(0x12),
  2189. 2: uint8(0x05),
  2190. 3: uint8(0xbb),
  2191. 4: uint8(0x1a),
  2192. 5: uint8(0xb0),
  2193. 6: uint8(0xe0),
  2194. 7: uint8(0x12),
  2195. },
  2196. 35: {
  2197. 0: uint8(0xae),
  2198. 1: uint8(0x97),
  2199. 2: uint8(0xa1),
  2200. 3: uint8(0x0f),
  2201. 4: uint8(0xd4),
  2202. 5: uint8(0x34),
  2203. 6: uint8(0xe0),
  2204. 7: uint8(0x15),
  2205. },
  2206. 36: {
  2207. 0: uint8(0xb4),
  2208. 1: uint8(0xa3),
  2209. 2: uint8(0x15),
  2210. 3: uint8(0x08),
  2211. 4: uint8(0xbe),
  2212. 5: uint8(0xff),
  2213. 6: uint8(0x4d),
  2214. 7: uint8(0x31),
  2215. },
  2216. 37: {
  2217. 0: uint8(0x81),
  2218. 1: uint8(0x39),
  2219. 2: uint8(0x62),
  2220. 3: uint8(0x29),
  2221. 4: uint8(0xf0),
  2222. 5: uint8(0x90),
  2223. 6: uint8(0x79),
  2224. 7: uint8(0x02),
  2225. },
  2226. 38: {
  2227. 0: uint8(0x4d),
  2228. 1: uint8(0x0c),
  2229. 2: uint8(0xf4),
  2230. 3: uint8(0x9e),
  2231. 4: uint8(0xe5),
  2232. 5: uint8(0xd4),
  2233. 6: uint8(0xdc),
  2234. 7: uint8(0xca),
  2235. },
  2236. 39: {
  2237. 0: uint8(0x5c),
  2238. 1: uint8(0x73),
  2239. 2: uint8(0x33),
  2240. 3: uint8(0x6a),
  2241. 4: uint8(0x76),
  2242. 5: uint8(0xd8),
  2243. 6: uint8(0xbf),
  2244. 7: uint8(0x9a),
  2245. },
  2246. 40: {
  2247. 0: uint8(0xd0),
  2248. 1: uint8(0xa7),
  2249. 2: uint8(0x04),
  2250. 3: uint8(0x53),
  2251. 4: uint8(0x6b),
  2252. 5: uint8(0xa9),
  2253. 6: uint8(0x3e),
  2254. 7: uint8(0x0e),
  2255. },
  2256. 41: {
  2257. 0: uint8(0x92),
  2258. 1: uint8(0x59),
  2259. 2: uint8(0x58),
  2260. 3: uint8(0xfc),
  2261. 4: uint8(0xd6),
  2262. 5: uint8(0x42),
  2263. 6: uint8(0x0c),
  2264. 7: uint8(0xad),
  2265. },
  2266. 42: {
  2267. 0: uint8(0xa9),
  2268. 1: uint8(0x15),
  2269. 2: uint8(0xc2),
  2270. 3: uint8(0x9b),
  2271. 4: uint8(0xc8),
  2272. 5: uint8(0x06),
  2273. 6: uint8(0x73),
  2274. 7: uint8(0x18),
  2275. },
  2276. 43: {
  2277. 0: uint8(0x95),
  2278. 1: uint8(0x2b),
  2279. 2: uint8(0x79),
  2280. 3: uint8(0xf3),
  2281. 4: uint8(0xbc),
  2282. 5: uint8(0x0a),
  2283. 6: uint8(0xa6),
  2284. 7: uint8(0xd4),
  2285. },
  2286. 44: {
  2287. 0: uint8(0xf2),
  2288. 1: uint8(0x1d),
  2289. 2: uint8(0xf2),
  2290. 3: uint8(0xe4),
  2291. 4: uint8(0x1d),
  2292. 5: uint8(0x45),
  2293. 6: uint8(0x35),
  2294. 7: uint8(0xf9),
  2295. },
  2296. 45: {
  2297. 0: uint8(0x87),
  2298. 1: uint8(0x57),
  2299. 2: uint8(0x75),
  2300. 3: uint8(0x19),
  2301. 4: uint8(0x04),
  2302. 5: uint8(0x8f),
  2303. 6: uint8(0x53),
  2304. 7: uint8(0xa9),
  2305. },
  2306. 46: {
  2307. 0: uint8(0x10),
  2308. 1: uint8(0xa5),
  2309. 2: uint8(0x6c),
  2310. 3: uint8(0xf5),
  2311. 4: uint8(0xdf),
  2312. 5: uint8(0xcd),
  2313. 6: uint8(0x9a),
  2314. 7: uint8(0xdb),
  2315. },
  2316. 47: {
  2317. 0: uint8(0xeb),
  2318. 1: uint8(0x75),
  2319. 2: uint8(0x09),
  2320. 3: uint8(0x5c),
  2321. 4: uint8(0xcd),
  2322. 5: uint8(0x98),
  2323. 6: uint8(0x6c),
  2324. 7: uint8(0xd0),
  2325. },
  2326. 48: {
  2327. 0: uint8(0x51),
  2328. 1: uint8(0xa9),
  2329. 2: uint8(0xcb),
  2330. 3: uint8(0x9e),
  2331. 4: uint8(0xcb),
  2332. 5: uint8(0xa3),
  2333. 6: uint8(0x12),
  2334. 7: uint8(0xe6),
  2335. },
  2336. 49: {
  2337. 0: uint8(0x96),
  2338. 1: uint8(0xaf),
  2339. 2: uint8(0xad),
  2340. 3: uint8(0xfc),
  2341. 4: uint8(0x2c),
  2342. 5: uint8(0xe6),
  2343. 6: uint8(0x66),
  2344. 7: uint8(0xc7),
  2345. },
  2346. 50: {
  2347. 0: uint8(0x72),
  2348. 1: uint8(0xfe),
  2349. 2: uint8(0x52),
  2350. 3: uint8(0x97),
  2351. 4: uint8(0x5a),
  2352. 5: uint8(0x43),
  2353. 6: uint8(0x64),
  2354. 7: uint8(0xee),
  2355. },
  2356. 51: {
  2357. 0: uint8(0x5a),
  2358. 1: uint8(0x16),
  2359. 2: uint8(0x45),
  2360. 3: uint8(0xb2),
  2361. 4: uint8(0x76),
  2362. 5: uint8(0xd5),
  2363. 6: uint8(0x92),
  2364. 7: uint8(0xa1),
  2365. },
  2366. 52: {
  2367. 0: uint8(0xb2),
  2368. 1: uint8(0x74),
  2369. 2: uint8(0xcb),
  2370. 3: uint8(0x8e),
  2371. 4: uint8(0xbf),
  2372. 5: uint8(0x87),
  2373. 6: uint8(0x87),
  2374. 7: uint8(0x0a),
  2375. },
  2376. 53: {
  2377. 0: uint8(0x6f),
  2378. 1: uint8(0x9b),
  2379. 2: uint8(0xb4),
  2380. 3: uint8(0x20),
  2381. 4: uint8(0x3d),
  2382. 5: uint8(0xe7),
  2383. 6: uint8(0xb3),
  2384. 7: uint8(0x81),
  2385. },
  2386. 54: {
  2387. 0: uint8(0xea),
  2388. 1: uint8(0xec),
  2389. 2: uint8(0xb2),
  2390. 3: uint8(0xa3),
  2391. 4: uint8(0x0b),
  2392. 5: uint8(0x22),
  2393. 6: uint8(0xa8),
  2394. 7: uint8(0x7f),
  2395. },
  2396. 55: {
  2397. 0: uint8(0x99),
  2398. 1: uint8(0x24),
  2399. 2: uint8(0xa4),
  2400. 3: uint8(0x3c),
  2401. 4: uint8(0xc1),
  2402. 5: uint8(0x31),
  2403. 6: uint8(0x57),
  2404. 7: uint8(0x24),
  2405. },
  2406. 56: {
  2407. 0: uint8(0xbd),
  2408. 1: uint8(0x83),
  2409. 2: uint8(0x8d),
  2410. 3: uint8(0x3a),
  2411. 4: uint8(0xaf),
  2412. 5: uint8(0xbf),
  2413. 6: uint8(0x8d),
  2414. 7: uint8(0xb7),
  2415. },
  2416. 57: {
  2417. 0: uint8(0x0b),
  2418. 1: uint8(0x1a),
  2419. 2: uint8(0x2a),
  2420. 3: uint8(0x32),
  2421. 4: uint8(0x65),
  2422. 5: uint8(0xd5),
  2423. 6: uint8(0x1a),
  2424. 7: uint8(0xea),
  2425. },
  2426. 58: {
  2427. 0: uint8(0x13),
  2428. 1: uint8(0x50),
  2429. 2: uint8(0x79),
  2430. 3: uint8(0xa3),
  2431. 4: uint8(0x23),
  2432. 5: uint8(0x1c),
  2433. 6: uint8(0xe6),
  2434. 7: uint8(0x60),
  2435. },
  2436. 59: {
  2437. 0: uint8(0x93),
  2438. 1: uint8(0x2b),
  2439. 2: uint8(0x28),
  2440. 3: uint8(0x46),
  2441. 4: uint8(0xe4),
  2442. 5: uint8(0xd7),
  2443. 6: uint8(0x06),
  2444. 7: uint8(0x66),
  2445. },
  2446. 60: {
  2447. 0: uint8(0xe1),
  2448. 1: uint8(0x91),
  2449. 2: uint8(0x5f),
  2450. 3: uint8(0x5c),
  2451. 4: uint8(0xb1),
  2452. 5: uint8(0xec),
  2453. 6: uint8(0xa4),
  2454. 7: uint8(0x6c),
  2455. },
  2456. 61: {
  2457. 0: uint8(0xf3),
  2458. 1: uint8(0x25),
  2459. 2: uint8(0x96),
  2460. 3: uint8(0x5c),
  2461. 4: uint8(0xa1),
  2462. 5: uint8(0x6d),
  2463. 6: uint8(0x62),
  2464. 7: uint8(0x9f),
  2465. },
  2466. 62: {
  2467. 0: uint8(0x57),
  2468. 1: uint8(0x5f),
  2469. 2: uint8(0xf2),
  2470. 3: uint8(0x8e),
  2471. 4: uint8(0x60),
  2472. 5: uint8(0x38),
  2473. 6: uint8(0x1b),
  2474. 7: uint8(0xe5),
  2475. },
  2476. 63: {
  2477. 0: uint8(0x72),
  2478. 1: uint8(0x45),
  2479. 2: uint8(0x06),
  2480. 3: uint8(0xeb),
  2481. 4: uint8(0x4c),
  2482. 5: uint8(0x32),
  2483. 6: uint8(0x8a),
  2484. 7: uint8(0x95),
  2485. },
  2486. }
  2487. type TICHAR = int8
  2488. type TPOSITION = struct {
  2489. FlineNumber TXML_Size
  2490. FcolumnNumber TXML_Size
  2491. }
  2492. type Tposition = TPOSITION
  2493. type TATTRIBUTE = struct {
  2494. Fname uintptr
  2495. FvaluePtr uintptr
  2496. FvalueEnd uintptr
  2497. Fnormalized int8
  2498. }
  2499. type Tencoding = struct {
  2500. Fscanners [4]TSCANNER
  2501. FliteralScanners [2]TSCANNER
  2502. FnameMatchesAscii uintptr
  2503. FnameLength uintptr
  2504. FskipS uintptr
  2505. FgetAtts uintptr
  2506. FcharRefNumber uintptr
  2507. FpredefinedEntityName uintptr
  2508. FupdatePosition uintptr
  2509. FisPublicId uintptr
  2510. Futf8Convert uintptr
  2511. Futf16Convert uintptr
  2512. FminBytesPerChar int32
  2513. FisUtf8 int8
  2514. FisUtf16 int8
  2515. }
  2516. type TENCODING = struct {
  2517. Fscanners [4]TSCANNER
  2518. FliteralScanners [2]TSCANNER
  2519. FnameMatchesAscii uintptr
  2520. FnameLength uintptr
  2521. FskipS uintptr
  2522. FgetAtts uintptr
  2523. FcharRefNumber uintptr
  2524. FpredefinedEntityName uintptr
  2525. FupdatePosition uintptr
  2526. FisPublicId uintptr
  2527. Futf8Convert uintptr
  2528. Futf16Convert uintptr
  2529. FminBytesPerChar int32
  2530. FisUtf8 int8
  2531. FisUtf16 int8
  2532. }
  2533. type TSCANNER = uintptr
  2534. type _XML_Convert_Result = int32
  2535. const _XML_CONVERT_COMPLETED = 0
  2536. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2537. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2538. type TINIT_ENCODING = struct {
  2539. FinitEnc TENCODING
  2540. FencPtr uintptr
  2541. }
  2542. type TCONVERTER = uintptr
  2543. const _XML_ROLE_ERROR = -1
  2544. const _XML_ROLE_NONE = 0
  2545. const _XML_ROLE_XML_DECL = 1
  2546. const _XML_ROLE_INSTANCE_START = 2
  2547. const _XML_ROLE_DOCTYPE_NONE = 3
  2548. const _XML_ROLE_DOCTYPE_NAME = 4
  2549. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2550. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2551. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2552. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2553. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2554. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2555. const _XML_ROLE_ENTITY_NONE = 11
  2556. const _XML_ROLE_ENTITY_VALUE = 12
  2557. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2558. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2559. const _XML_ROLE_ENTITY_COMPLETE = 15
  2560. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2561. const _XML_ROLE_NOTATION_NONE = 17
  2562. const _XML_ROLE_NOTATION_NAME = 18
  2563. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2564. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2565. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2566. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2567. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2568. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2569. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2570. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2571. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2572. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2573. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2574. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2575. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2576. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2577. const _XML_ROLE_ATTLIST_NONE = 33
  2578. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2579. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2580. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2581. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2582. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2583. const _XML_ROLE_ELEMENT_NONE = 39
  2584. const _XML_ROLE_ELEMENT_NAME = 40
  2585. const _XML_ROLE_CONTENT_ANY = 41
  2586. const _XML_ROLE_CONTENT_EMPTY = 42
  2587. const _XML_ROLE_CONTENT_PCDATA = 43
  2588. const _XML_ROLE_GROUP_OPEN = 44
  2589. const _XML_ROLE_GROUP_CLOSE = 45
  2590. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2591. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2592. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2593. const _XML_ROLE_GROUP_CHOICE = 49
  2594. const _XML_ROLE_GROUP_SEQUENCE = 50
  2595. const _XML_ROLE_CONTENT_ELEMENT = 51
  2596. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2597. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2598. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2599. const _XML_ROLE_PI = 55
  2600. const _XML_ROLE_COMMENT = 56
  2601. const _XML_ROLE_TEXT_DECL = 57
  2602. const _XML_ROLE_IGNORE_SECT = 58
  2603. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2604. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2605. type TPROLOG_STATE = struct {
  2606. Fhandler uintptr
  2607. Flevel uint32
  2608. Frole_none int32
  2609. FincludeLevel uint32
  2610. FdocumentEntity int32
  2611. FinEntityValue int32
  2612. }
  2613. type Tprolog_state = TPROLOG_STATE
  2614. type TKEY = uintptr
  2615. type TNAMED = struct {
  2616. Fname TKEY
  2617. }
  2618. type THASH_TABLE = struct {
  2619. Fv uintptr
  2620. Fpower uint8
  2621. Fsize Tsize_t
  2622. Fused Tsize_t
  2623. Fmem uintptr
  2624. }
  2625. /* For probing (after a collision) we need a step size relative prime
  2626. to the hash table size, which is a power of 2. We use double-hashing,
  2627. since we can calculate a second hash value cheaply by taking those bits
  2628. of the first hash value that were discarded (masked out) when the table
  2629. index was calculated: index = hash & mask, where mask = table->size - 1.
  2630. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2631. it odd, since odd numbers are always relative prime to a power of 2.
  2632. */
  2633. type THASH_TABLE_ITER = struct {
  2634. Fp uintptr
  2635. Fend uintptr
  2636. }
  2637. type TBINDING = struct {
  2638. Fprefix uintptr
  2639. FnextTagBinding uintptr
  2640. FprevPrefixBinding uintptr
  2641. FattId uintptr
  2642. Furi uintptr
  2643. FuriLen int32
  2644. FuriAlloc int32
  2645. }
  2646. type Tbinding = TBINDING
  2647. type TPREFIX = struct {
  2648. Fname uintptr
  2649. Fbinding uintptr
  2650. }
  2651. type Tprefix = TPREFIX
  2652. type TTAG_NAME = struct {
  2653. Fstr uintptr
  2654. FlocalPart uintptr
  2655. Fprefix uintptr
  2656. FstrLen int32
  2657. FuriLen int32
  2658. FprefixLen int32
  2659. }
  2660. // C documentation
  2661. //
  2662. // /* TAG represents an open element.
  2663. // The name of the element is stored in both the document and API
  2664. // encodings. The memory buffer 'buf' is a separately-allocated
  2665. // memory area which stores the name. During the XML_Parse()/
  2666. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2667. // version of the name (in the document encoding) is shared with the
  2668. // document buffer. If the element is open across calls to
  2669. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2670. // contain the 'raw' name as well.
  2671. //
  2672. // A parser re-uses these structures, maintaining a list of allocated
  2673. // TAG objects in a free list.
  2674. // */
  2675. type TTAG = struct {
  2676. Fparent uintptr
  2677. FrawName uintptr
  2678. FrawNameLength int32
  2679. Fname TTAG_NAME
  2680. Fbuf uintptr
  2681. FbufEnd uintptr
  2682. Fbindings uintptr
  2683. }
  2684. // C documentation
  2685. //
  2686. // /* TAG represents an open element.
  2687. // The name of the element is stored in both the document and API
  2688. // encodings. The memory buffer 'buf' is a separately-allocated
  2689. // memory area which stores the name. During the XML_Parse()/
  2690. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2691. // version of the name (in the document encoding) is shared with the
  2692. // document buffer. If the element is open across calls to
  2693. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2694. // contain the 'raw' name as well.
  2695. //
  2696. // A parser re-uses these structures, maintaining a list of allocated
  2697. // TAG objects in a free list.
  2698. // */
  2699. type Ttag = TTAG
  2700. type TENTITY = struct {
  2701. Fname uintptr
  2702. FtextPtr uintptr
  2703. FtextLen int32
  2704. Fprocessed int32
  2705. FsystemId uintptr
  2706. Fbase uintptr
  2707. FpublicId uintptr
  2708. Fnotation uintptr
  2709. Fopen TXML_Bool
  2710. Fis_param TXML_Bool
  2711. Fis_internal TXML_Bool
  2712. }
  2713. type TCONTENT_SCAFFOLD = struct {
  2714. Ftype1 _XML_Content_Type
  2715. Fquant _XML_Content_Quant
  2716. Fname uintptr
  2717. Ffirstchild int32
  2718. Flastchild int32
  2719. Fchildcnt int32
  2720. Fnextsib int32
  2721. }
  2722. type TBLOCK = struct {
  2723. Fnext uintptr
  2724. Fsize int32
  2725. Fs [1]TXML_Char
  2726. }
  2727. type Tblock = TBLOCK
  2728. type TSTRING_POOL = struct {
  2729. Fblocks uintptr
  2730. FfreeBlocks uintptr
  2731. Fend uintptr
  2732. Fptr uintptr
  2733. Fstart uintptr
  2734. Fmem uintptr
  2735. }
  2736. // C documentation
  2737. //
  2738. // /* The XML_Char before the name is used to determine whether
  2739. // an attribute has been specified. */
  2740. type TATTRIBUTE_ID = struct {
  2741. Fname uintptr
  2742. Fprefix uintptr
  2743. FmaybeTokenized TXML_Bool
  2744. Fxmlns TXML_Bool
  2745. }
  2746. // C documentation
  2747. //
  2748. // /* The XML_Char before the name is used to determine whether
  2749. // an attribute has been specified. */
  2750. type Tattribute_id = TATTRIBUTE_ID
  2751. type TDEFAULT_ATTRIBUTE = struct {
  2752. Fid uintptr
  2753. FisCdata TXML_Bool
  2754. Fvalue uintptr
  2755. }
  2756. type TNS_ATT = struct {
  2757. Fversion uint32
  2758. Fhash uint32
  2759. FuriName uintptr
  2760. }
  2761. type TELEMENT_TYPE = struct {
  2762. Fname uintptr
  2763. Fprefix uintptr
  2764. FidAtt uintptr
  2765. FnDefaultAtts int32
  2766. FallocDefaultAtts int32
  2767. FdefaultAtts uintptr
  2768. }
  2769. type TDTD = struct {
  2770. FgeneralEntities THASH_TABLE
  2771. FelementTypes THASH_TABLE
  2772. FattributeIds THASH_TABLE
  2773. Fprefixes THASH_TABLE
  2774. Fpool TSTRING_POOL
  2775. FentityValuePool TSTRING_POOL
  2776. FkeepProcessing TXML_Bool
  2777. FhasParamEntityRefs TXML_Bool
  2778. Fstandalone TXML_Bool
  2779. FparamEntityRead TXML_Bool
  2780. FparamEntities THASH_TABLE
  2781. FdefaultPrefix TPREFIX
  2782. Fin_eldecl TXML_Bool
  2783. Fscaffold uintptr
  2784. FcontentStringLen uint32
  2785. FscaffSize uint32
  2786. FscaffCount uint32
  2787. FscaffLevel int32
  2788. FscaffIndex uintptr
  2789. }
  2790. type TOPEN_INTERNAL_ENTITY = struct {
  2791. FinternalEventPtr uintptr
  2792. FinternalEventEndPtr uintptr
  2793. Fnext uintptr
  2794. Fentity uintptr
  2795. FstartTagLevel int32
  2796. FbetweenDecl TXML_Bool
  2797. }
  2798. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2799. type _XML_Account = int32
  2800. const _XML_ACCOUNT_DIRECT = 0
  2801. const /* bytes directly passed to the Expat parser */
  2802. _XML_ACCOUNT_ENTITY_EXPANSION = 1
  2803. const /* intermediate bytes produced during entity
  2804. expansion */
  2805. _XML_ACCOUNT_NONE = 2
  2806. type TXmlBigCount = uint64
  2807. type TACCOUNTING = struct {
  2808. FcountBytesDirect TXmlBigCount
  2809. FcountBytesIndirect TXmlBigCount
  2810. FdebugLevel int32
  2811. FmaximumAmplificationFactor float32
  2812. FactivationThresholdBytes uint64
  2813. }
  2814. type Taccounting = TACCOUNTING
  2815. type TENTITY_STATS = struct {
  2816. FcountEverOpened uint32
  2817. FcurrentDepth uint32
  2818. FmaximumDepthSeen uint32
  2819. FdebugLevel int32
  2820. }
  2821. type Tentity_stats = TENTITY_STATS
  2822. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2823. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2824. }
  2825. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2826. bp := tls.Alloc(16)
  2827. defer tls.Free(16)
  2828. var _ /* tmp at bp+0 */ [2]TXML_Char
  2829. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  2830. 0: nsSep,
  2831. }
  2832. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2833. }
  2834. // C documentation
  2835. //
  2836. // // "xml=http://www.w3.org/XML/1998/namespace"
  2837. var _implicitContext = [41]TXML_Char{
  2838. 0: int8(m_ASCII_x),
  2839. 1: int8(m_ASCII_m),
  2840. 2: int8(m_ASCII_l),
  2841. 3: int8(m_ASCII_EQUALS),
  2842. 4: int8(m_ASCII_h),
  2843. 5: int8(m_ASCII_t),
  2844. 6: int8(m_ASCII_t),
  2845. 7: int8(m_ASCII_p),
  2846. 8: int8(m_ASCII_COLON),
  2847. 9: int8(m_ASCII_SLASH),
  2848. 10: int8(m_ASCII_SLASH),
  2849. 11: int8(m_ASCII_w),
  2850. 12: int8(m_ASCII_w),
  2851. 13: int8(m_ASCII_w),
  2852. 14: int8(m_ASCII_PERIOD),
  2853. 15: int8(m_ASCII_w),
  2854. 16: int8(m_ASCII_3),
  2855. 17: int8(m_ASCII_PERIOD),
  2856. 18: int8(m_ASCII_o),
  2857. 19: int8(m_ASCII_r),
  2858. 20: int8(m_ASCII_g),
  2859. 21: int8(m_ASCII_SLASH),
  2860. 22: int8(m_ASCII_X),
  2861. 23: int8(m_ASCII_M),
  2862. 24: int8(m_ASCII_L),
  2863. 25: int8(m_ASCII_SLASH),
  2864. 26: int8(m_ASCII_1),
  2865. 27: int8(m_ASCII_9),
  2866. 28: int8(m_ASCII_9),
  2867. 29: int8(m_ASCII_8),
  2868. 30: int8(m_ASCII_SLASH),
  2869. 31: int8(m_ASCII_n),
  2870. 32: int8(m_ASCII_a),
  2871. 33: int8(m_ASCII_m),
  2872. 34: int8(m_ASCII_e),
  2873. 35: int8(m_ASCII_s),
  2874. 36: int8(m_ASCII_p),
  2875. 37: int8(m_ASCII_a),
  2876. 38: int8(m_ASCII_c),
  2877. 39: int8(m_ASCII_e),
  2878. }
  2879. /* To avoid warnings about unused functions: */
  2880. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint32) (r uint32) {
  2881. bp := tls.Alloc(48)
  2882. defer tls.Free(48)
  2883. if _getDebugLevel(tls, __ccgo_ts+17, uint32(0)) >= uint32(1) {
  2884. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+37, libc.VaList(bp+8, label, libc.Int32FromInt64(4)*libc.Int32FromInt32(2), entropy, libc.Uint32FromInt64(4)))
  2885. }
  2886. return entropy
  2887. }
  2888. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint32) {
  2889. bp := tls.Alloc(16)
  2890. defer tls.Free(16)
  2891. var _ /* entropy at bp+0 */ uint32
  2892. _ = parser
  2893. /* "Failproof" high quality providers: */
  2894. libbsd.Xarc4random_buf(tls, bp, uint32(4))
  2895. return _ENTROPY_DEBUG(tls, __ccgo_ts+81, *(*uint32)(unsafe.Pointer(bp)))
  2896. }
  2897. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint32) {
  2898. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2899. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2900. }
  2901. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2902. }
  2903. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2904. /* hash functions must be initialized before setContext() is called */
  2905. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint32(0) {
  2906. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2907. }
  2908. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2909. /* implicit context only set for root parser, since child
  2910. parsers (i.e. external entity parsers) will inherit it
  2911. */
  2912. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2913. }
  2914. return libc.Uint8FromInt32(1)
  2915. }
  2916. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2917. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2918. }
  2919. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2920. var mtemp, mtemp1 uintptr
  2921. var parser TXML_Parser
  2922. _, _, _ = mtemp, mtemp1, parser
  2923. if memsuite != 0 {
  2924. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint32(544))
  2925. if parser != libc.UintptrFromInt32(0) {
  2926. mtemp = parser + 12
  2927. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  2928. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  2929. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  2930. }
  2931. } else {
  2932. parser = libc.Xmalloc(tls, uint32(544))
  2933. if parser != libc.UintptrFromInt32(0) {
  2934. mtemp1 = parser + 12
  2935. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  2936. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  2937. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  2938. }
  2939. }
  2940. if !(parser != 0) {
  2941. return parser
  2942. }
  2943. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  2944. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  2945. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  2946. (*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.Uint32FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint32FromInt64(16))
  2947. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  2948. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2949. return libc.UintptrFromInt32(0)
  2950. }
  2951. (*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.Uint32FromInt32(m_INIT_DATA_BUF_SIZE)*libc.Uint32FromInt64(1))
  2952. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  2953. (*(*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)
  2954. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2955. return libc.UintptrFromInt32(0)
  2956. }
  2957. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  2958. if dtd != 0 {
  2959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  2960. } else {
  2961. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+12)
  2962. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  2963. (*(*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)
  2964. (*(*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)
  2965. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  2966. return libc.UintptrFromInt32(0)
  2967. }
  2968. }
  2969. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  2970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  2971. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  2972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  2973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  2974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  2975. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  2976. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = int8(m_ASCII_EXCL)
  2977. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  2978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  2979. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  2980. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint32(0)
  2981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  2982. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  2983. _poolInit(tls, parser+412, parser+12)
  2984. _poolInit(tls, parser+436, parser+12)
  2985. _parserInit(tls, parser, encodingName)
  2986. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  2987. if dtd != 0 {
  2988. // We need to stop the upcoming call to XML_ParserFree from happily
  2989. // destroying parser->m_dtd because the DTD is shared with the parent
  2990. // parser and the only guard that keeps XML_ParserFree from destroying
  2991. // parser->m_dtd is parser->m_isParamEntity but it will be set to
  2992. // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
  2993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = libc.UintptrFromInt32(0)
  2994. }
  2995. XXML_ParserFree(tls, parser)
  2996. return libc.UintptrFromInt32(0)
  2997. }
  2998. if nameSep != 0 {
  2999. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3000. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3002. } else {
  3003. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3004. }
  3005. return parser
  3006. }
  3007. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3009. XXmlPrologStateInit(tls, parser+252)
  3010. if encodingName != libc.UintptrFromInt32(0) {
  3011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+12)
  3012. }
  3013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3014. XXmlInitEncoding(tls, parser+148, parser+144, uintptr(0))
  3015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3018. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3019. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3020. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3021. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3022. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3023. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3024. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3025. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3039. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3042. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3043. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3050. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3051. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3052. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3053. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3054. libc.Xmemset(tls, parser+404, 0, uint32(8))
  3055. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3056. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3057. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3058. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3060. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3062. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3070. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint32(0)
  3074. libc.Xmemset(tls, parser+496, 0, uint32(32))
  3075. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FdebugLevel = libc.Int32FromUint32(_getDebugLevel(tls, __ccgo_ts+96, 0))
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = libc.Float32FromFloat32(100)
  3077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = uint64(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT)
  3078. libc.Xmemset(tls, parser+528, 0, uint32(16))
  3079. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entity_stats.FdebugLevel = libc.Int32FromUint32(_getDebugLevel(tls, __ccgo_ts+119, 0))
  3080. }
  3081. // C documentation
  3082. //
  3083. // /* moves list of bindings to m_freeBindingList */
  3084. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3085. var b uintptr
  3086. _ = b
  3087. for bindings != 0 {
  3088. b = bindings
  3089. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3090. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3091. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3092. }
  3093. }
  3094. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3095. var openEntity, openEntityList, tStk, tag uintptr
  3096. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3097. if parser == libc.UintptrFromInt32(0) {
  3098. return libc.Uint8FromInt32(0)
  3099. }
  3100. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3101. return libc.Uint8FromInt32(0)
  3102. }
  3103. /* move m_tagStack to m_freeTagList */
  3104. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3105. for tStk != 0 {
  3106. tag = tStk
  3107. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3108. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3109. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3110. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3112. }
  3113. /* move m_openInternalEntities to m_freeInternalEntities */
  3114. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3115. for openEntityList != 0 {
  3116. openEntity = openEntityList
  3117. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3118. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3120. }
  3121. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3122. (*(*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)
  3123. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3124. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3125. }
  3126. _poolClear(tls, parser+412)
  3127. _poolClear(tls, parser+436)
  3128. (*(*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)
  3129. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3130. _parserInit(tls, parser, encodingName)
  3131. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+12)
  3132. return libc.Uint8FromInt32(1)
  3133. }
  3134. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3135. if parser == libc.UintptrFromInt32(0) {
  3136. return int32(_XML_STATUS_ERROR)
  3137. }
  3138. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3139. XXX There's no way for the caller to determine which of the
  3140. XXX possible error cases caused the XML_STATUS_ERROR return.
  3141. */
  3142. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3143. return int32(_XML_STATUS_ERROR)
  3144. }
  3145. /* Get rid of any previous encoding name */
  3146. (*(*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)
  3147. if encodingName == libc.UintptrFromInt32(0) {
  3148. /* No new encoding name */
  3149. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3150. } else {
  3151. /* Copy the new encoding name into allocated memory */
  3152. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+12)
  3153. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3154. return int32(_XML_STATUS_ERROR)
  3155. }
  3156. }
  3157. return int32(_XML_STATUS_OK)
  3158. }
  3159. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3160. bp := tls.Alloc(16)
  3161. defer tls.Free(16)
  3162. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3163. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3164. var oldCharacterDataHandler TXML_CharacterDataHandler
  3165. var oldCommentHandler TXML_CommentHandler
  3166. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3167. var oldDefaultHandler TXML_DefaultHandler
  3168. var oldElementDeclHandler TXML_ElementDeclHandler
  3169. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3170. var oldEndElementHandler TXML_EndElementHandler
  3171. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3172. var oldEntityDeclHandler TXML_EntityDeclHandler
  3173. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3174. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3175. var oldInEntityValue int32
  3176. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3177. var oldNotationDeclHandler TXML_NotationDeclHandler
  3178. var oldParamEntityParsing _XML_ParamEntityParsing
  3179. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3180. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3181. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3182. var oldStartElementHandler TXML_StartElementHandler
  3183. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3184. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3185. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3186. var oldXmlDeclHandler TXML_XmlDeclHandler
  3187. var oldhash_secret_salt uint32
  3188. var _ /* tmp at bp+0 */ [2]TXML_Char
  3189. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3190. parser = oldParser
  3191. newDtd = libc.UintptrFromInt32(0)
  3192. /* Validate the oldParser parameter before we pull everything out of it */
  3193. if oldParser == libc.UintptrFromInt32(0) {
  3194. return libc.UintptrFromInt32(0)
  3195. }
  3196. /* Stash the original parser contents on the stack */
  3197. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3198. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3199. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3200. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3201. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3202. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3203. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3204. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3205. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3206. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3207. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3208. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3209. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3210. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3211. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3212. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3213. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3214. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3215. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3216. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3217. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3218. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3219. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3220. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3221. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3222. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3223. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3224. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3225. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3226. /* Note that the new parser shares the same hash secret as the old
  3227. parser, so that dtdCopy and copyEntityTable can lookup values
  3228. from hash tables associated with either parser without us having
  3229. to worry which hash secrets each table has.
  3230. */
  3231. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3232. if !(context != 0) {
  3233. newDtd = oldDtd
  3234. }
  3235. /* Note that the magical uses of the pre-processor to make field
  3236. access look more like C++ require that `parser' be overwritten
  3237. here. This makes this function more painful to follow than it
  3238. would be otherwise.
  3239. */
  3240. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3241. *(*[2]TXML_Char)(unsafe.Pointer(bp)) = [2]TXML_Char{
  3242. 0: (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator,
  3243. }
  3244. parser = _parserCreate(tls, encodingName, parser+12, bp, newDtd)
  3245. } else {
  3246. parser = _parserCreate(tls, encodingName, parser+12, libc.UintptrFromInt32(0), newDtd)
  3247. }
  3248. if !(parser != 0) {
  3249. return libc.UintptrFromInt32(0)
  3250. }
  3251. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3252. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3254. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3255. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3256. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3257. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3258. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3259. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3260. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3261. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3262. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3263. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3265. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3266. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3267. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3268. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3269. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3270. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3272. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3273. if oldUserData == oldHandlerArg {
  3274. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3275. } else {
  3276. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3277. }
  3278. if oldExternalEntityRefHandlerArg != oldParser {
  3279. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3280. }
  3281. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3282. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3283. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3284. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3285. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3286. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3287. if context != 0 {
  3288. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+12) != 0) || !(_setContext(tls, parser, context) != 0) {
  3289. XXML_ParserFree(tls, parser)
  3290. return libc.UintptrFromInt32(0)
  3291. }
  3292. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3293. } else {
  3294. /* The DTD instance referenced by parser->m_dtd is shared between the
  3295. document's root parser and external PE parsers, therefore one does not
  3296. need to call setContext. In addition, one also *must* not call
  3297. setContext, because this would overwrite existing prefix->binding
  3298. pointers in parser->m_dtd with ones that get destroyed with the external
  3299. PE parser. This would leave those prefixes with dangling pointers.
  3300. */
  3301. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3302. XXmlPrologStateInitExternalEntity(tls, parser+252)
  3303. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3304. }
  3305. return parser
  3306. }
  3307. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3308. var b uintptr
  3309. _ = b
  3310. for {
  3311. b = bindings
  3312. if !(b != 0) {
  3313. break
  3314. }
  3315. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3316. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3317. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3318. goto _1
  3319. _1:
  3320. }
  3321. }
  3322. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3323. var entityList, openEntity, p, tagList uintptr
  3324. _, _, _, _ = entityList, openEntity, p, tagList
  3325. if parser == libc.UintptrFromInt32(0) {
  3326. return
  3327. }
  3328. /* free m_tagStack and m_freeTagList */
  3329. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3330. for {
  3331. if tagList == libc.UintptrFromInt32(0) {
  3332. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3333. break
  3334. }
  3335. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3336. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3337. }
  3338. p = tagList
  3339. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3340. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3341. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3342. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3343. goto _1
  3344. _1:
  3345. }
  3346. /* free m_openInternalEntities and m_freeInternalEntities */
  3347. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3348. for {
  3349. if entityList == libc.UintptrFromInt32(0) {
  3350. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3351. break
  3352. }
  3353. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3354. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3355. }
  3356. openEntity = entityList
  3357. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3358. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3359. goto _2
  3360. _2:
  3361. }
  3362. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3363. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3364. _poolDestroy(tls, parser+412)
  3365. _poolDestroy(tls, parser+436)
  3366. (*(*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)
  3367. /* external parameter entity parsers share the DTD structure
  3368. parser->m_dtd with the root parser, so we must not destroy it
  3369. */
  3370. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3371. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+12)
  3372. }
  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_atts)
  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_groupConnector)
  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_buffer)
  3376. (*(*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)
  3377. (*(*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)
  3378. (*(*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)
  3379. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3380. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3381. }
  3382. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3383. }
  3384. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3385. if parser != libc.UintptrFromInt32(0) {
  3386. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3387. }
  3388. }
  3389. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3390. if parser == libc.UintptrFromInt32(0) {
  3391. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3392. }
  3393. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3394. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3395. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3396. }
  3397. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3398. return int32(_XML_ERROR_NONE)
  3399. }
  3400. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3401. var v1 int32
  3402. _ = v1
  3403. if parser == libc.UintptrFromInt32(0) {
  3404. return
  3405. }
  3406. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3407. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3408. return
  3409. }
  3410. if do_nst != 0 {
  3411. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3412. } else {
  3413. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3414. }
  3415. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3416. }
  3417. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3418. var v1 uintptr
  3419. _ = v1
  3420. if parser == libc.UintptrFromInt32(0) {
  3421. return
  3422. }
  3423. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3424. v1 = p
  3425. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3426. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3427. } else {
  3428. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3429. }
  3430. }
  3431. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3432. if parser == libc.UintptrFromInt32(0) {
  3433. return int32(_XML_STATUS_ERROR)
  3434. }
  3435. if p != 0 {
  3436. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+80, p)
  3437. if !(p != 0) {
  3438. return int32(_XML_STATUS_ERROR)
  3439. }
  3440. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3441. } else {
  3442. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3443. }
  3444. return int32(_XML_STATUS_OK)
  3445. }
  3446. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3447. if parser == libc.UintptrFromInt32(0) {
  3448. return libc.UintptrFromInt32(0)
  3449. }
  3450. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3451. }
  3452. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3453. if parser == libc.UintptrFromInt32(0) {
  3454. return -int32(1)
  3455. }
  3456. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3457. }
  3458. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3459. if parser == libc.UintptrFromInt32(0) {
  3460. return -int32(1)
  3461. }
  3462. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3463. }
  3464. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3465. if parser == libc.UintptrFromInt32(0) {
  3466. return
  3467. }
  3468. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3469. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3470. }
  3471. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3472. if parser != libc.UintptrFromInt32(0) {
  3473. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3474. }
  3475. }
  3476. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3477. if parser != libc.UintptrFromInt32(0) {
  3478. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3479. }
  3480. }
  3481. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3482. if parser != libc.UintptrFromInt32(0) {
  3483. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3484. }
  3485. }
  3486. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3487. if parser != libc.UintptrFromInt32(0) {
  3488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3489. }
  3490. }
  3491. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3492. if parser != libc.UintptrFromInt32(0) {
  3493. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3494. }
  3495. }
  3496. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3497. if parser == libc.UintptrFromInt32(0) {
  3498. return
  3499. }
  3500. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3501. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3502. }
  3503. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3504. if parser != libc.UintptrFromInt32(0) {
  3505. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3506. }
  3507. }
  3508. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3509. if parser != libc.UintptrFromInt32(0) {
  3510. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3511. }
  3512. }
  3513. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3514. if parser == libc.UintptrFromInt32(0) {
  3515. return
  3516. }
  3517. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3518. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3519. }
  3520. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3521. if parser == libc.UintptrFromInt32(0) {
  3522. return
  3523. }
  3524. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3525. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3526. }
  3527. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3528. if parser == libc.UintptrFromInt32(0) {
  3529. return
  3530. }
  3531. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3532. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3533. }
  3534. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3535. if parser != libc.UintptrFromInt32(0) {
  3536. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3537. }
  3538. }
  3539. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3540. if parser != libc.UintptrFromInt32(0) {
  3541. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3542. }
  3543. }
  3544. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3545. if parser != libc.UintptrFromInt32(0) {
  3546. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3547. }
  3548. }
  3549. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3550. if parser != libc.UintptrFromInt32(0) {
  3551. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3552. }
  3553. }
  3554. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3555. if parser == libc.UintptrFromInt32(0) {
  3556. return
  3557. }
  3558. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3559. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3560. }
  3561. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3562. if parser != libc.UintptrFromInt32(0) {
  3563. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3564. }
  3565. }
  3566. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3567. if parser != libc.UintptrFromInt32(0) {
  3568. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3569. }
  3570. }
  3571. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3572. if parser != libc.UintptrFromInt32(0) {
  3573. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3574. }
  3575. }
  3576. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3577. if parser != libc.UintptrFromInt32(0) {
  3578. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3579. }
  3580. }
  3581. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3582. if parser == libc.UintptrFromInt32(0) {
  3583. return
  3584. }
  3585. if arg != 0 {
  3586. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3587. } else {
  3588. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3589. }
  3590. }
  3591. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3592. if parser != libc.UintptrFromInt32(0) {
  3593. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3594. }
  3595. }
  3596. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3597. if parser == libc.UintptrFromInt32(0) {
  3598. return
  3599. }
  3600. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3601. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3602. }
  3603. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3604. if parser != libc.UintptrFromInt32(0) {
  3605. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3606. }
  3607. }
  3608. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3609. if parser != libc.UintptrFromInt32(0) {
  3610. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3611. }
  3612. }
  3613. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3614. if parser != libc.UintptrFromInt32(0) {
  3615. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3616. }
  3617. }
  3618. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3619. if parser != libc.UintptrFromInt32(0) {
  3620. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3621. }
  3622. }
  3623. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3624. if parser == libc.UintptrFromInt32(0) {
  3625. return 0
  3626. }
  3627. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3628. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3629. return 0
  3630. }
  3631. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3632. return int32(1)
  3633. }
  3634. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint32) (r int32) {
  3635. if parser == libc.UintptrFromInt32(0) {
  3636. return 0
  3637. }
  3638. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3639. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3640. }
  3641. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3642. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3643. return 0
  3644. }
  3645. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3646. return int32(1)
  3647. }
  3648. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3649. var buff uintptr
  3650. _ = buff
  3651. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3652. if parser != libc.UintptrFromInt32(0) {
  3653. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3654. }
  3655. return int32(_XML_STATUS_ERROR)
  3656. }
  3657. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3658. case int32(_XML_SUSPENDED):
  3659. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3660. return int32(_XML_STATUS_ERROR)
  3661. case int32(_XML_FINISHED):
  3662. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3663. return int32(_XML_STATUS_ERROR)
  3664. case int32(_XML_INITIALIZED):
  3665. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3666. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3667. return int32(_XML_STATUS_ERROR)
  3668. }
  3669. /* fall through */
  3670. fallthrough
  3671. default:
  3672. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3673. }
  3674. if len1 == 0 {
  3675. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3676. if !(isFinal != 0) {
  3677. return int32(_XML_STATUS_OK)
  3678. }
  3679. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3680. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3681. /* If data are left over from last buffer, and we now know that these
  3682. data are the final chunk of input, then we have to check them again
  3683. to detect errors based on that fact.
  3684. */
  3685. (*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+24)
  3686. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3687. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3688. case int32(_XML_SUSPENDED):
  3689. /* It is hard to be certain, but it seems that this case
  3690. * cannot occur. This code is cleaning up a previous parse
  3691. * with no new data (since len == 0). Changing the parsing
  3692. * state requires getting to execute a handler function, and
  3693. * there doesn't seem to be an opportunity for that while in
  3694. * this circumstance.
  3695. *
  3696. * Given the uncertainty, we retain the code but exclude it
  3697. * from coverage tests.
  3698. *
  3699. * LCOV_EXCL_START
  3700. */
  3701. (*(*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+404)
  3702. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3703. return int32(_XML_STATUS_SUSPENDED)
  3704. /* LCOV_EXCL_STOP */
  3705. fallthrough
  3706. case int32(_XML_INITIALIZED):
  3707. fallthrough
  3708. case int32(_XML_PARSING):
  3709. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3710. /* fall through */
  3711. fallthrough
  3712. default:
  3713. return int32(_XML_STATUS_OK)
  3714. }
  3715. }
  3716. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3717. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3718. return int32(_XML_STATUS_ERROR)
  3719. } else {
  3720. buff = XXML_GetBuffer(tls, parser, len1)
  3721. if buff == libc.UintptrFromInt32(0) {
  3722. return int32(_XML_STATUS_ERROR)
  3723. } else {
  3724. libc.Xmemcpy(tls, buff, s, libc.Uint32FromInt32(len1))
  3725. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3726. }
  3727. }
  3728. return r
  3729. }
  3730. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3731. var result _XML_Status
  3732. var start uintptr
  3733. _, _ = result, start
  3734. result = int32(_XML_STATUS_OK)
  3735. if parser == libc.UintptrFromInt32(0) {
  3736. return int32(_XML_STATUS_ERROR)
  3737. }
  3738. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3739. case int32(_XML_SUSPENDED):
  3740. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3741. return int32(_XML_STATUS_ERROR)
  3742. case int32(_XML_FINISHED):
  3743. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3744. return int32(_XML_STATUS_ERROR)
  3745. case int32(_XML_INITIALIZED):
  3746. /* Has someone called XML_GetBuffer successfully before? */
  3747. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0) {
  3748. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_BUFFER)
  3749. return int32(_XML_STATUS_ERROR)
  3750. }
  3751. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3752. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3753. return int32(_XML_STATUS_ERROR)
  3754. }
  3755. /* fall through */
  3756. fallthrough
  3757. default:
  3758. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3759. }
  3760. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3761. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3762. *(*uintptr)(unsafe.Pointer(parser + 28)) += uintptr(len1)
  3763. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3764. *(*TXML_Index)(unsafe.Pointer(parser + 36)) += len1
  3765. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3766. (*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+24)
  3767. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3768. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3769. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3770. return int32(_XML_STATUS_ERROR)
  3771. } else {
  3772. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3773. case int32(_XML_SUSPENDED):
  3774. result = int32(_XML_STATUS_SUSPENDED)
  3775. case int32(_XML_INITIALIZED):
  3776. fallthrough
  3777. case int32(_XML_PARSING):
  3778. if isFinal != 0 {
  3779. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3780. return result
  3781. }
  3782. fallthrough
  3783. default: /* should not happen */
  3784. }
  3785. }
  3786. (*(*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+404)
  3787. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3788. return result
  3789. }
  3790. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3791. var bufferSize, keep, neededSize, offset, v1, v2, v3, v4, v5, v6, v7, v8, v9 int32
  3792. var newBuf, v10, v11 uintptr
  3793. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3794. if parser == libc.UintptrFromInt32(0) {
  3795. return libc.UintptrFromInt32(0)
  3796. }
  3797. if len1 < 0 {
  3798. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3799. return libc.UintptrFromInt32(0)
  3800. }
  3801. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3802. case int32(_XML_SUSPENDED):
  3803. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3804. return libc.UintptrFromInt32(0)
  3805. case int32(_XML_FINISHED):
  3806. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3807. return libc.UintptrFromInt32(0)
  3808. default:
  3809. }
  3810. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3811. v1 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3812. } else {
  3813. v1 = 0
  3814. }
  3815. if len1 > v1 {
  3816. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3817. v2 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3818. } else {
  3819. v2 = 0
  3820. }
  3821. /* Do not invoke signed arithmetic overflow: */
  3822. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt32(v2))
  3823. if neededSize < 0 {
  3824. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3825. return libc.UintptrFromInt32(0)
  3826. }
  3827. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3828. v3 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3829. } else {
  3830. v3 = 0
  3831. }
  3832. keep = v3
  3833. if keep > int32(m_XML_CONTEXT_BYTES) {
  3834. keep = int32(m_XML_CONTEXT_BYTES)
  3835. }
  3836. /* Detect and prevent integer overflow */
  3837. if keep > int32(m_INT_MAX)-neededSize {
  3838. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3839. return libc.UintptrFromInt32(0)
  3840. }
  3841. neededSize += keep
  3842. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3843. v4 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3844. } else {
  3845. v4 = 0
  3846. }
  3847. if neededSize <= v4 {
  3848. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3849. v5 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3850. } else {
  3851. v5 = 0
  3852. }
  3853. if keep < v5 {
  3854. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3855. v6 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3856. } else {
  3857. v6 = 0
  3858. }
  3859. offset = v6 - keep
  3860. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3861. * in the buffer */
  3862. libc.Xmemmove(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer+uintptr(offset), libc.Uint32FromInt32(int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)+keep))
  3863. *(*uintptr)(unsafe.Pointer(parser + 28)) -= uintptr(offset)
  3864. *(*uintptr)(unsafe.Pointer(parser + 24)) -= uintptr(offset)
  3865. }
  3866. } else {
  3867. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3868. v7 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3869. } else {
  3870. v7 = 0
  3871. }
  3872. bufferSize = v7
  3873. if bufferSize == 0 {
  3874. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3875. }
  3876. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3877. /* Do not invoke signed arithmetic overflow: */
  3878. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3879. }
  3880. if bufferSize <= 0 {
  3881. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3882. return libc.UintptrFromInt32(0)
  3883. }
  3884. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt32(bufferSize))
  3885. if newBuf == uintptr(0) {
  3886. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3887. return libc.UintptrFromInt32(0)
  3888. }
  3889. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3890. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3891. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3892. v8 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3893. } else {
  3894. v8 = 0
  3895. }
  3896. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint32FromInt32(v8+keep))
  3897. (*(*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)
  3898. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3899. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3900. v9 = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3901. } else {
  3902. v9 = 0
  3903. }
  3904. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3905. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3906. } else {
  3907. /* This must be a brand new buffer with no data in it yet */
  3908. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3909. v10 = newBuf
  3910. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3911. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3912. }
  3913. }
  3914. v11 = libc.UintptrFromInt32(0)
  3915. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3916. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3917. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3918. }
  3919. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3920. }
  3921. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3922. if parser == libc.UintptrFromInt32(0) {
  3923. return int32(_XML_STATUS_ERROR)
  3924. }
  3925. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3926. case int32(_XML_SUSPENDED):
  3927. if resumable != 0 {
  3928. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3929. return int32(_XML_STATUS_ERROR)
  3930. }
  3931. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3932. case int32(_XML_FINISHED):
  3933. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3934. return int32(_XML_STATUS_ERROR)
  3935. default:
  3936. if resumable != 0 {
  3937. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  3938. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  3939. return int32(_XML_STATUS_ERROR)
  3940. }
  3941. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  3942. } else {
  3943. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3944. }
  3945. }
  3946. return int32(_XML_STATUS_OK)
  3947. }
  3948. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  3949. var result _XML_Status
  3950. _ = result
  3951. result = int32(_XML_STATUS_OK)
  3952. if parser == libc.UintptrFromInt32(0) {
  3953. return int32(_XML_STATUS_ERROR)
  3954. }
  3955. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  3956. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  3957. return int32(_XML_STATUS_ERROR)
  3958. }
  3959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3960. (*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+24)
  3961. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3962. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3963. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3964. return int32(_XML_STATUS_ERROR)
  3965. } else {
  3966. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3967. case int32(_XML_SUSPENDED):
  3968. result = int32(_XML_STATUS_SUSPENDED)
  3969. case int32(_XML_INITIALIZED):
  3970. fallthrough
  3971. case int32(_XML_PARSING):
  3972. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  3973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3974. return result
  3975. }
  3976. fallthrough
  3977. default:
  3978. }
  3979. }
  3980. (*(*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+404)
  3981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3982. return result
  3983. }
  3984. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  3985. if parser == libc.UintptrFromInt32(0) {
  3986. return
  3987. }
  3988. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  3989. }
  3990. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  3991. if parser == libc.UintptrFromInt32(0) {
  3992. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3993. }
  3994. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  3995. }
  3996. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  3997. if parser == libc.UintptrFromInt32(0) {
  3998. return -int32(1)
  3999. }
  4000. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4001. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4002. }
  4003. return -int32(1)
  4004. }
  4005. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4006. if parser == libc.UintptrFromInt32(0) {
  4007. return 0
  4008. }
  4009. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4010. return int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr)
  4011. }
  4012. return 0
  4013. }
  4014. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4015. if parser == libc.UintptrFromInt32(0) {
  4016. return libc.UintptrFromInt32(0)
  4017. }
  4018. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4019. if offset != libc.UintptrFromInt32(0) {
  4020. *(*int32)(unsafe.Pointer(offset)) = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4021. }
  4022. if size != libc.UintptrFromInt32(0) {
  4023. *(*int32)(unsafe.Pointer(size)) = int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  4024. }
  4025. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4026. }
  4027. return libc.UintptrFromInt32(0)
  4028. }
  4029. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4030. if parser == libc.UintptrFromInt32(0) {
  4031. return uint32(0)
  4032. }
  4033. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4034. (*(*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+404)
  4035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4036. }
  4037. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint32(1)
  4038. }
  4039. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4040. if parser == libc.UintptrFromInt32(0) {
  4041. return uint32(0)
  4042. }
  4043. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4044. (*(*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+404)
  4045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4046. }
  4047. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4048. }
  4049. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4050. if parser != libc.UintptrFromInt32(0) {
  4051. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4052. }
  4053. }
  4054. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4055. if parser == libc.UintptrFromInt32(0) {
  4056. return libc.UintptrFromInt32(0)
  4057. }
  4058. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4059. }
  4060. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4061. if parser == libc.UintptrFromInt32(0) {
  4062. return libc.UintptrFromInt32(0)
  4063. }
  4064. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4065. }
  4066. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4067. if parser != libc.UintptrFromInt32(0) {
  4068. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4069. }
  4070. }
  4071. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4072. if parser == libc.UintptrFromInt32(0) {
  4073. return
  4074. }
  4075. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4076. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4077. _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)
  4078. } else {
  4079. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4080. }
  4081. }
  4082. }
  4083. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4084. switch code {
  4085. case int32(_XML_ERROR_NONE):
  4086. return libc.UintptrFromInt32(0)
  4087. case int32(_XML_ERROR_NO_MEMORY):
  4088. return __ccgo_ts + 138
  4089. case int32(_XML_ERROR_SYNTAX):
  4090. return __ccgo_ts + 152
  4091. case int32(_XML_ERROR_NO_ELEMENTS):
  4092. return __ccgo_ts + 165
  4093. case int32(_XML_ERROR_INVALID_TOKEN):
  4094. return __ccgo_ts + 182
  4095. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4096. return __ccgo_ts + 214
  4097. case int32(_XML_ERROR_PARTIAL_CHAR):
  4098. return __ccgo_ts + 229
  4099. case int32(_XML_ERROR_TAG_MISMATCH):
  4100. return __ccgo_ts + 247
  4101. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4102. return __ccgo_ts + 262
  4103. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4104. return __ccgo_ts + 282
  4105. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4106. return __ccgo_ts + 310
  4107. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4108. return __ccgo_ts + 345
  4109. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4110. return __ccgo_ts + 362
  4111. case int32(_XML_ERROR_ASYNC_ENTITY):
  4112. return __ccgo_ts + 389
  4113. case int32(_XML_ERROR_BAD_CHAR_REF):
  4114. return __ccgo_ts + 409
  4115. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4116. return __ccgo_ts + 447
  4117. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4118. return __ccgo_ts + 474
  4119. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4120. return __ccgo_ts + 516
  4121. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4122. return __ccgo_ts + 563
  4123. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4124. return __ccgo_ts + 580
  4125. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4126. return __ccgo_ts + 631
  4127. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4128. return __ccgo_ts + 654
  4129. case int32(_XML_ERROR_NOT_STANDALONE):
  4130. return __ccgo_ts + 700
  4131. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4132. return __ccgo_ts + 727
  4133. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4134. return __ccgo_ts + 778
  4135. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4136. return __ccgo_ts + 814
  4137. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4138. return __ccgo_ts + 866
  4139. /* Added in 1.95.7. */
  4140. fallthrough
  4141. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4142. return __ccgo_ts + 911
  4143. /* Added in 1.95.8. */
  4144. fallthrough
  4145. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4146. return __ccgo_ts + 926
  4147. case int32(_XML_ERROR_INCOMPLETE_PE):
  4148. return __ccgo_ts + 952
  4149. case int32(_XML_ERROR_XML_DECL):
  4150. return __ccgo_ts + 990
  4151. case int32(_XML_ERROR_TEXT_DECL):
  4152. return __ccgo_ts + 1022
  4153. case int32(_XML_ERROR_PUBLICID):
  4154. return __ccgo_ts + 1055
  4155. case int32(_XML_ERROR_SUSPENDED):
  4156. return __ccgo_ts + 1089
  4157. case int32(_XML_ERROR_NOT_SUSPENDED):
  4158. return __ccgo_ts + 1106
  4159. case int32(_XML_ERROR_ABORTED):
  4160. return __ccgo_ts + 1127
  4161. case int32(_XML_ERROR_FINISHED):
  4162. return __ccgo_ts + 1143
  4163. case int32(_XML_ERROR_SUSPEND_PE):
  4164. return __ccgo_ts + 1160
  4165. /* Added in 2.0.0. */
  4166. fallthrough
  4167. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4168. return __ccgo_ts + 1204
  4169. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4170. return __ccgo_ts + 1284
  4171. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4172. return __ccgo_ts + 1343
  4173. /* Added in 2.2.5. */
  4174. fallthrough
  4175. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4176. return __ccgo_ts + 1407
  4177. /* Added in 2.3.0. */
  4178. fallthrough
  4179. case int32(_XML_ERROR_NO_BUFFER):
  4180. return __ccgo_ts + 1424
  4181. /* Added in 2.4.0. */
  4182. fallthrough
  4183. case int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH):
  4184. return __ccgo_ts + 1486
  4185. }
  4186. return libc.UintptrFromInt32(0)
  4187. }
  4188. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4189. /* V1 is used to string-ize the version number. However, it would
  4190. string-ize the actual version macro *names* unless we get them
  4191. substituted before being passed to V1. CPP is defined to expand
  4192. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4193. the version macros, then CPP will expand the resulting V1() macro
  4194. with the correct numerals. */
  4195. /* ### I'm assuming cpp is portable in this respect... */
  4196. return __ccgo_ts + 1555
  4197. }
  4198. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4199. var version TXML_Expat_Version
  4200. _ = version
  4201. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4202. version.Fminor = int32(m_XML_MINOR_VERSION)
  4203. version.Fmicro = m_XML_MICRO_VERSION
  4204. return version
  4205. }
  4206. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4207. return uintptr(unsafe.Pointer(&_features))
  4208. }
  4209. var _features = [8]TXML_Feature{
  4210. 0: {
  4211. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4212. Fname: __ccgo_ts + 1567,
  4213. Fvalue: int32(1),
  4214. },
  4215. 1: {
  4216. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4217. Fname: __ccgo_ts + 1584,
  4218. Fvalue: int32(1),
  4219. },
  4220. 2: {
  4221. Ffeature: int32(_XML_FEATURE_DTD),
  4222. Fname: __ccgo_ts + 1602,
  4223. },
  4224. 3: {
  4225. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4226. Fname: __ccgo_ts + 1610,
  4227. Fvalue: int32(m_XML_CONTEXT_BYTES),
  4228. },
  4229. 4: {
  4230. Ffeature: int32(_XML_FEATURE_NS),
  4231. Fname: __ccgo_ts + 1628,
  4232. },
  4233. 5: {
  4234. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT),
  4235. Fname: __ccgo_ts + 1635,
  4236. Fvalue: libc.Int32FromFloat32(100),
  4237. },
  4238. 6: {
  4239. Ffeature: int32(_XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4240. Fname: __ccgo_ts + 1652,
  4241. Fvalue: int32(m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT),
  4242. },
  4243. 7: {},
  4244. }
  4245. func XXML_SetBillionLaughsAttackProtectionMaximumAmplification(tls *libc.TLS, parser TXML_Parser, maximumAmplificationFactor float32) (r TXML_Bool) {
  4246. bp := tls.Alloc(16)
  4247. defer tls.Free(16)
  4248. var v1 uint32
  4249. var v3 bool
  4250. var _ /* __u at bp+0 */ struct {
  4251. F__i [0]uint32
  4252. F__f float32
  4253. }
  4254. _, _ = v1, v3
  4255. if v3 = parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0); !v3 {
  4256. *(*float32)(unsafe.Pointer(bp)) = maximumAmplificationFactor
  4257. v1 = *(*uint32)(unsafe.Pointer(bp))
  4258. goto _2
  4259. _2:
  4260. }
  4261. if v3 || libc.BoolInt32(v1&uint32(0x7fffffff) > uint32(0x7f800000)) != 0 || maximumAmplificationFactor < libc.Float32FromFloat32(1) {
  4262. return libc.Uint8FromInt32(0)
  4263. }
  4264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FmaximumAmplificationFactor = maximumAmplificationFactor
  4265. return libc.Uint8FromInt32(1)
  4266. }
  4267. func XXML_SetBillionLaughsAttackProtectionActivationThreshold(tls *libc.TLS, parser TXML_Parser, activationThresholdBytes uint64) (r TXML_Bool) {
  4268. if parser == libc.UintptrFromInt32(0) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  4269. return libc.Uint8FromInt32(0)
  4270. }
  4271. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FactivationThresholdBytes = activationThresholdBytes
  4272. return libc.Uint8FromInt32(1)
  4273. }
  4274. // C documentation
  4275. //
  4276. // /* Initially tag->rawName always points into the parse buffer;
  4277. // for those TAG instances opened while the current parse buffer was
  4278. // processed, and not yet closed, we need to store tag->rawName in a more
  4279. // permanent location, since the parse buffer is about to be discarded.
  4280. // */
  4281. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4282. var bufSize, nameLen int32
  4283. var rawNameBuf, tag, temp uintptr
  4284. var rawNameLen Tsize_t
  4285. _, _, _, _, _, _ = bufSize, nameLen, rawNameBuf, rawNameLen, tag, temp
  4286. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4287. for tag != 0 {
  4288. nameLen = libc.Int32FromUint32(uint32(1) * libc.Uint32FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4289. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4290. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4291. at the first entry that has already been copied; everything
  4292. below it in the stack is already been accounted for in a
  4293. previous call to this function.
  4294. */
  4295. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4296. break
  4297. }
  4298. /* For re-use purposes we need to ensure that the
  4299. size of tag->buf is a multiple of sizeof(XML_Char).
  4300. */
  4301. rawNameLen = (libc.Uint32FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength) + (libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))) & ^(libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))
  4302. /* Detect and prevent integer overflow. */
  4303. if rawNameLen > libc.Uint32FromInt32(m_INT_MAX)-libc.Uint32FromInt32(nameLen) {
  4304. return libc.Uint8FromInt32(0)
  4305. }
  4306. bufSize = nameLen + libc.Int32FromUint32(rawNameLen)
  4307. if bufSize > int32((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int32((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4308. 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.Uint32FromInt32(bufSize))
  4309. if temp == libc.UintptrFromInt32(0) {
  4310. return libc.Uint8FromInt32(0)
  4311. }
  4312. /* if tag->name.str points to tag->buf (only when namespace
  4313. processing is off) then we have to update it
  4314. */
  4315. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4316. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4317. }
  4318. /* if tag->name.localPart is set (when namespace processing is on)
  4319. then update it as well, since it will always point into tag->buf
  4320. */
  4321. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4322. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int32((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int32((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4323. }
  4324. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4325. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4326. rawNameBuf = temp + uintptr(nameLen)
  4327. }
  4328. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint32FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4329. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4330. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4331. }
  4332. return libc.Uint8FromInt32(1)
  4333. }
  4334. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4335. var result _XML_Error
  4336. _ = result
  4337. 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))
  4338. if result == int32(_XML_ERROR_NONE) {
  4339. if !(_storeRawNames(tls, parser) != 0) {
  4340. return int32(_XML_ERROR_NO_MEMORY)
  4341. }
  4342. }
  4343. return result
  4344. }
  4345. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4346. var result _XML_Error
  4347. _ = result
  4348. result = _initializeEncoding(tls, parser)
  4349. if result != int32(_XML_ERROR_NONE) {
  4350. return result
  4351. }
  4352. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4353. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4354. }
  4355. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4356. bp := tls.Alloc(16)
  4357. defer tls.Free(16)
  4358. var tok int32
  4359. var _ /* next at bp+0 */ uintptr
  4360. _ = tok
  4361. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4362. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*4))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4363. switch tok {
  4364. case int32(m_XML_TOK_BOM):
  4365. if !(_accountingDiffTolerated(tls, parser, tok, start, *(*uintptr)(unsafe.Pointer(bp)), int32(2649), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  4366. _accountingOnAbort(tls, parser)
  4367. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4368. }
  4369. /* If we are at the end of the buffer, this would cause the next stage,
  4370. i.e. externalEntityInitProcessor3, to pass control directly to
  4371. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4372. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4373. */
  4374. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4375. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4376. return int32(_XML_ERROR_NONE)
  4377. }
  4378. start = *(*uintptr)(unsafe.Pointer(bp))
  4379. case -int32(1):
  4380. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4381. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4382. return int32(_XML_ERROR_NONE)
  4383. }
  4384. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4385. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4386. case -int32(2):
  4387. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4388. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4389. return int32(_XML_ERROR_NONE)
  4390. }
  4391. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4392. return int32(_XML_ERROR_PARTIAL_CHAR)
  4393. }
  4394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4395. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4396. }
  4397. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4398. bp := tls.Alloc(16)
  4399. defer tls.Free(16)
  4400. var result _XML_Error
  4401. var tok int32
  4402. var _ /* next at bp+0 */ uintptr
  4403. _, _ = result, tok
  4404. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4405. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4406. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*4))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4407. /* Note: These bytes are accounted later in:
  4408. - processXmlDecl
  4409. - externalEntityContentProcessor
  4410. */
  4411. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4412. switch tok {
  4413. case int32(m_XML_TOK_XML_DECL):
  4414. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4415. if result != int32(_XML_ERROR_NONE) {
  4416. return result
  4417. }
  4418. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4419. case int32(_XML_SUSPENDED):
  4420. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4421. return int32(_XML_ERROR_NONE)
  4422. case int32(_XML_FINISHED):
  4423. return int32(_XML_ERROR_ABORTED)
  4424. default:
  4425. start = *(*uintptr)(unsafe.Pointer(bp))
  4426. }
  4427. case -int32(1):
  4428. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4429. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4430. return int32(_XML_ERROR_NONE)
  4431. }
  4432. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4433. case -int32(2):
  4434. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4435. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4436. return int32(_XML_ERROR_NONE)
  4437. }
  4438. return int32(_XML_ERROR_PARTIAL_CHAR)
  4439. }
  4440. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4441. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4442. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4443. }
  4444. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4445. var result _XML_Error
  4446. _ = result
  4447. 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))
  4448. if result == int32(_XML_ERROR_NONE) {
  4449. if !(_storeRawNames(tls, parser) != 0) {
  4450. return int32(_XML_ERROR_NO_MEMORY)
  4451. }
  4452. }
  4453. return result
  4454. }
  4455. 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) {
  4456. bp := tls.Alloc(64)
  4457. defer tls.Free(64)
  4458. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4459. 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
  4460. var bufSize, convLen, len1, n, tok int32
  4461. var charDataHandler TXML_CharacterDataHandler
  4462. var convert_res, convert_res1 _XML_Convert_Result
  4463. var noElmHandlers TXML_Bool
  4464. var result, result1, result2, result3 _XML_Error
  4465. var _ /* bindings at bp+20 */ uintptr
  4466. var _ /* buf at bp+48 */ [4]TXML_Char
  4467. var _ /* c at bp+52 */ TXML_Char
  4468. var _ /* c at bp+8 */ TXML_Char
  4469. var _ /* ch at bp+9 */ TXML_Char
  4470. var _ /* dataPtr at bp+56 */ uintptr
  4471. var _ /* dataPtr at bp+60 */ uintptr
  4472. var _ /* fromPtr at bp+16 */ uintptr
  4473. var _ /* name at bp+24 */ TTAG_NAME
  4474. var _ /* next at bp+4 */ uintptr
  4475. var _ /* toPtr at bp+12 */ uintptr
  4476. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4477. /* save one level of indirection */
  4478. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4479. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4480. eventPP = parser + 284
  4481. eventEndPP = parser + 288
  4482. } else {
  4483. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4484. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  4485. }
  4486. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4487. for {
  4488. *(*uintptr)(unsafe.Pointer(bp + 4)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4489. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 1*4))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+4)
  4490. if tok == -int32(5) || tok == -int32(3) {
  4491. if haveMore != 0 {
  4492. v3 = *(*uintptr)(unsafe.Pointer(bp))
  4493. } else {
  4494. v3 = end
  4495. }
  4496. v2 = v3
  4497. } else {
  4498. v2 = *(*uintptr)(unsafe.Pointer(bp + 4))
  4499. }
  4500. accountAfter = v2
  4501. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), accountAfter, int32(2773), account) != 0) {
  4502. _accountingOnAbort(tls, parser)
  4503. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  4504. }
  4505. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  4506. switch tok {
  4507. case -int32(3):
  4508. if haveMore != 0 {
  4509. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4510. return int32(_XML_ERROR_NONE)
  4511. }
  4512. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4513. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4514. *(*TXML_Char)(unsafe.Pointer(bp + 8)) = int8(0xA)
  4515. (*(*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+8, int32(1))
  4516. } else {
  4517. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4518. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4519. }
  4520. }
  4521. /* We are at the end of the final buffer, should we check for
  4522. XML_SUSPENDED, XML_FINISHED?
  4523. */
  4524. if startTagLevel == 0 {
  4525. return int32(_XML_ERROR_NO_ELEMENTS)
  4526. }
  4527. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4528. return int32(_XML_ERROR_ASYNC_ENTITY)
  4529. }
  4530. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4531. return int32(_XML_ERROR_NONE)
  4532. case -int32(4):
  4533. if haveMore != 0 {
  4534. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4535. return int32(_XML_ERROR_NONE)
  4536. }
  4537. if startTagLevel > 0 {
  4538. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4539. return int32(_XML_ERROR_ASYNC_ENTITY)
  4540. }
  4541. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4542. return int32(_XML_ERROR_NONE)
  4543. }
  4544. return int32(_XML_ERROR_NO_ELEMENTS)
  4545. case m_XML_TOK_INVALID:
  4546. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  4547. return int32(_XML_ERROR_INVALID_TOKEN)
  4548. case -int32(1):
  4549. if haveMore != 0 {
  4550. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4551. return int32(_XML_ERROR_NONE)
  4552. }
  4553. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4554. case -int32(2):
  4555. if haveMore != 0 {
  4556. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4557. return int32(_XML_ERROR_NONE)
  4558. }
  4559. return int32(_XML_ERROR_PARTIAL_CHAR)
  4560. case int32(m_XML_TOK_ENTITY_REF):
  4561. *(*TXML_Char)(unsafe.Pointer(bp + 9)) = int8((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 4))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  4562. if *(*TXML_Char)(unsafe.Pointer(bp + 9)) != 0 {
  4563. /* NOTE: We are replacing 4-6 characters original input for 1 character
  4564. * so there is no amplification and hence recording without
  4565. * protection. */
  4566. _accountingDiffTolerated(tls, parser, tok, bp+9, bp+9+uintptr(1), int32(2839), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  4567. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4568. (*(*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+9, int32(1))
  4569. } else {
  4570. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4571. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4572. }
  4573. }
  4574. break
  4575. }
  4576. name = _poolStoreString(tls, dtd+80, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 4))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  4577. if !(name != 0) {
  4578. return int32(_XML_ERROR_NO_MEMORY)
  4579. }
  4580. entity = _lookup(tls, parser, dtd, name, uint32(0))
  4581. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  4582. /* First, determine if a check for an existing declaration is needed;
  4583. if yes, check that the entity exists, and that it is internal,
  4584. otherwise call the skipped entity or default handler.
  4585. */
  4586. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4587. if !(entity != 0) {
  4588. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4589. } else {
  4590. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4591. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4592. }
  4593. }
  4594. } else {
  4595. if !(entity != 0) {
  4596. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4597. (*(*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)
  4598. } else {
  4599. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4600. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4601. }
  4602. }
  4603. break
  4604. }
  4605. }
  4606. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4607. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4608. }
  4609. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4610. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4611. }
  4612. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4613. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4614. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4615. (*(*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)
  4616. } else {
  4617. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4618. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4619. }
  4620. }
  4621. break
  4622. }
  4623. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4624. if result != int32(_XML_ERROR_NONE) {
  4625. return result
  4626. }
  4627. } else {
  4628. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4629. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4630. context = _getContext(tls, parser)
  4631. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4632. if !(context != 0) {
  4633. return int32(_XML_ERROR_NO_MEMORY)
  4634. }
  4635. 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) {
  4636. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4637. }
  4638. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  4639. } else {
  4640. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4641. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4642. }
  4643. }
  4644. }
  4645. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4646. /* fall through */
  4647. fallthrough
  4648. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4649. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4650. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4651. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4652. } else {
  4653. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(48))
  4654. if !(tag != 0) {
  4655. return int32(_XML_ERROR_NO_MEMORY)
  4656. }
  4657. (*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.Uint32FromInt32(libc.Int32FromInt32(m_INIT_TAG_BUF_SIZE)))
  4658. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4659. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4660. return int32(_XML_ERROR_NO_MEMORY)
  4661. }
  4662. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4663. }
  4664. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4665. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4666. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4667. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4668. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4669. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4670. (*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)
  4671. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4672. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4673. *(*uintptr)(unsafe.Pointer(bp + 16)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4674. *(*uintptr)(unsafe.Pointer(bp + 12)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4675. for {
  4676. 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+16, rawNameEnd, bp+12, (*TTAG)(unsafe.Pointer(tag)).FbufEnd-uintptr(1))
  4677. convLen = int32(*(*uintptr)(unsafe.Pointer(bp + 12))) - int32((*TTAG)(unsafe.Pointer(tag)).Fbuf)
  4678. if *(*uintptr)(unsafe.Pointer(bp + 16)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4679. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4680. break
  4681. }
  4682. bufSize = (int32((*TTAG)(unsafe.Pointer(tag)).FbufEnd) - int32((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4683. 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.Uint32FromInt32(bufSize))
  4684. if temp == libc.UintptrFromInt32(0) {
  4685. return int32(_XML_ERROR_NO_MEMORY)
  4686. }
  4687. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4688. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4689. *(*uintptr)(unsafe.Pointer(bp + 12)) = temp + uintptr(convLen)
  4690. goto _4
  4691. _4:
  4692. }
  4693. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4694. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 12)))) = int8('\000')
  4695. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+12, tag+44, account)
  4696. if result1 != 0 {
  4697. return result1
  4698. }
  4699. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4700. (*(*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)
  4701. } else {
  4702. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4703. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4704. }
  4705. }
  4706. _poolClear(tls, parser+412)
  4707. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4708. /* fall through */
  4709. fallthrough
  4710. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4711. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4712. *(*uintptr)(unsafe.Pointer(bp + 20)) = libc.UintptrFromInt32(0)
  4713. noElmHandlers = libc.Uint8FromInt32(1)
  4714. (*(*TTAG_NAME)(unsafe.Pointer(bp + 24))).Fstr = _poolStoreString(tls, parser+412, enc, rawName, rawName+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName)))
  4715. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 24))).Fstr != 0) {
  4716. return int32(_XML_ERROR_NO_MEMORY)
  4717. }
  4718. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  4719. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+24, bp+20, int32(_XML_ACCOUNT_NONE))
  4720. if result2 != int32(_XML_ERROR_NONE) {
  4721. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 20)))
  4722. return result2
  4723. }
  4724. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  4725. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4726. (*(*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 + 24))).Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4727. noElmHandlers = libc.Uint8FromInt32(0)
  4728. }
  4729. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4730. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4731. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4732. }
  4733. (*(*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 + 24))).Fstr)
  4734. noElmHandlers = libc.Uint8FromInt32(0)
  4735. }
  4736. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4737. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4738. }
  4739. _poolClear(tls, parser+412)
  4740. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 20)))
  4741. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4742. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4743. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4744. } else {
  4745. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 4)), end, nextPtr)
  4746. }
  4747. }
  4748. case int32(m_XML_TOK_END_TAG):
  4749. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4750. return int32(_XML_ERROR_ASYNC_ENTITY)
  4751. } else {
  4752. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4753. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4754. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4755. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint32FromInt32(len1)) != 0 {
  4756. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4757. return int32(_XML_ERROR_TAG_MISMATCH)
  4758. }
  4759. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4760. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4761. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4762. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4763. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4764. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4765. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4766. /* localPart and prefix may have been overwritten in
  4767. tag->name.str, since this points to the binding->uri
  4768. buffer which gets re-used; so we have to add them again
  4769. */
  4770. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4771. /* don't need to check for space - already done in storeAtts() */
  4772. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4773. v5 = uri
  4774. uri++
  4775. v6 = localPart
  4776. localPart++
  4777. *(*TXML_Char)(unsafe.Pointer(v5)) = *(*TXML_Char)(unsafe.Pointer(v6))
  4778. }
  4779. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4780. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4781. v7 = uri
  4782. uri++
  4783. *(*TXML_Char)(unsafe.Pointer(v7)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4784. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4785. v8 = uri
  4786. uri++
  4787. v9 = prefix
  4788. prefix++
  4789. *(*TXML_Char)(unsafe.Pointer(v8)) = *(*TXML_Char)(unsafe.Pointer(v9))
  4790. }
  4791. }
  4792. *(*TXML_Char)(unsafe.Pointer(uri)) = int8('\000')
  4793. }
  4794. (*(*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)
  4795. } else {
  4796. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4797. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4798. }
  4799. }
  4800. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4801. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4802. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4803. (*(*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)
  4804. }
  4805. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4806. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4807. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4808. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4809. }
  4810. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4811. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4812. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4813. } else {
  4814. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 4)), end, nextPtr)
  4815. }
  4816. }
  4817. }
  4818. case int32(m_XML_TOK_CHAR_REF):
  4819. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4820. if n < 0 {
  4821. return int32(_XML_ERROR_BAD_CHAR_REF)
  4822. }
  4823. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4824. (*(*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+48, XXmlUtf8Encode(tls, n, bp+48))
  4825. } else {
  4826. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4827. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4828. }
  4829. }
  4830. case int32(m_XML_TOK_XML_DECL):
  4831. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4832. case int32(m_XML_TOK_DATA_NEWLINE):
  4833. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4834. *(*TXML_Char)(unsafe.Pointer(bp + 52)) = int8(0xA)
  4835. (*(*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+52, int32(1))
  4836. } else {
  4837. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4838. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4839. }
  4840. }
  4841. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4842. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4843. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4844. } else {
  4845. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4846. (*(*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)
  4847. } else {
  4848. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4849. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4850. }
  4851. }
  4852. }
  4853. result3 = _doCdataSection(tls, parser, enc, bp+4, end, nextPtr, haveMore, account)
  4854. if result3 != int32(_XML_ERROR_NONE) {
  4855. return result3
  4856. } else {
  4857. if !(*(*uintptr)(unsafe.Pointer(bp + 4)) != 0) {
  4858. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4859. return result3
  4860. }
  4861. }
  4862. case -int32(5):
  4863. if haveMore != 0 {
  4864. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4865. return int32(_XML_ERROR_NONE)
  4866. }
  4867. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4868. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4869. *(*uintptr)(unsafe.Pointer(bp + 56)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4870. (*(*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+56, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  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, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(*(*uintptr)(unsafe.Pointer(bp + 56)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  4872. } else {
  4873. (*(*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(end)-int32(*(*uintptr)(unsafe.Pointer(bp))))
  4874. }
  4875. } else {
  4876. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4877. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4878. }
  4879. }
  4880. /* We are at the end of the final buffer, should we check for
  4881. XML_SUSPENDED, XML_FINISHED?
  4882. */
  4883. if startTagLevel == 0 {
  4884. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4885. return int32(_XML_ERROR_NO_ELEMENTS)
  4886. }
  4887. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4888. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4889. return int32(_XML_ERROR_ASYNC_ENTITY)
  4890. }
  4891. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4892. return int32(_XML_ERROR_NONE)
  4893. case int32(m_XML_TOK_DATA_CHARS):
  4894. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4895. if charDataHandler != 0 {
  4896. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4897. for {
  4898. *(*uintptr)(unsafe.Pointer(bp + 60)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4899. 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 + 4)), bp+60, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4900. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4901. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 60)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  4902. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4903. break
  4904. }
  4905. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4906. goto _10
  4907. _10:
  4908. }
  4909. } else {
  4910. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(*(*uintptr)(unsafe.Pointer(bp + 4)))-int32(*(*uintptr)(unsafe.Pointer(bp))))
  4911. }
  4912. } else {
  4913. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4914. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4915. }
  4916. }
  4917. case int32(m_XML_TOK_PI):
  4918. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) != 0) {
  4919. return int32(_XML_ERROR_NO_MEMORY)
  4920. }
  4921. case int32(m_XML_TOK_COMMENT):
  4922. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4))) != 0) {
  4923. return int32(_XML_ERROR_NO_MEMORY)
  4924. }
  4925. default:
  4926. /* All of the tokens produced by XmlContentTok() have their own
  4927. * explicit cases, so this default is not strictly necessary.
  4928. * However it is a useful safety net, so we retain the code and
  4929. * simply exclude it from the coverage tests.
  4930. *
  4931. * LCOV_EXCL_START
  4932. */
  4933. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4934. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  4935. }
  4936. break
  4937. /* LCOV_EXCL_STOP */
  4938. }
  4939. v11 = *(*uintptr)(unsafe.Pointer(bp + 4))
  4940. *(*uintptr)(unsafe.Pointer(bp)) = v11
  4941. *(*uintptr)(unsafe.Pointer(eventPP)) = v11
  4942. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4943. case int32(_XML_SUSPENDED):
  4944. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  4945. return int32(_XML_ERROR_NONE)
  4946. case int32(_XML_FINISHED):
  4947. return int32(_XML_ERROR_ABORTED)
  4948. default:
  4949. }
  4950. goto _1
  4951. _1:
  4952. }
  4953. /* not reached */
  4954. return r
  4955. }
  4956. // C documentation
  4957. //
  4958. // /* This function does not call free() on the allocated memory, merely
  4959. // * moving it to the parser's m_freeBindingList where it can be freed or
  4960. // * reused as appropriate.
  4961. // */
  4962. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4963. var b uintptr
  4964. _ = b
  4965. for bindings != 0 {
  4966. b = bindings
  4967. /* m_startNamespaceDeclHandler will have been called for this
  4968. * binding in addBindings(), so call the end handler now.
  4969. */
  4970. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4971. (*(*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)
  4972. }
  4973. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4974. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4975. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4976. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4977. }
  4978. }
  4979. // C documentation
  4980. //
  4981. // /* Precondition: all arguments must be non-NULL;
  4982. // Purpose:
  4983. // - normalize attributes
  4984. // - check attributes for well-formedness
  4985. // - generate namespace aware attribute names (URI, prefix)
  4986. // - build list of attributes for startElementHandler
  4987. // - default attributes
  4988. // - process namespace declarations (check and report them)
  4989. // - generate namespace aware element name (URI, prefix)
  4990. // */
  4991. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr, account _XML_Account) (r _XML_Error) {
  4992. bp := tls.Alloc(80)
  4993. defer tls.Free(80)
  4994. 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
  4995. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  4996. var c TXML_Char
  4997. var isCdata TXML_Bool
  4998. var mask, nsAttsSize, uriHash, version, v14 uint32
  4999. var oldNsAttsPower, step, v10 uint8
  5000. var result, result1, result2 _XML_Error
  5001. var _ /* sip_key at bp+52 */ Tsipkey
  5002. var _ /* sip_state at bp+0 */ Tsiphash
  5003. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  5004. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  5005. attIndex = 0
  5006. nPrefixes = 0
  5007. /* lookup the element type name */
  5008. elementType = _lookup(tls, parser, dtd+20, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint32(0))
  5009. if !(elementType != 0) {
  5010. name = _poolCopyString(tls, dtd+80, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  5011. if !(name != 0) {
  5012. return int32(_XML_ERROR_NO_MEMORY)
  5013. }
  5014. elementType = _lookup(tls, parser, dtd+20, name, uint32(24))
  5015. if !(elementType != 0) {
  5016. return int32(_XML_ERROR_NO_MEMORY)
  5017. }
  5018. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  5019. return int32(_XML_ERROR_NO_MEMORY)
  5020. }
  5021. }
  5022. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  5023. /* get the attributes from the tokenizer */
  5024. 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)
  5025. /* Detect and prevent integer overflow */
  5026. if n > int32(m_INT_MAX)-nDefaultAtts {
  5027. return int32(_XML_ERROR_NO_MEMORY)
  5028. }
  5029. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  5030. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  5031. /* Detect and prevent integer overflow */
  5032. if nDefaultAtts > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_INIT_ATTS_SIZE) || n > int32(m_INT_MAX)-(nDefaultAtts+int32(m_INIT_ATTS_SIZE)) {
  5033. return int32(_XML_ERROR_NO_MEMORY)
  5034. }
  5035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  5036. /* Detect and prevent integer overflow.
  5037. * The preprocessor guard addresses the "always false" warning
  5038. * from -Wtype-limits on platforms where
  5039. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5040. if libc.Uint32FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(16) {
  5041. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5042. return int32(_XML_ERROR_NO_MEMORY)
  5043. }
  5044. 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.Uint32FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint32FromInt64(16))
  5045. if temp == libc.UintptrFromInt32(0) {
  5046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  5047. return int32(_XML_ERROR_NO_MEMORY)
  5048. }
  5049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  5050. if n > oldAttsSize {
  5051. (*(*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)
  5052. }
  5053. }
  5054. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  5055. i = 0
  5056. for {
  5057. if !(i < n) {
  5058. break
  5059. }
  5060. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16
  5061. /* add the name and value to the attribute list */
  5062. 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)))
  5063. if !(attId != 0) {
  5064. return int32(_XML_ERROR_NO_MEMORY)
  5065. }
  5066. /* Detect duplicate attributes by their QNames. This does not work when
  5067. namespace processing is turned on and different prefixes for the same
  5068. namespace are used. For this case we have a check further down.
  5069. */
  5070. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5071. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).Fname
  5073. }
  5074. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5075. }
  5076. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5077. v2 = attIndex
  5078. attIndex++
  5079. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*4)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5080. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).Fnormalized != 0) {
  5081. isCdata = libc.Uint8FromInt32(1)
  5082. /* figure out whether declared as other than CDATA */
  5083. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5084. j = 0
  5085. for {
  5086. if !(j < nDefaultAtts) {
  5087. break
  5088. }
  5089. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*12))).Fid {
  5090. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*12))).FisCdata
  5091. break
  5092. }
  5093. goto _3
  5094. _3:
  5095. ;
  5096. j++
  5097. }
  5098. }
  5099. /* normalize the attribute value */
  5100. result = _storeAttributeValue(tls, parser, enc, isCdata, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvalueEnd, parser+412, account)
  5101. if result != 0 {
  5102. return result
  5103. }
  5104. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  5105. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  5106. } else {
  5107. /* the value did not need normalizing */
  5108. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) = _poolStoreString(tls, parser+412, enc, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*16))).FvalueEnd)
  5109. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) == uintptr(0) {
  5110. return int32(_XML_ERROR_NO_MEMORY)
  5111. }
  5112. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  5113. }
  5114. /* handle prefixed attribute names */
  5115. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5116. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5117. /* deal with namespace declarations here */
  5118. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)), bindingsPtr)
  5119. if result1 != 0 {
  5120. return result1
  5121. }
  5122. attIndex--
  5123. } else {
  5124. /* deal with other prefixed names later */
  5125. attIndex++
  5126. nPrefixes++
  5127. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5128. }
  5129. } else {
  5130. attIndex++
  5131. }
  5132. goto _1
  5133. _1:
  5134. ;
  5135. i++
  5136. }
  5137. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5138. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5139. 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 {
  5140. i = 0
  5141. for {
  5142. if !(i < attIndex) {
  5143. break
  5144. }
  5145. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5146. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5147. break
  5148. }
  5149. goto _4
  5150. _4:
  5151. ;
  5152. i += int32(2)
  5153. }
  5154. } else {
  5155. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5156. }
  5157. /* do attribute defaulting */
  5158. i = 0
  5159. for {
  5160. if !(i < nDefaultAtts) {
  5161. break
  5162. }
  5163. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*12
  5164. 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 {
  5165. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5166. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5167. 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)
  5168. if result2 != 0 {
  5169. return result2
  5170. }
  5171. } else {
  5172. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(2)
  5173. nPrefixes++
  5174. v6 = attIndex
  5175. attIndex++
  5176. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*4)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5177. v7 = attIndex
  5178. attIndex++
  5179. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*4)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5180. }
  5181. } else {
  5182. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = int8(1)
  5183. v8 = attIndex
  5184. attIndex++
  5185. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*4)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5186. v9 = attIndex
  5187. attIndex++
  5188. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*4)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5189. }
  5190. }
  5191. goto _5
  5192. _5:
  5193. ;
  5194. i++
  5195. }
  5196. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*4)) = uintptr(0)
  5197. /* expand prefixed attribute names, check for duplicates,
  5198. and clear flags that say whether attributes were specified */
  5199. i = 0
  5200. if nPrefixes != 0 { /* hash table index */
  5201. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5202. /* Detect and prevent invalid shift */
  5203. if uint32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8) {
  5204. return int32(_XML_ERROR_NO_MEMORY)
  5205. }
  5206. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5207. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5208. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5209. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5210. /* hash table size must also be a power of 2 and >= 8 */
  5211. for {
  5212. v11 = parser + 400
  5213. v10 = *(*uint8)(unsafe.Pointer(v11))
  5214. *(*uint8)(unsafe.Pointer(v11))++
  5215. if !(nPrefixes>>v10 != 0) {
  5216. break
  5217. }
  5218. }
  5219. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5220. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5221. }
  5222. /* Detect and prevent invalid shift */
  5223. if uint32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8) {
  5224. /* Restore actual size of memory in m_nsAtts */
  5225. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5226. return int32(_XML_ERROR_NO_MEMORY)
  5227. }
  5228. nsAttsSize = uint32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5229. /* Detect and prevent integer overflow.
  5230. * The preprocessor guard addresses the "always false" warning
  5231. * from -Wtype-limits on platforms where
  5232. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5233. if nsAttsSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(12) {
  5234. /* Restore actual size of memory in m_nsAtts */
  5235. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5236. return int32(_XML_ERROR_NO_MEMORY)
  5237. }
  5238. 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, nsAttsSize*libc.Uint32FromInt64(12))
  5239. if !(temp1 != 0) {
  5240. /* Restore actual size of memory in m_nsAtts */
  5241. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5242. return int32(_XML_ERROR_NO_MEMORY)
  5243. }
  5244. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5245. version = uint32(0) /* force re-initialization of m_nsAtts hash table */
  5246. }
  5247. /* using a version flag saves us from initializing m_nsAtts every time */
  5248. if !(version != 0) { /* initialize version flags when version wraps around */
  5249. version = uint32(m_INIT_ATTS_VERSION)
  5250. j1 = libc.Int32FromUint32(nsAttsSize)
  5251. for {
  5252. if !(j1 != 0) {
  5253. break
  5254. }
  5255. j1--
  5256. v13 = j1
  5257. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*12))).Fversion = version
  5258. goto _12
  5259. _12:
  5260. }
  5261. }
  5262. version--
  5263. v14 = version
  5264. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5265. /* expand prefixed names and check for duplicates */
  5266. for {
  5267. if !(i < attIndex) {
  5268. break
  5269. }
  5270. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4))
  5271. if int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5272. _copy_salt_to_sipkey(tls, parser, bp+52)
  5273. _sip24_init(tls, bp, bp+52)
  5274. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0 /* clear flag */
  5275. id = _lookup(tls, parser, dtd+40, s, uint32(0))
  5276. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5277. /* This code is walking through the appAtts array, dealing
  5278. * with (in this case) a prefixed attribute name. To be in
  5279. * the array, the attribute must have already been bound, so
  5280. * has to have passed through the hash table lookup once
  5281. * already. That implies that an entry for it already
  5282. * exists, so the lookup above will return a pointer to
  5283. * already allocated memory. There is no opportunaity for
  5284. * the allocator to fail, so the condition above cannot be
  5285. * fulfilled.
  5286. *
  5287. * Since it is difficult to be certain that the above
  5288. * analysis is complete, we retain the test and merely
  5289. * remove the code from coverage tests.
  5290. */
  5291. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5292. }
  5293. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5294. if !(b != 0) {
  5295. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5296. }
  5297. j1 = 0
  5298. for {
  5299. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5300. break
  5301. }
  5302. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5303. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  5304. v17 = 0
  5305. } else {
  5306. v19 = parser + 412 + 12
  5307. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5308. *(*uintptr)(unsafe.Pointer(v19))++
  5309. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5310. v17 = libc.Int32FromInt32(1)
  5311. }
  5312. if !(v17 != 0) {
  5313. return int32(_XML_ERROR_NO_MEMORY)
  5314. }
  5315. goto _16
  5316. _16:
  5317. ;
  5318. j1++
  5319. }
  5320. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint32FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint32(1))
  5321. for {
  5322. v20 = s
  5323. s++
  5324. if !(int32(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5325. break
  5326. }
  5327. }
  5328. _sip24_update(tls, bp, s, _keylen(tls, s)*uint32(1))
  5329. for { /* copies null terminator */
  5330. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  5331. v23 = 0
  5332. } else {
  5333. v25 = parser + 412 + 12
  5334. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5335. *(*uintptr)(unsafe.Pointer(v25))++
  5336. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5337. v23 = libc.Int32FromInt32(1)
  5338. }
  5339. if !(v23 != 0) {
  5340. return int32(_XML_ERROR_NO_MEMORY)
  5341. }
  5342. goto _22
  5343. _22:
  5344. ;
  5345. v21 = s
  5346. s++
  5347. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5348. break
  5349. }
  5350. }
  5351. uriHash = uint32(_sip24_final(tls, bp))
  5352. /* Check hash table for duplicate of expanded name (uriName).
  5353. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5354. */
  5355. step = uint8(0)
  5356. mask = nsAttsSize - uint32(1)
  5357. j1 = libc.Int32FromUint32(uriHash & mask) /* index into hash table */
  5358. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fversion == version {
  5359. /* for speed we compare stored hash values first */
  5360. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fhash {
  5361. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  5362. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).FuriName
  5363. /* s1 is null terminated, but not s2 */
  5364. for {
  5365. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2))) && int32(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5366. break
  5367. }
  5368. goto _26
  5369. _26:
  5370. ;
  5371. s1++
  5372. s2++
  5373. }
  5374. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5375. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5376. }
  5377. }
  5378. if !(step != 0) {
  5379. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  5380. }
  5381. if j1 < libc.Int32FromUint8(step) {
  5382. j1 = int32(uint32(j1) + (nsAttsSize - uint32(step)))
  5383. } else {
  5384. j1 -= libc.Int32FromUint8(step)
  5385. }
  5386. }
  5387. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5388. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5389. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5390. for {
  5391. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  5392. v30 = 0
  5393. } else {
  5394. v32 = parser + 412 + 12
  5395. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5396. *(*uintptr)(unsafe.Pointer(v32))++
  5397. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5398. v30 = libc.Int32FromInt32(1)
  5399. }
  5400. if !(v30 != 0) {
  5401. return int32(_XML_ERROR_NO_MEMORY)
  5402. }
  5403. goto _29
  5404. _29:
  5405. ;
  5406. v28 = s
  5407. s++
  5408. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5409. break
  5410. }
  5411. }
  5412. }
  5413. /* store expanded name in attribute list */
  5414. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  5415. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  5416. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4)) = s
  5417. /* fill empty slot with new version, uriName and hash value */
  5418. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fversion = version
  5419. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).Fhash = uriHash
  5420. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*12))).FuriName = s
  5421. nPrefixes--
  5422. v33 = nPrefixes
  5423. if !(v33 != 0) {
  5424. i += int32(2)
  5425. break
  5426. }
  5427. } else { /* not prefixed */
  5428. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = 0
  5429. } /* clear flag */
  5430. goto _15
  5431. _15:
  5432. ;
  5433. i += int32(2)
  5434. }
  5435. }
  5436. /* clear flags for the remaining attributes */
  5437. for {
  5438. if !(i < attIndex) {
  5439. break
  5440. }
  5441. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*4)) + uintptr(-libc.Int32FromInt32(1)))) = 0
  5442. goto _34
  5443. _34:
  5444. ;
  5445. i += int32(2)
  5446. }
  5447. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5448. for {
  5449. if !(binding != 0) {
  5450. break
  5451. }
  5452. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = 0
  5453. goto _35
  5454. _35:
  5455. ;
  5456. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5457. }
  5458. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5459. return int32(_XML_ERROR_NONE)
  5460. }
  5461. /* expand the element type name */
  5462. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5463. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5464. if !(binding != 0) {
  5465. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5466. }
  5467. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5468. for {
  5469. v36 = localPart
  5470. localPart++
  5471. if !(int32(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5472. break
  5473. }
  5474. }
  5475. } else {
  5476. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5477. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5478. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5479. } else {
  5480. return int32(_XML_ERROR_NONE)
  5481. }
  5482. }
  5483. prefixLen = 0
  5484. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5485. for {
  5486. v38 = prefixLen
  5487. prefixLen++
  5488. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5489. break
  5490. }
  5491. goto _37
  5492. _37:
  5493. } /* prefixLen includes null terminator */
  5494. }
  5495. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5496. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5497. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5498. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5499. i = 0
  5500. for {
  5501. v40 = i
  5502. i++
  5503. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5504. break
  5505. }
  5506. goto _39
  5507. _39:
  5508. } /* i includes null terminator */
  5509. /* Detect and prevent integer overflow */
  5510. if (*TBINDING)(unsafe.Pointer(binding)).FuriLen > int32(m_INT_MAX)-prefixLen || i > int32(m_INT_MAX)-((*TBINDING)(unsafe.Pointer(binding)).FuriLen+prefixLen) {
  5511. return int32(_XML_ERROR_NO_MEMORY)
  5512. }
  5513. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5514. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5515. /* Detect and prevent integer overflow */
  5516. if n > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5517. return int32(_XML_ERROR_NO_MEMORY)
  5518. }
  5519. /* Detect and prevent integer overflow.
  5520. * The preprocessor guard addresses the "always false" warning
  5521. * from -Wtype-limits on platforms where
  5522. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5523. if libc.Uint32FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE)) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  5524. return int32(_XML_ERROR_NO_MEMORY)
  5525. }
  5526. uri = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE))*libc.Uint32FromInt64(1))
  5527. if !(uri != 0) {
  5528. return int32(_XML_ERROR_NO_MEMORY)
  5529. }
  5530. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5531. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint32FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint32(1))
  5532. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5533. for {
  5534. if !(p != 0) {
  5535. break
  5536. }
  5537. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5538. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5539. }
  5540. goto _41
  5541. _41:
  5542. ;
  5543. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5544. }
  5545. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5546. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5547. }
  5548. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5549. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5550. libc.Xmemcpy(tls, uri, localPart, libc.Uint32FromInt32(i)*uint32(1))
  5551. /* we always have a namespace separator between localPart and prefix */
  5552. if prefixLen != 0 {
  5553. uri += uintptr(i - int32(1))
  5554. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5555. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint32FromInt32(prefixLen)*uint32(1))
  5556. }
  5557. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5558. return int32(_XML_ERROR_NONE)
  5559. }
  5560. func _is_rfc3986_uri_char(tls *libc.TLS, candidate TXML_Char) (r TXML_Bool) {
  5561. // For the RFC 3986 ANBF grammar see
  5562. // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
  5563. switch int32(candidate) {
  5564. // From rule "ALPHA" (uppercase half)
  5565. case int32('A'):
  5566. fallthrough
  5567. case int32('B'):
  5568. fallthrough
  5569. case int32('C'):
  5570. fallthrough
  5571. case int32('D'):
  5572. fallthrough
  5573. case int32('E'):
  5574. fallthrough
  5575. case int32('F'):
  5576. fallthrough
  5577. case int32('G'):
  5578. fallthrough
  5579. case int32('H'):
  5580. fallthrough
  5581. case int32('I'):
  5582. fallthrough
  5583. case int32('J'):
  5584. fallthrough
  5585. case int32('K'):
  5586. fallthrough
  5587. case int32('L'):
  5588. fallthrough
  5589. case int32('M'):
  5590. fallthrough
  5591. case int32('N'):
  5592. fallthrough
  5593. case int32('O'):
  5594. fallthrough
  5595. case int32('P'):
  5596. fallthrough
  5597. case int32('Q'):
  5598. fallthrough
  5599. case int32('R'):
  5600. fallthrough
  5601. case int32('S'):
  5602. fallthrough
  5603. case int32('T'):
  5604. fallthrough
  5605. case int32('U'):
  5606. fallthrough
  5607. case int32('V'):
  5608. fallthrough
  5609. case int32('W'):
  5610. fallthrough
  5611. case int32('X'):
  5612. fallthrough
  5613. case int32('Y'):
  5614. fallthrough
  5615. case int32('Z'):
  5616. // From rule "ALPHA" (lowercase half)
  5617. fallthrough
  5618. case int32('a'):
  5619. fallthrough
  5620. case int32('b'):
  5621. fallthrough
  5622. case int32('c'):
  5623. fallthrough
  5624. case int32('d'):
  5625. fallthrough
  5626. case int32('e'):
  5627. fallthrough
  5628. case int32('f'):
  5629. fallthrough
  5630. case int32('g'):
  5631. fallthrough
  5632. case int32('h'):
  5633. fallthrough
  5634. case int32('i'):
  5635. fallthrough
  5636. case int32('j'):
  5637. fallthrough
  5638. case int32('k'):
  5639. fallthrough
  5640. case int32('l'):
  5641. fallthrough
  5642. case int32('m'):
  5643. fallthrough
  5644. case int32('n'):
  5645. fallthrough
  5646. case int32('o'):
  5647. fallthrough
  5648. case int32('p'):
  5649. fallthrough
  5650. case int32('q'):
  5651. fallthrough
  5652. case int32('r'):
  5653. fallthrough
  5654. case int32('s'):
  5655. fallthrough
  5656. case int32('t'):
  5657. fallthrough
  5658. case int32('u'):
  5659. fallthrough
  5660. case int32('v'):
  5661. fallthrough
  5662. case int32('w'):
  5663. fallthrough
  5664. case int32('x'):
  5665. fallthrough
  5666. case int32('y'):
  5667. fallthrough
  5668. case int32('z'):
  5669. // From rule "DIGIT"
  5670. fallthrough
  5671. case int32('0'):
  5672. fallthrough
  5673. case int32('1'):
  5674. fallthrough
  5675. case int32('2'):
  5676. fallthrough
  5677. case int32('3'):
  5678. fallthrough
  5679. case int32('4'):
  5680. fallthrough
  5681. case int32('5'):
  5682. fallthrough
  5683. case int32('6'):
  5684. fallthrough
  5685. case int32('7'):
  5686. fallthrough
  5687. case int32('8'):
  5688. fallthrough
  5689. case int32('9'):
  5690. // From rule "pct-encoded"
  5691. fallthrough
  5692. case int32('%'):
  5693. // From rule "unreserved"
  5694. fallthrough
  5695. case int32('-'):
  5696. fallthrough
  5697. case int32('.'):
  5698. fallthrough
  5699. case int32('_'):
  5700. fallthrough
  5701. case int32('~'):
  5702. // From rule "gen-delims"
  5703. fallthrough
  5704. case int32(':'):
  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. // From rule "sub-delims"
  5718. fallthrough
  5719. case int32('!'):
  5720. fallthrough
  5721. case int32('$'):
  5722. fallthrough
  5723. case int32('&'):
  5724. fallthrough
  5725. case int32('\''):
  5726. fallthrough
  5727. case int32('('):
  5728. fallthrough
  5729. case int32(')'):
  5730. fallthrough
  5731. case int32('*'):
  5732. fallthrough
  5733. case int32('+'):
  5734. fallthrough
  5735. case int32(','):
  5736. fallthrough
  5737. case int32(';'):
  5738. fallthrough
  5739. case int32('='):
  5740. return libc.Uint8FromInt32(1)
  5741. default:
  5742. return libc.Uint8FromInt32(0)
  5743. }
  5744. return r
  5745. }
  5746. // C documentation
  5747. //
  5748. // /* addBinding() overwrites the value of prefix->binding without checking.
  5749. // Therefore one must keep track of the old value outside of addBinding().
  5750. // */
  5751. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5752. var b, temp, v3 uintptr
  5753. var isXML, isXMLNS, mustBeXML TXML_Bool
  5754. var len1, v2 int32
  5755. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5756. mustBeXML = libc.Uint8FromInt32(0)
  5757. isXML = libc.Uint8FromInt32(1)
  5758. isXMLNS = libc.Uint8FromInt32(1)
  5759. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5760. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5761. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5762. }
  5763. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5764. /* Not allowed to bind xmlns */
  5765. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5766. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5767. }
  5768. if int32(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5769. mustBeXML = libc.Uint8FromInt32(1)
  5770. }
  5771. }
  5772. len1 = 0
  5773. for {
  5774. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5775. break
  5776. }
  5777. if isXML != 0 && (len1 > _xmlLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlNamespace[len1])) {
  5778. isXML = libc.Uint8FromInt32(0)
  5779. }
  5780. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != int32(_xmlnsNamespace[len1])) {
  5781. isXMLNS = libc.Uint8FromInt32(0)
  5782. }
  5783. // NOTE: While Expat does not validate namespace URIs against RFC 3986
  5784. // today (and is not REQUIRED to do so with regard to the XML 1.0
  5785. // namespaces specification) we have to at least make sure, that
  5786. // the application on top of Expat (that is likely splitting expanded
  5787. // element names ("qualified names") of form
  5788. // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces
  5789. // in its element handler code) cannot be confused by an attacker
  5790. // putting additional namespace separator characters into namespace
  5791. // declarations. That would be ambiguous and not to be expected.
  5792. //
  5793. // While the HTML API docs of function XML_ParserCreateNS have been
  5794. // advising against use of a namespace separator character that can
  5795. // appear in a URI for >20 years now, some widespread applications
  5796. // are using URI characters (':' (colon) in particular) for a
  5797. // namespace separator, in practice. To keep these applications
  5798. // functional, we only reject namespaces URIs containing the
  5799. // application-chosen namespace separator if the chosen separator
  5800. // is a non-URI character with regard to RFC 3986.
  5801. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && int32(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) == int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator) && !(_is_rfc3986_uri_char(tls, *(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != 0) {
  5802. return int32(_XML_ERROR_SYNTAX)
  5803. }
  5804. goto _1
  5805. _1:
  5806. ;
  5807. len1++
  5808. }
  5809. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5810. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5811. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5812. if mustBeXML != 0 {
  5813. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5814. } else {
  5815. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5816. }
  5817. return v2
  5818. }
  5819. if isXMLNS != 0 {
  5820. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5821. }
  5822. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5823. len1++
  5824. }
  5825. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5826. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5827. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5828. /* Detect and prevent integer overflow */
  5829. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5830. return int32(_XML_ERROR_NO_MEMORY)
  5831. }
  5832. /* Detect and prevent integer overflow.
  5833. * The preprocessor guard addresses the "always false" warning
  5834. * from -Wtype-limits on platforms where
  5835. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5836. if libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  5837. return int32(_XML_ERROR_NO_MEMORY)
  5838. }
  5839. 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.Uint32FromInt64(1)*libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5840. if temp == libc.UintptrFromInt32(0) {
  5841. return int32(_XML_ERROR_NO_MEMORY)
  5842. }
  5843. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5844. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5845. }
  5846. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5847. } else {
  5848. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(28))
  5849. if !(b != 0) {
  5850. return int32(_XML_ERROR_NO_MEMORY)
  5851. }
  5852. /* Detect and prevent integer overflow */
  5853. if len1 > libc.Int32FromInt32(m_INT_MAX)-libc.Int32FromInt32(m_EXPAND_SPARE) {
  5854. return int32(_XML_ERROR_NO_MEMORY)
  5855. }
  5856. /* Detect and prevent integer overflow.
  5857. * The preprocessor guard addresses the "always false" warning
  5858. * from -Wtype-limits on platforms where
  5859. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  5860. if libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  5861. return int32(_XML_ERROR_NO_MEMORY)
  5862. }
  5863. (*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.Uint32FromInt64(1)*libc.Uint32FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5864. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5865. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5866. return int32(_XML_ERROR_NO_MEMORY)
  5867. }
  5868. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5869. }
  5870. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5871. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint32FromInt32(len1)*uint32(1))
  5872. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5873. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5874. }
  5875. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5876. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5877. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5878. /* NULL binding when default namespace undeclared */
  5879. if int32(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+152 {
  5880. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5881. } else {
  5882. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5883. }
  5884. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5885. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5886. /* if attId == NULL then we are not starting a namespace scope */
  5887. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5888. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5889. v3 = uri
  5890. } else {
  5891. v3 = uintptr(0)
  5892. }
  5893. (*(*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)
  5894. }
  5895. return int32(_XML_ERROR_NONE)
  5896. }
  5897. // "http://www.w3.org/XML/1998/namespace"
  5898. var _xmlNamespace = [37]TXML_Char{
  5899. 0: int8(m_ASCII_h),
  5900. 1: int8(m_ASCII_t),
  5901. 2: int8(m_ASCII_t),
  5902. 3: int8(m_ASCII_p),
  5903. 4: int8(m_ASCII_COLON),
  5904. 5: int8(m_ASCII_SLASH),
  5905. 6: int8(m_ASCII_SLASH),
  5906. 7: int8(m_ASCII_w),
  5907. 8: int8(m_ASCII_w),
  5908. 9: int8(m_ASCII_w),
  5909. 10: int8(m_ASCII_PERIOD),
  5910. 11: int8(m_ASCII_w),
  5911. 12: int8(m_ASCII_3),
  5912. 13: int8(m_ASCII_PERIOD),
  5913. 14: int8(m_ASCII_o),
  5914. 15: int8(m_ASCII_r),
  5915. 16: int8(m_ASCII_g),
  5916. 17: int8(m_ASCII_SLASH),
  5917. 18: int8(m_ASCII_X),
  5918. 19: int8(m_ASCII_M),
  5919. 20: int8(m_ASCII_L),
  5920. 21: int8(m_ASCII_SLASH),
  5921. 22: int8(m_ASCII_1),
  5922. 23: int8(m_ASCII_9),
  5923. 24: int8(m_ASCII_9),
  5924. 25: int8(m_ASCII_8),
  5925. 26: int8(m_ASCII_SLASH),
  5926. 27: int8(m_ASCII_n),
  5927. 28: int8(m_ASCII_a),
  5928. 29: int8(m_ASCII_m),
  5929. 30: int8(m_ASCII_e),
  5930. 31: int8(m_ASCII_s),
  5931. 32: int8(m_ASCII_p),
  5932. 33: int8(m_ASCII_a),
  5933. 34: int8(m_ASCII_c),
  5934. 35: int8(m_ASCII_e),
  5935. }
  5936. var _xmlLen = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt64(37))/libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))
  5937. // "http://www.w3.org/2000/xmlns/"
  5938. var _xmlnsNamespace = [30]TXML_Char{
  5939. 0: int8(m_ASCII_h),
  5940. 1: int8(m_ASCII_t),
  5941. 2: int8(m_ASCII_t),
  5942. 3: int8(m_ASCII_p),
  5943. 4: int8(m_ASCII_COLON),
  5944. 5: int8(m_ASCII_SLASH),
  5945. 6: int8(m_ASCII_SLASH),
  5946. 7: int8(m_ASCII_w),
  5947. 8: int8(m_ASCII_w),
  5948. 9: int8(m_ASCII_w),
  5949. 10: int8(m_ASCII_PERIOD),
  5950. 11: int8(m_ASCII_w),
  5951. 12: int8(m_ASCII_3),
  5952. 13: int8(m_ASCII_PERIOD),
  5953. 14: int8(m_ASCII_o),
  5954. 15: int8(m_ASCII_r),
  5955. 16: int8(m_ASCII_g),
  5956. 17: int8(m_ASCII_SLASH),
  5957. 18: int8(m_ASCII_2),
  5958. 19: int8(m_ASCII_0),
  5959. 20: int8(m_ASCII_0),
  5960. 21: int8(m_ASCII_0),
  5961. 22: int8(m_ASCII_SLASH),
  5962. 23: int8(m_ASCII_x),
  5963. 24: int8(m_ASCII_m),
  5964. 25: int8(m_ASCII_l),
  5965. 26: int8(m_ASCII_n),
  5966. 27: int8(m_ASCII_s),
  5967. 28: int8(m_ASCII_SLASH),
  5968. }
  5969. var _xmlnsLen = libc.Int32FromUint32(libc.Uint32FromInt32(libc.Int32FromInt64(30))/libc.Uint32FromInt64(1) - libc.Uint32FromInt32(1))
  5970. // C documentation
  5971. //
  5972. // /* The idea here is to avoid using stack for each CDATA section when
  5973. // the whole file is parsed with one call.
  5974. // */
  5975. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5976. bp := tls.Alloc(16)
  5977. defer tls.Free(16)
  5978. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5979. var result _XML_Error
  5980. _ = result
  5981. 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))
  5982. if result != int32(_XML_ERROR_NONE) {
  5983. return result
  5984. }
  5985. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5986. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  5987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  5988. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5989. } else {
  5990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  5991. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5992. }
  5993. }
  5994. return result
  5995. }
  5996. // C documentation
  5997. //
  5998. // /* startPtr gets set to non-null if the section is closed, and to null if
  5999. // the section is not yet closed.
  6000. // */
  6001. 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) {
  6002. bp := tls.Alloc(16)
  6003. defer tls.Free(16)
  6004. var charDataHandler TXML_CharacterDataHandler
  6005. var convert_res _XML_Convert_Result
  6006. var eventEndPP, eventPP, v3 uintptr
  6007. var tok int32
  6008. var _ /* c at bp+8 */ TXML_Char
  6009. var _ /* dataPtr at bp+12 */ uintptr
  6010. var _ /* next at bp+4 */ uintptr
  6011. var _ /* s at bp+0 */ uintptr
  6012. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  6013. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6014. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6015. eventPP = parser + 284
  6016. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6017. eventEndPP = parser + 288
  6018. } else {
  6019. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6020. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  6021. }
  6022. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6023. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6024. for {
  6025. *(*uintptr)(unsafe.Pointer(bp + 4)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  6026. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 2*4))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+4)
  6027. if !(_accountingDiffTolerated(tls, parser, tok, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)), int32(4044), account) != 0) {
  6028. _accountingOnAbort(tls, parser)
  6029. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6030. }
  6031. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6032. switch tok {
  6033. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  6034. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  6035. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6036. } else {
  6037. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6038. (*(*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)
  6039. } else {
  6040. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6041. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  6042. }
  6043. }
  6044. }
  6045. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6046. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6047. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6048. return int32(_XML_ERROR_ABORTED)
  6049. } else {
  6050. return int32(_XML_ERROR_NONE)
  6051. }
  6052. fallthrough
  6053. case int32(m_XML_TOK_DATA_NEWLINE):
  6054. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  6055. *(*TXML_Char)(unsafe.Pointer(bp + 8)) = int8(0xA)
  6056. (*(*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+8, int32(1))
  6057. } else {
  6058. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6059. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  6060. }
  6061. }
  6062. case int32(m_XML_TOK_DATA_CHARS):
  6063. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  6064. if charDataHandler != 0 {
  6065. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  6066. for {
  6067. *(*uintptr)(unsafe.Pointer(bp + 12)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  6068. 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 + 4)), bp+12, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  6069. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6070. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 12)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  6071. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  6072. break
  6073. }
  6074. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6075. goto _2
  6076. _2:
  6077. }
  6078. } else {
  6079. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(*(*uintptr)(unsafe.Pointer(bp + 4)))-int32(*(*uintptr)(unsafe.Pointer(bp))))
  6080. }
  6081. } else {
  6082. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6083. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 4)))
  6084. }
  6085. }
  6086. case m_XML_TOK_INVALID:
  6087. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6088. return int32(_XML_ERROR_INVALID_TOKEN)
  6089. case -int32(2):
  6090. if haveMore != 0 {
  6091. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6092. return int32(_XML_ERROR_NONE)
  6093. }
  6094. return int32(_XML_ERROR_PARTIAL_CHAR)
  6095. case -int32(1):
  6096. fallthrough
  6097. case -int32(4):
  6098. if haveMore != 0 {
  6099. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6100. return int32(_XML_ERROR_NONE)
  6101. }
  6102. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  6103. default:
  6104. /* Every token returned by XmlCdataSectionTok() has its own
  6105. * explicit case, so this default case will never be executed.
  6106. * We retain it as a safety net and exclude it from the coverage
  6107. * statistics.
  6108. *
  6109. * LCOV_EXCL_START
  6110. */
  6111. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6112. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6113. /* LCOV_EXCL_STOP */
  6114. }
  6115. v3 = *(*uintptr)(unsafe.Pointer(bp + 4))
  6116. *(*uintptr)(unsafe.Pointer(bp)) = v3
  6117. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  6118. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  6119. case int32(_XML_SUSPENDED):
  6120. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  6121. return int32(_XML_ERROR_NONE)
  6122. case int32(_XML_FINISHED):
  6123. return int32(_XML_ERROR_ABORTED)
  6124. default:
  6125. }
  6126. goto _1
  6127. _1:
  6128. }
  6129. /* not reached */
  6130. return r
  6131. }
  6132. // C documentation
  6133. //
  6134. // /* The idea here is to avoid using stack for each IGNORE section when
  6135. // the whole file is parsed with one call.
  6136. // */
  6137. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  6138. bp := tls.Alloc(16)
  6139. defer tls.Free(16)
  6140. *(*uintptr)(unsafe.Pointer(bp)) = _start
  6141. var result _XML_Error
  6142. _ = result
  6143. 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)))
  6144. if result != int32(_XML_ERROR_NONE) {
  6145. return result
  6146. }
  6147. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6148. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6149. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  6150. }
  6151. return result
  6152. }
  6153. // C documentation
  6154. //
  6155. // /* startPtr gets set to non-null is the section is closed, and to null
  6156. // if the section is not yet closed.
  6157. // */
  6158. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  6159. bp := tls.Alloc(16)
  6160. defer tls.Free(16)
  6161. var eventEndPP, eventPP, s uintptr
  6162. var tok int32
  6163. var _ /* next at bp+0 */ uintptr
  6164. _, _, _, _ = eventEndPP, eventPP, s, tok
  6165. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  6166. s = *(*uintptr)(unsafe.Pointer(startPtr))
  6167. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6168. eventPP = parser + 284
  6169. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6170. eventEndPP = parser + 288
  6171. } else {
  6172. /* It's not entirely clear, but it seems the following two lines
  6173. * of code cannot be executed. The only occasions on which 'enc'
  6174. * is not 'encoding' are when this function is called
  6175. * from the internal entity processing, and IGNORE sections are an
  6176. * error in internal entities.
  6177. *
  6178. * Since it really isn't clear that this is true, we keep the code
  6179. * and just remove it from our coverage tests.
  6180. *
  6181. * LCOV_EXCL_START
  6182. */
  6183. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6184. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  6185. /* LCOV_EXCL_STOP */
  6186. }
  6187. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6188. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  6189. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*4))})))(tls, enc, s, end, bp)
  6190. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4196), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6191. _accountingOnAbort(tls, parser)
  6192. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6193. }
  6194. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6195. switch tok {
  6196. case int32(m_XML_TOK_IGNORE_SECT):
  6197. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6198. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6199. }
  6200. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6201. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6202. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6203. return int32(_XML_ERROR_ABORTED)
  6204. } else {
  6205. return int32(_XML_ERROR_NONE)
  6206. }
  6207. fallthrough
  6208. case m_XML_TOK_INVALID:
  6209. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6210. return int32(_XML_ERROR_INVALID_TOKEN)
  6211. case -int32(2):
  6212. if haveMore != 0 {
  6213. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6214. return int32(_XML_ERROR_NONE)
  6215. }
  6216. return int32(_XML_ERROR_PARTIAL_CHAR)
  6217. case -int32(1):
  6218. fallthrough
  6219. case -int32(4):
  6220. if haveMore != 0 {
  6221. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6222. return int32(_XML_ERROR_NONE)
  6223. }
  6224. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  6225. default:
  6226. /* All of the tokens that XmlIgnoreSectionTok() returns have
  6227. * explicit cases to handle them, so this default case is never
  6228. * executed. We keep it as a safety net anyway, and remove it
  6229. * from our test coverage statistics.
  6230. *
  6231. * LCOV_EXCL_START
  6232. */
  6233. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6234. return int32(_XML_ERROR_UNEXPECTED_STATE)
  6235. /* LCOV_EXCL_STOP */
  6236. }
  6237. /* not reached */
  6238. return r
  6239. }
  6240. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  6241. var s uintptr
  6242. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  6243. _, _ = s, v1
  6244. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  6245. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6246. v1 = XXmlInitEncodingNS
  6247. } else {
  6248. v1 = XXmlInitEncoding
  6249. }
  6250. if v1(tls, parser+148, parser+144, s) != 0 {
  6251. return int32(_XML_ERROR_NONE)
  6252. }
  6253. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  6254. }
  6255. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  6256. bp := tls.Alloc(32)
  6257. defer tls.Free(32)
  6258. var result _XML_Error
  6259. var storedEncName, storedversion uintptr
  6260. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  6261. var _ /* encodingName at bp+0 */ uintptr
  6262. var _ /* newEncoding at bp+4 */ uintptr
  6263. var _ /* standalone at bp+16 */ int32
  6264. var _ /* version at bp+8 */ uintptr
  6265. var _ /* versionend at bp+12 */ uintptr
  6266. _, _, _, _ = result, storedEncName, storedversion, v1
  6267. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  6268. storedEncName = libc.UintptrFromInt32(0)
  6269. *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0)
  6270. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  6271. *(*uintptr)(unsafe.Pointer(bp + 12)) = libc.UintptrFromInt32(0)
  6272. storedversion = libc.UintptrFromInt32(0)
  6273. *(*int32)(unsafe.Pointer(bp + 16)) = -int32(1)
  6274. if !(_accountingDiffTolerated(tls, parser, int32(m_XML_TOK_XML_DECL), s, next, int32(4288), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6275. _accountingOnAbort(tls, parser)
  6276. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6277. }
  6278. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6279. v1 = XXmlParseXmlDeclNS
  6280. } else {
  6281. v1 = XXmlParseXmlDecl
  6282. }
  6283. if !(v1(tls, isGeneralTextEntity, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next, parser+284, bp+8, bp+12, bp, bp+4, bp+16) != 0) {
  6284. if isGeneralTextEntity != 0 {
  6285. return int32(_XML_ERROR_TEXT_DECL)
  6286. } else {
  6287. return int32(_XML_ERROR_XML_DECL)
  6288. }
  6289. }
  6290. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 16)) == int32(1) {
  6291. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  6292. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  6293. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  6294. }
  6295. }
  6296. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  6297. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  6298. storedEncName = _poolStoreString(tls, parser+436, (*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)))))
  6299. if !(storedEncName != 0) {
  6300. return int32(_XML_ERROR_NO_MEMORY)
  6301. }
  6302. (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fptr
  6303. }
  6304. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  6305. storedversion = _poolStoreString(tls, parser+436, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp + 12))-uintptr((*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar))
  6306. if !(storedversion != 0) {
  6307. return int32(_XML_ERROR_NO_MEMORY)
  6308. }
  6309. }
  6310. (*(*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 + 16)))
  6311. } else {
  6312. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  6313. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  6314. }
  6315. }
  6316. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  6317. if *(*uintptr)(unsafe.Pointer(bp + 4)) != 0 {
  6318. /* Check that the specified encoding does not conflict with what
  6319. * the parser has already deduced. Do we have the same number
  6320. * of bytes in the smallest representation of a character? If
  6321. * this is UTF-16, is it the same endianness?
  6322. */
  6323. if (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FminBytesPerChar != (*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar || (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4)))).FminBytesPerChar == int32(2) && *(*uintptr)(unsafe.Pointer(bp + 4)) != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6324. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6325. return int32(_XML_ERROR_INCORRECT_ENCODING)
  6326. }
  6327. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 4))
  6328. } else {
  6329. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  6330. if !(storedEncName != 0) {
  6331. storedEncName = _poolStoreString(tls, parser+436, (*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)))))
  6332. if !(storedEncName != 0) {
  6333. return int32(_XML_ERROR_NO_MEMORY)
  6334. }
  6335. }
  6336. result = _handleUnknownEncoding(tls, parser, storedEncName)
  6337. _poolClear(tls, parser+436)
  6338. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  6339. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  6340. }
  6341. return result
  6342. }
  6343. }
  6344. }
  6345. if storedEncName != 0 || storedversion != 0 {
  6346. _poolClear(tls, parser+436)
  6347. }
  6348. return int32(_XML_ERROR_NONE)
  6349. }
  6350. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6351. bp := tls.Alloc(1040)
  6352. defer tls.Free(1040)
  6353. var enc uintptr
  6354. var i int32
  6355. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6356. var _ /* info at bp+0 */ TXML_Encoding
  6357. _, _, _ = enc, i, v2
  6358. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6359. i = 0
  6360. for {
  6361. if !(i < int32(256)) {
  6362. break
  6363. }
  6364. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6365. goto _1
  6366. _1:
  6367. ;
  6368. i++
  6369. }
  6370. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6371. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6372. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6373. 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 {
  6374. (*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.Uint32FromInt32(XXmlSizeOfUnknownEncoding(tls)))
  6375. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6376. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6377. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6378. }
  6379. return int32(_XML_ERROR_NO_MEMORY)
  6380. }
  6381. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6382. v2 = XXmlInitUnknownEncodingNS
  6383. } else {
  6384. v2 = XXmlInitUnknownEncoding
  6385. }
  6386. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6387. if enc != 0 {
  6388. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6389. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6390. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6391. return int32(_XML_ERROR_NONE)
  6392. }
  6393. }
  6394. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6395. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6396. }
  6397. }
  6398. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6399. }
  6400. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6401. var result _XML_Error
  6402. _ = result
  6403. result = _initializeEncoding(tls, parser)
  6404. if result != int32(_XML_ERROR_NONE) {
  6405. return result
  6406. }
  6407. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6408. return _prologProcessor(tls, parser, s, end, nextPtr)
  6409. }
  6410. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6411. var result _XML_Error
  6412. _ = result
  6413. result = _initializeEncoding(tls, parser)
  6414. if result != int32(_XML_ERROR_NONE) {
  6415. return result
  6416. }
  6417. /* we know now that XML_Parse(Buffer) has been called,
  6418. so we consider the external parameter entity read */
  6419. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6420. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6421. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6422. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6423. } else {
  6424. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6425. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6426. }
  6427. return r
  6428. }
  6429. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6430. bp := tls.Alloc(16)
  6431. defer tls.Free(16)
  6432. var result _XML_Error
  6433. var start uintptr
  6434. var tok int32
  6435. var _ /* next at bp+0 */ uintptr
  6436. _, _, _ = result, start, tok
  6437. start = s
  6438. *(*uintptr)(unsafe.Pointer(bp)) = start
  6439. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6440. for {
  6441. 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)
  6442. /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in:
  6443. - storeEntityValue
  6444. - processXmlDecl
  6445. */
  6446. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6447. if tok <= 0 {
  6448. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6449. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6450. return int32(_XML_ERROR_NONE)
  6451. }
  6452. switch tok {
  6453. case m_XML_TOK_INVALID:
  6454. return int32(_XML_ERROR_INVALID_TOKEN)
  6455. case -int32(1):
  6456. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6457. case -int32(2):
  6458. return int32(_XML_ERROR_PARTIAL_CHAR)
  6459. case -int32(4): /* start == end */
  6460. fallthrough
  6461. default:
  6462. break
  6463. }
  6464. /* found end of entity value - can store it now */
  6465. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end, int32(_XML_ACCOUNT_DIRECT))
  6466. } else {
  6467. if tok == int32(m_XML_TOK_XML_DECL) {
  6468. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6469. if result != int32(_XML_ERROR_NONE) {
  6470. return result
  6471. }
  6472. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6473. * that to happen, a parameter entity parsing handler must have attempted
  6474. * to suspend the parser, which fails and raises an error. The parser can
  6475. * be aborted, but can't be suspended.
  6476. */
  6477. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6478. return int32(_XML_ERROR_ABORTED)
  6479. }
  6480. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6481. /* stop scanning for text declaration - we found one */
  6482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6483. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6484. } else {
  6485. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6486. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4495), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6487. _accountingOnAbort(tls, parser)
  6488. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6489. }
  6490. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6491. return int32(_XML_ERROR_NONE)
  6492. } else {
  6493. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6494. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6495. return int32(_XML_ERROR_SYNTAX)
  6496. }
  6497. }
  6498. }
  6499. }
  6500. start = *(*uintptr)(unsafe.Pointer(bp))
  6501. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6502. goto _1
  6503. _1:
  6504. }
  6505. return r
  6506. }
  6507. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6508. bp := tls.Alloc(16)
  6509. defer tls.Free(16)
  6510. var tok int32
  6511. var _ /* next at bp+0 */ uintptr
  6512. _ = tok
  6513. *(*uintptr)(unsafe.Pointer(bp)) = s
  6514. 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)
  6515. if tok <= 0 {
  6516. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6517. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6518. return int32(_XML_ERROR_NONE)
  6519. }
  6520. switch tok {
  6521. case m_XML_TOK_INVALID:
  6522. return int32(_XML_ERROR_INVALID_TOKEN)
  6523. case -int32(1):
  6524. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6525. case -int32(2):
  6526. return int32(_XML_ERROR_PARTIAL_CHAR)
  6527. case -int32(4): /* start == end */
  6528. fallthrough
  6529. default:
  6530. break
  6531. }
  6532. } else {
  6533. if tok == int32(m_XML_TOK_BOM) {
  6534. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4548), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  6535. _accountingOnAbort(tls, parser)
  6536. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6537. }
  6538. s = *(*uintptr)(unsafe.Pointer(bp))
  6539. 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)
  6540. }
  6541. }
  6542. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6543. 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))
  6544. }
  6545. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6546. bp := tls.Alloc(16)
  6547. defer tls.Free(16)
  6548. var enc, start uintptr
  6549. var tok int32
  6550. var _ /* next at bp+0 */ uintptr
  6551. _, _, _ = enc, start, tok
  6552. start = s
  6553. *(*uintptr)(unsafe.Pointer(bp)) = s
  6554. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6555. for {
  6556. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6557. /* Note: These bytes are accounted later in:
  6558. - storeEntityValue
  6559. */
  6560. if tok <= 0 {
  6561. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6562. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6563. return int32(_XML_ERROR_NONE)
  6564. }
  6565. switch tok {
  6566. case m_XML_TOK_INVALID:
  6567. return int32(_XML_ERROR_INVALID_TOKEN)
  6568. case -int32(1):
  6569. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6570. case -int32(2):
  6571. return int32(_XML_ERROR_PARTIAL_CHAR)
  6572. case -int32(4): /* start == end */
  6573. fallthrough
  6574. default:
  6575. break
  6576. }
  6577. /* found end of entity value - can store it now */
  6578. return _storeEntityValue(tls, parser, enc, s, end, int32(_XML_ACCOUNT_DIRECT))
  6579. }
  6580. start = *(*uintptr)(unsafe.Pointer(bp))
  6581. goto _1
  6582. _1:
  6583. }
  6584. return r
  6585. }
  6586. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6587. bp := tls.Alloc(16)
  6588. defer tls.Free(16)
  6589. var tok int32
  6590. var _ /* next at bp+0 */ uintptr
  6591. _ = tok
  6592. *(*uintptr)(unsafe.Pointer(bp)) = s
  6593. 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)
  6594. 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))
  6595. }
  6596. 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) {
  6597. bp := tls.Alloc(16)
  6598. defer tls.Free(16)
  6599. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6600. 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
  6601. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6602. var myindex, myindex1, role, v66, v69, v73, v76, v82, v84, v85 int32
  6603. var nameLen, v88 Tsize_t
  6604. var quant _XML_Content_Quant
  6605. var result, result1, result2, result3, result4, result5 _XML_Error
  6606. var v72, v79, v83 bool
  6607. var v81 uint32
  6608. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6609. /* save one level of indirection */
  6610. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6611. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6612. eventPP = parser + 284
  6613. eventEndPP = parser + 288
  6614. } else {
  6615. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6616. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  6617. }
  6618. for {
  6619. handleDefault = libc.Uint8FromInt32(1)
  6620. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6621. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6622. if tok <= 0 {
  6623. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6624. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6625. return int32(_XML_ERROR_NONE)
  6626. }
  6627. switch tok {
  6628. case m_XML_TOK_INVALID:
  6629. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6630. return int32(_XML_ERROR_INVALID_TOKEN)
  6631. case -int32(1):
  6632. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6633. case -int32(2):
  6634. return int32(_XML_ERROR_PARTIAL_CHAR)
  6635. case -int32(m_XML_TOK_PROLOG_S):
  6636. tok = -tok
  6637. case -int32(4):
  6638. /* for internal PE NOT referenced between declarations */
  6639. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6640. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6641. return int32(_XML_ERROR_NONE)
  6642. }
  6643. /* WFC: PE Between Declarations - must check that PE contains
  6644. complete markup, not only for external PEs, but also for
  6645. internal PEs if the reference occurs between declarations.
  6646. */
  6647. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6648. if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 252)).Fhandler})))(tls, parser+252, -int32(4), end, end, enc) == int32(_XML_ROLE_ERROR) {
  6649. return int32(_XML_ERROR_INCOMPLETE_PE)
  6650. }
  6651. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6652. return int32(_XML_ERROR_NONE)
  6653. }
  6654. return int32(_XML_ERROR_NO_ELEMENTS)
  6655. default:
  6656. tok = -tok
  6657. *(*uintptr)(unsafe.Pointer(bp)) = end
  6658. break
  6659. }
  6660. }
  6661. role = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 252)).Fhandler})))(tls, parser+252, tok, s, *(*uintptr)(unsafe.Pointer(bp)), enc)
  6662. switch role {
  6663. case int32(_XML_ROLE_INSTANCE_START): // bytes accounted in contentProcessor
  6664. fallthrough
  6665. case int32(_XML_ROLE_XML_DECL): // bytes accounted in processXmlDecl
  6666. fallthrough
  6667. case int32(_XML_ROLE_TEXT_DECL): // bytes accounted in processXmlDecl
  6668. default:
  6669. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(4717), account) != 0) {
  6670. _accountingOnAbort(tls, parser)
  6671. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  6672. }
  6673. }
  6674. switch role {
  6675. case int32(_XML_ROLE_XML_DECL):
  6676. goto _2
  6677. case int32(_XML_ROLE_DOCTYPE_NAME):
  6678. goto _3
  6679. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6680. goto _4
  6681. case int32(_XML_ROLE_TEXT_DECL):
  6682. goto _5
  6683. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6684. goto _6
  6685. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6686. goto _7
  6687. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6688. goto _8
  6689. case int32(_XML_ROLE_INSTANCE_START):
  6690. goto _9
  6691. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6692. goto _10
  6693. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6694. goto _11
  6695. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6696. goto _12
  6697. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6698. goto _13
  6699. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6700. goto _14
  6701. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6702. goto _15
  6703. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6704. goto _16
  6705. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6706. goto _17
  6707. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6708. goto _18
  6709. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6710. goto _19
  6711. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6712. goto _20
  6713. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6714. goto _21
  6715. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6716. goto _22
  6717. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6718. goto _23
  6719. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6720. goto _24
  6721. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6722. goto _25
  6723. case int32(_XML_ROLE_ENTITY_VALUE):
  6724. goto _26
  6725. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6726. goto _27
  6727. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6728. goto _28
  6729. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6730. goto _29
  6731. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6732. goto _30
  6733. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6734. goto _31
  6735. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6736. goto _32
  6737. case int32(_XML_ROLE_NOTATION_NAME):
  6738. goto _33
  6739. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6740. goto _34
  6741. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6742. goto _35
  6743. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6744. goto _36
  6745. case int32(_XML_ROLE_ERROR):
  6746. goto _37
  6747. case int32(_XML_ROLE_IGNORE_SECT):
  6748. goto _38
  6749. case int32(_XML_ROLE_GROUP_OPEN):
  6750. goto _39
  6751. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6752. goto _40
  6753. case int32(_XML_ROLE_GROUP_CHOICE):
  6754. goto _41
  6755. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6756. goto _42
  6757. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6758. goto _43
  6759. case int32(_XML_ROLE_ELEMENT_NAME):
  6760. goto _44
  6761. case int32(_XML_ROLE_CONTENT_EMPTY):
  6762. goto _45
  6763. case int32(_XML_ROLE_CONTENT_ANY):
  6764. goto _46
  6765. case int32(_XML_ROLE_CONTENT_PCDATA):
  6766. goto _47
  6767. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6768. goto _48
  6769. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6770. goto _49
  6771. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6772. goto _50
  6773. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6774. goto _51
  6775. case int32(_XML_ROLE_GROUP_CLOSE):
  6776. goto _52
  6777. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6778. goto _53
  6779. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6780. goto _54
  6781. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6782. goto _55
  6783. case int32(_XML_ROLE_PI):
  6784. goto _56
  6785. case int32(_XML_ROLE_COMMENT):
  6786. goto _57
  6787. case int32(_XML_ROLE_NONE):
  6788. goto _58
  6789. case int32(_XML_ROLE_DOCTYPE_NONE):
  6790. goto _59
  6791. case int32(_XML_ROLE_ENTITY_NONE):
  6792. goto _60
  6793. case int32(_XML_ROLE_NOTATION_NONE):
  6794. goto _61
  6795. case int32(_XML_ROLE_ATTLIST_NONE):
  6796. goto _62
  6797. case int32(_XML_ROLE_ELEMENT_NONE):
  6798. goto _63
  6799. }
  6800. goto _64
  6801. _2:
  6802. ;
  6803. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6804. if result != int32(_XML_ERROR_NONE) {
  6805. return result
  6806. }
  6807. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6808. handleDefault = libc.Uint8FromInt32(0)
  6809. goto _64
  6810. _3:
  6811. ;
  6812. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6813. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+412, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6814. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6815. return int32(_XML_ERROR_NO_MEMORY)
  6816. }
  6817. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  6818. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6819. handleDefault = libc.Uint8FromInt32(0)
  6820. }
  6821. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6822. goto _64
  6823. _4:
  6824. ;
  6825. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6826. (*(*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))
  6827. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6828. _poolClear(tls, parser+412)
  6829. handleDefault = libc.Uint8FromInt32(0)
  6830. }
  6831. goto _64
  6832. _5:
  6833. ;
  6834. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6835. if result1 != int32(_XML_ERROR_NONE) {
  6836. return result1
  6837. }
  6838. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6839. handleDefault = libc.Uint8FromInt32(0)
  6840. goto _64
  6841. _6:
  6842. ;
  6843. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6844. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  6845. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6846. return int32(_XML_ERROR_NO_MEMORY)
  6847. }
  6848. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6849. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6850. 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) {
  6851. return int32(_XML_ERROR_PUBLICID)
  6852. }
  6853. pubId = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6854. if !(pubId != 0) {
  6855. return int32(_XML_ERROR_NO_MEMORY)
  6856. }
  6857. _normalizePublicId(tls, pubId)
  6858. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  6859. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6860. handleDefault = libc.Uint8FromInt32(0)
  6861. goto alreadyChecked
  6862. }
  6863. /* fall through */
  6864. _7:
  6865. ;
  6866. 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) {
  6867. return int32(_XML_ERROR_PUBLICID)
  6868. }
  6869. goto alreadyChecked
  6870. alreadyChecked:
  6871. ;
  6872. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6873. tem = _poolStoreString(tls, dtd+80, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6874. if !(tem != 0) {
  6875. return int32(_XML_ERROR_NO_MEMORY)
  6876. }
  6877. _normalizePublicId(tls, tem)
  6878. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6879. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  6880. /* Don't suppress the default handler if we fell through from
  6881. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6882. */
  6883. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6884. handleDefault = libc.Uint8FromInt32(0)
  6885. }
  6886. }
  6887. goto _64
  6888. _8:
  6889. ;
  6890. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6891. /* Must not close doctype from within expanded parameter entities */
  6892. return int32(_XML_ERROR_INVALID_TOKEN)
  6893. }
  6894. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6895. (*(*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)
  6896. _poolClear(tls, parser+412)
  6897. handleDefault = libc.Uint8FromInt32(0)
  6898. }
  6899. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6900. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6901. was not set, indicating an external subset
  6902. */
  6903. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6904. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6905. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6906. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6907. entity = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  6908. if !(entity != 0) {
  6909. /* The external subset name "#" will have already been
  6910. * inserted into the hash table at the start of the
  6911. * external entity parsing, so no allocation will happen
  6912. * and lookup() cannot fail.
  6913. */
  6914. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6915. }
  6916. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6917. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6918. }
  6919. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6920. 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) {
  6921. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6922. }
  6923. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6924. 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) {
  6925. return int32(_XML_ERROR_NOT_STANDALONE)
  6926. }
  6927. } else {
  6928. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  6929. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  6930. }
  6931. }
  6932. /* end of DTD - no need to update dtd->keepProcessing */
  6933. }
  6934. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6935. }
  6936. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  6937. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6938. handleDefault = libc.Uint8FromInt32(0)
  6939. }
  6940. goto _64
  6941. _9:
  6942. ;
  6943. /* if there is no DOCTYPE declaration then now is the
  6944. last chance to read the foreign DTD
  6945. */
  6946. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6947. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6948. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6949. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6950. entity1 = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  6951. if !(entity1 != 0) {
  6952. return int32(_XML_ERROR_NO_MEMORY)
  6953. }
  6954. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6955. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6956. 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) {
  6957. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6958. }
  6959. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6960. 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) {
  6961. return int32(_XML_ERROR_NOT_STANDALONE)
  6962. }
  6963. } else {
  6964. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  6965. }
  6966. /* end of DTD - no need to update dtd->keepProcessing */
  6967. }
  6968. }
  6969. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6970. return _contentProcessor(tls, parser, s, end, nextPtr)
  6971. _10:
  6972. ;
  6973. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6974. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  6975. return int32(_XML_ERROR_NO_MEMORY)
  6976. }
  6977. goto checkAttListDeclHandler
  6978. _11:
  6979. ;
  6980. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6981. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  6982. return int32(_XML_ERROR_NO_MEMORY)
  6983. }
  6984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  6985. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  6986. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  6987. goto checkAttListDeclHandler
  6988. _12:
  6989. ;
  6990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  6991. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  6992. goto checkAttListDeclHandler
  6993. _13:
  6994. ;
  6995. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  6996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  6997. goto checkAttListDeclHandler
  6998. _14:
  6999. ;
  7000. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  7001. goto checkAttListDeclHandler
  7002. _15:
  7003. ;
  7004. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  7005. goto checkAttListDeclHandler
  7006. _16:
  7007. ;
  7008. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  7009. goto checkAttListDeclHandler
  7010. _17:
  7011. ;
  7012. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  7013. goto checkAttListDeclHandler
  7014. _18:
  7015. ;
  7016. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  7017. goto checkAttListDeclHandler
  7018. _19:
  7019. ;
  7020. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  7021. goto checkAttListDeclHandler
  7022. checkAttListDeclHandler:
  7023. ;
  7024. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7025. handleDefault = libc.Uint8FromInt32(0)
  7026. }
  7027. goto _64
  7028. _21:
  7029. ;
  7030. _20:
  7031. ;
  7032. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7033. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7034. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  7035. } else {
  7036. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  7037. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  7038. } else {
  7039. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  7040. }
  7041. prefix = v65
  7042. }
  7043. if !(_poolAppendString(tls, parser+412, prefix) != 0) {
  7044. return int32(_XML_ERROR_NO_MEMORY)
  7045. }
  7046. if !(_poolAppend(tls, parser+412, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7047. return int32(_XML_ERROR_NO_MEMORY)
  7048. }
  7049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7050. handleDefault = libc.Uint8FromInt32(0)
  7051. }
  7052. goto _64
  7053. _23:
  7054. ;
  7055. _22:
  7056. ;
  7057. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7058. 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) {
  7059. return int32(_XML_ERROR_NO_MEMORY)
  7060. }
  7061. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7062. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7063. /* Enumerated or Notation type */
  7064. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7065. v66 = 0
  7066. } else {
  7067. v68 = parser + 412 + 12
  7068. v67 = *(*uintptr)(unsafe.Pointer(v68))
  7069. *(*uintptr)(unsafe.Pointer(v68))++
  7070. *(*TXML_Char)(unsafe.Pointer(v67)) = int8(m_ASCII_RPAREN)
  7071. v66 = libc.Int32FromInt32(1)
  7072. }
  7073. if v72 = !(v66 != 0); !v72 {
  7074. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7075. v69 = 0
  7076. } else {
  7077. v71 = parser + 412 + 12
  7078. v70 = *(*uintptr)(unsafe.Pointer(v71))
  7079. *(*uintptr)(unsafe.Pointer(v71))++
  7080. *(*TXML_Char)(unsafe.Pointer(v70)) = int8('\000')
  7081. v69 = libc.Int32FromInt32(1)
  7082. }
  7083. }
  7084. if v72 || !(v69 != 0) {
  7085. return int32(_XML_ERROR_NO_MEMORY)
  7086. }
  7087. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7088. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7089. }
  7090. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7091. (*(*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)))
  7092. handleDefault = libc.Uint8FromInt32(0)
  7093. }
  7094. }
  7095. _poolClear(tls, parser+412)
  7096. goto _64
  7097. _25:
  7098. ;
  7099. _24:
  7100. ;
  7101. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7102. 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+80, int32(_XML_ACCOUNT_NONE))
  7103. if result2 != 0 {
  7104. return result2
  7105. }
  7106. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7107. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7108. /* ID attributes aren't allowed to have a default */
  7109. 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) {
  7110. return int32(_XML_ERROR_NO_MEMORY)
  7111. }
  7112. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  7113. if int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && int32(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  7114. /* Enumerated or Notation type */
  7115. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7116. v73 = 0
  7117. } else {
  7118. v75 = parser + 412 + 12
  7119. v74 = *(*uintptr)(unsafe.Pointer(v75))
  7120. *(*uintptr)(unsafe.Pointer(v75))++
  7121. *(*TXML_Char)(unsafe.Pointer(v74)) = int8(m_ASCII_RPAREN)
  7122. v73 = libc.Int32FromInt32(1)
  7123. }
  7124. if v79 = !(v73 != 0); !v79 {
  7125. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  7126. v76 = 0
  7127. } else {
  7128. v78 = parser + 412 + 12
  7129. v77 = *(*uintptr)(unsafe.Pointer(v78))
  7130. *(*uintptr)(unsafe.Pointer(v78))++
  7131. *(*TXML_Char)(unsafe.Pointer(v77)) = int8('\000')
  7132. v76 = libc.Int32FromInt32(1)
  7133. }
  7134. }
  7135. if v79 || !(v76 != 0) {
  7136. return int32(_XML_ERROR_NO_MEMORY)
  7137. }
  7138. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  7139. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7140. }
  7141. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7142. (*(*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)))
  7143. _poolClear(tls, parser+412)
  7144. handleDefault = libc.Uint8FromInt32(0)
  7145. }
  7146. }
  7147. goto _64
  7148. _26:
  7149. ;
  7150. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7151. 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))
  7152. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7153. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fstart
  7154. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen = int32((*TSTRING_POOL)(unsafe.Pointer(dtd+104)).Fptr) - int32((*TSTRING_POOL)(unsafe.Pointer(dtd+104)).Fstart)
  7155. (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fptr
  7156. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7157. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7158. (*(*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))
  7159. handleDefault = libc.Uint8FromInt32(0)
  7160. }
  7161. } else {
  7162. (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 104)).Fstart
  7163. }
  7164. if result3 != int32(_XML_ERROR_NONE) {
  7165. return result3
  7166. }
  7167. }
  7168. goto _64
  7169. _27:
  7170. ;
  7171. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  7172. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7173. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7174. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7175. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  7176. return int32(_XML_ERROR_NO_MEMORY)
  7177. }
  7178. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7179. handleDefault = libc.Uint8FromInt32(0)
  7180. } else {
  7181. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  7182. for the case where no parser->m_startDoctypeDeclHandler is set */
  7183. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  7184. }
  7185. 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) {
  7186. return int32(_XML_ERROR_NOT_STANDALONE)
  7187. }
  7188. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7189. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+132, uintptr(unsafe.Pointer(&_externalSubsetName)), uint32(36))
  7190. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7191. return int32(_XML_ERROR_NO_MEMORY)
  7192. }
  7193. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7194. }
  7195. /* fall through */
  7196. _28:
  7197. ;
  7198. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7199. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId = _poolStoreString(tls, dtd+80, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7200. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  7201. return int32(_XML_ERROR_NO_MEMORY)
  7202. }
  7203. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  7204. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7205. /* Don't suppress the default handler if we fell through from
  7206. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  7207. */
  7208. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  7209. handleDefault = libc.Uint8FromInt32(0)
  7210. }
  7211. }
  7212. goto _64
  7213. _29:
  7214. ;
  7215. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*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, 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))
  7218. handleDefault = libc.Uint8FromInt32(0)
  7219. }
  7220. goto _64
  7221. _30:
  7222. ;
  7223. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  7224. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+80, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7225. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  7226. return int32(_XML_ERROR_NO_MEMORY)
  7227. }
  7228. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7229. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  7230. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7231. (*(*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)
  7232. handleDefault = libc.Uint8FromInt32(0)
  7233. } else {
  7234. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7235. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7236. (*(*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)
  7237. handleDefault = libc.Uint8FromInt32(0)
  7238. }
  7239. }
  7240. }
  7241. goto _64
  7242. _31:
  7243. ;
  7244. 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 {
  7245. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7246. goto _64
  7247. }
  7248. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7249. name = _poolStoreString(tls, dtd+80, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7250. if !(name != 0) {
  7251. return int32(_XML_ERROR_NO_MEMORY)
  7252. }
  7253. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint32(36))
  7254. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7255. return int32(_XML_ERROR_NO_MEMORY)
  7256. }
  7257. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  7258. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7259. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7260. } else {
  7261. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7262. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7263. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  7264. /* if we have a parent parser or are reading an internal parameter
  7265. entity, then the entity declaration is not considered "internal"
  7266. */
  7267. (*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))
  7268. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7269. handleDefault = libc.Uint8FromInt32(0)
  7270. }
  7271. }
  7272. } else {
  7273. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7274. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7275. }
  7276. goto _64
  7277. _32:
  7278. ;
  7279. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  7280. name1 = _poolStoreString(tls, dtd+80, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7281. if !(name1 != 0) {
  7282. return int32(_XML_ERROR_NO_MEMORY)
  7283. }
  7284. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+132, name1, uint32(36))
  7285. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  7286. return int32(_XML_ERROR_NO_MEMORY)
  7287. }
  7288. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  7289. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7290. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7291. } else {
  7292. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  7293. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  7294. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  7295. /* if we have a parent parser or are reading an internal parameter
  7296. entity, then the entity declaration is not considered "internal"
  7297. */
  7298. (*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))
  7299. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7300. handleDefault = libc.Uint8FromInt32(0)
  7301. }
  7302. }
  7303. } else {
  7304. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7305. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  7306. }
  7307. goto _64
  7308. _33:
  7309. ;
  7310. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  7311. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  7312. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7313. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+412, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7314. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  7315. return int32(_XML_ERROR_NO_MEMORY)
  7316. }
  7317. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7318. handleDefault = libc.Uint8FromInt32(0)
  7319. }
  7320. goto _64
  7321. _34:
  7322. ;
  7323. 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) {
  7324. return int32(_XML_ERROR_PUBLICID)
  7325. }
  7326. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  7327. tem1 = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7328. if !(tem1 != 0) {
  7329. return int32(_XML_ERROR_NO_MEMORY)
  7330. }
  7331. _normalizePublicId(tls, tem1)
  7332. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  7333. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  7334. handleDefault = libc.Uint8FromInt32(0)
  7335. }
  7336. goto _64
  7337. _35:
  7338. ;
  7339. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7340. systemId = _poolStoreString(tls, parser+412, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7341. if !(systemId != 0) {
  7342. return int32(_XML_ERROR_NO_MEMORY)
  7343. }
  7344. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7345. (*(*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)
  7346. handleDefault = libc.Uint8FromInt32(0)
  7347. }
  7348. _poolClear(tls, parser+412)
  7349. goto _64
  7350. _36:
  7351. ;
  7352. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7353. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7354. (*(*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)
  7355. handleDefault = libc.Uint8FromInt32(0)
  7356. }
  7357. _poolClear(tls, parser+412)
  7358. goto _64
  7359. _37:
  7360. ;
  7361. switch tok {
  7362. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7363. /* PE references in internal subset are
  7364. not allowed within declarations. */
  7365. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  7366. case int32(m_XML_TOK_XML_DECL):
  7367. return int32(_XML_ERROR_MISPLACED_XML_PI)
  7368. default:
  7369. return int32(_XML_ERROR_SYNTAX)
  7370. }
  7371. _38:
  7372. ;
  7373. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7374. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7375. }
  7376. handleDefault = libc.Uint8FromInt32(0)
  7377. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7378. if result4 != int32(_XML_ERROR_NONE) {
  7379. return result4
  7380. } else {
  7381. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7382. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7383. return result4
  7384. }
  7385. }
  7386. goto _64
  7387. _39:
  7388. ;
  7389. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7390. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7391. /* Detect and prevent integer overflow */
  7392. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2) {
  7393. return int32(_XML_ERROR_NO_MEMORY)
  7394. }
  7395. p80 = parser + 464
  7396. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7397. 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, *(*uint32)(unsafe.Pointer(p80)))
  7398. if new_connector == libc.UintptrFromInt32(0) {
  7399. *(*uint32)(unsafe.Pointer(parser + 464)) /= uint32(2)
  7400. return int32(_XML_ERROR_NO_MEMORY)
  7401. }
  7402. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7403. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7404. /* Detect and prevent integer overflow.
  7405. * The preprocessor guard addresses the "always false" warning
  7406. * from -Wtype-limits on platforms where
  7407. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  7408. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(4) {
  7409. return int32(_XML_ERROR_NO_MEMORY)
  7410. }
  7411. 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, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize*libc.Uint32FromInt64(4))
  7412. if new_scaff_index == libc.UintptrFromInt32(0) {
  7413. return int32(_XML_ERROR_NO_MEMORY)
  7414. }
  7415. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7416. }
  7417. } else {
  7418. v81 = libc.Uint32FromInt32(32)
  7419. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7420. (*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, v81)
  7421. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7422. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7423. return int32(_XML_ERROR_NO_MEMORY)
  7424. }
  7425. }
  7426. }
  7427. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = 0
  7428. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7429. myindex = _nextScaffoldPart(tls, parser)
  7430. if myindex < 0 {
  7431. return int32(_XML_ERROR_NO_MEMORY)
  7432. }
  7433. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7434. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7435. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*28))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7436. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7437. handleDefault = libc.Uint8FromInt32(0)
  7438. }
  7439. }
  7440. goto _64
  7441. _40:
  7442. ;
  7443. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  7444. return int32(_XML_ERROR_SYNTAX)
  7445. }
  7446. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_COMMA)
  7447. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7448. handleDefault = libc.Uint8FromInt32(0)
  7449. }
  7450. goto _64
  7451. _41:
  7452. ;
  7453. if int32(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  7454. return int32(_XML_ERROR_SYNTAX)
  7455. }
  7456. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) != 0) && (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*28))).Ftype1 != int32(_XML_CTYPE_MIXED) {
  7457. (*(*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)))*28))).Ftype1 = int32(_XML_CTYPE_CHOICE)
  7458. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7459. handleDefault = libc.Uint8FromInt32(0)
  7460. }
  7461. }
  7462. *(*int8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = int8(m_ASCII_PIPE)
  7463. goto _64
  7464. _43:
  7465. ;
  7466. _42:
  7467. ;
  7468. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7469. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7470. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7471. } else {
  7472. name2 = _poolStoreString(tls, dtd+80, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7473. if !(name2 != 0) {
  7474. return int32(_XML_ERROR_NO_MEMORY)
  7475. }
  7476. entity2 = _lookup(tls, parser, dtd+132, name2, uint32(0))
  7477. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  7478. /* first, determine if a check for an existing declaration is needed;
  7479. if yes, check that the entity exists, and that it is internal,
  7480. otherwise call the skipped entity handler
  7481. */
  7482. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7483. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7484. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7485. } else {
  7486. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7487. }
  7488. }
  7489. if v83 && v82 != 0 {
  7490. if !(entity2 != 0) {
  7491. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7492. } else {
  7493. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7494. /* It's hard to exhaustively search the code to be sure,
  7495. * but there doesn't seem to be a way of executing the
  7496. * following line. There are two cases:
  7497. *
  7498. * If 'standalone' is false, the DTD must have no
  7499. * parameter entities or we wouldn't have passed the outer
  7500. * 'if' statement. That means the only entity in the hash
  7501. * table is the external subset name "#" which cannot be
  7502. * given as a parameter entity name in XML syntax, so the
  7503. * lookup must have returned NULL and we don't even reach
  7504. * the test for an internal entity.
  7505. *
  7506. * If 'standalone' is true, it does not seem to be
  7507. * possible to create entities taking this code path that
  7508. * are not internal entities, so fail the test above.
  7509. *
  7510. * Because this analysis is very uncertain, the code is
  7511. * being left in place and merely removed from the
  7512. * coverage test statistics.
  7513. */
  7514. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7515. }
  7516. }
  7517. } else {
  7518. if !(entity2 != 0) {
  7519. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7520. /* cannot report skipped entities in declarations */
  7521. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7522. (*(*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))
  7523. handleDefault = libc.Uint8FromInt32(0)
  7524. }
  7525. goto _64
  7526. }
  7527. }
  7528. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7529. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7530. }
  7531. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7532. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7533. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7534. } else {
  7535. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7536. }
  7537. betweenDecl = libc.Uint8FromInt32(v84)
  7538. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7539. if result5 != int32(_XML_ERROR_NONE) {
  7540. return result5
  7541. }
  7542. handleDefault = libc.Uint8FromInt32(0)
  7543. goto _64
  7544. }
  7545. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7546. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7547. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7548. _entityTrackingOnOpen(tls, parser, entity2, int32(5439))
  7549. 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) {
  7550. _entityTrackingOnClose(tls, parser, entity2, int32(5443))
  7551. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7552. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7553. }
  7554. _entityTrackingOnClose(tls, parser, entity2, int32(5447))
  7555. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7556. handleDefault = libc.Uint8FromInt32(0)
  7557. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7558. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7559. goto _64
  7560. }
  7561. } else {
  7562. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7563. goto _64
  7564. }
  7565. }
  7566. 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) {
  7567. return int32(_XML_ERROR_NOT_STANDALONE)
  7568. }
  7569. goto _64
  7570. /* Element declaration stuff */
  7571. _44:
  7572. ;
  7573. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7574. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7575. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7576. return int32(_XML_ERROR_NO_MEMORY)
  7577. }
  7578. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7579. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7580. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7581. handleDefault = libc.Uint8FromInt32(0)
  7582. }
  7583. goto _64
  7584. _46:
  7585. ;
  7586. _45:
  7587. ;
  7588. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7589. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7590. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(20))
  7591. if !(content != 0) {
  7592. return int32(_XML_ERROR_NO_MEMORY)
  7593. }
  7594. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7595. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7596. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7597. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7598. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7599. v85 = int32(_XML_CTYPE_ANY)
  7600. } else {
  7601. v85 = int32(_XML_CTYPE_EMPTY)
  7602. }
  7603. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7604. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7605. (*(*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)
  7606. handleDefault = libc.Uint8FromInt32(0)
  7607. }
  7608. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7609. }
  7610. goto _64
  7611. _47:
  7612. ;
  7613. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7614. (*(*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)))*28))).Ftype1 = int32(_XML_CTYPE_MIXED)
  7615. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7616. handleDefault = libc.Uint8FromInt32(0)
  7617. }
  7618. }
  7619. goto _64
  7620. _48:
  7621. ;
  7622. quant = int32(_XML_CQUANT_NONE)
  7623. goto elementContent
  7624. _49:
  7625. ;
  7626. quant = int32(_XML_CQUANT_OPT)
  7627. goto elementContent
  7628. _50:
  7629. ;
  7630. quant = int32(_XML_CQUANT_REP)
  7631. goto elementContent
  7632. _51:
  7633. ;
  7634. quant = int32(_XML_CQUANT_PLUS)
  7635. goto elementContent
  7636. elementContent:
  7637. ;
  7638. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7639. if quant == int32(_XML_CQUANT_NONE) {
  7640. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7641. } else {
  7642. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7643. }
  7644. nxt = v86
  7645. myindex1 = _nextScaffoldPart(tls, parser)
  7646. if myindex1 < 0 {
  7647. return int32(_XML_ERROR_NO_MEMORY)
  7648. }
  7649. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*28))).Ftype1 = int32(_XML_CTYPE_NAME)
  7650. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*28))).Fquant = quant
  7651. el = _getElementType(tls, parser, enc, s, nxt)
  7652. if !(el != 0) {
  7653. return int32(_XML_ERROR_NO_MEMORY)
  7654. }
  7655. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7656. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*28))).Fname = name3
  7657. nameLen = uint32(0)
  7658. for {
  7659. v88 = nameLen
  7660. nameLen++
  7661. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7662. break
  7663. }
  7664. goto _87
  7665. _87:
  7666. }
  7667. /* Detect and prevent integer overflow */
  7668. if nameLen > uint32(0xffffffff)-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen {
  7669. return int32(_XML_ERROR_NO_MEMORY)
  7670. }
  7671. *(*uint32)(unsafe.Pointer(dtd + 168)) += nameLen
  7672. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7673. handleDefault = libc.Uint8FromInt32(0)
  7674. }
  7675. }
  7676. goto _64
  7677. _52:
  7678. ;
  7679. quant = int32(_XML_CQUANT_NONE)
  7680. goto closeGroup
  7681. _53:
  7682. ;
  7683. quant = int32(_XML_CQUANT_OPT)
  7684. goto closeGroup
  7685. _54:
  7686. ;
  7687. quant = int32(_XML_CQUANT_REP)
  7688. goto closeGroup
  7689. _55:
  7690. ;
  7691. quant = int32(_XML_CQUANT_PLUS)
  7692. goto closeGroup
  7693. closeGroup:
  7694. ;
  7695. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7696. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7697. handleDefault = libc.Uint8FromInt32(0)
  7698. }
  7699. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7700. (*(*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)))*28))).Fquant = quant
  7701. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7702. if !(handleDefault != 0) {
  7703. model = _build_model(tls, parser)
  7704. if !(model != 0) {
  7705. return int32(_XML_ERROR_NO_MEMORY)
  7706. }
  7707. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7708. (*(*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)
  7709. }
  7710. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7711. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7712. }
  7713. }
  7714. goto _64
  7715. /* End element declaration stuff */
  7716. _56:
  7717. ;
  7718. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7719. return int32(_XML_ERROR_NO_MEMORY)
  7720. }
  7721. handleDefault = libc.Uint8FromInt32(0)
  7722. goto _64
  7723. _57:
  7724. ;
  7725. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7726. return int32(_XML_ERROR_NO_MEMORY)
  7727. }
  7728. handleDefault = libc.Uint8FromInt32(0)
  7729. goto _64
  7730. _58:
  7731. ;
  7732. switch tok {
  7733. case int32(m_XML_TOK_BOM):
  7734. handleDefault = libc.Uint8FromInt32(0)
  7735. break
  7736. }
  7737. goto _64
  7738. _59:
  7739. ;
  7740. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7741. handleDefault = libc.Uint8FromInt32(0)
  7742. }
  7743. goto _64
  7744. _60:
  7745. ;
  7746. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7747. handleDefault = libc.Uint8FromInt32(0)
  7748. }
  7749. goto _64
  7750. _61:
  7751. ;
  7752. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7753. handleDefault = libc.Uint8FromInt32(0)
  7754. }
  7755. goto _64
  7756. _62:
  7757. ;
  7758. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7759. handleDefault = libc.Uint8FromInt32(0)
  7760. }
  7761. goto _64
  7762. _63:
  7763. ;
  7764. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7765. handleDefault = libc.Uint8FromInt32(0)
  7766. }
  7767. goto _64
  7768. _64:
  7769. ; /* end of big switch */
  7770. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7771. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7772. }
  7773. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7774. case int32(_XML_SUSPENDED):
  7775. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7776. return int32(_XML_ERROR_NONE)
  7777. case int32(_XML_FINISHED):
  7778. return int32(_XML_ERROR_ABORTED)
  7779. default:
  7780. s = *(*uintptr)(unsafe.Pointer(bp))
  7781. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7782. }
  7783. goto _1
  7784. _1:
  7785. }
  7786. /* not reached */
  7787. return r
  7788. }
  7789. var _externalSubsetName = [2]TXML_Char{
  7790. 0: int8(m_ASCII_HASH),
  7791. }
  7792. var _atypeCDATA = [6]TXML_Char{
  7793. 0: int8(m_ASCII_C),
  7794. 1: int8(m_ASCII_D),
  7795. 2: int8(m_ASCII_A),
  7796. 3: int8(m_ASCII_T),
  7797. 4: int8(m_ASCII_A),
  7798. }
  7799. var _atypeID = [3]TXML_Char{
  7800. 0: int8(m_ASCII_I),
  7801. 1: int8(m_ASCII_D),
  7802. }
  7803. var _atypeIDREF = [6]TXML_Char{
  7804. 0: int8(m_ASCII_I),
  7805. 1: int8(m_ASCII_D),
  7806. 2: int8(m_ASCII_R),
  7807. 3: int8(m_ASCII_E),
  7808. 4: int8(m_ASCII_F),
  7809. }
  7810. var _atypeIDREFS = [7]TXML_Char{
  7811. 0: int8(m_ASCII_I),
  7812. 1: int8(m_ASCII_D),
  7813. 2: int8(m_ASCII_R),
  7814. 3: int8(m_ASCII_E),
  7815. 4: int8(m_ASCII_F),
  7816. 5: int8(m_ASCII_S),
  7817. }
  7818. var _atypeENTITY = [7]TXML_Char{
  7819. 0: int8(m_ASCII_E),
  7820. 1: int8(m_ASCII_N),
  7821. 2: int8(m_ASCII_T),
  7822. 3: int8(m_ASCII_I),
  7823. 4: int8(m_ASCII_T),
  7824. 5: int8(m_ASCII_Y),
  7825. }
  7826. var _atypeENTITIES = [9]TXML_Char{
  7827. 0: int8(m_ASCII_E),
  7828. 1: int8(m_ASCII_N),
  7829. 2: int8(m_ASCII_T),
  7830. 3: int8(m_ASCII_I),
  7831. 4: int8(m_ASCII_T),
  7832. 5: int8(m_ASCII_I),
  7833. 6: int8(m_ASCII_E),
  7834. 7: int8(m_ASCII_S),
  7835. }
  7836. var _atypeNMTOKEN = [8]TXML_Char{
  7837. 0: int8(m_ASCII_N),
  7838. 1: int8(m_ASCII_M),
  7839. 2: int8(m_ASCII_T),
  7840. 3: int8(m_ASCII_O),
  7841. 4: int8(m_ASCII_K),
  7842. 5: int8(m_ASCII_E),
  7843. 6: int8(m_ASCII_N),
  7844. }
  7845. var _atypeNMTOKENS = [9]TXML_Char{
  7846. 0: int8(m_ASCII_N),
  7847. 1: int8(m_ASCII_M),
  7848. 2: int8(m_ASCII_T),
  7849. 3: int8(m_ASCII_O),
  7850. 4: int8(m_ASCII_K),
  7851. 5: int8(m_ASCII_E),
  7852. 6: int8(m_ASCII_N),
  7853. 7: int8(m_ASCII_S),
  7854. }
  7855. var _notationPrefix = [10]TXML_Char{
  7856. 0: int8(m_ASCII_N),
  7857. 1: int8(m_ASCII_O),
  7858. 2: int8(m_ASCII_T),
  7859. 3: int8(m_ASCII_A),
  7860. 4: int8(m_ASCII_T),
  7861. 5: int8(m_ASCII_I),
  7862. 6: int8(m_ASCII_O),
  7863. 7: int8(m_ASCII_N),
  7864. 8: int8(m_ASCII_LPAREN),
  7865. }
  7866. var _enumValueSep = [2]TXML_Char{
  7867. 0: int8(m_ASCII_PIPE),
  7868. }
  7869. var _enumValueStart = [2]TXML_Char{
  7870. 0: int8(m_ASCII_LPAREN),
  7871. }
  7872. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7873. bp := tls.Alloc(16)
  7874. defer tls.Free(16)
  7875. var tok int32
  7876. var v2 uintptr
  7877. var _ /* next at bp+0 */ uintptr
  7878. _, _ = tok, v2
  7879. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7880. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7881. for {
  7882. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7883. 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)
  7884. if !(_accountingDiffTolerated(tls, parser, tok, s, *(*uintptr)(unsafe.Pointer(bp)), int32(5652), int32(_XML_ACCOUNT_DIRECT)) != 0) {
  7885. _accountingOnAbort(tls, parser)
  7886. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  7887. }
  7888. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7889. switch tok {
  7890. /* report partial linebreak - it might be the last token */
  7891. case -int32(m_XML_TOK_PROLOG_S):
  7892. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7893. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7894. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7895. return int32(_XML_ERROR_ABORTED)
  7896. }
  7897. }
  7898. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7899. return int32(_XML_ERROR_NONE)
  7900. case -int32(4):
  7901. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7902. return int32(_XML_ERROR_NONE)
  7903. case int32(m_XML_TOK_PROLOG_S):
  7904. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7905. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7906. }
  7907. case int32(m_XML_TOK_PI):
  7908. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7909. return int32(_XML_ERROR_NO_MEMORY)
  7910. }
  7911. case int32(m_XML_TOK_COMMENT):
  7912. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7913. return int32(_XML_ERROR_NO_MEMORY)
  7914. }
  7915. case m_XML_TOK_INVALID:
  7916. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7917. return int32(_XML_ERROR_INVALID_TOKEN)
  7918. case -int32(1):
  7919. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7920. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7921. return int32(_XML_ERROR_NONE)
  7922. }
  7923. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7924. case -int32(2):
  7925. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7926. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7927. return int32(_XML_ERROR_NONE)
  7928. }
  7929. return int32(_XML_ERROR_PARTIAL_CHAR)
  7930. default:
  7931. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  7932. }
  7933. v2 = *(*uintptr)(unsafe.Pointer(bp))
  7934. s = v2
  7935. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  7936. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7937. case int32(_XML_SUSPENDED):
  7938. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7939. return int32(_XML_ERROR_NONE)
  7940. case int32(_XML_FINISHED):
  7941. return int32(_XML_ERROR_ABORTED)
  7942. default:
  7943. }
  7944. goto _1
  7945. _1:
  7946. }
  7947. return r
  7948. }
  7949. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  7950. bp := tls.Alloc(16)
  7951. defer tls.Free(16)
  7952. var openEntity, textEnd, textStart uintptr
  7953. var result _XML_Error
  7954. var tok int32
  7955. var _ /* next at bp+0 */ uintptr
  7956. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  7957. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  7958. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7960. } else {
  7961. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt64(24))
  7962. if !(openEntity != 0) {
  7963. return int32(_XML_ERROR_NO_MEMORY)
  7964. }
  7965. }
  7966. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7967. _entityTrackingOnOpen(tls, parser, entity, int32(5732))
  7968. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  7969. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7970. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  7971. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  7972. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  7973. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  7974. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  7975. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  7976. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  7977. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7978. /* Set a safe default value in case 'next' does not get set */
  7979. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7980. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7981. 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)
  7982. 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))
  7983. } else {
  7984. 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))
  7985. }
  7986. if result == int32(_XML_ERROR_NONE) {
  7987. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7988. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(textStart)
  7989. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  7990. } else {
  7991. _entityTrackingOnClose(tls, parser, entity, int32(5766))
  7992. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7994. /* put openEntity back in list of free instances */
  7995. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7997. }
  7998. }
  7999. return result
  8000. }
  8001. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8002. bp := tls.Alloc(16)
  8003. defer tls.Free(16)
  8004. var entity, openEntity, textEnd, textStart uintptr
  8005. var result _XML_Error
  8006. var tok, tok1, v1 int32
  8007. var _ /* next at bp+0 */ uintptr
  8008. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  8009. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8010. if !(openEntity != 0) {
  8011. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8012. }
  8013. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  8014. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  8015. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8016. /* Set a safe default value in case 'next' does not get set */
  8017. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  8018. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8019. 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)
  8020. 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))
  8021. } else {
  8022. 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))
  8023. }
  8024. if result != int32(_XML_ERROR_NONE) {
  8025. return result
  8026. }
  8027. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8028. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32((*TENTITY)(unsafe.Pointer(entity)).FtextPtr)
  8029. return result
  8030. }
  8031. _entityTrackingOnClose(tls, parser, entity, int32(5817))
  8032. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  8034. /* put openEntity back in list of free instances */
  8035. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  8036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  8037. // If there are more open entities we want to stop right here and have the
  8038. // upcoming call to XML_ResumeParser continue with entity content, or it would
  8039. // be ignored altogether.
  8040. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != libc.UintptrFromInt32(0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  8041. return int32(_XML_ERROR_NONE)
  8042. }
  8043. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  8044. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  8045. 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)
  8046. 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))
  8047. } else {
  8048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  8049. /* see externalEntityContentProcessor vs contentProcessor */
  8050. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  8051. v1 = int32(1)
  8052. } else {
  8053. v1 = 0
  8054. }
  8055. 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))
  8056. if result == int32(_XML_ERROR_NONE) {
  8057. if !(_storeRawNames(tls, parser) != 0) {
  8058. return int32(_XML_ERROR_NO_MEMORY)
  8059. }
  8060. }
  8061. return result
  8062. }
  8063. return r
  8064. }
  8065. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  8066. _ = s
  8067. _ = end
  8068. _ = nextPtr
  8069. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  8070. }
  8071. 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) {
  8072. var result _XML_Error
  8073. var v1 int32
  8074. var v2, v3 uintptr
  8075. _, _, _, _ = result, v1, v2, v3
  8076. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool, account)
  8077. if result != 0 {
  8078. return result
  8079. }
  8080. if !(isCdata != 0) && int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8081. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  8082. }
  8083. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8084. v1 = 0
  8085. } else {
  8086. v3 = pool + 12
  8087. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8088. *(*uintptr)(unsafe.Pointer(v3))++
  8089. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8090. v1 = libc.Int32FromInt32(1)
  8091. }
  8092. if !(v1 != 0) {
  8093. return int32(_XML_ERROR_NO_MEMORY)
  8094. }
  8095. return int32(_XML_ERROR_NONE)
  8096. }
  8097. 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) {
  8098. bp := tls.Alloc(16)
  8099. defer tls.Free(16)
  8100. var checkEntityDecl int8
  8101. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  8102. var i, n, tok, v12, v3, v6, v9 int32
  8103. var result _XML_Error
  8104. var v13 bool
  8105. var _ /* buf at bp+4 */ [4]TXML_Char
  8106. var _ /* ch at bp+8 */ TXML_Char
  8107. var _ /* next at bp+0 */ uintptr
  8108. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  8109. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8110. for {
  8111. *(*uintptr)(unsafe.Pointer(bp)) = ptr /* XmlAttributeValueTok doesn't always set the last arg */
  8112. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 16))})))(tls, enc, ptr, end, bp)
  8113. if !(_accountingDiffTolerated(tls, parser, tok, ptr, *(*uintptr)(unsafe.Pointer(bp)), int32(5896), account) != 0) {
  8114. _accountingOnAbort(tls, parser)
  8115. return int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8116. }
  8117. switch tok {
  8118. case -int32(4):
  8119. return int32(_XML_ERROR_NONE)
  8120. case m_XML_TOK_INVALID:
  8121. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8122. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8123. }
  8124. return int32(_XML_ERROR_INVALID_TOKEN)
  8125. case -int32(1):
  8126. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8127. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8128. }
  8129. return int32(_XML_ERROR_INVALID_TOKEN)
  8130. case int32(m_XML_TOK_CHAR_REF):
  8131. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  8132. if n < 0 {
  8133. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8134. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8135. }
  8136. return int32(_XML_ERROR_BAD_CHAR_REF)
  8137. }
  8138. if !(isCdata != 0) && n == int32(0x20) && (int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8139. break
  8140. }
  8141. n = XXmlUtf8Encode(tls, n, bp+4)
  8142. /* The XmlEncode() functions can never return 0 here. That
  8143. * error return happens if the code point passed in is either
  8144. * negative or greater than or equal to 0x110000. The
  8145. * XmlCharRefNumber() functions will all return a number
  8146. * strictly less than 0x110000 or a negative value if an error
  8147. * occurred. The negative value is intercepted above, so
  8148. * XmlEncode() is never passed a value it might return an
  8149. * error for.
  8150. */
  8151. i = 0
  8152. for {
  8153. if !(i < n) {
  8154. break
  8155. }
  8156. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8157. v3 = 0
  8158. } else {
  8159. v5 = pool + 12
  8160. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8161. *(*uintptr)(unsafe.Pointer(v5))++
  8162. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 4)))[i]
  8163. v3 = libc.Int32FromInt32(1)
  8164. }
  8165. if !(v3 != 0) {
  8166. return int32(_XML_ERROR_NO_MEMORY)
  8167. }
  8168. goto _2
  8169. _2:
  8170. ;
  8171. i++
  8172. }
  8173. case int32(m_XML_TOK_DATA_CHARS):
  8174. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8175. return int32(_XML_ERROR_NO_MEMORY)
  8176. }
  8177. case -int32(3):
  8178. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8179. /* fall through */
  8180. fallthrough
  8181. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  8182. fallthrough
  8183. case int32(m_XML_TOK_DATA_NEWLINE):
  8184. if !(isCdata != 0) && (int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || int32(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  8185. break
  8186. }
  8187. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8188. v6 = 0
  8189. } else {
  8190. v8 = pool + 12
  8191. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8192. *(*uintptr)(unsafe.Pointer(v8))++
  8193. *(*TXML_Char)(unsafe.Pointer(v7)) = int8(0x20)
  8194. v6 = libc.Int32FromInt32(1)
  8195. }
  8196. if !(v6 != 0) {
  8197. return int32(_XML_ERROR_NO_MEMORY)
  8198. }
  8199. case int32(m_XML_TOK_ENTITY_REF):
  8200. *(*TXML_Char)(unsafe.Pointer(bp + 8)) = int8((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  8201. if *(*TXML_Char)(unsafe.Pointer(bp + 8)) != 0 {
  8202. /* NOTE: We are replacing 4-6 characters original input for 1 character
  8203. * so there is no amplification and hence recording without
  8204. * protection. */
  8205. _accountingDiffTolerated(tls, parser, tok, bp+8, bp+8+uintptr(1), int32(5965), int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8206. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  8207. v9 = 0
  8208. } else {
  8209. v11 = pool + 12
  8210. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8211. *(*uintptr)(unsafe.Pointer(v11))++
  8212. *(*TXML_Char)(unsafe.Pointer(v10)) = *(*TXML_Char)(unsafe.Pointer(bp + 8))
  8213. v9 = libc.Int32FromInt32(1)
  8214. }
  8215. if !(v9 != 0) {
  8216. return int32(_XML_ERROR_NO_MEMORY)
  8217. }
  8218. break
  8219. }
  8220. name = _poolStoreString(tls, parser+436, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8221. if !(name != 0) {
  8222. return int32(_XML_ERROR_NO_MEMORY)
  8223. }
  8224. entity = _lookup(tls, parser, dtd, name, uint32(0))
  8225. (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 436)).Fstart
  8226. /* First, determine if a check for an existing declaration is needed;
  8227. if yes, check that the entity exists, and that it is internal.
  8228. */
  8229. if pool == dtd+80 { /* are we called from prolog? */
  8230. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  8231. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  8232. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  8233. } else {
  8234. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  8235. }
  8236. }
  8237. checkEntityDecl = libc.BoolInt8(v13 && v12 != 0)
  8238. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  8239. checkEntityDecl = libc.BoolInt8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  8240. }
  8241. if checkEntityDecl != 0 {
  8242. if !(entity != 0) {
  8243. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  8244. } else {
  8245. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  8246. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  8247. }
  8248. }
  8249. } else {
  8250. if !(entity != 0) {
  8251. /* Cannot report skipped entity here - see comments on
  8252. parser->m_skippedEntityHandler.
  8253. if (parser->m_skippedEntityHandler)
  8254. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8255. */
  8256. /* Cannot call the default handler because this would be
  8257. out of sync with the call to the startElementHandler.
  8258. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  8259. reportDefault(parser, enc, ptr, next);
  8260. */
  8261. break
  8262. }
  8263. }
  8264. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8265. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8266. /* It does not appear that this line can be executed.
  8267. *
  8268. * The "if (entity->open)" check catches recursive entity
  8269. * definitions. In order to be called with an open
  8270. * entity, it must have gone through this code before and
  8271. * been through the recursive call to
  8272. * appendAttributeValue() some lines below. That call
  8273. * sets the local encoding ("enc") to the parser's
  8274. * internal encoding (internal_utf8 or internal_utf16),
  8275. * which can never be the same as the principle encoding.
  8276. * It doesn't appear there is another code path that gets
  8277. * here with entity->open being TRUE.
  8278. *
  8279. * Since it is not certain that this logic is watertight,
  8280. * we keep the line and merely exclude it from coverage
  8281. * tests.
  8282. */
  8283. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  8284. }
  8285. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8286. }
  8287. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  8288. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8289. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8290. }
  8291. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  8292. }
  8293. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  8294. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8296. }
  8297. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  8298. } else {
  8299. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  8300. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8301. _entityTrackingOnOpen(tls, parser, entity, int32(6046))
  8302. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool, int32(_XML_ACCOUNT_ENTITY_EXPANSION))
  8303. _entityTrackingOnClose(tls, parser, entity, int32(6053))
  8304. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8305. if result != 0 {
  8306. return result
  8307. }
  8308. }
  8309. default:
  8310. /* The only token returned by XmlAttributeValueTok() that does
  8311. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  8312. * Getting that would require an entity name to contain an
  8313. * incomplete XML character (e.g. \xE2\x82); however previous
  8314. * tokenisers will have already recognised and rejected such
  8315. * names before XmlAttributeValueTok() gets a look-in. This
  8316. * default case should be retained as a safety net, but the code
  8317. * excluded from coverage tests.
  8318. *
  8319. * LCOV_EXCL_START
  8320. */
  8321. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8322. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  8323. }
  8324. return int32(_XML_ERROR_UNEXPECTED_STATE)
  8325. /* LCOV_EXCL_STOP */
  8326. }
  8327. ptr = *(*uintptr)(unsafe.Pointer(bp))
  8328. goto _1
  8329. _1:
  8330. }
  8331. /* not reached */
  8332. return r
  8333. }
  8334. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr, account _XML_Account) (r _XML_Error) {
  8335. bp := tls.Alloc(16)
  8336. defer tls.Free(16)
  8337. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  8338. var i, n, oldInEntityValue, tok int32
  8339. var result _XML_Error
  8340. var _ /* buf at bp+4 */ [4]TXML_Char
  8341. var _ /* next at bp+0 */ uintptr
  8342. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  8343. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8344. pool = dtd + 104
  8345. result = int32(_XML_ERROR_NONE)
  8346. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  8347. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  8348. /* never return Null for the value argument in EntityDeclHandler,
  8349. since this would indicate an external entity; therefore we
  8350. have to make sure that entityValuePool.start is not null */
  8351. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  8352. if !(_poolGrow(tls, pool) != 0) {
  8353. return int32(_XML_ERROR_NO_MEMORY)
  8354. }
  8355. }
  8356. for {
  8357. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr /* XmlEntityValueTok doesn't always set the last arg */
  8358. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 16 + 1*4))})))(tls, enc, entityTextPtr, entityTextEnd, bp)
  8359. if !(_accountingDiffTolerated(tls, parser, tok, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp)), int32(6109), account) != 0) {
  8360. _accountingOnAbort(tls, parser)
  8361. result = int32(_XML_ERROR_AMPLIFICATION_LIMIT_BREACH)
  8362. goto endEntityValue
  8363. }
  8364. switch tok {
  8365. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  8366. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8367. name = _poolStoreString(tls, parser+412, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  8368. if !(name != 0) {
  8369. result = int32(_XML_ERROR_NO_MEMORY)
  8370. goto endEntityValue
  8371. }
  8372. entity = _lookup(tls, parser, dtd+132, name, uint32(0))
  8373. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  8374. if !(entity != 0) {
  8375. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  8376. /* cannot report skipped entity here - see comments on
  8377. parser->m_skippedEntityHandler
  8378. if (parser->m_skippedEntityHandler)
  8379. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  8380. */
  8381. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8382. goto endEntityValue
  8383. }
  8384. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  8385. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8386. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8387. }
  8388. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  8389. goto endEntityValue
  8390. }
  8391. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  8392. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  8393. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  8394. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8395. _entityTrackingOnOpen(tls, parser, entity, int32(6152))
  8396. 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) {
  8397. _entityTrackingOnClose(tls, parser, entity, int32(6156))
  8398. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8399. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  8400. goto endEntityValue
  8401. }
  8402. _entityTrackingOnClose(tls, parser, entity, int32(6161))
  8403. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8404. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  8405. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8406. }
  8407. } else {
  8408. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  8409. }
  8410. } else {
  8411. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  8412. _entityTrackingOnOpen(tls, parser, entity, int32(6169))
  8413. 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))
  8414. _entityTrackingOnClose(tls, parser, entity, int32(6174))
  8415. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  8416. if result != 0 {
  8417. goto endEntityValue
  8418. }
  8419. }
  8420. break
  8421. }
  8422. /* In the internal subset, PE references are not legal
  8423. within markup declarations, e.g entity values in this case. */
  8424. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8425. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  8426. goto endEntityValue
  8427. case -int32(4):
  8428. result = int32(_XML_ERROR_NONE)
  8429. goto endEntityValue
  8430. case int32(m_XML_TOK_ENTITY_REF):
  8431. fallthrough
  8432. case int32(m_XML_TOK_DATA_CHARS):
  8433. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8434. result = int32(_XML_ERROR_NO_MEMORY)
  8435. goto endEntityValue
  8436. }
  8437. case -int32(3):
  8438. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8439. /* fall through */
  8440. fallthrough
  8441. case int32(m_XML_TOK_DATA_NEWLINE):
  8442. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8443. result = int32(_XML_ERROR_NO_MEMORY)
  8444. goto endEntityValue
  8445. }
  8446. v3 = pool + 12
  8447. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8448. *(*uintptr)(unsafe.Pointer(v3))++
  8449. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8450. case int32(m_XML_TOK_CHAR_REF):
  8451. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8452. if n < 0 {
  8453. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8454. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8455. }
  8456. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8457. goto endEntityValue
  8458. }
  8459. n = XXmlUtf8Encode(tls, n, bp+4)
  8460. /* The XmlEncode() functions can never return 0 here. That
  8461. * error return happens if the code point passed in is either
  8462. * negative or greater than or equal to 0x110000. The
  8463. * XmlCharRefNumber() functions will all return a number
  8464. * strictly less than 0x110000 or a negative value if an error
  8465. * occurred. The negative value is intercepted above, so
  8466. * XmlEncode() is never passed a value it might return an
  8467. * error for.
  8468. */
  8469. i = 0
  8470. for {
  8471. if !(i < n) {
  8472. break
  8473. }
  8474. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8475. result = int32(_XML_ERROR_NO_MEMORY)
  8476. goto endEntityValue
  8477. }
  8478. v6 = pool + 12
  8479. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8480. *(*uintptr)(unsafe.Pointer(v6))++
  8481. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 4)))[i]
  8482. goto _4
  8483. _4:
  8484. ;
  8485. i++
  8486. }
  8487. case -int32(1):
  8488. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8489. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8490. }
  8491. result = int32(_XML_ERROR_INVALID_TOKEN)
  8492. goto endEntityValue
  8493. case m_XML_TOK_INVALID:
  8494. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8495. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8496. }
  8497. result = int32(_XML_ERROR_INVALID_TOKEN)
  8498. goto endEntityValue
  8499. default:
  8500. /* This default case should be unnecessary -- all the tokens
  8501. * that XmlEntityValueTok() can return have their own explicit
  8502. * cases -- but should be retained for safety. We do however
  8503. * exclude it from the coverage statistics.
  8504. *
  8505. * LCOV_EXCL_START
  8506. */
  8507. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8508. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8509. }
  8510. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8511. goto endEntityValue
  8512. /* LCOV_EXCL_STOP */
  8513. }
  8514. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8515. goto _1
  8516. _1:
  8517. }
  8518. goto endEntityValue
  8519. endEntityValue:
  8520. ;
  8521. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8522. return result
  8523. }
  8524. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8525. var p, v2, v3, v4, v5 uintptr
  8526. _, _, _, _, _ = p, v2, v3, v4, v5
  8527. for {
  8528. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8529. return
  8530. }
  8531. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8532. break
  8533. }
  8534. goto _1
  8535. _1:
  8536. ;
  8537. s++
  8538. }
  8539. p = s
  8540. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8541. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8542. v2 = p
  8543. p++
  8544. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0xA)
  8545. s++
  8546. v3 = s
  8547. if int32(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8548. s++
  8549. }
  8550. } else {
  8551. v4 = p
  8552. p++
  8553. v5 = s
  8554. s++
  8555. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8556. }
  8557. }
  8558. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  8559. }
  8560. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8561. var data, target, tem uintptr
  8562. _, _, _ = data, target, tem
  8563. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8564. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8565. _reportDefault(tls, parser, enc, start, end)
  8566. }
  8567. return int32(1)
  8568. }
  8569. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8570. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8571. target = _poolStoreString(tls, parser+412, enc, start, tem)
  8572. if !(target != 0) {
  8573. return 0
  8574. }
  8575. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr
  8576. data = _poolStoreString(tls, parser+412, 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)))
  8577. if !(data != 0) {
  8578. return 0
  8579. }
  8580. _normalizeLines(tls, data)
  8581. (*(*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)
  8582. _poolClear(tls, parser+412)
  8583. return int32(1)
  8584. }
  8585. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8586. var data uintptr
  8587. _ = data
  8588. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8589. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8590. _reportDefault(tls, parser, enc, start, end)
  8591. }
  8592. return int32(1)
  8593. }
  8594. data = _poolStoreString(tls, parser+412, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8595. if !(data != 0) {
  8596. return 0
  8597. }
  8598. _normalizeLines(tls, data)
  8599. (*(*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)
  8600. _poolClear(tls, parser+412)
  8601. return int32(1)
  8602. }
  8603. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8604. bp := tls.Alloc(16)
  8605. defer tls.Free(16)
  8606. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8607. var convert_res _XML_Convert_Result
  8608. var eventEndPP, eventPP uintptr
  8609. var _ /* dataPtr at bp+4 */ uintptr
  8610. _, _, _ = convert_res, eventEndPP, eventPP
  8611. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8612. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8613. eventPP = parser + 284
  8614. eventEndPP = parser + 288
  8615. } else {
  8616. /* To get here, two things must be true; the parser must be
  8617. * using a character encoding that is not the same as the
  8618. * encoding passed in, and the encoding passed in must need
  8619. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8620. * is defined). The only occasions on which the encoding passed
  8621. * in is not the same as the parser's encoding are when it is
  8622. * the internal encoding (e.g. a previously defined parameter
  8623. * entity, already converted to internal format). This by
  8624. * definition doesn't need conversion, so the whole branch never
  8625. * gets executed.
  8626. *
  8627. * For safety's sake we don't delete these lines and merely
  8628. * exclude them from coverage statistics.
  8629. *
  8630. * LCOV_EXCL_START
  8631. */
  8632. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8633. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 4
  8634. /* LCOV_EXCL_STOP */
  8635. }
  8636. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8637. *(*uintptr)(unsafe.Pointer(bp + 4)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8638. 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+4, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  8639. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8640. (*(*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(*(*uintptr)(unsafe.Pointer(bp + 4)))-int32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf))
  8641. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8642. }
  8643. } else {
  8644. (*(*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(end)-int32(*(*uintptr)(unsafe.Pointer(bp))))
  8645. }
  8646. }
  8647. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8648. var att, temp uintptr
  8649. var count, i int32
  8650. _, _, _, _ = att, count, i, temp
  8651. if value != 0 || isId != 0 {
  8652. i = 0
  8653. for {
  8654. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8655. break
  8656. }
  8657. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*12))).Fid {
  8658. return int32(1)
  8659. }
  8660. goto _1
  8661. _1:
  8662. ;
  8663. i++
  8664. }
  8665. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8666. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8667. }
  8668. }
  8669. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8670. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8671. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8672. (*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.Uint32FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts)*libc.Uint32FromInt64(12))
  8673. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8674. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8675. return 0
  8676. }
  8677. } else {
  8678. /* Detect and prevent integer overflow */
  8679. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts > libc.Int32FromInt32(m_INT_MAX)/libc.Int32FromInt32(2) {
  8680. return 0
  8681. }
  8682. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8683. /* Detect and prevent integer overflow.
  8684. * The preprocessor guard addresses the "always false" warning
  8685. * from -Wtype-limits on platforms where
  8686. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  8687. if libc.Uint32FromInt32(count) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(12) {
  8688. return 0
  8689. }
  8690. 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.Uint32FromInt32(count)*libc.Uint32FromInt64(12))
  8691. if temp == libc.UintptrFromInt32(0) {
  8692. return 0
  8693. }
  8694. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8695. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8696. }
  8697. }
  8698. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*12
  8699. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8700. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8701. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8702. if !(isCdata != 0) {
  8703. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8704. }
  8705. *(*int32)(unsafe.Pointer(type1 + 12)) += int32(1)
  8706. return int32(1)
  8707. }
  8708. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8709. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8710. var v3, v6 int32
  8711. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8712. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8713. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8714. for {
  8715. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8716. break
  8717. }
  8718. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8719. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8720. for {
  8721. if !(s != name) {
  8722. break
  8723. }
  8724. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8725. v3 = 0
  8726. } else {
  8727. v5 = dtd + 80 + 12
  8728. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8729. *(*uintptr)(unsafe.Pointer(v5))++
  8730. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8731. v3 = libc.Int32FromInt32(1)
  8732. }
  8733. if !(v3 != 0) {
  8734. return 0
  8735. }
  8736. goto _2
  8737. _2:
  8738. ;
  8739. s++
  8740. }
  8741. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8742. v6 = 0
  8743. } else {
  8744. v8 = dtd + 80 + 12
  8745. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8746. *(*uintptr)(unsafe.Pointer(v8))++
  8747. *(*TXML_Char)(unsafe.Pointer(v7)) = int8('\000')
  8748. v6 = libc.Int32FromInt32(1)
  8749. }
  8750. if !(v6 != 0) {
  8751. return 0
  8752. }
  8753. prefix = _lookup(tls, parser, dtd+60, (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart, uint32(8))
  8754. if !(prefix != 0) {
  8755. return 0
  8756. }
  8757. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart {
  8758. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  8759. } else {
  8760. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  8761. }
  8762. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8763. break
  8764. }
  8765. goto _1
  8766. _1:
  8767. ;
  8768. name++
  8769. }
  8770. return int32(1)
  8771. }
  8772. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8773. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8774. var i, j, v1, v6, v9 int32
  8775. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8776. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8777. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8778. v1 = 0
  8779. } else {
  8780. v3 = dtd + 80 + 12
  8781. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8782. *(*uintptr)(unsafe.Pointer(v3))++
  8783. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  8784. v1 = libc.Int32FromInt32(1)
  8785. }
  8786. if !(v1 != 0) {
  8787. return libc.UintptrFromInt32(0)
  8788. }
  8789. name = _poolStoreString(tls, dtd+80, enc, start, end)
  8790. if !(name != 0) {
  8791. return libc.UintptrFromInt32(0)
  8792. }
  8793. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8794. name++
  8795. id = _lookup(tls, parser, dtd+40, name, uint32(12))
  8796. if !(id != 0) {
  8797. return libc.UintptrFromInt32(0)
  8798. }
  8799. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8800. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  8801. } else {
  8802. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  8803. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8804. if int32(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && int32(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && int32(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && int32(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && int32(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  8805. if int32(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8806. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 152
  8807. } else {
  8808. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+60, name+uintptr(6), uint32(8))
  8809. }
  8810. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8811. } else {
  8812. i = 0
  8813. for {
  8814. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8815. break
  8816. }
  8817. /* attributes without prefix are *not* in the default namespace */
  8818. if int32(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8819. j = 0
  8820. for {
  8821. if !(j < i) {
  8822. break
  8823. }
  8824. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8825. v6 = 0
  8826. } else {
  8827. v8 = dtd + 80 + 12
  8828. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8829. *(*uintptr)(unsafe.Pointer(v8))++
  8830. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8831. v6 = libc.Int32FromInt32(1)
  8832. }
  8833. if !(v6 != 0) {
  8834. return libc.UintptrFromInt32(0)
  8835. }
  8836. goto _5
  8837. _5:
  8838. ;
  8839. j++
  8840. }
  8841. if (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fend && !(_poolGrow(tls, dtd+80) != 0) {
  8842. v9 = 0
  8843. } else {
  8844. v11 = dtd + 80 + 12
  8845. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8846. *(*uintptr)(unsafe.Pointer(v11))++
  8847. *(*TXML_Char)(unsafe.Pointer(v10)) = int8('\000')
  8848. v9 = libc.Int32FromInt32(1)
  8849. }
  8850. if !(v9 != 0) {
  8851. return libc.UintptrFromInt32(0)
  8852. }
  8853. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+60, (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart, uint32(8))
  8854. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8855. return libc.UintptrFromInt32(0)
  8856. }
  8857. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+80)).Fstart {
  8858. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  8859. } else {
  8860. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  8861. }
  8862. break
  8863. }
  8864. goto _4
  8865. _4:
  8866. ;
  8867. i++
  8868. }
  8869. }
  8870. }
  8871. }
  8872. return id
  8873. }
  8874. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8875. bp := tls.Alloc(16)
  8876. defer tls.Free(16)
  8877. 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
  8878. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8879. var needSep TXML_Bool
  8880. var v12, v28 bool
  8881. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8882. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8883. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8884. needSep = libc.Uint8FromInt32(0)
  8885. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8886. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8887. v1 = 0
  8888. } else {
  8889. v3 = parser + 412 + 12
  8890. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8891. *(*uintptr)(unsafe.Pointer(v3))++
  8892. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(m_ASCII_EQUALS)
  8893. v1 = libc.Int32FromInt32(1)
  8894. }
  8895. if !(v1 != 0) {
  8896. return libc.UintptrFromInt32(0)
  8897. }
  8898. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8899. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8900. len1--
  8901. }
  8902. i = 0
  8903. for {
  8904. if !(i < len1) {
  8905. break
  8906. }
  8907. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8908. v5 = 0
  8909. } else {
  8910. v7 = parser + 412 + 12
  8911. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8912. *(*uintptr)(unsafe.Pointer(v7))++
  8913. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8914. v5 = libc.Int32FromInt32(1)
  8915. }
  8916. if !(v5 != 0) {
  8917. /* Because of memory caching, I don't believe this line can be
  8918. * executed.
  8919. *
  8920. * This is part of a loop copying the default prefix binding
  8921. * URI into the parser's temporary string pool. Previously,
  8922. * that URI was copied into the same string pool, with a
  8923. * terminating NUL character, as part of setContext(). When
  8924. * the pool was cleared, that leaves a block definitely big
  8925. * enough to hold the URI on the free block list of the pool.
  8926. * The URI copy in getContext() therefore cannot run out of
  8927. * memory.
  8928. *
  8929. * If the pool is used between the setContext() and
  8930. * getContext() calls, the worst it can do is leave a bigger
  8931. * block on the front of the free list. Given that this is
  8932. * all somewhat inobvious and program logic can be changed, we
  8933. * don't delete the line but we do exclude it from the test
  8934. * coverage statistics.
  8935. */
  8936. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  8937. }
  8938. goto _4
  8939. _4:
  8940. ;
  8941. i++
  8942. }
  8943. needSep = libc.Uint8FromInt32(1)
  8944. }
  8945. _hashTableIterInit(tls, bp, dtd+60)
  8946. for {
  8947. prefix = _hashTableIterNext(tls, bp)
  8948. if !(prefix != 0) {
  8949. break
  8950. }
  8951. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  8952. /* This test appears to be (justifiable) paranoia. There does
  8953. * not seem to be a way of injecting a prefix without a binding
  8954. * that doesn't get errored long before this function is called.
  8955. * The test should remain for safety's sake, so we instead
  8956. * exclude the following line from the coverage statistics.
  8957. */
  8958. goto _8 /* LCOV_EXCL_LINE */
  8959. }
  8960. if v12 = needSep != 0; v12 {
  8961. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8962. v9 = 0
  8963. } else {
  8964. v11 = parser + 412 + 12
  8965. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8966. *(*uintptr)(unsafe.Pointer(v11))++
  8967. *(*TXML_Char)(unsafe.Pointer(v10)) = int8(m_ASCII_FF)
  8968. v9 = libc.Int32FromInt32(1)
  8969. }
  8970. }
  8971. if v12 && !(v9 != 0) {
  8972. return libc.UintptrFromInt32(0)
  8973. }
  8974. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  8975. for {
  8976. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8977. break
  8978. }
  8979. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8980. v14 = 0
  8981. } else {
  8982. v16 = parser + 412 + 12
  8983. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8984. *(*uintptr)(unsafe.Pointer(v16))++
  8985. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8986. v14 = libc.Int32FromInt32(1)
  8987. }
  8988. if !(v14 != 0) {
  8989. return libc.UintptrFromInt32(0)
  8990. }
  8991. goto _13
  8992. _13:
  8993. ;
  8994. s++
  8995. }
  8996. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  8997. v17 = 0
  8998. } else {
  8999. v19 = parser + 412 + 12
  9000. v18 = *(*uintptr)(unsafe.Pointer(v19))
  9001. *(*uintptr)(unsafe.Pointer(v19))++
  9002. *(*TXML_Char)(unsafe.Pointer(v18)) = int8(m_ASCII_EQUALS)
  9003. v17 = libc.Int32FromInt32(1)
  9004. }
  9005. if !(v17 != 0) {
  9006. return libc.UintptrFromInt32(0)
  9007. }
  9008. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  9009. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  9010. len11--
  9011. }
  9012. i1 = 0
  9013. for {
  9014. if !(i1 < len11) {
  9015. break
  9016. }
  9017. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9018. v21 = 0
  9019. } else {
  9020. v23 = parser + 412 + 12
  9021. v22 = *(*uintptr)(unsafe.Pointer(v23))
  9022. *(*uintptr)(unsafe.Pointer(v23))++
  9023. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  9024. v21 = libc.Int32FromInt32(1)
  9025. }
  9026. if !(v21 != 0) {
  9027. return libc.UintptrFromInt32(0)
  9028. }
  9029. goto _20
  9030. _20:
  9031. ;
  9032. i1++
  9033. }
  9034. needSep = libc.Uint8FromInt32(1)
  9035. goto _8
  9036. _8:
  9037. }
  9038. _hashTableIterInit(tls, bp, dtd)
  9039. for {
  9040. e = _hashTableIterNext(tls, bp)
  9041. if !(e != 0) {
  9042. break
  9043. }
  9044. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  9045. goto _24
  9046. }
  9047. if v28 = needSep != 0; v28 {
  9048. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9049. v25 = 0
  9050. } else {
  9051. v27 = parser + 412 + 12
  9052. v26 = *(*uintptr)(unsafe.Pointer(v27))
  9053. *(*uintptr)(unsafe.Pointer(v27))++
  9054. *(*TXML_Char)(unsafe.Pointer(v26)) = int8(m_ASCII_FF)
  9055. v25 = libc.Int32FromInt32(1)
  9056. }
  9057. }
  9058. if v28 && !(v25 != 0) {
  9059. return libc.UintptrFromInt32(0)
  9060. }
  9061. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  9062. for {
  9063. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  9064. break
  9065. }
  9066. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9067. v30 = 0
  9068. } else {
  9069. v32 = parser + 412 + 12
  9070. v31 = *(*uintptr)(unsafe.Pointer(v32))
  9071. *(*uintptr)(unsafe.Pointer(v32))++
  9072. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  9073. v30 = libc.Int32FromInt32(1)
  9074. }
  9075. if !(v30 != 0) {
  9076. return uintptr(0)
  9077. }
  9078. goto _29
  9079. _29:
  9080. ;
  9081. s1++
  9082. }
  9083. needSep = libc.Uint8FromInt32(1)
  9084. goto _24
  9085. _24:
  9086. }
  9087. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9088. v33 = 0
  9089. } else {
  9090. v35 = parser + 412 + 12
  9091. v34 = *(*uintptr)(unsafe.Pointer(v35))
  9092. *(*uintptr)(unsafe.Pointer(v35))++
  9093. *(*TXML_Char)(unsafe.Pointer(v34)) = int8('\000')
  9094. v33 = libc.Int32FromInt32(1)
  9095. }
  9096. if !(v33 != 0) {
  9097. return libc.UintptrFromInt32(0)
  9098. }
  9099. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  9100. }
  9101. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  9102. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  9103. var v1, v11, v14, v4, v8 int32
  9104. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  9105. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9106. s = context
  9107. for int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9108. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  9109. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9110. v1 = 0
  9111. } else {
  9112. v3 = parser + 412 + 12
  9113. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9114. *(*uintptr)(unsafe.Pointer(v3))++
  9115. *(*TXML_Char)(unsafe.Pointer(v2)) = int8('\000')
  9116. v1 = libc.Int32FromInt32(1)
  9117. }
  9118. if !(v1 != 0) {
  9119. return libc.Uint8FromInt32(0)
  9120. }
  9121. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart, uint32(0))
  9122. if e != 0 {
  9123. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  9124. }
  9125. if int32(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  9126. s++
  9127. }
  9128. context = s
  9129. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  9130. } else {
  9131. if int32(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  9132. if int32((*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart) == 0 {
  9133. prefix = dtd + 152
  9134. } else {
  9135. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9136. v4 = 0
  9137. } else {
  9138. v6 = parser + 412 + 12
  9139. v5 = *(*uintptr)(unsafe.Pointer(v6))
  9140. *(*uintptr)(unsafe.Pointer(v6))++
  9141. *(*TXML_Char)(unsafe.Pointer(v5)) = int8('\000')
  9142. v4 = libc.Int32FromInt32(1)
  9143. }
  9144. if !(v4 != 0) {
  9145. return libc.Uint8FromInt32(0)
  9146. }
  9147. prefix = _lookup(tls, parser, dtd+60, (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart, uint32(8))
  9148. if !(prefix != 0) {
  9149. return libc.Uint8FromInt32(0)
  9150. }
  9151. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart {
  9152. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+80, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  9153. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  9154. return libc.Uint8FromInt32(0)
  9155. }
  9156. }
  9157. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  9158. }
  9159. context = s + uintptr(1)
  9160. for {
  9161. if !(int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  9162. break
  9163. }
  9164. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9165. v8 = 0
  9166. } else {
  9167. v10 = parser + 412 + 12
  9168. v9 = *(*uintptr)(unsafe.Pointer(v10))
  9169. *(*uintptr)(unsafe.Pointer(v10))++
  9170. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  9171. v8 = libc.Int32FromInt32(1)
  9172. }
  9173. if !(v8 != 0) {
  9174. return libc.Uint8FromInt32(0)
  9175. }
  9176. goto _7
  9177. _7:
  9178. ;
  9179. context++
  9180. }
  9181. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9182. v11 = 0
  9183. } else {
  9184. v13 = parser + 412 + 12
  9185. v12 = *(*uintptr)(unsafe.Pointer(v13))
  9186. *(*uintptr)(unsafe.Pointer(v13))++
  9187. *(*TXML_Char)(unsafe.Pointer(v12)) = int8('\000')
  9188. v11 = libc.Int32FromInt32(1)
  9189. }
  9190. if !(v11 != 0) {
  9191. return libc.Uint8FromInt32(0)
  9192. }
  9193. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fstart, parser+368) != int32(_XML_ERROR_NONE) {
  9194. return libc.Uint8FromInt32(0)
  9195. }
  9196. (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 412)).Fstart
  9197. if int32(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  9198. context++
  9199. }
  9200. s = context
  9201. } else {
  9202. if (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+412)).Fend && !(_poolGrow(tls, parser+412) != 0) {
  9203. v14 = 0
  9204. } else {
  9205. v16 = parser + 412 + 12
  9206. v15 = *(*uintptr)(unsafe.Pointer(v16))
  9207. *(*uintptr)(unsafe.Pointer(v16))++
  9208. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  9209. v14 = libc.Int32FromInt32(1)
  9210. }
  9211. if !(v14 != 0) {
  9212. return libc.Uint8FromInt32(0)
  9213. }
  9214. s++
  9215. }
  9216. }
  9217. }
  9218. return libc.Uint8FromInt32(1)
  9219. }
  9220. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  9221. var p, s, v2, v3 uintptr
  9222. _, _, _, _ = p, s, v2, v3
  9223. p = publicId
  9224. s = publicId
  9225. for {
  9226. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9227. break
  9228. }
  9229. switch int32(*(*TXML_Char)(unsafe.Pointer(s))) {
  9230. case int32(0x20):
  9231. fallthrough
  9232. case int32(0xD):
  9233. fallthrough
  9234. case int32(0xA):
  9235. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  9236. v2 = p
  9237. p++
  9238. *(*TXML_Char)(unsafe.Pointer(v2)) = int8(0x20)
  9239. }
  9240. default:
  9241. v3 = p
  9242. p++
  9243. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9244. }
  9245. goto _1
  9246. _1:
  9247. ;
  9248. s++
  9249. }
  9250. if p != publicId && int32(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  9251. p--
  9252. }
  9253. *(*TXML_Char)(unsafe.Pointer(p)) = int8('\000')
  9254. }
  9255. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  9256. var p uintptr
  9257. _ = p
  9258. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint32(188))
  9259. if p == libc.UintptrFromInt32(0) {
  9260. return p
  9261. }
  9262. _poolInit(tls, p+80, ms)
  9263. _poolInit(tls, p+104, ms)
  9264. _hashTableInit(tls, p, ms)
  9265. _hashTableInit(tls, p+20, ms)
  9266. _hashTableInit(tls, p+40, ms)
  9267. _hashTableInit(tls, p+60, ms)
  9268. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9269. _hashTableInit(tls, p+132, ms)
  9270. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9271. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9272. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9273. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9274. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9275. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9276. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9277. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9278. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9279. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9280. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9281. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9282. return p
  9283. }
  9284. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  9285. bp := tls.Alloc(16)
  9286. defer tls.Free(16)
  9287. var e uintptr
  9288. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9289. _ = e
  9290. _hashTableIterInit(tls, bp, p+20)
  9291. for {
  9292. e = _hashTableIterNext(tls, bp)
  9293. if !(e != 0) {
  9294. break
  9295. }
  9296. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9297. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9298. }
  9299. goto _1
  9300. _1:
  9301. }
  9302. _hashTableClear(tls, p)
  9303. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  9304. _hashTableClear(tls, p+132)
  9305. _hashTableClear(tls, p+20)
  9306. _hashTableClear(tls, p+40)
  9307. _hashTableClear(tls, p+60)
  9308. _poolClear(tls, p+80)
  9309. _poolClear(tls, p+104)
  9310. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  9311. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  9312. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  9313. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9314. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  9315. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9316. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  9317. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  9318. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  9319. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  9320. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  9321. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  9322. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  9323. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  9324. }
  9325. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  9326. bp := tls.Alloc(16)
  9327. defer tls.Free(16)
  9328. var e uintptr
  9329. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9330. _ = e
  9331. _hashTableIterInit(tls, bp, p+20)
  9332. for {
  9333. e = _hashTableIterNext(tls, bp)
  9334. if !(e != 0) {
  9335. break
  9336. }
  9337. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  9338. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  9339. }
  9340. goto _1
  9341. _1:
  9342. }
  9343. _hashTableDestroy(tls, p)
  9344. _hashTableDestroy(tls, p+132)
  9345. _hashTableDestroy(tls, p+20)
  9346. _hashTableDestroy(tls, p+40)
  9347. _hashTableDestroy(tls, p+60)
  9348. _poolDestroy(tls, p+80)
  9349. _poolDestroy(tls, p+104)
  9350. if isDocEntity != 0 {
  9351. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  9352. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  9353. }
  9354. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  9355. }
  9356. // C documentation
  9357. //
  9358. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  9359. // The new DTD has already been initialized.
  9360. // */
  9361. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  9362. bp := tls.Alloc(16)
  9363. defer tls.Free(16)
  9364. var i, v3, v7 int32
  9365. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  9366. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9367. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  9368. /* Copy the prefix table. */
  9369. _hashTableIterInit(tls, bp, oldDtd+60)
  9370. for {
  9371. oldP = _hashTableIterNext(tls, bp)
  9372. if !(oldP != 0) {
  9373. break
  9374. }
  9375. name = _poolCopyString(tls, newDtd+80, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  9376. if !(name != 0) {
  9377. return 0
  9378. }
  9379. if !(_lookup(tls, oldParser, newDtd+60, name, uint32(8)) != 0) {
  9380. return 0
  9381. }
  9382. goto _1
  9383. _1:
  9384. }
  9385. _hashTableIterInit(tls, bp, oldDtd+40)
  9386. /* Copy the attribute id table. */
  9387. for {
  9388. oldA = _hashTableIterNext(tls, bp)
  9389. if !(oldA != 0) {
  9390. break
  9391. }
  9392. /* Remember to allocate the scratch byte before the name. */
  9393. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+80)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+80)).Fend && !(_poolGrow(tls, newDtd+80) != 0) {
  9394. v3 = 0
  9395. } else {
  9396. v5 = newDtd + 80 + 12
  9397. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9398. *(*uintptr)(unsafe.Pointer(v5))++
  9399. *(*TXML_Char)(unsafe.Pointer(v4)) = int8('\000')
  9400. v3 = libc.Int32FromInt32(1)
  9401. }
  9402. if !(v3 != 0) {
  9403. return 0
  9404. }
  9405. name1 = _poolCopyString(tls, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  9406. if !(name1 != 0) {
  9407. return 0
  9408. }
  9409. name1++
  9410. newA = _lookup(tls, oldParser, newDtd+40, name1, uint32(12))
  9411. if !(newA != 0) {
  9412. return 0
  9413. }
  9414. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  9415. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  9416. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  9417. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+152 {
  9418. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 152
  9419. } else {
  9420. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+60, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint32(0))
  9421. }
  9422. }
  9423. goto _2
  9424. _2:
  9425. }
  9426. /* Copy the element type table. */
  9427. _hashTableIterInit(tls, bp, oldDtd+20)
  9428. for {
  9429. oldE = _hashTableIterNext(tls, bp)
  9430. if !(oldE != 0) {
  9431. break
  9432. }
  9433. name2 = _poolCopyString(tls, newDtd+80, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  9434. if !(name2 != 0) {
  9435. return 0
  9436. }
  9437. newE = _lookup(tls, oldParser, newDtd+20, name2, uint32(24))
  9438. if !(newE != 0) {
  9439. return 0
  9440. }
  9441. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9442. (*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.Uint32FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts)*uint32(12))
  9443. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9444. return 0
  9445. }
  9446. }
  9447. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9448. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+40, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint32(0))
  9449. }
  9450. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9451. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9452. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9453. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9454. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+60, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint32(0))
  9455. }
  9456. i = 0
  9457. for {
  9458. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9459. break
  9460. }
  9461. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fid = _lookup(tls, oldParser, newDtd+40, (*TATTRIBUTE_ID)(unsafe.Pointer((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).Fid)).Fname, uint32(0))
  9462. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).FisCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).FisCdata
  9463. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).Fvalue != 0 {
  9464. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fvalue = _poolCopyString(tls, newDtd+80, (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*12))).Fvalue)
  9465. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fvalue != 0) {
  9466. return 0
  9467. }
  9468. } else {
  9469. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*12))).Fvalue = libc.UintptrFromInt32(0)
  9470. }
  9471. goto _8
  9472. _8:
  9473. ;
  9474. i++
  9475. }
  9476. goto _6
  9477. _6:
  9478. }
  9479. /* Copy the entity tables. */
  9480. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+80, oldDtd) != 0) {
  9481. return 0
  9482. }
  9483. if !(_copyEntityTable(tls, oldParser, newDtd+132, newDtd+80, oldDtd+132) != 0) {
  9484. return 0
  9485. }
  9486. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9487. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9488. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9489. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9490. /* Don't want deep copying for scaffolding */
  9491. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9492. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9493. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9494. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9495. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9496. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9497. return int32(1)
  9498. }
  9499. /* End dtdCopy */
  9500. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9501. bp := tls.Alloc(16)
  9502. defer tls.Free(16)
  9503. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9504. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9505. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9506. cachedOldBase = libc.UintptrFromInt32(0)
  9507. cachedNewBase = libc.UintptrFromInt32(0)
  9508. _hashTableIterInit(tls, bp, oldTable)
  9509. for {
  9510. oldE = _hashTableIterNext(tls, bp)
  9511. if !(oldE != 0) {
  9512. break
  9513. }
  9514. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9515. if !(name != 0) {
  9516. return 0
  9517. }
  9518. newE = _lookup(tls, oldParser, newTable, name, uint32(36))
  9519. if !(newE != 0) {
  9520. return 0
  9521. }
  9522. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9523. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9524. if !(tem != 0) {
  9525. return 0
  9526. }
  9527. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9528. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9529. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9530. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9531. } else {
  9532. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9533. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9534. if !(tem != 0) {
  9535. return 0
  9536. }
  9537. v2 = tem
  9538. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9539. cachedNewBase = v2
  9540. }
  9541. }
  9542. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9543. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9544. if !(tem != 0) {
  9545. return 0
  9546. }
  9547. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9548. }
  9549. } else {
  9550. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9551. if !(tem1 != 0) {
  9552. return 0
  9553. }
  9554. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9555. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9556. }
  9557. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9558. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9559. if !(tem2 != 0) {
  9560. return 0
  9561. }
  9562. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9563. }
  9564. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9565. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9566. goto _1
  9567. _1:
  9568. }
  9569. return int32(1)
  9570. }
  9571. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9572. for {
  9573. if !(int32(*(*TXML_Char)(unsafe.Pointer(s1))) == int32(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9574. break
  9575. }
  9576. if int32(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9577. return libc.Uint8FromInt32(1)
  9578. }
  9579. goto _1
  9580. _1:
  9581. ;
  9582. s1++
  9583. s2++
  9584. }
  9585. return libc.Uint8FromInt32(0)
  9586. }
  9587. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9588. var len1 Tsize_t
  9589. _ = len1
  9590. len1 = uint32(0)
  9591. for {
  9592. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9593. break
  9594. }
  9595. goto _1
  9596. _1:
  9597. ;
  9598. s++
  9599. len1++
  9600. }
  9601. return len1
  9602. }
  9603. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9604. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9605. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = uint64(_get_hash_secret_salt(tls, parser))
  9606. }
  9607. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint32) {
  9608. bp := tls.Alloc(80)
  9609. defer tls.Free(80)
  9610. var _ /* key at bp+52 */ Tsipkey
  9611. var _ /* state at bp+0 */ Tsiphash
  9612. _ = __ccgo_fp(_sip24_valid)
  9613. _copy_salt_to_sipkey(tls, parser, bp+52)
  9614. _sip24_init(tls, bp, bp+52)
  9615. _sip24_update(tls, bp, s, _keylen(tls, s)*uint32(1))
  9616. return uint32(_sip24_final(tls, bp))
  9617. }
  9618. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9619. var h, mask, newHash, newMask uint32
  9620. var i, j, newSize, tsize, tsize1 Tsize_t
  9621. var newPower, step uint8
  9622. var newV uintptr
  9623. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9624. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint32(0) {
  9625. if !(createSize != 0) {
  9626. return libc.UintptrFromInt32(0)
  9627. }
  9628. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9629. /* table->size is a power of 2 */
  9630. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint32FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9631. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint32(4)
  9632. (*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)
  9633. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9634. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint32(0)
  9635. return libc.UintptrFromInt32(0)
  9636. }
  9637. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9638. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint32(1))
  9639. } else {
  9640. h = _hash(tls, parser, name)
  9641. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint32(1)
  9642. step = uint8(0)
  9643. i = h & mask
  9644. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0 {
  9645. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)))).Fname) != 0 {
  9646. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4))
  9647. }
  9648. if !(step != 0) {
  9649. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  9650. }
  9651. if i < uint32(step) {
  9652. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint32(step)
  9653. } else {
  9654. i -= uint32(step)
  9655. }
  9656. }
  9657. if !(createSize != 0) {
  9658. return libc.UintptrFromInt32(0)
  9659. }
  9660. /* check for overflow (table is half full) */
  9661. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9662. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9663. /* Detect and prevent invalid shift */
  9664. if uint32(newPower) >= libc.Uint32FromInt64(4)*libc.Uint32FromInt32(8) {
  9665. return libc.UintptrFromInt32(0)
  9666. }
  9667. newSize = libc.Uint32FromInt32(1) << newPower
  9668. newMask = newSize - uint32(1)
  9669. /* Detect and prevent integer overflow */
  9670. if newSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(4) {
  9671. return libc.UintptrFromInt32(0)
  9672. }
  9673. tsize1 = newSize * uint32(4)
  9674. 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)
  9675. if !(newV != 0) {
  9676. return libc.UintptrFromInt32(0)
  9677. }
  9678. libc.Xmemset(tls, newV, 0, tsize1)
  9679. i = uint32(0)
  9680. for {
  9681. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9682. break
  9683. }
  9684. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0 {
  9685. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)))).Fname)
  9686. j = newHash & newMask
  9687. step = uint8(0)
  9688. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*4)) != 0 {
  9689. if !(step != 0) {
  9690. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  9691. }
  9692. if j < uint32(step) {
  9693. j += newSize - uint32(step)
  9694. } else {
  9695. j -= uint32(step)
  9696. }
  9697. }
  9698. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*4)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4))
  9699. }
  9700. goto _2
  9701. _2:
  9702. ;
  9703. i++
  9704. }
  9705. (*(*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)
  9706. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9707. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9708. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9709. i = h & newMask
  9710. step = uint8(0)
  9711. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0 {
  9712. if !(step != 0) {
  9713. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint32FromInt32(1))
  9714. }
  9715. if i < uint32(step) {
  9716. i += newSize - uint32(step)
  9717. } else {
  9718. i -= uint32(step)
  9719. }
  9720. }
  9721. }
  9722. }
  9723. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) = (*(*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)
  9724. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) != 0) {
  9725. return libc.UintptrFromInt32(0)
  9726. }
  9727. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)), 0, createSize)
  9728. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)))).Fname = name
  9729. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9730. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4))
  9731. }
  9732. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9733. var i Tsize_t
  9734. _ = i
  9735. i = uint32(0)
  9736. for {
  9737. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9738. break
  9739. }
  9740. (*(*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)*4)))
  9741. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*4)) = libc.UintptrFromInt32(0)
  9742. goto _1
  9743. _1:
  9744. ;
  9745. i++
  9746. }
  9747. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint32(0)
  9748. }
  9749. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9750. var i Tsize_t
  9751. _ = i
  9752. i = uint32(0)
  9753. for {
  9754. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9755. break
  9756. }
  9757. (*(*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)*4)))
  9758. goto _1
  9759. _1:
  9760. ;
  9761. i++
  9762. }
  9763. (*(*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)
  9764. }
  9765. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9766. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9767. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint32(0)
  9768. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint32(0)
  9769. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9770. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9771. }
  9772. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9773. var v1 uintptr
  9774. _ = v1
  9775. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9776. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9777. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*4
  9778. } else {
  9779. v1 = libc.UintptrFromInt32(0)
  9780. }
  9781. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9782. }
  9783. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9784. var tem, v1, v2 uintptr
  9785. _, _, _ = tem, v1, v2
  9786. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9787. v2 = iter
  9788. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9789. *(*uintptr)(unsafe.Pointer(v2)) += 4
  9790. tem = *(*uintptr)(unsafe.Pointer(v1))
  9791. if tem != 0 {
  9792. return tem
  9793. }
  9794. }
  9795. return libc.UintptrFromInt32(0)
  9796. }
  9797. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9798. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9799. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9800. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9801. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9802. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9803. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9804. }
  9805. func _poolClear(tls *libc.TLS, pool uintptr) {
  9806. var p, tem uintptr
  9807. _, _ = p, tem
  9808. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9809. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9810. } else {
  9811. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9812. for p != 0 {
  9813. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9814. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9815. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9816. p = tem
  9817. }
  9818. }
  9819. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9820. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9821. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9822. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9823. }
  9824. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9825. var p, tem, tem1 uintptr
  9826. _, _, _ = p, tem, tem1
  9827. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9828. for p != 0 {
  9829. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9830. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9831. p = tem
  9832. }
  9833. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9834. for p != 0 {
  9835. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9836. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9837. p = tem1
  9838. }
  9839. }
  9840. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9841. bp := tls.Alloc(16)
  9842. defer tls.Free(16)
  9843. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9844. var convert_res _XML_Convert_Result
  9845. _ = convert_res
  9846. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9847. return libc.UintptrFromInt32(0)
  9848. }
  9849. for {
  9850. 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+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)
  9851. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9852. break
  9853. }
  9854. if !(_poolGrow(tls, pool) != 0) {
  9855. return libc.UintptrFromInt32(0)
  9856. }
  9857. goto _1
  9858. _1:
  9859. }
  9860. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9861. }
  9862. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9863. var v1, v4, v5 uintptr
  9864. var v3 int32
  9865. _, _, _, _ = v1, v3, v4, v5
  9866. for {
  9867. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9868. v3 = 0
  9869. } else {
  9870. v5 = pool + 12
  9871. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9872. *(*uintptr)(unsafe.Pointer(v5))++
  9873. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9874. v3 = libc.Int32FromInt32(1)
  9875. }
  9876. if !(v3 != 0) {
  9877. return libc.UintptrFromInt32(0)
  9878. }
  9879. goto _2
  9880. _2:
  9881. ;
  9882. v1 = s
  9883. s++
  9884. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9885. break
  9886. }
  9887. }
  9888. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9889. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9890. return s
  9891. }
  9892. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9893. var v2 int32
  9894. var v3, v4 uintptr
  9895. _, _, _ = v2, v3, v4
  9896. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9897. /* The following line is unreachable given the current usage of
  9898. * poolCopyStringN(). Currently it is called from exactly one
  9899. * place to copy the text of a simple general entity. By that
  9900. * point, the name of the entity is already stored in the pool, so
  9901. * pool->ptr cannot be NULL.
  9902. *
  9903. * If poolCopyStringN() is used elsewhere as it well might be,
  9904. * this line may well become executable again. Regardless, this
  9905. * sort of check shouldn't be removed lightly, so we just exclude
  9906. * it from the coverage statistics.
  9907. */
  9908. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9909. }
  9910. for {
  9911. if !(n > 0) {
  9912. break
  9913. }
  9914. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9915. v2 = 0
  9916. } else {
  9917. v4 = pool + 12
  9918. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9919. *(*uintptr)(unsafe.Pointer(v4))++
  9920. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9921. v2 = libc.Int32FromInt32(1)
  9922. }
  9923. if !(v2 != 0) {
  9924. return libc.UintptrFromInt32(0)
  9925. }
  9926. goto _1
  9927. _1:
  9928. ;
  9929. n--
  9930. s++
  9931. }
  9932. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9933. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9934. return s
  9935. }
  9936. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9937. var v1 int32
  9938. var v2, v3 uintptr
  9939. _, _, _ = v1, v2, v3
  9940. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  9941. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9942. v1 = 0
  9943. } else {
  9944. v3 = pool + 12
  9945. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9946. *(*uintptr)(unsafe.Pointer(v3))++
  9947. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  9948. v1 = libc.Int32FromInt32(1)
  9949. }
  9950. if !(v1 != 0) {
  9951. return libc.UintptrFromInt32(0)
  9952. }
  9953. s++
  9954. }
  9955. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9956. }
  9957. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9958. var v1, v2 uintptr
  9959. _, _ = v1, v2
  9960. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  9961. return libc.UintptrFromInt32(0)
  9962. }
  9963. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9964. return libc.UintptrFromInt32(0)
  9965. }
  9966. v2 = pool + 12
  9967. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9968. *(*uintptr)(unsafe.Pointer(v2))++
  9969. *(*TXML_Char)(unsafe.Pointer(v1)) = 0
  9970. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9971. }
  9972. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  9973. var bytesToAllocate, stretchedBlockSize int32
  9974. var stretch Tsize_t
  9975. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  9976. /* Unprotected math would be:
  9977. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  9978. **
  9979. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  9980. ** For a + b * c we check b * c in isolation first, so that addition of a
  9981. ** on top has no chance of making us accept a small non-negative number
  9982. */
  9983. stretch = uint32(1) /* can be 4 bytes */
  9984. if blockSize <= 0 {
  9985. return uint32(0)
  9986. }
  9987. if blockSize > libc.Int32FromUint32(libc.Uint32FromInt32(m_INT_MAX)/stretch) {
  9988. return uint32(0)
  9989. }
  9990. stretchedBlockSize = blockSize * libc.Int32FromUint32(stretch)
  9991. bytesToAllocate = libc.Int32FromUint32(uint32(libc.UintptrFromInt32(0)+8) + libc.Uint32FromInt32(stretchedBlockSize))
  9992. if bytesToAllocate < 0 {
  9993. return uint32(0)
  9994. }
  9995. return libc.Uint32FromInt32(bytesToAllocate)
  9996. return r
  9997. }
  9998. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  9999. var blockSize, blockSize1 int32
  10000. var bytesToAllocate, bytesToAllocate1 Tsize_t
  10001. var offsetInsideBlock Tptrdiff_t
  10002. var tem, tem1, temp uintptr
  10003. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  10004. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  10005. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  10006. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10007. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10008. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  10009. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8
  10010. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10011. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  10012. return libc.Uint8FromInt32(1)
  10013. }
  10014. if int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) < (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fsize {
  10015. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  10016. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10017. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  10018. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  10019. libc.Xmemcpy(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+8, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint32FromInt32(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint32(1))
  10020. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8 + uintptr(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10021. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8
  10022. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  10023. return libc.Uint8FromInt32(1)
  10024. }
  10025. }
  10026. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+8 {
  10027. blockSize = libc.Int32FromUint32(libc.Uint32FromInt32(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  10028. /* NOTE: Needs to be calculated prior to calling `realloc`
  10029. to avoid dangling pointers: */
  10030. offsetInsideBlock = int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10031. if blockSize < 0 {
  10032. /* This condition traps a situation where either more than
  10033. * INT_MAX/2 bytes have already been allocated. This isn't
  10034. * readily testable, since it is unlikely that an average
  10035. * machine will have that much memory, so we exclude it from the
  10036. * coverage statistics.
  10037. */
  10038. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10039. }
  10040. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  10041. if bytesToAllocate == uint32(0) {
  10042. return libc.Uint8FromInt32(0)
  10043. }
  10044. 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, bytesToAllocate)
  10045. if temp == libc.UintptrFromInt32(0) {
  10046. return libc.Uint8FromInt32(0)
  10047. }
  10048. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  10049. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  10050. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8 + uintptr(offsetInsideBlock)
  10051. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 8
  10052. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  10053. } else {
  10054. blockSize1 = int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  10055. if blockSize1 < 0 {
  10056. /* This condition traps a situation where either more than
  10057. * INT_MAX bytes have already been allocated (which is prevented
  10058. * by various pieces of program logic, not least this one, never
  10059. * mind the unlikelihood of actually having that much memory) or
  10060. * the pool control fields have been corrupted (which could
  10061. * conceivably happen in an extremely buggy user handler
  10062. * function). Either way it isn't readily testable, so we
  10063. * exclude it from the coverage statistics.
  10064. */
  10065. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  10066. }
  10067. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  10068. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  10069. } else {
  10070. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  10071. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  10072. return libc.Uint8FromInt32(0)
  10073. }
  10074. blockSize1 *= int32(2)
  10075. }
  10076. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  10077. if bytesToAllocate1 == uint32(0) {
  10078. return libc.Uint8FromInt32(0)
  10079. }
  10080. 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)
  10081. if !(tem1 != 0) {
  10082. return libc.Uint8FromInt32(0)
  10083. }
  10084. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  10085. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  10086. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  10087. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  10088. libc.Xmemcpy(tls, tem1+8, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint32FromInt32(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint32(1))
  10089. }
  10090. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 8 + uintptr(int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int32((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  10091. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 8
  10092. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 8 + uintptr(blockSize1)
  10093. }
  10094. return libc.Uint8FromInt32(1)
  10095. }
  10096. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  10097. var dtd, me, parent, temp, v2 uintptr
  10098. var next, v3, v4, v5 int32
  10099. var v1 uint32
  10100. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  10101. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  10102. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10103. (*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, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize*libc.Uint32FromInt64(4))
  10104. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  10105. return -int32(1)
  10106. }
  10107. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  10108. }
  10109. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  10110. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  10111. /* Detect and prevent integer overflow */
  10112. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromUint32(0xffffffff)/libc.Uint32FromUint32(2) {
  10113. return -int32(1)
  10114. }
  10115. /* Detect and prevent integer overflow.
  10116. * The preprocessor guard addresses the "always false" warning
  10117. * from -Wtype-limits on platforms where
  10118. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10119. if (*TDTD)(unsafe.Pointer(dtd)).FscaffSize > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromUint32(2)/libc.Uint32FromInt64(28) {
  10120. return -int32(1)
  10121. }
  10122. 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, (*TDTD)(unsafe.Pointer(dtd)).FscaffSize*libc.Uint32FromInt32(2)*libc.Uint32FromInt64(28))
  10123. if temp == libc.UintptrFromInt32(0) {
  10124. return -int32(1)
  10125. }
  10126. *(*uint32)(unsafe.Pointer(dtd + 172)) *= uint32(2)
  10127. } else {
  10128. temp = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint32FromInt32(m_INIT_SCAFFOLD_ELEMENTS)*libc.Uint32FromInt64(28))
  10129. if temp == libc.UintptrFromInt32(0) {
  10130. return -int32(1)
  10131. }
  10132. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  10133. }
  10134. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  10135. }
  10136. v2 = dtd + 176
  10137. v1 = *(*uint32)(unsafe.Pointer(v2))
  10138. *(*uint32)(unsafe.Pointer(v2))++
  10139. next = libc.Int32FromUint32(v1)
  10140. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*28
  10141. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  10142. parent = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*28
  10143. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  10144. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*28))).Fnextsib = next
  10145. }
  10146. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  10147. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  10148. }
  10149. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  10150. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  10151. }
  10152. v5 = libc.Int32FromInt32(0)
  10153. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  10154. v4 = v5
  10155. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  10156. v3 = v4
  10157. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  10158. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  10159. return next
  10160. }
  10161. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  10162. var allocsize Tsize_t
  10163. var cn, src_node int32
  10164. var dest, destLimit, dtd, jobDest, ret, src, str, v1, v4, v6 uintptr
  10165. var i uint32
  10166. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = allocsize, cn, dest, destLimit, dtd, i, jobDest, ret, src, src_node, str, v1, v4, v6
  10167. /* Function build_model transforms the existing parser->m_dtd->scaffold
  10168. * array of CONTENT_SCAFFOLD tree nodes into a new array of
  10169. * XML_Content tree nodes followed by a gapless list of zero-terminated
  10170. * strings. */
  10171. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the current string writing location */
  10172. /* Detect and prevent integer overflow.
  10173. * The preprocessor guard addresses the "always false" warning
  10174. * from -Wtype-limits on platforms where
  10175. * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */
  10176. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(20) {
  10177. return libc.UintptrFromInt32(0)
  10178. }
  10179. if (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen > libc.Uint32FromInt32(-libc.Int32FromInt32(1))/libc.Uint32FromInt64(1) {
  10180. return libc.UintptrFromInt32(0)
  10181. }
  10182. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount*uint32(20) > libc.Uint32FromInt32(-libc.Int32FromInt32(1))-(*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen*uint32(1) {
  10183. return libc.UintptrFromInt32(0)
  10184. }
  10185. allocsize = (*TDTD)(unsafe.Pointer(dtd)).FscaffCount*libc.Uint32FromInt64(20) + (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen*libc.Uint32FromInt64(1)
  10186. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, allocsize)
  10187. if !(ret != 0) {
  10188. return libc.UintptrFromInt32(0)
  10189. }
  10190. /* What follows is an iterative implementation (of what was previously done
  10191. * recursively in a dedicated function called "build_node". The old recursive
  10192. * build_node could be forced into stack exhaustion from input as small as a
  10193. * few megabyte, and so that was a security issue. Hence, a function call
  10194. * stack is avoided now by resolving recursion.)
  10195. *
  10196. * The iterative approach works as follows:
  10197. *
  10198. * - We have two writing pointers, both walking up the result array; one does
  10199. * the work, the other creates "jobs" for its colleague to do, and leads
  10200. * the way:
  10201. *
  10202. * - The faster one, pointer jobDest, always leads and writes "what job
  10203. * to do" by the other, once they reach that place in the
  10204. * array: leader "jobDest" stores the source node array index (relative
  10205. * to array dtd->scaffold) in field "numchildren".
  10206. *
  10207. * - The slower one, pointer dest, looks at the value stored in the
  10208. * "numchildren" field (which actually holds a source node array index
  10209. * at that time) and puts the real data from dtd->scaffold in.
  10210. *
  10211. * - Before the loop starts, jobDest writes source array index 0
  10212. * (where the root node is located) so that dest will have something to do
  10213. * when it starts operation.
  10214. *
  10215. * - Whenever nodes with children are encountered, jobDest appends
  10216. * them as new jobs, in order. As a result, tree node siblings are
  10217. * adjacent in the resulting array, for example:
  10218. *
  10219. * [0] root, has two children
  10220. * [1] first child of 0, has three children
  10221. * [3] first child of 1, does not have children
  10222. * [4] second child of 1, does not have children
  10223. * [5] third child of 1, does not have children
  10224. * [2] second child of 0, does not have children
  10225. *
  10226. * Or (the same data) presented in flat array view:
  10227. *
  10228. * [0] root, has two children
  10229. *
  10230. * [1] first child of 0, has three children
  10231. * [2] second child of 0, does not have children
  10232. *
  10233. * [3] first child of 1, does not have children
  10234. * [4] second child of 1, does not have children
  10235. * [5] third child of 1, does not have children
  10236. *
  10237. * - The algorithm repeats until all target array indices have been processed.
  10238. */
  10239. dest = ret /* tree node writing location, moves upwards */
  10240. destLimit = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*20
  10241. jobDest = ret /* next free writing location in target array */
  10242. str = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*20
  10243. /* Add the starting job, the root node (index 0) of the source tree */
  10244. v1 = jobDest
  10245. jobDest += 20
  10246. (*TXML_Content)(unsafe.Pointer(v1)).Fnumchildren = uint32(0)
  10247. for {
  10248. if !(dest < destLimit) {
  10249. break
  10250. }
  10251. /* Retrieve source tree array index from job storage */
  10252. src_node = libc.Int32FromUint32((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren)
  10253. /* Convert item */
  10254. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Ftype1
  10255. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Fquant
  10256. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  10257. (*TXML_Content)(unsafe.Pointer(dest)).Fname = str
  10258. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Fname
  10259. for {
  10260. v4 = str
  10261. str++
  10262. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(src))
  10263. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  10264. break
  10265. }
  10266. src++
  10267. goto _3
  10268. _3:
  10269. }
  10270. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  10271. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  10272. } else {
  10273. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  10274. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Fchildcnt)
  10275. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = jobDest
  10276. /* Append scaffold indices of children to array */
  10277. i = uint32(0)
  10278. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*28))).Ffirstchild
  10279. for {
  10280. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  10281. break
  10282. }
  10283. v6 = jobDest
  10284. jobDest += 20
  10285. (*TXML_Content)(unsafe.Pointer(v6)).Fnumchildren = libc.Uint32FromInt32(cn)
  10286. goto _5
  10287. _5:
  10288. ;
  10289. i++
  10290. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*28))).Fnextsib
  10291. }
  10292. }
  10293. goto _2
  10294. _2:
  10295. ;
  10296. dest += 20
  10297. }
  10298. return ret
  10299. }
  10300. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  10301. var dtd, name, ret uintptr
  10302. _, _, _ = dtd, name, ret
  10303. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  10304. name = _poolStoreString(tls, dtd+80, enc, ptr, end)
  10305. if !(name != 0) {
  10306. return libc.UintptrFromInt32(0)
  10307. }
  10308. ret = _lookup(tls, parser, dtd+20, name, uint32(24))
  10309. if !(ret != 0) {
  10310. return libc.UintptrFromInt32(0)
  10311. }
  10312. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  10313. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart
  10314. } else {
  10315. (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 80)).Fptr
  10316. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  10317. return libc.UintptrFromInt32(0)
  10318. }
  10319. }
  10320. return ret
  10321. }
  10322. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  10323. var charsRequired Tsize_t
  10324. var result uintptr
  10325. _, _ = charsRequired, result
  10326. charsRequired = uint32(0)
  10327. /* First determine how long the string is */
  10328. for int32(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  10329. charsRequired++
  10330. }
  10331. /* Include the terminator */
  10332. charsRequired++
  10333. /* Now allocate space for the copy */
  10334. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, charsRequired*uint32(1))
  10335. if result == libc.UintptrFromInt32(0) {
  10336. return libc.UintptrFromInt32(0)
  10337. }
  10338. /* Copy the original into place */
  10339. libc.Xmemcpy(tls, result, s, charsRequired*uint32(1))
  10340. return result
  10341. }
  10342. func _accountingGetCurrentAmplification(tls *libc.TLS, rootParser TXML_Parser) (r float32) {
  10343. var amplificationFactor, v1 float32
  10344. var countBytesOutput TXmlBigCount
  10345. _, _, _ = amplificationFactor, countBytesOutput, v1
  10346. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10347. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect != 0 {
  10348. v1 = float32(countBytesOutput) / float32((*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect)
  10349. } else {
  10350. v1 = libc.Float32FromFloat32(1)
  10351. }
  10352. amplificationFactor = v1
  10353. return amplificationFactor
  10354. }
  10355. func _accountingReportStats(tls *libc.TLS, originParser TXML_Parser, epilog uintptr) {
  10356. bp := tls.Alloc(48)
  10357. defer tls.Free(48)
  10358. var amplificationFactor float32
  10359. var rootParser TXML_Parser
  10360. _, _ = amplificationFactor, rootParser
  10361. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10362. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel < int32(1) {
  10363. return
  10364. }
  10365. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10366. 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))
  10367. }
  10368. func _accountingOnAbort(tls *libc.TLS, originParser TXML_Parser) {
  10369. _accountingReportStats(tls, originParser, __ccgo_ts+1748)
  10370. }
  10371. func _accountingReportDiff(tls *libc.TLS, rootParser TXML_Parser, levelsAwayFromRootParser uint32, before uintptr, after uintptr, bytesMore Tptrdiff_t, source_line int32, account _XML_Account) {
  10372. bp := tls.Alloc(64)
  10373. defer tls.Free(64)
  10374. var contextLength uint32
  10375. var ellipsisLength Tsize_t
  10376. var walker, v1 uintptr
  10377. var _ /* ellipis at bp+0 */ [5]int8
  10378. _, _, _, _ = contextLength, ellipsisLength, walker, v1
  10379. if account == int32(_XML_ACCOUNT_DIRECT) {
  10380. v1 = __ccgo_ts + 1759
  10381. } else {
  10382. v1 = __ccgo_ts + 1763
  10383. }
  10384. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1767, libc.VaList(bp+16, bytesMore, v1, levelsAwayFromRootParser, source_line, int32(10), __ccgo_ts+1807))
  10385. *(*[5]int8)(unsafe.Pointer(bp)) = [5]int8{'[', '.', '.', ']'}
  10386. ellipsisLength = libc.Uint32FromInt64(5) - libc.Uint32FromInt32(1)
  10387. contextLength = uint32(10)
  10388. /* Note: Performance is of no concern here */
  10389. walker = before
  10390. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(3) || int32(after)-int32(before) <= libc.Int32FromUint32(contextLength+ellipsisLength+contextLength) {
  10391. for {
  10392. if !(walker < after) {
  10393. break
  10394. }
  10395. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1808, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10396. goto _2
  10397. _2:
  10398. ;
  10399. walker++
  10400. }
  10401. } else {
  10402. for {
  10403. if !(walker < before+uintptr(contextLength)) {
  10404. break
  10405. }
  10406. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1808, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10407. goto _3
  10408. _3:
  10409. ;
  10410. walker++
  10411. }
  10412. libc.Xfprintf(tls, libc.Xstderr, bp, 0)
  10413. walker = after - uintptr(contextLength)
  10414. for {
  10415. if !(walker < after) {
  10416. break
  10417. }
  10418. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1808, libc.VaList(bp+16, XunsignedCharToPrintable(tls, libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(walker))))))
  10419. goto _4
  10420. _4:
  10421. ;
  10422. walker++
  10423. }
  10424. }
  10425. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1811, 0)
  10426. }
  10427. func _accountingDiffTolerated(tls *libc.TLS, originParser TXML_Parser, tok int32, before uintptr, after uintptr, source_line int32, account _XML_Account) (r TXML_Bool) {
  10428. bp := tls.Alloc(16)
  10429. defer tls.Free(16)
  10430. var additionTarget, v1 uintptr
  10431. var amplificationFactor float32
  10432. var bytesMore Tptrdiff_t
  10433. var countBytesOutput TXmlBigCount
  10434. var isDirect int32
  10435. var rootParser TXML_Parser
  10436. var tolerated TXML_Bool
  10437. var _ /* levelsAwayFromRootParser at bp+0 */ uint32
  10438. _, _, _, _, _, _, _, _ = additionTarget, amplificationFactor, bytesMore, countBytesOutput, isDirect, rootParser, tolerated, v1
  10439. /* Note: We need to check the token type *first* to be sure that
  10440. * we can even access variable <after>, safely.
  10441. * E.g. for XML_TOK_NONE <after> may hold an invalid pointer. */
  10442. switch tok {
  10443. case m_XML_TOK_INVALID:
  10444. fallthrough
  10445. case -int32(1):
  10446. fallthrough
  10447. case -int32(2):
  10448. fallthrough
  10449. case -int32(4):
  10450. return libc.Uint8FromInt32(1)
  10451. }
  10452. if account == int32(_XML_ACCOUNT_NONE) {
  10453. return libc.Uint8FromInt32(1)
  10454. }
  10455. rootParser = _getRootParserOf(tls, originParser, bp)
  10456. isDirect = libc.BoolInt32(account == int32(_XML_ACCOUNT_DIRECT) && originParser == rootParser)
  10457. bytesMore = int32(after) - int32(before)
  10458. if isDirect != 0 {
  10459. v1 = rootParser + 496
  10460. } else {
  10461. v1 = rootParser + 496 + 8
  10462. }
  10463. additionTarget = v1
  10464. /* Detect and avoid integer overflow */
  10465. if *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) > libc.Uint64FromInt32(-libc.Int32FromInt32(1))-libc.Uint64FromInt32(bytesMore) {
  10466. return libc.Uint8FromInt32(0)
  10467. }
  10468. *(*TXmlBigCount)(unsafe.Pointer(additionTarget)) += libc.Uint64FromInt32(bytesMore)
  10469. countBytesOutput = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesDirect + (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FcountBytesIndirect
  10470. amplificationFactor = _accountingGetCurrentAmplification(tls, rootParser)
  10471. tolerated = libc.BoolUint8(countBytesOutput < (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FactivationThresholdBytes || amplificationFactor <= (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FmaximumAmplificationFactor)
  10472. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_accounting.FdebugLevel >= int32(2) {
  10473. _accountingReportStats(tls, rootParser, __ccgo_ts+1807)
  10474. _accountingReportDiff(tls, rootParser, *(*uint32)(unsafe.Pointer(bp)), before, after, bytesMore, source_line, account)
  10475. }
  10476. return tolerated
  10477. }
  10478. func XtestingAccountingGetCountBytesDirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10479. if !(parser != 0) {
  10480. return uint64(0)
  10481. }
  10482. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesDirect
  10483. }
  10484. func XtestingAccountingGetCountBytesIndirect(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  10485. if !(parser != 0) {
  10486. return uint64(0)
  10487. }
  10488. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_accounting.FcountBytesIndirect
  10489. }
  10490. func _entityTrackingReportStats(tls *libc.TLS, rootParser TXML_Parser, entity uintptr, action uintptr, sourceLine int32) {
  10491. bp := tls.Alloc(96)
  10492. defer tls.Free(96)
  10493. var entityName, v1 uintptr
  10494. _, _ = entityName, v1
  10495. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FdebugLevel < int32(1) {
  10496. return
  10497. }
  10498. entityName = (*TENTITY)(unsafe.Pointer(entity)).Fname
  10499. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  10500. v1 = __ccgo_ts + 1814
  10501. } else {
  10502. v1 = __ccgo_ts + 1816
  10503. }
  10504. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+1818, 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+1807, v1, entityName, action, (*TENTITY)(unsafe.Pointer(entity)).FtextLen, sourceLine))
  10505. }
  10506. func _entityTrackingOnOpen(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10507. var rootParser TXML_Parser
  10508. _ = rootParser
  10509. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10510. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcountEverOpened++
  10511. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth++
  10512. if (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth > (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen {
  10513. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FmaximumDepthSeen++
  10514. }
  10515. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1903, sourceLine)
  10516. }
  10517. func _entityTrackingOnClose(tls *libc.TLS, originParser TXML_Parser, entity uintptr, sourceLine int32) {
  10518. var rootParser TXML_Parser
  10519. _ = rootParser
  10520. rootParser = _getRootParserOf(tls, originParser, libc.UintptrFromInt32(0))
  10521. _entityTrackingReportStats(tls, rootParser, entity, __ccgo_ts+1909, sourceLine)
  10522. (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_entity_stats.FcurrentDepth--
  10523. }
  10524. func _getRootParserOf(tls *libc.TLS, parser TXML_Parser, outLevelDiff uintptr) (r TXML_Parser) {
  10525. var rootParser TXML_Parser
  10526. var stepsTakenUpwards uint32
  10527. _, _ = rootParser, stepsTakenUpwards
  10528. rootParser = parser
  10529. stepsTakenUpwards = uint32(0)
  10530. for (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser != 0 {
  10531. rootParser = (*TXML_ParserStruct)(unsafe.Pointer(rootParser)).Fm_parentParser
  10532. stepsTakenUpwards++
  10533. }
  10534. if outLevelDiff != libc.UintptrFromInt32(0) {
  10535. *(*uint32)(unsafe.Pointer(outLevelDiff)) = stepsTakenUpwards
  10536. }
  10537. return rootParser
  10538. }
  10539. func XunsignedCharToPrintable(tls *libc.TLS, c uint8) (r uintptr) {
  10540. switch libc.Int32FromUint8(c) {
  10541. case 0:
  10542. return __ccgo_ts + 1915
  10543. case int32(1):
  10544. return __ccgo_ts + 1918
  10545. case int32(2):
  10546. return __ccgo_ts + 1922
  10547. case int32(3):
  10548. return __ccgo_ts + 1926
  10549. case int32(4):
  10550. return __ccgo_ts + 1930
  10551. case int32(5):
  10552. return __ccgo_ts + 1934
  10553. case int32(6):
  10554. return __ccgo_ts + 1938
  10555. case int32(7):
  10556. return __ccgo_ts + 1942
  10557. case int32(8):
  10558. return __ccgo_ts + 1946
  10559. case int32(9):
  10560. return __ccgo_ts + 1950
  10561. case int32(10):
  10562. return __ccgo_ts + 1953
  10563. case int32(11):
  10564. return __ccgo_ts + 1956
  10565. case int32(12):
  10566. return __ccgo_ts + 1960
  10567. case int32(13):
  10568. return __ccgo_ts + 1964
  10569. case int32(14):
  10570. return __ccgo_ts + 1967
  10571. case int32(15):
  10572. return __ccgo_ts + 1971
  10573. case int32(16):
  10574. return __ccgo_ts + 1975
  10575. case int32(17):
  10576. return __ccgo_ts + 1980
  10577. case int32(18):
  10578. return __ccgo_ts + 1985
  10579. case int32(19):
  10580. return __ccgo_ts + 1990
  10581. case int32(20):
  10582. return __ccgo_ts + 1995
  10583. case int32(21):
  10584. return __ccgo_ts + 2000
  10585. case int32(22):
  10586. return __ccgo_ts + 2005
  10587. case int32(23):
  10588. return __ccgo_ts + 2010
  10589. case int32(24):
  10590. return __ccgo_ts + 2015
  10591. case int32(25):
  10592. return __ccgo_ts + 2020
  10593. case int32(26):
  10594. return __ccgo_ts + 2025
  10595. case int32(27):
  10596. return __ccgo_ts + 2030
  10597. case int32(28):
  10598. return __ccgo_ts + 2035
  10599. case int32(29):
  10600. return __ccgo_ts + 2040
  10601. case int32(30):
  10602. return __ccgo_ts + 2045
  10603. case int32(31):
  10604. return __ccgo_ts + 2050
  10605. case int32(32):
  10606. return __ccgo_ts + 2055
  10607. case int32(33):
  10608. return __ccgo_ts + 2057
  10609. case int32(34):
  10610. return __ccgo_ts + 2059
  10611. case int32(35):
  10612. return __ccgo_ts + 2062
  10613. case int32(36):
  10614. return __ccgo_ts + 2064
  10615. case int32(37):
  10616. return __ccgo_ts + 1814
  10617. case int32(38):
  10618. return __ccgo_ts + 1816
  10619. case int32(39):
  10620. return __ccgo_ts + 2066
  10621. case int32(40):
  10622. return __ccgo_ts + 2068
  10623. case int32(41):
  10624. return __ccgo_ts + 2070
  10625. case int32(42):
  10626. return __ccgo_ts + 2072
  10627. case int32(43):
  10628. return __ccgo_ts + 2074
  10629. case int32(44):
  10630. return __ccgo_ts + 2076
  10631. case int32(45):
  10632. return __ccgo_ts + 2078
  10633. case int32(46):
  10634. return __ccgo_ts + 2080
  10635. case int32(47):
  10636. return __ccgo_ts + 2082
  10637. case int32(48):
  10638. return __ccgo_ts + 2084
  10639. case int32(49):
  10640. return __ccgo_ts + 2086
  10641. case int32(50):
  10642. return __ccgo_ts + 2088
  10643. case int32(51):
  10644. return __ccgo_ts + 2090
  10645. case int32(52):
  10646. return __ccgo_ts + 2092
  10647. case int32(53):
  10648. return __ccgo_ts + 2094
  10649. case int32(54):
  10650. return __ccgo_ts + 2096
  10651. case int32(55):
  10652. return __ccgo_ts + 2098
  10653. case int32(56):
  10654. return __ccgo_ts + 2100
  10655. case int32(57):
  10656. return __ccgo_ts + 2102
  10657. case int32(58):
  10658. return __ccgo_ts + 2104
  10659. case int32(59):
  10660. return __ccgo_ts + 2106
  10661. case int32(60):
  10662. return __ccgo_ts + 2108
  10663. case int32(61):
  10664. return __ccgo_ts + 2110
  10665. case int32(62):
  10666. return __ccgo_ts + 2112
  10667. case int32(63):
  10668. return __ccgo_ts + 2114
  10669. case int32(64):
  10670. return __ccgo_ts + 2116
  10671. case int32(65):
  10672. return __ccgo_ts + 2118
  10673. case int32(66):
  10674. return __ccgo_ts + 2120
  10675. case int32(67):
  10676. return __ccgo_ts + 2122
  10677. case int32(68):
  10678. return __ccgo_ts + 2124
  10679. case int32(69):
  10680. return __ccgo_ts + 2126
  10681. case int32(70):
  10682. return __ccgo_ts + 2128
  10683. case int32(71):
  10684. return __ccgo_ts + 2130
  10685. case int32(72):
  10686. return __ccgo_ts + 2132
  10687. case int32(73):
  10688. return __ccgo_ts + 2134
  10689. case int32(74):
  10690. return __ccgo_ts + 2136
  10691. case int32(75):
  10692. return __ccgo_ts + 2138
  10693. case int32(76):
  10694. return __ccgo_ts + 2140
  10695. case int32(77):
  10696. return __ccgo_ts + 2142
  10697. case int32(78):
  10698. return __ccgo_ts + 2144
  10699. case int32(79):
  10700. return __ccgo_ts + 2146
  10701. case int32(80):
  10702. return __ccgo_ts + 2148
  10703. case int32(81):
  10704. return __ccgo_ts + 2150
  10705. case int32(82):
  10706. return __ccgo_ts + 2152
  10707. case int32(83):
  10708. return __ccgo_ts + 2154
  10709. case int32(84):
  10710. return __ccgo_ts + 2156
  10711. case int32(85):
  10712. return __ccgo_ts + 2158
  10713. case int32(86):
  10714. return __ccgo_ts + 2160
  10715. case int32(87):
  10716. return __ccgo_ts + 2162
  10717. case int32(88):
  10718. return __ccgo_ts + 2164
  10719. case int32(89):
  10720. return __ccgo_ts + 2166
  10721. case int32(90):
  10722. return __ccgo_ts + 2168
  10723. case int32(91):
  10724. return __ccgo_ts + 2170
  10725. case int32(92):
  10726. return __ccgo_ts + 2172
  10727. case int32(93):
  10728. return __ccgo_ts + 2175
  10729. case int32(94):
  10730. return __ccgo_ts + 2177
  10731. case int32(95):
  10732. return __ccgo_ts + 2179
  10733. case int32(96):
  10734. return __ccgo_ts + 2181
  10735. case int32(97):
  10736. return __ccgo_ts + 2183
  10737. case int32(98):
  10738. return __ccgo_ts + 2185
  10739. case int32(99):
  10740. return __ccgo_ts + 2187
  10741. case int32(100):
  10742. return __ccgo_ts + 2189
  10743. case int32(101):
  10744. return __ccgo_ts + 2191
  10745. case int32(102):
  10746. return __ccgo_ts + 2193
  10747. case int32(103):
  10748. return __ccgo_ts + 2195
  10749. case int32(104):
  10750. return __ccgo_ts + 2197
  10751. case int32(105):
  10752. return __ccgo_ts + 2199
  10753. case int32(106):
  10754. return __ccgo_ts + 2201
  10755. case int32(107):
  10756. return __ccgo_ts + 2203
  10757. case int32(108):
  10758. return __ccgo_ts + 2205
  10759. case int32(109):
  10760. return __ccgo_ts + 2207
  10761. case int32(110):
  10762. return __ccgo_ts + 2209
  10763. case int32(111):
  10764. return __ccgo_ts + 2211
  10765. case int32(112):
  10766. return __ccgo_ts + 2213
  10767. case int32(113):
  10768. return __ccgo_ts + 2215
  10769. case int32(114):
  10770. return __ccgo_ts + 2217
  10771. case int32(115):
  10772. return __ccgo_ts + 2219
  10773. case int32(116):
  10774. return __ccgo_ts + 2221
  10775. case int32(117):
  10776. return __ccgo_ts + 2223
  10777. case int32(118):
  10778. return __ccgo_ts + 2225
  10779. case int32(119):
  10780. return __ccgo_ts + 2227
  10781. case int32(120):
  10782. return __ccgo_ts + 2229
  10783. case int32(121):
  10784. return __ccgo_ts + 2231
  10785. case int32(122):
  10786. return __ccgo_ts + 2233
  10787. case int32(123):
  10788. return __ccgo_ts + 2235
  10789. case int32(124):
  10790. return __ccgo_ts + 2237
  10791. case int32(125):
  10792. return __ccgo_ts + 2239
  10793. case int32(126):
  10794. return __ccgo_ts + 2241
  10795. case int32(127):
  10796. return __ccgo_ts + 2243
  10797. case int32(128):
  10798. return __ccgo_ts + 2248
  10799. case int32(129):
  10800. return __ccgo_ts + 2253
  10801. case int32(130):
  10802. return __ccgo_ts + 2258
  10803. case int32(131):
  10804. return __ccgo_ts + 2263
  10805. case int32(132):
  10806. return __ccgo_ts + 2268
  10807. case int32(133):
  10808. return __ccgo_ts + 2273
  10809. case int32(134):
  10810. return __ccgo_ts + 2278
  10811. case int32(135):
  10812. return __ccgo_ts + 2283
  10813. case int32(136):
  10814. return __ccgo_ts + 2288
  10815. case int32(137):
  10816. return __ccgo_ts + 2293
  10817. case int32(138):
  10818. return __ccgo_ts + 2298
  10819. case int32(139):
  10820. return __ccgo_ts + 2303
  10821. case int32(140):
  10822. return __ccgo_ts + 2308
  10823. case int32(141):
  10824. return __ccgo_ts + 2313
  10825. case int32(142):
  10826. return __ccgo_ts + 2318
  10827. case int32(143):
  10828. return __ccgo_ts + 2323
  10829. case int32(144):
  10830. return __ccgo_ts + 2328
  10831. case int32(145):
  10832. return __ccgo_ts + 2333
  10833. case int32(146):
  10834. return __ccgo_ts + 2338
  10835. case int32(147):
  10836. return __ccgo_ts + 2343
  10837. case int32(148):
  10838. return __ccgo_ts + 2348
  10839. case int32(149):
  10840. return __ccgo_ts + 2353
  10841. case int32(150):
  10842. return __ccgo_ts + 2358
  10843. case int32(151):
  10844. return __ccgo_ts + 2363
  10845. case int32(152):
  10846. return __ccgo_ts + 2368
  10847. case int32(153):
  10848. return __ccgo_ts + 2373
  10849. case int32(154):
  10850. return __ccgo_ts + 2378
  10851. case int32(155):
  10852. return __ccgo_ts + 2383
  10853. case int32(156):
  10854. return __ccgo_ts + 2388
  10855. case int32(157):
  10856. return __ccgo_ts + 2393
  10857. case int32(158):
  10858. return __ccgo_ts + 2398
  10859. case int32(159):
  10860. return __ccgo_ts + 2403
  10861. case int32(160):
  10862. return __ccgo_ts + 2408
  10863. case int32(161):
  10864. return __ccgo_ts + 2413
  10865. case int32(162):
  10866. return __ccgo_ts + 2418
  10867. case int32(163):
  10868. return __ccgo_ts + 2423
  10869. case int32(164):
  10870. return __ccgo_ts + 2428
  10871. case int32(165):
  10872. return __ccgo_ts + 2433
  10873. case int32(166):
  10874. return __ccgo_ts + 2438
  10875. case int32(167):
  10876. return __ccgo_ts + 2443
  10877. case int32(168):
  10878. return __ccgo_ts + 2448
  10879. case int32(169):
  10880. return __ccgo_ts + 2453
  10881. case int32(170):
  10882. return __ccgo_ts + 2458
  10883. case int32(171):
  10884. return __ccgo_ts + 2463
  10885. case int32(172):
  10886. return __ccgo_ts + 2468
  10887. case int32(173):
  10888. return __ccgo_ts + 2473
  10889. case int32(174):
  10890. return __ccgo_ts + 2478
  10891. case int32(175):
  10892. return __ccgo_ts + 2483
  10893. case int32(176):
  10894. return __ccgo_ts + 2488
  10895. case int32(177):
  10896. return __ccgo_ts + 2493
  10897. case int32(178):
  10898. return __ccgo_ts + 2498
  10899. case int32(179):
  10900. return __ccgo_ts + 2503
  10901. case int32(180):
  10902. return __ccgo_ts + 2508
  10903. case int32(181):
  10904. return __ccgo_ts + 2513
  10905. case int32(182):
  10906. return __ccgo_ts + 2518
  10907. case int32(183):
  10908. return __ccgo_ts + 2523
  10909. case int32(184):
  10910. return __ccgo_ts + 2528
  10911. case int32(185):
  10912. return __ccgo_ts + 2533
  10913. case int32(186):
  10914. return __ccgo_ts + 2538
  10915. case int32(187):
  10916. return __ccgo_ts + 2543
  10917. case int32(188):
  10918. return __ccgo_ts + 2548
  10919. case int32(189):
  10920. return __ccgo_ts + 2553
  10921. case int32(190):
  10922. return __ccgo_ts + 2558
  10923. case int32(191):
  10924. return __ccgo_ts + 2563
  10925. case int32(192):
  10926. return __ccgo_ts + 2568
  10927. case int32(193):
  10928. return __ccgo_ts + 2573
  10929. case int32(194):
  10930. return __ccgo_ts + 2578
  10931. case int32(195):
  10932. return __ccgo_ts + 2583
  10933. case int32(196):
  10934. return __ccgo_ts + 2588
  10935. case int32(197):
  10936. return __ccgo_ts + 2593
  10937. case int32(198):
  10938. return __ccgo_ts + 2598
  10939. case int32(199):
  10940. return __ccgo_ts + 2603
  10941. case int32(200):
  10942. return __ccgo_ts + 2608
  10943. case int32(201):
  10944. return __ccgo_ts + 2613
  10945. case int32(202):
  10946. return __ccgo_ts + 2618
  10947. case int32(203):
  10948. return __ccgo_ts + 2623
  10949. case int32(204):
  10950. return __ccgo_ts + 2628
  10951. case int32(205):
  10952. return __ccgo_ts + 2633
  10953. case int32(206):
  10954. return __ccgo_ts + 2638
  10955. case int32(207):
  10956. return __ccgo_ts + 2643
  10957. case int32(208):
  10958. return __ccgo_ts + 2648
  10959. case int32(209):
  10960. return __ccgo_ts + 2653
  10961. case int32(210):
  10962. return __ccgo_ts + 2658
  10963. case int32(211):
  10964. return __ccgo_ts + 2663
  10965. case int32(212):
  10966. return __ccgo_ts + 2668
  10967. case int32(213):
  10968. return __ccgo_ts + 2673
  10969. case int32(214):
  10970. return __ccgo_ts + 2678
  10971. case int32(215):
  10972. return __ccgo_ts + 2683
  10973. case int32(216):
  10974. return __ccgo_ts + 2688
  10975. case int32(217):
  10976. return __ccgo_ts + 2693
  10977. case int32(218):
  10978. return __ccgo_ts + 2698
  10979. case int32(219):
  10980. return __ccgo_ts + 2703
  10981. case int32(220):
  10982. return __ccgo_ts + 2708
  10983. case int32(221):
  10984. return __ccgo_ts + 2713
  10985. case int32(222):
  10986. return __ccgo_ts + 2718
  10987. case int32(223):
  10988. return __ccgo_ts + 2723
  10989. case int32(224):
  10990. return __ccgo_ts + 2728
  10991. case int32(225):
  10992. return __ccgo_ts + 2733
  10993. case int32(226):
  10994. return __ccgo_ts + 2738
  10995. case int32(227):
  10996. return __ccgo_ts + 2743
  10997. case int32(228):
  10998. return __ccgo_ts + 2748
  10999. case int32(229):
  11000. return __ccgo_ts + 2753
  11001. case int32(230):
  11002. return __ccgo_ts + 2758
  11003. case int32(231):
  11004. return __ccgo_ts + 2763
  11005. case int32(232):
  11006. return __ccgo_ts + 2768
  11007. case int32(233):
  11008. return __ccgo_ts + 2773
  11009. case int32(234):
  11010. return __ccgo_ts + 2778
  11011. case int32(235):
  11012. return __ccgo_ts + 2783
  11013. case int32(236):
  11014. return __ccgo_ts + 2788
  11015. case int32(237):
  11016. return __ccgo_ts + 2793
  11017. case int32(238):
  11018. return __ccgo_ts + 2798
  11019. case int32(239):
  11020. return __ccgo_ts + 2803
  11021. case int32(240):
  11022. return __ccgo_ts + 2808
  11023. case int32(241):
  11024. return __ccgo_ts + 2813
  11025. case int32(242):
  11026. return __ccgo_ts + 2818
  11027. case int32(243):
  11028. return __ccgo_ts + 2823
  11029. case int32(244):
  11030. return __ccgo_ts + 2828
  11031. case int32(245):
  11032. return __ccgo_ts + 2833
  11033. case int32(246):
  11034. return __ccgo_ts + 2838
  11035. case int32(247):
  11036. return __ccgo_ts + 2843
  11037. case int32(248):
  11038. return __ccgo_ts + 2848
  11039. case int32(249):
  11040. return __ccgo_ts + 2853
  11041. case int32(250):
  11042. return __ccgo_ts + 2858
  11043. case int32(251):
  11044. return __ccgo_ts + 2863
  11045. case int32(252):
  11046. return __ccgo_ts + 2868
  11047. case int32(253):
  11048. return __ccgo_ts + 2873
  11049. case int32(254):
  11050. return __ccgo_ts + 2878
  11051. case int32(255):
  11052. return __ccgo_ts + 2883
  11053. default:
  11054. /* never gets here */
  11055. return __ccgo_ts + 2888
  11056. }
  11057. /* never gets here */
  11058. return r
  11059. }
  11060. func _getDebugLevel(tls *libc.TLS, variableName uintptr, defaultDebugLevel uint32) (r uint32) {
  11061. bp := tls.Alloc(16)
  11062. defer tls.Free(16)
  11063. var debugLevel uint32
  11064. var value, valueOrNull uintptr
  11065. var _ /* afterValue at bp+0 */ uintptr
  11066. _, _, _ = debugLevel, value, valueOrNull
  11067. valueOrNull = libc.Xgetenv(tls, variableName)
  11068. if valueOrNull == libc.UintptrFromInt32(0) {
  11069. return defaultDebugLevel
  11070. }
  11071. value = valueOrNull
  11072. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11073. *(*uintptr)(unsafe.Pointer(bp)) = value
  11074. debugLevel = libc.Xstrtoul(tls, value, bp, int32(10))
  11075. if *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) != 0 || int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != int32('\000') {
  11076. *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) = 0
  11077. return defaultDebugLevel
  11078. }
  11079. return debugLevel
  11080. }
  11081. const m_ASCII_01 = 0x30
  11082. const m_ASCII_11 = 0x31
  11083. const m_ASCII_21 = 0x32
  11084. const m_ASCII_31 = 0x33
  11085. const m_ASCII_81 = 0x38
  11086. const m_ASCII_91 = 0x39
  11087. const m_ASCII_B1 = 66
  11088. const m_ASCII_COLON1 = 0x3A
  11089. const m_ASCII_COMMA1 = 0x2C
  11090. const m_ASCII_EQUALS1 = 0x3D
  11091. const m_ASCII_EXCL1 = 0x21
  11092. const m_ASCII_FF1 = 0x0C
  11093. const m_ASCII_G1 = 71
  11094. const m_ASCII_HASH1 = 0x23
  11095. const m_ASCII_LPAREN1 = 0x28
  11096. const m_ASCII_P1 = 80
  11097. const m_ASCII_PERIOD1 = 0x2E
  11098. const m_ASCII_PIPE1 = 0x7C
  11099. const m_ASCII_Q1 = 81
  11100. const m_ASCII_RPAREN1 = 0x29
  11101. const m_ASCII_SLASH1 = 0x2F
  11102. const m_ASCII_U1 = 85
  11103. const m_ASCII_a1 = 0x61
  11104. const m_ASCII_c1 = 0x63
  11105. const m_ASCII_e1 = 0x65
  11106. const m_ASCII_g1 = 0x67
  11107. const m_ASCII_h1 = 0x68
  11108. const m_ASCII_l1 = 0x6C
  11109. const m_ASCII_m1 = 0x6D
  11110. const m_ASCII_n1 = 0x6E
  11111. const m_ASCII_o1 = 0x6F
  11112. const m_ASCII_p1 = 0x70
  11113. const m_ASCII_r1 = 0x72
  11114. const m_ASCII_s1 = 0x73
  11115. const m_ASCII_t1 = 0x74
  11116. const m_ASCII_w1 = 0x77
  11117. const m_ASCII_x1 = 0x78
  11118. const m_EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT1 = "100.0f"
  11119. const m_INT_MAX1 = 0x7fffffff
  11120. const m_UINT_MAX1 = 0xffffffff
  11121. /*
  11122. __ __ _
  11123. ___\ \/ /_ __ __ _| |_
  11124. / _ \\ /| '_ \ / _` | __|
  11125. | __// \| |_) | (_| | |_
  11126. \___/_/\_\ .__/ \__,_|\__|
  11127. |_| XML parser
  11128. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  11129. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  11130. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  11131. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  11132. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  11133. Licensed under the MIT license:
  11134. Permission is hereby granted, free of charge, to any person obtaining
  11135. a copy of this software and associated documentation files (the
  11136. "Software"), to deal in the Software without restriction, including
  11137. without limitation the rights to use, copy, modify, merge, publish,
  11138. distribute, sublicense, and/or sell copies of the Software, and to permit
  11139. persons to whom the Software is furnished to do so, subject to the
  11140. following conditions:
  11141. The above copyright notice and this permission notice shall be included
  11142. in all copies or substantial portions of the Software.
  11143. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  11144. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11145. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  11146. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  11147. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  11148. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  11149. USE OR OTHER DEALINGS IN THE SOFTWARE.
  11150. */
  11151. /* Doesn't check:
  11152. that ,| are not mixed in a model group
  11153. content of literals
  11154. */
  11155. var _KW_ANY = [4]int8{
  11156. 0: int8(m_ASCII_A),
  11157. 1: int8(m_ASCII_N),
  11158. 2: int8(m_ASCII_Y),
  11159. }
  11160. var _KW_ATTLIST = [8]int8{
  11161. 0: int8(m_ASCII_A),
  11162. 1: int8(m_ASCII_T),
  11163. 2: int8(m_ASCII_T),
  11164. 3: int8(m_ASCII_L),
  11165. 4: int8(m_ASCII_I),
  11166. 5: int8(m_ASCII_S),
  11167. 6: int8(m_ASCII_T),
  11168. }
  11169. var _KW_CDATA = [6]int8{
  11170. 0: int8(m_ASCII_C),
  11171. 1: int8(m_ASCII_D),
  11172. 2: int8(m_ASCII_A),
  11173. 3: int8(m_ASCII_T),
  11174. 4: int8(m_ASCII_A),
  11175. }
  11176. var _KW_DOCTYPE = [8]int8{
  11177. 0: int8(m_ASCII_D),
  11178. 1: int8(m_ASCII_O),
  11179. 2: int8(m_ASCII_C),
  11180. 3: int8(m_ASCII_T),
  11181. 4: int8(m_ASCII_Y),
  11182. 5: int8(m_ASCII_P1),
  11183. 6: int8(m_ASCII_E),
  11184. }
  11185. var _KW_ELEMENT = [8]int8{
  11186. 0: int8(m_ASCII_E),
  11187. 1: int8(m_ASCII_L),
  11188. 2: int8(m_ASCII_E),
  11189. 3: int8(m_ASCII_M),
  11190. 4: int8(m_ASCII_E),
  11191. 5: int8(m_ASCII_N),
  11192. 6: int8(m_ASCII_T),
  11193. }
  11194. var _KW_EMPTY = [6]int8{
  11195. 0: int8(m_ASCII_E),
  11196. 1: int8(m_ASCII_M),
  11197. 2: int8(m_ASCII_P1),
  11198. 3: int8(m_ASCII_T),
  11199. 4: int8(m_ASCII_Y),
  11200. }
  11201. var _KW_ENTITIES = [9]int8{
  11202. 0: int8(m_ASCII_E),
  11203. 1: int8(m_ASCII_N),
  11204. 2: int8(m_ASCII_T),
  11205. 3: int8(m_ASCII_I),
  11206. 4: int8(m_ASCII_T),
  11207. 5: int8(m_ASCII_I),
  11208. 6: int8(m_ASCII_E),
  11209. 7: int8(m_ASCII_S),
  11210. }
  11211. var _KW_ENTITY = [7]int8{
  11212. 0: int8(m_ASCII_E),
  11213. 1: int8(m_ASCII_N),
  11214. 2: int8(m_ASCII_T),
  11215. 3: int8(m_ASCII_I),
  11216. 4: int8(m_ASCII_T),
  11217. 5: int8(m_ASCII_Y),
  11218. }
  11219. var _KW_FIXED = [6]int8{
  11220. 0: int8(m_ASCII_F),
  11221. 1: int8(m_ASCII_I),
  11222. 2: int8(m_ASCII_X),
  11223. 3: int8(m_ASCII_E),
  11224. 4: int8(m_ASCII_D),
  11225. }
  11226. var _KW_ID = [3]int8{
  11227. 0: int8(m_ASCII_I),
  11228. 1: int8(m_ASCII_D),
  11229. }
  11230. var _KW_IDREF = [6]int8{
  11231. 0: int8(m_ASCII_I),
  11232. 1: int8(m_ASCII_D),
  11233. 2: int8(m_ASCII_R),
  11234. 3: int8(m_ASCII_E),
  11235. 4: int8(m_ASCII_F),
  11236. }
  11237. var _KW_IDREFS = [7]int8{
  11238. 0: int8(m_ASCII_I),
  11239. 1: int8(m_ASCII_D),
  11240. 2: int8(m_ASCII_R),
  11241. 3: int8(m_ASCII_E),
  11242. 4: int8(m_ASCII_F),
  11243. 5: int8(m_ASCII_S),
  11244. }
  11245. var _KW_IGNORE = [7]int8{
  11246. 0: int8(m_ASCII_I),
  11247. 1: int8(m_ASCII_G1),
  11248. 2: int8(m_ASCII_N),
  11249. 3: int8(m_ASCII_O),
  11250. 4: int8(m_ASCII_R),
  11251. 5: int8(m_ASCII_E),
  11252. }
  11253. var _KW_IMPLIED = [8]int8{
  11254. 0: int8(m_ASCII_I),
  11255. 1: int8(m_ASCII_M),
  11256. 2: int8(m_ASCII_P1),
  11257. 3: int8(m_ASCII_L),
  11258. 4: int8(m_ASCII_I),
  11259. 5: int8(m_ASCII_E),
  11260. 6: int8(m_ASCII_D),
  11261. }
  11262. var _KW_INCLUDE = [8]int8{
  11263. 0: int8(m_ASCII_I),
  11264. 1: int8(m_ASCII_N),
  11265. 2: int8(m_ASCII_C),
  11266. 3: int8(m_ASCII_L),
  11267. 4: int8(m_ASCII_U1),
  11268. 5: int8(m_ASCII_D),
  11269. 6: int8(m_ASCII_E),
  11270. }
  11271. var _KW_NDATA = [6]int8{
  11272. 0: int8(m_ASCII_N),
  11273. 1: int8(m_ASCII_D),
  11274. 2: int8(m_ASCII_A),
  11275. 3: int8(m_ASCII_T),
  11276. 4: int8(m_ASCII_A),
  11277. }
  11278. var _KW_NMTOKEN = [8]int8{
  11279. 0: int8(m_ASCII_N),
  11280. 1: int8(m_ASCII_M),
  11281. 2: int8(m_ASCII_T),
  11282. 3: int8(m_ASCII_O),
  11283. 4: int8(m_ASCII_K),
  11284. 5: int8(m_ASCII_E),
  11285. 6: int8(m_ASCII_N),
  11286. }
  11287. var _KW_NMTOKENS = [9]int8{
  11288. 0: int8(m_ASCII_N),
  11289. 1: int8(m_ASCII_M),
  11290. 2: int8(m_ASCII_T),
  11291. 3: int8(m_ASCII_O),
  11292. 4: int8(m_ASCII_K),
  11293. 5: int8(m_ASCII_E),
  11294. 6: int8(m_ASCII_N),
  11295. 7: int8(m_ASCII_S),
  11296. }
  11297. var _KW_NOTATION = [9]int8{
  11298. 0: int8(m_ASCII_N),
  11299. 1: int8(m_ASCII_O),
  11300. 2: int8(m_ASCII_T),
  11301. 3: int8(m_ASCII_A),
  11302. 4: int8(m_ASCII_T),
  11303. 5: int8(m_ASCII_I),
  11304. 6: int8(m_ASCII_O),
  11305. 7: int8(m_ASCII_N),
  11306. }
  11307. var _KW_PCDATA = [7]int8{
  11308. 0: int8(m_ASCII_P1),
  11309. 1: int8(m_ASCII_C),
  11310. 2: int8(m_ASCII_D),
  11311. 3: int8(m_ASCII_A),
  11312. 4: int8(m_ASCII_T),
  11313. 5: int8(m_ASCII_A),
  11314. }
  11315. var _KW_PUBLIC = [7]int8{
  11316. 0: int8(m_ASCII_P1),
  11317. 1: int8(m_ASCII_U1),
  11318. 2: int8(m_ASCII_B1),
  11319. 3: int8(m_ASCII_L),
  11320. 4: int8(m_ASCII_I),
  11321. 5: int8(m_ASCII_C),
  11322. }
  11323. var _KW_REQUIRED = [9]int8{
  11324. 0: int8(m_ASCII_R),
  11325. 1: int8(m_ASCII_E),
  11326. 2: int8(m_ASCII_Q1),
  11327. 3: int8(m_ASCII_U1),
  11328. 4: int8(m_ASCII_I),
  11329. 5: int8(m_ASCII_R),
  11330. 6: int8(m_ASCII_E),
  11331. 7: int8(m_ASCII_D),
  11332. }
  11333. var _KW_SYSTEM = [7]int8{
  11334. 0: int8(m_ASCII_S),
  11335. 1: int8(m_ASCII_Y),
  11336. 2: int8(m_ASCII_S),
  11337. 3: int8(m_ASCII_T),
  11338. 4: int8(m_ASCII_E),
  11339. 5: int8(m_ASCII_M),
  11340. }
  11341. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11342. switch tok {
  11343. case int32(m_XML_TOK_PROLOG_S):
  11344. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11345. return int32(_XML_ROLE_NONE)
  11346. case int32(m_XML_TOK_XML_DECL):
  11347. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11348. return int32(_XML_ROLE_XML_DECL)
  11349. case int32(m_XML_TOK_PI):
  11350. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11351. return int32(_XML_ROLE_PI)
  11352. case int32(m_XML_TOK_COMMENT):
  11353. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  11354. return int32(_XML_ROLE_COMMENT)
  11355. case int32(m_XML_TOK_BOM):
  11356. return int32(_XML_ROLE_NONE)
  11357. case int32(m_XML_TOK_DECL_OPEN):
  11358. 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) {
  11359. break
  11360. }
  11361. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11362. return int32(_XML_ROLE_DOCTYPE_NONE)
  11363. case int32(m_XML_TOK_INSTANCE_START):
  11364. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11365. return int32(_XML_ROLE_INSTANCE_START)
  11366. }
  11367. return _common(tls, state, tok)
  11368. }
  11369. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11370. switch tok {
  11371. case int32(m_XML_TOK_PROLOG_S):
  11372. return int32(_XML_ROLE_NONE)
  11373. case int32(m_XML_TOK_PI):
  11374. return int32(_XML_ROLE_PI)
  11375. case int32(m_XML_TOK_COMMENT):
  11376. return int32(_XML_ROLE_COMMENT)
  11377. case int32(m_XML_TOK_BOM):
  11378. /* This case can never arise. To reach this role function, the
  11379. * parse must have passed through prolog0 and therefore have had
  11380. * some form of input, even if only a space. At that point, a
  11381. * byte order mark is no longer a valid character (though
  11382. * technically it should be interpreted as a non-breaking space),
  11383. * so will be rejected by the tokenizing stages.
  11384. */
  11385. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  11386. case int32(m_XML_TOK_DECL_OPEN):
  11387. 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) {
  11388. break
  11389. }
  11390. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  11391. return int32(_XML_ROLE_DOCTYPE_NONE)
  11392. case int32(m_XML_TOK_INSTANCE_START):
  11393. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11394. return int32(_XML_ROLE_INSTANCE_START)
  11395. }
  11396. return _common(tls, state, tok)
  11397. }
  11398. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11399. _ = ptr
  11400. _ = end
  11401. _ = enc
  11402. switch tok {
  11403. case int32(m_XML_TOK_PROLOG_S):
  11404. return int32(_XML_ROLE_NONE)
  11405. case int32(m_XML_TOK_PI):
  11406. return int32(_XML_ROLE_PI)
  11407. case int32(m_XML_TOK_COMMENT):
  11408. return int32(_XML_ROLE_COMMENT)
  11409. case int32(m_XML_TOK_INSTANCE_START):
  11410. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  11411. return int32(_XML_ROLE_INSTANCE_START)
  11412. }
  11413. return _common(tls, state, tok)
  11414. }
  11415. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11416. _ = ptr
  11417. _ = end
  11418. _ = enc
  11419. switch tok {
  11420. case int32(m_XML_TOK_PROLOG_S):
  11421. return int32(_XML_ROLE_DOCTYPE_NONE)
  11422. case int32(m_XML_TOK_NAME):
  11423. fallthrough
  11424. case int32(m_XML_TOK_PREFIXED_NAME):
  11425. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  11426. return int32(_XML_ROLE_DOCTYPE_NAME)
  11427. }
  11428. return _common(tls, state, tok)
  11429. }
  11430. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11431. switch tok {
  11432. case int32(m_XML_TOK_PROLOG_S):
  11433. return int32(_XML_ROLE_DOCTYPE_NONE)
  11434. case int32(m_XML_TOK_OPEN_BRACKET):
  11435. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11436. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11437. case int32(m_XML_TOK_DECL_CLOSE):
  11438. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11439. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11440. case int32(m_XML_TOK_NAME):
  11441. 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 {
  11442. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11443. return int32(_XML_ROLE_DOCTYPE_NONE)
  11444. }
  11445. 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 {
  11446. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  11447. return int32(_XML_ROLE_DOCTYPE_NONE)
  11448. }
  11449. break
  11450. }
  11451. return _common(tls, state, tok)
  11452. }
  11453. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11454. _ = ptr
  11455. _ = end
  11456. _ = enc
  11457. switch tok {
  11458. case int32(m_XML_TOK_PROLOG_S):
  11459. return int32(_XML_ROLE_DOCTYPE_NONE)
  11460. case int32(m_XML_TOK_LITERAL):
  11461. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  11462. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  11463. }
  11464. return _common(tls, state, tok)
  11465. }
  11466. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11467. _ = ptr
  11468. _ = end
  11469. _ = enc
  11470. switch tok {
  11471. case int32(m_XML_TOK_PROLOG_S):
  11472. return int32(_XML_ROLE_DOCTYPE_NONE)
  11473. case int32(m_XML_TOK_LITERAL):
  11474. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  11475. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  11476. }
  11477. return _common(tls, state, tok)
  11478. }
  11479. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11480. _ = ptr
  11481. _ = end
  11482. _ = enc
  11483. switch tok {
  11484. case int32(m_XML_TOK_PROLOG_S):
  11485. return int32(_XML_ROLE_DOCTYPE_NONE)
  11486. case int32(m_XML_TOK_OPEN_BRACKET):
  11487. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  11488. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  11489. case int32(m_XML_TOK_DECL_CLOSE):
  11490. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11491. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11492. }
  11493. return _common(tls, state, tok)
  11494. }
  11495. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11496. _ = ptr
  11497. _ = end
  11498. _ = enc
  11499. switch tok {
  11500. case int32(m_XML_TOK_PROLOG_S):
  11501. return int32(_XML_ROLE_DOCTYPE_NONE)
  11502. case int32(m_XML_TOK_DECL_CLOSE):
  11503. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  11504. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  11505. }
  11506. return _common(tls, state, tok)
  11507. }
  11508. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11509. switch tok {
  11510. case int32(m_XML_TOK_PROLOG_S):
  11511. return int32(_XML_ROLE_NONE)
  11512. case int32(m_XML_TOK_DECL_OPEN):
  11513. 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 {
  11514. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  11515. return int32(_XML_ROLE_ENTITY_NONE)
  11516. }
  11517. 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 {
  11518. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  11519. return int32(_XML_ROLE_ATTLIST_NONE)
  11520. }
  11521. 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 {
  11522. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  11523. return int32(_XML_ROLE_ELEMENT_NONE)
  11524. }
  11525. 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 {
  11526. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  11527. return int32(_XML_ROLE_NOTATION_NONE)
  11528. }
  11529. case int32(m_XML_TOK_PI):
  11530. return int32(_XML_ROLE_PI)
  11531. case int32(m_XML_TOK_COMMENT):
  11532. return int32(_XML_ROLE_COMMENT)
  11533. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  11534. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  11535. case int32(m_XML_TOK_CLOSE_BRACKET):
  11536. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  11537. return int32(_XML_ROLE_DOCTYPE_NONE)
  11538. case -int32(4):
  11539. return int32(_XML_ROLE_NONE)
  11540. }
  11541. return _common(tls, state, tok)
  11542. }
  11543. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11544. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  11545. if tok == int32(m_XML_TOK_XML_DECL) {
  11546. return int32(_XML_ROLE_TEXT_DECL)
  11547. }
  11548. return _externalSubset1(tls, state, tok, ptr, end, enc)
  11549. }
  11550. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11551. switch tok {
  11552. case int32(m_XML_TOK_COND_SECT_OPEN):
  11553. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  11554. return int32(_XML_ROLE_NONE)
  11555. case int32(m_XML_TOK_COND_SECT_CLOSE):
  11556. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  11557. break
  11558. }
  11559. *(*uint32)(unsafe.Pointer(state + 12)) -= uint32(1)
  11560. return int32(_XML_ROLE_NONE)
  11561. case int32(m_XML_TOK_PROLOG_S):
  11562. return int32(_XML_ROLE_NONE)
  11563. case int32(m_XML_TOK_CLOSE_BRACKET):
  11564. case -int32(4):
  11565. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  11566. break
  11567. }
  11568. return int32(_XML_ROLE_NONE)
  11569. default:
  11570. return _internalSubset(tls, state, tok, ptr, end, enc)
  11571. }
  11572. return _common(tls, state, tok)
  11573. }
  11574. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11575. _ = ptr
  11576. _ = end
  11577. _ = enc
  11578. switch tok {
  11579. case int32(m_XML_TOK_PROLOG_S):
  11580. return int32(_XML_ROLE_ENTITY_NONE)
  11581. case int32(m_XML_TOK_PERCENT):
  11582. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  11583. return int32(_XML_ROLE_ENTITY_NONE)
  11584. case int32(m_XML_TOK_NAME):
  11585. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  11586. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  11587. }
  11588. return _common(tls, state, tok)
  11589. }
  11590. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11591. _ = ptr
  11592. _ = end
  11593. _ = enc
  11594. switch tok {
  11595. case int32(m_XML_TOK_PROLOG_S):
  11596. return int32(_XML_ROLE_ENTITY_NONE)
  11597. case int32(m_XML_TOK_NAME):
  11598. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  11599. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  11600. }
  11601. return _common(tls, state, tok)
  11602. }
  11603. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11604. switch tok {
  11605. case int32(m_XML_TOK_PROLOG_S):
  11606. return int32(_XML_ROLE_ENTITY_NONE)
  11607. case int32(m_XML_TOK_NAME):
  11608. 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 {
  11609. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11610. return int32(_XML_ROLE_ENTITY_NONE)
  11611. }
  11612. 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 {
  11613. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  11614. return int32(_XML_ROLE_ENTITY_NONE)
  11615. }
  11616. case int32(m_XML_TOK_LITERAL):
  11617. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11618. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11619. return int32(_XML_ROLE_ENTITY_VALUE)
  11620. }
  11621. return _common(tls, state, tok)
  11622. }
  11623. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11624. _ = ptr
  11625. _ = end
  11626. _ = enc
  11627. switch tok {
  11628. case int32(m_XML_TOK_PROLOG_S):
  11629. return int32(_XML_ROLE_ENTITY_NONE)
  11630. case int32(m_XML_TOK_LITERAL):
  11631. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  11632. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11633. }
  11634. return _common(tls, state, tok)
  11635. }
  11636. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11637. _ = ptr
  11638. _ = end
  11639. _ = enc
  11640. switch tok {
  11641. case int32(m_XML_TOK_PROLOG_S):
  11642. return int32(_XML_ROLE_ENTITY_NONE)
  11643. case int32(m_XML_TOK_LITERAL):
  11644. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  11645. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11646. }
  11647. return _common(tls, state, tok)
  11648. }
  11649. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11650. var v1 uintptr
  11651. _ = v1
  11652. switch tok {
  11653. case int32(m_XML_TOK_PROLOG_S):
  11654. return int32(_XML_ROLE_ENTITY_NONE)
  11655. case int32(m_XML_TOK_DECL_CLOSE):
  11656. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11657. v1 = __ccgo_fp(_internalSubset)
  11658. } else {
  11659. v1 = __ccgo_fp(_externalSubset1)
  11660. }
  11661. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11662. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11663. case int32(m_XML_TOK_NAME):
  11664. 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 {
  11665. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  11666. return int32(_XML_ROLE_ENTITY_NONE)
  11667. }
  11668. break
  11669. }
  11670. return _common(tls, state, tok)
  11671. }
  11672. func _entity6(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_NAME):
  11680. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11681. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11682. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  11683. }
  11684. return _common(tls, state, tok)
  11685. }
  11686. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11687. switch tok {
  11688. case int32(m_XML_TOK_PROLOG_S):
  11689. return int32(_XML_ROLE_ENTITY_NONE)
  11690. case int32(m_XML_TOK_NAME):
  11691. 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 {
  11692. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11693. return int32(_XML_ROLE_ENTITY_NONE)
  11694. }
  11695. 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 {
  11696. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  11697. return int32(_XML_ROLE_ENTITY_NONE)
  11698. }
  11699. case int32(m_XML_TOK_LITERAL):
  11700. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11701. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  11702. return int32(_XML_ROLE_ENTITY_VALUE)
  11703. }
  11704. return _common(tls, state, tok)
  11705. }
  11706. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11707. _ = ptr
  11708. _ = end
  11709. _ = enc
  11710. switch tok {
  11711. case int32(m_XML_TOK_PROLOG_S):
  11712. return int32(_XML_ROLE_ENTITY_NONE)
  11713. case int32(m_XML_TOK_LITERAL):
  11714. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  11715. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  11716. }
  11717. return _common(tls, state, tok)
  11718. }
  11719. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11720. _ = ptr
  11721. _ = end
  11722. _ = enc
  11723. switch tok {
  11724. case int32(m_XML_TOK_PROLOG_S):
  11725. return int32(_XML_ROLE_ENTITY_NONE)
  11726. case int32(m_XML_TOK_LITERAL):
  11727. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  11728. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  11729. }
  11730. return _common(tls, state, tok)
  11731. }
  11732. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11733. var v1 uintptr
  11734. _ = v1
  11735. _ = ptr
  11736. _ = end
  11737. _ = enc
  11738. switch tok {
  11739. case int32(m_XML_TOK_PROLOG_S):
  11740. return int32(_XML_ROLE_ENTITY_NONE)
  11741. case int32(m_XML_TOK_DECL_CLOSE):
  11742. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11743. v1 = __ccgo_fp(_internalSubset)
  11744. } else {
  11745. v1 = __ccgo_fp(_externalSubset1)
  11746. }
  11747. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11748. return int32(_XML_ROLE_ENTITY_COMPLETE)
  11749. }
  11750. return _common(tls, state, tok)
  11751. }
  11752. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11753. _ = ptr
  11754. _ = end
  11755. _ = enc
  11756. switch tok {
  11757. case int32(m_XML_TOK_PROLOG_S):
  11758. return int32(_XML_ROLE_NOTATION_NONE)
  11759. case int32(m_XML_TOK_NAME):
  11760. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  11761. return int32(_XML_ROLE_NOTATION_NAME)
  11762. }
  11763. return _common(tls, state, tok)
  11764. }
  11765. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11766. switch tok {
  11767. case int32(m_XML_TOK_PROLOG_S):
  11768. return int32(_XML_ROLE_NOTATION_NONE)
  11769. case int32(m_XML_TOK_NAME):
  11770. 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 {
  11771. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  11772. return int32(_XML_ROLE_NOTATION_NONE)
  11773. }
  11774. 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 {
  11775. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  11776. return int32(_XML_ROLE_NOTATION_NONE)
  11777. }
  11778. break
  11779. }
  11780. return _common(tls, state, tok)
  11781. }
  11782. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11783. _ = ptr
  11784. _ = end
  11785. _ = enc
  11786. switch tok {
  11787. case int32(m_XML_TOK_PROLOG_S):
  11788. return int32(_XML_ROLE_NOTATION_NONE)
  11789. case int32(m_XML_TOK_LITERAL):
  11790. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  11791. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  11792. }
  11793. return _common(tls, state, tok)
  11794. }
  11795. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11796. _ = ptr
  11797. _ = end
  11798. _ = enc
  11799. switch tok {
  11800. case int32(m_XML_TOK_PROLOG_S):
  11801. return int32(_XML_ROLE_NOTATION_NONE)
  11802. case int32(m_XML_TOK_LITERAL):
  11803. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11804. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11805. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11806. }
  11807. return _common(tls, state, tok)
  11808. }
  11809. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11810. var v1 uintptr
  11811. _ = v1
  11812. _ = ptr
  11813. _ = end
  11814. _ = enc
  11815. switch tok {
  11816. case int32(m_XML_TOK_PROLOG_S):
  11817. return int32(_XML_ROLE_NOTATION_NONE)
  11818. case int32(m_XML_TOK_LITERAL):
  11819. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  11820. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  11821. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  11822. case int32(m_XML_TOK_DECL_CLOSE):
  11823. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11824. v1 = __ccgo_fp(_internalSubset)
  11825. } else {
  11826. v1 = __ccgo_fp(_externalSubset1)
  11827. }
  11828. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11829. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  11830. }
  11831. return _common(tls, state, tok)
  11832. }
  11833. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11834. _ = ptr
  11835. _ = end
  11836. _ = enc
  11837. switch tok {
  11838. case int32(m_XML_TOK_PROLOG_S):
  11839. return int32(_XML_ROLE_ATTLIST_NONE)
  11840. case int32(m_XML_TOK_NAME):
  11841. fallthrough
  11842. case int32(m_XML_TOK_PREFIXED_NAME):
  11843. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11844. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  11845. }
  11846. return _common(tls, state, tok)
  11847. }
  11848. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11849. var v1 uintptr
  11850. _ = v1
  11851. _ = ptr
  11852. _ = end
  11853. _ = enc
  11854. switch tok {
  11855. case int32(m_XML_TOK_PROLOG_S):
  11856. return int32(_XML_ROLE_ATTLIST_NONE)
  11857. case int32(m_XML_TOK_DECL_CLOSE):
  11858. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  11859. v1 = __ccgo_fp(_internalSubset)
  11860. } else {
  11861. v1 = __ccgo_fp(_externalSubset1)
  11862. }
  11863. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  11864. return int32(_XML_ROLE_ATTLIST_NONE)
  11865. case int32(m_XML_TOK_NAME):
  11866. fallthrough
  11867. case int32(m_XML_TOK_PREFIXED_NAME):
  11868. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  11869. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  11870. }
  11871. return _common(tls, state, tok)
  11872. }
  11873. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11874. var i int32
  11875. _ = i
  11876. switch tok {
  11877. case int32(m_XML_TOK_PROLOG_S):
  11878. return int32(_XML_ROLE_ATTLIST_NONE)
  11879. case int32(m_XML_TOK_NAME):
  11880. i = 0
  11881. for {
  11882. if !(i < libc.Int32FromUint32(libc.Uint32FromInt64(32)/libc.Uint32FromInt64(4))) {
  11883. break
  11884. }
  11885. 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 {
  11886. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11887. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  11888. }
  11889. goto _1
  11890. _1:
  11891. ;
  11892. i++
  11893. }
  11894. 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 {
  11895. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  11896. return int32(_XML_ROLE_ATTLIST_NONE)
  11897. }
  11898. case int32(m_XML_TOK_OPEN_PAREN):
  11899. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11900. return int32(_XML_ROLE_ATTLIST_NONE)
  11901. }
  11902. return _common(tls, state, tok)
  11903. }
  11904. var _types = [8]uintptr{
  11905. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  11906. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  11907. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  11908. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  11909. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  11910. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  11911. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  11912. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  11913. }
  11914. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11915. _ = ptr
  11916. _ = end
  11917. _ = enc
  11918. switch tok {
  11919. case int32(m_XML_TOK_PROLOG_S):
  11920. return int32(_XML_ROLE_ATTLIST_NONE)
  11921. case int32(m_XML_TOK_NMTOKEN):
  11922. fallthrough
  11923. case int32(m_XML_TOK_NAME):
  11924. fallthrough
  11925. case int32(m_XML_TOK_PREFIXED_NAME):
  11926. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  11927. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  11928. }
  11929. return _common(tls, state, tok)
  11930. }
  11931. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11932. _ = ptr
  11933. _ = end
  11934. _ = enc
  11935. switch tok {
  11936. case int32(m_XML_TOK_PROLOG_S):
  11937. return int32(_XML_ROLE_ATTLIST_NONE)
  11938. case int32(m_XML_TOK_CLOSE_PAREN):
  11939. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11940. return int32(_XML_ROLE_ATTLIST_NONE)
  11941. case int32(m_XML_TOK_OR):
  11942. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  11943. return int32(_XML_ROLE_ATTLIST_NONE)
  11944. }
  11945. return _common(tls, state, tok)
  11946. }
  11947. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11948. _ = ptr
  11949. _ = end
  11950. _ = enc
  11951. switch tok {
  11952. case int32(m_XML_TOK_PROLOG_S):
  11953. return int32(_XML_ROLE_ATTLIST_NONE)
  11954. case int32(m_XML_TOK_OPEN_PAREN):
  11955. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11956. return int32(_XML_ROLE_ATTLIST_NONE)
  11957. }
  11958. return _common(tls, state, tok)
  11959. }
  11960. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11961. _ = ptr
  11962. _ = end
  11963. _ = enc
  11964. switch tok {
  11965. case int32(m_XML_TOK_PROLOG_S):
  11966. return int32(_XML_ROLE_ATTLIST_NONE)
  11967. case int32(m_XML_TOK_NAME):
  11968. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  11969. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  11970. }
  11971. return _common(tls, state, tok)
  11972. }
  11973. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11974. _ = ptr
  11975. _ = end
  11976. _ = enc
  11977. switch tok {
  11978. case int32(m_XML_TOK_PROLOG_S):
  11979. return int32(_XML_ROLE_ATTLIST_NONE)
  11980. case int32(m_XML_TOK_CLOSE_PAREN):
  11981. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  11982. return int32(_XML_ROLE_ATTLIST_NONE)
  11983. case int32(m_XML_TOK_OR):
  11984. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  11985. return int32(_XML_ROLE_ATTLIST_NONE)
  11986. }
  11987. return _common(tls, state, tok)
  11988. }
  11989. // C documentation
  11990. //
  11991. // /* default value */
  11992. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  11993. switch tok {
  11994. case int32(m_XML_TOK_PROLOG_S):
  11995. return int32(_XML_ROLE_ATTLIST_NONE)
  11996. case int32(m_XML_TOK_POUND_NAME):
  11997. 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 {
  11998. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  11999. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  12000. }
  12001. 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 {
  12002. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12003. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  12004. }
  12005. 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 {
  12006. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  12007. return int32(_XML_ROLE_ATTLIST_NONE)
  12008. }
  12009. case int32(m_XML_TOK_LITERAL):
  12010. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12011. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  12012. }
  12013. return _common(tls, state, tok)
  12014. }
  12015. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12016. _ = ptr
  12017. _ = end
  12018. _ = enc
  12019. switch tok {
  12020. case int32(m_XML_TOK_PROLOG_S):
  12021. return int32(_XML_ROLE_ATTLIST_NONE)
  12022. case int32(m_XML_TOK_LITERAL):
  12023. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  12024. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  12025. }
  12026. return _common(tls, state, tok)
  12027. }
  12028. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12029. _ = ptr
  12030. _ = end
  12031. _ = enc
  12032. switch tok {
  12033. case int32(m_XML_TOK_PROLOG_S):
  12034. return int32(_XML_ROLE_ELEMENT_NONE)
  12035. case int32(m_XML_TOK_NAME):
  12036. fallthrough
  12037. case int32(m_XML_TOK_PREFIXED_NAME):
  12038. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  12039. return int32(_XML_ROLE_ELEMENT_NAME)
  12040. }
  12041. return _common(tls, state, tok)
  12042. }
  12043. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12044. switch tok {
  12045. case int32(m_XML_TOK_PROLOG_S):
  12046. return int32(_XML_ROLE_ELEMENT_NONE)
  12047. case int32(m_XML_TOK_NAME):
  12048. 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 {
  12049. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12050. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12051. return int32(_XML_ROLE_CONTENT_EMPTY)
  12052. }
  12053. 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 {
  12054. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12055. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12056. return int32(_XML_ROLE_CONTENT_ANY)
  12057. }
  12058. case int32(m_XML_TOK_OPEN_PAREN):
  12059. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  12060. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  12061. return int32(_XML_ROLE_GROUP_OPEN)
  12062. }
  12063. return _common(tls, state, tok)
  12064. }
  12065. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12066. switch tok {
  12067. case int32(m_XML_TOK_PROLOG_S):
  12068. return int32(_XML_ROLE_ELEMENT_NONE)
  12069. case int32(m_XML_TOK_POUND_NAME):
  12070. 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 {
  12071. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  12072. return int32(_XML_ROLE_CONTENT_PCDATA)
  12073. }
  12074. case int32(m_XML_TOK_OPEN_PAREN):
  12075. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  12076. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12077. return int32(_XML_ROLE_GROUP_OPEN)
  12078. case int32(m_XML_TOK_NAME):
  12079. fallthrough
  12080. case int32(m_XML_TOK_PREFIXED_NAME):
  12081. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12082. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12083. case int32(m_XML_TOK_NAME_QUESTION):
  12084. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12085. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12086. case int32(m_XML_TOK_NAME_ASTERISK):
  12087. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12088. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12089. case int32(m_XML_TOK_NAME_PLUS):
  12090. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12091. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12092. }
  12093. return _common(tls, state, tok)
  12094. }
  12095. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12096. _ = ptr
  12097. _ = end
  12098. _ = enc
  12099. switch tok {
  12100. case int32(m_XML_TOK_PROLOG_S):
  12101. return int32(_XML_ROLE_ELEMENT_NONE)
  12102. case int32(m_XML_TOK_CLOSE_PAREN):
  12103. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12104. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12105. return int32(_XML_ROLE_GROUP_CLOSE)
  12106. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12107. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12108. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12109. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12110. case int32(m_XML_TOK_OR):
  12111. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12112. return int32(_XML_ROLE_ELEMENT_NONE)
  12113. }
  12114. return _common(tls, state, tok)
  12115. }
  12116. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12117. _ = ptr
  12118. _ = end
  12119. _ = enc
  12120. switch tok {
  12121. case int32(m_XML_TOK_PROLOG_S):
  12122. return int32(_XML_ROLE_ELEMENT_NONE)
  12123. case int32(m_XML_TOK_NAME):
  12124. fallthrough
  12125. case int32(m_XML_TOK_PREFIXED_NAME):
  12126. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  12127. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12128. }
  12129. return _common(tls, state, tok)
  12130. }
  12131. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12132. _ = ptr
  12133. _ = end
  12134. _ = enc
  12135. switch tok {
  12136. case int32(m_XML_TOK_PROLOG_S):
  12137. return int32(_XML_ROLE_ELEMENT_NONE)
  12138. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12139. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12140. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12141. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12142. case int32(m_XML_TOK_OR):
  12143. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  12144. return int32(_XML_ROLE_ELEMENT_NONE)
  12145. }
  12146. return _common(tls, state, tok)
  12147. }
  12148. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12149. _ = ptr
  12150. _ = end
  12151. _ = enc
  12152. switch tok {
  12153. case int32(m_XML_TOK_PROLOG_S):
  12154. return int32(_XML_ROLE_ELEMENT_NONE)
  12155. case int32(m_XML_TOK_OPEN_PAREN):
  12156. *(*uint32)(unsafe.Pointer(state + 4)) += uint32(1)
  12157. return int32(_XML_ROLE_GROUP_OPEN)
  12158. case int32(m_XML_TOK_NAME):
  12159. fallthrough
  12160. case int32(m_XML_TOK_PREFIXED_NAME):
  12161. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12162. return int32(_XML_ROLE_CONTENT_ELEMENT)
  12163. case int32(m_XML_TOK_NAME_QUESTION):
  12164. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12165. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  12166. case int32(m_XML_TOK_NAME_ASTERISK):
  12167. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12168. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  12169. case int32(m_XML_TOK_NAME_PLUS):
  12170. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  12171. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  12172. }
  12173. return _common(tls, state, tok)
  12174. }
  12175. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12176. _ = ptr
  12177. _ = end
  12178. _ = enc
  12179. switch tok {
  12180. case int32(m_XML_TOK_PROLOG_S):
  12181. return int32(_XML_ROLE_ELEMENT_NONE)
  12182. case int32(m_XML_TOK_CLOSE_PAREN):
  12183. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12184. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12185. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12186. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12187. }
  12188. return int32(_XML_ROLE_GROUP_CLOSE)
  12189. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  12190. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12191. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12192. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12193. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12194. }
  12195. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  12196. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  12197. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12198. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12199. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12200. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12201. }
  12202. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  12203. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  12204. *(*uint32)(unsafe.Pointer(state + 4)) -= uint32(1)
  12205. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  12206. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  12207. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  12208. }
  12209. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  12210. case int32(m_XML_TOK_COMMA):
  12211. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12212. return int32(_XML_ROLE_GROUP_SEQUENCE)
  12213. case int32(m_XML_TOK_OR):
  12214. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  12215. return int32(_XML_ROLE_GROUP_CHOICE)
  12216. }
  12217. return _common(tls, state, tok)
  12218. }
  12219. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12220. switch tok {
  12221. case int32(m_XML_TOK_PROLOG_S):
  12222. return int32(_XML_ROLE_NONE)
  12223. case int32(m_XML_TOK_NAME):
  12224. 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 {
  12225. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  12226. return int32(_XML_ROLE_NONE)
  12227. }
  12228. 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 {
  12229. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  12230. return int32(_XML_ROLE_NONE)
  12231. }
  12232. break
  12233. }
  12234. return _common(tls, state, tok)
  12235. }
  12236. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12237. _ = ptr
  12238. _ = end
  12239. _ = enc
  12240. switch tok {
  12241. case int32(m_XML_TOK_PROLOG_S):
  12242. return int32(_XML_ROLE_NONE)
  12243. case int32(m_XML_TOK_OPEN_BRACKET):
  12244. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12245. *(*uint32)(unsafe.Pointer(state + 12)) += uint32(1)
  12246. return int32(_XML_ROLE_NONE)
  12247. }
  12248. return _common(tls, state, tok)
  12249. }
  12250. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12251. _ = ptr
  12252. _ = end
  12253. _ = enc
  12254. switch tok {
  12255. case int32(m_XML_TOK_PROLOG_S):
  12256. return int32(_XML_ROLE_NONE)
  12257. case int32(m_XML_TOK_OPEN_BRACKET):
  12258. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  12259. return int32(_XML_ROLE_IGNORE_SECT)
  12260. }
  12261. return _common(tls, state, tok)
  12262. }
  12263. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12264. var v1 uintptr
  12265. _ = v1
  12266. _ = ptr
  12267. _ = end
  12268. _ = enc
  12269. switch tok {
  12270. case int32(m_XML_TOK_PROLOG_S):
  12271. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12272. case int32(m_XML_TOK_DECL_CLOSE):
  12273. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  12274. v1 = __ccgo_fp(_internalSubset)
  12275. } else {
  12276. v1 = __ccgo_fp(_externalSubset1)
  12277. }
  12278. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  12279. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  12280. }
  12281. return _common(tls, state, tok)
  12282. }
  12283. // C documentation
  12284. //
  12285. // /* This function will only be invoked if the internal logic of the
  12286. // * parser has broken down. It is used in two cases:
  12287. // *
  12288. // * 1: When the XML prolog has been finished. At this point the
  12289. // * processor (the parser level above these role handlers) should
  12290. // * switch from prologProcessor to contentProcessor and reinitialise
  12291. // * the handler function.
  12292. // *
  12293. // * 2: When an error has been detected (via common() below). At this
  12294. // * point again the processor should be switched to errorProcessor,
  12295. // * which will never call a handler.
  12296. // *
  12297. // * The result of this is that error() can only be called if the
  12298. // * processor switch failed to happen, which is an internal error and
  12299. // * therefore we shouldn't be able to provoke it simply by using the
  12300. // * library. It is a necessary backstop, however, so we merely exclude
  12301. // * it from the coverage statistics.
  12302. // *
  12303. // * LCOV_EXCL_START
  12304. // */
  12305. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  12306. _ = state
  12307. _ = tok
  12308. _ = ptr
  12309. _ = end
  12310. _ = enc
  12311. return int32(_XML_ROLE_NONE)
  12312. }
  12313. /* LCOV_EXCL_STOP */
  12314. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  12315. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  12316. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  12317. }
  12318. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  12319. return int32(_XML_ROLE_ERROR)
  12320. }
  12321. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  12322. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  12323. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  12324. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12325. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  12326. }
  12327. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  12328. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  12329. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  12330. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  12331. }
  12332. const m_ASCII_02 = 48
  12333. const m_ASCII_12 = 49
  12334. const m_ASCII_22 = 50
  12335. const m_ASCII_32 = 51
  12336. const m_ASCII_41 = 52
  12337. const m_ASCII_51 = 53
  12338. const m_ASCII_61 = 54
  12339. const m_ASCII_71 = 55
  12340. const m_ASCII_82 = 56
  12341. const m_ASCII_92 = 57
  12342. const m_ASCII_AMP1 = 38
  12343. const m_ASCII_APOS1 = 39
  12344. const m_ASCII_COLON2 = 58
  12345. const m_ASCII_EQUALS2 = 61
  12346. const m_ASCII_EXCL2 = 33
  12347. const m_ASCII_G2 = 0x47
  12348. const m_ASCII_GT1 = 62
  12349. const m_ASCII_K1 = 0x4B
  12350. const m_ASCII_LSQB1 = 91
  12351. const m_ASCII_LT1 = 60
  12352. const m_ASCII_MINUS1 = 45
  12353. const m_ASCII_N1 = 0x4E
  12354. const m_ASCII_P2 = 0x50
  12355. const m_ASCII_PERIOD2 = 46
  12356. const m_ASCII_Q2 = 0x51
  12357. const m_ASCII_QUOT1 = 34
  12358. const m_ASCII_R1 = 0x52
  12359. const m_ASCII_RSQB1 = 93
  12360. const m_ASCII_SEMI1 = 59
  12361. const m_ASCII_SPACE1 = 32
  12362. const m_ASCII_TAB1 = 9
  12363. const m_ASCII_UNDERSCORE1 = 95
  12364. const m_ASCII_Y1 = 0x59
  12365. const m_ASCII_Z1 = 90
  12366. const m_ASCII_a2 = 97
  12367. const m_ASCII_b1 = 98
  12368. const m_ASCII_c2 = 99
  12369. const m_ASCII_d1 = 100
  12370. const m_ASCII_e2 = 101
  12371. const m_ASCII_f1 = 102
  12372. const m_ASCII_g2 = 103
  12373. const m_ASCII_i1 = 105
  12374. const m_ASCII_l2 = 108
  12375. const m_ASCII_m2 = 109
  12376. const m_ASCII_n2 = 110
  12377. const m_ASCII_o2 = 111
  12378. const m_ASCII_p2 = 112
  12379. const m_ASCII_q1 = 113
  12380. const m_ASCII_r2 = 114
  12381. const m_ASCII_s2 = 115
  12382. const m_ASCII_t2 = 116
  12383. const m_ASCII_u1 = 117
  12384. const m_ASCII_v1 = 118
  12385. const m_ASCII_x2 = 120
  12386. const m_ASCII_y1 = 121
  12387. const m_ASCII_z1 = 122
  12388. const m_ENCODING_MAX = 128
  12389. const m___bool_true_false_are_defined = 1
  12390. const m_bool = "_Bool"
  12391. const m_false = 0
  12392. const m_true = 1
  12393. const m_utf8_isName4 = "isNever"
  12394. const m_utf8_isNmstrt4 = "isNever"
  12395. var _namingBitmap = [320]uint32{
  12396. 8: uint32(0xFFFFFFFF),
  12397. 9: uint32(0xFFFFFFFF),
  12398. 10: uint32(0xFFFFFFFF),
  12399. 11: uint32(0xFFFFFFFF),
  12400. 12: uint32(0xFFFFFFFF),
  12401. 13: uint32(0xFFFFFFFF),
  12402. 14: uint32(0xFFFFFFFF),
  12403. 15: uint32(0xFFFFFFFF),
  12404. 17: uint32(0x04000000),
  12405. 18: uint32(0x87FFFFFE),
  12406. 19: uint32(0x07FFFFFE),
  12407. 22: uint32(0xFF7FFFFF),
  12408. 23: uint32(0xFF7FFFFF),
  12409. 24: uint32(0xFFFFFFFF),
  12410. 25: uint32(0x7FF3FFFF),
  12411. 26: uint32(0xFFFFFDFE),
  12412. 27: uint32(0x7FFFFFFF),
  12413. 28: uint32(0xFFFFFFFF),
  12414. 29: uint32(0xFFFFFFFF),
  12415. 30: uint32(0xFFFFE00F),
  12416. 31: uint32(0xFC31FFFF),
  12417. 32: uint32(0x00FFFFFF),
  12418. 34: uint32(0xFFFF0000),
  12419. 35: uint32(0xFFFFFFFF),
  12420. 36: uint32(0xFFFFFFFF),
  12421. 37: uint32(0xF80001FF),
  12422. 38: uint32(0x00000003),
  12423. 44: uint32(0xFFFFD740),
  12424. 45: uint32(0xFFFFFFFB),
  12425. 46: uint32(0x547F7FFF),
  12426. 47: uint32(0x000FFFFD),
  12427. 48: uint32(0xFFFFDFFE),
  12428. 49: uint32(0xFFFFFFFF),
  12429. 50: uint32(0xDFFEFFFF),
  12430. 51: uint32(0xFFFFFFFF),
  12431. 52: uint32(0xFFFF0003),
  12432. 53: uint32(0xFFFFFFFF),
  12433. 54: uint32(0xFFFF199F),
  12434. 55: uint32(0x033FCFFF),
  12435. 57: uint32(0xFFFE0000),
  12436. 58: uint32(0x027FFFFF),
  12437. 59: uint32(0xFFFFFFFE),
  12438. 60: uint32(0x0000007F),
  12439. 62: uint32(0xFFFF0000),
  12440. 63: uint32(0x000707FF),
  12441. 65: uint32(0x07FFFFFE),
  12442. 66: uint32(0x000007FE),
  12443. 67: uint32(0xFFFE0000),
  12444. 68: uint32(0xFFFFFFFF),
  12445. 69: uint32(0x7CFFFFFF),
  12446. 70: uint32(0x002F7FFF),
  12447. 71: uint32(0x00000060),
  12448. 72: uint32(0xFFFFFFE0),
  12449. 73: uint32(0x23FFFFFF),
  12450. 74: uint32(0xFF000000),
  12451. 75: uint32(0x00000003),
  12452. 76: uint32(0xFFF99FE0),
  12453. 77: uint32(0x03C5FDFF),
  12454. 78: uint32(0xB0000000),
  12455. 79: uint32(0x00030003),
  12456. 80: uint32(0xFFF987E0),
  12457. 81: uint32(0x036DFDFF),
  12458. 82: uint32(0x5E000000),
  12459. 83: uint32(0x001C0000),
  12460. 84: uint32(0xFFFBAFE0),
  12461. 85: uint32(0x23EDFDFF),
  12462. 87: uint32(0x00000001),
  12463. 88: uint32(0xFFF99FE0),
  12464. 89: uint32(0x23CDFDFF),
  12465. 90: uint32(0xB0000000),
  12466. 91: uint32(0x00000003),
  12467. 92: uint32(0xD63DC7E0),
  12468. 93: uint32(0x03BFC718),
  12469. 96: uint32(0xFFFDDFE0),
  12470. 97: uint32(0x03EFFDFF),
  12471. 99: uint32(0x00000003),
  12472. 100: uint32(0xFFFDDFE0),
  12473. 101: uint32(0x03EFFDFF),
  12474. 102: uint32(0x40000000),
  12475. 103: uint32(0x00000003),
  12476. 104: uint32(0xFFFDDFE0),
  12477. 105: uint32(0x03FFFDFF),
  12478. 107: uint32(0x00000003),
  12479. 112: uint32(0xFFFFFFFE),
  12480. 113: uint32(0x000D7FFF),
  12481. 114: uint32(0x0000003F),
  12482. 116: uint32(0xFEF02596),
  12483. 117: uint32(0x200D6CAE),
  12484. 118: uint32(0x0000001F),
  12485. 122: uint32(0xFFFFFEFF),
  12486. 123: uint32(0x000003FF),
  12487. 133: uint32(0xFFFFFFFF),
  12488. 134: uint32(0xFFFF003F),
  12489. 135: uint32(0x007FFFFF),
  12490. 136: uint32(0x0007DAED),
  12491. 137: uint32(0x50000000),
  12492. 138: uint32(0x82315001),
  12493. 139: uint32(0x002C62AB),
  12494. 140: uint32(0x40000000),
  12495. 141: uint32(0xF580C900),
  12496. 142: uint32(0x00000007),
  12497. 143: uint32(0x02010800),
  12498. 144: uint32(0xFFFFFFFF),
  12499. 145: uint32(0xFFFFFFFF),
  12500. 146: uint32(0xFFFFFFFF),
  12501. 147: uint32(0xFFFFFFFF),
  12502. 148: uint32(0x0FFFFFFF),
  12503. 149: uint32(0xFFFFFFFF),
  12504. 150: uint32(0xFFFFFFFF),
  12505. 151: uint32(0x03FFFFFF),
  12506. 152: uint32(0x3F3FFFFF),
  12507. 153: uint32(0xFFFFFFFF),
  12508. 154: uint32(0xAAFF3F3F),
  12509. 155: uint32(0x3FFFFFFF),
  12510. 156: uint32(0xFFFFFFFF),
  12511. 157: uint32(0x5FDFFFFF),
  12512. 158: uint32(0x0FCF1FDC),
  12513. 159: uint32(0x1FDC1FFF),
  12514. 161: uint32(0x00004C40),
  12515. 164: uint32(0x00000007),
  12516. 168: uint32(0x00000080),
  12517. 169: uint32(0x000003FE),
  12518. 170: uint32(0xFFFFFFFE),
  12519. 171: uint32(0xFFFFFFFF),
  12520. 172: uint32(0x001FFFFF),
  12521. 173: uint32(0xFFFFFFFE),
  12522. 174: uint32(0xFFFFFFFF),
  12523. 175: uint32(0x07FFFFFF),
  12524. 176: uint32(0xFFFFFFE0),
  12525. 177: uint32(0x00001FFF),
  12526. 184: uint32(0xFFFFFFFF),
  12527. 185: uint32(0xFFFFFFFF),
  12528. 186: uint32(0xFFFFFFFF),
  12529. 187: uint32(0xFFFFFFFF),
  12530. 188: uint32(0xFFFFFFFF),
  12531. 189: uint32(0x0000003F),
  12532. 192: uint32(0xFFFFFFFF),
  12533. 193: uint32(0xFFFFFFFF),
  12534. 194: uint32(0xFFFFFFFF),
  12535. 195: uint32(0xFFFFFFFF),
  12536. 196: uint32(0xFFFFFFFF),
  12537. 197: uint32(0x0000000F),
  12538. 201: uint32(0x07FF6000),
  12539. 202: uint32(0x87FFFFFE),
  12540. 203: uint32(0x07FFFFFE),
  12541. 205: uint32(0x00800000),
  12542. 206: uint32(0xFF7FFFFF),
  12543. 207: uint32(0xFF7FFFFF),
  12544. 208: uint32(0x00FFFFFF),
  12545. 210: uint32(0xFFFF0000),
  12546. 211: uint32(0xFFFFFFFF),
  12547. 212: uint32(0xFFFFFFFF),
  12548. 213: uint32(0xF80001FF),
  12549. 214: uint32(0x00030003),
  12550. 216: uint32(0xFFFFFFFF),
  12551. 217: uint32(0xFFFFFFFF),
  12552. 218: uint32(0x0000003F),
  12553. 219: uint32(0x00000003),
  12554. 220: uint32(0xFFFFD7C0),
  12555. 221: uint32(0xFFFFFFFB),
  12556. 222: uint32(0x547F7FFF),
  12557. 223: uint32(0x000FFFFD),
  12558. 224: uint32(0xFFFFDFFE),
  12559. 225: uint32(0xFFFFFFFF),
  12560. 226: uint32(0xDFFEFFFF),
  12561. 227: uint32(0xFFFFFFFF),
  12562. 228: uint32(0xFFFF007B),
  12563. 229: uint32(0xFFFFFFFF),
  12564. 230: uint32(0xFFFF199F),
  12565. 231: uint32(0x033FCFFF),
  12566. 233: uint32(0xFFFE0000),
  12567. 234: uint32(0x027FFFFF),
  12568. 235: uint32(0xFFFFFFFE),
  12569. 236: uint32(0xFFFE007F),
  12570. 237: uint32(0xBBFFFFFB),
  12571. 238: uint32(0xFFFF0016),
  12572. 239: uint32(0x000707FF),
  12573. 241: uint32(0x07FFFFFE),
  12574. 242: uint32(0x0007FFFF),
  12575. 243: uint32(0xFFFF03FF),
  12576. 244: uint32(0xFFFFFFFF),
  12577. 245: uint32(0x7CFFFFFF),
  12578. 246: uint32(0xFFEF7FFF),
  12579. 247: uint32(0x03FF3DFF),
  12580. 248: uint32(0xFFFFFFEE),
  12581. 249: uint32(0xF3FFFFFF),
  12582. 250: uint32(0xFF1E3FFF),
  12583. 251: uint32(0x0000FFCF),
  12584. 252: uint32(0xFFF99FEE),
  12585. 253: uint32(0xD3C5FDFF),
  12586. 254: uint32(0xB080399F),
  12587. 255: uint32(0x0003FFCF),
  12588. 256: uint32(0xFFF987E4),
  12589. 257: uint32(0xD36DFDFF),
  12590. 258: uint32(0x5E003987),
  12591. 259: uint32(0x001FFFC0),
  12592. 260: uint32(0xFFFBAFEE),
  12593. 261: uint32(0xF3EDFDFF),
  12594. 262: uint32(0x00003BBF),
  12595. 263: uint32(0x0000FFC1),
  12596. 264: uint32(0xFFF99FEE),
  12597. 265: uint32(0xF3CDFDFF),
  12598. 266: uint32(0xB0C0398F),
  12599. 267: uint32(0x0000FFC3),
  12600. 268: uint32(0xD63DC7EC),
  12601. 269: uint32(0xC3BFC718),
  12602. 270: uint32(0x00803DC7),
  12603. 271: uint32(0x0000FF80),
  12604. 272: uint32(0xFFFDDFEE),
  12605. 273: uint32(0xC3EFFDFF),
  12606. 274: uint32(0x00603DDF),
  12607. 275: uint32(0x0000FFC3),
  12608. 276: uint32(0xFFFDDFEC),
  12609. 277: uint32(0xC3EFFDFF),
  12610. 278: uint32(0x40603DDF),
  12611. 279: uint32(0x0000FFC3),
  12612. 280: uint32(0xFFFDDFEC),
  12613. 281: uint32(0xC3FFFDFF),
  12614. 282: uint32(0x00803DCF),
  12615. 283: uint32(0x0000FFC3),
  12616. 288: uint32(0xFFFFFFFE),
  12617. 289: uint32(0x07FF7FFF),
  12618. 290: uint32(0x03FF7FFF),
  12619. 292: uint32(0xFEF02596),
  12620. 293: uint32(0x3BFF6CAE),
  12621. 294: uint32(0x03FF3F5F),
  12622. 296: uint32(0x03000000),
  12623. 297: uint32(0xC2A003FF),
  12624. 298: uint32(0xFFFFFEFF),
  12625. 299: uint32(0xFFFE03FF),
  12626. 300: uint32(0xFEBF0FDF),
  12627. 301: uint32(0x02FE3FFF),
  12628. 310: uint32(0x1FFF0000),
  12629. 311: uint32(0x00000002),
  12630. 312: uint32(0x000000A0),
  12631. 313: uint32(0x003EFFFE),
  12632. 314: uint32(0xFFFFFFFE),
  12633. 315: uint32(0xFFFFFFFF),
  12634. 316: uint32(0x661FFFFF),
  12635. 317: uint32(0xFFFFFFFE),
  12636. 318: uint32(0xFFFFFFFF),
  12637. 319: uint32(0x77FFFFFF),
  12638. }
  12639. var _nmstrtPages = [256]uint8{
  12640. 0: uint8(0x02),
  12641. 1: uint8(0x03),
  12642. 2: uint8(0x04),
  12643. 3: uint8(0x05),
  12644. 4: uint8(0x06),
  12645. 5: uint8(0x07),
  12646. 6: uint8(0x08),
  12647. 9: uint8(0x09),
  12648. 10: uint8(0x0A),
  12649. 11: uint8(0x0B),
  12650. 12: uint8(0x0C),
  12651. 13: uint8(0x0D),
  12652. 14: uint8(0x0E),
  12653. 15: uint8(0x0F),
  12654. 16: uint8(0x10),
  12655. 17: uint8(0x11),
  12656. 30: uint8(0x12),
  12657. 31: uint8(0x13),
  12658. 33: uint8(0x14),
  12659. 48: uint8(0x15),
  12660. 49: uint8(0x16),
  12661. 78: uint8(0x01),
  12662. 79: uint8(0x01),
  12663. 80: uint8(0x01),
  12664. 81: uint8(0x01),
  12665. 82: uint8(0x01),
  12666. 83: uint8(0x01),
  12667. 84: uint8(0x01),
  12668. 85: uint8(0x01),
  12669. 86: uint8(0x01),
  12670. 87: uint8(0x01),
  12671. 88: uint8(0x01),
  12672. 89: uint8(0x01),
  12673. 90: uint8(0x01),
  12674. 91: uint8(0x01),
  12675. 92: uint8(0x01),
  12676. 93: uint8(0x01),
  12677. 94: uint8(0x01),
  12678. 95: uint8(0x01),
  12679. 96: uint8(0x01),
  12680. 97: uint8(0x01),
  12681. 98: uint8(0x01),
  12682. 99: uint8(0x01),
  12683. 100: uint8(0x01),
  12684. 101: uint8(0x01),
  12685. 102: uint8(0x01),
  12686. 103: uint8(0x01),
  12687. 104: uint8(0x01),
  12688. 105: uint8(0x01),
  12689. 106: uint8(0x01),
  12690. 107: uint8(0x01),
  12691. 108: uint8(0x01),
  12692. 109: uint8(0x01),
  12693. 110: uint8(0x01),
  12694. 111: uint8(0x01),
  12695. 112: uint8(0x01),
  12696. 113: uint8(0x01),
  12697. 114: uint8(0x01),
  12698. 115: uint8(0x01),
  12699. 116: uint8(0x01),
  12700. 117: uint8(0x01),
  12701. 118: uint8(0x01),
  12702. 119: uint8(0x01),
  12703. 120: uint8(0x01),
  12704. 121: uint8(0x01),
  12705. 122: uint8(0x01),
  12706. 123: uint8(0x01),
  12707. 124: uint8(0x01),
  12708. 125: uint8(0x01),
  12709. 126: uint8(0x01),
  12710. 127: uint8(0x01),
  12711. 128: uint8(0x01),
  12712. 129: uint8(0x01),
  12713. 130: uint8(0x01),
  12714. 131: uint8(0x01),
  12715. 132: uint8(0x01),
  12716. 133: uint8(0x01),
  12717. 134: uint8(0x01),
  12718. 135: uint8(0x01),
  12719. 136: uint8(0x01),
  12720. 137: uint8(0x01),
  12721. 138: uint8(0x01),
  12722. 139: uint8(0x01),
  12723. 140: uint8(0x01),
  12724. 141: uint8(0x01),
  12725. 142: uint8(0x01),
  12726. 143: uint8(0x01),
  12727. 144: uint8(0x01),
  12728. 145: uint8(0x01),
  12729. 146: uint8(0x01),
  12730. 147: uint8(0x01),
  12731. 148: uint8(0x01),
  12732. 149: uint8(0x01),
  12733. 150: uint8(0x01),
  12734. 151: uint8(0x01),
  12735. 152: uint8(0x01),
  12736. 153: uint8(0x01),
  12737. 154: uint8(0x01),
  12738. 155: uint8(0x01),
  12739. 156: uint8(0x01),
  12740. 157: uint8(0x01),
  12741. 158: uint8(0x01),
  12742. 159: uint8(0x17),
  12743. 172: uint8(0x01),
  12744. 173: uint8(0x01),
  12745. 174: uint8(0x01),
  12746. 175: uint8(0x01),
  12747. 176: uint8(0x01),
  12748. 177: uint8(0x01),
  12749. 178: uint8(0x01),
  12750. 179: uint8(0x01),
  12751. 180: uint8(0x01),
  12752. 181: uint8(0x01),
  12753. 182: uint8(0x01),
  12754. 183: uint8(0x01),
  12755. 184: uint8(0x01),
  12756. 185: uint8(0x01),
  12757. 186: uint8(0x01),
  12758. 187: uint8(0x01),
  12759. 188: uint8(0x01),
  12760. 189: uint8(0x01),
  12761. 190: uint8(0x01),
  12762. 191: uint8(0x01),
  12763. 192: uint8(0x01),
  12764. 193: uint8(0x01),
  12765. 194: uint8(0x01),
  12766. 195: uint8(0x01),
  12767. 196: uint8(0x01),
  12768. 197: uint8(0x01),
  12769. 198: uint8(0x01),
  12770. 199: uint8(0x01),
  12771. 200: uint8(0x01),
  12772. 201: uint8(0x01),
  12773. 202: uint8(0x01),
  12774. 203: uint8(0x01),
  12775. 204: uint8(0x01),
  12776. 205: uint8(0x01),
  12777. 206: uint8(0x01),
  12778. 207: uint8(0x01),
  12779. 208: uint8(0x01),
  12780. 209: uint8(0x01),
  12781. 210: uint8(0x01),
  12782. 211: uint8(0x01),
  12783. 212: uint8(0x01),
  12784. 213: uint8(0x01),
  12785. 214: uint8(0x01),
  12786. 215: uint8(0x18),
  12787. }
  12788. var _namePages = [256]uint8{
  12789. 0: uint8(0x19),
  12790. 1: uint8(0x03),
  12791. 2: uint8(0x1A),
  12792. 3: uint8(0x1B),
  12793. 4: uint8(0x1C),
  12794. 5: uint8(0x1D),
  12795. 6: uint8(0x1E),
  12796. 9: uint8(0x1F),
  12797. 10: uint8(0x20),
  12798. 11: uint8(0x21),
  12799. 12: uint8(0x22),
  12800. 13: uint8(0x23),
  12801. 14: uint8(0x24),
  12802. 15: uint8(0x25),
  12803. 16: uint8(0x10),
  12804. 17: uint8(0x11),
  12805. 30: uint8(0x12),
  12806. 31: uint8(0x13),
  12807. 32: uint8(0x26),
  12808. 33: uint8(0x14),
  12809. 48: uint8(0x27),
  12810. 49: uint8(0x16),
  12811. 78: uint8(0x01),
  12812. 79: uint8(0x01),
  12813. 80: uint8(0x01),
  12814. 81: uint8(0x01),
  12815. 82: uint8(0x01),
  12816. 83: uint8(0x01),
  12817. 84: uint8(0x01),
  12818. 85: uint8(0x01),
  12819. 86: uint8(0x01),
  12820. 87: uint8(0x01),
  12821. 88: uint8(0x01),
  12822. 89: uint8(0x01),
  12823. 90: uint8(0x01),
  12824. 91: uint8(0x01),
  12825. 92: uint8(0x01),
  12826. 93: uint8(0x01),
  12827. 94: uint8(0x01),
  12828. 95: uint8(0x01),
  12829. 96: uint8(0x01),
  12830. 97: uint8(0x01),
  12831. 98: uint8(0x01),
  12832. 99: uint8(0x01),
  12833. 100: uint8(0x01),
  12834. 101: uint8(0x01),
  12835. 102: uint8(0x01),
  12836. 103: uint8(0x01),
  12837. 104: uint8(0x01),
  12838. 105: uint8(0x01),
  12839. 106: uint8(0x01),
  12840. 107: uint8(0x01),
  12841. 108: uint8(0x01),
  12842. 109: uint8(0x01),
  12843. 110: uint8(0x01),
  12844. 111: uint8(0x01),
  12845. 112: uint8(0x01),
  12846. 113: uint8(0x01),
  12847. 114: uint8(0x01),
  12848. 115: uint8(0x01),
  12849. 116: uint8(0x01),
  12850. 117: uint8(0x01),
  12851. 118: uint8(0x01),
  12852. 119: uint8(0x01),
  12853. 120: uint8(0x01),
  12854. 121: uint8(0x01),
  12855. 122: uint8(0x01),
  12856. 123: uint8(0x01),
  12857. 124: uint8(0x01),
  12858. 125: uint8(0x01),
  12859. 126: uint8(0x01),
  12860. 127: uint8(0x01),
  12861. 128: uint8(0x01),
  12862. 129: uint8(0x01),
  12863. 130: uint8(0x01),
  12864. 131: uint8(0x01),
  12865. 132: uint8(0x01),
  12866. 133: uint8(0x01),
  12867. 134: uint8(0x01),
  12868. 135: uint8(0x01),
  12869. 136: uint8(0x01),
  12870. 137: uint8(0x01),
  12871. 138: uint8(0x01),
  12872. 139: uint8(0x01),
  12873. 140: uint8(0x01),
  12874. 141: uint8(0x01),
  12875. 142: uint8(0x01),
  12876. 143: uint8(0x01),
  12877. 144: uint8(0x01),
  12878. 145: uint8(0x01),
  12879. 146: uint8(0x01),
  12880. 147: uint8(0x01),
  12881. 148: uint8(0x01),
  12882. 149: uint8(0x01),
  12883. 150: uint8(0x01),
  12884. 151: uint8(0x01),
  12885. 152: uint8(0x01),
  12886. 153: uint8(0x01),
  12887. 154: uint8(0x01),
  12888. 155: uint8(0x01),
  12889. 156: uint8(0x01),
  12890. 157: uint8(0x01),
  12891. 158: uint8(0x01),
  12892. 159: uint8(0x17),
  12893. 172: uint8(0x01),
  12894. 173: uint8(0x01),
  12895. 174: uint8(0x01),
  12896. 175: uint8(0x01),
  12897. 176: uint8(0x01),
  12898. 177: uint8(0x01),
  12899. 178: uint8(0x01),
  12900. 179: uint8(0x01),
  12901. 180: uint8(0x01),
  12902. 181: uint8(0x01),
  12903. 182: uint8(0x01),
  12904. 183: uint8(0x01),
  12905. 184: uint8(0x01),
  12906. 185: uint8(0x01),
  12907. 186: uint8(0x01),
  12908. 187: uint8(0x01),
  12909. 188: uint8(0x01),
  12910. 189: uint8(0x01),
  12911. 190: uint8(0x01),
  12912. 191: uint8(0x01),
  12913. 192: uint8(0x01),
  12914. 193: uint8(0x01),
  12915. 194: uint8(0x01),
  12916. 195: uint8(0x01),
  12917. 196: uint8(0x01),
  12918. 197: uint8(0x01),
  12919. 198: uint8(0x01),
  12920. 199: uint8(0x01),
  12921. 200: uint8(0x01),
  12922. 201: uint8(0x01),
  12923. 202: uint8(0x01),
  12924. 203: uint8(0x01),
  12925. 204: uint8(0x01),
  12926. 205: uint8(0x01),
  12927. 206: uint8(0x01),
  12928. 207: uint8(0x01),
  12929. 208: uint8(0x01),
  12930. 209: uint8(0x01),
  12931. 210: uint8(0x01),
  12932. 211: uint8(0x01),
  12933. 212: uint8(0x01),
  12934. 213: uint8(0x01),
  12935. 214: uint8(0x01),
  12936. 215: uint8(0x18),
  12937. }
  12938. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  12939. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  12940. pages, 3 bits to add to that index and 5 bits to generate the mask.
  12941. */
  12942. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  12943. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  12944. into pages, 3 bits to add to that index and 5 bits to generate the
  12945. mask.
  12946. */
  12947. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  12948. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  12949. with the additional restriction of not allowing the Unicode
  12950. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  12951. Implementation details:
  12952. (A & 0x80) == 0 means A < 0x80
  12953. and
  12954. (A & 0xC0) == 0xC0 means A > 0xBF
  12955. */
  12956. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12957. _ = enc
  12958. _ = p
  12959. return 0
  12960. }
  12961. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12962. _ = enc
  12963. 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))))
  12964. }
  12965. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12966. _ = enc
  12967. 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))))
  12968. }
  12969. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12970. _ = enc
  12971. 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))))
  12972. }
  12973. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12974. _ = enc
  12975. 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))))
  12976. }
  12977. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12978. _ = enc
  12979. 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))
  12980. }
  12981. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  12982. var v1, v3, v4 int32
  12983. var v2, v5, v6 bool
  12984. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  12985. _ = enc
  12986. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  12987. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  12988. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  12989. } else {
  12990. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  12991. }
  12992. }
  12993. if v6 = v2 || v1 != 0; !v6 {
  12994. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  12995. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  12996. } else {
  12997. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  12998. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  12999. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  13000. } else {
  13001. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13002. }
  13003. }
  13004. v3 = libc.BoolInt32(v5 || v4 != 0)
  13005. }
  13006. }
  13007. return libc.BoolInt32(v6 || v3 != 0)
  13008. }
  13009. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  13010. var v1, v2 int32
  13011. var v3, v4 bool
  13012. _, _, _, _ = v1, v2, v3, v4
  13013. _ = enc
  13014. 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 {
  13015. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  13016. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13017. } else {
  13018. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  13019. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  13020. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  13021. } else {
  13022. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  13023. }
  13024. }
  13025. v1 = libc.BoolInt32(v3 || v2 != 0)
  13026. }
  13027. }
  13028. return libc.BoolInt32(v4 || v1 != 0)
  13029. }
  13030. type Tnormal_encoding = struct {
  13031. Fenc TENCODING
  13032. Ftype1 [256]uint8
  13033. FisName2 uintptr
  13034. FisName3 uintptr
  13035. FisName4 uintptr
  13036. FisNmstrt2 uintptr
  13037. FisNmstrt3 uintptr
  13038. FisNmstrt4 uintptr
  13039. FisInvalid2 uintptr
  13040. FisInvalid3 uintptr
  13041. FisInvalid4 uintptr
  13042. }
  13043. const _BT_NONXML = 0
  13044. const _BT_MALFORM = 1
  13045. const _BT_LT = 2
  13046. const _BT_AMP = 3
  13047. const _BT_RSQB = 4
  13048. const _BT_LEAD2 = 5
  13049. const _BT_LEAD3 = 6
  13050. const _BT_LEAD4 = 7
  13051. const _BT_TRAIL = 8
  13052. const _BT_CR = 9
  13053. const _BT_LF = 10
  13054. const _BT_GT = 11
  13055. const _BT_QUOT = 12
  13056. const _BT_APOS = 13
  13057. const _BT_EQUALS = 14
  13058. const _BT_QUEST = 15
  13059. const _BT_EXCL = 16
  13060. const _BT_SOL = 17
  13061. const _BT_SEMI = 18
  13062. const _BT_NUM = 19
  13063. const _BT_LSQB = 20
  13064. const _BT_S = 21
  13065. const _BT_NMSTRT = 22
  13066. const _BT_COLON = 23
  13067. const _BT_HEX = 24
  13068. const _BT_DIGIT = 25
  13069. const _BT_NAME = 26
  13070. const _BT_MINUS = 27
  13071. const _BT_OTHER = 28
  13072. const _BT_NONASCII = 29
  13073. const _BT_PERCNT = 30
  13074. const _BT_LPAR = 31
  13075. const _BT_RPAR = 32
  13076. const _BT_AST = 33
  13077. const _BT_PLUS = 34
  13078. const _BT_COMMA = 35
  13079. const _BT_VERBAR = 36
  13080. /*
  13081. __ __ _
  13082. ___\ \/ /_ __ __ _| |_
  13083. / _ \\ /| '_ \ / _` | __|
  13084. | __// \| |_) | (_| | |_
  13085. \___/_/\_\ .__/ \__,_|\__|
  13086. |_| XML parser
  13087. Copyright (c) 1999-2000 Thai Open Source Software Center Ltd
  13088. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13089. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13090. Copyright (c) 2007 Karl Waclawek <karl@waclawek.net>
  13091. Copyright (c) 2017 Sebastian Pipping <sebastian@pipping.org>
  13092. Licensed under the MIT license:
  13093. Permission is hereby granted, free of charge, to any person obtaining
  13094. a copy of this software and associated documentation files (the
  13095. "Software"), to deal in the Software without restriction, including
  13096. without limitation the rights to use, copy, modify, merge, publish,
  13097. distribute, sublicense, and/or sell copies of the Software, and to permit
  13098. persons to whom the Software is furnished to do so, subject to the
  13099. following conditions:
  13100. The above copyright notice and this permission notice shall be included
  13101. in all copies or substantial portions of the Software.
  13102. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13103. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13104. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13105. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13106. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13107. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13108. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13109. */
  13110. /* minimum bytes per character */
  13111. /* c is an ASCII character */
  13112. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  13113. __ __ _
  13114. ___\ \/ /_ __ __ _| |_
  13115. / _ \\ /| '_ \ / _` | __|
  13116. | __// \| |_) | (_| | |_
  13117. \___/_/\_\ .__/ \__,_|\__|
  13118. |_| XML parser
  13119. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  13120. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  13121. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  13122. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  13123. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  13124. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  13125. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  13126. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  13127. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  13128. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  13129. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  13130. Licensed under the MIT license:
  13131. Permission is hereby granted, free of charge, to any person obtaining
  13132. a copy of this software and associated documentation files (the
  13133. "Software"), to deal in the Software without restriction, including
  13134. without limitation the rights to use, copy, modify, merge, publish,
  13135. distribute, sublicense, and/or sell copies of the Software, and to permit
  13136. persons to whom the Software is furnished to do so, subject to the
  13137. following conditions:
  13138. The above copyright notice and this permission notice shall be included
  13139. in all copies or substantial portions of the Software.
  13140. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13141. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13142. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13143. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13144. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13145. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13146. USE OR OTHER DEALINGS IN THE SOFTWARE.
  13147. */
  13148. /* ptr points to character following "<!-" */
  13149. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13150. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13151. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  13152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13153. return m_XML_TOK_INVALID
  13154. }
  13155. ptr += uintptr(1)
  13156. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13157. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13158. case int32(_BT_LEAD2):
  13159. if int32(end)-int32(ptr) < int32(2) {
  13160. return -int32(2)
  13161. }
  13162. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13164. return m_XML_TOK_INVALID
  13165. }
  13166. ptr += uintptr(2)
  13167. case int32(_BT_LEAD3):
  13168. if int32(end)-int32(ptr) < int32(3) {
  13169. return -int32(2)
  13170. }
  13171. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13172. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13173. return m_XML_TOK_INVALID
  13174. }
  13175. ptr += uintptr(3)
  13176. case int32(_BT_LEAD4):
  13177. if int32(end)-int32(ptr) < int32(4) {
  13178. return -int32(2)
  13179. }
  13180. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13182. return m_XML_TOK_INVALID
  13183. }
  13184. ptr += uintptr(4)
  13185. case int32(_BT_NONXML):
  13186. fallthrough
  13187. case int32(_BT_MALFORM):
  13188. fallthrough
  13189. case int32(_BT_TRAIL):
  13190. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13191. return m_XML_TOK_INVALID
  13192. case int32(_BT_MINUS):
  13193. ptr += uintptr(1)
  13194. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13195. return -int32(1)
  13196. }
  13197. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  13198. ptr += uintptr(1)
  13199. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13200. return -int32(1)
  13201. }
  13202. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13203. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13204. return m_XML_TOK_INVALID
  13205. }
  13206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13207. return int32(m_XML_TOK_COMMENT)
  13208. }
  13209. default:
  13210. ptr += uintptr(1)
  13211. break
  13212. }
  13213. }
  13214. }
  13215. return -int32(1)
  13216. }
  13217. /* ptr points to character following "<!" */
  13218. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13219. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13220. return -int32(1)
  13221. }
  13222. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13223. case int32(_BT_MINUS):
  13224. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13225. case int32(_BT_LSQB):
  13226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13227. return int32(m_XML_TOK_COND_SECT_OPEN)
  13228. case int32(_BT_NMSTRT):
  13229. fallthrough
  13230. case int32(_BT_HEX):
  13231. ptr += uintptr(1)
  13232. default:
  13233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13234. return m_XML_TOK_INVALID
  13235. }
  13236. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13237. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13238. case int32(_BT_PERCNT):
  13239. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  13240. return -int32(1)
  13241. }
  13242. /* don't allow <!ENTITY% foo "whatever"> */
  13243. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) {
  13244. case int32(_BT_S):
  13245. fallthrough
  13246. case int32(_BT_CR):
  13247. fallthrough
  13248. case int32(_BT_LF):
  13249. fallthrough
  13250. case int32(_BT_PERCNT):
  13251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13252. return m_XML_TOK_INVALID
  13253. }
  13254. /* fall through */
  13255. fallthrough
  13256. case int32(_BT_S):
  13257. fallthrough
  13258. case int32(_BT_CR):
  13259. fallthrough
  13260. case int32(_BT_LF):
  13261. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13262. return int32(m_XML_TOK_DECL_OPEN)
  13263. case int32(_BT_NMSTRT):
  13264. fallthrough
  13265. case int32(_BT_HEX):
  13266. ptr += uintptr(1)
  13267. default:
  13268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13269. return m_XML_TOK_INVALID
  13270. }
  13271. }
  13272. return -int32(1)
  13273. }
  13274. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  13275. var upper int32
  13276. _ = upper
  13277. upper = 0
  13278. _ = enc
  13279. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  13280. if int32(end)-int32(ptr) != libc.Int32FromInt32(1)*libc.Int32FromInt32(3) {
  13281. return int32(1)
  13282. }
  13283. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13284. case int32(m_ASCII_x2):
  13285. case int32(m_ASCII_X):
  13286. upper = int32(1)
  13287. default:
  13288. return int32(1)
  13289. }
  13290. ptr += uintptr(1)
  13291. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13292. case int32(m_ASCII_m2):
  13293. case int32(m_ASCII_M):
  13294. upper = int32(1)
  13295. default:
  13296. return int32(1)
  13297. }
  13298. ptr += uintptr(1)
  13299. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  13300. case int32(m_ASCII_l2):
  13301. case int32(m_ASCII_L):
  13302. upper = int32(1)
  13303. default:
  13304. return int32(1)
  13305. }
  13306. if upper != 0 {
  13307. return 0
  13308. }
  13309. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  13310. return int32(1)
  13311. }
  13312. /* ptr points to character following "<?" */
  13313. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13314. bp := tls.Alloc(16)
  13315. defer tls.Free(16)
  13316. var target uintptr
  13317. var _ /* tok at bp+0 */ int32
  13318. _ = target
  13319. target = ptr
  13320. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13321. return -int32(1)
  13322. }
  13323. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13324. case int32(_BT_NONASCII):
  13325. if !(libc.Int32FromInt32(0) != 0) {
  13326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13327. return m_XML_TOK_INVALID
  13328. } /* fall through */
  13329. fallthrough
  13330. case int32(_BT_NMSTRT):
  13331. fallthrough
  13332. case int32(_BT_HEX):
  13333. ptr += uintptr(1)
  13334. case int32(_BT_LEAD2):
  13335. if int32(end)-int32(ptr) < int32(2) {
  13336. return -int32(2)
  13337. }
  13338. 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) {
  13339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13340. return m_XML_TOK_INVALID
  13341. }
  13342. ptr += uintptr(2)
  13343. case int32(_BT_LEAD3):
  13344. if int32(end)-int32(ptr) < int32(3) {
  13345. return -int32(2)
  13346. }
  13347. 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) {
  13348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13349. return m_XML_TOK_INVALID
  13350. }
  13351. ptr += uintptr(3)
  13352. case int32(_BT_LEAD4):
  13353. if int32(end)-int32(ptr) < int32(4) {
  13354. return -int32(2)
  13355. }
  13356. 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) {
  13357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13358. return m_XML_TOK_INVALID
  13359. }
  13360. ptr += uintptr(4)
  13361. default:
  13362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13363. return m_XML_TOK_INVALID
  13364. }
  13365. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13366. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13367. case int32(_BT_NONASCII):
  13368. if !(libc.Int32FromInt32(0) != 0) {
  13369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13370. return m_XML_TOK_INVALID
  13371. } /* fall through */
  13372. fallthrough
  13373. case int32(_BT_NMSTRT):
  13374. fallthrough
  13375. case int32(_BT_HEX):
  13376. fallthrough
  13377. case int32(_BT_DIGIT):
  13378. fallthrough
  13379. case int32(_BT_NAME):
  13380. fallthrough
  13381. case int32(_BT_MINUS):
  13382. ptr += uintptr(1)
  13383. case int32(_BT_LEAD2):
  13384. if int32(end)-int32(ptr) < int32(2) {
  13385. return -int32(2)
  13386. }
  13387. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13388. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13389. return m_XML_TOK_INVALID
  13390. }
  13391. ptr += uintptr(2)
  13392. case int32(_BT_LEAD3):
  13393. if int32(end)-int32(ptr) < int32(3) {
  13394. return -int32(2)
  13395. }
  13396. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13397. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13398. return m_XML_TOK_INVALID
  13399. }
  13400. ptr += uintptr(3)
  13401. case int32(_BT_LEAD4):
  13402. if int32(end)-int32(ptr) < int32(4) {
  13403. return -int32(2)
  13404. }
  13405. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 || !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  13406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13407. return m_XML_TOK_INVALID
  13408. }
  13409. ptr += uintptr(4)
  13410. case int32(_BT_S):
  13411. fallthrough
  13412. case int32(_BT_CR):
  13413. fallthrough
  13414. case int32(_BT_LF):
  13415. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13416. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13417. return m_XML_TOK_INVALID
  13418. }
  13419. ptr += uintptr(1)
  13420. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13421. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13422. case int32(_BT_LEAD2):
  13423. if int32(end)-int32(ptr) < int32(2) {
  13424. return -int32(2)
  13425. }
  13426. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13428. return m_XML_TOK_INVALID
  13429. }
  13430. ptr += uintptr(2)
  13431. case int32(_BT_LEAD3):
  13432. if int32(end)-int32(ptr) < int32(3) {
  13433. return -int32(2)
  13434. }
  13435. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13437. return m_XML_TOK_INVALID
  13438. }
  13439. ptr += uintptr(3)
  13440. case int32(_BT_LEAD4):
  13441. if int32(end)-int32(ptr) < int32(4) {
  13442. return -int32(2)
  13443. }
  13444. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13445. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13446. return m_XML_TOK_INVALID
  13447. }
  13448. ptr += uintptr(4)
  13449. case int32(_BT_NONXML):
  13450. fallthrough
  13451. case int32(_BT_MALFORM):
  13452. fallthrough
  13453. case int32(_BT_TRAIL):
  13454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13455. return m_XML_TOK_INVALID
  13456. case int32(_BT_QUEST):
  13457. ptr += uintptr(1)
  13458. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13459. return -int32(1)
  13460. }
  13461. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13463. return *(*int32)(unsafe.Pointer(bp))
  13464. }
  13465. default:
  13466. ptr += uintptr(1)
  13467. break
  13468. }
  13469. }
  13470. return -int32(1)
  13471. case int32(_BT_QUEST):
  13472. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  13473. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13474. return m_XML_TOK_INVALID
  13475. }
  13476. ptr += uintptr(1)
  13477. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13478. return -int32(1)
  13479. }
  13480. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13481. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13482. return *(*int32)(unsafe.Pointer(bp))
  13483. }
  13484. /* fall through */
  13485. fallthrough
  13486. default:
  13487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13488. return m_XML_TOK_INVALID
  13489. }
  13490. }
  13491. return -int32(1)
  13492. }
  13493. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13494. var i int32
  13495. _ = i
  13496. _ = enc
  13497. /* CDATA[ */
  13498. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(6)*libc.Int32FromInt32(1)) {
  13499. return -int32(1)
  13500. }
  13501. i = 0
  13502. for {
  13503. if !(i < int32(6)) {
  13504. break
  13505. }
  13506. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB[i])) {
  13507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13508. return m_XML_TOK_INVALID
  13509. }
  13510. goto _1
  13511. _1:
  13512. ;
  13513. i++
  13514. ptr += uintptr(1)
  13515. }
  13516. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13517. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  13518. }
  13519. var _CDATA_LSQB = [6]int8{
  13520. 0: int8(m_ASCII_C),
  13521. 1: int8(m_ASCII_D),
  13522. 2: int8(m_ASCII_A),
  13523. 3: int8(m_ASCII_T),
  13524. 4: int8(m_ASCII_A),
  13525. 5: int8(m_ASCII_LSQB1),
  13526. }
  13527. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13528. var n Tsize_t
  13529. _ = n
  13530. if ptr >= end {
  13531. return -int32(4)
  13532. }
  13533. if int32(1) > int32(1) {
  13534. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  13535. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13536. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13537. if n == uint32(0) {
  13538. return -int32(1)
  13539. }
  13540. end = ptr + uintptr(n)
  13541. }
  13542. }
  13543. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13544. case int32(_BT_RSQB):
  13545. ptr += uintptr(1)
  13546. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13547. return -int32(1)
  13548. }
  13549. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  13550. break
  13551. }
  13552. ptr += uintptr(1)
  13553. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13554. return -int32(1)
  13555. }
  13556. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  13557. ptr -= uintptr(1)
  13558. break
  13559. }
  13560. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13561. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  13562. case int32(_BT_CR):
  13563. ptr += uintptr(1)
  13564. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13565. return -int32(1)
  13566. }
  13567. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  13568. ptr += uintptr(1)
  13569. }
  13570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13571. return int32(m_XML_TOK_DATA_NEWLINE)
  13572. case int32(_BT_LF):
  13573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13574. return int32(m_XML_TOK_DATA_NEWLINE)
  13575. case int32(_BT_LEAD2):
  13576. if int32(end)-int32(ptr) < int32(2) {
  13577. return -int32(2)
  13578. }
  13579. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13581. return m_XML_TOK_INVALID
  13582. }
  13583. ptr += uintptr(2)
  13584. case int32(_BT_LEAD3):
  13585. if int32(end)-int32(ptr) < int32(3) {
  13586. return -int32(2)
  13587. }
  13588. if (*(*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 m_XML_TOK_INVALID
  13591. }
  13592. ptr += uintptr(3)
  13593. case int32(_BT_LEAD4):
  13594. if int32(end)-int32(ptr) < int32(4) {
  13595. return -int32(2)
  13596. }
  13597. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13598. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13599. return m_XML_TOK_INVALID
  13600. }
  13601. ptr += uintptr(4)
  13602. case int32(_BT_NONXML):
  13603. fallthrough
  13604. case int32(_BT_MALFORM):
  13605. fallthrough
  13606. case int32(_BT_TRAIL):
  13607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13608. return m_XML_TOK_INVALID
  13609. default:
  13610. ptr += uintptr(1)
  13611. break
  13612. }
  13613. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13614. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13615. case int32(_BT_LEAD2):
  13616. if int32(end)-int32(ptr) < int32(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13618. return int32(m_XML_TOK_DATA_CHARS)
  13619. }
  13620. ptr += uintptr(2)
  13621. case int32(_BT_LEAD3):
  13622. if int32(end)-int32(ptr) < int32(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13624. return int32(m_XML_TOK_DATA_CHARS)
  13625. }
  13626. ptr += uintptr(3)
  13627. case int32(_BT_LEAD4):
  13628. if int32(end)-int32(ptr) < int32(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13630. return int32(m_XML_TOK_DATA_CHARS)
  13631. }
  13632. ptr += uintptr(4)
  13633. case int32(_BT_NONXML):
  13634. fallthrough
  13635. case int32(_BT_MALFORM):
  13636. fallthrough
  13637. case int32(_BT_TRAIL):
  13638. fallthrough
  13639. case int32(_BT_CR):
  13640. fallthrough
  13641. case int32(_BT_LF):
  13642. fallthrough
  13643. case int32(_BT_RSQB):
  13644. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13645. return int32(m_XML_TOK_DATA_CHARS)
  13646. default:
  13647. ptr += uintptr(1)
  13648. break
  13649. }
  13650. }
  13651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13652. return int32(m_XML_TOK_DATA_CHARS)
  13653. }
  13654. /* ptr points to character following "</" */
  13655. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13656. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13657. return -int32(1)
  13658. }
  13659. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13660. case int32(_BT_NONASCII):
  13661. if !(libc.Int32FromInt32(0) != 0) {
  13662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13663. return m_XML_TOK_INVALID
  13664. } /* fall through */
  13665. fallthrough
  13666. case int32(_BT_NMSTRT):
  13667. fallthrough
  13668. case int32(_BT_HEX):
  13669. ptr += uintptr(1)
  13670. case int32(_BT_LEAD2):
  13671. if int32(end)-int32(ptr) < int32(2) {
  13672. return -int32(2)
  13673. }
  13674. 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) {
  13675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13676. return m_XML_TOK_INVALID
  13677. }
  13678. ptr += uintptr(2)
  13679. case int32(_BT_LEAD3):
  13680. if int32(end)-int32(ptr) < int32(3) {
  13681. return -int32(2)
  13682. }
  13683. 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) {
  13684. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13685. return m_XML_TOK_INVALID
  13686. }
  13687. ptr += uintptr(3)
  13688. case int32(_BT_LEAD4):
  13689. if int32(end)-int32(ptr) < int32(4) {
  13690. return -int32(2)
  13691. }
  13692. 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) {
  13693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13694. return m_XML_TOK_INVALID
  13695. }
  13696. ptr += uintptr(4)
  13697. default:
  13698. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13699. return m_XML_TOK_INVALID
  13700. }
  13701. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13702. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13703. case int32(_BT_NONASCII):
  13704. goto _1
  13705. case int32(_BT_MINUS):
  13706. goto _2
  13707. case int32(_BT_NAME):
  13708. goto _3
  13709. case int32(_BT_DIGIT):
  13710. goto _4
  13711. case int32(_BT_HEX):
  13712. goto _5
  13713. case int32(_BT_NMSTRT):
  13714. goto _6
  13715. case int32(_BT_LEAD2):
  13716. goto _7
  13717. case int32(_BT_LEAD3):
  13718. goto _8
  13719. case int32(_BT_LEAD4):
  13720. goto _9
  13721. case int32(_BT_LF):
  13722. goto _10
  13723. case int32(_BT_CR):
  13724. goto _11
  13725. case int32(_BT_S):
  13726. goto _12
  13727. case int32(_BT_COLON):
  13728. goto _13
  13729. case int32(_BT_GT):
  13730. goto _14
  13731. default:
  13732. goto _15
  13733. }
  13734. goto _16
  13735. _1:
  13736. ;
  13737. if !(libc.Int32FromInt32(0) != 0) {
  13738. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13739. return m_XML_TOK_INVALID
  13740. } /* fall through */
  13741. _6:
  13742. ;
  13743. _5:
  13744. ;
  13745. _4:
  13746. ;
  13747. _3:
  13748. ;
  13749. _2:
  13750. ;
  13751. ptr += uintptr(1)
  13752. goto _16
  13753. _7:
  13754. ;
  13755. if int32(end)-int32(ptr) < int32(2) {
  13756. return -int32(2)
  13757. }
  13758. 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) {
  13759. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13760. return m_XML_TOK_INVALID
  13761. }
  13762. ptr += uintptr(2)
  13763. goto _16
  13764. _8:
  13765. ;
  13766. if int32(end)-int32(ptr) < int32(3) {
  13767. return -int32(2)
  13768. }
  13769. 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) {
  13770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13771. return m_XML_TOK_INVALID
  13772. }
  13773. ptr += uintptr(3)
  13774. goto _16
  13775. _9:
  13776. ;
  13777. if int32(end)-int32(ptr) < int32(4) {
  13778. return -int32(2)
  13779. }
  13780. 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) {
  13781. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13782. return m_XML_TOK_INVALID
  13783. }
  13784. ptr += uintptr(4)
  13785. goto _16
  13786. _12:
  13787. ;
  13788. _11:
  13789. ;
  13790. _10:
  13791. ;
  13792. ptr += uintptr(1)
  13793. _19:
  13794. ;
  13795. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13796. goto _17
  13797. }
  13798. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13799. case int32(_BT_S):
  13800. fallthrough
  13801. case int32(_BT_CR):
  13802. fallthrough
  13803. case int32(_BT_LF):
  13804. case int32(_BT_GT):
  13805. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13806. return int32(m_XML_TOK_END_TAG)
  13807. default:
  13808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13809. return m_XML_TOK_INVALID
  13810. }
  13811. goto _18
  13812. _18:
  13813. ;
  13814. ptr += uintptr(1)
  13815. goto _19
  13816. goto _17
  13817. _17:
  13818. ;
  13819. return -int32(1)
  13820. _13:
  13821. ;
  13822. /* no need to check qname syntax here,
  13823. since end-tag must match exactly */
  13824. ptr += uintptr(1)
  13825. goto _16
  13826. _14:
  13827. ;
  13828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13829. return int32(m_XML_TOK_END_TAG)
  13830. _15:
  13831. ;
  13832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13833. return m_XML_TOK_INVALID
  13834. _16:
  13835. }
  13836. return -int32(1)
  13837. }
  13838. /* ptr points to character following "&#X" */
  13839. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13840. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13841. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13842. case int32(_BT_DIGIT):
  13843. fallthrough
  13844. case int32(_BT_HEX):
  13845. default:
  13846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13847. return m_XML_TOK_INVALID
  13848. }
  13849. ptr += uintptr(1)
  13850. for {
  13851. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13852. break
  13853. }
  13854. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13855. case int32(_BT_DIGIT):
  13856. fallthrough
  13857. case int32(_BT_HEX):
  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_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13875. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13876. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  13877. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13878. }
  13879. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13880. case int32(_BT_DIGIT):
  13881. default:
  13882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13883. return m_XML_TOK_INVALID
  13884. }
  13885. ptr += uintptr(1)
  13886. for {
  13887. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13888. break
  13889. }
  13890. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13891. case int32(_BT_DIGIT):
  13892. case int32(_BT_SEMI):
  13893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13894. return int32(m_XML_TOK_CHAR_REF)
  13895. default:
  13896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13897. return m_XML_TOK_INVALID
  13898. }
  13899. goto _1
  13900. _1:
  13901. ;
  13902. ptr += uintptr(1)
  13903. }
  13904. }
  13905. return -int32(1)
  13906. }
  13907. /* ptr points to character following "&" */
  13908. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13909. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13910. return -int32(1)
  13911. }
  13912. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13913. case int32(_BT_NONASCII):
  13914. if !(libc.Int32FromInt32(0) != 0) {
  13915. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13916. return m_XML_TOK_INVALID
  13917. } /* fall through */
  13918. fallthrough
  13919. case int32(_BT_NMSTRT):
  13920. fallthrough
  13921. case int32(_BT_HEX):
  13922. ptr += uintptr(1)
  13923. case int32(_BT_LEAD2):
  13924. if int32(end)-int32(ptr) < int32(2) {
  13925. return -int32(2)
  13926. }
  13927. 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) {
  13928. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13929. return m_XML_TOK_INVALID
  13930. }
  13931. ptr += uintptr(2)
  13932. case int32(_BT_LEAD3):
  13933. if int32(end)-int32(ptr) < int32(3) {
  13934. return -int32(2)
  13935. }
  13936. 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) {
  13937. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13938. return m_XML_TOK_INVALID
  13939. }
  13940. ptr += uintptr(3)
  13941. case int32(_BT_LEAD4):
  13942. if int32(end)-int32(ptr) < int32(4) {
  13943. return -int32(2)
  13944. }
  13945. 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) {
  13946. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13947. return m_XML_TOK_INVALID
  13948. }
  13949. ptr += uintptr(4)
  13950. case int32(_BT_NUM):
  13951. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13952. default:
  13953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13954. return m_XML_TOK_INVALID
  13955. }
  13956. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  13957. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  13958. case int32(_BT_NONASCII):
  13959. if !(libc.Int32FromInt32(0) != 0) {
  13960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13961. return m_XML_TOK_INVALID
  13962. } /* fall through */
  13963. fallthrough
  13964. case int32(_BT_NMSTRT):
  13965. fallthrough
  13966. case int32(_BT_HEX):
  13967. fallthrough
  13968. case int32(_BT_DIGIT):
  13969. fallthrough
  13970. case int32(_BT_NAME):
  13971. fallthrough
  13972. case int32(_BT_MINUS):
  13973. ptr += uintptr(1)
  13974. case int32(_BT_LEAD2):
  13975. if int32(end)-int32(ptr) < int32(2) {
  13976. return -int32(2)
  13977. }
  13978. 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) {
  13979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13980. return m_XML_TOK_INVALID
  13981. }
  13982. ptr += uintptr(2)
  13983. case int32(_BT_LEAD3):
  13984. if int32(end)-int32(ptr) < int32(3) {
  13985. return -int32(2)
  13986. }
  13987. 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) {
  13988. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13989. return m_XML_TOK_INVALID
  13990. }
  13991. ptr += uintptr(3)
  13992. case int32(_BT_LEAD4):
  13993. if int32(end)-int32(ptr) < int32(4) {
  13994. return -int32(2)
  13995. }
  13996. 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) {
  13997. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13998. return m_XML_TOK_INVALID
  13999. }
  14000. ptr += uintptr(4)
  14001. case int32(_BT_SEMI):
  14002. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14003. return int32(m_XML_TOK_ENTITY_REF)
  14004. default:
  14005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14006. return m_XML_TOK_INVALID
  14007. }
  14008. }
  14009. return -int32(1)
  14010. }
  14011. /* ptr points to character following first character of attribute name */
  14012. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14013. bp := tls.Alloc(16)
  14014. defer tls.Free(16)
  14015. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  14016. var hadColon, open, t, t1, tok int32
  14017. _, _, _, _, _ = hadColon, open, t, t1, tok
  14018. hadColon = 0
  14019. for int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14020. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14021. case int32(_BT_NONASCII):
  14022. goto _1
  14023. case int32(_BT_MINUS):
  14024. goto _2
  14025. case int32(_BT_NAME):
  14026. goto _3
  14027. case int32(_BT_DIGIT):
  14028. goto _4
  14029. case int32(_BT_HEX):
  14030. goto _5
  14031. case int32(_BT_NMSTRT):
  14032. goto _6
  14033. case int32(_BT_LEAD2):
  14034. goto _7
  14035. case int32(_BT_LEAD3):
  14036. goto _8
  14037. case int32(_BT_LEAD4):
  14038. goto _9
  14039. case int32(_BT_COLON):
  14040. goto _10
  14041. case int32(_BT_LF):
  14042. goto _11
  14043. case int32(_BT_CR):
  14044. goto _12
  14045. case int32(_BT_S):
  14046. goto _13
  14047. case int32(_BT_EQUALS):
  14048. goto _14
  14049. default:
  14050. goto _15
  14051. }
  14052. goto _16
  14053. _1:
  14054. ;
  14055. if !(libc.Int32FromInt32(0) != 0) {
  14056. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14057. return m_XML_TOK_INVALID
  14058. } /* fall through */
  14059. _6:
  14060. ;
  14061. _5:
  14062. ;
  14063. _4:
  14064. ;
  14065. _3:
  14066. ;
  14067. _2:
  14068. ;
  14069. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14070. goto _16
  14071. _7:
  14072. ;
  14073. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14074. return -int32(2)
  14075. }
  14076. 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) {
  14077. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14078. return m_XML_TOK_INVALID
  14079. }
  14080. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14081. goto _16
  14082. _8:
  14083. ;
  14084. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14085. return -int32(2)
  14086. }
  14087. 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) {
  14088. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14089. return m_XML_TOK_INVALID
  14090. }
  14091. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14092. goto _16
  14093. _9:
  14094. ;
  14095. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14096. return -int32(2)
  14097. }
  14098. 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) {
  14099. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14100. return m_XML_TOK_INVALID
  14101. }
  14102. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14103. goto _16
  14104. _10:
  14105. ;
  14106. if hadColon != 0 {
  14107. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14108. return m_XML_TOK_INVALID
  14109. }
  14110. hadColon = int32(1)
  14111. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14112. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14113. return -int32(1)
  14114. }
  14115. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14116. case int32(_BT_NONASCII):
  14117. if !(libc.Int32FromInt32(0) != 0) {
  14118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14119. return m_XML_TOK_INVALID
  14120. } /* fall through */
  14121. fallthrough
  14122. case int32(_BT_NMSTRT):
  14123. fallthrough
  14124. case int32(_BT_HEX):
  14125. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14126. case int32(_BT_LEAD2):
  14127. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14128. return -int32(2)
  14129. }
  14130. 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) {
  14131. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14132. return m_XML_TOK_INVALID
  14133. }
  14134. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14135. case int32(_BT_LEAD3):
  14136. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14137. return -int32(2)
  14138. }
  14139. 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) {
  14140. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14141. return m_XML_TOK_INVALID
  14142. }
  14143. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14144. case int32(_BT_LEAD4):
  14145. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14146. return -int32(2)
  14147. }
  14148. 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) {
  14149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14150. return m_XML_TOK_INVALID
  14151. }
  14152. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14153. default:
  14154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14155. return m_XML_TOK_INVALID
  14156. }
  14157. goto _16
  14158. _13:
  14159. ;
  14160. _12:
  14161. ;
  14162. _11:
  14163. ;
  14164. _19:
  14165. ;
  14166. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14167. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14168. return -int32(1)
  14169. }
  14170. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14171. if t == int32(_BT_EQUALS) {
  14172. goto _17
  14173. }
  14174. switch t {
  14175. case int32(_BT_S):
  14176. fallthrough
  14177. case int32(_BT_LF):
  14178. fallthrough
  14179. case int32(_BT_CR):
  14180. default:
  14181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14182. return m_XML_TOK_INVALID
  14183. }
  14184. goto _18
  14185. _18:
  14186. ;
  14187. goto _19
  14188. goto _17
  14189. _17:
  14190. ;
  14191. /* fall through */
  14192. _14:
  14193. ;
  14194. hadColon = 0
  14195. for {
  14196. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14197. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14198. return -int32(1)
  14199. }
  14200. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14201. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  14202. break
  14203. }
  14204. switch open {
  14205. case int32(_BT_S):
  14206. fallthrough
  14207. case int32(_BT_LF):
  14208. fallthrough
  14209. case int32(_BT_CR):
  14210. default:
  14211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14212. return m_XML_TOK_INVALID
  14213. }
  14214. goto _20
  14215. _20:
  14216. }
  14217. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14218. /* in attribute value */
  14219. for {
  14220. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14221. return -int32(1)
  14222. }
  14223. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  14224. if t1 == open {
  14225. break
  14226. }
  14227. switch t1 {
  14228. case int32(_BT_LEAD2):
  14229. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14230. return -int32(2)
  14231. }
  14232. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14234. return m_XML_TOK_INVALID
  14235. }
  14236. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14237. case int32(_BT_LEAD3):
  14238. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14239. return -int32(2)
  14240. }
  14241. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14242. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14243. return m_XML_TOK_INVALID
  14244. }
  14245. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14246. case int32(_BT_LEAD4):
  14247. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14248. return -int32(2)
  14249. }
  14250. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  14251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14252. return m_XML_TOK_INVALID
  14253. }
  14254. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14255. case int32(_BT_NONXML):
  14256. fallthrough
  14257. case int32(_BT_MALFORM):
  14258. fallthrough
  14259. case int32(_BT_TRAIL):
  14260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14261. return m_XML_TOK_INVALID
  14262. case int32(_BT_AMP):
  14263. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  14264. if tok <= 0 {
  14265. if tok == m_XML_TOK_INVALID {
  14266. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14267. }
  14268. return tok
  14269. }
  14270. case int32(_BT_LT):
  14271. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14272. return m_XML_TOK_INVALID
  14273. default:
  14274. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14275. break
  14276. }
  14277. goto _21
  14278. _21:
  14279. }
  14280. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14281. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14282. return -int32(1)
  14283. }
  14284. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14285. case int32(_BT_S):
  14286. fallthrough
  14287. case int32(_BT_CR):
  14288. fallthrough
  14289. case int32(_BT_LF):
  14290. case int32(_BT_SOL):
  14291. goto sol
  14292. case int32(_BT_GT):
  14293. goto gt
  14294. default:
  14295. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14296. return m_XML_TOK_INVALID
  14297. }
  14298. /* ptr points to closing quote */
  14299. _24:
  14300. ;
  14301. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14302. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14303. return -int32(1)
  14304. }
  14305. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))) {
  14306. case int32(_BT_NONASCII):
  14307. goto _25
  14308. case int32(_BT_HEX):
  14309. goto _26
  14310. case int32(_BT_NMSTRT):
  14311. goto _27
  14312. case int32(_BT_LEAD2):
  14313. goto _28
  14314. case int32(_BT_LEAD3):
  14315. goto _29
  14316. case int32(_BT_LEAD4):
  14317. goto _30
  14318. case int32(_BT_LF):
  14319. goto _31
  14320. case int32(_BT_CR):
  14321. goto _32
  14322. case int32(_BT_S):
  14323. goto _33
  14324. case int32(_BT_GT):
  14325. goto _34
  14326. case int32(_BT_SOL):
  14327. goto _35
  14328. default:
  14329. goto _36
  14330. }
  14331. goto _37
  14332. _25:
  14333. ;
  14334. if !(libc.Int32FromInt32(0) != 0) {
  14335. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14336. return m_XML_TOK_INVALID
  14337. } /* fall through */
  14338. _27:
  14339. ;
  14340. _26:
  14341. ;
  14342. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14343. goto _37
  14344. _28:
  14345. ;
  14346. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  14347. return -int32(2)
  14348. }
  14349. 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) {
  14350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14351. return m_XML_TOK_INVALID
  14352. }
  14353. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  14354. goto _37
  14355. _29:
  14356. ;
  14357. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  14358. return -int32(2)
  14359. }
  14360. 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) {
  14361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14362. return m_XML_TOK_INVALID
  14363. }
  14364. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  14365. goto _37
  14366. _30:
  14367. ;
  14368. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  14369. return -int32(2)
  14370. }
  14371. 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) {
  14372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14373. return m_XML_TOK_INVALID
  14374. }
  14375. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  14376. goto _37
  14377. _33:
  14378. ;
  14379. _32:
  14380. ;
  14381. _31:
  14382. ;
  14383. goto _23
  14384. _34:
  14385. ;
  14386. goto gt
  14387. gt:
  14388. ;
  14389. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14390. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  14391. _35:
  14392. ;
  14393. goto sol
  14394. sol:
  14395. ;
  14396. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  14397. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14398. return -int32(1)
  14399. }
  14400. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14402. return m_XML_TOK_INVALID
  14403. }
  14404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  14405. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  14406. _36:
  14407. ;
  14408. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14409. return m_XML_TOK_INVALID
  14410. _37:
  14411. ;
  14412. goto _22
  14413. goto _23
  14414. _23:
  14415. ;
  14416. goto _24
  14417. goto _22
  14418. _22:
  14419. ;
  14420. goto _16
  14421. _15:
  14422. ;
  14423. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  14424. return m_XML_TOK_INVALID
  14425. _16:
  14426. }
  14427. return -int32(1)
  14428. }
  14429. /* ptr points to character following "<" */
  14430. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14431. var hadColon int32
  14432. _ = hadColon
  14433. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14434. return -int32(1)
  14435. }
  14436. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14437. case int32(_BT_NONASCII):
  14438. if !(libc.Int32FromInt32(0) != 0) {
  14439. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14440. return m_XML_TOK_INVALID
  14441. } /* fall through */
  14442. fallthrough
  14443. case int32(_BT_NMSTRT):
  14444. fallthrough
  14445. case int32(_BT_HEX):
  14446. ptr += uintptr(1)
  14447. case int32(_BT_LEAD2):
  14448. if int32(end)-int32(ptr) < int32(2) {
  14449. return -int32(2)
  14450. }
  14451. 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) {
  14452. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14453. return m_XML_TOK_INVALID
  14454. }
  14455. ptr += uintptr(2)
  14456. case int32(_BT_LEAD3):
  14457. if int32(end)-int32(ptr) < int32(3) {
  14458. return -int32(2)
  14459. }
  14460. 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) {
  14461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14462. return m_XML_TOK_INVALID
  14463. }
  14464. ptr += uintptr(3)
  14465. case int32(_BT_LEAD4):
  14466. if int32(end)-int32(ptr) < int32(4) {
  14467. return -int32(2)
  14468. }
  14469. 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) {
  14470. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14471. return m_XML_TOK_INVALID
  14472. }
  14473. ptr += uintptr(4)
  14474. case int32(_BT_EXCL):
  14475. ptr += uintptr(1)
  14476. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14477. return -int32(1)
  14478. }
  14479. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14480. case int32(_BT_MINUS):
  14481. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14482. case int32(_BT_LSQB):
  14483. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14484. }
  14485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14486. return m_XML_TOK_INVALID
  14487. case int32(_BT_QUEST):
  14488. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14489. case int32(_BT_SOL):
  14490. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14491. default:
  14492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14493. return m_XML_TOK_INVALID
  14494. }
  14495. hadColon = 0
  14496. /* we have a start-tag */
  14497. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14498. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14499. case int32(_BT_NONASCII):
  14500. goto _1
  14501. case int32(_BT_MINUS):
  14502. goto _2
  14503. case int32(_BT_NAME):
  14504. goto _3
  14505. case int32(_BT_DIGIT):
  14506. goto _4
  14507. case int32(_BT_HEX):
  14508. goto _5
  14509. case int32(_BT_NMSTRT):
  14510. goto _6
  14511. case int32(_BT_LEAD2):
  14512. goto _7
  14513. case int32(_BT_LEAD3):
  14514. goto _8
  14515. case int32(_BT_LEAD4):
  14516. goto _9
  14517. case int32(_BT_COLON):
  14518. goto _10
  14519. case int32(_BT_LF):
  14520. goto _11
  14521. case int32(_BT_CR):
  14522. goto _12
  14523. case int32(_BT_S):
  14524. goto _13
  14525. case int32(_BT_GT):
  14526. goto _14
  14527. case int32(_BT_SOL):
  14528. goto _15
  14529. default:
  14530. goto _16
  14531. }
  14532. goto _17
  14533. _1:
  14534. ;
  14535. if !(libc.Int32FromInt32(0) != 0) {
  14536. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14537. return m_XML_TOK_INVALID
  14538. } /* fall through */
  14539. _6:
  14540. ;
  14541. _5:
  14542. ;
  14543. _4:
  14544. ;
  14545. _3:
  14546. ;
  14547. _2:
  14548. ;
  14549. ptr += uintptr(1)
  14550. goto _17
  14551. _7:
  14552. ;
  14553. if int32(end)-int32(ptr) < int32(2) {
  14554. return -int32(2)
  14555. }
  14556. 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) {
  14557. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14558. return m_XML_TOK_INVALID
  14559. }
  14560. ptr += uintptr(2)
  14561. goto _17
  14562. _8:
  14563. ;
  14564. if int32(end)-int32(ptr) < int32(3) {
  14565. return -int32(2)
  14566. }
  14567. 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) {
  14568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14569. return m_XML_TOK_INVALID
  14570. }
  14571. ptr += uintptr(3)
  14572. goto _17
  14573. _9:
  14574. ;
  14575. if int32(end)-int32(ptr) < int32(4) {
  14576. return -int32(2)
  14577. }
  14578. 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) {
  14579. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14580. return m_XML_TOK_INVALID
  14581. }
  14582. ptr += uintptr(4)
  14583. goto _17
  14584. _10:
  14585. ;
  14586. if hadColon != 0 {
  14587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14588. return m_XML_TOK_INVALID
  14589. }
  14590. hadColon = int32(1)
  14591. ptr += uintptr(1)
  14592. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14593. return -int32(1)
  14594. }
  14595. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14596. case int32(_BT_NONASCII):
  14597. if !(libc.Int32FromInt32(0) != 0) {
  14598. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14599. return m_XML_TOK_INVALID
  14600. } /* fall through */
  14601. fallthrough
  14602. case int32(_BT_NMSTRT):
  14603. fallthrough
  14604. case int32(_BT_HEX):
  14605. ptr += uintptr(1)
  14606. case int32(_BT_LEAD2):
  14607. if int32(end)-int32(ptr) < int32(2) {
  14608. return -int32(2)
  14609. }
  14610. 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) {
  14611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14612. return m_XML_TOK_INVALID
  14613. }
  14614. ptr += uintptr(2)
  14615. case int32(_BT_LEAD3):
  14616. if int32(end)-int32(ptr) < int32(3) {
  14617. return -int32(2)
  14618. }
  14619. 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) {
  14620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14621. return m_XML_TOK_INVALID
  14622. }
  14623. ptr += uintptr(3)
  14624. case int32(_BT_LEAD4):
  14625. if int32(end)-int32(ptr) < int32(4) {
  14626. return -int32(2)
  14627. }
  14628. 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) {
  14629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14630. return m_XML_TOK_INVALID
  14631. }
  14632. ptr += uintptr(4)
  14633. default:
  14634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14635. return m_XML_TOK_INVALID
  14636. }
  14637. goto _17
  14638. _13:
  14639. ;
  14640. _12:
  14641. ;
  14642. _11:
  14643. ;
  14644. ptr += uintptr(1)
  14645. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14646. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14647. case int32(_BT_NONASCII):
  14648. if !(libc.Int32FromInt32(0) != 0) {
  14649. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14650. return m_XML_TOK_INVALID
  14651. } /* fall through */
  14652. fallthrough
  14653. case int32(_BT_NMSTRT):
  14654. fallthrough
  14655. case int32(_BT_HEX):
  14656. ptr += uintptr(1)
  14657. case int32(_BT_LEAD2):
  14658. if int32(end)-int32(ptr) < int32(2) {
  14659. return -int32(2)
  14660. }
  14661. 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) {
  14662. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14663. return m_XML_TOK_INVALID
  14664. }
  14665. ptr += uintptr(2)
  14666. case int32(_BT_LEAD3):
  14667. if int32(end)-int32(ptr) < int32(3) {
  14668. return -int32(2)
  14669. }
  14670. 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) {
  14671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14672. return m_XML_TOK_INVALID
  14673. }
  14674. ptr += uintptr(3)
  14675. case int32(_BT_LEAD4):
  14676. if int32(end)-int32(ptr) < int32(4) {
  14677. return -int32(2)
  14678. }
  14679. 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) {
  14680. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14681. return m_XML_TOK_INVALID
  14682. }
  14683. ptr += uintptr(4)
  14684. case int32(_BT_GT):
  14685. goto gt
  14686. case int32(_BT_SOL):
  14687. goto sol
  14688. case int32(_BT_S):
  14689. fallthrough
  14690. case int32(_BT_CR):
  14691. fallthrough
  14692. case int32(_BT_LF):
  14693. ptr += uintptr(1)
  14694. continue
  14695. default:
  14696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14697. return m_XML_TOK_INVALID
  14698. }
  14699. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  14700. }
  14701. return -int32(1)
  14702. _14:
  14703. ;
  14704. goto gt
  14705. gt:
  14706. ;
  14707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14708. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  14709. _15:
  14710. ;
  14711. goto sol
  14712. sol:
  14713. ;
  14714. ptr += uintptr(1)
  14715. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14716. return -int32(1)
  14717. }
  14718. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14719. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14720. return m_XML_TOK_INVALID
  14721. }
  14722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14723. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  14724. _16:
  14725. ;
  14726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14727. return m_XML_TOK_INVALID
  14728. _17:
  14729. }
  14730. return -int32(1)
  14731. }
  14732. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14733. var n Tsize_t
  14734. _ = n
  14735. if ptr >= end {
  14736. return -int32(4)
  14737. }
  14738. if int32(1) > int32(1) {
  14739. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  14740. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  14741. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  14742. if n == uint32(0) {
  14743. return -int32(1)
  14744. }
  14745. end = ptr + uintptr(n)
  14746. }
  14747. }
  14748. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14749. case int32(_BT_LT):
  14750. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14751. case int32(_BT_AMP):
  14752. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  14753. case int32(_BT_CR):
  14754. ptr += uintptr(1)
  14755. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14756. return -int32(3)
  14757. }
  14758. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  14759. ptr += uintptr(1)
  14760. }
  14761. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14762. return int32(m_XML_TOK_DATA_NEWLINE)
  14763. case int32(_BT_LF):
  14764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14765. return int32(m_XML_TOK_DATA_NEWLINE)
  14766. case int32(_BT_RSQB):
  14767. ptr += uintptr(1)
  14768. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14769. return -int32(5)
  14770. }
  14771. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14772. break
  14773. }
  14774. ptr += uintptr(1)
  14775. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14776. return -int32(5)
  14777. }
  14778. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14779. ptr -= uintptr(1)
  14780. break
  14781. }
  14782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14783. return m_XML_TOK_INVALID
  14784. case int32(_BT_LEAD2):
  14785. if int32(end)-int32(ptr) < int32(2) {
  14786. return -int32(2)
  14787. }
  14788. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14790. return m_XML_TOK_INVALID
  14791. }
  14792. ptr += uintptr(2)
  14793. case int32(_BT_LEAD3):
  14794. if int32(end)-int32(ptr) < int32(3) {
  14795. return -int32(2)
  14796. }
  14797. if (*(*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 m_XML_TOK_INVALID
  14800. }
  14801. ptr += uintptr(3)
  14802. case int32(_BT_LEAD4):
  14803. if int32(end)-int32(ptr) < int32(4) {
  14804. return -int32(2)
  14805. }
  14806. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14808. return m_XML_TOK_INVALID
  14809. }
  14810. ptr += uintptr(4)
  14811. case int32(_BT_NONXML):
  14812. fallthrough
  14813. case int32(_BT_MALFORM):
  14814. fallthrough
  14815. case int32(_BT_TRAIL):
  14816. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14817. return m_XML_TOK_INVALID
  14818. default:
  14819. ptr += uintptr(1)
  14820. break
  14821. }
  14822. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14823. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14824. case int32(_BT_LEAD2):
  14825. if int32(end)-int32(ptr) < int32(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  14826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14827. return int32(m_XML_TOK_DATA_CHARS)
  14828. }
  14829. ptr += uintptr(2)
  14830. case int32(_BT_LEAD3):
  14831. if int32(end)-int32(ptr) < int32(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  14832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14833. return int32(m_XML_TOK_DATA_CHARS)
  14834. }
  14835. ptr += uintptr(3)
  14836. case int32(_BT_LEAD4):
  14837. if int32(end)-int32(ptr) < int32(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  14838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14839. return int32(m_XML_TOK_DATA_CHARS)
  14840. }
  14841. ptr += uintptr(4)
  14842. case int32(_BT_RSQB):
  14843. if int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(1) {
  14844. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  14845. ptr += uintptr(1)
  14846. break
  14847. }
  14848. if int32(end)-int32(ptr) >= libc.Int32FromInt32(3)*libc.Int32FromInt32(1) {
  14849. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  14850. ptr += uintptr(1)
  14851. break
  14852. }
  14853. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  14854. return m_XML_TOK_INVALID
  14855. }
  14856. }
  14857. /* fall through */
  14858. fallthrough
  14859. case int32(_BT_AMP):
  14860. fallthrough
  14861. case int32(_BT_LT):
  14862. fallthrough
  14863. case int32(_BT_NONXML):
  14864. fallthrough
  14865. case int32(_BT_MALFORM):
  14866. fallthrough
  14867. case int32(_BT_TRAIL):
  14868. fallthrough
  14869. case int32(_BT_CR):
  14870. fallthrough
  14871. case int32(_BT_LF):
  14872. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14873. return int32(m_XML_TOK_DATA_CHARS)
  14874. default:
  14875. ptr += uintptr(1)
  14876. break
  14877. }
  14878. }
  14879. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14880. return int32(m_XML_TOK_DATA_CHARS)
  14881. }
  14882. /* ptr points to character following "%" */
  14883. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14884. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14885. return -int32(1)
  14886. }
  14887. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14888. case int32(_BT_NONASCII):
  14889. if !(libc.Int32FromInt32(0) != 0) {
  14890. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14891. return m_XML_TOK_INVALID
  14892. } /* fall through */
  14893. fallthrough
  14894. case int32(_BT_NMSTRT):
  14895. fallthrough
  14896. case int32(_BT_HEX):
  14897. ptr += uintptr(1)
  14898. case int32(_BT_LEAD2):
  14899. if int32(end)-int32(ptr) < int32(2) {
  14900. return -int32(2)
  14901. }
  14902. 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) {
  14903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14904. return m_XML_TOK_INVALID
  14905. }
  14906. ptr += uintptr(2)
  14907. case int32(_BT_LEAD3):
  14908. if int32(end)-int32(ptr) < int32(3) {
  14909. return -int32(2)
  14910. }
  14911. 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) {
  14912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14913. return m_XML_TOK_INVALID
  14914. }
  14915. ptr += uintptr(3)
  14916. case int32(_BT_LEAD4):
  14917. if int32(end)-int32(ptr) < int32(4) {
  14918. return -int32(2)
  14919. }
  14920. 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) {
  14921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14922. return m_XML_TOK_INVALID
  14923. }
  14924. ptr += uintptr(4)
  14925. case int32(_BT_S):
  14926. fallthrough
  14927. case int32(_BT_LF):
  14928. fallthrough
  14929. case int32(_BT_CR):
  14930. fallthrough
  14931. case int32(_BT_PERCNT):
  14932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14933. return int32(m_XML_TOK_PERCENT)
  14934. default:
  14935. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14936. return m_XML_TOK_INVALID
  14937. }
  14938. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  14939. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14940. case int32(_BT_NONASCII):
  14941. if !(libc.Int32FromInt32(0) != 0) {
  14942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14943. return m_XML_TOK_INVALID
  14944. } /* fall through */
  14945. fallthrough
  14946. case int32(_BT_NMSTRT):
  14947. fallthrough
  14948. case int32(_BT_HEX):
  14949. fallthrough
  14950. case int32(_BT_DIGIT):
  14951. fallthrough
  14952. case int32(_BT_NAME):
  14953. fallthrough
  14954. case int32(_BT_MINUS):
  14955. ptr += uintptr(1)
  14956. case int32(_BT_LEAD2):
  14957. if int32(end)-int32(ptr) < int32(2) {
  14958. return -int32(2)
  14959. }
  14960. 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) {
  14961. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14962. return m_XML_TOK_INVALID
  14963. }
  14964. ptr += uintptr(2)
  14965. case int32(_BT_LEAD3):
  14966. if int32(end)-int32(ptr) < int32(3) {
  14967. return -int32(2)
  14968. }
  14969. 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) {
  14970. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14971. return m_XML_TOK_INVALID
  14972. }
  14973. ptr += uintptr(3)
  14974. case int32(_BT_LEAD4):
  14975. if int32(end)-int32(ptr) < int32(4) {
  14976. return -int32(2)
  14977. }
  14978. 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) {
  14979. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14980. return m_XML_TOK_INVALID
  14981. }
  14982. ptr += uintptr(4)
  14983. case int32(_BT_SEMI):
  14984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  14985. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  14986. default:
  14987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  14988. return m_XML_TOK_INVALID
  14989. }
  14990. }
  14991. return -int32(1)
  14992. }
  14993. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  14994. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  14995. return -int32(1)
  14996. }
  14997. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  14998. case int32(_BT_NONASCII):
  14999. if !(libc.Int32FromInt32(0) != 0) {
  15000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15001. return m_XML_TOK_INVALID
  15002. } /* fall through */
  15003. fallthrough
  15004. case int32(_BT_NMSTRT):
  15005. fallthrough
  15006. case int32(_BT_HEX):
  15007. ptr += uintptr(1)
  15008. case int32(_BT_LEAD2):
  15009. if int32(end)-int32(ptr) < int32(2) {
  15010. return -int32(2)
  15011. }
  15012. 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) {
  15013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15014. return m_XML_TOK_INVALID
  15015. }
  15016. ptr += uintptr(2)
  15017. case int32(_BT_LEAD3):
  15018. if int32(end)-int32(ptr) < int32(3) {
  15019. return -int32(2)
  15020. }
  15021. 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) {
  15022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15023. return m_XML_TOK_INVALID
  15024. }
  15025. ptr += uintptr(3)
  15026. case int32(_BT_LEAD4):
  15027. if int32(end)-int32(ptr) < int32(4) {
  15028. return -int32(2)
  15029. }
  15030. 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) {
  15031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15032. return m_XML_TOK_INVALID
  15033. }
  15034. ptr += uintptr(4)
  15035. default:
  15036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15037. return m_XML_TOK_INVALID
  15038. }
  15039. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15040. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15041. case int32(_BT_NONASCII):
  15042. if !(libc.Int32FromInt32(0) != 0) {
  15043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15044. return m_XML_TOK_INVALID
  15045. } /* fall through */
  15046. fallthrough
  15047. case int32(_BT_NMSTRT):
  15048. fallthrough
  15049. case int32(_BT_HEX):
  15050. fallthrough
  15051. case int32(_BT_DIGIT):
  15052. fallthrough
  15053. case int32(_BT_NAME):
  15054. fallthrough
  15055. case int32(_BT_MINUS):
  15056. ptr += uintptr(1)
  15057. case int32(_BT_LEAD2):
  15058. if int32(end)-int32(ptr) < int32(2) {
  15059. return -int32(2)
  15060. }
  15061. 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) {
  15062. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15063. return m_XML_TOK_INVALID
  15064. }
  15065. ptr += uintptr(2)
  15066. case int32(_BT_LEAD3):
  15067. if int32(end)-int32(ptr) < int32(3) {
  15068. return -int32(2)
  15069. }
  15070. 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) {
  15071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15072. return m_XML_TOK_INVALID
  15073. }
  15074. ptr += uintptr(3)
  15075. case int32(_BT_LEAD4):
  15076. if int32(end)-int32(ptr) < int32(4) {
  15077. return -int32(2)
  15078. }
  15079. 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) {
  15080. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15081. return m_XML_TOK_INVALID
  15082. }
  15083. ptr += uintptr(4)
  15084. case int32(_BT_CR):
  15085. fallthrough
  15086. case int32(_BT_LF):
  15087. fallthrough
  15088. case int32(_BT_S):
  15089. fallthrough
  15090. case int32(_BT_RPAR):
  15091. fallthrough
  15092. case int32(_BT_GT):
  15093. fallthrough
  15094. case int32(_BT_PERCNT):
  15095. fallthrough
  15096. case int32(_BT_VERBAR):
  15097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15098. return int32(m_XML_TOK_POUND_NAME)
  15099. default:
  15100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15101. return m_XML_TOK_INVALID
  15102. }
  15103. }
  15104. return -int32(m_XML_TOK_POUND_NAME)
  15105. }
  15106. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15107. var t int32
  15108. _ = t
  15109. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15110. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  15111. switch t {
  15112. case int32(_BT_LEAD2):
  15113. if int32(end)-int32(ptr) < int32(2) {
  15114. return -int32(2)
  15115. }
  15116. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15118. return m_XML_TOK_INVALID
  15119. }
  15120. ptr += uintptr(2)
  15121. case int32(_BT_LEAD3):
  15122. if int32(end)-int32(ptr) < int32(3) {
  15123. return -int32(2)
  15124. }
  15125. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15126. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15127. return m_XML_TOK_INVALID
  15128. }
  15129. ptr += uintptr(3)
  15130. case int32(_BT_LEAD4):
  15131. if int32(end)-int32(ptr) < int32(4) {
  15132. return -int32(2)
  15133. }
  15134. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15135. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15136. return m_XML_TOK_INVALID
  15137. }
  15138. ptr += uintptr(4)
  15139. case int32(_BT_NONXML):
  15140. fallthrough
  15141. case int32(_BT_MALFORM):
  15142. fallthrough
  15143. case int32(_BT_TRAIL):
  15144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15145. return m_XML_TOK_INVALID
  15146. case int32(_BT_QUOT):
  15147. fallthrough
  15148. case int32(_BT_APOS):
  15149. ptr += uintptr(1)
  15150. if t != open {
  15151. break
  15152. }
  15153. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15154. return -int32(m_XML_TOK_LITERAL)
  15155. }
  15156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15157. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15158. case int32(_BT_S):
  15159. fallthrough
  15160. case int32(_BT_CR):
  15161. fallthrough
  15162. case int32(_BT_LF):
  15163. fallthrough
  15164. case int32(_BT_GT):
  15165. fallthrough
  15166. case int32(_BT_PERCNT):
  15167. fallthrough
  15168. case int32(_BT_LSQB):
  15169. return int32(m_XML_TOK_LITERAL)
  15170. default:
  15171. return m_XML_TOK_INVALID
  15172. }
  15173. fallthrough
  15174. default:
  15175. ptr += uintptr(1)
  15176. break
  15177. }
  15178. }
  15179. return -int32(1)
  15180. }
  15181. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15182. var n Tsize_t
  15183. var tok int32
  15184. _, _ = n, tok
  15185. if ptr >= end {
  15186. return -int32(4)
  15187. }
  15188. if int32(1) > int32(1) {
  15189. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  15190. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15191. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15192. if n == uint32(0) {
  15193. return -int32(1)
  15194. }
  15195. end = ptr + uintptr(n)
  15196. }
  15197. }
  15198. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15199. case int32(_BT_QUOT):
  15200. goto _1
  15201. case int32(_BT_APOS):
  15202. goto _2
  15203. case int32(_BT_LT):
  15204. goto _3
  15205. case int32(_BT_CR):
  15206. goto _4
  15207. case int32(_BT_LF):
  15208. goto _5
  15209. case int32(_BT_S):
  15210. goto _6
  15211. case int32(_BT_PERCNT):
  15212. goto _7
  15213. case int32(_BT_COMMA):
  15214. goto _8
  15215. case int32(_BT_LSQB):
  15216. goto _9
  15217. case int32(_BT_RSQB):
  15218. goto _10
  15219. case int32(_BT_LPAR):
  15220. goto _11
  15221. case int32(_BT_RPAR):
  15222. goto _12
  15223. case int32(_BT_VERBAR):
  15224. goto _13
  15225. case int32(_BT_GT):
  15226. goto _14
  15227. case int32(_BT_NUM):
  15228. goto _15
  15229. case int32(_BT_LEAD2):
  15230. goto _16
  15231. case int32(_BT_LEAD3):
  15232. goto _17
  15233. case int32(_BT_LEAD4):
  15234. goto _18
  15235. case int32(_BT_HEX):
  15236. goto _19
  15237. case int32(_BT_NMSTRT):
  15238. goto _20
  15239. case int32(_BT_COLON):
  15240. goto _21
  15241. case int32(_BT_MINUS):
  15242. goto _22
  15243. case int32(_BT_NAME):
  15244. goto _23
  15245. case int32(_BT_DIGIT):
  15246. goto _24
  15247. case int32(_BT_NONASCII):
  15248. goto _25
  15249. default:
  15250. goto _26
  15251. }
  15252. goto _27
  15253. _1:
  15254. ;
  15255. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  15256. _2:
  15257. ;
  15258. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  15259. _3:
  15260. ;
  15261. ptr += uintptr(1)
  15262. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15263. return -int32(1)
  15264. }
  15265. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15266. case int32(_BT_EXCL):
  15267. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15268. case int32(_BT_QUEST):
  15269. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15270. case int32(_BT_NMSTRT):
  15271. fallthrough
  15272. case int32(_BT_HEX):
  15273. fallthrough
  15274. case int32(_BT_NONASCII):
  15275. fallthrough
  15276. case int32(_BT_LEAD2):
  15277. fallthrough
  15278. case int32(_BT_LEAD3):
  15279. fallthrough
  15280. case int32(_BT_LEAD4):
  15281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  15282. return int32(m_XML_TOK_INSTANCE_START)
  15283. }
  15284. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15285. return m_XML_TOK_INVALID
  15286. _4:
  15287. ;
  15288. if ptr+uintptr(1) == end {
  15289. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  15290. /* indicate that this might be part of a CR/LF pair */
  15291. return -int32(m_XML_TOK_PROLOG_S)
  15292. }
  15293. /* fall through */
  15294. _6:
  15295. ;
  15296. _5:
  15297. ;
  15298. _30:
  15299. ;
  15300. ptr += uintptr(1)
  15301. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15302. goto _28
  15303. }
  15304. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15305. case int32(_BT_S):
  15306. fallthrough
  15307. case int32(_BT_LF):
  15308. case int32(_BT_CR):
  15309. /* don't split CR/LF pair */
  15310. if ptr+uintptr(1) != end {
  15311. break
  15312. }
  15313. /* fall through */
  15314. fallthrough
  15315. default:
  15316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15317. return int32(m_XML_TOK_PROLOG_S)
  15318. }
  15319. goto _29
  15320. _29:
  15321. ;
  15322. goto _30
  15323. goto _28
  15324. _28:
  15325. ;
  15326. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15327. return int32(m_XML_TOK_PROLOG_S)
  15328. _7:
  15329. ;
  15330. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15331. _8:
  15332. ;
  15333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15334. return int32(m_XML_TOK_COMMA)
  15335. _9:
  15336. ;
  15337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15338. return int32(m_XML_TOK_OPEN_BRACKET)
  15339. _10:
  15340. ;
  15341. ptr += uintptr(1)
  15342. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15343. return -int32(m_XML_TOK_CLOSE_BRACKET)
  15344. }
  15345. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15346. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  15347. return -int32(1)
  15348. }
  15349. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  15350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  15351. return int32(m_XML_TOK_COND_SECT_CLOSE)
  15352. }
  15353. }
  15354. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15355. return int32(m_XML_TOK_CLOSE_BRACKET)
  15356. _11:
  15357. ;
  15358. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15359. return int32(m_XML_TOK_OPEN_PAREN)
  15360. _12:
  15361. ;
  15362. ptr += uintptr(1)
  15363. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15364. return -int32(m_XML_TOK_CLOSE_PAREN)
  15365. }
  15366. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15367. case int32(_BT_AST):
  15368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15369. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  15370. case int32(_BT_QUEST):
  15371. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15372. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  15373. case int32(_BT_PLUS):
  15374. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15375. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  15376. case int32(_BT_CR):
  15377. fallthrough
  15378. case int32(_BT_LF):
  15379. fallthrough
  15380. case int32(_BT_S):
  15381. fallthrough
  15382. case int32(_BT_GT):
  15383. fallthrough
  15384. case int32(_BT_COMMA):
  15385. fallthrough
  15386. case int32(_BT_VERBAR):
  15387. fallthrough
  15388. case int32(_BT_RPAR):
  15389. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15390. return int32(m_XML_TOK_CLOSE_PAREN)
  15391. }
  15392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15393. return m_XML_TOK_INVALID
  15394. _13:
  15395. ;
  15396. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15397. return int32(m_XML_TOK_OR)
  15398. _14:
  15399. ;
  15400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15401. return int32(m_XML_TOK_DECL_CLOSE)
  15402. _15:
  15403. ;
  15404. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15405. _16:
  15406. ;
  15407. if int32(end)-int32(ptr) < int32(2) {
  15408. return -int32(2)
  15409. }
  15410. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15412. return m_XML_TOK_INVALID
  15413. }
  15414. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  15415. ptr += uintptr(2)
  15416. tok = int32(m_XML_TOK_NAME)
  15417. goto _27
  15418. }
  15419. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  15420. ptr += uintptr(2)
  15421. tok = int32(m_XML_TOK_NMTOKEN)
  15422. goto _27
  15423. }
  15424. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15425. return m_XML_TOK_INVALID
  15426. _17:
  15427. ;
  15428. if int32(end)-int32(ptr) < int32(3) {
  15429. return -int32(2)
  15430. }
  15431. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15433. return m_XML_TOK_INVALID
  15434. }
  15435. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  15436. ptr += uintptr(3)
  15437. tok = int32(m_XML_TOK_NAME)
  15438. goto _27
  15439. }
  15440. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  15441. ptr += uintptr(3)
  15442. tok = int32(m_XML_TOK_NMTOKEN)
  15443. goto _27
  15444. }
  15445. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15446. return m_XML_TOK_INVALID
  15447. _18:
  15448. ;
  15449. if int32(end)-int32(ptr) < int32(4) {
  15450. return -int32(2)
  15451. }
  15452. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15453. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15454. return m_XML_TOK_INVALID
  15455. }
  15456. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  15457. ptr += uintptr(4)
  15458. tok = int32(m_XML_TOK_NAME)
  15459. goto _27
  15460. }
  15461. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  15462. ptr += uintptr(4)
  15463. tok = int32(m_XML_TOK_NMTOKEN)
  15464. goto _27
  15465. }
  15466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15467. return m_XML_TOK_INVALID
  15468. _20:
  15469. ;
  15470. _19:
  15471. ;
  15472. tok = int32(m_XML_TOK_NAME)
  15473. ptr += uintptr(1)
  15474. goto _27
  15475. _24:
  15476. ;
  15477. _23:
  15478. ;
  15479. _22:
  15480. ;
  15481. _21:
  15482. ;
  15483. tok = int32(m_XML_TOK_NMTOKEN)
  15484. ptr += uintptr(1)
  15485. goto _27
  15486. _25:
  15487. ;
  15488. if 0 != 0 {
  15489. ptr += uintptr(1)
  15490. tok = int32(m_XML_TOK_NAME)
  15491. goto _27
  15492. }
  15493. if 0 != 0 {
  15494. ptr += uintptr(1)
  15495. tok = int32(m_XML_TOK_NMTOKEN)
  15496. goto _27
  15497. }
  15498. /* fall through */
  15499. _26:
  15500. ;
  15501. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15502. return m_XML_TOK_INVALID
  15503. _27:
  15504. ;
  15505. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15506. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15507. case int32(_BT_NONASCII):
  15508. if !(libc.Int32FromInt32(0) != 0) {
  15509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15510. return m_XML_TOK_INVALID
  15511. } /* fall through */
  15512. fallthrough
  15513. case int32(_BT_NMSTRT):
  15514. fallthrough
  15515. case int32(_BT_HEX):
  15516. fallthrough
  15517. case int32(_BT_DIGIT):
  15518. fallthrough
  15519. case int32(_BT_NAME):
  15520. fallthrough
  15521. case int32(_BT_MINUS):
  15522. ptr += uintptr(1)
  15523. case int32(_BT_LEAD2):
  15524. if int32(end)-int32(ptr) < int32(2) {
  15525. return -int32(2)
  15526. }
  15527. 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) {
  15528. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15529. return m_XML_TOK_INVALID
  15530. }
  15531. ptr += uintptr(2)
  15532. case int32(_BT_LEAD3):
  15533. if int32(end)-int32(ptr) < int32(3) {
  15534. return -int32(2)
  15535. }
  15536. 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) {
  15537. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15538. return m_XML_TOK_INVALID
  15539. }
  15540. ptr += uintptr(3)
  15541. case int32(_BT_LEAD4):
  15542. if int32(end)-int32(ptr) < int32(4) {
  15543. return -int32(2)
  15544. }
  15545. 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) {
  15546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15547. return m_XML_TOK_INVALID
  15548. }
  15549. ptr += uintptr(4)
  15550. case int32(_BT_GT):
  15551. fallthrough
  15552. case int32(_BT_RPAR):
  15553. fallthrough
  15554. case int32(_BT_COMMA):
  15555. fallthrough
  15556. case int32(_BT_VERBAR):
  15557. fallthrough
  15558. case int32(_BT_LSQB):
  15559. fallthrough
  15560. case int32(_BT_PERCNT):
  15561. fallthrough
  15562. case int32(_BT_S):
  15563. fallthrough
  15564. case int32(_BT_CR):
  15565. fallthrough
  15566. case int32(_BT_LF):
  15567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15568. return tok
  15569. case int32(_BT_COLON):
  15570. ptr += uintptr(1)
  15571. switch tok {
  15572. case int32(m_XML_TOK_NAME):
  15573. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15574. return -int32(1)
  15575. }
  15576. tok = int32(m_XML_TOK_PREFIXED_NAME)
  15577. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15578. case int32(_BT_NONASCII):
  15579. if !(libc.Int32FromInt32(0) != 0) {
  15580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15581. return m_XML_TOK_INVALID
  15582. } /* fall through */
  15583. fallthrough
  15584. case int32(_BT_NMSTRT):
  15585. fallthrough
  15586. case int32(_BT_HEX):
  15587. fallthrough
  15588. case int32(_BT_DIGIT):
  15589. fallthrough
  15590. case int32(_BT_NAME):
  15591. fallthrough
  15592. case int32(_BT_MINUS):
  15593. ptr += uintptr(1)
  15594. case int32(_BT_LEAD2):
  15595. if int32(end)-int32(ptr) < int32(2) {
  15596. return -int32(2)
  15597. }
  15598. 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) {
  15599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15600. return m_XML_TOK_INVALID
  15601. }
  15602. ptr += uintptr(2)
  15603. case int32(_BT_LEAD3):
  15604. if int32(end)-int32(ptr) < int32(3) {
  15605. return -int32(2)
  15606. }
  15607. 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) {
  15608. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15609. return m_XML_TOK_INVALID
  15610. }
  15611. ptr += uintptr(3)
  15612. case int32(_BT_LEAD4):
  15613. if int32(end)-int32(ptr) < int32(4) {
  15614. return -int32(2)
  15615. }
  15616. 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) {
  15617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15618. return m_XML_TOK_INVALID
  15619. }
  15620. ptr += uintptr(4)
  15621. default:
  15622. tok = int32(m_XML_TOK_NMTOKEN)
  15623. break
  15624. }
  15625. case int32(m_XML_TOK_PREFIXED_NAME):
  15626. tok = int32(m_XML_TOK_NMTOKEN)
  15627. break
  15628. }
  15629. case int32(_BT_PLUS):
  15630. if tok == int32(m_XML_TOK_NMTOKEN) {
  15631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15632. return m_XML_TOK_INVALID
  15633. }
  15634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15635. return int32(m_XML_TOK_NAME_PLUS)
  15636. case int32(_BT_AST):
  15637. if tok == int32(m_XML_TOK_NMTOKEN) {
  15638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15639. return m_XML_TOK_INVALID
  15640. }
  15641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15642. return int32(m_XML_TOK_NAME_ASTERISK)
  15643. case int32(_BT_QUEST):
  15644. if tok == int32(m_XML_TOK_NMTOKEN) {
  15645. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15646. return m_XML_TOK_INVALID
  15647. }
  15648. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15649. return int32(m_XML_TOK_NAME_QUESTION)
  15650. default:
  15651. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15652. return m_XML_TOK_INVALID
  15653. }
  15654. }
  15655. return -tok
  15656. }
  15657. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15658. var start uintptr
  15659. _ = start
  15660. if ptr >= end {
  15661. return -int32(4)
  15662. } else {
  15663. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15664. /* This line cannot be executed. The incoming data has already
  15665. * been tokenized once, so incomplete characters like this have
  15666. * already been eliminated from the input. Retaining the paranoia
  15667. * check is still valuable, however.
  15668. */
  15669. return -int32(1) /* LCOV_EXCL_LINE */
  15670. }
  15671. }
  15672. start = ptr
  15673. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15674. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15675. case int32(_BT_LEAD2):
  15676. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15677. case int32(_BT_LEAD3):
  15678. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15679. case int32(_BT_LEAD4):
  15680. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15681. case int32(_BT_AMP):
  15682. if ptr == start {
  15683. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15684. }
  15685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15686. return int32(m_XML_TOK_DATA_CHARS)
  15687. case int32(_BT_LT):
  15688. /* this is for inside entity references */
  15689. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15690. return m_XML_TOK_INVALID
  15691. case int32(_BT_LF):
  15692. if ptr == start {
  15693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15694. return int32(m_XML_TOK_DATA_NEWLINE)
  15695. }
  15696. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15697. return int32(m_XML_TOK_DATA_CHARS)
  15698. case int32(_BT_CR):
  15699. if ptr == start {
  15700. ptr += uintptr(1)
  15701. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15702. return -int32(3)
  15703. }
  15704. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15705. ptr += uintptr(1)
  15706. }
  15707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15708. return int32(m_XML_TOK_DATA_NEWLINE)
  15709. }
  15710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15711. return int32(m_XML_TOK_DATA_CHARS)
  15712. case int32(_BT_S):
  15713. if ptr == start {
  15714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15715. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  15716. }
  15717. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15718. return int32(m_XML_TOK_DATA_CHARS)
  15719. default:
  15720. ptr += uintptr(1)
  15721. break
  15722. }
  15723. }
  15724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15725. return int32(m_XML_TOK_DATA_CHARS)
  15726. }
  15727. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15728. var start uintptr
  15729. var tok, v1 int32
  15730. _, _, _ = start, tok, v1
  15731. if ptr >= end {
  15732. return -int32(4)
  15733. } else {
  15734. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15735. /* This line cannot be executed. The incoming data has already
  15736. * been tokenized once, so incomplete characters like this have
  15737. * already been eliminated from the input. Retaining the paranoia
  15738. * check is still valuable, however.
  15739. */
  15740. return -int32(1) /* LCOV_EXCL_LINE */
  15741. }
  15742. }
  15743. start = ptr
  15744. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15745. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15746. case int32(_BT_LEAD2):
  15747. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  15748. case int32(_BT_LEAD3):
  15749. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  15750. case int32(_BT_LEAD4):
  15751. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  15752. case int32(_BT_AMP):
  15753. if ptr == start {
  15754. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15755. }
  15756. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15757. return int32(m_XML_TOK_DATA_CHARS)
  15758. case int32(_BT_PERCNT):
  15759. if ptr == start {
  15760. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  15761. if tok == int32(m_XML_TOK_PERCENT) {
  15762. v1 = m_XML_TOK_INVALID
  15763. } else {
  15764. v1 = tok
  15765. }
  15766. return v1
  15767. }
  15768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15769. return int32(m_XML_TOK_DATA_CHARS)
  15770. case int32(_BT_LF):
  15771. if ptr == start {
  15772. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  15773. return int32(m_XML_TOK_DATA_NEWLINE)
  15774. }
  15775. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15776. return int32(m_XML_TOK_DATA_CHARS)
  15777. case int32(_BT_CR):
  15778. if ptr == start {
  15779. ptr += uintptr(1)
  15780. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15781. return -int32(3)
  15782. }
  15783. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  15784. ptr += uintptr(1)
  15785. }
  15786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15787. return int32(m_XML_TOK_DATA_NEWLINE)
  15788. }
  15789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15790. return int32(m_XML_TOK_DATA_CHARS)
  15791. default:
  15792. ptr += uintptr(1)
  15793. break
  15794. }
  15795. }
  15796. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15797. return int32(m_XML_TOK_DATA_CHARS)
  15798. }
  15799. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  15800. var level int32
  15801. var n Tsize_t
  15802. _, _ = level, n
  15803. level = 0
  15804. if int32(1) > int32(1) {
  15805. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  15806. if n&libc.Uint32FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  15807. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  15808. end = ptr + uintptr(n)
  15809. }
  15810. }
  15811. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  15812. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15813. case int32(_BT_LEAD2):
  15814. if int32(end)-int32(ptr) < int32(2) {
  15815. return -int32(2)
  15816. }
  15817. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  15818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15819. return m_XML_TOK_INVALID
  15820. }
  15821. ptr += uintptr(2)
  15822. case int32(_BT_LEAD3):
  15823. if int32(end)-int32(ptr) < int32(3) {
  15824. return -int32(2)
  15825. }
  15826. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  15827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15828. return m_XML_TOK_INVALID
  15829. }
  15830. ptr += uintptr(3)
  15831. case int32(_BT_LEAD4):
  15832. if int32(end)-int32(ptr) < int32(4) {
  15833. return -int32(2)
  15834. }
  15835. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  15836. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15837. return m_XML_TOK_INVALID
  15838. }
  15839. ptr += uintptr(4)
  15840. case int32(_BT_NONXML):
  15841. fallthrough
  15842. case int32(_BT_MALFORM):
  15843. fallthrough
  15844. case int32(_BT_TRAIL):
  15845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15846. return m_XML_TOK_INVALID
  15847. case int32(_BT_LT):
  15848. ptr += uintptr(1)
  15849. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15850. return -int32(1)
  15851. }
  15852. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  15853. ptr += uintptr(1)
  15854. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15855. return -int32(1)
  15856. }
  15857. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  15858. level++
  15859. ptr += uintptr(1)
  15860. }
  15861. }
  15862. case int32(_BT_RSQB):
  15863. ptr += uintptr(1)
  15864. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15865. return -int32(1)
  15866. }
  15867. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  15868. ptr += uintptr(1)
  15869. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15870. return -int32(1)
  15871. }
  15872. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  15873. ptr += uintptr(1)
  15874. if level == 0 {
  15875. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  15876. return int32(m_XML_TOK_IGNORE_SECT)
  15877. }
  15878. level--
  15879. }
  15880. }
  15881. default:
  15882. ptr += uintptr(1)
  15883. break
  15884. }
  15885. }
  15886. return -int32(1)
  15887. }
  15888. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  15889. ptr += uintptr(1)
  15890. end -= uintptr(1)
  15891. for {
  15892. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  15893. break
  15894. }
  15895. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15896. case int32(_BT_DIGIT):
  15897. fallthrough
  15898. case int32(_BT_HEX):
  15899. fallthrough
  15900. case int32(_BT_MINUS):
  15901. fallthrough
  15902. case int32(_BT_APOS):
  15903. fallthrough
  15904. case int32(_BT_LPAR):
  15905. fallthrough
  15906. case int32(_BT_RPAR):
  15907. fallthrough
  15908. case int32(_BT_PLUS):
  15909. fallthrough
  15910. case int32(_BT_COMMA):
  15911. fallthrough
  15912. case int32(_BT_SOL):
  15913. fallthrough
  15914. case int32(_BT_EQUALS):
  15915. fallthrough
  15916. case int32(_BT_QUEST):
  15917. fallthrough
  15918. case int32(_BT_CR):
  15919. fallthrough
  15920. case int32(_BT_LF):
  15921. fallthrough
  15922. case int32(_BT_SEMI):
  15923. fallthrough
  15924. case int32(_BT_EXCL):
  15925. fallthrough
  15926. case int32(_BT_AST):
  15927. fallthrough
  15928. case int32(_BT_PERCNT):
  15929. fallthrough
  15930. case int32(_BT_NUM):
  15931. fallthrough
  15932. case int32(_BT_COLON):
  15933. case int32(_BT_S):
  15934. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  15935. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15936. return 0
  15937. }
  15938. case int32(_BT_NAME):
  15939. fallthrough
  15940. case int32(_BT_NMSTRT):
  15941. if !(int32(*(*int8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  15942. break
  15943. }
  15944. /* fall through */
  15945. fallthrough
  15946. default:
  15947. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  15948. case int32(0x24): /* $ */
  15949. fallthrough
  15950. case int32(0x40): /* @ */
  15951. default:
  15952. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  15953. return 0
  15954. }
  15955. break
  15956. }
  15957. goto _1
  15958. _1:
  15959. ;
  15960. ptr += uintptr(1)
  15961. }
  15962. return int32(1)
  15963. }
  15964. /* This must only be called for a well-formed start-tag or empty
  15965. element tag. Returns the number of attributes. Pointers to the
  15966. first attsMax attributes are stored in atts.
  15967. */
  15968. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  15969. var nAtts, open, state int32
  15970. _, _, _ = nAtts, open, state
  15971. state = 1
  15972. nAtts = 0
  15973. open = 0 /* defined when state == inValue;
  15974. initialization just to shut up compilers */
  15975. ptr += uintptr(1)
  15976. for {
  15977. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  15978. case int32(_BT_LEAD2):
  15979. if state == 0 {
  15980. if nAtts < attsMax {
  15981. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  15982. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  15983. }
  15984. state = 1
  15985. }
  15986. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  15987. case int32(_BT_LEAD3):
  15988. if state == 0 {
  15989. if nAtts < attsMax {
  15990. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  15991. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  15992. }
  15993. state = 1
  15994. }
  15995. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  15996. case int32(_BT_LEAD4):
  15997. if state == 0 {
  15998. if nAtts < attsMax {
  15999. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  16000. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  16001. }
  16002. state = 1
  16003. }
  16004. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16005. case int32(_BT_NONASCII):
  16006. fallthrough
  16007. case int32(_BT_NMSTRT):
  16008. fallthrough
  16009. case int32(_BT_HEX):
  16010. if state == 0 {
  16011. if nAtts < attsMax {
  16012. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  16013. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  16014. }
  16015. state = 1
  16016. }
  16017. case int32(_BT_QUOT):
  16018. if state != 2 {
  16019. if nAtts < attsMax {
  16020. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(1)
  16021. }
  16022. state = 2
  16023. open = int32(_BT_QUOT)
  16024. } else {
  16025. if open == int32(_BT_QUOT) {
  16026. state = 0
  16027. if nAtts < attsMax {
  16028. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  16029. }
  16030. nAtts++
  16031. }
  16032. }
  16033. case int32(_BT_APOS):
  16034. if state != 2 {
  16035. if nAtts < attsMax {
  16036. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(1)
  16037. }
  16038. state = 2
  16039. open = int32(_BT_APOS)
  16040. } else {
  16041. if open == int32(_BT_APOS) {
  16042. state = 0
  16043. if nAtts < attsMax {
  16044. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  16045. }
  16046. nAtts++
  16047. }
  16048. }
  16049. case int32(_BT_AMP):
  16050. if nAtts < attsMax {
  16051. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  16052. }
  16053. case int32(_BT_S):
  16054. if state == 1 {
  16055. state = 0
  16056. } else {
  16057. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr || int32(*(*int8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))))))) == open) {
  16058. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  16059. }
  16060. }
  16061. case int32(_BT_CR):
  16062. fallthrough
  16063. case int32(_BT_LF):
  16064. /* This case ensures that the first attribute name is counted
  16065. Apart from that we could just change state on the quote. */
  16066. if state == 1 {
  16067. state = 0
  16068. } else {
  16069. if state == 2 && nAtts < attsMax {
  16070. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  16071. }
  16072. }
  16073. case int32(_BT_GT):
  16074. fallthrough
  16075. case int32(_BT_SOL):
  16076. if state != 2 {
  16077. return nAtts
  16078. }
  16079. default:
  16080. break
  16081. }
  16082. goto _1
  16083. _1:
  16084. ;
  16085. ptr += uintptr(1)
  16086. }
  16087. /* not reached */
  16088. return r
  16089. }
  16090. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16091. var c, c1, result int32
  16092. _, _, _ = c, c1, result
  16093. result = 0
  16094. /* skip &# */
  16095. _ = enc
  16096. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  16097. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  16098. ptr += uintptr(1)
  16099. for {
  16100. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16101. break
  16102. }
  16103. c = int32(*(*int8)(unsafe.Pointer(ptr)))
  16104. switch c {
  16105. case int32(m_ASCII_02):
  16106. fallthrough
  16107. case int32(m_ASCII_12):
  16108. fallthrough
  16109. case int32(m_ASCII_22):
  16110. fallthrough
  16111. case int32(m_ASCII_32):
  16112. fallthrough
  16113. case int32(m_ASCII_41):
  16114. fallthrough
  16115. case int32(m_ASCII_51):
  16116. fallthrough
  16117. case int32(m_ASCII_61):
  16118. fallthrough
  16119. case int32(m_ASCII_71):
  16120. fallthrough
  16121. case int32(m_ASCII_82):
  16122. fallthrough
  16123. case int32(m_ASCII_92):
  16124. result <<= int32(4)
  16125. result |= c - int32(m_ASCII_02)
  16126. case int32(m_ASCII_A):
  16127. fallthrough
  16128. case int32(m_ASCII_B1):
  16129. fallthrough
  16130. case int32(m_ASCII_C):
  16131. fallthrough
  16132. case int32(m_ASCII_D):
  16133. fallthrough
  16134. case int32(m_ASCII_E):
  16135. fallthrough
  16136. case int32(m_ASCII_F):
  16137. result <<= int32(4)
  16138. result += int32(10) + (c - int32(m_ASCII_A))
  16139. case int32(m_ASCII_a2):
  16140. fallthrough
  16141. case int32(m_ASCII_b1):
  16142. fallthrough
  16143. case int32(m_ASCII_c2):
  16144. fallthrough
  16145. case int32(m_ASCII_d1):
  16146. fallthrough
  16147. case int32(m_ASCII_e2):
  16148. fallthrough
  16149. case int32(m_ASCII_f1):
  16150. result <<= int32(4)
  16151. result += int32(10) + (c - int32(m_ASCII_a2))
  16152. break
  16153. }
  16154. if result >= int32(0x110000) {
  16155. return -int32(1)
  16156. }
  16157. goto _1
  16158. _1:
  16159. ;
  16160. ptr += uintptr(1)
  16161. }
  16162. } else {
  16163. for {
  16164. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  16165. break
  16166. }
  16167. c1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  16168. result *= int32(10)
  16169. result += c1 - int32(m_ASCII_02)
  16170. if result >= int32(0x110000) {
  16171. return -int32(1)
  16172. }
  16173. goto _2
  16174. _2:
  16175. ;
  16176. ptr += uintptr(1)
  16177. }
  16178. }
  16179. return _checkCharRefNumber(tls, result)
  16180. }
  16181. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  16182. _ = enc
  16183. switch (int32(end) - int32(ptr)) / libc.Int32FromInt32(1) {
  16184. case int32(2):
  16185. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t2) {
  16186. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16187. case int32(m_ASCII_l2):
  16188. return int32(m_ASCII_LT1)
  16189. case int32(m_ASCII_g2):
  16190. return int32(m_ASCII_GT1)
  16191. }
  16192. }
  16193. case int32(3):
  16194. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  16195. ptr += uintptr(1)
  16196. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  16197. ptr += uintptr(1)
  16198. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16199. return int32(m_ASCII_AMP1)
  16200. }
  16201. }
  16202. }
  16203. case int32(4):
  16204. switch int32(*(*int8)(unsafe.Pointer(ptr))) {
  16205. case int32(m_ASCII_q1):
  16206. ptr += uintptr(1)
  16207. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  16208. ptr += uintptr(1)
  16209. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16210. ptr += uintptr(1)
  16211. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  16212. return int32(m_ASCII_QUOT1)
  16213. }
  16214. }
  16215. }
  16216. case int32(m_ASCII_a2):
  16217. ptr += uintptr(1)
  16218. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  16219. ptr += uintptr(1)
  16220. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  16221. ptr += uintptr(1)
  16222. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  16223. return int32(m_ASCII_APOS1)
  16224. }
  16225. }
  16226. }
  16227. break
  16228. }
  16229. }
  16230. return 0
  16231. }
  16232. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  16233. _ = enc
  16234. for {
  16235. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  16236. break
  16237. }
  16238. if int32(end1)-int32(ptr1) < int32(1) {
  16239. /* This line cannot be executed. The incoming data has already
  16240. * been tokenized once, so incomplete characters like this have
  16241. * already been eliminated from the input. Retaining the
  16242. * paranoia check is still valuable, however.
  16243. */
  16244. return 0 /* LCOV_EXCL_LINE */
  16245. }
  16246. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  16247. return 0
  16248. }
  16249. goto _1
  16250. _1:
  16251. ;
  16252. ptr1 += uintptr(1)
  16253. ptr2++
  16254. }
  16255. return libc.BoolInt32(ptr1 == end1)
  16256. }
  16257. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  16258. var start uintptr
  16259. _ = start
  16260. start = ptr
  16261. for {
  16262. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16263. case int32(_BT_LEAD2):
  16264. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16265. case int32(_BT_LEAD3):
  16266. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16267. case int32(_BT_LEAD4):
  16268. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16269. case int32(_BT_NONASCII):
  16270. fallthrough
  16271. case int32(_BT_NMSTRT):
  16272. fallthrough
  16273. case int32(_BT_COLON):
  16274. fallthrough
  16275. case int32(_BT_HEX):
  16276. fallthrough
  16277. case int32(_BT_DIGIT):
  16278. fallthrough
  16279. case int32(_BT_NAME):
  16280. fallthrough
  16281. case int32(_BT_MINUS):
  16282. ptr += uintptr(1)
  16283. default:
  16284. return int32(ptr) - int32(start)
  16285. }
  16286. goto _1
  16287. _1:
  16288. }
  16289. return r
  16290. }
  16291. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  16292. for {
  16293. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16294. case int32(_BT_LF):
  16295. fallthrough
  16296. case int32(_BT_CR):
  16297. fallthrough
  16298. case int32(_BT_S):
  16299. ptr += uintptr(1)
  16300. default:
  16301. return ptr
  16302. }
  16303. goto _1
  16304. _1:
  16305. }
  16306. return r
  16307. }
  16308. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  16309. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) {
  16310. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) {
  16311. case int32(_BT_LEAD2):
  16312. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  16313. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16314. case int32(_BT_LEAD3):
  16315. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  16316. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16317. case int32(_BT_LEAD4):
  16318. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  16319. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16320. case int32(_BT_LF):
  16321. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  16322. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16323. ptr += uintptr(1)
  16324. case int32(_BT_CR):
  16325. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  16326. ptr += uintptr(1)
  16327. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))))) == int32(_BT_LF) {
  16328. ptr += uintptr(1)
  16329. }
  16330. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  16331. default:
  16332. ptr += uintptr(1)
  16333. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  16334. break
  16335. }
  16336. }
  16337. }
  16338. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  16339. _UTF8_cval1 = 0
  16340. const _UTF8_cval2 = 192
  16341. const _UTF8_cval3 = 224
  16342. const _UTF8_cval4 = 240
  16343. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  16344. var fromLim uintptr
  16345. var prev uint8
  16346. var walked Tsize_t
  16347. _, _, _ = fromLim, prev, walked
  16348. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  16349. walked = uint32(0)
  16350. for {
  16351. if !(fromLim > from) {
  16352. break
  16353. }
  16354. prev = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1)))))
  16355. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  16356. if walked+uint32(1) >= uint32(4) {
  16357. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  16358. break
  16359. } else {
  16360. walked = uint32(0)
  16361. }
  16362. } else {
  16363. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  16364. if walked+uint32(1) >= uint32(3) {
  16365. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  16366. break
  16367. } else {
  16368. walked = uint32(0)
  16369. }
  16370. } else {
  16371. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  16372. if walked+uint32(1) >= uint32(2) {
  16373. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  16374. break
  16375. } else {
  16376. walked = uint32(0)
  16377. }
  16378. } else {
  16379. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  16380. break
  16381. }
  16382. }
  16383. }
  16384. }
  16385. goto _1
  16386. _1:
  16387. ;
  16388. fromLim--
  16389. walked++
  16390. }
  16391. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  16392. }
  16393. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16394. bp := tls.Alloc(16)
  16395. defer tls.Free(16)
  16396. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  16397. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  16398. var fromLimBefore uintptr
  16399. var input_incomplete, output_exhausted uint8
  16400. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  16401. input_incomplete = uint8(m_false)
  16402. output_exhausted = uint8(m_false)
  16403. /* Avoid copying partial characters (due to limited space). */
  16404. bytesAvailable = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(*(*uintptr)(unsafe.Pointer(fromP)))
  16405. bytesStorable = int32(toLim) - int32(*(*uintptr)(unsafe.Pointer(toP)))
  16406. _ = enc
  16407. if bytesAvailable > bytesStorable {
  16408. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  16409. output_exhausted = uint8(m_true)
  16410. }
  16411. /* Avoid copying partial characters (from incomplete input). */
  16412. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  16413. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  16414. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  16415. input_incomplete = uint8(m_true)
  16416. }
  16417. bytesToCopy = int32(*(*uintptr)(unsafe.Pointer(bp))) - int32(*(*uintptr)(unsafe.Pointer(fromP)))
  16418. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint32FromInt32(bytesToCopy))
  16419. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  16420. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  16421. if output_exhausted != 0 { /* needs to go first */
  16422. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16423. } else {
  16424. if input_incomplete != 0 {
  16425. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16426. } else {
  16427. return int32(_XML_CONVERT_COMPLETED)
  16428. }
  16429. }
  16430. return r
  16431. }
  16432. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16433. var from, to, v1, v2, v3, v4 uintptr
  16434. var n uint32
  16435. var res _XML_Convert_Result
  16436. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  16437. res = int32(_XML_CONVERT_COMPLETED)
  16438. to = *(*uintptr)(unsafe.Pointer(toP))
  16439. from = *(*uintptr)(unsafe.Pointer(fromP))
  16440. for from < fromLim && to < toLim {
  16441. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))))) {
  16442. case int32(_BT_LEAD2):
  16443. if int32(fromLim)-int32(from) < int32(2) {
  16444. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16445. goto after
  16446. }
  16447. v1 = to
  16448. to += 2
  16449. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  16450. from += uintptr(2)
  16451. case int32(_BT_LEAD3):
  16452. if int32(fromLim)-int32(from) < int32(3) {
  16453. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16454. goto after
  16455. }
  16456. v2 = to
  16457. to += 2
  16458. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | int32(*(*int8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | int32(*(*int8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  16459. from += uintptr(3)
  16460. case int32(_BT_LEAD4):
  16461. if (int32(toLim)-int32(to))/2 < int32(2) {
  16462. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16463. goto after
  16464. }
  16465. if int32(fromLim)-int32(from) < int32(4) {
  16466. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16467. goto after
  16468. }
  16469. n = libc.Uint32FromInt32(int32(*(*int8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | int32(*(*int8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | int32(*(*int8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | int32(*(*int8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  16470. n -= uint32(0x10000)
  16471. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint32FromInt32(0xD800))
  16472. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint32FromInt32(0x3FF) | libc.Uint32FromInt32(0xDC00))
  16473. to += uintptr(2) * 2
  16474. from += uintptr(4)
  16475. default:
  16476. v3 = to
  16477. to += 2
  16478. v4 = from
  16479. from++
  16480. *(*uint16)(unsafe.Pointer(v3)) = libc.Uint16FromInt8(*(*int8)(unsafe.Pointer(v4)))
  16481. break
  16482. }
  16483. }
  16484. if from < fromLim {
  16485. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16486. }
  16487. goto after
  16488. after:
  16489. ;
  16490. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16491. *(*uintptr)(unsafe.Pointer(toP)) = to
  16492. return res
  16493. }
  16494. var _utf8_encoding_ns = Tnormal_encoding{
  16495. Fenc: TENCODING{
  16496. Fscanners: [4]TSCANNER{},
  16497. FliteralScanners: [2]TSCANNER{},
  16498. FminBytesPerChar: int32(1),
  16499. FisUtf8: int8(1),
  16500. },
  16501. Ftype1: [256]uint8{
  16502. 9: uint8(_BT_S),
  16503. 10: uint8(_BT_LF),
  16504. 13: uint8(_BT_CR),
  16505. 32: uint8(_BT_S),
  16506. 33: uint8(_BT_EXCL),
  16507. 34: uint8(_BT_QUOT),
  16508. 35: uint8(_BT_NUM),
  16509. 36: uint8(_BT_OTHER),
  16510. 37: uint8(_BT_PERCNT),
  16511. 38: uint8(_BT_AMP),
  16512. 39: uint8(_BT_APOS),
  16513. 40: uint8(_BT_LPAR),
  16514. 41: uint8(_BT_RPAR),
  16515. 42: uint8(_BT_AST),
  16516. 43: uint8(_BT_PLUS),
  16517. 44: uint8(_BT_COMMA),
  16518. 45: uint8(_BT_MINUS),
  16519. 46: uint8(_BT_NAME),
  16520. 47: uint8(_BT_SOL),
  16521. 48: uint8(_BT_DIGIT),
  16522. 49: uint8(_BT_DIGIT),
  16523. 50: uint8(_BT_DIGIT),
  16524. 51: uint8(_BT_DIGIT),
  16525. 52: uint8(_BT_DIGIT),
  16526. 53: uint8(_BT_DIGIT),
  16527. 54: uint8(_BT_DIGIT),
  16528. 55: uint8(_BT_DIGIT),
  16529. 56: uint8(_BT_DIGIT),
  16530. 57: uint8(_BT_DIGIT),
  16531. 58: uint8(_BT_COLON),
  16532. 59: uint8(_BT_SEMI),
  16533. 60: uint8(_BT_LT),
  16534. 61: uint8(_BT_EQUALS),
  16535. 62: uint8(_BT_GT),
  16536. 63: uint8(_BT_QUEST),
  16537. 64: uint8(_BT_OTHER),
  16538. 65: uint8(_BT_HEX),
  16539. 66: uint8(_BT_HEX),
  16540. 67: uint8(_BT_HEX),
  16541. 68: uint8(_BT_HEX),
  16542. 69: uint8(_BT_HEX),
  16543. 70: uint8(_BT_HEX),
  16544. 71: uint8(_BT_NMSTRT),
  16545. 72: uint8(_BT_NMSTRT),
  16546. 73: uint8(_BT_NMSTRT),
  16547. 74: uint8(_BT_NMSTRT),
  16548. 75: uint8(_BT_NMSTRT),
  16549. 76: uint8(_BT_NMSTRT),
  16550. 77: uint8(_BT_NMSTRT),
  16551. 78: uint8(_BT_NMSTRT),
  16552. 79: uint8(_BT_NMSTRT),
  16553. 80: uint8(_BT_NMSTRT),
  16554. 81: uint8(_BT_NMSTRT),
  16555. 82: uint8(_BT_NMSTRT),
  16556. 83: uint8(_BT_NMSTRT),
  16557. 84: uint8(_BT_NMSTRT),
  16558. 85: uint8(_BT_NMSTRT),
  16559. 86: uint8(_BT_NMSTRT),
  16560. 87: uint8(_BT_NMSTRT),
  16561. 88: uint8(_BT_NMSTRT),
  16562. 89: uint8(_BT_NMSTRT),
  16563. 90: uint8(_BT_NMSTRT),
  16564. 91: uint8(_BT_LSQB),
  16565. 92: uint8(_BT_OTHER),
  16566. 93: uint8(_BT_RSQB),
  16567. 94: uint8(_BT_OTHER),
  16568. 95: uint8(_BT_NMSTRT),
  16569. 96: uint8(_BT_OTHER),
  16570. 97: uint8(_BT_HEX),
  16571. 98: uint8(_BT_HEX),
  16572. 99: uint8(_BT_HEX),
  16573. 100: uint8(_BT_HEX),
  16574. 101: uint8(_BT_HEX),
  16575. 102: uint8(_BT_HEX),
  16576. 103: uint8(_BT_NMSTRT),
  16577. 104: uint8(_BT_NMSTRT),
  16578. 105: uint8(_BT_NMSTRT),
  16579. 106: uint8(_BT_NMSTRT),
  16580. 107: uint8(_BT_NMSTRT),
  16581. 108: uint8(_BT_NMSTRT),
  16582. 109: uint8(_BT_NMSTRT),
  16583. 110: uint8(_BT_NMSTRT),
  16584. 111: uint8(_BT_NMSTRT),
  16585. 112: uint8(_BT_NMSTRT),
  16586. 113: uint8(_BT_NMSTRT),
  16587. 114: uint8(_BT_NMSTRT),
  16588. 115: uint8(_BT_NMSTRT),
  16589. 116: uint8(_BT_NMSTRT),
  16590. 117: uint8(_BT_NMSTRT),
  16591. 118: uint8(_BT_NMSTRT),
  16592. 119: uint8(_BT_NMSTRT),
  16593. 120: uint8(_BT_NMSTRT),
  16594. 121: uint8(_BT_NMSTRT),
  16595. 122: uint8(_BT_NMSTRT),
  16596. 123: uint8(_BT_OTHER),
  16597. 124: uint8(_BT_VERBAR),
  16598. 125: uint8(_BT_OTHER),
  16599. 126: uint8(_BT_OTHER),
  16600. 127: uint8(_BT_OTHER),
  16601. 128: uint8(_BT_TRAIL),
  16602. 129: uint8(_BT_TRAIL),
  16603. 130: uint8(_BT_TRAIL),
  16604. 131: uint8(_BT_TRAIL),
  16605. 132: uint8(_BT_TRAIL),
  16606. 133: uint8(_BT_TRAIL),
  16607. 134: uint8(_BT_TRAIL),
  16608. 135: uint8(_BT_TRAIL),
  16609. 136: uint8(_BT_TRAIL),
  16610. 137: uint8(_BT_TRAIL),
  16611. 138: uint8(_BT_TRAIL),
  16612. 139: uint8(_BT_TRAIL),
  16613. 140: uint8(_BT_TRAIL),
  16614. 141: uint8(_BT_TRAIL),
  16615. 142: uint8(_BT_TRAIL),
  16616. 143: uint8(_BT_TRAIL),
  16617. 144: uint8(_BT_TRAIL),
  16618. 145: uint8(_BT_TRAIL),
  16619. 146: uint8(_BT_TRAIL),
  16620. 147: uint8(_BT_TRAIL),
  16621. 148: uint8(_BT_TRAIL),
  16622. 149: uint8(_BT_TRAIL),
  16623. 150: uint8(_BT_TRAIL),
  16624. 151: uint8(_BT_TRAIL),
  16625. 152: uint8(_BT_TRAIL),
  16626. 153: uint8(_BT_TRAIL),
  16627. 154: uint8(_BT_TRAIL),
  16628. 155: uint8(_BT_TRAIL),
  16629. 156: uint8(_BT_TRAIL),
  16630. 157: uint8(_BT_TRAIL),
  16631. 158: uint8(_BT_TRAIL),
  16632. 159: uint8(_BT_TRAIL),
  16633. 160: uint8(_BT_TRAIL),
  16634. 161: uint8(_BT_TRAIL),
  16635. 162: uint8(_BT_TRAIL),
  16636. 163: uint8(_BT_TRAIL),
  16637. 164: uint8(_BT_TRAIL),
  16638. 165: uint8(_BT_TRAIL),
  16639. 166: uint8(_BT_TRAIL),
  16640. 167: uint8(_BT_TRAIL),
  16641. 168: uint8(_BT_TRAIL),
  16642. 169: uint8(_BT_TRAIL),
  16643. 170: uint8(_BT_TRAIL),
  16644. 171: uint8(_BT_TRAIL),
  16645. 172: uint8(_BT_TRAIL),
  16646. 173: uint8(_BT_TRAIL),
  16647. 174: uint8(_BT_TRAIL),
  16648. 175: uint8(_BT_TRAIL),
  16649. 176: uint8(_BT_TRAIL),
  16650. 177: uint8(_BT_TRAIL),
  16651. 178: uint8(_BT_TRAIL),
  16652. 179: uint8(_BT_TRAIL),
  16653. 180: uint8(_BT_TRAIL),
  16654. 181: uint8(_BT_TRAIL),
  16655. 182: uint8(_BT_TRAIL),
  16656. 183: uint8(_BT_TRAIL),
  16657. 184: uint8(_BT_TRAIL),
  16658. 185: uint8(_BT_TRAIL),
  16659. 186: uint8(_BT_TRAIL),
  16660. 187: uint8(_BT_TRAIL),
  16661. 188: uint8(_BT_TRAIL),
  16662. 189: uint8(_BT_TRAIL),
  16663. 190: uint8(_BT_TRAIL),
  16664. 191: uint8(_BT_TRAIL),
  16665. 192: uint8(_BT_LEAD2),
  16666. 193: uint8(_BT_LEAD2),
  16667. 194: uint8(_BT_LEAD2),
  16668. 195: uint8(_BT_LEAD2),
  16669. 196: uint8(_BT_LEAD2),
  16670. 197: uint8(_BT_LEAD2),
  16671. 198: uint8(_BT_LEAD2),
  16672. 199: uint8(_BT_LEAD2),
  16673. 200: uint8(_BT_LEAD2),
  16674. 201: uint8(_BT_LEAD2),
  16675. 202: uint8(_BT_LEAD2),
  16676. 203: uint8(_BT_LEAD2),
  16677. 204: uint8(_BT_LEAD2),
  16678. 205: uint8(_BT_LEAD2),
  16679. 206: uint8(_BT_LEAD2),
  16680. 207: uint8(_BT_LEAD2),
  16681. 208: uint8(_BT_LEAD2),
  16682. 209: uint8(_BT_LEAD2),
  16683. 210: uint8(_BT_LEAD2),
  16684. 211: uint8(_BT_LEAD2),
  16685. 212: uint8(_BT_LEAD2),
  16686. 213: uint8(_BT_LEAD2),
  16687. 214: uint8(_BT_LEAD2),
  16688. 215: uint8(_BT_LEAD2),
  16689. 216: uint8(_BT_LEAD2),
  16690. 217: uint8(_BT_LEAD2),
  16691. 218: uint8(_BT_LEAD2),
  16692. 219: uint8(_BT_LEAD2),
  16693. 220: uint8(_BT_LEAD2),
  16694. 221: uint8(_BT_LEAD2),
  16695. 222: uint8(_BT_LEAD2),
  16696. 223: uint8(_BT_LEAD2),
  16697. 224: uint8(_BT_LEAD3),
  16698. 225: uint8(_BT_LEAD3),
  16699. 226: uint8(_BT_LEAD3),
  16700. 227: uint8(_BT_LEAD3),
  16701. 228: uint8(_BT_LEAD3),
  16702. 229: uint8(_BT_LEAD3),
  16703. 230: uint8(_BT_LEAD3),
  16704. 231: uint8(_BT_LEAD3),
  16705. 232: uint8(_BT_LEAD3),
  16706. 233: uint8(_BT_LEAD3),
  16707. 234: uint8(_BT_LEAD3),
  16708. 235: uint8(_BT_LEAD3),
  16709. 236: uint8(_BT_LEAD3),
  16710. 237: uint8(_BT_LEAD3),
  16711. 238: uint8(_BT_LEAD3),
  16712. 239: uint8(_BT_LEAD3),
  16713. 240: uint8(_BT_LEAD4),
  16714. 241: uint8(_BT_LEAD4),
  16715. 242: uint8(_BT_LEAD4),
  16716. 243: uint8(_BT_LEAD4),
  16717. 244: uint8(_BT_LEAD4),
  16718. 254: uint8(_BT_MALFORM),
  16719. 255: uint8(_BT_MALFORM),
  16720. },
  16721. }
  16722. func init() {
  16723. p := unsafe.Pointer(&_utf8_encoding_ns)
  16724. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16725. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  16726. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  16727. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  16728. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  16729. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  16730. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  16731. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  16732. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  16733. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  16734. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  16735. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  16736. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  16737. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  16738. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  16739. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  16740. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  16741. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  16742. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  16743. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  16744. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  16745. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  16746. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  16747. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  16748. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  16749. }
  16750. var _utf8_encoding = Tnormal_encoding{
  16751. Fenc: TENCODING{
  16752. Fscanners: [4]TSCANNER{},
  16753. FliteralScanners: [2]TSCANNER{},
  16754. FminBytesPerChar: int32(1),
  16755. FisUtf8: int8(1),
  16756. },
  16757. Ftype1: [256]uint8{
  16758. 9: uint8(_BT_S),
  16759. 10: uint8(_BT_LF),
  16760. 13: uint8(_BT_CR),
  16761. 32: uint8(_BT_S),
  16762. 33: uint8(_BT_EXCL),
  16763. 34: uint8(_BT_QUOT),
  16764. 35: uint8(_BT_NUM),
  16765. 36: uint8(_BT_OTHER),
  16766. 37: uint8(_BT_PERCNT),
  16767. 38: uint8(_BT_AMP),
  16768. 39: uint8(_BT_APOS),
  16769. 40: uint8(_BT_LPAR),
  16770. 41: uint8(_BT_RPAR),
  16771. 42: uint8(_BT_AST),
  16772. 43: uint8(_BT_PLUS),
  16773. 44: uint8(_BT_COMMA),
  16774. 45: uint8(_BT_MINUS),
  16775. 46: uint8(_BT_NAME),
  16776. 47: uint8(_BT_SOL),
  16777. 48: uint8(_BT_DIGIT),
  16778. 49: uint8(_BT_DIGIT),
  16779. 50: uint8(_BT_DIGIT),
  16780. 51: uint8(_BT_DIGIT),
  16781. 52: uint8(_BT_DIGIT),
  16782. 53: uint8(_BT_DIGIT),
  16783. 54: uint8(_BT_DIGIT),
  16784. 55: uint8(_BT_DIGIT),
  16785. 56: uint8(_BT_DIGIT),
  16786. 57: uint8(_BT_DIGIT),
  16787. 58: uint8(_BT_NMSTRT),
  16788. 59: uint8(_BT_SEMI),
  16789. 60: uint8(_BT_LT),
  16790. 61: uint8(_BT_EQUALS),
  16791. 62: uint8(_BT_GT),
  16792. 63: uint8(_BT_QUEST),
  16793. 64: uint8(_BT_OTHER),
  16794. 65: uint8(_BT_HEX),
  16795. 66: uint8(_BT_HEX),
  16796. 67: uint8(_BT_HEX),
  16797. 68: uint8(_BT_HEX),
  16798. 69: uint8(_BT_HEX),
  16799. 70: uint8(_BT_HEX),
  16800. 71: uint8(_BT_NMSTRT),
  16801. 72: uint8(_BT_NMSTRT),
  16802. 73: uint8(_BT_NMSTRT),
  16803. 74: uint8(_BT_NMSTRT),
  16804. 75: uint8(_BT_NMSTRT),
  16805. 76: uint8(_BT_NMSTRT),
  16806. 77: uint8(_BT_NMSTRT),
  16807. 78: uint8(_BT_NMSTRT),
  16808. 79: uint8(_BT_NMSTRT),
  16809. 80: uint8(_BT_NMSTRT),
  16810. 81: uint8(_BT_NMSTRT),
  16811. 82: uint8(_BT_NMSTRT),
  16812. 83: uint8(_BT_NMSTRT),
  16813. 84: uint8(_BT_NMSTRT),
  16814. 85: uint8(_BT_NMSTRT),
  16815. 86: uint8(_BT_NMSTRT),
  16816. 87: uint8(_BT_NMSTRT),
  16817. 88: uint8(_BT_NMSTRT),
  16818. 89: uint8(_BT_NMSTRT),
  16819. 90: uint8(_BT_NMSTRT),
  16820. 91: uint8(_BT_LSQB),
  16821. 92: uint8(_BT_OTHER),
  16822. 93: uint8(_BT_RSQB),
  16823. 94: uint8(_BT_OTHER),
  16824. 95: uint8(_BT_NMSTRT),
  16825. 96: uint8(_BT_OTHER),
  16826. 97: uint8(_BT_HEX),
  16827. 98: uint8(_BT_HEX),
  16828. 99: uint8(_BT_HEX),
  16829. 100: uint8(_BT_HEX),
  16830. 101: uint8(_BT_HEX),
  16831. 102: uint8(_BT_HEX),
  16832. 103: uint8(_BT_NMSTRT),
  16833. 104: uint8(_BT_NMSTRT),
  16834. 105: uint8(_BT_NMSTRT),
  16835. 106: uint8(_BT_NMSTRT),
  16836. 107: uint8(_BT_NMSTRT),
  16837. 108: uint8(_BT_NMSTRT),
  16838. 109: uint8(_BT_NMSTRT),
  16839. 110: uint8(_BT_NMSTRT),
  16840. 111: uint8(_BT_NMSTRT),
  16841. 112: uint8(_BT_NMSTRT),
  16842. 113: uint8(_BT_NMSTRT),
  16843. 114: uint8(_BT_NMSTRT),
  16844. 115: uint8(_BT_NMSTRT),
  16845. 116: uint8(_BT_NMSTRT),
  16846. 117: uint8(_BT_NMSTRT),
  16847. 118: uint8(_BT_NMSTRT),
  16848. 119: uint8(_BT_NMSTRT),
  16849. 120: uint8(_BT_NMSTRT),
  16850. 121: uint8(_BT_NMSTRT),
  16851. 122: uint8(_BT_NMSTRT),
  16852. 123: uint8(_BT_OTHER),
  16853. 124: uint8(_BT_VERBAR),
  16854. 125: uint8(_BT_OTHER),
  16855. 126: uint8(_BT_OTHER),
  16856. 127: uint8(_BT_OTHER),
  16857. 128: uint8(_BT_TRAIL),
  16858. 129: uint8(_BT_TRAIL),
  16859. 130: uint8(_BT_TRAIL),
  16860. 131: uint8(_BT_TRAIL),
  16861. 132: uint8(_BT_TRAIL),
  16862. 133: uint8(_BT_TRAIL),
  16863. 134: uint8(_BT_TRAIL),
  16864. 135: uint8(_BT_TRAIL),
  16865. 136: uint8(_BT_TRAIL),
  16866. 137: uint8(_BT_TRAIL),
  16867. 138: uint8(_BT_TRAIL),
  16868. 139: uint8(_BT_TRAIL),
  16869. 140: uint8(_BT_TRAIL),
  16870. 141: uint8(_BT_TRAIL),
  16871. 142: uint8(_BT_TRAIL),
  16872. 143: uint8(_BT_TRAIL),
  16873. 144: uint8(_BT_TRAIL),
  16874. 145: uint8(_BT_TRAIL),
  16875. 146: uint8(_BT_TRAIL),
  16876. 147: uint8(_BT_TRAIL),
  16877. 148: uint8(_BT_TRAIL),
  16878. 149: uint8(_BT_TRAIL),
  16879. 150: uint8(_BT_TRAIL),
  16880. 151: uint8(_BT_TRAIL),
  16881. 152: uint8(_BT_TRAIL),
  16882. 153: uint8(_BT_TRAIL),
  16883. 154: uint8(_BT_TRAIL),
  16884. 155: uint8(_BT_TRAIL),
  16885. 156: uint8(_BT_TRAIL),
  16886. 157: uint8(_BT_TRAIL),
  16887. 158: uint8(_BT_TRAIL),
  16888. 159: uint8(_BT_TRAIL),
  16889. 160: uint8(_BT_TRAIL),
  16890. 161: uint8(_BT_TRAIL),
  16891. 162: uint8(_BT_TRAIL),
  16892. 163: uint8(_BT_TRAIL),
  16893. 164: uint8(_BT_TRAIL),
  16894. 165: uint8(_BT_TRAIL),
  16895. 166: uint8(_BT_TRAIL),
  16896. 167: uint8(_BT_TRAIL),
  16897. 168: uint8(_BT_TRAIL),
  16898. 169: uint8(_BT_TRAIL),
  16899. 170: uint8(_BT_TRAIL),
  16900. 171: uint8(_BT_TRAIL),
  16901. 172: uint8(_BT_TRAIL),
  16902. 173: uint8(_BT_TRAIL),
  16903. 174: uint8(_BT_TRAIL),
  16904. 175: uint8(_BT_TRAIL),
  16905. 176: uint8(_BT_TRAIL),
  16906. 177: uint8(_BT_TRAIL),
  16907. 178: uint8(_BT_TRAIL),
  16908. 179: uint8(_BT_TRAIL),
  16909. 180: uint8(_BT_TRAIL),
  16910. 181: uint8(_BT_TRAIL),
  16911. 182: uint8(_BT_TRAIL),
  16912. 183: uint8(_BT_TRAIL),
  16913. 184: uint8(_BT_TRAIL),
  16914. 185: uint8(_BT_TRAIL),
  16915. 186: uint8(_BT_TRAIL),
  16916. 187: uint8(_BT_TRAIL),
  16917. 188: uint8(_BT_TRAIL),
  16918. 189: uint8(_BT_TRAIL),
  16919. 190: uint8(_BT_TRAIL),
  16920. 191: uint8(_BT_TRAIL),
  16921. 192: uint8(_BT_LEAD2),
  16922. 193: uint8(_BT_LEAD2),
  16923. 194: uint8(_BT_LEAD2),
  16924. 195: uint8(_BT_LEAD2),
  16925. 196: uint8(_BT_LEAD2),
  16926. 197: uint8(_BT_LEAD2),
  16927. 198: uint8(_BT_LEAD2),
  16928. 199: uint8(_BT_LEAD2),
  16929. 200: uint8(_BT_LEAD2),
  16930. 201: uint8(_BT_LEAD2),
  16931. 202: uint8(_BT_LEAD2),
  16932. 203: uint8(_BT_LEAD2),
  16933. 204: uint8(_BT_LEAD2),
  16934. 205: uint8(_BT_LEAD2),
  16935. 206: uint8(_BT_LEAD2),
  16936. 207: uint8(_BT_LEAD2),
  16937. 208: uint8(_BT_LEAD2),
  16938. 209: uint8(_BT_LEAD2),
  16939. 210: uint8(_BT_LEAD2),
  16940. 211: uint8(_BT_LEAD2),
  16941. 212: uint8(_BT_LEAD2),
  16942. 213: uint8(_BT_LEAD2),
  16943. 214: uint8(_BT_LEAD2),
  16944. 215: uint8(_BT_LEAD2),
  16945. 216: uint8(_BT_LEAD2),
  16946. 217: uint8(_BT_LEAD2),
  16947. 218: uint8(_BT_LEAD2),
  16948. 219: uint8(_BT_LEAD2),
  16949. 220: uint8(_BT_LEAD2),
  16950. 221: uint8(_BT_LEAD2),
  16951. 222: uint8(_BT_LEAD2),
  16952. 223: uint8(_BT_LEAD2),
  16953. 224: uint8(_BT_LEAD3),
  16954. 225: uint8(_BT_LEAD3),
  16955. 226: uint8(_BT_LEAD3),
  16956. 227: uint8(_BT_LEAD3),
  16957. 228: uint8(_BT_LEAD3),
  16958. 229: uint8(_BT_LEAD3),
  16959. 230: uint8(_BT_LEAD3),
  16960. 231: uint8(_BT_LEAD3),
  16961. 232: uint8(_BT_LEAD3),
  16962. 233: uint8(_BT_LEAD3),
  16963. 234: uint8(_BT_LEAD3),
  16964. 235: uint8(_BT_LEAD3),
  16965. 236: uint8(_BT_LEAD3),
  16966. 237: uint8(_BT_LEAD3),
  16967. 238: uint8(_BT_LEAD3),
  16968. 239: uint8(_BT_LEAD3),
  16969. 240: uint8(_BT_LEAD4),
  16970. 241: uint8(_BT_LEAD4),
  16971. 242: uint8(_BT_LEAD4),
  16972. 243: uint8(_BT_LEAD4),
  16973. 244: uint8(_BT_LEAD4),
  16974. 254: uint8(_BT_MALFORM),
  16975. 255: uint8(_BT_MALFORM),
  16976. },
  16977. }
  16978. func init() {
  16979. p := unsafe.Pointer(&_utf8_encoding)
  16980. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  16981. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  16982. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  16983. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  16984. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  16985. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  16986. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  16987. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  16988. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  16989. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  16990. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  16991. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  16992. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  16993. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  16994. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  16995. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  16996. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  16997. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  16998. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  16999. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  17000. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  17001. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  17002. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  17003. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  17004. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  17005. }
  17006. var _internal_utf8_encoding_ns = Tnormal_encoding{
  17007. Fenc: TENCODING{
  17008. Fscanners: [4]TSCANNER{},
  17009. FliteralScanners: [2]TSCANNER{},
  17010. FminBytesPerChar: int32(1),
  17011. FisUtf8: int8(1),
  17012. },
  17013. Ftype1: [256]uint8{
  17014. 9: uint8(_BT_S),
  17015. 10: uint8(_BT_LF),
  17016. 13: uint8(_BT_S),
  17017. 32: uint8(_BT_S),
  17018. 33: uint8(_BT_EXCL),
  17019. 34: uint8(_BT_QUOT),
  17020. 35: uint8(_BT_NUM),
  17021. 36: uint8(_BT_OTHER),
  17022. 37: uint8(_BT_PERCNT),
  17023. 38: uint8(_BT_AMP),
  17024. 39: uint8(_BT_APOS),
  17025. 40: uint8(_BT_LPAR),
  17026. 41: uint8(_BT_RPAR),
  17027. 42: uint8(_BT_AST),
  17028. 43: uint8(_BT_PLUS),
  17029. 44: uint8(_BT_COMMA),
  17030. 45: uint8(_BT_MINUS),
  17031. 46: uint8(_BT_NAME),
  17032. 47: uint8(_BT_SOL),
  17033. 48: uint8(_BT_DIGIT),
  17034. 49: uint8(_BT_DIGIT),
  17035. 50: uint8(_BT_DIGIT),
  17036. 51: uint8(_BT_DIGIT),
  17037. 52: uint8(_BT_DIGIT),
  17038. 53: uint8(_BT_DIGIT),
  17039. 54: uint8(_BT_DIGIT),
  17040. 55: uint8(_BT_DIGIT),
  17041. 56: uint8(_BT_DIGIT),
  17042. 57: uint8(_BT_DIGIT),
  17043. 58: uint8(_BT_COLON),
  17044. 59: uint8(_BT_SEMI),
  17045. 60: uint8(_BT_LT),
  17046. 61: uint8(_BT_EQUALS),
  17047. 62: uint8(_BT_GT),
  17048. 63: uint8(_BT_QUEST),
  17049. 64: uint8(_BT_OTHER),
  17050. 65: uint8(_BT_HEX),
  17051. 66: uint8(_BT_HEX),
  17052. 67: uint8(_BT_HEX),
  17053. 68: uint8(_BT_HEX),
  17054. 69: uint8(_BT_HEX),
  17055. 70: uint8(_BT_HEX),
  17056. 71: uint8(_BT_NMSTRT),
  17057. 72: uint8(_BT_NMSTRT),
  17058. 73: uint8(_BT_NMSTRT),
  17059. 74: uint8(_BT_NMSTRT),
  17060. 75: uint8(_BT_NMSTRT),
  17061. 76: uint8(_BT_NMSTRT),
  17062. 77: uint8(_BT_NMSTRT),
  17063. 78: uint8(_BT_NMSTRT),
  17064. 79: uint8(_BT_NMSTRT),
  17065. 80: uint8(_BT_NMSTRT),
  17066. 81: uint8(_BT_NMSTRT),
  17067. 82: uint8(_BT_NMSTRT),
  17068. 83: uint8(_BT_NMSTRT),
  17069. 84: uint8(_BT_NMSTRT),
  17070. 85: uint8(_BT_NMSTRT),
  17071. 86: uint8(_BT_NMSTRT),
  17072. 87: uint8(_BT_NMSTRT),
  17073. 88: uint8(_BT_NMSTRT),
  17074. 89: uint8(_BT_NMSTRT),
  17075. 90: uint8(_BT_NMSTRT),
  17076. 91: uint8(_BT_LSQB),
  17077. 92: uint8(_BT_OTHER),
  17078. 93: uint8(_BT_RSQB),
  17079. 94: uint8(_BT_OTHER),
  17080. 95: uint8(_BT_NMSTRT),
  17081. 96: uint8(_BT_OTHER),
  17082. 97: uint8(_BT_HEX),
  17083. 98: uint8(_BT_HEX),
  17084. 99: uint8(_BT_HEX),
  17085. 100: uint8(_BT_HEX),
  17086. 101: uint8(_BT_HEX),
  17087. 102: uint8(_BT_HEX),
  17088. 103: uint8(_BT_NMSTRT),
  17089. 104: uint8(_BT_NMSTRT),
  17090. 105: uint8(_BT_NMSTRT),
  17091. 106: uint8(_BT_NMSTRT),
  17092. 107: uint8(_BT_NMSTRT),
  17093. 108: uint8(_BT_NMSTRT),
  17094. 109: uint8(_BT_NMSTRT),
  17095. 110: uint8(_BT_NMSTRT),
  17096. 111: uint8(_BT_NMSTRT),
  17097. 112: uint8(_BT_NMSTRT),
  17098. 113: uint8(_BT_NMSTRT),
  17099. 114: uint8(_BT_NMSTRT),
  17100. 115: uint8(_BT_NMSTRT),
  17101. 116: uint8(_BT_NMSTRT),
  17102. 117: uint8(_BT_NMSTRT),
  17103. 118: uint8(_BT_NMSTRT),
  17104. 119: uint8(_BT_NMSTRT),
  17105. 120: uint8(_BT_NMSTRT),
  17106. 121: uint8(_BT_NMSTRT),
  17107. 122: uint8(_BT_NMSTRT),
  17108. 123: uint8(_BT_OTHER),
  17109. 124: uint8(_BT_VERBAR),
  17110. 125: uint8(_BT_OTHER),
  17111. 126: uint8(_BT_OTHER),
  17112. 127: uint8(_BT_OTHER),
  17113. 128: uint8(_BT_TRAIL),
  17114. 129: uint8(_BT_TRAIL),
  17115. 130: uint8(_BT_TRAIL),
  17116. 131: uint8(_BT_TRAIL),
  17117. 132: uint8(_BT_TRAIL),
  17118. 133: uint8(_BT_TRAIL),
  17119. 134: uint8(_BT_TRAIL),
  17120. 135: uint8(_BT_TRAIL),
  17121. 136: uint8(_BT_TRAIL),
  17122. 137: uint8(_BT_TRAIL),
  17123. 138: uint8(_BT_TRAIL),
  17124. 139: uint8(_BT_TRAIL),
  17125. 140: uint8(_BT_TRAIL),
  17126. 141: uint8(_BT_TRAIL),
  17127. 142: uint8(_BT_TRAIL),
  17128. 143: uint8(_BT_TRAIL),
  17129. 144: uint8(_BT_TRAIL),
  17130. 145: uint8(_BT_TRAIL),
  17131. 146: uint8(_BT_TRAIL),
  17132. 147: uint8(_BT_TRAIL),
  17133. 148: uint8(_BT_TRAIL),
  17134. 149: uint8(_BT_TRAIL),
  17135. 150: uint8(_BT_TRAIL),
  17136. 151: uint8(_BT_TRAIL),
  17137. 152: uint8(_BT_TRAIL),
  17138. 153: uint8(_BT_TRAIL),
  17139. 154: uint8(_BT_TRAIL),
  17140. 155: uint8(_BT_TRAIL),
  17141. 156: uint8(_BT_TRAIL),
  17142. 157: uint8(_BT_TRAIL),
  17143. 158: uint8(_BT_TRAIL),
  17144. 159: uint8(_BT_TRAIL),
  17145. 160: uint8(_BT_TRAIL),
  17146. 161: uint8(_BT_TRAIL),
  17147. 162: uint8(_BT_TRAIL),
  17148. 163: uint8(_BT_TRAIL),
  17149. 164: uint8(_BT_TRAIL),
  17150. 165: uint8(_BT_TRAIL),
  17151. 166: uint8(_BT_TRAIL),
  17152. 167: uint8(_BT_TRAIL),
  17153. 168: uint8(_BT_TRAIL),
  17154. 169: uint8(_BT_TRAIL),
  17155. 170: uint8(_BT_TRAIL),
  17156. 171: uint8(_BT_TRAIL),
  17157. 172: uint8(_BT_TRAIL),
  17158. 173: uint8(_BT_TRAIL),
  17159. 174: uint8(_BT_TRAIL),
  17160. 175: uint8(_BT_TRAIL),
  17161. 176: uint8(_BT_TRAIL),
  17162. 177: uint8(_BT_TRAIL),
  17163. 178: uint8(_BT_TRAIL),
  17164. 179: uint8(_BT_TRAIL),
  17165. 180: uint8(_BT_TRAIL),
  17166. 181: uint8(_BT_TRAIL),
  17167. 182: uint8(_BT_TRAIL),
  17168. 183: uint8(_BT_TRAIL),
  17169. 184: uint8(_BT_TRAIL),
  17170. 185: uint8(_BT_TRAIL),
  17171. 186: uint8(_BT_TRAIL),
  17172. 187: uint8(_BT_TRAIL),
  17173. 188: uint8(_BT_TRAIL),
  17174. 189: uint8(_BT_TRAIL),
  17175. 190: uint8(_BT_TRAIL),
  17176. 191: uint8(_BT_TRAIL),
  17177. 192: uint8(_BT_LEAD2),
  17178. 193: uint8(_BT_LEAD2),
  17179. 194: uint8(_BT_LEAD2),
  17180. 195: uint8(_BT_LEAD2),
  17181. 196: uint8(_BT_LEAD2),
  17182. 197: uint8(_BT_LEAD2),
  17183. 198: uint8(_BT_LEAD2),
  17184. 199: uint8(_BT_LEAD2),
  17185. 200: uint8(_BT_LEAD2),
  17186. 201: uint8(_BT_LEAD2),
  17187. 202: uint8(_BT_LEAD2),
  17188. 203: uint8(_BT_LEAD2),
  17189. 204: uint8(_BT_LEAD2),
  17190. 205: uint8(_BT_LEAD2),
  17191. 206: uint8(_BT_LEAD2),
  17192. 207: uint8(_BT_LEAD2),
  17193. 208: uint8(_BT_LEAD2),
  17194. 209: uint8(_BT_LEAD2),
  17195. 210: uint8(_BT_LEAD2),
  17196. 211: uint8(_BT_LEAD2),
  17197. 212: uint8(_BT_LEAD2),
  17198. 213: uint8(_BT_LEAD2),
  17199. 214: uint8(_BT_LEAD2),
  17200. 215: uint8(_BT_LEAD2),
  17201. 216: uint8(_BT_LEAD2),
  17202. 217: uint8(_BT_LEAD2),
  17203. 218: uint8(_BT_LEAD2),
  17204. 219: uint8(_BT_LEAD2),
  17205. 220: uint8(_BT_LEAD2),
  17206. 221: uint8(_BT_LEAD2),
  17207. 222: uint8(_BT_LEAD2),
  17208. 223: uint8(_BT_LEAD2),
  17209. 224: uint8(_BT_LEAD3),
  17210. 225: uint8(_BT_LEAD3),
  17211. 226: uint8(_BT_LEAD3),
  17212. 227: uint8(_BT_LEAD3),
  17213. 228: uint8(_BT_LEAD3),
  17214. 229: uint8(_BT_LEAD3),
  17215. 230: uint8(_BT_LEAD3),
  17216. 231: uint8(_BT_LEAD3),
  17217. 232: uint8(_BT_LEAD3),
  17218. 233: uint8(_BT_LEAD3),
  17219. 234: uint8(_BT_LEAD3),
  17220. 235: uint8(_BT_LEAD3),
  17221. 236: uint8(_BT_LEAD3),
  17222. 237: uint8(_BT_LEAD3),
  17223. 238: uint8(_BT_LEAD3),
  17224. 239: uint8(_BT_LEAD3),
  17225. 240: uint8(_BT_LEAD4),
  17226. 241: uint8(_BT_LEAD4),
  17227. 242: uint8(_BT_LEAD4),
  17228. 243: uint8(_BT_LEAD4),
  17229. 244: uint8(_BT_LEAD4),
  17230. 254: uint8(_BT_MALFORM),
  17231. 255: uint8(_BT_MALFORM),
  17232. },
  17233. }
  17234. func init() {
  17235. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  17236. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17237. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17238. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17239. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17240. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17241. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17242. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17243. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17244. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17245. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17246. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17247. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17248. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17249. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17250. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  17251. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  17252. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  17253. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  17254. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  17255. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  17256. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  17257. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  17258. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  17259. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  17260. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  17261. }
  17262. var _internal_utf8_encoding = Tnormal_encoding{
  17263. Fenc: TENCODING{
  17264. Fscanners: [4]TSCANNER{},
  17265. FliteralScanners: [2]TSCANNER{},
  17266. FminBytesPerChar: int32(1),
  17267. FisUtf8: int8(1),
  17268. },
  17269. Ftype1: [256]uint8{
  17270. 9: uint8(_BT_S),
  17271. 10: uint8(_BT_LF),
  17272. 13: uint8(_BT_S),
  17273. 32: uint8(_BT_S),
  17274. 33: uint8(_BT_EXCL),
  17275. 34: uint8(_BT_QUOT),
  17276. 35: uint8(_BT_NUM),
  17277. 36: uint8(_BT_OTHER),
  17278. 37: uint8(_BT_PERCNT),
  17279. 38: uint8(_BT_AMP),
  17280. 39: uint8(_BT_APOS),
  17281. 40: uint8(_BT_LPAR),
  17282. 41: uint8(_BT_RPAR),
  17283. 42: uint8(_BT_AST),
  17284. 43: uint8(_BT_PLUS),
  17285. 44: uint8(_BT_COMMA),
  17286. 45: uint8(_BT_MINUS),
  17287. 46: uint8(_BT_NAME),
  17288. 47: uint8(_BT_SOL),
  17289. 48: uint8(_BT_DIGIT),
  17290. 49: uint8(_BT_DIGIT),
  17291. 50: uint8(_BT_DIGIT),
  17292. 51: uint8(_BT_DIGIT),
  17293. 52: uint8(_BT_DIGIT),
  17294. 53: uint8(_BT_DIGIT),
  17295. 54: uint8(_BT_DIGIT),
  17296. 55: uint8(_BT_DIGIT),
  17297. 56: uint8(_BT_DIGIT),
  17298. 57: uint8(_BT_DIGIT),
  17299. 58: uint8(_BT_NMSTRT),
  17300. 59: uint8(_BT_SEMI),
  17301. 60: uint8(_BT_LT),
  17302. 61: uint8(_BT_EQUALS),
  17303. 62: uint8(_BT_GT),
  17304. 63: uint8(_BT_QUEST),
  17305. 64: uint8(_BT_OTHER),
  17306. 65: uint8(_BT_HEX),
  17307. 66: uint8(_BT_HEX),
  17308. 67: uint8(_BT_HEX),
  17309. 68: uint8(_BT_HEX),
  17310. 69: uint8(_BT_HEX),
  17311. 70: uint8(_BT_HEX),
  17312. 71: uint8(_BT_NMSTRT),
  17313. 72: uint8(_BT_NMSTRT),
  17314. 73: uint8(_BT_NMSTRT),
  17315. 74: uint8(_BT_NMSTRT),
  17316. 75: uint8(_BT_NMSTRT),
  17317. 76: uint8(_BT_NMSTRT),
  17318. 77: uint8(_BT_NMSTRT),
  17319. 78: uint8(_BT_NMSTRT),
  17320. 79: uint8(_BT_NMSTRT),
  17321. 80: uint8(_BT_NMSTRT),
  17322. 81: uint8(_BT_NMSTRT),
  17323. 82: uint8(_BT_NMSTRT),
  17324. 83: uint8(_BT_NMSTRT),
  17325. 84: uint8(_BT_NMSTRT),
  17326. 85: uint8(_BT_NMSTRT),
  17327. 86: uint8(_BT_NMSTRT),
  17328. 87: uint8(_BT_NMSTRT),
  17329. 88: uint8(_BT_NMSTRT),
  17330. 89: uint8(_BT_NMSTRT),
  17331. 90: uint8(_BT_NMSTRT),
  17332. 91: uint8(_BT_LSQB),
  17333. 92: uint8(_BT_OTHER),
  17334. 93: uint8(_BT_RSQB),
  17335. 94: uint8(_BT_OTHER),
  17336. 95: uint8(_BT_NMSTRT),
  17337. 96: uint8(_BT_OTHER),
  17338. 97: uint8(_BT_HEX),
  17339. 98: uint8(_BT_HEX),
  17340. 99: uint8(_BT_HEX),
  17341. 100: uint8(_BT_HEX),
  17342. 101: uint8(_BT_HEX),
  17343. 102: uint8(_BT_HEX),
  17344. 103: uint8(_BT_NMSTRT),
  17345. 104: uint8(_BT_NMSTRT),
  17346. 105: uint8(_BT_NMSTRT),
  17347. 106: uint8(_BT_NMSTRT),
  17348. 107: uint8(_BT_NMSTRT),
  17349. 108: uint8(_BT_NMSTRT),
  17350. 109: uint8(_BT_NMSTRT),
  17351. 110: uint8(_BT_NMSTRT),
  17352. 111: uint8(_BT_NMSTRT),
  17353. 112: uint8(_BT_NMSTRT),
  17354. 113: uint8(_BT_NMSTRT),
  17355. 114: uint8(_BT_NMSTRT),
  17356. 115: uint8(_BT_NMSTRT),
  17357. 116: uint8(_BT_NMSTRT),
  17358. 117: uint8(_BT_NMSTRT),
  17359. 118: uint8(_BT_NMSTRT),
  17360. 119: uint8(_BT_NMSTRT),
  17361. 120: uint8(_BT_NMSTRT),
  17362. 121: uint8(_BT_NMSTRT),
  17363. 122: uint8(_BT_NMSTRT),
  17364. 123: uint8(_BT_OTHER),
  17365. 124: uint8(_BT_VERBAR),
  17366. 125: uint8(_BT_OTHER),
  17367. 126: uint8(_BT_OTHER),
  17368. 127: uint8(_BT_OTHER),
  17369. 128: uint8(_BT_TRAIL),
  17370. 129: uint8(_BT_TRAIL),
  17371. 130: uint8(_BT_TRAIL),
  17372. 131: uint8(_BT_TRAIL),
  17373. 132: uint8(_BT_TRAIL),
  17374. 133: uint8(_BT_TRAIL),
  17375. 134: uint8(_BT_TRAIL),
  17376. 135: uint8(_BT_TRAIL),
  17377. 136: uint8(_BT_TRAIL),
  17378. 137: uint8(_BT_TRAIL),
  17379. 138: uint8(_BT_TRAIL),
  17380. 139: uint8(_BT_TRAIL),
  17381. 140: uint8(_BT_TRAIL),
  17382. 141: uint8(_BT_TRAIL),
  17383. 142: uint8(_BT_TRAIL),
  17384. 143: uint8(_BT_TRAIL),
  17385. 144: uint8(_BT_TRAIL),
  17386. 145: uint8(_BT_TRAIL),
  17387. 146: uint8(_BT_TRAIL),
  17388. 147: uint8(_BT_TRAIL),
  17389. 148: uint8(_BT_TRAIL),
  17390. 149: uint8(_BT_TRAIL),
  17391. 150: uint8(_BT_TRAIL),
  17392. 151: uint8(_BT_TRAIL),
  17393. 152: uint8(_BT_TRAIL),
  17394. 153: uint8(_BT_TRAIL),
  17395. 154: uint8(_BT_TRAIL),
  17396. 155: uint8(_BT_TRAIL),
  17397. 156: uint8(_BT_TRAIL),
  17398. 157: uint8(_BT_TRAIL),
  17399. 158: uint8(_BT_TRAIL),
  17400. 159: uint8(_BT_TRAIL),
  17401. 160: uint8(_BT_TRAIL),
  17402. 161: uint8(_BT_TRAIL),
  17403. 162: uint8(_BT_TRAIL),
  17404. 163: uint8(_BT_TRAIL),
  17405. 164: uint8(_BT_TRAIL),
  17406. 165: uint8(_BT_TRAIL),
  17407. 166: uint8(_BT_TRAIL),
  17408. 167: uint8(_BT_TRAIL),
  17409. 168: uint8(_BT_TRAIL),
  17410. 169: uint8(_BT_TRAIL),
  17411. 170: uint8(_BT_TRAIL),
  17412. 171: uint8(_BT_TRAIL),
  17413. 172: uint8(_BT_TRAIL),
  17414. 173: uint8(_BT_TRAIL),
  17415. 174: uint8(_BT_TRAIL),
  17416. 175: uint8(_BT_TRAIL),
  17417. 176: uint8(_BT_TRAIL),
  17418. 177: uint8(_BT_TRAIL),
  17419. 178: uint8(_BT_TRAIL),
  17420. 179: uint8(_BT_TRAIL),
  17421. 180: uint8(_BT_TRAIL),
  17422. 181: uint8(_BT_TRAIL),
  17423. 182: uint8(_BT_TRAIL),
  17424. 183: uint8(_BT_TRAIL),
  17425. 184: uint8(_BT_TRAIL),
  17426. 185: uint8(_BT_TRAIL),
  17427. 186: uint8(_BT_TRAIL),
  17428. 187: uint8(_BT_TRAIL),
  17429. 188: uint8(_BT_TRAIL),
  17430. 189: uint8(_BT_TRAIL),
  17431. 190: uint8(_BT_TRAIL),
  17432. 191: uint8(_BT_TRAIL),
  17433. 192: uint8(_BT_LEAD2),
  17434. 193: uint8(_BT_LEAD2),
  17435. 194: uint8(_BT_LEAD2),
  17436. 195: uint8(_BT_LEAD2),
  17437. 196: uint8(_BT_LEAD2),
  17438. 197: uint8(_BT_LEAD2),
  17439. 198: uint8(_BT_LEAD2),
  17440. 199: uint8(_BT_LEAD2),
  17441. 200: uint8(_BT_LEAD2),
  17442. 201: uint8(_BT_LEAD2),
  17443. 202: uint8(_BT_LEAD2),
  17444. 203: uint8(_BT_LEAD2),
  17445. 204: uint8(_BT_LEAD2),
  17446. 205: uint8(_BT_LEAD2),
  17447. 206: uint8(_BT_LEAD2),
  17448. 207: uint8(_BT_LEAD2),
  17449. 208: uint8(_BT_LEAD2),
  17450. 209: uint8(_BT_LEAD2),
  17451. 210: uint8(_BT_LEAD2),
  17452. 211: uint8(_BT_LEAD2),
  17453. 212: uint8(_BT_LEAD2),
  17454. 213: uint8(_BT_LEAD2),
  17455. 214: uint8(_BT_LEAD2),
  17456. 215: uint8(_BT_LEAD2),
  17457. 216: uint8(_BT_LEAD2),
  17458. 217: uint8(_BT_LEAD2),
  17459. 218: uint8(_BT_LEAD2),
  17460. 219: uint8(_BT_LEAD2),
  17461. 220: uint8(_BT_LEAD2),
  17462. 221: uint8(_BT_LEAD2),
  17463. 222: uint8(_BT_LEAD2),
  17464. 223: uint8(_BT_LEAD2),
  17465. 224: uint8(_BT_LEAD3),
  17466. 225: uint8(_BT_LEAD3),
  17467. 226: uint8(_BT_LEAD3),
  17468. 227: uint8(_BT_LEAD3),
  17469. 228: uint8(_BT_LEAD3),
  17470. 229: uint8(_BT_LEAD3),
  17471. 230: uint8(_BT_LEAD3),
  17472. 231: uint8(_BT_LEAD3),
  17473. 232: uint8(_BT_LEAD3),
  17474. 233: uint8(_BT_LEAD3),
  17475. 234: uint8(_BT_LEAD3),
  17476. 235: uint8(_BT_LEAD3),
  17477. 236: uint8(_BT_LEAD3),
  17478. 237: uint8(_BT_LEAD3),
  17479. 238: uint8(_BT_LEAD3),
  17480. 239: uint8(_BT_LEAD3),
  17481. 240: uint8(_BT_LEAD4),
  17482. 241: uint8(_BT_LEAD4),
  17483. 242: uint8(_BT_LEAD4),
  17484. 243: uint8(_BT_LEAD4),
  17485. 244: uint8(_BT_LEAD4),
  17486. 254: uint8(_BT_MALFORM),
  17487. 255: uint8(_BT_MALFORM),
  17488. },
  17489. }
  17490. func init() {
  17491. p := unsafe.Pointer(&_internal_utf8_encoding)
  17492. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17493. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17494. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17495. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17496. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17497. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17498. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17499. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17500. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17501. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17502. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17503. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17504. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17505. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17506. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_utf8_toUtf8)
  17507. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_utf8_toUtf16)
  17508. *(*uintptr)(unsafe.Add(p, 328)) = __ccgo_fp(_utf8_isName2)
  17509. *(*uintptr)(unsafe.Add(p, 332)) = __ccgo_fp(_utf8_isName3)
  17510. *(*uintptr)(unsafe.Add(p, 336)) = __ccgo_fp(_isNever)
  17511. *(*uintptr)(unsafe.Add(p, 340)) = __ccgo_fp(_utf8_isNmstrt2)
  17512. *(*uintptr)(unsafe.Add(p, 344)) = __ccgo_fp(_utf8_isNmstrt3)
  17513. *(*uintptr)(unsafe.Add(p, 348)) = __ccgo_fp(_isNever)
  17514. *(*uintptr)(unsafe.Add(p, 352)) = __ccgo_fp(_utf8_isInvalid2)
  17515. *(*uintptr)(unsafe.Add(p, 356)) = __ccgo_fp(_utf8_isInvalid3)
  17516. *(*uintptr)(unsafe.Add(p, 360)) = __ccgo_fp(_utf8_isInvalid4)
  17517. }
  17518. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17519. var c uint8
  17520. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  17521. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  17522. _ = enc
  17523. for {
  17524. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  17525. return int32(_XML_CONVERT_COMPLETED)
  17526. }
  17527. c = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))
  17528. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  17529. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(2) {
  17530. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17531. }
  17532. v3 = toP
  17533. v2 = *(*uintptr)(unsafe.Pointer(v3))
  17534. *(*uintptr)(unsafe.Pointer(v3))++
  17535. *(*int8)(unsafe.Pointer(v2)) = int8(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  17536. v5 = toP
  17537. v4 = *(*uintptr)(unsafe.Pointer(v5))
  17538. *(*uintptr)(unsafe.Pointer(v5))++
  17539. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  17540. *(*uintptr)(unsafe.Pointer(fromP))++
  17541. } else {
  17542. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  17543. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17544. }
  17545. v7 = toP
  17546. v6 = *(*uintptr)(unsafe.Pointer(v7))
  17547. *(*uintptr)(unsafe.Pointer(v7))++
  17548. v9 = fromP
  17549. v8 = *(*uintptr)(unsafe.Pointer(v9))
  17550. *(*uintptr)(unsafe.Pointer(v9))++
  17551. *(*int8)(unsafe.Pointer(v6)) = *(*int8)(unsafe.Pointer(v8))
  17552. }
  17553. goto _1
  17554. _1:
  17555. }
  17556. return r
  17557. }
  17558. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  17559. var v1, v2, v3, v4 uintptr
  17560. _, _, _, _ = v1, v2, v3, v4
  17561. _ = enc
  17562. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  17563. v2 = toP
  17564. v1 = *(*uintptr)(unsafe.Pointer(v2))
  17565. *(*uintptr)(unsafe.Pointer(v2)) += 2
  17566. v4 = fromP
  17567. v3 = *(*uintptr)(unsafe.Pointer(v4))
  17568. *(*uintptr)(unsafe.Pointer(v4))++
  17569. *(*uint16)(unsafe.Pointer(v1)) = uint16(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(v3))))
  17570. }
  17571. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  17572. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  17573. } else {
  17574. return int32(_XML_CONVERT_COMPLETED)
  17575. }
  17576. return r
  17577. }
  17578. var _latin1_encoding_ns = Tnormal_encoding{
  17579. Fenc: TENCODING{
  17580. Fscanners: [4]TSCANNER{},
  17581. FliteralScanners: [2]TSCANNER{},
  17582. FminBytesPerChar: int32(1),
  17583. },
  17584. Ftype1: [256]uint8{
  17585. 9: uint8(_BT_S),
  17586. 10: uint8(_BT_LF),
  17587. 13: uint8(_BT_CR),
  17588. 32: uint8(_BT_S),
  17589. 33: uint8(_BT_EXCL),
  17590. 34: uint8(_BT_QUOT),
  17591. 35: uint8(_BT_NUM),
  17592. 36: uint8(_BT_OTHER),
  17593. 37: uint8(_BT_PERCNT),
  17594. 38: uint8(_BT_AMP),
  17595. 39: uint8(_BT_APOS),
  17596. 40: uint8(_BT_LPAR),
  17597. 41: uint8(_BT_RPAR),
  17598. 42: uint8(_BT_AST),
  17599. 43: uint8(_BT_PLUS),
  17600. 44: uint8(_BT_COMMA),
  17601. 45: uint8(_BT_MINUS),
  17602. 46: uint8(_BT_NAME),
  17603. 47: uint8(_BT_SOL),
  17604. 48: uint8(_BT_DIGIT),
  17605. 49: uint8(_BT_DIGIT),
  17606. 50: uint8(_BT_DIGIT),
  17607. 51: uint8(_BT_DIGIT),
  17608. 52: uint8(_BT_DIGIT),
  17609. 53: uint8(_BT_DIGIT),
  17610. 54: uint8(_BT_DIGIT),
  17611. 55: uint8(_BT_DIGIT),
  17612. 56: uint8(_BT_DIGIT),
  17613. 57: uint8(_BT_DIGIT),
  17614. 58: uint8(_BT_COLON),
  17615. 59: uint8(_BT_SEMI),
  17616. 60: uint8(_BT_LT),
  17617. 61: uint8(_BT_EQUALS),
  17618. 62: uint8(_BT_GT),
  17619. 63: uint8(_BT_QUEST),
  17620. 64: uint8(_BT_OTHER),
  17621. 65: uint8(_BT_HEX),
  17622. 66: uint8(_BT_HEX),
  17623. 67: uint8(_BT_HEX),
  17624. 68: uint8(_BT_HEX),
  17625. 69: uint8(_BT_HEX),
  17626. 70: uint8(_BT_HEX),
  17627. 71: uint8(_BT_NMSTRT),
  17628. 72: uint8(_BT_NMSTRT),
  17629. 73: uint8(_BT_NMSTRT),
  17630. 74: uint8(_BT_NMSTRT),
  17631. 75: uint8(_BT_NMSTRT),
  17632. 76: uint8(_BT_NMSTRT),
  17633. 77: uint8(_BT_NMSTRT),
  17634. 78: uint8(_BT_NMSTRT),
  17635. 79: uint8(_BT_NMSTRT),
  17636. 80: uint8(_BT_NMSTRT),
  17637. 81: uint8(_BT_NMSTRT),
  17638. 82: uint8(_BT_NMSTRT),
  17639. 83: uint8(_BT_NMSTRT),
  17640. 84: uint8(_BT_NMSTRT),
  17641. 85: uint8(_BT_NMSTRT),
  17642. 86: uint8(_BT_NMSTRT),
  17643. 87: uint8(_BT_NMSTRT),
  17644. 88: uint8(_BT_NMSTRT),
  17645. 89: uint8(_BT_NMSTRT),
  17646. 90: uint8(_BT_NMSTRT),
  17647. 91: uint8(_BT_LSQB),
  17648. 92: uint8(_BT_OTHER),
  17649. 93: uint8(_BT_RSQB),
  17650. 94: uint8(_BT_OTHER),
  17651. 95: uint8(_BT_NMSTRT),
  17652. 96: uint8(_BT_OTHER),
  17653. 97: uint8(_BT_HEX),
  17654. 98: uint8(_BT_HEX),
  17655. 99: uint8(_BT_HEX),
  17656. 100: uint8(_BT_HEX),
  17657. 101: uint8(_BT_HEX),
  17658. 102: uint8(_BT_HEX),
  17659. 103: uint8(_BT_NMSTRT),
  17660. 104: uint8(_BT_NMSTRT),
  17661. 105: uint8(_BT_NMSTRT),
  17662. 106: uint8(_BT_NMSTRT),
  17663. 107: uint8(_BT_NMSTRT),
  17664. 108: uint8(_BT_NMSTRT),
  17665. 109: uint8(_BT_NMSTRT),
  17666. 110: uint8(_BT_NMSTRT),
  17667. 111: uint8(_BT_NMSTRT),
  17668. 112: uint8(_BT_NMSTRT),
  17669. 113: uint8(_BT_NMSTRT),
  17670. 114: uint8(_BT_NMSTRT),
  17671. 115: uint8(_BT_NMSTRT),
  17672. 116: uint8(_BT_NMSTRT),
  17673. 117: uint8(_BT_NMSTRT),
  17674. 118: uint8(_BT_NMSTRT),
  17675. 119: uint8(_BT_NMSTRT),
  17676. 120: uint8(_BT_NMSTRT),
  17677. 121: uint8(_BT_NMSTRT),
  17678. 122: uint8(_BT_NMSTRT),
  17679. 123: uint8(_BT_OTHER),
  17680. 124: uint8(_BT_VERBAR),
  17681. 125: uint8(_BT_OTHER),
  17682. 126: uint8(_BT_OTHER),
  17683. 127: uint8(_BT_OTHER),
  17684. 128: uint8(_BT_OTHER),
  17685. 129: uint8(_BT_OTHER),
  17686. 130: uint8(_BT_OTHER),
  17687. 131: uint8(_BT_OTHER),
  17688. 132: uint8(_BT_OTHER),
  17689. 133: uint8(_BT_OTHER),
  17690. 134: uint8(_BT_OTHER),
  17691. 135: uint8(_BT_OTHER),
  17692. 136: uint8(_BT_OTHER),
  17693. 137: uint8(_BT_OTHER),
  17694. 138: uint8(_BT_OTHER),
  17695. 139: uint8(_BT_OTHER),
  17696. 140: uint8(_BT_OTHER),
  17697. 141: uint8(_BT_OTHER),
  17698. 142: uint8(_BT_OTHER),
  17699. 143: uint8(_BT_OTHER),
  17700. 144: uint8(_BT_OTHER),
  17701. 145: uint8(_BT_OTHER),
  17702. 146: uint8(_BT_OTHER),
  17703. 147: uint8(_BT_OTHER),
  17704. 148: uint8(_BT_OTHER),
  17705. 149: uint8(_BT_OTHER),
  17706. 150: uint8(_BT_OTHER),
  17707. 151: uint8(_BT_OTHER),
  17708. 152: uint8(_BT_OTHER),
  17709. 153: uint8(_BT_OTHER),
  17710. 154: uint8(_BT_OTHER),
  17711. 155: uint8(_BT_OTHER),
  17712. 156: uint8(_BT_OTHER),
  17713. 157: uint8(_BT_OTHER),
  17714. 158: uint8(_BT_OTHER),
  17715. 159: uint8(_BT_OTHER),
  17716. 160: uint8(_BT_OTHER),
  17717. 161: uint8(_BT_OTHER),
  17718. 162: uint8(_BT_OTHER),
  17719. 163: uint8(_BT_OTHER),
  17720. 164: uint8(_BT_OTHER),
  17721. 165: uint8(_BT_OTHER),
  17722. 166: uint8(_BT_OTHER),
  17723. 167: uint8(_BT_OTHER),
  17724. 168: uint8(_BT_OTHER),
  17725. 169: uint8(_BT_OTHER),
  17726. 170: uint8(_BT_NMSTRT),
  17727. 171: uint8(_BT_OTHER),
  17728. 172: uint8(_BT_OTHER),
  17729. 173: uint8(_BT_OTHER),
  17730. 174: uint8(_BT_OTHER),
  17731. 175: uint8(_BT_OTHER),
  17732. 176: uint8(_BT_OTHER),
  17733. 177: uint8(_BT_OTHER),
  17734. 178: uint8(_BT_OTHER),
  17735. 179: uint8(_BT_OTHER),
  17736. 180: uint8(_BT_OTHER),
  17737. 181: uint8(_BT_NMSTRT),
  17738. 182: uint8(_BT_OTHER),
  17739. 183: uint8(_BT_NAME),
  17740. 184: uint8(_BT_OTHER),
  17741. 185: uint8(_BT_OTHER),
  17742. 186: uint8(_BT_NMSTRT),
  17743. 187: uint8(_BT_OTHER),
  17744. 188: uint8(_BT_OTHER),
  17745. 189: uint8(_BT_OTHER),
  17746. 190: uint8(_BT_OTHER),
  17747. 191: uint8(_BT_OTHER),
  17748. 192: uint8(_BT_NMSTRT),
  17749. 193: uint8(_BT_NMSTRT),
  17750. 194: uint8(_BT_NMSTRT),
  17751. 195: uint8(_BT_NMSTRT),
  17752. 196: uint8(_BT_NMSTRT),
  17753. 197: uint8(_BT_NMSTRT),
  17754. 198: uint8(_BT_NMSTRT),
  17755. 199: uint8(_BT_NMSTRT),
  17756. 200: uint8(_BT_NMSTRT),
  17757. 201: uint8(_BT_NMSTRT),
  17758. 202: uint8(_BT_NMSTRT),
  17759. 203: uint8(_BT_NMSTRT),
  17760. 204: uint8(_BT_NMSTRT),
  17761. 205: uint8(_BT_NMSTRT),
  17762. 206: uint8(_BT_NMSTRT),
  17763. 207: uint8(_BT_NMSTRT),
  17764. 208: uint8(_BT_NMSTRT),
  17765. 209: uint8(_BT_NMSTRT),
  17766. 210: uint8(_BT_NMSTRT),
  17767. 211: uint8(_BT_NMSTRT),
  17768. 212: uint8(_BT_NMSTRT),
  17769. 213: uint8(_BT_NMSTRT),
  17770. 214: uint8(_BT_NMSTRT),
  17771. 215: uint8(_BT_OTHER),
  17772. 216: uint8(_BT_NMSTRT),
  17773. 217: uint8(_BT_NMSTRT),
  17774. 218: uint8(_BT_NMSTRT),
  17775. 219: uint8(_BT_NMSTRT),
  17776. 220: uint8(_BT_NMSTRT),
  17777. 221: uint8(_BT_NMSTRT),
  17778. 222: uint8(_BT_NMSTRT),
  17779. 223: uint8(_BT_NMSTRT),
  17780. 224: uint8(_BT_NMSTRT),
  17781. 225: uint8(_BT_NMSTRT),
  17782. 226: uint8(_BT_NMSTRT),
  17783. 227: uint8(_BT_NMSTRT),
  17784. 228: uint8(_BT_NMSTRT),
  17785. 229: uint8(_BT_NMSTRT),
  17786. 230: uint8(_BT_NMSTRT),
  17787. 231: uint8(_BT_NMSTRT),
  17788. 232: uint8(_BT_NMSTRT),
  17789. 233: uint8(_BT_NMSTRT),
  17790. 234: uint8(_BT_NMSTRT),
  17791. 235: uint8(_BT_NMSTRT),
  17792. 236: uint8(_BT_NMSTRT),
  17793. 237: uint8(_BT_NMSTRT),
  17794. 238: uint8(_BT_NMSTRT),
  17795. 239: uint8(_BT_NMSTRT),
  17796. 240: uint8(_BT_NMSTRT),
  17797. 241: uint8(_BT_NMSTRT),
  17798. 242: uint8(_BT_NMSTRT),
  17799. 243: uint8(_BT_NMSTRT),
  17800. 244: uint8(_BT_NMSTRT),
  17801. 245: uint8(_BT_NMSTRT),
  17802. 246: uint8(_BT_NMSTRT),
  17803. 247: uint8(_BT_OTHER),
  17804. 248: uint8(_BT_NMSTRT),
  17805. 249: uint8(_BT_NMSTRT),
  17806. 250: uint8(_BT_NMSTRT),
  17807. 251: uint8(_BT_NMSTRT),
  17808. 252: uint8(_BT_NMSTRT),
  17809. 253: uint8(_BT_NMSTRT),
  17810. 254: uint8(_BT_NMSTRT),
  17811. 255: uint8(_BT_NMSTRT),
  17812. },
  17813. }
  17814. func init() {
  17815. p := unsafe.Pointer(&_latin1_encoding_ns)
  17816. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  17817. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  17818. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  17819. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  17820. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  17821. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  17822. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  17823. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  17824. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  17825. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  17826. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  17827. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  17828. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  17829. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  17830. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_latin1_toUtf8)
  17831. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  17832. }
  17833. var _latin1_encoding = Tnormal_encoding{
  17834. Fenc: TENCODING{
  17835. Fscanners: [4]TSCANNER{},
  17836. FliteralScanners: [2]TSCANNER{},
  17837. FminBytesPerChar: int32(1),
  17838. },
  17839. Ftype1: [256]uint8{
  17840. 9: uint8(_BT_S),
  17841. 10: uint8(_BT_LF),
  17842. 13: uint8(_BT_CR),
  17843. 32: uint8(_BT_S),
  17844. 33: uint8(_BT_EXCL),
  17845. 34: uint8(_BT_QUOT),
  17846. 35: uint8(_BT_NUM),
  17847. 36: uint8(_BT_OTHER),
  17848. 37: uint8(_BT_PERCNT),
  17849. 38: uint8(_BT_AMP),
  17850. 39: uint8(_BT_APOS),
  17851. 40: uint8(_BT_LPAR),
  17852. 41: uint8(_BT_RPAR),
  17853. 42: uint8(_BT_AST),
  17854. 43: uint8(_BT_PLUS),
  17855. 44: uint8(_BT_COMMA),
  17856. 45: uint8(_BT_MINUS),
  17857. 46: uint8(_BT_NAME),
  17858. 47: uint8(_BT_SOL),
  17859. 48: uint8(_BT_DIGIT),
  17860. 49: uint8(_BT_DIGIT),
  17861. 50: uint8(_BT_DIGIT),
  17862. 51: uint8(_BT_DIGIT),
  17863. 52: uint8(_BT_DIGIT),
  17864. 53: uint8(_BT_DIGIT),
  17865. 54: uint8(_BT_DIGIT),
  17866. 55: uint8(_BT_DIGIT),
  17867. 56: uint8(_BT_DIGIT),
  17868. 57: uint8(_BT_DIGIT),
  17869. 58: uint8(_BT_NMSTRT),
  17870. 59: uint8(_BT_SEMI),
  17871. 60: uint8(_BT_LT),
  17872. 61: uint8(_BT_EQUALS),
  17873. 62: uint8(_BT_GT),
  17874. 63: uint8(_BT_QUEST),
  17875. 64: uint8(_BT_OTHER),
  17876. 65: uint8(_BT_HEX),
  17877. 66: uint8(_BT_HEX),
  17878. 67: uint8(_BT_HEX),
  17879. 68: uint8(_BT_HEX),
  17880. 69: uint8(_BT_HEX),
  17881. 70: uint8(_BT_HEX),
  17882. 71: uint8(_BT_NMSTRT),
  17883. 72: uint8(_BT_NMSTRT),
  17884. 73: uint8(_BT_NMSTRT),
  17885. 74: uint8(_BT_NMSTRT),
  17886. 75: uint8(_BT_NMSTRT),
  17887. 76: uint8(_BT_NMSTRT),
  17888. 77: uint8(_BT_NMSTRT),
  17889. 78: uint8(_BT_NMSTRT),
  17890. 79: uint8(_BT_NMSTRT),
  17891. 80: uint8(_BT_NMSTRT),
  17892. 81: uint8(_BT_NMSTRT),
  17893. 82: uint8(_BT_NMSTRT),
  17894. 83: uint8(_BT_NMSTRT),
  17895. 84: uint8(_BT_NMSTRT),
  17896. 85: uint8(_BT_NMSTRT),
  17897. 86: uint8(_BT_NMSTRT),
  17898. 87: uint8(_BT_NMSTRT),
  17899. 88: uint8(_BT_NMSTRT),
  17900. 89: uint8(_BT_NMSTRT),
  17901. 90: uint8(_BT_NMSTRT),
  17902. 91: uint8(_BT_LSQB),
  17903. 92: uint8(_BT_OTHER),
  17904. 93: uint8(_BT_RSQB),
  17905. 94: uint8(_BT_OTHER),
  17906. 95: uint8(_BT_NMSTRT),
  17907. 96: uint8(_BT_OTHER),
  17908. 97: uint8(_BT_HEX),
  17909. 98: uint8(_BT_HEX),
  17910. 99: uint8(_BT_HEX),
  17911. 100: uint8(_BT_HEX),
  17912. 101: uint8(_BT_HEX),
  17913. 102: uint8(_BT_HEX),
  17914. 103: uint8(_BT_NMSTRT),
  17915. 104: uint8(_BT_NMSTRT),
  17916. 105: uint8(_BT_NMSTRT),
  17917. 106: uint8(_BT_NMSTRT),
  17918. 107: uint8(_BT_NMSTRT),
  17919. 108: uint8(_BT_NMSTRT),
  17920. 109: uint8(_BT_NMSTRT),
  17921. 110: uint8(_BT_NMSTRT),
  17922. 111: uint8(_BT_NMSTRT),
  17923. 112: uint8(_BT_NMSTRT),
  17924. 113: uint8(_BT_NMSTRT),
  17925. 114: uint8(_BT_NMSTRT),
  17926. 115: uint8(_BT_NMSTRT),
  17927. 116: uint8(_BT_NMSTRT),
  17928. 117: uint8(_BT_NMSTRT),
  17929. 118: uint8(_BT_NMSTRT),
  17930. 119: uint8(_BT_NMSTRT),
  17931. 120: uint8(_BT_NMSTRT),
  17932. 121: uint8(_BT_NMSTRT),
  17933. 122: uint8(_BT_NMSTRT),
  17934. 123: uint8(_BT_OTHER),
  17935. 124: uint8(_BT_VERBAR),
  17936. 125: uint8(_BT_OTHER),
  17937. 126: uint8(_BT_OTHER),
  17938. 127: uint8(_BT_OTHER),
  17939. 128: uint8(_BT_OTHER),
  17940. 129: uint8(_BT_OTHER),
  17941. 130: uint8(_BT_OTHER),
  17942. 131: uint8(_BT_OTHER),
  17943. 132: uint8(_BT_OTHER),
  17944. 133: uint8(_BT_OTHER),
  17945. 134: uint8(_BT_OTHER),
  17946. 135: uint8(_BT_OTHER),
  17947. 136: uint8(_BT_OTHER),
  17948. 137: uint8(_BT_OTHER),
  17949. 138: uint8(_BT_OTHER),
  17950. 139: uint8(_BT_OTHER),
  17951. 140: uint8(_BT_OTHER),
  17952. 141: uint8(_BT_OTHER),
  17953. 142: uint8(_BT_OTHER),
  17954. 143: uint8(_BT_OTHER),
  17955. 144: uint8(_BT_OTHER),
  17956. 145: uint8(_BT_OTHER),
  17957. 146: uint8(_BT_OTHER),
  17958. 147: uint8(_BT_OTHER),
  17959. 148: uint8(_BT_OTHER),
  17960. 149: uint8(_BT_OTHER),
  17961. 150: uint8(_BT_OTHER),
  17962. 151: uint8(_BT_OTHER),
  17963. 152: uint8(_BT_OTHER),
  17964. 153: uint8(_BT_OTHER),
  17965. 154: uint8(_BT_OTHER),
  17966. 155: uint8(_BT_OTHER),
  17967. 156: uint8(_BT_OTHER),
  17968. 157: uint8(_BT_OTHER),
  17969. 158: uint8(_BT_OTHER),
  17970. 159: uint8(_BT_OTHER),
  17971. 160: uint8(_BT_OTHER),
  17972. 161: uint8(_BT_OTHER),
  17973. 162: uint8(_BT_OTHER),
  17974. 163: uint8(_BT_OTHER),
  17975. 164: uint8(_BT_OTHER),
  17976. 165: uint8(_BT_OTHER),
  17977. 166: uint8(_BT_OTHER),
  17978. 167: uint8(_BT_OTHER),
  17979. 168: uint8(_BT_OTHER),
  17980. 169: uint8(_BT_OTHER),
  17981. 170: uint8(_BT_NMSTRT),
  17982. 171: uint8(_BT_OTHER),
  17983. 172: uint8(_BT_OTHER),
  17984. 173: uint8(_BT_OTHER),
  17985. 174: uint8(_BT_OTHER),
  17986. 175: uint8(_BT_OTHER),
  17987. 176: uint8(_BT_OTHER),
  17988. 177: uint8(_BT_OTHER),
  17989. 178: uint8(_BT_OTHER),
  17990. 179: uint8(_BT_OTHER),
  17991. 180: uint8(_BT_OTHER),
  17992. 181: uint8(_BT_NMSTRT),
  17993. 182: uint8(_BT_OTHER),
  17994. 183: uint8(_BT_NAME),
  17995. 184: uint8(_BT_OTHER),
  17996. 185: uint8(_BT_OTHER),
  17997. 186: uint8(_BT_NMSTRT),
  17998. 187: uint8(_BT_OTHER),
  17999. 188: uint8(_BT_OTHER),
  18000. 189: uint8(_BT_OTHER),
  18001. 190: uint8(_BT_OTHER),
  18002. 191: uint8(_BT_OTHER),
  18003. 192: uint8(_BT_NMSTRT),
  18004. 193: uint8(_BT_NMSTRT),
  18005. 194: uint8(_BT_NMSTRT),
  18006. 195: uint8(_BT_NMSTRT),
  18007. 196: uint8(_BT_NMSTRT),
  18008. 197: uint8(_BT_NMSTRT),
  18009. 198: uint8(_BT_NMSTRT),
  18010. 199: uint8(_BT_NMSTRT),
  18011. 200: uint8(_BT_NMSTRT),
  18012. 201: uint8(_BT_NMSTRT),
  18013. 202: uint8(_BT_NMSTRT),
  18014. 203: uint8(_BT_NMSTRT),
  18015. 204: uint8(_BT_NMSTRT),
  18016. 205: uint8(_BT_NMSTRT),
  18017. 206: uint8(_BT_NMSTRT),
  18018. 207: uint8(_BT_NMSTRT),
  18019. 208: uint8(_BT_NMSTRT),
  18020. 209: uint8(_BT_NMSTRT),
  18021. 210: uint8(_BT_NMSTRT),
  18022. 211: uint8(_BT_NMSTRT),
  18023. 212: uint8(_BT_NMSTRT),
  18024. 213: uint8(_BT_NMSTRT),
  18025. 214: uint8(_BT_NMSTRT),
  18026. 215: uint8(_BT_OTHER),
  18027. 216: uint8(_BT_NMSTRT),
  18028. 217: uint8(_BT_NMSTRT),
  18029. 218: uint8(_BT_NMSTRT),
  18030. 219: uint8(_BT_NMSTRT),
  18031. 220: uint8(_BT_NMSTRT),
  18032. 221: uint8(_BT_NMSTRT),
  18033. 222: uint8(_BT_NMSTRT),
  18034. 223: uint8(_BT_NMSTRT),
  18035. 224: uint8(_BT_NMSTRT),
  18036. 225: uint8(_BT_NMSTRT),
  18037. 226: uint8(_BT_NMSTRT),
  18038. 227: uint8(_BT_NMSTRT),
  18039. 228: uint8(_BT_NMSTRT),
  18040. 229: uint8(_BT_NMSTRT),
  18041. 230: uint8(_BT_NMSTRT),
  18042. 231: uint8(_BT_NMSTRT),
  18043. 232: uint8(_BT_NMSTRT),
  18044. 233: uint8(_BT_NMSTRT),
  18045. 234: uint8(_BT_NMSTRT),
  18046. 235: uint8(_BT_NMSTRT),
  18047. 236: uint8(_BT_NMSTRT),
  18048. 237: uint8(_BT_NMSTRT),
  18049. 238: uint8(_BT_NMSTRT),
  18050. 239: uint8(_BT_NMSTRT),
  18051. 240: uint8(_BT_NMSTRT),
  18052. 241: uint8(_BT_NMSTRT),
  18053. 242: uint8(_BT_NMSTRT),
  18054. 243: uint8(_BT_NMSTRT),
  18055. 244: uint8(_BT_NMSTRT),
  18056. 245: uint8(_BT_NMSTRT),
  18057. 246: uint8(_BT_NMSTRT),
  18058. 247: uint8(_BT_OTHER),
  18059. 248: uint8(_BT_NMSTRT),
  18060. 249: uint8(_BT_NMSTRT),
  18061. 250: uint8(_BT_NMSTRT),
  18062. 251: uint8(_BT_NMSTRT),
  18063. 252: uint8(_BT_NMSTRT),
  18064. 253: uint8(_BT_NMSTRT),
  18065. 254: uint8(_BT_NMSTRT),
  18066. 255: uint8(_BT_NMSTRT),
  18067. },
  18068. }
  18069. func init() {
  18070. p := unsafe.Pointer(&_latin1_encoding)
  18071. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18072. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  18073. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  18074. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  18075. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  18076. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  18077. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  18078. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  18079. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  18080. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  18081. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  18082. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  18083. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  18084. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  18085. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_latin1_toUtf8)
  18086. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  18087. }
  18088. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18089. var v1, v2, v3, v4 uintptr
  18090. _, _, _, _ = v1, v2, v3, v4
  18091. _ = enc
  18092. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  18093. v2 = toP
  18094. v1 = *(*uintptr)(unsafe.Pointer(v2))
  18095. *(*uintptr)(unsafe.Pointer(v2))++
  18096. v4 = fromP
  18097. v3 = *(*uintptr)(unsafe.Pointer(v4))
  18098. *(*uintptr)(unsafe.Pointer(v4))++
  18099. *(*int8)(unsafe.Pointer(v1)) = *(*int8)(unsafe.Pointer(v3))
  18100. }
  18101. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18102. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18103. } else {
  18104. return int32(_XML_CONVERT_COMPLETED)
  18105. }
  18106. return r
  18107. }
  18108. var _ascii_encoding_ns = Tnormal_encoding{
  18109. Fenc: TENCODING{
  18110. Fscanners: [4]TSCANNER{},
  18111. FliteralScanners: [2]TSCANNER{},
  18112. FminBytesPerChar: int32(1),
  18113. FisUtf8: int8(1),
  18114. },
  18115. Ftype1: [256]uint8{
  18116. 9: uint8(_BT_S),
  18117. 10: uint8(_BT_LF),
  18118. 13: uint8(_BT_CR),
  18119. 32: uint8(_BT_S),
  18120. 33: uint8(_BT_EXCL),
  18121. 34: uint8(_BT_QUOT),
  18122. 35: uint8(_BT_NUM),
  18123. 36: uint8(_BT_OTHER),
  18124. 37: uint8(_BT_PERCNT),
  18125. 38: uint8(_BT_AMP),
  18126. 39: uint8(_BT_APOS),
  18127. 40: uint8(_BT_LPAR),
  18128. 41: uint8(_BT_RPAR),
  18129. 42: uint8(_BT_AST),
  18130. 43: uint8(_BT_PLUS),
  18131. 44: uint8(_BT_COMMA),
  18132. 45: uint8(_BT_MINUS),
  18133. 46: uint8(_BT_NAME),
  18134. 47: uint8(_BT_SOL),
  18135. 48: uint8(_BT_DIGIT),
  18136. 49: uint8(_BT_DIGIT),
  18137. 50: uint8(_BT_DIGIT),
  18138. 51: uint8(_BT_DIGIT),
  18139. 52: uint8(_BT_DIGIT),
  18140. 53: uint8(_BT_DIGIT),
  18141. 54: uint8(_BT_DIGIT),
  18142. 55: uint8(_BT_DIGIT),
  18143. 56: uint8(_BT_DIGIT),
  18144. 57: uint8(_BT_DIGIT),
  18145. 58: uint8(_BT_COLON),
  18146. 59: uint8(_BT_SEMI),
  18147. 60: uint8(_BT_LT),
  18148. 61: uint8(_BT_EQUALS),
  18149. 62: uint8(_BT_GT),
  18150. 63: uint8(_BT_QUEST),
  18151. 64: uint8(_BT_OTHER),
  18152. 65: uint8(_BT_HEX),
  18153. 66: uint8(_BT_HEX),
  18154. 67: uint8(_BT_HEX),
  18155. 68: uint8(_BT_HEX),
  18156. 69: uint8(_BT_HEX),
  18157. 70: uint8(_BT_HEX),
  18158. 71: uint8(_BT_NMSTRT),
  18159. 72: uint8(_BT_NMSTRT),
  18160. 73: uint8(_BT_NMSTRT),
  18161. 74: uint8(_BT_NMSTRT),
  18162. 75: uint8(_BT_NMSTRT),
  18163. 76: uint8(_BT_NMSTRT),
  18164. 77: uint8(_BT_NMSTRT),
  18165. 78: uint8(_BT_NMSTRT),
  18166. 79: uint8(_BT_NMSTRT),
  18167. 80: uint8(_BT_NMSTRT),
  18168. 81: uint8(_BT_NMSTRT),
  18169. 82: uint8(_BT_NMSTRT),
  18170. 83: uint8(_BT_NMSTRT),
  18171. 84: uint8(_BT_NMSTRT),
  18172. 85: uint8(_BT_NMSTRT),
  18173. 86: uint8(_BT_NMSTRT),
  18174. 87: uint8(_BT_NMSTRT),
  18175. 88: uint8(_BT_NMSTRT),
  18176. 89: uint8(_BT_NMSTRT),
  18177. 90: uint8(_BT_NMSTRT),
  18178. 91: uint8(_BT_LSQB),
  18179. 92: uint8(_BT_OTHER),
  18180. 93: uint8(_BT_RSQB),
  18181. 94: uint8(_BT_OTHER),
  18182. 95: uint8(_BT_NMSTRT),
  18183. 96: uint8(_BT_OTHER),
  18184. 97: uint8(_BT_HEX),
  18185. 98: uint8(_BT_HEX),
  18186. 99: uint8(_BT_HEX),
  18187. 100: uint8(_BT_HEX),
  18188. 101: uint8(_BT_HEX),
  18189. 102: uint8(_BT_HEX),
  18190. 103: uint8(_BT_NMSTRT),
  18191. 104: uint8(_BT_NMSTRT),
  18192. 105: uint8(_BT_NMSTRT),
  18193. 106: uint8(_BT_NMSTRT),
  18194. 107: uint8(_BT_NMSTRT),
  18195. 108: uint8(_BT_NMSTRT),
  18196. 109: uint8(_BT_NMSTRT),
  18197. 110: uint8(_BT_NMSTRT),
  18198. 111: uint8(_BT_NMSTRT),
  18199. 112: uint8(_BT_NMSTRT),
  18200. 113: uint8(_BT_NMSTRT),
  18201. 114: uint8(_BT_NMSTRT),
  18202. 115: uint8(_BT_NMSTRT),
  18203. 116: uint8(_BT_NMSTRT),
  18204. 117: uint8(_BT_NMSTRT),
  18205. 118: uint8(_BT_NMSTRT),
  18206. 119: uint8(_BT_NMSTRT),
  18207. 120: uint8(_BT_NMSTRT),
  18208. 121: uint8(_BT_NMSTRT),
  18209. 122: uint8(_BT_NMSTRT),
  18210. 123: uint8(_BT_OTHER),
  18211. 124: uint8(_BT_VERBAR),
  18212. 125: uint8(_BT_OTHER),
  18213. 126: uint8(_BT_OTHER),
  18214. 127: uint8(_BT_OTHER),
  18215. },
  18216. }
  18217. func init() {
  18218. p := unsafe.Pointer(&_ascii_encoding_ns)
  18219. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18220. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  18221. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  18222. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  18223. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  18224. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  18225. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  18226. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  18227. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  18228. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  18229. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  18230. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  18231. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  18232. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  18233. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_ascii_toUtf8)
  18234. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  18235. }
  18236. var _ascii_encoding = Tnormal_encoding{
  18237. Fenc: TENCODING{
  18238. Fscanners: [4]TSCANNER{},
  18239. FliteralScanners: [2]TSCANNER{},
  18240. FminBytesPerChar: int32(1),
  18241. FisUtf8: int8(1),
  18242. },
  18243. Ftype1: [256]uint8{
  18244. 9: uint8(_BT_S),
  18245. 10: uint8(_BT_LF),
  18246. 13: uint8(_BT_CR),
  18247. 32: uint8(_BT_S),
  18248. 33: uint8(_BT_EXCL),
  18249. 34: uint8(_BT_QUOT),
  18250. 35: uint8(_BT_NUM),
  18251. 36: uint8(_BT_OTHER),
  18252. 37: uint8(_BT_PERCNT),
  18253. 38: uint8(_BT_AMP),
  18254. 39: uint8(_BT_APOS),
  18255. 40: uint8(_BT_LPAR),
  18256. 41: uint8(_BT_RPAR),
  18257. 42: uint8(_BT_AST),
  18258. 43: uint8(_BT_PLUS),
  18259. 44: uint8(_BT_COMMA),
  18260. 45: uint8(_BT_MINUS),
  18261. 46: uint8(_BT_NAME),
  18262. 47: uint8(_BT_SOL),
  18263. 48: uint8(_BT_DIGIT),
  18264. 49: uint8(_BT_DIGIT),
  18265. 50: uint8(_BT_DIGIT),
  18266. 51: uint8(_BT_DIGIT),
  18267. 52: uint8(_BT_DIGIT),
  18268. 53: uint8(_BT_DIGIT),
  18269. 54: uint8(_BT_DIGIT),
  18270. 55: uint8(_BT_DIGIT),
  18271. 56: uint8(_BT_DIGIT),
  18272. 57: uint8(_BT_DIGIT),
  18273. 58: uint8(_BT_NMSTRT),
  18274. 59: uint8(_BT_SEMI),
  18275. 60: uint8(_BT_LT),
  18276. 61: uint8(_BT_EQUALS),
  18277. 62: uint8(_BT_GT),
  18278. 63: uint8(_BT_QUEST),
  18279. 64: uint8(_BT_OTHER),
  18280. 65: uint8(_BT_HEX),
  18281. 66: uint8(_BT_HEX),
  18282. 67: uint8(_BT_HEX),
  18283. 68: uint8(_BT_HEX),
  18284. 69: uint8(_BT_HEX),
  18285. 70: uint8(_BT_HEX),
  18286. 71: uint8(_BT_NMSTRT),
  18287. 72: uint8(_BT_NMSTRT),
  18288. 73: uint8(_BT_NMSTRT),
  18289. 74: uint8(_BT_NMSTRT),
  18290. 75: uint8(_BT_NMSTRT),
  18291. 76: uint8(_BT_NMSTRT),
  18292. 77: uint8(_BT_NMSTRT),
  18293. 78: uint8(_BT_NMSTRT),
  18294. 79: uint8(_BT_NMSTRT),
  18295. 80: uint8(_BT_NMSTRT),
  18296. 81: uint8(_BT_NMSTRT),
  18297. 82: uint8(_BT_NMSTRT),
  18298. 83: uint8(_BT_NMSTRT),
  18299. 84: uint8(_BT_NMSTRT),
  18300. 85: uint8(_BT_NMSTRT),
  18301. 86: uint8(_BT_NMSTRT),
  18302. 87: uint8(_BT_NMSTRT),
  18303. 88: uint8(_BT_NMSTRT),
  18304. 89: uint8(_BT_NMSTRT),
  18305. 90: uint8(_BT_NMSTRT),
  18306. 91: uint8(_BT_LSQB),
  18307. 92: uint8(_BT_OTHER),
  18308. 93: uint8(_BT_RSQB),
  18309. 94: uint8(_BT_OTHER),
  18310. 95: uint8(_BT_NMSTRT),
  18311. 96: uint8(_BT_OTHER),
  18312. 97: uint8(_BT_HEX),
  18313. 98: uint8(_BT_HEX),
  18314. 99: uint8(_BT_HEX),
  18315. 100: uint8(_BT_HEX),
  18316. 101: uint8(_BT_HEX),
  18317. 102: uint8(_BT_HEX),
  18318. 103: uint8(_BT_NMSTRT),
  18319. 104: uint8(_BT_NMSTRT),
  18320. 105: uint8(_BT_NMSTRT),
  18321. 106: uint8(_BT_NMSTRT),
  18322. 107: uint8(_BT_NMSTRT),
  18323. 108: uint8(_BT_NMSTRT),
  18324. 109: uint8(_BT_NMSTRT),
  18325. 110: uint8(_BT_NMSTRT),
  18326. 111: uint8(_BT_NMSTRT),
  18327. 112: uint8(_BT_NMSTRT),
  18328. 113: uint8(_BT_NMSTRT),
  18329. 114: uint8(_BT_NMSTRT),
  18330. 115: uint8(_BT_NMSTRT),
  18331. 116: uint8(_BT_NMSTRT),
  18332. 117: uint8(_BT_NMSTRT),
  18333. 118: uint8(_BT_NMSTRT),
  18334. 119: uint8(_BT_NMSTRT),
  18335. 120: uint8(_BT_NMSTRT),
  18336. 121: uint8(_BT_NMSTRT),
  18337. 122: uint8(_BT_NMSTRT),
  18338. 123: uint8(_BT_OTHER),
  18339. 124: uint8(_BT_VERBAR),
  18340. 125: uint8(_BT_OTHER),
  18341. 126: uint8(_BT_OTHER),
  18342. 127: uint8(_BT_OTHER),
  18343. },
  18344. }
  18345. func init() {
  18346. p := unsafe.Pointer(&_ascii_encoding)
  18347. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  18348. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_normal_contentTok)
  18349. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_cdataSectionTok)
  18350. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_normal_ignoreSectionTok)
  18351. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_attributeValueTok)
  18352. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_normal_entityValueTok)
  18353. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_nameMatchesAscii)
  18354. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_normal_nameLength)
  18355. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_skipS)
  18356. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_normal_getAtts)
  18357. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_charRefNumber)
  18358. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_normal_predefinedEntityName)
  18359. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_updatePosition)
  18360. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_normal_isPublicId)
  18361. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_ascii_toUtf8)
  18362. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_latin1_toUtf16)
  18363. }
  18364. func _unicode_byte_type(tls *libc.TLS, hi int8, lo int8) (r int32) {
  18365. switch libc.Int32FromUint8(libc.Uint8FromInt8(hi)) {
  18366. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  18367. case int32(0xD8):
  18368. fallthrough
  18369. case int32(0xD9):
  18370. fallthrough
  18371. case int32(0xDA):
  18372. fallthrough
  18373. case int32(0xDB):
  18374. return int32(_BT_LEAD4)
  18375. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  18376. fallthrough
  18377. case int32(0xDC):
  18378. fallthrough
  18379. case int32(0xDD):
  18380. fallthrough
  18381. case int32(0xDE):
  18382. fallthrough
  18383. case int32(0xDF):
  18384. return int32(_BT_TRAIL)
  18385. case int32(0xFF):
  18386. switch libc.Int32FromUint8(libc.Uint8FromInt8(lo)) {
  18387. case int32(0xFF): /* noncharacter-FFFF */
  18388. fallthrough
  18389. case int32(0xFE): /* noncharacter-FFFE */
  18390. return int32(_BT_NONXML)
  18391. }
  18392. break
  18393. }
  18394. return int32(_BT_NONASCII)
  18395. }
  18396. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18397. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18398. var hi, lo, lo2 uint8
  18399. var plane int32
  18400. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18401. from = *(*uintptr)(unsafe.Pointer(fromP))
  18402. _ = enc
  18403. fromLim = from + uintptr((int32(fromLim)-int32(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18404. for {
  18405. if !(from < fromLim) {
  18406. break
  18407. }
  18408. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18409. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18410. switch libc.Int32FromUint8(hi) {
  18411. case 0:
  18412. if libc.Int32FromUint8(lo) < int32(0x80) {
  18413. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18414. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18415. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18416. }
  18417. v3 = toP
  18418. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18419. *(*uintptr)(unsafe.Pointer(v3))++
  18420. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18421. break
  18422. } /* fall through */
  18423. fallthrough
  18424. case int32(0x1):
  18425. fallthrough
  18426. case int32(0x2):
  18427. fallthrough
  18428. case int32(0x3):
  18429. fallthrough
  18430. case int32(0x4):
  18431. fallthrough
  18432. case int32(0x5):
  18433. fallthrough
  18434. case int32(0x6):
  18435. fallthrough
  18436. case int32(0x7):
  18437. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(2) {
  18438. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18439. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18440. }
  18441. v5 = toP
  18442. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18443. *(*uintptr)(unsafe.Pointer(v5))++
  18444. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18445. v7 = toP
  18446. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18447. *(*uintptr)(unsafe.Pointer(v7))++
  18448. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18449. default:
  18450. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(3) {
  18451. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18452. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18453. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18454. v9 = toP
  18455. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18456. *(*uintptr)(unsafe.Pointer(v9))++
  18457. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18458. v11 = toP
  18459. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18460. *(*uintptr)(unsafe.Pointer(v11))++
  18461. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18462. v13 = toP
  18463. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18464. *(*uintptr)(unsafe.Pointer(v13))++
  18465. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18466. case int32(0xD8):
  18467. fallthrough
  18468. case int32(0xD9):
  18469. fallthrough
  18470. case int32(0xDA):
  18471. fallthrough
  18472. case int32(0xDB):
  18473. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(4) {
  18474. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18475. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18476. }
  18477. if int32(fromLim)-int32(from) < int32(4) {
  18478. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18479. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18480. }
  18481. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18482. v15 = toP
  18483. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18484. *(*uintptr)(unsafe.Pointer(v15))++
  18485. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18486. v17 = toP
  18487. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18488. *(*uintptr)(unsafe.Pointer(v17))++
  18489. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18490. from += uintptr(2)
  18491. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18492. v19 = toP
  18493. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18494. *(*uintptr)(unsafe.Pointer(v19))++
  18495. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18496. v21 = toP
  18497. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18498. *(*uintptr)(unsafe.Pointer(v21))++
  18499. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18500. break
  18501. }
  18502. goto _1
  18503. _1:
  18504. ;
  18505. from += uintptr(2)
  18506. }
  18507. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18508. if from < fromLim {
  18509. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18510. } else {
  18511. return int32(_XML_CONVERT_COMPLETED)
  18512. }
  18513. return r
  18514. }
  18515. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18516. var res _XML_Convert_Result
  18517. var v2, v3 uintptr
  18518. _, _, _ = res, v2, v3
  18519. res = int32(_XML_CONVERT_COMPLETED)
  18520. _ = enc
  18521. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  18522. if int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))) > (int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1))))&int32(0xF8) == int32(0xD8) {
  18523. fromLim -= uintptr(2)
  18524. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18525. }
  18526. for {
  18527. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18528. break
  18529. }
  18530. v3 = toP
  18531. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18532. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18533. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))
  18534. goto _1
  18535. _1:
  18536. ;
  18537. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18538. }
  18539. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18540. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18541. } else {
  18542. return res
  18543. }
  18544. return r
  18545. }
  18546. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18547. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  18548. var hi, lo, lo2 uint8
  18549. var plane int32
  18550. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  18551. from = *(*uintptr)(unsafe.Pointer(fromP))
  18552. _ = enc
  18553. fromLim = from + uintptr((int32(fromLim)-int32(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  18554. for {
  18555. if !(from < fromLim) {
  18556. break
  18557. }
  18558. lo = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18559. hi = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from)))
  18560. switch libc.Int32FromUint8(hi) {
  18561. case 0:
  18562. if libc.Int32FromUint8(lo) < int32(0x80) {
  18563. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  18564. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18565. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18566. }
  18567. v3 = toP
  18568. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18569. *(*uintptr)(unsafe.Pointer(v3))++
  18570. *(*int8)(unsafe.Pointer(v2)) = libc.Int8FromUint8(lo)
  18571. break
  18572. } /* fall through */
  18573. fallthrough
  18574. case int32(0x1):
  18575. fallthrough
  18576. case int32(0x2):
  18577. fallthrough
  18578. case int32(0x3):
  18579. fallthrough
  18580. case int32(0x4):
  18581. fallthrough
  18582. case int32(0x5):
  18583. fallthrough
  18584. case int32(0x6):
  18585. fallthrough
  18586. case int32(0x7):
  18587. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(2) {
  18588. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18589. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18590. }
  18591. v5 = toP
  18592. v4 = *(*uintptr)(unsafe.Pointer(v5))
  18593. *(*uintptr)(unsafe.Pointer(v5))++
  18594. *(*int8)(unsafe.Pointer(v4)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  18595. v7 = toP
  18596. v6 = *(*uintptr)(unsafe.Pointer(v7))
  18597. *(*uintptr)(unsafe.Pointer(v7))++
  18598. *(*int8)(unsafe.Pointer(v6)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18599. default:
  18600. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(3) {
  18601. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18602. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18603. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  18604. v9 = toP
  18605. v8 = *(*uintptr)(unsafe.Pointer(v9))
  18606. *(*uintptr)(unsafe.Pointer(v9))++
  18607. *(*int8)(unsafe.Pointer(v8)) = int8(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  18608. v11 = toP
  18609. v10 = *(*uintptr)(unsafe.Pointer(v11))
  18610. *(*uintptr)(unsafe.Pointer(v11))++
  18611. *(*int8)(unsafe.Pointer(v10)) = int8(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18612. v13 = toP
  18613. v12 = *(*uintptr)(unsafe.Pointer(v13))
  18614. *(*uintptr)(unsafe.Pointer(v13))++
  18615. *(*int8)(unsafe.Pointer(v12)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18616. case int32(0xD8):
  18617. fallthrough
  18618. case int32(0xD9):
  18619. fallthrough
  18620. case int32(0xDA):
  18621. fallthrough
  18622. case int32(0xDB):
  18623. if int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) < int32(4) {
  18624. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18625. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18626. }
  18627. if int32(fromLim)-int32(from) < int32(4) {
  18628. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18629. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18630. }
  18631. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  18632. v15 = toP
  18633. v14 = *(*uintptr)(unsafe.Pointer(v15))
  18634. *(*uintptr)(unsafe.Pointer(v15))++
  18635. *(*int8)(unsafe.Pointer(v14)) = int8(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  18636. v17 = toP
  18637. v16 = *(*uintptr)(unsafe.Pointer(v17))
  18638. *(*uintptr)(unsafe.Pointer(v17))++
  18639. *(*int8)(unsafe.Pointer(v16)) = int8(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  18640. from += uintptr(2)
  18641. lo2 = libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from + 1)))
  18642. v19 = toP
  18643. v18 = *(*uintptr)(unsafe.Pointer(v19))
  18644. *(*uintptr)(unsafe.Pointer(v19))++
  18645. *(*int8)(unsafe.Pointer(v18)) = int8(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(from))))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  18646. v21 = toP
  18647. v20 = *(*uintptr)(unsafe.Pointer(v21))
  18648. *(*uintptr)(unsafe.Pointer(v21))++
  18649. *(*int8)(unsafe.Pointer(v20)) = int8(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  18650. break
  18651. }
  18652. goto _1
  18653. _1:
  18654. ;
  18655. from += uintptr(2)
  18656. }
  18657. *(*uintptr)(unsafe.Pointer(fromP)) = from
  18658. if from < fromLim {
  18659. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18660. } else {
  18661. return int32(_XML_CONVERT_COMPLETED)
  18662. }
  18663. return r
  18664. }
  18665. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  18666. var res _XML_Convert_Result
  18667. var v2, v3 uintptr
  18668. _, _, _ = res, v2, v3
  18669. res = int32(_XML_CONVERT_COMPLETED)
  18670. _ = enc
  18671. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  18672. if int32(fromLim)-int32(*(*uintptr)(unsafe.Pointer(fromP))) > (int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2)))))&int32(0xF8) == int32(0xD8) {
  18673. fromLim -= uintptr(2)
  18674. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  18675. }
  18676. for {
  18677. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  18678. break
  18679. }
  18680. v3 = toP
  18681. v2 = *(*uintptr)(unsafe.Pointer(v3))
  18682. *(*uintptr)(unsafe.Pointer(v3)) += 2
  18683. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))<<int32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))))
  18684. goto _1
  18685. _1:
  18686. ;
  18687. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  18688. }
  18689. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  18690. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  18691. } else {
  18692. return res
  18693. }
  18694. return r
  18695. }
  18696. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  18697. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  18698. __ __ _
  18699. ___\ \/ /_ __ __ _| |_
  18700. / _ \\ /| '_ \ / _` | __|
  18701. | __// \| |_) | (_| | |_
  18702. \___/_/\_\ .__/ \__,_|\__|
  18703. |_| XML parser
  18704. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  18705. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  18706. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  18707. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  18708. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  18709. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  18710. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  18711. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  18712. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  18713. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  18714. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  18715. Licensed under the MIT license:
  18716. Permission is hereby granted, free of charge, to any person obtaining
  18717. a copy of this software and associated documentation files (the
  18718. "Software"), to deal in the Software without restriction, including
  18719. without limitation the rights to use, copy, modify, merge, publish,
  18720. distribute, sublicense, and/or sell copies of the Software, and to permit
  18721. persons to whom the Software is furnished to do so, subject to the
  18722. following conditions:
  18723. The above copyright notice and this permission notice shall be included
  18724. in all copies or substantial portions of the Software.
  18725. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18726. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18727. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  18728. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18729. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  18730. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  18731. USE OR OTHER DEALINGS IN THE SOFTWARE.
  18732. */
  18733. /* ptr points to character following "<!-" */
  18734. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18735. var v1 int32
  18736. _ = v1
  18737. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18738. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  18739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18740. return m_XML_TOK_INVALID
  18741. }
  18742. ptr += uintptr(2)
  18743. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18744. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18745. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18746. } else {
  18747. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18748. }
  18749. switch v1 {
  18750. case int32(_BT_LEAD2):
  18751. if int32(end)-int32(ptr) < int32(2) {
  18752. return -int32(2)
  18753. }
  18754. if 0 != 0 {
  18755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18756. return m_XML_TOK_INVALID
  18757. }
  18758. ptr += uintptr(2)
  18759. case int32(_BT_LEAD3):
  18760. if int32(end)-int32(ptr) < int32(3) {
  18761. return -int32(2)
  18762. }
  18763. if 0 != 0 {
  18764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18765. return m_XML_TOK_INVALID
  18766. }
  18767. ptr += uintptr(3)
  18768. case int32(_BT_LEAD4):
  18769. if int32(end)-int32(ptr) < int32(4) {
  18770. return -int32(2)
  18771. }
  18772. if 0 != 0 {
  18773. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18774. return m_XML_TOK_INVALID
  18775. }
  18776. ptr += uintptr(4)
  18777. case int32(_BT_NONXML):
  18778. fallthrough
  18779. case int32(_BT_MALFORM):
  18780. fallthrough
  18781. case int32(_BT_TRAIL):
  18782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18783. return m_XML_TOK_INVALID
  18784. case int32(_BT_MINUS):
  18785. ptr += uintptr(2)
  18786. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18787. return -int32(1)
  18788. }
  18789. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  18790. ptr += uintptr(2)
  18791. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18792. return -int32(1)
  18793. }
  18794. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  18795. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18796. return m_XML_TOK_INVALID
  18797. }
  18798. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18799. return int32(m_XML_TOK_COMMENT)
  18800. }
  18801. default:
  18802. ptr += uintptr(2)
  18803. break
  18804. }
  18805. }
  18806. }
  18807. return -int32(1)
  18808. }
  18809. /* ptr points to character following "<!" */
  18810. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18811. var v1, v2, v3 int32
  18812. _, _, _ = v1, v2, v3
  18813. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18814. return -int32(1)
  18815. }
  18816. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18817. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18818. } else {
  18819. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18820. }
  18821. switch v1 {
  18822. case int32(_BT_MINUS):
  18823. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18824. case int32(_BT_LSQB):
  18825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18826. return int32(m_XML_TOK_COND_SECT_OPEN)
  18827. case int32(_BT_NMSTRT):
  18828. fallthrough
  18829. case int32(_BT_HEX):
  18830. ptr += uintptr(2)
  18831. default:
  18832. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18833. return m_XML_TOK_INVALID
  18834. }
  18835. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18836. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18837. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18838. } else {
  18839. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18840. }
  18841. switch v2 {
  18842. case int32(_BT_PERCNT):
  18843. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  18844. return -int32(1)
  18845. }
  18846. /* don't allow <!ENTITY% foo "whatever"> */
  18847. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  18848. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  18849. } else {
  18850. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  18851. }
  18852. switch v3 {
  18853. case int32(_BT_S):
  18854. fallthrough
  18855. case int32(_BT_CR):
  18856. fallthrough
  18857. case int32(_BT_LF):
  18858. fallthrough
  18859. case int32(_BT_PERCNT):
  18860. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18861. return m_XML_TOK_INVALID
  18862. }
  18863. /* fall through */
  18864. fallthrough
  18865. case int32(_BT_S):
  18866. fallthrough
  18867. case int32(_BT_CR):
  18868. fallthrough
  18869. case int32(_BT_LF):
  18870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18871. return int32(m_XML_TOK_DECL_OPEN)
  18872. case int32(_BT_NMSTRT):
  18873. fallthrough
  18874. case int32(_BT_HEX):
  18875. ptr += uintptr(2)
  18876. default:
  18877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18878. return m_XML_TOK_INVALID
  18879. }
  18880. }
  18881. return -int32(1)
  18882. }
  18883. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  18884. var upper, v1, v2, v3 int32
  18885. _, _, _, _ = upper, v1, v2, v3
  18886. upper = 0
  18887. _ = enc
  18888. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  18889. if int32(end)-int32(ptr) != libc.Int32FromInt32(2)*libc.Int32FromInt32(3) {
  18890. return int32(1)
  18891. }
  18892. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18893. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18894. } else {
  18895. v1 = -int32(1)
  18896. }
  18897. switch v1 {
  18898. case int32(m_ASCII_x2):
  18899. case int32(m_ASCII_X):
  18900. upper = int32(1)
  18901. default:
  18902. return int32(1)
  18903. }
  18904. ptr += uintptr(2)
  18905. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18906. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18907. } else {
  18908. v2 = -int32(1)
  18909. }
  18910. switch v2 {
  18911. case int32(m_ASCII_m2):
  18912. case int32(m_ASCII_M):
  18913. upper = int32(1)
  18914. default:
  18915. return int32(1)
  18916. }
  18917. ptr += uintptr(2)
  18918. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18919. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  18920. } else {
  18921. v3 = -int32(1)
  18922. }
  18923. switch v3 {
  18924. case int32(m_ASCII_l2):
  18925. case int32(m_ASCII_L):
  18926. upper = int32(1)
  18927. default:
  18928. return int32(1)
  18929. }
  18930. if upper != 0 {
  18931. return 0
  18932. }
  18933. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  18934. return int32(1)
  18935. }
  18936. /* ptr points to character following "<?" */
  18937. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18938. bp := tls.Alloc(16)
  18939. defer tls.Free(16)
  18940. var target uintptr
  18941. var v1, v2, v3 int32
  18942. var _ /* tok at bp+0 */ int32
  18943. _, _, _, _ = target, v1, v2, v3
  18944. target = ptr
  18945. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18946. return -int32(1)
  18947. }
  18948. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18949. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18950. } else {
  18951. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  18952. }
  18953. switch v1 {
  18954. case int32(_BT_NONASCII):
  18955. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  18956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18957. return m_XML_TOK_INVALID
  18958. } /* fall through */
  18959. fallthrough
  18960. case int32(_BT_NMSTRT):
  18961. fallthrough
  18962. case int32(_BT_HEX):
  18963. ptr += uintptr(2)
  18964. case int32(_BT_LEAD2):
  18965. if int32(end)-int32(ptr) < int32(2) {
  18966. return -int32(2)
  18967. }
  18968. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18970. return m_XML_TOK_INVALID
  18971. }
  18972. ptr += uintptr(2)
  18973. case int32(_BT_LEAD3):
  18974. if int32(end)-int32(ptr) < int32(3) {
  18975. return -int32(2)
  18976. }
  18977. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18978. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18979. return m_XML_TOK_INVALID
  18980. }
  18981. ptr += uintptr(3)
  18982. case int32(_BT_LEAD4):
  18983. if int32(end)-int32(ptr) < int32(4) {
  18984. return -int32(2)
  18985. }
  18986. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  18987. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18988. return m_XML_TOK_INVALID
  18989. }
  18990. ptr += uintptr(4)
  18991. default:
  18992. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18993. return m_XML_TOK_INVALID
  18994. }
  18995. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  18996. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  18997. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  18998. } else {
  18999. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19000. }
  19001. switch v2 {
  19002. case int32(_BT_NONASCII):
  19003. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19005. return m_XML_TOK_INVALID
  19006. } /* fall through */
  19007. fallthrough
  19008. case int32(_BT_NMSTRT):
  19009. fallthrough
  19010. case int32(_BT_HEX):
  19011. fallthrough
  19012. case int32(_BT_DIGIT):
  19013. fallthrough
  19014. case int32(_BT_NAME):
  19015. fallthrough
  19016. case int32(_BT_MINUS):
  19017. ptr += uintptr(2)
  19018. case int32(_BT_LEAD2):
  19019. if int32(end)-int32(ptr) < int32(2) {
  19020. return -int32(2)
  19021. }
  19022. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19023. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19024. return m_XML_TOK_INVALID
  19025. }
  19026. ptr += uintptr(2)
  19027. case int32(_BT_LEAD3):
  19028. if int32(end)-int32(ptr) < int32(3) {
  19029. return -int32(2)
  19030. }
  19031. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19032. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19033. return m_XML_TOK_INVALID
  19034. }
  19035. ptr += uintptr(3)
  19036. case int32(_BT_LEAD4):
  19037. if int32(end)-int32(ptr) < int32(4) {
  19038. return -int32(2)
  19039. }
  19040. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19041. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19042. return m_XML_TOK_INVALID
  19043. }
  19044. ptr += uintptr(4)
  19045. case int32(_BT_S):
  19046. fallthrough
  19047. case int32(_BT_CR):
  19048. fallthrough
  19049. case int32(_BT_LF):
  19050. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19052. return m_XML_TOK_INVALID
  19053. }
  19054. ptr += uintptr(2)
  19055. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19056. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19057. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19058. } else {
  19059. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19060. }
  19061. switch v3 {
  19062. case int32(_BT_LEAD2):
  19063. if int32(end)-int32(ptr) < int32(2) {
  19064. return -int32(2)
  19065. }
  19066. if 0 != 0 {
  19067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19068. return m_XML_TOK_INVALID
  19069. }
  19070. ptr += uintptr(2)
  19071. case int32(_BT_LEAD3):
  19072. if int32(end)-int32(ptr) < int32(3) {
  19073. return -int32(2)
  19074. }
  19075. if 0 != 0 {
  19076. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19077. return m_XML_TOK_INVALID
  19078. }
  19079. ptr += uintptr(3)
  19080. case int32(_BT_LEAD4):
  19081. if int32(end)-int32(ptr) < int32(4) {
  19082. return -int32(2)
  19083. }
  19084. if 0 != 0 {
  19085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19086. return m_XML_TOK_INVALID
  19087. }
  19088. ptr += uintptr(4)
  19089. case int32(_BT_NONXML):
  19090. fallthrough
  19091. case int32(_BT_MALFORM):
  19092. fallthrough
  19093. case int32(_BT_TRAIL):
  19094. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19095. return m_XML_TOK_INVALID
  19096. case int32(_BT_QUEST):
  19097. ptr += uintptr(2)
  19098. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19099. return -int32(1)
  19100. }
  19101. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19103. return *(*int32)(unsafe.Pointer(bp))
  19104. }
  19105. default:
  19106. ptr += uintptr(2)
  19107. break
  19108. }
  19109. }
  19110. return -int32(1)
  19111. case int32(_BT_QUEST):
  19112. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  19113. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19114. return m_XML_TOK_INVALID
  19115. }
  19116. ptr += uintptr(2)
  19117. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19118. return -int32(1)
  19119. }
  19120. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19121. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19122. return *(*int32)(unsafe.Pointer(bp))
  19123. }
  19124. /* fall through */
  19125. fallthrough
  19126. default:
  19127. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19128. return m_XML_TOK_INVALID
  19129. }
  19130. }
  19131. return -int32(1)
  19132. }
  19133. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19134. var i int32
  19135. _ = i
  19136. _ = enc
  19137. /* CDATA[ */
  19138. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(6)*libc.Int32FromInt32(2)) {
  19139. return -int32(1)
  19140. }
  19141. i = 0
  19142. for {
  19143. if !(i < int32(6)) {
  19144. break
  19145. }
  19146. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(_CDATA_LSQB1[i])) {
  19147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19148. return m_XML_TOK_INVALID
  19149. }
  19150. goto _1
  19151. _1:
  19152. ;
  19153. i++
  19154. ptr += uintptr(2)
  19155. }
  19156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19157. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  19158. }
  19159. var _CDATA_LSQB1 = [6]int8{
  19160. 0: int8(m_ASCII_C),
  19161. 1: int8(m_ASCII_D),
  19162. 2: int8(m_ASCII_A),
  19163. 3: int8(m_ASCII_T),
  19164. 4: int8(m_ASCII_A),
  19165. 5: int8(m_ASCII_LSQB1),
  19166. }
  19167. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19168. var n Tsize_t
  19169. var v1, v2, v3 int32
  19170. _, _, _, _ = n, v1, v2, v3
  19171. if ptr >= end {
  19172. return -int32(4)
  19173. }
  19174. if int32(2) > int32(1) {
  19175. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  19176. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19177. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19178. if n == uint32(0) {
  19179. return -int32(1)
  19180. }
  19181. end = ptr + uintptr(n)
  19182. }
  19183. }
  19184. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19185. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19186. } else {
  19187. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19188. }
  19189. switch v1 {
  19190. case int32(_BT_RSQB):
  19191. ptr += uintptr(2)
  19192. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19193. return -int32(1)
  19194. }
  19195. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  19196. break
  19197. }
  19198. ptr += uintptr(2)
  19199. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19200. return -int32(1)
  19201. }
  19202. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  19203. ptr -= uintptr(2)
  19204. break
  19205. }
  19206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19207. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  19208. case int32(_BT_CR):
  19209. ptr += uintptr(2)
  19210. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19211. return -int32(1)
  19212. }
  19213. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19214. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19215. } else {
  19216. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19217. }
  19218. if v2 == int32(_BT_LF) {
  19219. ptr += uintptr(2)
  19220. }
  19221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19222. return int32(m_XML_TOK_DATA_NEWLINE)
  19223. case int32(_BT_LF):
  19224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19225. return int32(m_XML_TOK_DATA_NEWLINE)
  19226. case int32(_BT_LEAD2):
  19227. if int32(end)-int32(ptr) < int32(2) {
  19228. return -int32(2)
  19229. }
  19230. if 0 != 0 {
  19231. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19232. return m_XML_TOK_INVALID
  19233. }
  19234. ptr += uintptr(2)
  19235. case int32(_BT_LEAD3):
  19236. if int32(end)-int32(ptr) < int32(3) {
  19237. return -int32(2)
  19238. }
  19239. if 0 != 0 {
  19240. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19241. return m_XML_TOK_INVALID
  19242. }
  19243. ptr += uintptr(3)
  19244. case int32(_BT_LEAD4):
  19245. if int32(end)-int32(ptr) < int32(4) {
  19246. return -int32(2)
  19247. }
  19248. if 0 != 0 {
  19249. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19250. return m_XML_TOK_INVALID
  19251. }
  19252. ptr += uintptr(4)
  19253. case int32(_BT_NONXML):
  19254. fallthrough
  19255. case int32(_BT_MALFORM):
  19256. fallthrough
  19257. case int32(_BT_TRAIL):
  19258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19259. return m_XML_TOK_INVALID
  19260. default:
  19261. ptr += uintptr(2)
  19262. break
  19263. }
  19264. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19265. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19266. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19267. } else {
  19268. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19269. }
  19270. switch v3 {
  19271. case int32(_BT_LEAD2):
  19272. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  19273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19274. return int32(m_XML_TOK_DATA_CHARS)
  19275. }
  19276. ptr += uintptr(2)
  19277. case int32(_BT_LEAD3):
  19278. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  19279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19280. return int32(m_XML_TOK_DATA_CHARS)
  19281. }
  19282. ptr += uintptr(3)
  19283. case int32(_BT_LEAD4):
  19284. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  19285. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19286. return int32(m_XML_TOK_DATA_CHARS)
  19287. }
  19288. ptr += uintptr(4)
  19289. case int32(_BT_NONXML):
  19290. fallthrough
  19291. case int32(_BT_MALFORM):
  19292. fallthrough
  19293. case int32(_BT_TRAIL):
  19294. fallthrough
  19295. case int32(_BT_CR):
  19296. fallthrough
  19297. case int32(_BT_LF):
  19298. fallthrough
  19299. case int32(_BT_RSQB):
  19300. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19301. return int32(m_XML_TOK_DATA_CHARS)
  19302. default:
  19303. ptr += uintptr(2)
  19304. break
  19305. }
  19306. }
  19307. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19308. return int32(m_XML_TOK_DATA_CHARS)
  19309. }
  19310. /* ptr points to character following "</" */
  19311. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19312. var v1, v2, v22 int32
  19313. _, _, _ = v1, v2, v22
  19314. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19315. return -int32(1)
  19316. }
  19317. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19318. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19319. } else {
  19320. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19321. }
  19322. switch v1 {
  19323. case int32(_BT_NONASCII):
  19324. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19325. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19326. return m_XML_TOK_INVALID
  19327. } /* fall through */
  19328. fallthrough
  19329. case int32(_BT_NMSTRT):
  19330. fallthrough
  19331. case int32(_BT_HEX):
  19332. ptr += uintptr(2)
  19333. case int32(_BT_LEAD2):
  19334. if int32(end)-int32(ptr) < int32(2) {
  19335. return -int32(2)
  19336. }
  19337. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19339. return m_XML_TOK_INVALID
  19340. }
  19341. ptr += uintptr(2)
  19342. case int32(_BT_LEAD3):
  19343. if int32(end)-int32(ptr) < int32(3) {
  19344. return -int32(2)
  19345. }
  19346. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19347. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19348. return m_XML_TOK_INVALID
  19349. }
  19350. ptr += uintptr(3)
  19351. case int32(_BT_LEAD4):
  19352. if int32(end)-int32(ptr) < int32(4) {
  19353. return -int32(2)
  19354. }
  19355. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19356. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19357. return m_XML_TOK_INVALID
  19358. }
  19359. ptr += uintptr(4)
  19360. default:
  19361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19362. return m_XML_TOK_INVALID
  19363. }
  19364. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19365. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19366. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19367. } else {
  19368. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19369. }
  19370. switch v2 {
  19371. case int32(_BT_NONASCII):
  19372. goto _3
  19373. case int32(_BT_MINUS):
  19374. goto _4
  19375. case int32(_BT_NAME):
  19376. goto _5
  19377. case int32(_BT_DIGIT):
  19378. goto _6
  19379. case int32(_BT_HEX):
  19380. goto _7
  19381. case int32(_BT_NMSTRT):
  19382. goto _8
  19383. case int32(_BT_LEAD2):
  19384. goto _9
  19385. case int32(_BT_LEAD3):
  19386. goto _10
  19387. case int32(_BT_LEAD4):
  19388. goto _11
  19389. case int32(_BT_LF):
  19390. goto _12
  19391. case int32(_BT_CR):
  19392. goto _13
  19393. case int32(_BT_S):
  19394. goto _14
  19395. case int32(_BT_COLON):
  19396. goto _15
  19397. case int32(_BT_GT):
  19398. goto _16
  19399. default:
  19400. goto _17
  19401. }
  19402. goto _18
  19403. _3:
  19404. ;
  19405. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19407. return m_XML_TOK_INVALID
  19408. } /* fall through */
  19409. _8:
  19410. ;
  19411. _7:
  19412. ;
  19413. _6:
  19414. ;
  19415. _5:
  19416. ;
  19417. _4:
  19418. ;
  19419. ptr += uintptr(2)
  19420. goto _18
  19421. _9:
  19422. ;
  19423. if int32(end)-int32(ptr) < int32(2) {
  19424. return -int32(2)
  19425. }
  19426. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19427. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19428. return m_XML_TOK_INVALID
  19429. }
  19430. ptr += uintptr(2)
  19431. goto _18
  19432. _10:
  19433. ;
  19434. if int32(end)-int32(ptr) < int32(3) {
  19435. return -int32(2)
  19436. }
  19437. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19438. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19439. return m_XML_TOK_INVALID
  19440. }
  19441. ptr += uintptr(3)
  19442. goto _18
  19443. _11:
  19444. ;
  19445. if int32(end)-int32(ptr) < int32(4) {
  19446. return -int32(2)
  19447. }
  19448. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19450. return m_XML_TOK_INVALID
  19451. }
  19452. ptr += uintptr(4)
  19453. goto _18
  19454. _14:
  19455. ;
  19456. _13:
  19457. ;
  19458. _12:
  19459. ;
  19460. ptr += uintptr(2)
  19461. _21:
  19462. ;
  19463. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19464. goto _19
  19465. }
  19466. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19467. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19468. } else {
  19469. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19470. }
  19471. switch v22 {
  19472. case int32(_BT_S):
  19473. fallthrough
  19474. case int32(_BT_CR):
  19475. fallthrough
  19476. case int32(_BT_LF):
  19477. case int32(_BT_GT):
  19478. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19479. return int32(m_XML_TOK_END_TAG)
  19480. default:
  19481. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19482. return m_XML_TOK_INVALID
  19483. }
  19484. goto _20
  19485. _20:
  19486. ;
  19487. ptr += uintptr(2)
  19488. goto _21
  19489. goto _19
  19490. _19:
  19491. ;
  19492. return -int32(1)
  19493. _15:
  19494. ;
  19495. /* no need to check qname syntax here,
  19496. since end-tag must match exactly */
  19497. ptr += uintptr(2)
  19498. goto _18
  19499. _16:
  19500. ;
  19501. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19502. return int32(m_XML_TOK_END_TAG)
  19503. _17:
  19504. ;
  19505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19506. return m_XML_TOK_INVALID
  19507. _18:
  19508. }
  19509. return -int32(1)
  19510. }
  19511. /* ptr points to character following "&#X" */
  19512. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19513. var v1, v3 int32
  19514. _, _ = v1, v3
  19515. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19516. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19517. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19518. } else {
  19519. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19520. }
  19521. switch v1 {
  19522. case int32(_BT_DIGIT):
  19523. fallthrough
  19524. case int32(_BT_HEX):
  19525. default:
  19526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19527. return m_XML_TOK_INVALID
  19528. }
  19529. ptr += uintptr(2)
  19530. for {
  19531. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19532. break
  19533. }
  19534. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19535. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19536. } else {
  19537. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19538. }
  19539. switch v3 {
  19540. case int32(_BT_DIGIT):
  19541. fallthrough
  19542. case int32(_BT_HEX):
  19543. case int32(_BT_SEMI):
  19544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19545. return int32(m_XML_TOK_CHAR_REF)
  19546. default:
  19547. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19548. return m_XML_TOK_INVALID
  19549. }
  19550. goto _2
  19551. _2:
  19552. ;
  19553. ptr += uintptr(2)
  19554. }
  19555. }
  19556. return -int32(1)
  19557. }
  19558. /* ptr points to character following "&#" */
  19559. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19560. var v1, v3 int32
  19561. _, _ = v1, v3
  19562. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19563. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  19564. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19565. }
  19566. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19567. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19568. } else {
  19569. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19570. }
  19571. switch v1 {
  19572. case int32(_BT_DIGIT):
  19573. default:
  19574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19575. return m_XML_TOK_INVALID
  19576. }
  19577. ptr += uintptr(2)
  19578. for {
  19579. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19580. break
  19581. }
  19582. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19583. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19584. } else {
  19585. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19586. }
  19587. switch v3 {
  19588. case int32(_BT_DIGIT):
  19589. case int32(_BT_SEMI):
  19590. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19591. return int32(m_XML_TOK_CHAR_REF)
  19592. default:
  19593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19594. return m_XML_TOK_INVALID
  19595. }
  19596. goto _2
  19597. _2:
  19598. ;
  19599. ptr += uintptr(2)
  19600. }
  19601. }
  19602. return -int32(1)
  19603. }
  19604. /* ptr points to character following "&" */
  19605. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19606. var v1, v2 int32
  19607. _, _ = v1, v2
  19608. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19609. return -int32(1)
  19610. }
  19611. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19612. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19613. } else {
  19614. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19615. }
  19616. switch v1 {
  19617. case int32(_BT_NONASCII):
  19618. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19619. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19620. return m_XML_TOK_INVALID
  19621. } /* fall through */
  19622. fallthrough
  19623. case int32(_BT_NMSTRT):
  19624. fallthrough
  19625. case int32(_BT_HEX):
  19626. ptr += uintptr(2)
  19627. case int32(_BT_LEAD2):
  19628. if int32(end)-int32(ptr) < int32(2) {
  19629. return -int32(2)
  19630. }
  19631. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19632. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19633. return m_XML_TOK_INVALID
  19634. }
  19635. ptr += uintptr(2)
  19636. case int32(_BT_LEAD3):
  19637. if int32(end)-int32(ptr) < int32(3) {
  19638. return -int32(2)
  19639. }
  19640. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19642. return m_XML_TOK_INVALID
  19643. }
  19644. ptr += uintptr(3)
  19645. case int32(_BT_LEAD4):
  19646. if int32(end)-int32(ptr) < int32(4) {
  19647. return -int32(2)
  19648. }
  19649. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19650. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19651. return m_XML_TOK_INVALID
  19652. }
  19653. ptr += uintptr(4)
  19654. case int32(_BT_NUM):
  19655. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19656. default:
  19657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19658. return m_XML_TOK_INVALID
  19659. }
  19660. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19661. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  19662. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  19663. } else {
  19664. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  19665. }
  19666. switch v2 {
  19667. case int32(_BT_NONASCII):
  19668. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  19669. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19670. return m_XML_TOK_INVALID
  19671. } /* fall through */
  19672. fallthrough
  19673. case int32(_BT_NMSTRT):
  19674. fallthrough
  19675. case int32(_BT_HEX):
  19676. fallthrough
  19677. case int32(_BT_DIGIT):
  19678. fallthrough
  19679. case int32(_BT_NAME):
  19680. fallthrough
  19681. case int32(_BT_MINUS):
  19682. ptr += uintptr(2)
  19683. case int32(_BT_LEAD2):
  19684. if int32(end)-int32(ptr) < int32(2) {
  19685. return -int32(2)
  19686. }
  19687. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19689. return m_XML_TOK_INVALID
  19690. }
  19691. ptr += uintptr(2)
  19692. case int32(_BT_LEAD3):
  19693. if int32(end)-int32(ptr) < int32(3) {
  19694. return -int32(2)
  19695. }
  19696. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19697. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19698. return m_XML_TOK_INVALID
  19699. }
  19700. ptr += uintptr(3)
  19701. case int32(_BT_LEAD4):
  19702. if int32(end)-int32(ptr) < int32(4) {
  19703. return -int32(2)
  19704. }
  19705. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19706. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19707. return m_XML_TOK_INVALID
  19708. }
  19709. ptr += uintptr(4)
  19710. case int32(_BT_SEMI):
  19711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19712. return int32(m_XML_TOK_ENTITY_REF)
  19713. default:
  19714. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19715. return m_XML_TOK_INVALID
  19716. }
  19717. }
  19718. return -int32(1)
  19719. }
  19720. /* ptr points to character following first character of attribute name */
  19721. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19722. bp := tls.Alloc(16)
  19723. defer tls.Free(16)
  19724. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  19725. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  19726. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  19727. hadColon = 0
  19728. for int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  19729. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19730. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19731. } else {
  19732. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19733. }
  19734. switch v1 {
  19735. case int32(_BT_NONASCII):
  19736. goto _2
  19737. case int32(_BT_MINUS):
  19738. goto _3
  19739. case int32(_BT_NAME):
  19740. goto _4
  19741. case int32(_BT_DIGIT):
  19742. goto _5
  19743. case int32(_BT_HEX):
  19744. goto _6
  19745. case int32(_BT_NMSTRT):
  19746. goto _7
  19747. case int32(_BT_LEAD2):
  19748. goto _8
  19749. case int32(_BT_LEAD3):
  19750. goto _9
  19751. case int32(_BT_LEAD4):
  19752. goto _10
  19753. case int32(_BT_COLON):
  19754. goto _11
  19755. case int32(_BT_LF):
  19756. goto _12
  19757. case int32(_BT_CR):
  19758. goto _13
  19759. case int32(_BT_S):
  19760. goto _14
  19761. case int32(_BT_EQUALS):
  19762. goto _15
  19763. default:
  19764. goto _16
  19765. }
  19766. goto _17
  19767. _2:
  19768. ;
  19769. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  19770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19771. return m_XML_TOK_INVALID
  19772. } /* fall through */
  19773. _7:
  19774. ;
  19775. _6:
  19776. ;
  19777. _5:
  19778. ;
  19779. _4:
  19780. ;
  19781. _3:
  19782. ;
  19783. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19784. goto _17
  19785. _8:
  19786. ;
  19787. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  19788. return -int32(2)
  19789. }
  19790. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19791. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19792. return m_XML_TOK_INVALID
  19793. }
  19794. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19795. goto _17
  19796. _9:
  19797. ;
  19798. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  19799. return -int32(2)
  19800. }
  19801. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19802. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19803. return m_XML_TOK_INVALID
  19804. }
  19805. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19806. goto _17
  19807. _10:
  19808. ;
  19809. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  19810. return -int32(2)
  19811. }
  19812. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19813. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19814. return m_XML_TOK_INVALID
  19815. }
  19816. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19817. goto _17
  19818. _11:
  19819. ;
  19820. if hadColon != 0 {
  19821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19822. return m_XML_TOK_INVALID
  19823. }
  19824. hadColon = int32(1)
  19825. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19826. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19827. return -int32(1)
  19828. }
  19829. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19830. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19831. } else {
  19832. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19833. }
  19834. switch v18 {
  19835. case int32(_BT_NONASCII):
  19836. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  19837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19838. return m_XML_TOK_INVALID
  19839. } /* fall through */
  19840. fallthrough
  19841. case int32(_BT_NMSTRT):
  19842. fallthrough
  19843. case int32(_BT_HEX):
  19844. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19845. case int32(_BT_LEAD2):
  19846. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  19847. return -int32(2)
  19848. }
  19849. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19851. return m_XML_TOK_INVALID
  19852. }
  19853. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19854. case int32(_BT_LEAD3):
  19855. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  19856. return -int32(2)
  19857. }
  19858. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19860. return m_XML_TOK_INVALID
  19861. }
  19862. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19863. case int32(_BT_LEAD4):
  19864. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  19865. return -int32(2)
  19866. }
  19867. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  19868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19869. return m_XML_TOK_INVALID
  19870. }
  19871. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19872. default:
  19873. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19874. return m_XML_TOK_INVALID
  19875. }
  19876. goto _17
  19877. _14:
  19878. ;
  19879. _13:
  19880. ;
  19881. _12:
  19882. ;
  19883. _21:
  19884. ;
  19885. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19886. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19887. return -int32(1)
  19888. }
  19889. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19890. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19891. } else {
  19892. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19893. }
  19894. t = v22
  19895. if t == int32(_BT_EQUALS) {
  19896. goto _19
  19897. }
  19898. switch t {
  19899. case int32(_BT_S):
  19900. fallthrough
  19901. case int32(_BT_LF):
  19902. fallthrough
  19903. case int32(_BT_CR):
  19904. default:
  19905. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19906. return m_XML_TOK_INVALID
  19907. }
  19908. goto _20
  19909. _20:
  19910. ;
  19911. goto _21
  19912. goto _19
  19913. _19:
  19914. ;
  19915. /* fall through */
  19916. _15:
  19917. ;
  19918. hadColon = 0
  19919. for {
  19920. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19921. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19922. return -int32(1)
  19923. }
  19924. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19925. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19926. } else {
  19927. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19928. }
  19929. open = v24
  19930. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  19931. break
  19932. }
  19933. switch open {
  19934. case int32(_BT_S):
  19935. fallthrough
  19936. case int32(_BT_LF):
  19937. fallthrough
  19938. case int32(_BT_CR):
  19939. default:
  19940. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19941. return m_XML_TOK_INVALID
  19942. }
  19943. goto _23
  19944. _23:
  19945. }
  19946. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19947. /* in attribute value */
  19948. for {
  19949. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19950. return -int32(1)
  19951. }
  19952. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  19953. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  19954. } else {
  19955. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  19956. }
  19957. t1 = v26
  19958. if t1 == open {
  19959. break
  19960. }
  19961. switch t1 {
  19962. case int32(_BT_LEAD2):
  19963. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  19964. return -int32(2)
  19965. }
  19966. if 0 != 0 {
  19967. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19968. return m_XML_TOK_INVALID
  19969. }
  19970. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  19971. case int32(_BT_LEAD3):
  19972. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  19973. return -int32(2)
  19974. }
  19975. if 0 != 0 {
  19976. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19977. return m_XML_TOK_INVALID
  19978. }
  19979. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  19980. case int32(_BT_LEAD4):
  19981. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  19982. return -int32(2)
  19983. }
  19984. if 0 != 0 {
  19985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19986. return m_XML_TOK_INVALID
  19987. }
  19988. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  19989. case int32(_BT_NONXML):
  19990. fallthrough
  19991. case int32(_BT_MALFORM):
  19992. fallthrough
  19993. case int32(_BT_TRAIL):
  19994. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  19995. return m_XML_TOK_INVALID
  19996. case int32(_BT_AMP):
  19997. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  19998. if tok <= 0 {
  19999. if tok == m_XML_TOK_INVALID {
  20000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20001. }
  20002. return tok
  20003. }
  20004. case int32(_BT_LT):
  20005. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20006. return m_XML_TOK_INVALID
  20007. default:
  20008. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20009. break
  20010. }
  20011. goto _25
  20012. _25:
  20013. }
  20014. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20015. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20016. return -int32(1)
  20017. }
  20018. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20019. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20020. } else {
  20021. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20022. }
  20023. switch v27 {
  20024. case int32(_BT_S):
  20025. fallthrough
  20026. case int32(_BT_CR):
  20027. fallthrough
  20028. case int32(_BT_LF):
  20029. case int32(_BT_SOL):
  20030. goto sol
  20031. case int32(_BT_GT):
  20032. goto gt
  20033. default:
  20034. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20035. return m_XML_TOK_INVALID
  20036. }
  20037. /* ptr points to closing quote */
  20038. _30:
  20039. ;
  20040. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20041. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20042. return -int32(1)
  20043. }
  20044. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  20045. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))))
  20046. } else {
  20047. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  20048. }
  20049. switch v31 {
  20050. case int32(_BT_NONASCII):
  20051. goto _32
  20052. case int32(_BT_HEX):
  20053. goto _33
  20054. case int32(_BT_NMSTRT):
  20055. goto _34
  20056. case int32(_BT_LEAD2):
  20057. goto _35
  20058. case int32(_BT_LEAD3):
  20059. goto _36
  20060. case int32(_BT_LEAD4):
  20061. goto _37
  20062. case int32(_BT_LF):
  20063. goto _38
  20064. case int32(_BT_CR):
  20065. goto _39
  20066. case int32(_BT_S):
  20067. goto _40
  20068. case int32(_BT_GT):
  20069. goto _41
  20070. case int32(_BT_SOL):
  20071. goto _42
  20072. default:
  20073. goto _43
  20074. }
  20075. goto _44
  20076. _32:
  20077. ;
  20078. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))&libc.Int32FromInt32(0x1F))) != 0) {
  20079. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20080. return m_XML_TOK_INVALID
  20081. } /* fall through */
  20082. _34:
  20083. ;
  20084. _33:
  20085. ;
  20086. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20087. goto _44
  20088. _35:
  20089. ;
  20090. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  20091. return -int32(2)
  20092. }
  20093. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20094. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20095. return m_XML_TOK_INVALID
  20096. }
  20097. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20098. goto _44
  20099. _36:
  20100. ;
  20101. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  20102. return -int32(2)
  20103. }
  20104. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20105. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20106. return m_XML_TOK_INVALID
  20107. }
  20108. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  20109. goto _44
  20110. _37:
  20111. ;
  20112. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  20113. return -int32(2)
  20114. }
  20115. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20117. return m_XML_TOK_INVALID
  20118. }
  20119. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  20120. goto _44
  20121. _40:
  20122. ;
  20123. _39:
  20124. ;
  20125. _38:
  20126. ;
  20127. goto _29
  20128. _41:
  20129. ;
  20130. goto gt
  20131. gt:
  20132. ;
  20133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20134. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  20135. _42:
  20136. ;
  20137. goto sol
  20138. sol:
  20139. ;
  20140. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  20141. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20142. return -int32(1)
  20143. }
  20144. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  20145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20146. return m_XML_TOK_INVALID
  20147. }
  20148. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  20149. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  20150. _43:
  20151. ;
  20152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20153. return m_XML_TOK_INVALID
  20154. _44:
  20155. ;
  20156. goto _28
  20157. goto _29
  20158. _29:
  20159. ;
  20160. goto _30
  20161. goto _28
  20162. _28:
  20163. ;
  20164. goto _17
  20165. _16:
  20166. ;
  20167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  20168. return m_XML_TOK_INVALID
  20169. _17:
  20170. }
  20171. return -int32(1)
  20172. }
  20173. /* ptr points to character following "<" */
  20174. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20175. var hadColon, v1, v2, v21, v22, v3 int32
  20176. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  20177. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20178. return -int32(1)
  20179. }
  20180. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20181. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20182. } else {
  20183. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20184. }
  20185. switch v1 {
  20186. case int32(_BT_NONASCII):
  20187. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20189. return m_XML_TOK_INVALID
  20190. } /* fall through */
  20191. fallthrough
  20192. case int32(_BT_NMSTRT):
  20193. fallthrough
  20194. case int32(_BT_HEX):
  20195. ptr += uintptr(2)
  20196. case int32(_BT_LEAD2):
  20197. if int32(end)-int32(ptr) < int32(2) {
  20198. return -int32(2)
  20199. }
  20200. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20202. return m_XML_TOK_INVALID
  20203. }
  20204. ptr += uintptr(2)
  20205. case int32(_BT_LEAD3):
  20206. if int32(end)-int32(ptr) < int32(3) {
  20207. return -int32(2)
  20208. }
  20209. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20211. return m_XML_TOK_INVALID
  20212. }
  20213. ptr += uintptr(3)
  20214. case int32(_BT_LEAD4):
  20215. if int32(end)-int32(ptr) < int32(4) {
  20216. return -int32(2)
  20217. }
  20218. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20219. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20220. return m_XML_TOK_INVALID
  20221. }
  20222. ptr += uintptr(4)
  20223. case int32(_BT_EXCL):
  20224. ptr += uintptr(2)
  20225. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20226. return -int32(1)
  20227. }
  20228. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20229. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20230. } else {
  20231. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20232. }
  20233. switch v2 {
  20234. case int32(_BT_MINUS):
  20235. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20236. case int32(_BT_LSQB):
  20237. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20238. }
  20239. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20240. return m_XML_TOK_INVALID
  20241. case int32(_BT_QUEST):
  20242. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20243. case int32(_BT_SOL):
  20244. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20245. default:
  20246. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20247. return m_XML_TOK_INVALID
  20248. }
  20249. hadColon = 0
  20250. /* we have a start-tag */
  20251. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20252. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20253. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20254. } else {
  20255. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20256. }
  20257. switch v3 {
  20258. case int32(_BT_NONASCII):
  20259. goto _4
  20260. case int32(_BT_MINUS):
  20261. goto _5
  20262. case int32(_BT_NAME):
  20263. goto _6
  20264. case int32(_BT_DIGIT):
  20265. goto _7
  20266. case int32(_BT_HEX):
  20267. goto _8
  20268. case int32(_BT_NMSTRT):
  20269. goto _9
  20270. case int32(_BT_LEAD2):
  20271. goto _10
  20272. case int32(_BT_LEAD3):
  20273. goto _11
  20274. case int32(_BT_LEAD4):
  20275. goto _12
  20276. case int32(_BT_COLON):
  20277. goto _13
  20278. case int32(_BT_LF):
  20279. goto _14
  20280. case int32(_BT_CR):
  20281. goto _15
  20282. case int32(_BT_S):
  20283. goto _16
  20284. case int32(_BT_GT):
  20285. goto _17
  20286. case int32(_BT_SOL):
  20287. goto _18
  20288. default:
  20289. goto _19
  20290. }
  20291. goto _20
  20292. _4:
  20293. ;
  20294. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20295. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20296. return m_XML_TOK_INVALID
  20297. } /* fall through */
  20298. _9:
  20299. ;
  20300. _8:
  20301. ;
  20302. _7:
  20303. ;
  20304. _6:
  20305. ;
  20306. _5:
  20307. ;
  20308. ptr += uintptr(2)
  20309. goto _20
  20310. _10:
  20311. ;
  20312. if int32(end)-int32(ptr) < int32(2) {
  20313. return -int32(2)
  20314. }
  20315. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20316. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20317. return m_XML_TOK_INVALID
  20318. }
  20319. ptr += uintptr(2)
  20320. goto _20
  20321. _11:
  20322. ;
  20323. if int32(end)-int32(ptr) < int32(3) {
  20324. return -int32(2)
  20325. }
  20326. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20327. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20328. return m_XML_TOK_INVALID
  20329. }
  20330. ptr += uintptr(3)
  20331. goto _20
  20332. _12:
  20333. ;
  20334. if int32(end)-int32(ptr) < int32(4) {
  20335. return -int32(2)
  20336. }
  20337. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20338. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20339. return m_XML_TOK_INVALID
  20340. }
  20341. ptr += uintptr(4)
  20342. goto _20
  20343. _13:
  20344. ;
  20345. if hadColon != 0 {
  20346. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20347. return m_XML_TOK_INVALID
  20348. }
  20349. hadColon = int32(1)
  20350. ptr += uintptr(2)
  20351. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20352. return -int32(1)
  20353. }
  20354. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20355. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20356. } else {
  20357. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20358. }
  20359. switch v21 {
  20360. case int32(_BT_NONASCII):
  20361. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20362. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20363. return m_XML_TOK_INVALID
  20364. } /* fall through */
  20365. fallthrough
  20366. case int32(_BT_NMSTRT):
  20367. fallthrough
  20368. case int32(_BT_HEX):
  20369. ptr += uintptr(2)
  20370. case int32(_BT_LEAD2):
  20371. if int32(end)-int32(ptr) < int32(2) {
  20372. return -int32(2)
  20373. }
  20374. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20375. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20376. return m_XML_TOK_INVALID
  20377. }
  20378. ptr += uintptr(2)
  20379. case int32(_BT_LEAD3):
  20380. if int32(end)-int32(ptr) < int32(3) {
  20381. return -int32(2)
  20382. }
  20383. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20385. return m_XML_TOK_INVALID
  20386. }
  20387. ptr += uintptr(3)
  20388. case int32(_BT_LEAD4):
  20389. if int32(end)-int32(ptr) < int32(4) {
  20390. return -int32(2)
  20391. }
  20392. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20393. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20394. return m_XML_TOK_INVALID
  20395. }
  20396. ptr += uintptr(4)
  20397. default:
  20398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20399. return m_XML_TOK_INVALID
  20400. }
  20401. goto _20
  20402. _16:
  20403. ;
  20404. _15:
  20405. ;
  20406. _14:
  20407. ;
  20408. ptr += uintptr(2)
  20409. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20410. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20411. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20412. } else {
  20413. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20414. }
  20415. switch v22 {
  20416. case int32(_BT_NONASCII):
  20417. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20418. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20419. return m_XML_TOK_INVALID
  20420. } /* fall through */
  20421. fallthrough
  20422. case int32(_BT_NMSTRT):
  20423. fallthrough
  20424. case int32(_BT_HEX):
  20425. ptr += uintptr(2)
  20426. case int32(_BT_LEAD2):
  20427. if int32(end)-int32(ptr) < int32(2) {
  20428. return -int32(2)
  20429. }
  20430. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20431. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20432. return m_XML_TOK_INVALID
  20433. }
  20434. ptr += uintptr(2)
  20435. case int32(_BT_LEAD3):
  20436. if int32(end)-int32(ptr) < int32(3) {
  20437. return -int32(2)
  20438. }
  20439. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20440. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20441. return m_XML_TOK_INVALID
  20442. }
  20443. ptr += uintptr(3)
  20444. case int32(_BT_LEAD4):
  20445. if int32(end)-int32(ptr) < int32(4) {
  20446. return -int32(2)
  20447. }
  20448. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20450. return m_XML_TOK_INVALID
  20451. }
  20452. ptr += uintptr(4)
  20453. case int32(_BT_GT):
  20454. goto gt
  20455. case int32(_BT_SOL):
  20456. goto sol
  20457. case int32(_BT_S):
  20458. fallthrough
  20459. case int32(_BT_CR):
  20460. fallthrough
  20461. case int32(_BT_LF):
  20462. ptr += uintptr(2)
  20463. continue
  20464. default:
  20465. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20466. return m_XML_TOK_INVALID
  20467. }
  20468. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  20469. }
  20470. return -int32(1)
  20471. _17:
  20472. ;
  20473. goto gt
  20474. gt:
  20475. ;
  20476. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20477. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  20478. _18:
  20479. ;
  20480. goto sol
  20481. sol:
  20482. ;
  20483. ptr += uintptr(2)
  20484. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20485. return -int32(1)
  20486. }
  20487. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20488. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20489. return m_XML_TOK_INVALID
  20490. }
  20491. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20492. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  20493. _19:
  20494. ;
  20495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20496. return m_XML_TOK_INVALID
  20497. _20:
  20498. }
  20499. return -int32(1)
  20500. }
  20501. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20502. var n Tsize_t
  20503. var v1, v2, v3 int32
  20504. _, _, _, _ = n, v1, v2, v3
  20505. if ptr >= end {
  20506. return -int32(4)
  20507. }
  20508. if int32(2) > int32(1) {
  20509. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  20510. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  20511. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  20512. if n == uint32(0) {
  20513. return -int32(1)
  20514. }
  20515. end = ptr + uintptr(n)
  20516. }
  20517. }
  20518. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20519. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20520. } else {
  20521. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20522. }
  20523. switch v1 {
  20524. case int32(_BT_LT):
  20525. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20526. case int32(_BT_AMP):
  20527. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20528. case int32(_BT_CR):
  20529. ptr += uintptr(2)
  20530. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20531. return -int32(3)
  20532. }
  20533. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20534. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20535. } else {
  20536. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20537. }
  20538. if v2 == int32(_BT_LF) {
  20539. ptr += uintptr(2)
  20540. }
  20541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20542. return int32(m_XML_TOK_DATA_NEWLINE)
  20543. case int32(_BT_LF):
  20544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20545. return int32(m_XML_TOK_DATA_NEWLINE)
  20546. case int32(_BT_RSQB):
  20547. ptr += uintptr(2)
  20548. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20549. return -int32(5)
  20550. }
  20551. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  20552. break
  20553. }
  20554. ptr += uintptr(2)
  20555. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20556. return -int32(5)
  20557. }
  20558. if !(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  20559. ptr -= uintptr(2)
  20560. break
  20561. }
  20562. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20563. return m_XML_TOK_INVALID
  20564. case int32(_BT_LEAD2):
  20565. if int32(end)-int32(ptr) < int32(2) {
  20566. return -int32(2)
  20567. }
  20568. if 0 != 0 {
  20569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20570. return m_XML_TOK_INVALID
  20571. }
  20572. ptr += uintptr(2)
  20573. case int32(_BT_LEAD3):
  20574. if int32(end)-int32(ptr) < int32(3) {
  20575. return -int32(2)
  20576. }
  20577. if 0 != 0 {
  20578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20579. return m_XML_TOK_INVALID
  20580. }
  20581. ptr += uintptr(3)
  20582. case int32(_BT_LEAD4):
  20583. if int32(end)-int32(ptr) < int32(4) {
  20584. return -int32(2)
  20585. }
  20586. if 0 != 0 {
  20587. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20588. return m_XML_TOK_INVALID
  20589. }
  20590. ptr += uintptr(4)
  20591. case int32(_BT_NONXML):
  20592. fallthrough
  20593. case int32(_BT_MALFORM):
  20594. fallthrough
  20595. case int32(_BT_TRAIL):
  20596. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20597. return m_XML_TOK_INVALID
  20598. default:
  20599. ptr += uintptr(2)
  20600. break
  20601. }
  20602. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20603. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20604. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20605. } else {
  20606. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20607. }
  20608. switch v3 {
  20609. case int32(_BT_LEAD2):
  20610. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  20611. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20612. return int32(m_XML_TOK_DATA_CHARS)
  20613. }
  20614. ptr += uintptr(2)
  20615. case int32(_BT_LEAD3):
  20616. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  20617. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20618. return int32(m_XML_TOK_DATA_CHARS)
  20619. }
  20620. ptr += uintptr(3)
  20621. case int32(_BT_LEAD4):
  20622. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  20623. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20624. return int32(m_XML_TOK_DATA_CHARS)
  20625. }
  20626. ptr += uintptr(4)
  20627. case int32(_BT_RSQB):
  20628. if int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2) {
  20629. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  20630. ptr += uintptr(2)
  20631. break
  20632. }
  20633. if int32(end)-int32(ptr) >= libc.Int32FromInt32(3)*libc.Int32FromInt32(2) {
  20634. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  20635. ptr += uintptr(2)
  20636. break
  20637. }
  20638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  20639. return m_XML_TOK_INVALID
  20640. }
  20641. }
  20642. /* fall through */
  20643. fallthrough
  20644. case int32(_BT_AMP):
  20645. fallthrough
  20646. case int32(_BT_LT):
  20647. fallthrough
  20648. case int32(_BT_NONXML):
  20649. fallthrough
  20650. case int32(_BT_MALFORM):
  20651. fallthrough
  20652. case int32(_BT_TRAIL):
  20653. fallthrough
  20654. case int32(_BT_CR):
  20655. fallthrough
  20656. case int32(_BT_LF):
  20657. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20658. return int32(m_XML_TOK_DATA_CHARS)
  20659. default:
  20660. ptr += uintptr(2)
  20661. break
  20662. }
  20663. }
  20664. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20665. return int32(m_XML_TOK_DATA_CHARS)
  20666. }
  20667. /* ptr points to character following "%" */
  20668. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20669. var v1, v2 int32
  20670. _, _ = v1, v2
  20671. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20672. return -int32(1)
  20673. }
  20674. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20675. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20676. } else {
  20677. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20678. }
  20679. switch v1 {
  20680. case int32(_BT_NONASCII):
  20681. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20683. return m_XML_TOK_INVALID
  20684. } /* fall through */
  20685. fallthrough
  20686. case int32(_BT_NMSTRT):
  20687. fallthrough
  20688. case int32(_BT_HEX):
  20689. ptr += uintptr(2)
  20690. case int32(_BT_LEAD2):
  20691. if int32(end)-int32(ptr) < int32(2) {
  20692. return -int32(2)
  20693. }
  20694. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20695. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20696. return m_XML_TOK_INVALID
  20697. }
  20698. ptr += uintptr(2)
  20699. case int32(_BT_LEAD3):
  20700. if int32(end)-int32(ptr) < int32(3) {
  20701. return -int32(2)
  20702. }
  20703. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20705. return m_XML_TOK_INVALID
  20706. }
  20707. ptr += uintptr(3)
  20708. case int32(_BT_LEAD4):
  20709. if int32(end)-int32(ptr) < int32(4) {
  20710. return -int32(2)
  20711. }
  20712. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20714. return m_XML_TOK_INVALID
  20715. }
  20716. ptr += uintptr(4)
  20717. case int32(_BT_S):
  20718. fallthrough
  20719. case int32(_BT_LF):
  20720. fallthrough
  20721. case int32(_BT_CR):
  20722. fallthrough
  20723. case int32(_BT_PERCNT):
  20724. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20725. return int32(m_XML_TOK_PERCENT)
  20726. default:
  20727. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20728. return m_XML_TOK_INVALID
  20729. }
  20730. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20731. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20732. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20733. } else {
  20734. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20735. }
  20736. switch v2 {
  20737. case int32(_BT_NONASCII):
  20738. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20740. return m_XML_TOK_INVALID
  20741. } /* fall through */
  20742. fallthrough
  20743. case int32(_BT_NMSTRT):
  20744. fallthrough
  20745. case int32(_BT_HEX):
  20746. fallthrough
  20747. case int32(_BT_DIGIT):
  20748. fallthrough
  20749. case int32(_BT_NAME):
  20750. fallthrough
  20751. case int32(_BT_MINUS):
  20752. ptr += uintptr(2)
  20753. case int32(_BT_LEAD2):
  20754. if int32(end)-int32(ptr) < int32(2) {
  20755. return -int32(2)
  20756. }
  20757. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20759. return m_XML_TOK_INVALID
  20760. }
  20761. ptr += uintptr(2)
  20762. case int32(_BT_LEAD3):
  20763. if int32(end)-int32(ptr) < int32(3) {
  20764. return -int32(2)
  20765. }
  20766. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20767. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20768. return m_XML_TOK_INVALID
  20769. }
  20770. ptr += uintptr(3)
  20771. case int32(_BT_LEAD4):
  20772. if int32(end)-int32(ptr) < int32(4) {
  20773. return -int32(2)
  20774. }
  20775. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20776. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20777. return m_XML_TOK_INVALID
  20778. }
  20779. ptr += uintptr(4)
  20780. case int32(_BT_SEMI):
  20781. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20782. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  20783. default:
  20784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20785. return m_XML_TOK_INVALID
  20786. }
  20787. }
  20788. return -int32(1)
  20789. }
  20790. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20791. var v1, v2 int32
  20792. _, _ = v1, v2
  20793. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20794. return -int32(1)
  20795. }
  20796. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20797. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20798. } else {
  20799. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20800. }
  20801. switch v1 {
  20802. case int32(_BT_NONASCII):
  20803. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20805. return m_XML_TOK_INVALID
  20806. } /* fall through */
  20807. fallthrough
  20808. case int32(_BT_NMSTRT):
  20809. fallthrough
  20810. case int32(_BT_HEX):
  20811. ptr += uintptr(2)
  20812. case int32(_BT_LEAD2):
  20813. if int32(end)-int32(ptr) < int32(2) {
  20814. return -int32(2)
  20815. }
  20816. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20817. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20818. return m_XML_TOK_INVALID
  20819. }
  20820. ptr += uintptr(2)
  20821. case int32(_BT_LEAD3):
  20822. if int32(end)-int32(ptr) < int32(3) {
  20823. return -int32(2)
  20824. }
  20825. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20827. return m_XML_TOK_INVALID
  20828. }
  20829. ptr += uintptr(3)
  20830. case int32(_BT_LEAD4):
  20831. if int32(end)-int32(ptr) < int32(4) {
  20832. return -int32(2)
  20833. }
  20834. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20835. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20836. return m_XML_TOK_INVALID
  20837. }
  20838. ptr += uintptr(4)
  20839. default:
  20840. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20841. return m_XML_TOK_INVALID
  20842. }
  20843. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20844. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20845. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20846. } else {
  20847. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20848. }
  20849. switch v2 {
  20850. case int32(_BT_NONASCII):
  20851. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  20852. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20853. return m_XML_TOK_INVALID
  20854. } /* fall through */
  20855. fallthrough
  20856. case int32(_BT_NMSTRT):
  20857. fallthrough
  20858. case int32(_BT_HEX):
  20859. fallthrough
  20860. case int32(_BT_DIGIT):
  20861. fallthrough
  20862. case int32(_BT_NAME):
  20863. fallthrough
  20864. case int32(_BT_MINUS):
  20865. ptr += uintptr(2)
  20866. case int32(_BT_LEAD2):
  20867. if int32(end)-int32(ptr) < int32(2) {
  20868. return -int32(2)
  20869. }
  20870. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20871. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20872. return m_XML_TOK_INVALID
  20873. }
  20874. ptr += uintptr(2)
  20875. case int32(_BT_LEAD3):
  20876. if int32(end)-int32(ptr) < int32(3) {
  20877. return -int32(2)
  20878. }
  20879. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20880. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20881. return m_XML_TOK_INVALID
  20882. }
  20883. ptr += uintptr(3)
  20884. case int32(_BT_LEAD4):
  20885. if int32(end)-int32(ptr) < int32(4) {
  20886. return -int32(2)
  20887. }
  20888. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  20889. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20890. return m_XML_TOK_INVALID
  20891. }
  20892. ptr += uintptr(4)
  20893. case int32(_BT_CR):
  20894. fallthrough
  20895. case int32(_BT_LF):
  20896. fallthrough
  20897. case int32(_BT_S):
  20898. fallthrough
  20899. case int32(_BT_RPAR):
  20900. fallthrough
  20901. case int32(_BT_GT):
  20902. fallthrough
  20903. case int32(_BT_PERCNT):
  20904. fallthrough
  20905. case int32(_BT_VERBAR):
  20906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20907. return int32(m_XML_TOK_POUND_NAME)
  20908. default:
  20909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20910. return m_XML_TOK_INVALID
  20911. }
  20912. }
  20913. return -int32(m_XML_TOK_POUND_NAME)
  20914. }
  20915. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20916. var t, v1, v2 int32
  20917. _, _, _ = t, v1, v2
  20918. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  20919. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20920. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20921. } else {
  20922. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20923. }
  20924. t = v1
  20925. switch t {
  20926. case int32(_BT_LEAD2):
  20927. if int32(end)-int32(ptr) < int32(2) {
  20928. return -int32(2)
  20929. }
  20930. if 0 != 0 {
  20931. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20932. return m_XML_TOK_INVALID
  20933. }
  20934. ptr += uintptr(2)
  20935. case int32(_BT_LEAD3):
  20936. if int32(end)-int32(ptr) < int32(3) {
  20937. return -int32(2)
  20938. }
  20939. if 0 != 0 {
  20940. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20941. return m_XML_TOK_INVALID
  20942. }
  20943. ptr += uintptr(3)
  20944. case int32(_BT_LEAD4):
  20945. if int32(end)-int32(ptr) < int32(4) {
  20946. return -int32(2)
  20947. }
  20948. if 0 != 0 {
  20949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20950. return m_XML_TOK_INVALID
  20951. }
  20952. ptr += uintptr(4)
  20953. case int32(_BT_NONXML):
  20954. fallthrough
  20955. case int32(_BT_MALFORM):
  20956. fallthrough
  20957. case int32(_BT_TRAIL):
  20958. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20959. return m_XML_TOK_INVALID
  20960. case int32(_BT_QUOT):
  20961. fallthrough
  20962. case int32(_BT_APOS):
  20963. ptr += uintptr(2)
  20964. if t != open {
  20965. break
  20966. }
  20967. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20968. return -int32(m_XML_TOK_LITERAL)
  20969. }
  20970. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20971. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  20972. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  20973. } else {
  20974. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  20975. }
  20976. switch v2 {
  20977. case int32(_BT_S):
  20978. fallthrough
  20979. case int32(_BT_CR):
  20980. fallthrough
  20981. case int32(_BT_LF):
  20982. fallthrough
  20983. case int32(_BT_GT):
  20984. fallthrough
  20985. case int32(_BT_PERCNT):
  20986. fallthrough
  20987. case int32(_BT_LSQB):
  20988. return int32(m_XML_TOK_LITERAL)
  20989. default:
  20990. return m_XML_TOK_INVALID
  20991. }
  20992. fallthrough
  20993. default:
  20994. ptr += uintptr(2)
  20995. break
  20996. }
  20997. }
  20998. return -int32(1)
  20999. }
  21000. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21001. var n Tsize_t
  21002. var tok, v1, v29, v33, v34, v35, v36 int32
  21003. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  21004. if ptr >= end {
  21005. return -int32(4)
  21006. }
  21007. if int32(2) > int32(1) {
  21008. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  21009. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21010. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21011. if n == uint32(0) {
  21012. return -int32(1)
  21013. }
  21014. end = ptr + uintptr(n)
  21015. }
  21016. }
  21017. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21018. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21019. } else {
  21020. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21021. }
  21022. switch v1 {
  21023. case int32(_BT_QUOT):
  21024. goto _2
  21025. case int32(_BT_APOS):
  21026. goto _3
  21027. case int32(_BT_LT):
  21028. goto _4
  21029. case int32(_BT_CR):
  21030. goto _5
  21031. case int32(_BT_LF):
  21032. goto _6
  21033. case int32(_BT_S):
  21034. goto _7
  21035. case int32(_BT_PERCNT):
  21036. goto _8
  21037. case int32(_BT_COMMA):
  21038. goto _9
  21039. case int32(_BT_LSQB):
  21040. goto _10
  21041. case int32(_BT_RSQB):
  21042. goto _11
  21043. case int32(_BT_LPAR):
  21044. goto _12
  21045. case int32(_BT_RPAR):
  21046. goto _13
  21047. case int32(_BT_VERBAR):
  21048. goto _14
  21049. case int32(_BT_GT):
  21050. goto _15
  21051. case int32(_BT_NUM):
  21052. goto _16
  21053. case int32(_BT_LEAD2):
  21054. goto _17
  21055. case int32(_BT_LEAD3):
  21056. goto _18
  21057. case int32(_BT_LEAD4):
  21058. goto _19
  21059. case int32(_BT_HEX):
  21060. goto _20
  21061. case int32(_BT_NMSTRT):
  21062. goto _21
  21063. case int32(_BT_COLON):
  21064. goto _22
  21065. case int32(_BT_MINUS):
  21066. goto _23
  21067. case int32(_BT_NAME):
  21068. goto _24
  21069. case int32(_BT_DIGIT):
  21070. goto _25
  21071. case int32(_BT_NONASCII):
  21072. goto _26
  21073. default:
  21074. goto _27
  21075. }
  21076. goto _28
  21077. _2:
  21078. ;
  21079. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  21080. _3:
  21081. ;
  21082. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  21083. _4:
  21084. ;
  21085. ptr += uintptr(2)
  21086. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21087. return -int32(1)
  21088. }
  21089. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21090. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21091. } else {
  21092. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21093. }
  21094. switch v29 {
  21095. case int32(_BT_EXCL):
  21096. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21097. case int32(_BT_QUEST):
  21098. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21099. case int32(_BT_NMSTRT):
  21100. fallthrough
  21101. case int32(_BT_HEX):
  21102. fallthrough
  21103. case int32(_BT_NONASCII):
  21104. fallthrough
  21105. case int32(_BT_LEAD2):
  21106. fallthrough
  21107. case int32(_BT_LEAD3):
  21108. fallthrough
  21109. case int32(_BT_LEAD4):
  21110. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  21111. return int32(m_XML_TOK_INSTANCE_START)
  21112. }
  21113. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21114. return m_XML_TOK_INVALID
  21115. _5:
  21116. ;
  21117. if ptr+uintptr(2) == end {
  21118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  21119. /* indicate that this might be part of a CR/LF pair */
  21120. return -int32(m_XML_TOK_PROLOG_S)
  21121. }
  21122. /* fall through */
  21123. _7:
  21124. ;
  21125. _6:
  21126. ;
  21127. _32:
  21128. ;
  21129. ptr += uintptr(2)
  21130. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21131. goto _30
  21132. }
  21133. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21134. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21135. } else {
  21136. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21137. }
  21138. switch v33 {
  21139. case int32(_BT_S):
  21140. fallthrough
  21141. case int32(_BT_LF):
  21142. case int32(_BT_CR):
  21143. /* don't split CR/LF pair */
  21144. if ptr+uintptr(2) != end {
  21145. break
  21146. }
  21147. /* fall through */
  21148. fallthrough
  21149. default:
  21150. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21151. return int32(m_XML_TOK_PROLOG_S)
  21152. }
  21153. goto _31
  21154. _31:
  21155. ;
  21156. goto _32
  21157. goto _30
  21158. _30:
  21159. ;
  21160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21161. return int32(m_XML_TOK_PROLOG_S)
  21162. _8:
  21163. ;
  21164. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21165. _9:
  21166. ;
  21167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21168. return int32(m_XML_TOK_COMMA)
  21169. _10:
  21170. ;
  21171. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21172. return int32(m_XML_TOK_OPEN_BRACKET)
  21173. _11:
  21174. ;
  21175. ptr += uintptr(2)
  21176. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21177. return -int32(m_XML_TOK_CLOSE_BRACKET)
  21178. }
  21179. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21180. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  21181. return -int32(1)
  21182. }
  21183. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  21184. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  21185. return int32(m_XML_TOK_COND_SECT_CLOSE)
  21186. }
  21187. }
  21188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21189. return int32(m_XML_TOK_CLOSE_BRACKET)
  21190. _12:
  21191. ;
  21192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21193. return int32(m_XML_TOK_OPEN_PAREN)
  21194. _13:
  21195. ;
  21196. ptr += uintptr(2)
  21197. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21198. return -int32(m_XML_TOK_CLOSE_PAREN)
  21199. }
  21200. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21201. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21202. } else {
  21203. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21204. }
  21205. switch v34 {
  21206. case int32(_BT_AST):
  21207. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21208. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  21209. case int32(_BT_QUEST):
  21210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21211. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  21212. case int32(_BT_PLUS):
  21213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21214. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  21215. case int32(_BT_CR):
  21216. fallthrough
  21217. case int32(_BT_LF):
  21218. fallthrough
  21219. case int32(_BT_S):
  21220. fallthrough
  21221. case int32(_BT_GT):
  21222. fallthrough
  21223. case int32(_BT_COMMA):
  21224. fallthrough
  21225. case int32(_BT_VERBAR):
  21226. fallthrough
  21227. case int32(_BT_RPAR):
  21228. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21229. return int32(m_XML_TOK_CLOSE_PAREN)
  21230. }
  21231. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21232. return m_XML_TOK_INVALID
  21233. _14:
  21234. ;
  21235. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21236. return int32(m_XML_TOK_OR)
  21237. _15:
  21238. ;
  21239. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21240. return int32(m_XML_TOK_DECL_CLOSE)
  21241. _16:
  21242. ;
  21243. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21244. _17:
  21245. ;
  21246. if int32(end)-int32(ptr) < int32(2) {
  21247. return -int32(2)
  21248. }
  21249. if 0 != 0 {
  21250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21251. return m_XML_TOK_INVALID
  21252. }
  21253. if 0 != 0 {
  21254. ptr += uintptr(2)
  21255. tok = int32(m_XML_TOK_NAME)
  21256. goto _28
  21257. }
  21258. if 0 != 0 {
  21259. ptr += uintptr(2)
  21260. tok = int32(m_XML_TOK_NMTOKEN)
  21261. goto _28
  21262. }
  21263. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21264. return m_XML_TOK_INVALID
  21265. _18:
  21266. ;
  21267. if int32(end)-int32(ptr) < int32(3) {
  21268. return -int32(2)
  21269. }
  21270. if 0 != 0 {
  21271. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21272. return m_XML_TOK_INVALID
  21273. }
  21274. if 0 != 0 {
  21275. ptr += uintptr(3)
  21276. tok = int32(m_XML_TOK_NAME)
  21277. goto _28
  21278. }
  21279. if 0 != 0 {
  21280. ptr += uintptr(3)
  21281. tok = int32(m_XML_TOK_NMTOKEN)
  21282. goto _28
  21283. }
  21284. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21285. return m_XML_TOK_INVALID
  21286. _19:
  21287. ;
  21288. if int32(end)-int32(ptr) < int32(4) {
  21289. return -int32(2)
  21290. }
  21291. if 0 != 0 {
  21292. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21293. return m_XML_TOK_INVALID
  21294. }
  21295. if 0 != 0 {
  21296. ptr += uintptr(4)
  21297. tok = int32(m_XML_TOK_NAME)
  21298. goto _28
  21299. }
  21300. if 0 != 0 {
  21301. ptr += uintptr(4)
  21302. tok = int32(m_XML_TOK_NMTOKEN)
  21303. goto _28
  21304. }
  21305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21306. return m_XML_TOK_INVALID
  21307. _21:
  21308. ;
  21309. _20:
  21310. ;
  21311. tok = int32(m_XML_TOK_NAME)
  21312. ptr += uintptr(2)
  21313. goto _28
  21314. _25:
  21315. ;
  21316. _24:
  21317. ;
  21318. _23:
  21319. ;
  21320. _22:
  21321. ;
  21322. tok = int32(m_XML_TOK_NMTOKEN)
  21323. ptr += uintptr(2)
  21324. goto _28
  21325. _26:
  21326. ;
  21327. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  21328. ptr += uintptr(2)
  21329. tok = int32(m_XML_TOK_NAME)
  21330. goto _28
  21331. }
  21332. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&int32(0x1F))) != 0 {
  21333. ptr += uintptr(2)
  21334. tok = int32(m_XML_TOK_NMTOKEN)
  21335. goto _28
  21336. }
  21337. /* fall through */
  21338. _27:
  21339. ;
  21340. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21341. return m_XML_TOK_INVALID
  21342. _28:
  21343. ;
  21344. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21345. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21346. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21347. } else {
  21348. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21349. }
  21350. switch v35 {
  21351. case int32(_BT_NONASCII):
  21352. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21353. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21354. return m_XML_TOK_INVALID
  21355. } /* fall through */
  21356. fallthrough
  21357. case int32(_BT_NMSTRT):
  21358. fallthrough
  21359. case int32(_BT_HEX):
  21360. fallthrough
  21361. case int32(_BT_DIGIT):
  21362. fallthrough
  21363. case int32(_BT_NAME):
  21364. fallthrough
  21365. case int32(_BT_MINUS):
  21366. ptr += uintptr(2)
  21367. case int32(_BT_LEAD2):
  21368. if int32(end)-int32(ptr) < int32(2) {
  21369. return -int32(2)
  21370. }
  21371. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21373. return m_XML_TOK_INVALID
  21374. }
  21375. ptr += uintptr(2)
  21376. case int32(_BT_LEAD3):
  21377. if int32(end)-int32(ptr) < int32(3) {
  21378. return -int32(2)
  21379. }
  21380. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21381. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21382. return m_XML_TOK_INVALID
  21383. }
  21384. ptr += uintptr(3)
  21385. case int32(_BT_LEAD4):
  21386. if int32(end)-int32(ptr) < int32(4) {
  21387. return -int32(2)
  21388. }
  21389. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21391. return m_XML_TOK_INVALID
  21392. }
  21393. ptr += uintptr(4)
  21394. case int32(_BT_GT):
  21395. fallthrough
  21396. case int32(_BT_RPAR):
  21397. fallthrough
  21398. case int32(_BT_COMMA):
  21399. fallthrough
  21400. case int32(_BT_VERBAR):
  21401. fallthrough
  21402. case int32(_BT_LSQB):
  21403. fallthrough
  21404. case int32(_BT_PERCNT):
  21405. fallthrough
  21406. case int32(_BT_S):
  21407. fallthrough
  21408. case int32(_BT_CR):
  21409. fallthrough
  21410. case int32(_BT_LF):
  21411. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21412. return tok
  21413. case int32(_BT_COLON):
  21414. ptr += uintptr(2)
  21415. switch tok {
  21416. case int32(m_XML_TOK_NAME):
  21417. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21418. return -int32(1)
  21419. }
  21420. tok = int32(m_XML_TOK_PREFIXED_NAME)
  21421. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21422. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21423. } else {
  21424. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21425. }
  21426. switch v36 {
  21427. case int32(_BT_NONASCII):
  21428. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))&libc.Int32FromInt32(0x1F))) != 0) {
  21429. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21430. return m_XML_TOK_INVALID
  21431. } /* fall through */
  21432. fallthrough
  21433. case int32(_BT_NMSTRT):
  21434. fallthrough
  21435. case int32(_BT_HEX):
  21436. fallthrough
  21437. case int32(_BT_DIGIT):
  21438. fallthrough
  21439. case int32(_BT_NAME):
  21440. fallthrough
  21441. case int32(_BT_MINUS):
  21442. ptr += uintptr(2)
  21443. case int32(_BT_LEAD2):
  21444. if int32(end)-int32(ptr) < int32(2) {
  21445. return -int32(2)
  21446. }
  21447. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21448. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21449. return m_XML_TOK_INVALID
  21450. }
  21451. ptr += uintptr(2)
  21452. case int32(_BT_LEAD3):
  21453. if int32(end)-int32(ptr) < int32(3) {
  21454. return -int32(2)
  21455. }
  21456. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21457. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21458. return m_XML_TOK_INVALID
  21459. }
  21460. ptr += uintptr(3)
  21461. case int32(_BT_LEAD4):
  21462. if int32(end)-int32(ptr) < int32(4) {
  21463. return -int32(2)
  21464. }
  21465. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  21466. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21467. return m_XML_TOK_INVALID
  21468. }
  21469. ptr += uintptr(4)
  21470. default:
  21471. tok = int32(m_XML_TOK_NMTOKEN)
  21472. break
  21473. }
  21474. case int32(m_XML_TOK_PREFIXED_NAME):
  21475. tok = int32(m_XML_TOK_NMTOKEN)
  21476. break
  21477. }
  21478. case int32(_BT_PLUS):
  21479. if tok == int32(m_XML_TOK_NMTOKEN) {
  21480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21481. return m_XML_TOK_INVALID
  21482. }
  21483. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21484. return int32(m_XML_TOK_NAME_PLUS)
  21485. case int32(_BT_AST):
  21486. if tok == int32(m_XML_TOK_NMTOKEN) {
  21487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21488. return m_XML_TOK_INVALID
  21489. }
  21490. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21491. return int32(m_XML_TOK_NAME_ASTERISK)
  21492. case int32(_BT_QUEST):
  21493. if tok == int32(m_XML_TOK_NMTOKEN) {
  21494. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21495. return m_XML_TOK_INVALID
  21496. }
  21497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21498. return int32(m_XML_TOK_NAME_QUESTION)
  21499. default:
  21500. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21501. return m_XML_TOK_INVALID
  21502. }
  21503. }
  21504. return -tok
  21505. }
  21506. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21507. var start uintptr
  21508. var v1, v2 int32
  21509. _, _, _ = start, v1, v2
  21510. if ptr >= end {
  21511. return -int32(4)
  21512. } else {
  21513. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21514. /* This line cannot be executed. The incoming data has already
  21515. * been tokenized once, so incomplete characters like this have
  21516. * already been eliminated from the input. Retaining the paranoia
  21517. * check is still valuable, however.
  21518. */
  21519. return -int32(1) /* LCOV_EXCL_LINE */
  21520. }
  21521. }
  21522. start = ptr
  21523. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21524. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21525. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21526. } else {
  21527. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21528. }
  21529. switch v1 {
  21530. case int32(_BT_LEAD2):
  21531. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21532. case int32(_BT_LEAD3):
  21533. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21534. case int32(_BT_LEAD4):
  21535. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21536. case int32(_BT_AMP):
  21537. if ptr == start {
  21538. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21539. }
  21540. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21541. return int32(m_XML_TOK_DATA_CHARS)
  21542. case int32(_BT_LT):
  21543. /* this is for inside entity references */
  21544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21545. return m_XML_TOK_INVALID
  21546. case int32(_BT_LF):
  21547. if ptr == start {
  21548. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21549. return int32(m_XML_TOK_DATA_NEWLINE)
  21550. }
  21551. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21552. return int32(m_XML_TOK_DATA_CHARS)
  21553. case int32(_BT_CR):
  21554. if ptr == start {
  21555. ptr += uintptr(2)
  21556. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21557. return -int32(3)
  21558. }
  21559. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21560. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21561. } else {
  21562. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21563. }
  21564. if v2 == int32(_BT_LF) {
  21565. ptr += uintptr(2)
  21566. }
  21567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21568. return int32(m_XML_TOK_DATA_NEWLINE)
  21569. }
  21570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21571. return int32(m_XML_TOK_DATA_CHARS)
  21572. case int32(_BT_S):
  21573. if ptr == start {
  21574. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21575. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  21576. }
  21577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21578. return int32(m_XML_TOK_DATA_CHARS)
  21579. default:
  21580. ptr += uintptr(2)
  21581. break
  21582. }
  21583. }
  21584. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21585. return int32(m_XML_TOK_DATA_CHARS)
  21586. }
  21587. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21588. var start uintptr
  21589. var tok, v1, v2, v3 int32
  21590. _, _, _, _, _ = start, tok, v1, v2, v3
  21591. if ptr >= end {
  21592. return -int32(4)
  21593. } else {
  21594. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21595. /* This line cannot be executed. The incoming data has already
  21596. * been tokenized once, so incomplete characters like this have
  21597. * already been eliminated from the input. Retaining the paranoia
  21598. * check is still valuable, however.
  21599. */
  21600. return -int32(1) /* LCOV_EXCL_LINE */
  21601. }
  21602. }
  21603. start = ptr
  21604. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21605. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21606. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21607. } else {
  21608. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21609. }
  21610. switch v1 {
  21611. case int32(_BT_LEAD2):
  21612. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  21613. case int32(_BT_LEAD3):
  21614. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  21615. case int32(_BT_LEAD4):
  21616. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  21617. case int32(_BT_AMP):
  21618. if ptr == start {
  21619. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21620. }
  21621. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21622. return int32(m_XML_TOK_DATA_CHARS)
  21623. case int32(_BT_PERCNT):
  21624. if ptr == start {
  21625. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21626. if tok == int32(m_XML_TOK_PERCENT) {
  21627. v2 = m_XML_TOK_INVALID
  21628. } else {
  21629. v2 = tok
  21630. }
  21631. return v2
  21632. }
  21633. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21634. return int32(m_XML_TOK_DATA_CHARS)
  21635. case int32(_BT_LF):
  21636. if ptr == start {
  21637. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21638. return int32(m_XML_TOK_DATA_NEWLINE)
  21639. }
  21640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21641. return int32(m_XML_TOK_DATA_CHARS)
  21642. case int32(_BT_CR):
  21643. if ptr == start {
  21644. ptr += uintptr(2)
  21645. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21646. return -int32(3)
  21647. }
  21648. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21649. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21650. } else {
  21651. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21652. }
  21653. if v3 == int32(_BT_LF) {
  21654. ptr += uintptr(2)
  21655. }
  21656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21657. return int32(m_XML_TOK_DATA_NEWLINE)
  21658. }
  21659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21660. return int32(m_XML_TOK_DATA_CHARS)
  21661. default:
  21662. ptr += uintptr(2)
  21663. break
  21664. }
  21665. }
  21666. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21667. return int32(m_XML_TOK_DATA_CHARS)
  21668. }
  21669. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21670. var level, v1 int32
  21671. var n Tsize_t
  21672. _, _, _ = level, n, v1
  21673. level = 0
  21674. if int32(2) > int32(1) {
  21675. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  21676. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21677. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21678. end = ptr + uintptr(n)
  21679. }
  21680. }
  21681. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  21682. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21683. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21684. } else {
  21685. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21686. }
  21687. switch v1 {
  21688. case int32(_BT_LEAD2):
  21689. if int32(end)-int32(ptr) < int32(2) {
  21690. return -int32(2)
  21691. }
  21692. if 0 != 0 {
  21693. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21694. return m_XML_TOK_INVALID
  21695. }
  21696. ptr += uintptr(2)
  21697. case int32(_BT_LEAD3):
  21698. if int32(end)-int32(ptr) < int32(3) {
  21699. return -int32(2)
  21700. }
  21701. if 0 != 0 {
  21702. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21703. return m_XML_TOK_INVALID
  21704. }
  21705. ptr += uintptr(3)
  21706. case int32(_BT_LEAD4):
  21707. if int32(end)-int32(ptr) < int32(4) {
  21708. return -int32(2)
  21709. }
  21710. if 0 != 0 {
  21711. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21712. return m_XML_TOK_INVALID
  21713. }
  21714. ptr += uintptr(4)
  21715. case int32(_BT_NONXML):
  21716. fallthrough
  21717. case int32(_BT_MALFORM):
  21718. fallthrough
  21719. case int32(_BT_TRAIL):
  21720. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21721. return m_XML_TOK_INVALID
  21722. case int32(_BT_LT):
  21723. ptr += uintptr(2)
  21724. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21725. return -int32(1)
  21726. }
  21727. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL2) {
  21728. ptr += uintptr(2)
  21729. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21730. return -int32(1)
  21731. }
  21732. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  21733. level++
  21734. ptr += uintptr(2)
  21735. }
  21736. }
  21737. case int32(_BT_RSQB):
  21738. ptr += uintptr(2)
  21739. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21740. return -int32(1)
  21741. }
  21742. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  21743. ptr += uintptr(2)
  21744. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21745. return -int32(1)
  21746. }
  21747. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  21748. ptr += uintptr(2)
  21749. if level == 0 {
  21750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21751. return int32(m_XML_TOK_IGNORE_SECT)
  21752. }
  21753. level--
  21754. }
  21755. }
  21756. default:
  21757. ptr += uintptr(2)
  21758. break
  21759. }
  21760. }
  21761. return -int32(1)
  21762. }
  21763. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  21764. var v2, v3, v4 int32
  21765. _, _, _ = v2, v3, v4
  21766. ptr += uintptr(2)
  21767. end -= uintptr(2)
  21768. for {
  21769. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21770. break
  21771. }
  21772. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21773. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21774. } else {
  21775. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21776. }
  21777. switch v2 {
  21778. case int32(_BT_DIGIT):
  21779. fallthrough
  21780. case int32(_BT_HEX):
  21781. fallthrough
  21782. case int32(_BT_MINUS):
  21783. fallthrough
  21784. case int32(_BT_APOS):
  21785. fallthrough
  21786. case int32(_BT_LPAR):
  21787. fallthrough
  21788. case int32(_BT_RPAR):
  21789. fallthrough
  21790. case int32(_BT_PLUS):
  21791. fallthrough
  21792. case int32(_BT_COMMA):
  21793. fallthrough
  21794. case int32(_BT_SOL):
  21795. fallthrough
  21796. case int32(_BT_EQUALS):
  21797. fallthrough
  21798. case int32(_BT_QUEST):
  21799. fallthrough
  21800. case int32(_BT_CR):
  21801. fallthrough
  21802. case int32(_BT_LF):
  21803. fallthrough
  21804. case int32(_BT_SEMI):
  21805. fallthrough
  21806. case int32(_BT_EXCL):
  21807. fallthrough
  21808. case int32(_BT_AST):
  21809. fallthrough
  21810. case int32(_BT_PERCNT):
  21811. fallthrough
  21812. case int32(_BT_NUM):
  21813. fallthrough
  21814. case int32(_BT_COLON):
  21815. case int32(_BT_S):
  21816. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  21817. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21818. return 0
  21819. }
  21820. case int32(_BT_NAME):
  21821. fallthrough
  21822. case int32(_BT_NMSTRT):
  21823. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21824. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21825. } else {
  21826. v3 = -int32(1)
  21827. }
  21828. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  21829. break
  21830. }
  21831. /* fall through */
  21832. fallthrough
  21833. default:
  21834. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21835. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21836. } else {
  21837. v4 = -int32(1)
  21838. }
  21839. switch v4 {
  21840. case int32(0x24): /* $ */
  21841. fallthrough
  21842. case int32(0x40): /* @ */
  21843. default:
  21844. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  21845. return 0
  21846. }
  21847. break
  21848. }
  21849. goto _1
  21850. _1:
  21851. ;
  21852. ptr += uintptr(2)
  21853. }
  21854. return int32(1)
  21855. }
  21856. /* This must only be called for a well-formed start-tag or empty
  21857. element tag. Returns the number of attributes. Pointers to the
  21858. first attsMax attributes are stored in atts.
  21859. */
  21860. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  21861. var nAtts, open, state, v2, v3, v5, v7 int32
  21862. var v4, v6, v8, v9 bool
  21863. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  21864. state = 1
  21865. nAtts = 0
  21866. open = 0 /* defined when state == inValue;
  21867. initialization just to shut up compilers */
  21868. ptr += uintptr(2)
  21869. for {
  21870. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21871. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  21872. } else {
  21873. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  21874. }
  21875. switch v2 {
  21876. case int32(_BT_LEAD2):
  21877. if state == 0 {
  21878. if nAtts < attsMax {
  21879. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21880. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  21881. }
  21882. state = 1
  21883. }
  21884. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  21885. case int32(_BT_LEAD3):
  21886. if state == 0 {
  21887. if nAtts < attsMax {
  21888. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21889. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  21890. }
  21891. state = 1
  21892. }
  21893. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  21894. case int32(_BT_LEAD4):
  21895. if state == 0 {
  21896. if nAtts < attsMax {
  21897. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21898. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  21899. }
  21900. state = 1
  21901. }
  21902. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  21903. case int32(_BT_NONASCII):
  21904. fallthrough
  21905. case int32(_BT_NMSTRT):
  21906. fallthrough
  21907. case int32(_BT_HEX):
  21908. if state == 0 {
  21909. if nAtts < attsMax {
  21910. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  21911. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  21912. }
  21913. state = 1
  21914. }
  21915. case int32(_BT_QUOT):
  21916. if state != 2 {
  21917. if nAtts < attsMax {
  21918. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  21919. }
  21920. state = 2
  21921. open = int32(_BT_QUOT)
  21922. } else {
  21923. if open == int32(_BT_QUOT) {
  21924. state = 0
  21925. if nAtts < attsMax {
  21926. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  21927. }
  21928. nAtts++
  21929. }
  21930. }
  21931. case int32(_BT_APOS):
  21932. if state != 2 {
  21933. if nAtts < attsMax {
  21934. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  21935. }
  21936. state = 2
  21937. open = int32(_BT_APOS)
  21938. } else {
  21939. if open == int32(_BT_APOS) {
  21940. state = 0
  21941. if nAtts < attsMax {
  21942. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  21943. }
  21944. nAtts++
  21945. }
  21946. }
  21947. case int32(_BT_AMP):
  21948. if nAtts < attsMax {
  21949. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  21950. }
  21951. case int32(_BT_S):
  21952. if state == 1 {
  21953. state = 0
  21954. } else {
  21955. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized != 0; v9 {
  21956. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr; !v4 {
  21957. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  21958. v3 = int32(*(*int8)(unsafe.Pointer(ptr)))
  21959. } else {
  21960. v3 = -int32(1)
  21961. }
  21962. }
  21963. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  21964. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21965. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21966. } else {
  21967. v5 = -int32(1)
  21968. }
  21969. }
  21970. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  21971. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  21972. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))))))
  21973. } else {
  21974. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  21975. }
  21976. }
  21977. }
  21978. if v9 && (v8 || v7 == open) {
  21979. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  21980. }
  21981. }
  21982. case int32(_BT_CR):
  21983. fallthrough
  21984. case int32(_BT_LF):
  21985. /* This case ensures that the first attribute name is counted
  21986. Apart from that we could just change state on the quote. */
  21987. if state == 1 {
  21988. state = 0
  21989. } else {
  21990. if state == 2 && nAtts < attsMax {
  21991. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  21992. }
  21993. }
  21994. case int32(_BT_GT):
  21995. fallthrough
  21996. case int32(_BT_SOL):
  21997. if state != 2 {
  21998. return nAtts
  21999. }
  22000. default:
  22001. break
  22002. }
  22003. goto _1
  22004. _1:
  22005. ;
  22006. ptr += uintptr(2)
  22007. }
  22008. /* not reached */
  22009. return r
  22010. }
  22011. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22012. var c, c1, result, v2, v4 int32
  22013. _, _, _, _, _ = c, c1, result, v2, v4
  22014. result = 0
  22015. /* skip &# */
  22016. _ = enc
  22017. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  22018. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x2) {
  22019. ptr += uintptr(2)
  22020. for {
  22021. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22022. break
  22023. }
  22024. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22025. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22026. } else {
  22027. v2 = -int32(1)
  22028. }
  22029. c = v2
  22030. switch c {
  22031. case int32(m_ASCII_02):
  22032. fallthrough
  22033. case int32(m_ASCII_12):
  22034. fallthrough
  22035. case int32(m_ASCII_22):
  22036. fallthrough
  22037. case int32(m_ASCII_32):
  22038. fallthrough
  22039. case int32(m_ASCII_41):
  22040. fallthrough
  22041. case int32(m_ASCII_51):
  22042. fallthrough
  22043. case int32(m_ASCII_61):
  22044. fallthrough
  22045. case int32(m_ASCII_71):
  22046. fallthrough
  22047. case int32(m_ASCII_82):
  22048. fallthrough
  22049. case int32(m_ASCII_92):
  22050. result <<= int32(4)
  22051. result |= c - int32(m_ASCII_02)
  22052. case int32(m_ASCII_A):
  22053. fallthrough
  22054. case int32(m_ASCII_B1):
  22055. fallthrough
  22056. case int32(m_ASCII_C):
  22057. fallthrough
  22058. case int32(m_ASCII_D):
  22059. fallthrough
  22060. case int32(m_ASCII_E):
  22061. fallthrough
  22062. case int32(m_ASCII_F):
  22063. result <<= int32(4)
  22064. result += int32(10) + (c - int32(m_ASCII_A))
  22065. case int32(m_ASCII_a2):
  22066. fallthrough
  22067. case int32(m_ASCII_b1):
  22068. fallthrough
  22069. case int32(m_ASCII_c2):
  22070. fallthrough
  22071. case int32(m_ASCII_d1):
  22072. fallthrough
  22073. case int32(m_ASCII_e2):
  22074. fallthrough
  22075. case int32(m_ASCII_f1):
  22076. result <<= int32(4)
  22077. result += int32(10) + (c - int32(m_ASCII_a2))
  22078. break
  22079. }
  22080. if result >= int32(0x110000) {
  22081. return -int32(1)
  22082. }
  22083. goto _1
  22084. _1:
  22085. ;
  22086. ptr += uintptr(2)
  22087. }
  22088. } else {
  22089. for {
  22090. if !!(int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  22091. break
  22092. }
  22093. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22094. v4 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22095. } else {
  22096. v4 = -int32(1)
  22097. }
  22098. c1 = v4
  22099. result *= int32(10)
  22100. result += c1 - int32(m_ASCII_02)
  22101. if result >= int32(0x110000) {
  22102. return -int32(1)
  22103. }
  22104. goto _3
  22105. _3:
  22106. ;
  22107. ptr += uintptr(2)
  22108. }
  22109. }
  22110. return _checkCharRefNumber(tls, result)
  22111. }
  22112. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  22113. var v1, v2 int32
  22114. _, _ = v1, v2
  22115. _ = enc
  22116. switch (int32(end) - int32(ptr)) / libc.Int32FromInt32(2) {
  22117. case int32(2):
  22118. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t2) {
  22119. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22120. v1 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22121. } else {
  22122. v1 = -int32(1)
  22123. }
  22124. switch v1 {
  22125. case int32(m_ASCII_l2):
  22126. return int32(m_ASCII_LT1)
  22127. case int32(m_ASCII_g2):
  22128. return int32(m_ASCII_GT1)
  22129. }
  22130. }
  22131. case int32(3):
  22132. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a2) {
  22133. ptr += uintptr(2)
  22134. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m2) {
  22135. ptr += uintptr(2)
  22136. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22137. return int32(m_ASCII_AMP1)
  22138. }
  22139. }
  22140. }
  22141. case int32(4):
  22142. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22143. v2 = int32(*(*int8)(unsafe.Pointer(ptr)))
  22144. } else {
  22145. v2 = -int32(1)
  22146. }
  22147. switch v2 {
  22148. case int32(m_ASCII_q1):
  22149. ptr += uintptr(2)
  22150. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  22151. ptr += uintptr(2)
  22152. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22153. ptr += uintptr(2)
  22154. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t2) {
  22155. return int32(m_ASCII_QUOT1)
  22156. }
  22157. }
  22158. }
  22159. case int32(m_ASCII_a2):
  22160. ptr += uintptr(2)
  22161. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p2) {
  22162. ptr += uintptr(2)
  22163. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o2) {
  22164. ptr += uintptr(2)
  22165. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s2) {
  22166. return int32(m_ASCII_APOS1)
  22167. }
  22168. }
  22169. }
  22170. break
  22171. }
  22172. }
  22173. return 0
  22174. }
  22175. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  22176. _ = enc
  22177. for {
  22178. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  22179. break
  22180. }
  22181. if int32(end1)-int32(ptr1) < int32(2) {
  22182. /* This line cannot be executed. The incoming data has already
  22183. * been tokenized once, so incomplete characters like this have
  22184. * already been eliminated from the input. Retaining the
  22185. * paranoia check is still valuable, however.
  22186. */
  22187. return 0 /* LCOV_EXCL_LINE */
  22188. }
  22189. if !(int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  22190. return 0
  22191. }
  22192. goto _1
  22193. _1:
  22194. ;
  22195. ptr1 += uintptr(2)
  22196. ptr2++
  22197. }
  22198. return libc.BoolInt32(ptr1 == end1)
  22199. }
  22200. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  22201. var start uintptr
  22202. var v2 int32
  22203. _, _ = start, v2
  22204. start = ptr
  22205. for {
  22206. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22207. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22208. } else {
  22209. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22210. }
  22211. switch v2 {
  22212. case int32(_BT_LEAD2):
  22213. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22214. case int32(_BT_LEAD3):
  22215. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22216. case int32(_BT_LEAD4):
  22217. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22218. case int32(_BT_NONASCII):
  22219. fallthrough
  22220. case int32(_BT_NMSTRT):
  22221. fallthrough
  22222. case int32(_BT_COLON):
  22223. fallthrough
  22224. case int32(_BT_HEX):
  22225. fallthrough
  22226. case int32(_BT_DIGIT):
  22227. fallthrough
  22228. case int32(_BT_NAME):
  22229. fallthrough
  22230. case int32(_BT_MINUS):
  22231. ptr += uintptr(2)
  22232. default:
  22233. return int32(ptr) - int32(start)
  22234. }
  22235. goto _1
  22236. _1:
  22237. }
  22238. return r
  22239. }
  22240. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  22241. var v2 int32
  22242. _ = v2
  22243. for {
  22244. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22245. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22246. } else {
  22247. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22248. }
  22249. switch v2 {
  22250. case int32(_BT_LF):
  22251. fallthrough
  22252. case int32(_BT_CR):
  22253. fallthrough
  22254. case int32(_BT_S):
  22255. ptr += uintptr(2)
  22256. default:
  22257. return ptr
  22258. }
  22259. goto _1
  22260. _1:
  22261. }
  22262. return r
  22263. }
  22264. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  22265. var v1, v2 int32
  22266. var v3 bool
  22267. _, _, _ = v1, v2, v3
  22268. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  22269. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22270. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22271. } else {
  22272. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22273. }
  22274. switch v1 {
  22275. case int32(_BT_LEAD2):
  22276. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  22277. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22278. case int32(_BT_LEAD3):
  22279. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  22280. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22281. case int32(_BT_LEAD4):
  22282. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  22283. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22284. case int32(_BT_LF):
  22285. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  22286. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22287. ptr += uintptr(2)
  22288. case int32(_BT_CR):
  22289. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  22290. ptr += uintptr(2)
  22291. if v3 = int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2); v3 {
  22292. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == 0 {
  22293. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))))))
  22294. } else {
  22295. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + 1)), *(*int8)(unsafe.Pointer(ptr)))
  22296. }
  22297. }
  22298. if v3 && v2 == int32(_BT_LF) {
  22299. ptr += uintptr(2)
  22300. }
  22301. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  22302. default:
  22303. ptr += uintptr(2)
  22304. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  22305. break
  22306. }
  22307. }
  22308. }
  22309. var _little2_encoding_ns = Tnormal_encoding{
  22310. Fenc: TENCODING{
  22311. Fscanners: [4]TSCANNER{},
  22312. FliteralScanners: [2]TSCANNER{},
  22313. FminBytesPerChar: int32(2),
  22314. FisUtf16: int8(1),
  22315. },
  22316. Ftype1: [256]uint8{
  22317. 9: uint8(_BT_S),
  22318. 10: uint8(_BT_LF),
  22319. 13: uint8(_BT_CR),
  22320. 32: uint8(_BT_S),
  22321. 33: uint8(_BT_EXCL),
  22322. 34: uint8(_BT_QUOT),
  22323. 35: uint8(_BT_NUM),
  22324. 36: uint8(_BT_OTHER),
  22325. 37: uint8(_BT_PERCNT),
  22326. 38: uint8(_BT_AMP),
  22327. 39: uint8(_BT_APOS),
  22328. 40: uint8(_BT_LPAR),
  22329. 41: uint8(_BT_RPAR),
  22330. 42: uint8(_BT_AST),
  22331. 43: uint8(_BT_PLUS),
  22332. 44: uint8(_BT_COMMA),
  22333. 45: uint8(_BT_MINUS),
  22334. 46: uint8(_BT_NAME),
  22335. 47: uint8(_BT_SOL),
  22336. 48: uint8(_BT_DIGIT),
  22337. 49: uint8(_BT_DIGIT),
  22338. 50: uint8(_BT_DIGIT),
  22339. 51: uint8(_BT_DIGIT),
  22340. 52: uint8(_BT_DIGIT),
  22341. 53: uint8(_BT_DIGIT),
  22342. 54: uint8(_BT_DIGIT),
  22343. 55: uint8(_BT_DIGIT),
  22344. 56: uint8(_BT_DIGIT),
  22345. 57: uint8(_BT_DIGIT),
  22346. 58: uint8(_BT_COLON),
  22347. 59: uint8(_BT_SEMI),
  22348. 60: uint8(_BT_LT),
  22349. 61: uint8(_BT_EQUALS),
  22350. 62: uint8(_BT_GT),
  22351. 63: uint8(_BT_QUEST),
  22352. 64: uint8(_BT_OTHER),
  22353. 65: uint8(_BT_HEX),
  22354. 66: uint8(_BT_HEX),
  22355. 67: uint8(_BT_HEX),
  22356. 68: uint8(_BT_HEX),
  22357. 69: uint8(_BT_HEX),
  22358. 70: uint8(_BT_HEX),
  22359. 71: uint8(_BT_NMSTRT),
  22360. 72: uint8(_BT_NMSTRT),
  22361. 73: uint8(_BT_NMSTRT),
  22362. 74: uint8(_BT_NMSTRT),
  22363. 75: uint8(_BT_NMSTRT),
  22364. 76: uint8(_BT_NMSTRT),
  22365. 77: uint8(_BT_NMSTRT),
  22366. 78: uint8(_BT_NMSTRT),
  22367. 79: uint8(_BT_NMSTRT),
  22368. 80: uint8(_BT_NMSTRT),
  22369. 81: uint8(_BT_NMSTRT),
  22370. 82: uint8(_BT_NMSTRT),
  22371. 83: uint8(_BT_NMSTRT),
  22372. 84: uint8(_BT_NMSTRT),
  22373. 85: uint8(_BT_NMSTRT),
  22374. 86: uint8(_BT_NMSTRT),
  22375. 87: uint8(_BT_NMSTRT),
  22376. 88: uint8(_BT_NMSTRT),
  22377. 89: uint8(_BT_NMSTRT),
  22378. 90: uint8(_BT_NMSTRT),
  22379. 91: uint8(_BT_LSQB),
  22380. 92: uint8(_BT_OTHER),
  22381. 93: uint8(_BT_RSQB),
  22382. 94: uint8(_BT_OTHER),
  22383. 95: uint8(_BT_NMSTRT),
  22384. 96: uint8(_BT_OTHER),
  22385. 97: uint8(_BT_HEX),
  22386. 98: uint8(_BT_HEX),
  22387. 99: uint8(_BT_HEX),
  22388. 100: uint8(_BT_HEX),
  22389. 101: uint8(_BT_HEX),
  22390. 102: uint8(_BT_HEX),
  22391. 103: uint8(_BT_NMSTRT),
  22392. 104: uint8(_BT_NMSTRT),
  22393. 105: uint8(_BT_NMSTRT),
  22394. 106: uint8(_BT_NMSTRT),
  22395. 107: uint8(_BT_NMSTRT),
  22396. 108: uint8(_BT_NMSTRT),
  22397. 109: uint8(_BT_NMSTRT),
  22398. 110: uint8(_BT_NMSTRT),
  22399. 111: uint8(_BT_NMSTRT),
  22400. 112: uint8(_BT_NMSTRT),
  22401. 113: uint8(_BT_NMSTRT),
  22402. 114: uint8(_BT_NMSTRT),
  22403. 115: uint8(_BT_NMSTRT),
  22404. 116: uint8(_BT_NMSTRT),
  22405. 117: uint8(_BT_NMSTRT),
  22406. 118: uint8(_BT_NMSTRT),
  22407. 119: uint8(_BT_NMSTRT),
  22408. 120: uint8(_BT_NMSTRT),
  22409. 121: uint8(_BT_NMSTRT),
  22410. 122: uint8(_BT_NMSTRT),
  22411. 123: uint8(_BT_OTHER),
  22412. 124: uint8(_BT_VERBAR),
  22413. 125: uint8(_BT_OTHER),
  22414. 126: uint8(_BT_OTHER),
  22415. 127: uint8(_BT_OTHER),
  22416. 128: uint8(_BT_OTHER),
  22417. 129: uint8(_BT_OTHER),
  22418. 130: uint8(_BT_OTHER),
  22419. 131: uint8(_BT_OTHER),
  22420. 132: uint8(_BT_OTHER),
  22421. 133: uint8(_BT_OTHER),
  22422. 134: uint8(_BT_OTHER),
  22423. 135: uint8(_BT_OTHER),
  22424. 136: uint8(_BT_OTHER),
  22425. 137: uint8(_BT_OTHER),
  22426. 138: uint8(_BT_OTHER),
  22427. 139: uint8(_BT_OTHER),
  22428. 140: uint8(_BT_OTHER),
  22429. 141: uint8(_BT_OTHER),
  22430. 142: uint8(_BT_OTHER),
  22431. 143: uint8(_BT_OTHER),
  22432. 144: uint8(_BT_OTHER),
  22433. 145: uint8(_BT_OTHER),
  22434. 146: uint8(_BT_OTHER),
  22435. 147: uint8(_BT_OTHER),
  22436. 148: uint8(_BT_OTHER),
  22437. 149: uint8(_BT_OTHER),
  22438. 150: uint8(_BT_OTHER),
  22439. 151: uint8(_BT_OTHER),
  22440. 152: uint8(_BT_OTHER),
  22441. 153: uint8(_BT_OTHER),
  22442. 154: uint8(_BT_OTHER),
  22443. 155: uint8(_BT_OTHER),
  22444. 156: uint8(_BT_OTHER),
  22445. 157: uint8(_BT_OTHER),
  22446. 158: uint8(_BT_OTHER),
  22447. 159: uint8(_BT_OTHER),
  22448. 160: uint8(_BT_OTHER),
  22449. 161: uint8(_BT_OTHER),
  22450. 162: uint8(_BT_OTHER),
  22451. 163: uint8(_BT_OTHER),
  22452. 164: uint8(_BT_OTHER),
  22453. 165: uint8(_BT_OTHER),
  22454. 166: uint8(_BT_OTHER),
  22455. 167: uint8(_BT_OTHER),
  22456. 168: uint8(_BT_OTHER),
  22457. 169: uint8(_BT_OTHER),
  22458. 170: uint8(_BT_NMSTRT),
  22459. 171: uint8(_BT_OTHER),
  22460. 172: uint8(_BT_OTHER),
  22461. 173: uint8(_BT_OTHER),
  22462. 174: uint8(_BT_OTHER),
  22463. 175: uint8(_BT_OTHER),
  22464. 176: uint8(_BT_OTHER),
  22465. 177: uint8(_BT_OTHER),
  22466. 178: uint8(_BT_OTHER),
  22467. 179: uint8(_BT_OTHER),
  22468. 180: uint8(_BT_OTHER),
  22469. 181: uint8(_BT_NMSTRT),
  22470. 182: uint8(_BT_OTHER),
  22471. 183: uint8(_BT_NAME),
  22472. 184: uint8(_BT_OTHER),
  22473. 185: uint8(_BT_OTHER),
  22474. 186: uint8(_BT_NMSTRT),
  22475. 187: uint8(_BT_OTHER),
  22476. 188: uint8(_BT_OTHER),
  22477. 189: uint8(_BT_OTHER),
  22478. 190: uint8(_BT_OTHER),
  22479. 191: uint8(_BT_OTHER),
  22480. 192: uint8(_BT_NMSTRT),
  22481. 193: uint8(_BT_NMSTRT),
  22482. 194: uint8(_BT_NMSTRT),
  22483. 195: uint8(_BT_NMSTRT),
  22484. 196: uint8(_BT_NMSTRT),
  22485. 197: uint8(_BT_NMSTRT),
  22486. 198: uint8(_BT_NMSTRT),
  22487. 199: uint8(_BT_NMSTRT),
  22488. 200: uint8(_BT_NMSTRT),
  22489. 201: uint8(_BT_NMSTRT),
  22490. 202: uint8(_BT_NMSTRT),
  22491. 203: uint8(_BT_NMSTRT),
  22492. 204: uint8(_BT_NMSTRT),
  22493. 205: uint8(_BT_NMSTRT),
  22494. 206: uint8(_BT_NMSTRT),
  22495. 207: uint8(_BT_NMSTRT),
  22496. 208: uint8(_BT_NMSTRT),
  22497. 209: uint8(_BT_NMSTRT),
  22498. 210: uint8(_BT_NMSTRT),
  22499. 211: uint8(_BT_NMSTRT),
  22500. 212: uint8(_BT_NMSTRT),
  22501. 213: uint8(_BT_NMSTRT),
  22502. 214: uint8(_BT_NMSTRT),
  22503. 215: uint8(_BT_OTHER),
  22504. 216: uint8(_BT_NMSTRT),
  22505. 217: uint8(_BT_NMSTRT),
  22506. 218: uint8(_BT_NMSTRT),
  22507. 219: uint8(_BT_NMSTRT),
  22508. 220: uint8(_BT_NMSTRT),
  22509. 221: uint8(_BT_NMSTRT),
  22510. 222: uint8(_BT_NMSTRT),
  22511. 223: uint8(_BT_NMSTRT),
  22512. 224: uint8(_BT_NMSTRT),
  22513. 225: uint8(_BT_NMSTRT),
  22514. 226: uint8(_BT_NMSTRT),
  22515. 227: uint8(_BT_NMSTRT),
  22516. 228: uint8(_BT_NMSTRT),
  22517. 229: uint8(_BT_NMSTRT),
  22518. 230: uint8(_BT_NMSTRT),
  22519. 231: uint8(_BT_NMSTRT),
  22520. 232: uint8(_BT_NMSTRT),
  22521. 233: uint8(_BT_NMSTRT),
  22522. 234: uint8(_BT_NMSTRT),
  22523. 235: uint8(_BT_NMSTRT),
  22524. 236: uint8(_BT_NMSTRT),
  22525. 237: uint8(_BT_NMSTRT),
  22526. 238: uint8(_BT_NMSTRT),
  22527. 239: uint8(_BT_NMSTRT),
  22528. 240: uint8(_BT_NMSTRT),
  22529. 241: uint8(_BT_NMSTRT),
  22530. 242: uint8(_BT_NMSTRT),
  22531. 243: uint8(_BT_NMSTRT),
  22532. 244: uint8(_BT_NMSTRT),
  22533. 245: uint8(_BT_NMSTRT),
  22534. 246: uint8(_BT_NMSTRT),
  22535. 247: uint8(_BT_OTHER),
  22536. 248: uint8(_BT_NMSTRT),
  22537. 249: uint8(_BT_NMSTRT),
  22538. 250: uint8(_BT_NMSTRT),
  22539. 251: uint8(_BT_NMSTRT),
  22540. 252: uint8(_BT_NMSTRT),
  22541. 253: uint8(_BT_NMSTRT),
  22542. 254: uint8(_BT_NMSTRT),
  22543. 255: uint8(_BT_NMSTRT),
  22544. },
  22545. }
  22546. func init() {
  22547. p := unsafe.Pointer(&_little2_encoding_ns)
  22548. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22549. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  22550. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  22551. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  22552. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  22553. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  22554. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  22555. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  22556. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  22557. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  22558. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  22559. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  22560. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  22561. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  22562. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  22563. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  22564. }
  22565. var _little2_encoding = Tnormal_encoding{
  22566. Fenc: TENCODING{
  22567. Fscanners: [4]TSCANNER{},
  22568. FliteralScanners: [2]TSCANNER{},
  22569. FminBytesPerChar: int32(2),
  22570. FisUtf16: int8(1),
  22571. },
  22572. Ftype1: [256]uint8{
  22573. 9: uint8(_BT_S),
  22574. 10: uint8(_BT_LF),
  22575. 13: uint8(_BT_CR),
  22576. 32: uint8(_BT_S),
  22577. 33: uint8(_BT_EXCL),
  22578. 34: uint8(_BT_QUOT),
  22579. 35: uint8(_BT_NUM),
  22580. 36: uint8(_BT_OTHER),
  22581. 37: uint8(_BT_PERCNT),
  22582. 38: uint8(_BT_AMP),
  22583. 39: uint8(_BT_APOS),
  22584. 40: uint8(_BT_LPAR),
  22585. 41: uint8(_BT_RPAR),
  22586. 42: uint8(_BT_AST),
  22587. 43: uint8(_BT_PLUS),
  22588. 44: uint8(_BT_COMMA),
  22589. 45: uint8(_BT_MINUS),
  22590. 46: uint8(_BT_NAME),
  22591. 47: uint8(_BT_SOL),
  22592. 48: uint8(_BT_DIGIT),
  22593. 49: uint8(_BT_DIGIT),
  22594. 50: uint8(_BT_DIGIT),
  22595. 51: uint8(_BT_DIGIT),
  22596. 52: uint8(_BT_DIGIT),
  22597. 53: uint8(_BT_DIGIT),
  22598. 54: uint8(_BT_DIGIT),
  22599. 55: uint8(_BT_DIGIT),
  22600. 56: uint8(_BT_DIGIT),
  22601. 57: uint8(_BT_DIGIT),
  22602. 58: uint8(_BT_NMSTRT),
  22603. 59: uint8(_BT_SEMI),
  22604. 60: uint8(_BT_LT),
  22605. 61: uint8(_BT_EQUALS),
  22606. 62: uint8(_BT_GT),
  22607. 63: uint8(_BT_QUEST),
  22608. 64: uint8(_BT_OTHER),
  22609. 65: uint8(_BT_HEX),
  22610. 66: uint8(_BT_HEX),
  22611. 67: uint8(_BT_HEX),
  22612. 68: uint8(_BT_HEX),
  22613. 69: uint8(_BT_HEX),
  22614. 70: uint8(_BT_HEX),
  22615. 71: uint8(_BT_NMSTRT),
  22616. 72: uint8(_BT_NMSTRT),
  22617. 73: uint8(_BT_NMSTRT),
  22618. 74: uint8(_BT_NMSTRT),
  22619. 75: uint8(_BT_NMSTRT),
  22620. 76: uint8(_BT_NMSTRT),
  22621. 77: uint8(_BT_NMSTRT),
  22622. 78: uint8(_BT_NMSTRT),
  22623. 79: uint8(_BT_NMSTRT),
  22624. 80: uint8(_BT_NMSTRT),
  22625. 81: uint8(_BT_NMSTRT),
  22626. 82: uint8(_BT_NMSTRT),
  22627. 83: uint8(_BT_NMSTRT),
  22628. 84: uint8(_BT_NMSTRT),
  22629. 85: uint8(_BT_NMSTRT),
  22630. 86: uint8(_BT_NMSTRT),
  22631. 87: uint8(_BT_NMSTRT),
  22632. 88: uint8(_BT_NMSTRT),
  22633. 89: uint8(_BT_NMSTRT),
  22634. 90: uint8(_BT_NMSTRT),
  22635. 91: uint8(_BT_LSQB),
  22636. 92: uint8(_BT_OTHER),
  22637. 93: uint8(_BT_RSQB),
  22638. 94: uint8(_BT_OTHER),
  22639. 95: uint8(_BT_NMSTRT),
  22640. 96: uint8(_BT_OTHER),
  22641. 97: uint8(_BT_HEX),
  22642. 98: uint8(_BT_HEX),
  22643. 99: uint8(_BT_HEX),
  22644. 100: uint8(_BT_HEX),
  22645. 101: uint8(_BT_HEX),
  22646. 102: uint8(_BT_HEX),
  22647. 103: uint8(_BT_NMSTRT),
  22648. 104: uint8(_BT_NMSTRT),
  22649. 105: uint8(_BT_NMSTRT),
  22650. 106: uint8(_BT_NMSTRT),
  22651. 107: uint8(_BT_NMSTRT),
  22652. 108: uint8(_BT_NMSTRT),
  22653. 109: uint8(_BT_NMSTRT),
  22654. 110: uint8(_BT_NMSTRT),
  22655. 111: uint8(_BT_NMSTRT),
  22656. 112: uint8(_BT_NMSTRT),
  22657. 113: uint8(_BT_NMSTRT),
  22658. 114: uint8(_BT_NMSTRT),
  22659. 115: uint8(_BT_NMSTRT),
  22660. 116: uint8(_BT_NMSTRT),
  22661. 117: uint8(_BT_NMSTRT),
  22662. 118: uint8(_BT_NMSTRT),
  22663. 119: uint8(_BT_NMSTRT),
  22664. 120: uint8(_BT_NMSTRT),
  22665. 121: uint8(_BT_NMSTRT),
  22666. 122: uint8(_BT_NMSTRT),
  22667. 123: uint8(_BT_OTHER),
  22668. 124: uint8(_BT_VERBAR),
  22669. 125: uint8(_BT_OTHER),
  22670. 126: uint8(_BT_OTHER),
  22671. 127: uint8(_BT_OTHER),
  22672. 128: uint8(_BT_OTHER),
  22673. 129: uint8(_BT_OTHER),
  22674. 130: uint8(_BT_OTHER),
  22675. 131: uint8(_BT_OTHER),
  22676. 132: uint8(_BT_OTHER),
  22677. 133: uint8(_BT_OTHER),
  22678. 134: uint8(_BT_OTHER),
  22679. 135: uint8(_BT_OTHER),
  22680. 136: uint8(_BT_OTHER),
  22681. 137: uint8(_BT_OTHER),
  22682. 138: uint8(_BT_OTHER),
  22683. 139: uint8(_BT_OTHER),
  22684. 140: uint8(_BT_OTHER),
  22685. 141: uint8(_BT_OTHER),
  22686. 142: uint8(_BT_OTHER),
  22687. 143: uint8(_BT_OTHER),
  22688. 144: uint8(_BT_OTHER),
  22689. 145: uint8(_BT_OTHER),
  22690. 146: uint8(_BT_OTHER),
  22691. 147: uint8(_BT_OTHER),
  22692. 148: uint8(_BT_OTHER),
  22693. 149: uint8(_BT_OTHER),
  22694. 150: uint8(_BT_OTHER),
  22695. 151: uint8(_BT_OTHER),
  22696. 152: uint8(_BT_OTHER),
  22697. 153: uint8(_BT_OTHER),
  22698. 154: uint8(_BT_OTHER),
  22699. 155: uint8(_BT_OTHER),
  22700. 156: uint8(_BT_OTHER),
  22701. 157: uint8(_BT_OTHER),
  22702. 158: uint8(_BT_OTHER),
  22703. 159: uint8(_BT_OTHER),
  22704. 160: uint8(_BT_OTHER),
  22705. 161: uint8(_BT_OTHER),
  22706. 162: uint8(_BT_OTHER),
  22707. 163: uint8(_BT_OTHER),
  22708. 164: uint8(_BT_OTHER),
  22709. 165: uint8(_BT_OTHER),
  22710. 166: uint8(_BT_OTHER),
  22711. 167: uint8(_BT_OTHER),
  22712. 168: uint8(_BT_OTHER),
  22713. 169: uint8(_BT_OTHER),
  22714. 170: uint8(_BT_NMSTRT),
  22715. 171: uint8(_BT_OTHER),
  22716. 172: uint8(_BT_OTHER),
  22717. 173: uint8(_BT_OTHER),
  22718. 174: uint8(_BT_OTHER),
  22719. 175: uint8(_BT_OTHER),
  22720. 176: uint8(_BT_OTHER),
  22721. 177: uint8(_BT_OTHER),
  22722. 178: uint8(_BT_OTHER),
  22723. 179: uint8(_BT_OTHER),
  22724. 180: uint8(_BT_OTHER),
  22725. 181: uint8(_BT_NMSTRT),
  22726. 182: uint8(_BT_OTHER),
  22727. 183: uint8(_BT_NAME),
  22728. 184: uint8(_BT_OTHER),
  22729. 185: uint8(_BT_OTHER),
  22730. 186: uint8(_BT_NMSTRT),
  22731. 187: uint8(_BT_OTHER),
  22732. 188: uint8(_BT_OTHER),
  22733. 189: uint8(_BT_OTHER),
  22734. 190: uint8(_BT_OTHER),
  22735. 191: uint8(_BT_OTHER),
  22736. 192: uint8(_BT_NMSTRT),
  22737. 193: uint8(_BT_NMSTRT),
  22738. 194: uint8(_BT_NMSTRT),
  22739. 195: uint8(_BT_NMSTRT),
  22740. 196: uint8(_BT_NMSTRT),
  22741. 197: uint8(_BT_NMSTRT),
  22742. 198: uint8(_BT_NMSTRT),
  22743. 199: uint8(_BT_NMSTRT),
  22744. 200: uint8(_BT_NMSTRT),
  22745. 201: uint8(_BT_NMSTRT),
  22746. 202: uint8(_BT_NMSTRT),
  22747. 203: uint8(_BT_NMSTRT),
  22748. 204: uint8(_BT_NMSTRT),
  22749. 205: uint8(_BT_NMSTRT),
  22750. 206: uint8(_BT_NMSTRT),
  22751. 207: uint8(_BT_NMSTRT),
  22752. 208: uint8(_BT_NMSTRT),
  22753. 209: uint8(_BT_NMSTRT),
  22754. 210: uint8(_BT_NMSTRT),
  22755. 211: uint8(_BT_NMSTRT),
  22756. 212: uint8(_BT_NMSTRT),
  22757. 213: uint8(_BT_NMSTRT),
  22758. 214: uint8(_BT_NMSTRT),
  22759. 215: uint8(_BT_OTHER),
  22760. 216: uint8(_BT_NMSTRT),
  22761. 217: uint8(_BT_NMSTRT),
  22762. 218: uint8(_BT_NMSTRT),
  22763. 219: uint8(_BT_NMSTRT),
  22764. 220: uint8(_BT_NMSTRT),
  22765. 221: uint8(_BT_NMSTRT),
  22766. 222: uint8(_BT_NMSTRT),
  22767. 223: uint8(_BT_NMSTRT),
  22768. 224: uint8(_BT_NMSTRT),
  22769. 225: uint8(_BT_NMSTRT),
  22770. 226: uint8(_BT_NMSTRT),
  22771. 227: uint8(_BT_NMSTRT),
  22772. 228: uint8(_BT_NMSTRT),
  22773. 229: uint8(_BT_NMSTRT),
  22774. 230: uint8(_BT_NMSTRT),
  22775. 231: uint8(_BT_NMSTRT),
  22776. 232: uint8(_BT_NMSTRT),
  22777. 233: uint8(_BT_NMSTRT),
  22778. 234: uint8(_BT_NMSTRT),
  22779. 235: uint8(_BT_NMSTRT),
  22780. 236: uint8(_BT_NMSTRT),
  22781. 237: uint8(_BT_NMSTRT),
  22782. 238: uint8(_BT_NMSTRT),
  22783. 239: uint8(_BT_NMSTRT),
  22784. 240: uint8(_BT_NMSTRT),
  22785. 241: uint8(_BT_NMSTRT),
  22786. 242: uint8(_BT_NMSTRT),
  22787. 243: uint8(_BT_NMSTRT),
  22788. 244: uint8(_BT_NMSTRT),
  22789. 245: uint8(_BT_NMSTRT),
  22790. 246: uint8(_BT_NMSTRT),
  22791. 247: uint8(_BT_OTHER),
  22792. 248: uint8(_BT_NMSTRT),
  22793. 249: uint8(_BT_NMSTRT),
  22794. 250: uint8(_BT_NMSTRT),
  22795. 251: uint8(_BT_NMSTRT),
  22796. 252: uint8(_BT_NMSTRT),
  22797. 253: uint8(_BT_NMSTRT),
  22798. 254: uint8(_BT_NMSTRT),
  22799. 255: uint8(_BT_NMSTRT),
  22800. },
  22801. }
  22802. func init() {
  22803. p := unsafe.Pointer(&_little2_encoding)
  22804. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  22805. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  22806. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  22807. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  22808. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  22809. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  22810. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  22811. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  22812. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  22813. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  22814. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  22815. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  22816. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  22817. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  22818. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  22819. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  22820. }
  22821. var _internal_little2_encoding_ns = Tnormal_encoding{
  22822. Fenc: TENCODING{
  22823. Fscanners: [4]TSCANNER{},
  22824. FliteralScanners: [2]TSCANNER{},
  22825. FminBytesPerChar: int32(2),
  22826. FisUtf16: int8(1),
  22827. },
  22828. Ftype1: [256]uint8{
  22829. 9: uint8(_BT_S),
  22830. 10: uint8(_BT_LF),
  22831. 13: uint8(_BT_S),
  22832. 32: uint8(_BT_S),
  22833. 33: uint8(_BT_EXCL),
  22834. 34: uint8(_BT_QUOT),
  22835. 35: uint8(_BT_NUM),
  22836. 36: uint8(_BT_OTHER),
  22837. 37: uint8(_BT_PERCNT),
  22838. 38: uint8(_BT_AMP),
  22839. 39: uint8(_BT_APOS),
  22840. 40: uint8(_BT_LPAR),
  22841. 41: uint8(_BT_RPAR),
  22842. 42: uint8(_BT_AST),
  22843. 43: uint8(_BT_PLUS),
  22844. 44: uint8(_BT_COMMA),
  22845. 45: uint8(_BT_MINUS),
  22846. 46: uint8(_BT_NAME),
  22847. 47: uint8(_BT_SOL),
  22848. 48: uint8(_BT_DIGIT),
  22849. 49: uint8(_BT_DIGIT),
  22850. 50: uint8(_BT_DIGIT),
  22851. 51: uint8(_BT_DIGIT),
  22852. 52: uint8(_BT_DIGIT),
  22853. 53: uint8(_BT_DIGIT),
  22854. 54: uint8(_BT_DIGIT),
  22855. 55: uint8(_BT_DIGIT),
  22856. 56: uint8(_BT_DIGIT),
  22857. 57: uint8(_BT_DIGIT),
  22858. 58: uint8(_BT_COLON),
  22859. 59: uint8(_BT_SEMI),
  22860. 60: uint8(_BT_LT),
  22861. 61: uint8(_BT_EQUALS),
  22862. 62: uint8(_BT_GT),
  22863. 63: uint8(_BT_QUEST),
  22864. 64: uint8(_BT_OTHER),
  22865. 65: uint8(_BT_HEX),
  22866. 66: uint8(_BT_HEX),
  22867. 67: uint8(_BT_HEX),
  22868. 68: uint8(_BT_HEX),
  22869. 69: uint8(_BT_HEX),
  22870. 70: uint8(_BT_HEX),
  22871. 71: uint8(_BT_NMSTRT),
  22872. 72: uint8(_BT_NMSTRT),
  22873. 73: uint8(_BT_NMSTRT),
  22874. 74: uint8(_BT_NMSTRT),
  22875. 75: uint8(_BT_NMSTRT),
  22876. 76: uint8(_BT_NMSTRT),
  22877. 77: uint8(_BT_NMSTRT),
  22878. 78: uint8(_BT_NMSTRT),
  22879. 79: uint8(_BT_NMSTRT),
  22880. 80: uint8(_BT_NMSTRT),
  22881. 81: uint8(_BT_NMSTRT),
  22882. 82: uint8(_BT_NMSTRT),
  22883. 83: uint8(_BT_NMSTRT),
  22884. 84: uint8(_BT_NMSTRT),
  22885. 85: uint8(_BT_NMSTRT),
  22886. 86: uint8(_BT_NMSTRT),
  22887. 87: uint8(_BT_NMSTRT),
  22888. 88: uint8(_BT_NMSTRT),
  22889. 89: uint8(_BT_NMSTRT),
  22890. 90: uint8(_BT_NMSTRT),
  22891. 91: uint8(_BT_LSQB),
  22892. 92: uint8(_BT_OTHER),
  22893. 93: uint8(_BT_RSQB),
  22894. 94: uint8(_BT_OTHER),
  22895. 95: uint8(_BT_NMSTRT),
  22896. 96: uint8(_BT_OTHER),
  22897. 97: uint8(_BT_HEX),
  22898. 98: uint8(_BT_HEX),
  22899. 99: uint8(_BT_HEX),
  22900. 100: uint8(_BT_HEX),
  22901. 101: uint8(_BT_HEX),
  22902. 102: uint8(_BT_HEX),
  22903. 103: uint8(_BT_NMSTRT),
  22904. 104: uint8(_BT_NMSTRT),
  22905. 105: uint8(_BT_NMSTRT),
  22906. 106: uint8(_BT_NMSTRT),
  22907. 107: uint8(_BT_NMSTRT),
  22908. 108: uint8(_BT_NMSTRT),
  22909. 109: uint8(_BT_NMSTRT),
  22910. 110: uint8(_BT_NMSTRT),
  22911. 111: uint8(_BT_NMSTRT),
  22912. 112: uint8(_BT_NMSTRT),
  22913. 113: uint8(_BT_NMSTRT),
  22914. 114: uint8(_BT_NMSTRT),
  22915. 115: uint8(_BT_NMSTRT),
  22916. 116: uint8(_BT_NMSTRT),
  22917. 117: uint8(_BT_NMSTRT),
  22918. 118: uint8(_BT_NMSTRT),
  22919. 119: uint8(_BT_NMSTRT),
  22920. 120: uint8(_BT_NMSTRT),
  22921. 121: uint8(_BT_NMSTRT),
  22922. 122: uint8(_BT_NMSTRT),
  22923. 123: uint8(_BT_OTHER),
  22924. 124: uint8(_BT_VERBAR),
  22925. 125: uint8(_BT_OTHER),
  22926. 126: uint8(_BT_OTHER),
  22927. 127: uint8(_BT_OTHER),
  22928. 128: uint8(_BT_OTHER),
  22929. 129: uint8(_BT_OTHER),
  22930. 130: uint8(_BT_OTHER),
  22931. 131: uint8(_BT_OTHER),
  22932. 132: uint8(_BT_OTHER),
  22933. 133: uint8(_BT_OTHER),
  22934. 134: uint8(_BT_OTHER),
  22935. 135: uint8(_BT_OTHER),
  22936. 136: uint8(_BT_OTHER),
  22937. 137: uint8(_BT_OTHER),
  22938. 138: uint8(_BT_OTHER),
  22939. 139: uint8(_BT_OTHER),
  22940. 140: uint8(_BT_OTHER),
  22941. 141: uint8(_BT_OTHER),
  22942. 142: uint8(_BT_OTHER),
  22943. 143: uint8(_BT_OTHER),
  22944. 144: uint8(_BT_OTHER),
  22945. 145: uint8(_BT_OTHER),
  22946. 146: uint8(_BT_OTHER),
  22947. 147: uint8(_BT_OTHER),
  22948. 148: uint8(_BT_OTHER),
  22949. 149: uint8(_BT_OTHER),
  22950. 150: uint8(_BT_OTHER),
  22951. 151: uint8(_BT_OTHER),
  22952. 152: uint8(_BT_OTHER),
  22953. 153: uint8(_BT_OTHER),
  22954. 154: uint8(_BT_OTHER),
  22955. 155: uint8(_BT_OTHER),
  22956. 156: uint8(_BT_OTHER),
  22957. 157: uint8(_BT_OTHER),
  22958. 158: uint8(_BT_OTHER),
  22959. 159: uint8(_BT_OTHER),
  22960. 160: uint8(_BT_OTHER),
  22961. 161: uint8(_BT_OTHER),
  22962. 162: uint8(_BT_OTHER),
  22963. 163: uint8(_BT_OTHER),
  22964. 164: uint8(_BT_OTHER),
  22965. 165: uint8(_BT_OTHER),
  22966. 166: uint8(_BT_OTHER),
  22967. 167: uint8(_BT_OTHER),
  22968. 168: uint8(_BT_OTHER),
  22969. 169: uint8(_BT_OTHER),
  22970. 170: uint8(_BT_NMSTRT),
  22971. 171: uint8(_BT_OTHER),
  22972. 172: uint8(_BT_OTHER),
  22973. 173: uint8(_BT_OTHER),
  22974. 174: uint8(_BT_OTHER),
  22975. 175: uint8(_BT_OTHER),
  22976. 176: uint8(_BT_OTHER),
  22977. 177: uint8(_BT_OTHER),
  22978. 178: uint8(_BT_OTHER),
  22979. 179: uint8(_BT_OTHER),
  22980. 180: uint8(_BT_OTHER),
  22981. 181: uint8(_BT_NMSTRT),
  22982. 182: uint8(_BT_OTHER),
  22983. 183: uint8(_BT_NAME),
  22984. 184: uint8(_BT_OTHER),
  22985. 185: uint8(_BT_OTHER),
  22986. 186: uint8(_BT_NMSTRT),
  22987. 187: uint8(_BT_OTHER),
  22988. 188: uint8(_BT_OTHER),
  22989. 189: uint8(_BT_OTHER),
  22990. 190: uint8(_BT_OTHER),
  22991. 191: uint8(_BT_OTHER),
  22992. 192: uint8(_BT_NMSTRT),
  22993. 193: uint8(_BT_NMSTRT),
  22994. 194: uint8(_BT_NMSTRT),
  22995. 195: uint8(_BT_NMSTRT),
  22996. 196: uint8(_BT_NMSTRT),
  22997. 197: uint8(_BT_NMSTRT),
  22998. 198: uint8(_BT_NMSTRT),
  22999. 199: uint8(_BT_NMSTRT),
  23000. 200: uint8(_BT_NMSTRT),
  23001. 201: uint8(_BT_NMSTRT),
  23002. 202: uint8(_BT_NMSTRT),
  23003. 203: uint8(_BT_NMSTRT),
  23004. 204: uint8(_BT_NMSTRT),
  23005. 205: uint8(_BT_NMSTRT),
  23006. 206: uint8(_BT_NMSTRT),
  23007. 207: uint8(_BT_NMSTRT),
  23008. 208: uint8(_BT_NMSTRT),
  23009. 209: uint8(_BT_NMSTRT),
  23010. 210: uint8(_BT_NMSTRT),
  23011. 211: uint8(_BT_NMSTRT),
  23012. 212: uint8(_BT_NMSTRT),
  23013. 213: uint8(_BT_NMSTRT),
  23014. 214: uint8(_BT_NMSTRT),
  23015. 215: uint8(_BT_OTHER),
  23016. 216: uint8(_BT_NMSTRT),
  23017. 217: uint8(_BT_NMSTRT),
  23018. 218: uint8(_BT_NMSTRT),
  23019. 219: uint8(_BT_NMSTRT),
  23020. 220: uint8(_BT_NMSTRT),
  23021. 221: uint8(_BT_NMSTRT),
  23022. 222: uint8(_BT_NMSTRT),
  23023. 223: uint8(_BT_NMSTRT),
  23024. 224: uint8(_BT_NMSTRT),
  23025. 225: uint8(_BT_NMSTRT),
  23026. 226: uint8(_BT_NMSTRT),
  23027. 227: uint8(_BT_NMSTRT),
  23028. 228: uint8(_BT_NMSTRT),
  23029. 229: uint8(_BT_NMSTRT),
  23030. 230: uint8(_BT_NMSTRT),
  23031. 231: uint8(_BT_NMSTRT),
  23032. 232: uint8(_BT_NMSTRT),
  23033. 233: uint8(_BT_NMSTRT),
  23034. 234: uint8(_BT_NMSTRT),
  23035. 235: uint8(_BT_NMSTRT),
  23036. 236: uint8(_BT_NMSTRT),
  23037. 237: uint8(_BT_NMSTRT),
  23038. 238: uint8(_BT_NMSTRT),
  23039. 239: uint8(_BT_NMSTRT),
  23040. 240: uint8(_BT_NMSTRT),
  23041. 241: uint8(_BT_NMSTRT),
  23042. 242: uint8(_BT_NMSTRT),
  23043. 243: uint8(_BT_NMSTRT),
  23044. 244: uint8(_BT_NMSTRT),
  23045. 245: uint8(_BT_NMSTRT),
  23046. 246: uint8(_BT_NMSTRT),
  23047. 247: uint8(_BT_OTHER),
  23048. 248: uint8(_BT_NMSTRT),
  23049. 249: uint8(_BT_NMSTRT),
  23050. 250: uint8(_BT_NMSTRT),
  23051. 251: uint8(_BT_NMSTRT),
  23052. 252: uint8(_BT_NMSTRT),
  23053. 253: uint8(_BT_NMSTRT),
  23054. 254: uint8(_BT_NMSTRT),
  23055. 255: uint8(_BT_NMSTRT),
  23056. },
  23057. }
  23058. func init() {
  23059. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  23060. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23061. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  23062. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  23063. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  23064. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  23065. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  23066. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  23067. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  23068. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  23069. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  23070. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  23071. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  23072. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  23073. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  23074. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  23075. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  23076. }
  23077. var _internal_little2_encoding = Tnormal_encoding{
  23078. Fenc: TENCODING{
  23079. Fscanners: [4]TSCANNER{},
  23080. FliteralScanners: [2]TSCANNER{},
  23081. FminBytesPerChar: int32(2),
  23082. FisUtf16: int8(1),
  23083. },
  23084. Ftype1: [256]uint8{
  23085. 9: uint8(_BT_S),
  23086. 10: uint8(_BT_LF),
  23087. 13: uint8(_BT_S),
  23088. 32: uint8(_BT_S),
  23089. 33: uint8(_BT_EXCL),
  23090. 34: uint8(_BT_QUOT),
  23091. 35: uint8(_BT_NUM),
  23092. 36: uint8(_BT_OTHER),
  23093. 37: uint8(_BT_PERCNT),
  23094. 38: uint8(_BT_AMP),
  23095. 39: uint8(_BT_APOS),
  23096. 40: uint8(_BT_LPAR),
  23097. 41: uint8(_BT_RPAR),
  23098. 42: uint8(_BT_AST),
  23099. 43: uint8(_BT_PLUS),
  23100. 44: uint8(_BT_COMMA),
  23101. 45: uint8(_BT_MINUS),
  23102. 46: uint8(_BT_NAME),
  23103. 47: uint8(_BT_SOL),
  23104. 48: uint8(_BT_DIGIT),
  23105. 49: uint8(_BT_DIGIT),
  23106. 50: uint8(_BT_DIGIT),
  23107. 51: uint8(_BT_DIGIT),
  23108. 52: uint8(_BT_DIGIT),
  23109. 53: uint8(_BT_DIGIT),
  23110. 54: uint8(_BT_DIGIT),
  23111. 55: uint8(_BT_DIGIT),
  23112. 56: uint8(_BT_DIGIT),
  23113. 57: uint8(_BT_DIGIT),
  23114. 58: uint8(_BT_NMSTRT),
  23115. 59: uint8(_BT_SEMI),
  23116. 60: uint8(_BT_LT),
  23117. 61: uint8(_BT_EQUALS),
  23118. 62: uint8(_BT_GT),
  23119. 63: uint8(_BT_QUEST),
  23120. 64: uint8(_BT_OTHER),
  23121. 65: uint8(_BT_HEX),
  23122. 66: uint8(_BT_HEX),
  23123. 67: uint8(_BT_HEX),
  23124. 68: uint8(_BT_HEX),
  23125. 69: uint8(_BT_HEX),
  23126. 70: uint8(_BT_HEX),
  23127. 71: uint8(_BT_NMSTRT),
  23128. 72: uint8(_BT_NMSTRT),
  23129. 73: uint8(_BT_NMSTRT),
  23130. 74: uint8(_BT_NMSTRT),
  23131. 75: uint8(_BT_NMSTRT),
  23132. 76: uint8(_BT_NMSTRT),
  23133. 77: uint8(_BT_NMSTRT),
  23134. 78: uint8(_BT_NMSTRT),
  23135. 79: uint8(_BT_NMSTRT),
  23136. 80: uint8(_BT_NMSTRT),
  23137. 81: uint8(_BT_NMSTRT),
  23138. 82: uint8(_BT_NMSTRT),
  23139. 83: uint8(_BT_NMSTRT),
  23140. 84: uint8(_BT_NMSTRT),
  23141. 85: uint8(_BT_NMSTRT),
  23142. 86: uint8(_BT_NMSTRT),
  23143. 87: uint8(_BT_NMSTRT),
  23144. 88: uint8(_BT_NMSTRT),
  23145. 89: uint8(_BT_NMSTRT),
  23146. 90: uint8(_BT_NMSTRT),
  23147. 91: uint8(_BT_LSQB),
  23148. 92: uint8(_BT_OTHER),
  23149. 93: uint8(_BT_RSQB),
  23150. 94: uint8(_BT_OTHER),
  23151. 95: uint8(_BT_NMSTRT),
  23152. 96: uint8(_BT_OTHER),
  23153. 97: uint8(_BT_HEX),
  23154. 98: uint8(_BT_HEX),
  23155. 99: uint8(_BT_HEX),
  23156. 100: uint8(_BT_HEX),
  23157. 101: uint8(_BT_HEX),
  23158. 102: uint8(_BT_HEX),
  23159. 103: uint8(_BT_NMSTRT),
  23160. 104: uint8(_BT_NMSTRT),
  23161. 105: uint8(_BT_NMSTRT),
  23162. 106: uint8(_BT_NMSTRT),
  23163. 107: uint8(_BT_NMSTRT),
  23164. 108: uint8(_BT_NMSTRT),
  23165. 109: uint8(_BT_NMSTRT),
  23166. 110: uint8(_BT_NMSTRT),
  23167. 111: uint8(_BT_NMSTRT),
  23168. 112: uint8(_BT_NMSTRT),
  23169. 113: uint8(_BT_NMSTRT),
  23170. 114: uint8(_BT_NMSTRT),
  23171. 115: uint8(_BT_NMSTRT),
  23172. 116: uint8(_BT_NMSTRT),
  23173. 117: uint8(_BT_NMSTRT),
  23174. 118: uint8(_BT_NMSTRT),
  23175. 119: uint8(_BT_NMSTRT),
  23176. 120: uint8(_BT_NMSTRT),
  23177. 121: uint8(_BT_NMSTRT),
  23178. 122: uint8(_BT_NMSTRT),
  23179. 123: uint8(_BT_OTHER),
  23180. 124: uint8(_BT_VERBAR),
  23181. 125: uint8(_BT_OTHER),
  23182. 126: uint8(_BT_OTHER),
  23183. 127: uint8(_BT_OTHER),
  23184. 128: uint8(_BT_OTHER),
  23185. 129: uint8(_BT_OTHER),
  23186. 130: uint8(_BT_OTHER),
  23187. 131: uint8(_BT_OTHER),
  23188. 132: uint8(_BT_OTHER),
  23189. 133: uint8(_BT_OTHER),
  23190. 134: uint8(_BT_OTHER),
  23191. 135: uint8(_BT_OTHER),
  23192. 136: uint8(_BT_OTHER),
  23193. 137: uint8(_BT_OTHER),
  23194. 138: uint8(_BT_OTHER),
  23195. 139: uint8(_BT_OTHER),
  23196. 140: uint8(_BT_OTHER),
  23197. 141: uint8(_BT_OTHER),
  23198. 142: uint8(_BT_OTHER),
  23199. 143: uint8(_BT_OTHER),
  23200. 144: uint8(_BT_OTHER),
  23201. 145: uint8(_BT_OTHER),
  23202. 146: uint8(_BT_OTHER),
  23203. 147: uint8(_BT_OTHER),
  23204. 148: uint8(_BT_OTHER),
  23205. 149: uint8(_BT_OTHER),
  23206. 150: uint8(_BT_OTHER),
  23207. 151: uint8(_BT_OTHER),
  23208. 152: uint8(_BT_OTHER),
  23209. 153: uint8(_BT_OTHER),
  23210. 154: uint8(_BT_OTHER),
  23211. 155: uint8(_BT_OTHER),
  23212. 156: uint8(_BT_OTHER),
  23213. 157: uint8(_BT_OTHER),
  23214. 158: uint8(_BT_OTHER),
  23215. 159: uint8(_BT_OTHER),
  23216. 160: uint8(_BT_OTHER),
  23217. 161: uint8(_BT_OTHER),
  23218. 162: uint8(_BT_OTHER),
  23219. 163: uint8(_BT_OTHER),
  23220. 164: uint8(_BT_OTHER),
  23221. 165: uint8(_BT_OTHER),
  23222. 166: uint8(_BT_OTHER),
  23223. 167: uint8(_BT_OTHER),
  23224. 168: uint8(_BT_OTHER),
  23225. 169: uint8(_BT_OTHER),
  23226. 170: uint8(_BT_NMSTRT),
  23227. 171: uint8(_BT_OTHER),
  23228. 172: uint8(_BT_OTHER),
  23229. 173: uint8(_BT_OTHER),
  23230. 174: uint8(_BT_OTHER),
  23231. 175: uint8(_BT_OTHER),
  23232. 176: uint8(_BT_OTHER),
  23233. 177: uint8(_BT_OTHER),
  23234. 178: uint8(_BT_OTHER),
  23235. 179: uint8(_BT_OTHER),
  23236. 180: uint8(_BT_OTHER),
  23237. 181: uint8(_BT_NMSTRT),
  23238. 182: uint8(_BT_OTHER),
  23239. 183: uint8(_BT_NAME),
  23240. 184: uint8(_BT_OTHER),
  23241. 185: uint8(_BT_OTHER),
  23242. 186: uint8(_BT_NMSTRT),
  23243. 187: uint8(_BT_OTHER),
  23244. 188: uint8(_BT_OTHER),
  23245. 189: uint8(_BT_OTHER),
  23246. 190: uint8(_BT_OTHER),
  23247. 191: uint8(_BT_OTHER),
  23248. 192: uint8(_BT_NMSTRT),
  23249. 193: uint8(_BT_NMSTRT),
  23250. 194: uint8(_BT_NMSTRT),
  23251. 195: uint8(_BT_NMSTRT),
  23252. 196: uint8(_BT_NMSTRT),
  23253. 197: uint8(_BT_NMSTRT),
  23254. 198: uint8(_BT_NMSTRT),
  23255. 199: uint8(_BT_NMSTRT),
  23256. 200: uint8(_BT_NMSTRT),
  23257. 201: uint8(_BT_NMSTRT),
  23258. 202: uint8(_BT_NMSTRT),
  23259. 203: uint8(_BT_NMSTRT),
  23260. 204: uint8(_BT_NMSTRT),
  23261. 205: uint8(_BT_NMSTRT),
  23262. 206: uint8(_BT_NMSTRT),
  23263. 207: uint8(_BT_NMSTRT),
  23264. 208: uint8(_BT_NMSTRT),
  23265. 209: uint8(_BT_NMSTRT),
  23266. 210: uint8(_BT_NMSTRT),
  23267. 211: uint8(_BT_NMSTRT),
  23268. 212: uint8(_BT_NMSTRT),
  23269. 213: uint8(_BT_NMSTRT),
  23270. 214: uint8(_BT_NMSTRT),
  23271. 215: uint8(_BT_OTHER),
  23272. 216: uint8(_BT_NMSTRT),
  23273. 217: uint8(_BT_NMSTRT),
  23274. 218: uint8(_BT_NMSTRT),
  23275. 219: uint8(_BT_NMSTRT),
  23276. 220: uint8(_BT_NMSTRT),
  23277. 221: uint8(_BT_NMSTRT),
  23278. 222: uint8(_BT_NMSTRT),
  23279. 223: uint8(_BT_NMSTRT),
  23280. 224: uint8(_BT_NMSTRT),
  23281. 225: uint8(_BT_NMSTRT),
  23282. 226: uint8(_BT_NMSTRT),
  23283. 227: uint8(_BT_NMSTRT),
  23284. 228: uint8(_BT_NMSTRT),
  23285. 229: uint8(_BT_NMSTRT),
  23286. 230: uint8(_BT_NMSTRT),
  23287. 231: uint8(_BT_NMSTRT),
  23288. 232: uint8(_BT_NMSTRT),
  23289. 233: uint8(_BT_NMSTRT),
  23290. 234: uint8(_BT_NMSTRT),
  23291. 235: uint8(_BT_NMSTRT),
  23292. 236: uint8(_BT_NMSTRT),
  23293. 237: uint8(_BT_NMSTRT),
  23294. 238: uint8(_BT_NMSTRT),
  23295. 239: uint8(_BT_NMSTRT),
  23296. 240: uint8(_BT_NMSTRT),
  23297. 241: uint8(_BT_NMSTRT),
  23298. 242: uint8(_BT_NMSTRT),
  23299. 243: uint8(_BT_NMSTRT),
  23300. 244: uint8(_BT_NMSTRT),
  23301. 245: uint8(_BT_NMSTRT),
  23302. 246: uint8(_BT_NMSTRT),
  23303. 247: uint8(_BT_OTHER),
  23304. 248: uint8(_BT_NMSTRT),
  23305. 249: uint8(_BT_NMSTRT),
  23306. 250: uint8(_BT_NMSTRT),
  23307. 251: uint8(_BT_NMSTRT),
  23308. 252: uint8(_BT_NMSTRT),
  23309. 253: uint8(_BT_NMSTRT),
  23310. 254: uint8(_BT_NMSTRT),
  23311. 255: uint8(_BT_NMSTRT),
  23312. },
  23313. }
  23314. func init() {
  23315. p := unsafe.Pointer(&_internal_little2_encoding)
  23316. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  23317. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_little2_contentTok)
  23318. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_cdataSectionTok)
  23319. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_little2_ignoreSectionTok)
  23320. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_attributeValueTok)
  23321. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_little2_entityValueTok)
  23322. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_nameMatchesAscii)
  23323. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_little2_nameLength)
  23324. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_skipS)
  23325. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_little2_getAtts)
  23326. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_charRefNumber)
  23327. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_little2_predefinedEntityName)
  23328. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_updatePosition)
  23329. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_little2_isPublicId)
  23330. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_toUtf8)
  23331. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_little2_toUtf16)
  23332. }
  23333. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  23334. /* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)!
  23335. __ __ _
  23336. ___\ \/ /_ __ __ _| |_
  23337. / _ \\ /| '_ \ / _` | __|
  23338. | __// \| |_) | (_| | |_
  23339. \___/_/\_\ .__/ \__,_|\__|
  23340. |_| XML parser
  23341. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  23342. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  23343. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  23344. Copyright (c) 2002-2016 Karl Waclawek <karl@waclawek.net>
  23345. Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
  23346. Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
  23347. Copyright (c) 2018 Benjamin Peterson <benjamin@python.org>
  23348. Copyright (c) 2018 Anton Maklakov <antmak.pub@gmail.com>
  23349. Copyright (c) 2019 David Loffredo <loffredo@steptools.com>
  23350. Copyright (c) 2020 Boris Kolpackov <boris@codesynthesis.com>
  23351. Copyright (c) 2022 Martin Ettl <ettl.martin78@googlemail.com>
  23352. Licensed under the MIT license:
  23353. Permission is hereby granted, free of charge, to any person obtaining
  23354. a copy of this software and associated documentation files (the
  23355. "Software"), to deal in the Software without restriction, including
  23356. without limitation the rights to use, copy, modify, merge, publish,
  23357. distribute, sublicense, and/or sell copies of the Software, and to permit
  23358. persons to whom the Software is furnished to do so, subject to the
  23359. following conditions:
  23360. The above copyright notice and this permission notice shall be included
  23361. in all copies or substantial portions of the Software.
  23362. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23363. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23364. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23365. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23366. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23367. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23368. USE OR OTHER DEALINGS IN THE SOFTWARE.
  23369. */
  23370. /* ptr points to character following "<!-" */
  23371. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23372. var v1 int32
  23373. _ = v1
  23374. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23375. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  23376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23377. return m_XML_TOK_INVALID
  23378. }
  23379. ptr += uintptr(2)
  23380. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23381. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23382. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23383. } else {
  23384. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23385. }
  23386. switch v1 {
  23387. case int32(_BT_LEAD2):
  23388. if int32(end)-int32(ptr) < int32(2) {
  23389. return -int32(2)
  23390. }
  23391. if 0 != 0 {
  23392. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23393. return m_XML_TOK_INVALID
  23394. }
  23395. ptr += uintptr(2)
  23396. case int32(_BT_LEAD3):
  23397. if int32(end)-int32(ptr) < int32(3) {
  23398. return -int32(2)
  23399. }
  23400. if 0 != 0 {
  23401. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23402. return m_XML_TOK_INVALID
  23403. }
  23404. ptr += uintptr(3)
  23405. case int32(_BT_LEAD4):
  23406. if int32(end)-int32(ptr) < int32(4) {
  23407. return -int32(2)
  23408. }
  23409. if 0 != 0 {
  23410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23411. return m_XML_TOK_INVALID
  23412. }
  23413. ptr += uintptr(4)
  23414. case int32(_BT_NONXML):
  23415. fallthrough
  23416. case int32(_BT_MALFORM):
  23417. fallthrough
  23418. case int32(_BT_TRAIL):
  23419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23420. return m_XML_TOK_INVALID
  23421. case int32(_BT_MINUS):
  23422. ptr += uintptr(2)
  23423. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23424. return -int32(1)
  23425. }
  23426. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  23427. ptr += uintptr(2)
  23428. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23429. return -int32(1)
  23430. }
  23431. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23433. return m_XML_TOK_INVALID
  23434. }
  23435. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23436. return int32(m_XML_TOK_COMMENT)
  23437. }
  23438. default:
  23439. ptr += uintptr(2)
  23440. break
  23441. }
  23442. }
  23443. }
  23444. return -int32(1)
  23445. }
  23446. /* ptr points to character following "<!" */
  23447. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23448. var v1, v2, v3 int32
  23449. _, _, _ = v1, v2, v3
  23450. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23451. return -int32(1)
  23452. }
  23453. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23454. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23455. } else {
  23456. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23457. }
  23458. switch v1 {
  23459. case int32(_BT_MINUS):
  23460. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23461. case int32(_BT_LSQB):
  23462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23463. return int32(m_XML_TOK_COND_SECT_OPEN)
  23464. case int32(_BT_NMSTRT):
  23465. fallthrough
  23466. case int32(_BT_HEX):
  23467. ptr += uintptr(2)
  23468. default:
  23469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23470. return m_XML_TOK_INVALID
  23471. }
  23472. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23473. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23474. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23475. } else {
  23476. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23477. }
  23478. switch v2 {
  23479. case int32(_BT_PERCNT):
  23480. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  23481. return -int32(1)
  23482. }
  23483. /* don't allow <!ENTITY% foo "whatever"> */
  23484. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23485. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  23486. } else {
  23487. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23488. }
  23489. switch v3 {
  23490. case int32(_BT_S):
  23491. fallthrough
  23492. case int32(_BT_CR):
  23493. fallthrough
  23494. case int32(_BT_LF):
  23495. fallthrough
  23496. case int32(_BT_PERCNT):
  23497. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23498. return m_XML_TOK_INVALID
  23499. }
  23500. /* fall through */
  23501. fallthrough
  23502. case int32(_BT_S):
  23503. fallthrough
  23504. case int32(_BT_CR):
  23505. fallthrough
  23506. case int32(_BT_LF):
  23507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23508. return int32(m_XML_TOK_DECL_OPEN)
  23509. case int32(_BT_NMSTRT):
  23510. fallthrough
  23511. case int32(_BT_HEX):
  23512. ptr += uintptr(2)
  23513. default:
  23514. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23515. return m_XML_TOK_INVALID
  23516. }
  23517. }
  23518. return -int32(1)
  23519. }
  23520. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  23521. var upper, v1, v2, v3 int32
  23522. _, _, _, _ = upper, v1, v2, v3
  23523. upper = 0
  23524. _ = enc
  23525. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  23526. if int32(end)-int32(ptr) != libc.Int32FromInt32(2)*libc.Int32FromInt32(3) {
  23527. return int32(1)
  23528. }
  23529. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23530. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23531. } else {
  23532. v1 = -int32(1)
  23533. }
  23534. switch v1 {
  23535. case int32(m_ASCII_x2):
  23536. case int32(m_ASCII_X):
  23537. upper = int32(1)
  23538. default:
  23539. return int32(1)
  23540. }
  23541. ptr += uintptr(2)
  23542. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23543. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23544. } else {
  23545. v2 = -int32(1)
  23546. }
  23547. switch v2 {
  23548. case int32(m_ASCII_m2):
  23549. case int32(m_ASCII_M):
  23550. upper = int32(1)
  23551. default:
  23552. return int32(1)
  23553. }
  23554. ptr += uintptr(2)
  23555. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23556. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  23557. } else {
  23558. v3 = -int32(1)
  23559. }
  23560. switch v3 {
  23561. case int32(m_ASCII_l2):
  23562. case int32(m_ASCII_L):
  23563. upper = int32(1)
  23564. default:
  23565. return int32(1)
  23566. }
  23567. if upper != 0 {
  23568. return 0
  23569. }
  23570. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  23571. return int32(1)
  23572. }
  23573. /* ptr points to character following "<?" */
  23574. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23575. bp := tls.Alloc(16)
  23576. defer tls.Free(16)
  23577. var target uintptr
  23578. var v1, v2, v3 int32
  23579. var _ /* tok at bp+0 */ int32
  23580. _, _, _, _ = target, v1, v2, v3
  23581. target = ptr
  23582. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23583. return -int32(1)
  23584. }
  23585. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23586. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23587. } else {
  23588. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23589. }
  23590. switch v1 {
  23591. case int32(_BT_NONASCII):
  23592. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23594. return m_XML_TOK_INVALID
  23595. } /* fall through */
  23596. fallthrough
  23597. case int32(_BT_NMSTRT):
  23598. fallthrough
  23599. case int32(_BT_HEX):
  23600. ptr += uintptr(2)
  23601. case int32(_BT_LEAD2):
  23602. if int32(end)-int32(ptr) < int32(2) {
  23603. return -int32(2)
  23604. }
  23605. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23607. return m_XML_TOK_INVALID
  23608. }
  23609. ptr += uintptr(2)
  23610. case int32(_BT_LEAD3):
  23611. if int32(end)-int32(ptr) < int32(3) {
  23612. return -int32(2)
  23613. }
  23614. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23615. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23616. return m_XML_TOK_INVALID
  23617. }
  23618. ptr += uintptr(3)
  23619. case int32(_BT_LEAD4):
  23620. if int32(end)-int32(ptr) < int32(4) {
  23621. return -int32(2)
  23622. }
  23623. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23624. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23625. return m_XML_TOK_INVALID
  23626. }
  23627. ptr += uintptr(4)
  23628. default:
  23629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23630. return m_XML_TOK_INVALID
  23631. }
  23632. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23633. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23634. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23635. } else {
  23636. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23637. }
  23638. switch v2 {
  23639. case int32(_BT_NONASCII):
  23640. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23642. return m_XML_TOK_INVALID
  23643. } /* fall through */
  23644. fallthrough
  23645. case int32(_BT_NMSTRT):
  23646. fallthrough
  23647. case int32(_BT_HEX):
  23648. fallthrough
  23649. case int32(_BT_DIGIT):
  23650. fallthrough
  23651. case int32(_BT_NAME):
  23652. fallthrough
  23653. case int32(_BT_MINUS):
  23654. ptr += uintptr(2)
  23655. case int32(_BT_LEAD2):
  23656. if int32(end)-int32(ptr) < int32(2) {
  23657. return -int32(2)
  23658. }
  23659. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23661. return m_XML_TOK_INVALID
  23662. }
  23663. ptr += uintptr(2)
  23664. case int32(_BT_LEAD3):
  23665. if int32(end)-int32(ptr) < int32(3) {
  23666. return -int32(2)
  23667. }
  23668. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23669. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23670. return m_XML_TOK_INVALID
  23671. }
  23672. ptr += uintptr(3)
  23673. case int32(_BT_LEAD4):
  23674. if int32(end)-int32(ptr) < int32(4) {
  23675. return -int32(2)
  23676. }
  23677. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23678. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23679. return m_XML_TOK_INVALID
  23680. }
  23681. ptr += uintptr(4)
  23682. case int32(_BT_S):
  23683. fallthrough
  23684. case int32(_BT_CR):
  23685. fallthrough
  23686. case int32(_BT_LF):
  23687. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23689. return m_XML_TOK_INVALID
  23690. }
  23691. ptr += uintptr(2)
  23692. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23693. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23694. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23695. } else {
  23696. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23697. }
  23698. switch v3 {
  23699. case int32(_BT_LEAD2):
  23700. if int32(end)-int32(ptr) < int32(2) {
  23701. return -int32(2)
  23702. }
  23703. if 0 != 0 {
  23704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23705. return m_XML_TOK_INVALID
  23706. }
  23707. ptr += uintptr(2)
  23708. case int32(_BT_LEAD3):
  23709. if int32(end)-int32(ptr) < int32(3) {
  23710. return -int32(2)
  23711. }
  23712. if 0 != 0 {
  23713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23714. return m_XML_TOK_INVALID
  23715. }
  23716. ptr += uintptr(3)
  23717. case int32(_BT_LEAD4):
  23718. if int32(end)-int32(ptr) < int32(4) {
  23719. return -int32(2)
  23720. }
  23721. if 0 != 0 {
  23722. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23723. return m_XML_TOK_INVALID
  23724. }
  23725. ptr += uintptr(4)
  23726. case int32(_BT_NONXML):
  23727. fallthrough
  23728. case int32(_BT_MALFORM):
  23729. fallthrough
  23730. case int32(_BT_TRAIL):
  23731. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23732. return m_XML_TOK_INVALID
  23733. case int32(_BT_QUEST):
  23734. ptr += uintptr(2)
  23735. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23736. return -int32(1)
  23737. }
  23738. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23740. return *(*int32)(unsafe.Pointer(bp))
  23741. }
  23742. default:
  23743. ptr += uintptr(2)
  23744. break
  23745. }
  23746. }
  23747. return -int32(1)
  23748. case int32(_BT_QUEST):
  23749. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  23750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23751. return m_XML_TOK_INVALID
  23752. }
  23753. ptr += uintptr(2)
  23754. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23755. return -int32(1)
  23756. }
  23757. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23759. return *(*int32)(unsafe.Pointer(bp))
  23760. }
  23761. /* fall through */
  23762. fallthrough
  23763. default:
  23764. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23765. return m_XML_TOK_INVALID
  23766. }
  23767. }
  23768. return -int32(1)
  23769. }
  23770. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23771. var i int32
  23772. _ = i
  23773. _ = enc
  23774. /* CDATA[ */
  23775. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(6)*libc.Int32FromInt32(2)) {
  23776. return -int32(1)
  23777. }
  23778. i = 0
  23779. for {
  23780. if !(i < int32(6)) {
  23781. break
  23782. }
  23783. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(_CDATA_LSQB2[i])) {
  23784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23785. return m_XML_TOK_INVALID
  23786. }
  23787. goto _1
  23788. _1:
  23789. ;
  23790. i++
  23791. ptr += uintptr(2)
  23792. }
  23793. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23794. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  23795. }
  23796. var _CDATA_LSQB2 = [6]int8{
  23797. 0: int8(m_ASCII_C),
  23798. 1: int8(m_ASCII_D),
  23799. 2: int8(m_ASCII_A),
  23800. 3: int8(m_ASCII_T),
  23801. 4: int8(m_ASCII_A),
  23802. 5: int8(m_ASCII_LSQB1),
  23803. }
  23804. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23805. var n Tsize_t
  23806. var v1, v2, v3 int32
  23807. _, _, _, _ = n, v1, v2, v3
  23808. if ptr >= end {
  23809. return -int32(4)
  23810. }
  23811. if int32(2) > int32(1) {
  23812. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  23813. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23814. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23815. if n == uint32(0) {
  23816. return -int32(1)
  23817. }
  23818. end = ptr + uintptr(n)
  23819. }
  23820. }
  23821. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23822. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23823. } else {
  23824. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23825. }
  23826. switch v1 {
  23827. case int32(_BT_RSQB):
  23828. ptr += uintptr(2)
  23829. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23830. return -int32(1)
  23831. }
  23832. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  23833. break
  23834. }
  23835. ptr += uintptr(2)
  23836. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23837. return -int32(1)
  23838. }
  23839. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  23840. ptr -= uintptr(2)
  23841. break
  23842. }
  23843. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23844. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  23845. case int32(_BT_CR):
  23846. ptr += uintptr(2)
  23847. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23848. return -int32(1)
  23849. }
  23850. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23851. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23852. } else {
  23853. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23854. }
  23855. if v2 == int32(_BT_LF) {
  23856. ptr += uintptr(2)
  23857. }
  23858. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23859. return int32(m_XML_TOK_DATA_NEWLINE)
  23860. case int32(_BT_LF):
  23861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23862. return int32(m_XML_TOK_DATA_NEWLINE)
  23863. case int32(_BT_LEAD2):
  23864. if int32(end)-int32(ptr) < int32(2) {
  23865. return -int32(2)
  23866. }
  23867. if 0 != 0 {
  23868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23869. return m_XML_TOK_INVALID
  23870. }
  23871. ptr += uintptr(2)
  23872. case int32(_BT_LEAD3):
  23873. if int32(end)-int32(ptr) < int32(3) {
  23874. return -int32(2)
  23875. }
  23876. if 0 != 0 {
  23877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23878. return m_XML_TOK_INVALID
  23879. }
  23880. ptr += uintptr(3)
  23881. case int32(_BT_LEAD4):
  23882. if int32(end)-int32(ptr) < int32(4) {
  23883. return -int32(2)
  23884. }
  23885. if 0 != 0 {
  23886. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23887. return m_XML_TOK_INVALID
  23888. }
  23889. ptr += uintptr(4)
  23890. case int32(_BT_NONXML):
  23891. fallthrough
  23892. case int32(_BT_MALFORM):
  23893. fallthrough
  23894. case int32(_BT_TRAIL):
  23895. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23896. return m_XML_TOK_INVALID
  23897. default:
  23898. ptr += uintptr(2)
  23899. break
  23900. }
  23901. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  23902. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23903. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23904. } else {
  23905. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23906. }
  23907. switch v3 {
  23908. case int32(_BT_LEAD2):
  23909. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  23910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23911. return int32(m_XML_TOK_DATA_CHARS)
  23912. }
  23913. ptr += uintptr(2)
  23914. case int32(_BT_LEAD3):
  23915. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  23916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23917. return int32(m_XML_TOK_DATA_CHARS)
  23918. }
  23919. ptr += uintptr(3)
  23920. case int32(_BT_LEAD4):
  23921. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  23922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23923. return int32(m_XML_TOK_DATA_CHARS)
  23924. }
  23925. ptr += uintptr(4)
  23926. case int32(_BT_NONXML):
  23927. fallthrough
  23928. case int32(_BT_MALFORM):
  23929. fallthrough
  23930. case int32(_BT_TRAIL):
  23931. fallthrough
  23932. case int32(_BT_CR):
  23933. fallthrough
  23934. case int32(_BT_LF):
  23935. fallthrough
  23936. case int32(_BT_RSQB):
  23937. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23938. return int32(m_XML_TOK_DATA_CHARS)
  23939. default:
  23940. ptr += uintptr(2)
  23941. break
  23942. }
  23943. }
  23944. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23945. return int32(m_XML_TOK_DATA_CHARS)
  23946. }
  23947. /* ptr points to character following "</" */
  23948. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23949. var v1, v2, v22 int32
  23950. _, _, _ = v1, v2, v22
  23951. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23952. return -int32(1)
  23953. }
  23954. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  23955. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  23956. } else {
  23957. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  23958. }
  23959. switch v1 {
  23960. case int32(_BT_NONASCII):
  23961. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  23962. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23963. return m_XML_TOK_INVALID
  23964. } /* fall through */
  23965. fallthrough
  23966. case int32(_BT_NMSTRT):
  23967. fallthrough
  23968. case int32(_BT_HEX):
  23969. ptr += uintptr(2)
  23970. case int32(_BT_LEAD2):
  23971. if int32(end)-int32(ptr) < int32(2) {
  23972. return -int32(2)
  23973. }
  23974. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23976. return m_XML_TOK_INVALID
  23977. }
  23978. ptr += uintptr(2)
  23979. case int32(_BT_LEAD3):
  23980. if int32(end)-int32(ptr) < int32(3) {
  23981. return -int32(2)
  23982. }
  23983. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23985. return m_XML_TOK_INVALID
  23986. }
  23987. ptr += uintptr(3)
  23988. case int32(_BT_LEAD4):
  23989. if int32(end)-int32(ptr) < int32(4) {
  23990. return -int32(2)
  23991. }
  23992. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  23993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23994. return m_XML_TOK_INVALID
  23995. }
  23996. ptr += uintptr(4)
  23997. default:
  23998. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23999. return m_XML_TOK_INVALID
  24000. }
  24001. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24002. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24003. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24004. } else {
  24005. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24006. }
  24007. switch v2 {
  24008. case int32(_BT_NONASCII):
  24009. goto _3
  24010. case int32(_BT_MINUS):
  24011. goto _4
  24012. case int32(_BT_NAME):
  24013. goto _5
  24014. case int32(_BT_DIGIT):
  24015. goto _6
  24016. case int32(_BT_HEX):
  24017. goto _7
  24018. case int32(_BT_NMSTRT):
  24019. goto _8
  24020. case int32(_BT_LEAD2):
  24021. goto _9
  24022. case int32(_BT_LEAD3):
  24023. goto _10
  24024. case int32(_BT_LEAD4):
  24025. goto _11
  24026. case int32(_BT_LF):
  24027. goto _12
  24028. case int32(_BT_CR):
  24029. goto _13
  24030. case int32(_BT_S):
  24031. goto _14
  24032. case int32(_BT_COLON):
  24033. goto _15
  24034. case int32(_BT_GT):
  24035. goto _16
  24036. default:
  24037. goto _17
  24038. }
  24039. goto _18
  24040. _3:
  24041. ;
  24042. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24043. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24044. return m_XML_TOK_INVALID
  24045. } /* fall through */
  24046. _8:
  24047. ;
  24048. _7:
  24049. ;
  24050. _6:
  24051. ;
  24052. _5:
  24053. ;
  24054. _4:
  24055. ;
  24056. ptr += uintptr(2)
  24057. goto _18
  24058. _9:
  24059. ;
  24060. if int32(end)-int32(ptr) < int32(2) {
  24061. return -int32(2)
  24062. }
  24063. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24064. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24065. return m_XML_TOK_INVALID
  24066. }
  24067. ptr += uintptr(2)
  24068. goto _18
  24069. _10:
  24070. ;
  24071. if int32(end)-int32(ptr) < int32(3) {
  24072. return -int32(2)
  24073. }
  24074. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24076. return m_XML_TOK_INVALID
  24077. }
  24078. ptr += uintptr(3)
  24079. goto _18
  24080. _11:
  24081. ;
  24082. if int32(end)-int32(ptr) < int32(4) {
  24083. return -int32(2)
  24084. }
  24085. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24086. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24087. return m_XML_TOK_INVALID
  24088. }
  24089. ptr += uintptr(4)
  24090. goto _18
  24091. _14:
  24092. ;
  24093. _13:
  24094. ;
  24095. _12:
  24096. ;
  24097. ptr += uintptr(2)
  24098. _21:
  24099. ;
  24100. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24101. goto _19
  24102. }
  24103. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24104. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24105. } else {
  24106. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24107. }
  24108. switch v22 {
  24109. case int32(_BT_S):
  24110. fallthrough
  24111. case int32(_BT_CR):
  24112. fallthrough
  24113. case int32(_BT_LF):
  24114. case int32(_BT_GT):
  24115. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24116. return int32(m_XML_TOK_END_TAG)
  24117. default:
  24118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24119. return m_XML_TOK_INVALID
  24120. }
  24121. goto _20
  24122. _20:
  24123. ;
  24124. ptr += uintptr(2)
  24125. goto _21
  24126. goto _19
  24127. _19:
  24128. ;
  24129. return -int32(1)
  24130. _15:
  24131. ;
  24132. /* no need to check qname syntax here,
  24133. since end-tag must match exactly */
  24134. ptr += uintptr(2)
  24135. goto _18
  24136. _16:
  24137. ;
  24138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24139. return int32(m_XML_TOK_END_TAG)
  24140. _17:
  24141. ;
  24142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24143. return m_XML_TOK_INVALID
  24144. _18:
  24145. }
  24146. return -int32(1)
  24147. }
  24148. /* ptr points to character following "&#X" */
  24149. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24150. var v1, v3 int32
  24151. _, _ = v1, v3
  24152. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24153. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24154. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24155. } else {
  24156. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24157. }
  24158. switch v1 {
  24159. case int32(_BT_DIGIT):
  24160. fallthrough
  24161. case int32(_BT_HEX):
  24162. default:
  24163. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24164. return m_XML_TOK_INVALID
  24165. }
  24166. ptr += uintptr(2)
  24167. for {
  24168. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24169. break
  24170. }
  24171. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24172. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24173. } else {
  24174. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24175. }
  24176. switch v3 {
  24177. case int32(_BT_DIGIT):
  24178. fallthrough
  24179. case int32(_BT_HEX):
  24180. case int32(_BT_SEMI):
  24181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24182. return int32(m_XML_TOK_CHAR_REF)
  24183. default:
  24184. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24185. return m_XML_TOK_INVALID
  24186. }
  24187. goto _2
  24188. _2:
  24189. ;
  24190. ptr += uintptr(2)
  24191. }
  24192. }
  24193. return -int32(1)
  24194. }
  24195. /* ptr points to character following "&#" */
  24196. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24197. var v1, v3 int32
  24198. _, _ = v1, v3
  24199. if int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24200. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  24201. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24202. }
  24203. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24204. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24205. } else {
  24206. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24207. }
  24208. switch v1 {
  24209. case int32(_BT_DIGIT):
  24210. default:
  24211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24212. return m_XML_TOK_INVALID
  24213. }
  24214. ptr += uintptr(2)
  24215. for {
  24216. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24217. break
  24218. }
  24219. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24220. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24221. } else {
  24222. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24223. }
  24224. switch v3 {
  24225. case int32(_BT_DIGIT):
  24226. case int32(_BT_SEMI):
  24227. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24228. return int32(m_XML_TOK_CHAR_REF)
  24229. default:
  24230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24231. return m_XML_TOK_INVALID
  24232. }
  24233. goto _2
  24234. _2:
  24235. ;
  24236. ptr += uintptr(2)
  24237. }
  24238. }
  24239. return -int32(1)
  24240. }
  24241. /* ptr points to character following "&" */
  24242. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24243. var v1, v2 int32
  24244. _, _ = v1, v2
  24245. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24246. return -int32(1)
  24247. }
  24248. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24249. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24250. } else {
  24251. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24252. }
  24253. switch v1 {
  24254. case int32(_BT_NONASCII):
  24255. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24257. return m_XML_TOK_INVALID
  24258. } /* fall through */
  24259. fallthrough
  24260. case int32(_BT_NMSTRT):
  24261. fallthrough
  24262. case int32(_BT_HEX):
  24263. ptr += uintptr(2)
  24264. case int32(_BT_LEAD2):
  24265. if int32(end)-int32(ptr) < int32(2) {
  24266. return -int32(2)
  24267. }
  24268. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24269. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24270. return m_XML_TOK_INVALID
  24271. }
  24272. ptr += uintptr(2)
  24273. case int32(_BT_LEAD3):
  24274. if int32(end)-int32(ptr) < int32(3) {
  24275. return -int32(2)
  24276. }
  24277. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24278. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24279. return m_XML_TOK_INVALID
  24280. }
  24281. ptr += uintptr(3)
  24282. case int32(_BT_LEAD4):
  24283. if int32(end)-int32(ptr) < int32(4) {
  24284. return -int32(2)
  24285. }
  24286. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24288. return m_XML_TOK_INVALID
  24289. }
  24290. ptr += uintptr(4)
  24291. case int32(_BT_NUM):
  24292. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24293. default:
  24294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24295. return m_XML_TOK_INVALID
  24296. }
  24297. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24298. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24299. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24300. } else {
  24301. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24302. }
  24303. switch v2 {
  24304. case int32(_BT_NONASCII):
  24305. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24306. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24307. return m_XML_TOK_INVALID
  24308. } /* fall through */
  24309. fallthrough
  24310. case int32(_BT_NMSTRT):
  24311. fallthrough
  24312. case int32(_BT_HEX):
  24313. fallthrough
  24314. case int32(_BT_DIGIT):
  24315. fallthrough
  24316. case int32(_BT_NAME):
  24317. fallthrough
  24318. case int32(_BT_MINUS):
  24319. ptr += uintptr(2)
  24320. case int32(_BT_LEAD2):
  24321. if int32(end)-int32(ptr) < int32(2) {
  24322. return -int32(2)
  24323. }
  24324. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24325. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24326. return m_XML_TOK_INVALID
  24327. }
  24328. ptr += uintptr(2)
  24329. case int32(_BT_LEAD3):
  24330. if int32(end)-int32(ptr) < int32(3) {
  24331. return -int32(2)
  24332. }
  24333. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24335. return m_XML_TOK_INVALID
  24336. }
  24337. ptr += uintptr(3)
  24338. case int32(_BT_LEAD4):
  24339. if int32(end)-int32(ptr) < int32(4) {
  24340. return -int32(2)
  24341. }
  24342. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24343. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24344. return m_XML_TOK_INVALID
  24345. }
  24346. ptr += uintptr(4)
  24347. case int32(_BT_SEMI):
  24348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  24349. return int32(m_XML_TOK_ENTITY_REF)
  24350. default:
  24351. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24352. return m_XML_TOK_INVALID
  24353. }
  24354. }
  24355. return -int32(1)
  24356. }
  24357. /* ptr points to character following first character of attribute name */
  24358. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24359. bp := tls.Alloc(16)
  24360. defer tls.Free(16)
  24361. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24362. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  24363. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  24364. hadColon = 0
  24365. for int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24366. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24367. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24368. } else {
  24369. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24370. }
  24371. switch v1 {
  24372. case int32(_BT_NONASCII):
  24373. goto _2
  24374. case int32(_BT_MINUS):
  24375. goto _3
  24376. case int32(_BT_NAME):
  24377. goto _4
  24378. case int32(_BT_DIGIT):
  24379. goto _5
  24380. case int32(_BT_HEX):
  24381. goto _6
  24382. case int32(_BT_NMSTRT):
  24383. goto _7
  24384. case int32(_BT_LEAD2):
  24385. goto _8
  24386. case int32(_BT_LEAD3):
  24387. goto _9
  24388. case int32(_BT_LEAD4):
  24389. goto _10
  24390. case int32(_BT_COLON):
  24391. goto _11
  24392. case int32(_BT_LF):
  24393. goto _12
  24394. case int32(_BT_CR):
  24395. goto _13
  24396. case int32(_BT_S):
  24397. goto _14
  24398. case int32(_BT_EQUALS):
  24399. goto _15
  24400. default:
  24401. goto _16
  24402. }
  24403. goto _17
  24404. _2:
  24405. ;
  24406. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24407. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24408. return m_XML_TOK_INVALID
  24409. } /* fall through */
  24410. _7:
  24411. ;
  24412. _6:
  24413. ;
  24414. _5:
  24415. ;
  24416. _4:
  24417. ;
  24418. _3:
  24419. ;
  24420. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24421. goto _17
  24422. _8:
  24423. ;
  24424. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24425. return -int32(2)
  24426. }
  24427. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24429. return m_XML_TOK_INVALID
  24430. }
  24431. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24432. goto _17
  24433. _9:
  24434. ;
  24435. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24436. return -int32(2)
  24437. }
  24438. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24439. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24440. return m_XML_TOK_INVALID
  24441. }
  24442. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24443. goto _17
  24444. _10:
  24445. ;
  24446. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24447. return -int32(2)
  24448. }
  24449. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24450. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24451. return m_XML_TOK_INVALID
  24452. }
  24453. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24454. goto _17
  24455. _11:
  24456. ;
  24457. if hadColon != 0 {
  24458. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24459. return m_XML_TOK_INVALID
  24460. }
  24461. hadColon = int32(1)
  24462. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24463. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24464. return -int32(1)
  24465. }
  24466. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24467. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24468. } else {
  24469. v18 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24470. }
  24471. switch v18 {
  24472. case int32(_BT_NONASCII):
  24473. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24474. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24475. return m_XML_TOK_INVALID
  24476. } /* fall through */
  24477. fallthrough
  24478. case int32(_BT_NMSTRT):
  24479. fallthrough
  24480. case int32(_BT_HEX):
  24481. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24482. case int32(_BT_LEAD2):
  24483. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24484. return -int32(2)
  24485. }
  24486. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24487. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24488. return m_XML_TOK_INVALID
  24489. }
  24490. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24491. case int32(_BT_LEAD3):
  24492. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24493. return -int32(2)
  24494. }
  24495. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24496. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24497. return m_XML_TOK_INVALID
  24498. }
  24499. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24500. case int32(_BT_LEAD4):
  24501. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24502. return -int32(2)
  24503. }
  24504. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24506. return m_XML_TOK_INVALID
  24507. }
  24508. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24509. default:
  24510. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24511. return m_XML_TOK_INVALID
  24512. }
  24513. goto _17
  24514. _14:
  24515. ;
  24516. _13:
  24517. ;
  24518. _12:
  24519. ;
  24520. _21:
  24521. ;
  24522. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24523. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24524. return -int32(1)
  24525. }
  24526. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24527. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24528. } else {
  24529. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24530. }
  24531. t = v22
  24532. if t == int32(_BT_EQUALS) {
  24533. goto _19
  24534. }
  24535. switch t {
  24536. case int32(_BT_S):
  24537. fallthrough
  24538. case int32(_BT_LF):
  24539. fallthrough
  24540. case int32(_BT_CR):
  24541. default:
  24542. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24543. return m_XML_TOK_INVALID
  24544. }
  24545. goto _20
  24546. _20:
  24547. ;
  24548. goto _21
  24549. goto _19
  24550. _19:
  24551. ;
  24552. /* fall through */
  24553. _15:
  24554. ;
  24555. hadColon = 0
  24556. for {
  24557. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24558. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24559. return -int32(1)
  24560. }
  24561. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24562. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24563. } else {
  24564. v24 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24565. }
  24566. open = v24
  24567. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  24568. break
  24569. }
  24570. switch open {
  24571. case int32(_BT_S):
  24572. fallthrough
  24573. case int32(_BT_LF):
  24574. fallthrough
  24575. case int32(_BT_CR):
  24576. default:
  24577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24578. return m_XML_TOK_INVALID
  24579. }
  24580. goto _23
  24581. _23:
  24582. }
  24583. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24584. /* in attribute value */
  24585. for {
  24586. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24587. return -int32(1)
  24588. }
  24589. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24590. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24591. } else {
  24592. v26 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24593. }
  24594. t1 = v26
  24595. if t1 == open {
  24596. break
  24597. }
  24598. switch t1 {
  24599. case int32(_BT_LEAD2):
  24600. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24601. return -int32(2)
  24602. }
  24603. if 0 != 0 {
  24604. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24605. return m_XML_TOK_INVALID
  24606. }
  24607. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24608. case int32(_BT_LEAD3):
  24609. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24610. return -int32(2)
  24611. }
  24612. if 0 != 0 {
  24613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24614. return m_XML_TOK_INVALID
  24615. }
  24616. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24617. case int32(_BT_LEAD4):
  24618. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24619. return -int32(2)
  24620. }
  24621. if 0 != 0 {
  24622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24623. return m_XML_TOK_INVALID
  24624. }
  24625. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24626. case int32(_BT_NONXML):
  24627. fallthrough
  24628. case int32(_BT_MALFORM):
  24629. fallthrough
  24630. case int32(_BT_TRAIL):
  24631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24632. return m_XML_TOK_INVALID
  24633. case int32(_BT_AMP):
  24634. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  24635. if tok <= 0 {
  24636. if tok == m_XML_TOK_INVALID {
  24637. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24638. }
  24639. return tok
  24640. }
  24641. case int32(_BT_LT):
  24642. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24643. return m_XML_TOK_INVALID
  24644. default:
  24645. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24646. break
  24647. }
  24648. goto _25
  24649. _25:
  24650. }
  24651. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24652. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24653. return -int32(1)
  24654. }
  24655. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24656. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24657. } else {
  24658. v27 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24659. }
  24660. switch v27 {
  24661. case int32(_BT_S):
  24662. fallthrough
  24663. case int32(_BT_CR):
  24664. fallthrough
  24665. case int32(_BT_LF):
  24666. case int32(_BT_SOL):
  24667. goto sol
  24668. case int32(_BT_GT):
  24669. goto gt
  24670. default:
  24671. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24672. return m_XML_TOK_INVALID
  24673. }
  24674. /* ptr points to closing quote */
  24675. _30:
  24676. ;
  24677. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24678. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24679. return -int32(1)
  24680. }
  24681. if int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  24682. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))))))
  24683. } else {
  24684. v31 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  24685. }
  24686. switch v31 {
  24687. case int32(_BT_NONASCII):
  24688. goto _32
  24689. case int32(_BT_HEX):
  24690. goto _33
  24691. case int32(_BT_NMSTRT):
  24692. goto _34
  24693. case int32(_BT_LEAD2):
  24694. goto _35
  24695. case int32(_BT_LEAD3):
  24696. goto _36
  24697. case int32(_BT_LEAD4):
  24698. goto _37
  24699. case int32(_BT_LF):
  24700. goto _38
  24701. case int32(_BT_CR):
  24702. goto _39
  24703. case int32(_BT_S):
  24704. goto _40
  24705. case int32(_BT_GT):
  24706. goto _41
  24707. case int32(_BT_SOL):
  24708. goto _42
  24709. default:
  24710. goto _43
  24711. }
  24712. goto _44
  24713. _32:
  24714. ;
  24715. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24716. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24717. return m_XML_TOK_INVALID
  24718. } /* fall through */
  24719. _34:
  24720. ;
  24721. _33:
  24722. ;
  24723. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24724. goto _44
  24725. _35:
  24726. ;
  24727. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(2) {
  24728. return -int32(2)
  24729. }
  24730. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24731. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24732. return m_XML_TOK_INVALID
  24733. }
  24734. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24735. goto _44
  24736. _36:
  24737. ;
  24738. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(3) {
  24739. return -int32(2)
  24740. }
  24741. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24742. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24743. return m_XML_TOK_INVALID
  24744. }
  24745. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  24746. goto _44
  24747. _37:
  24748. ;
  24749. if int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) < int32(4) {
  24750. return -int32(2)
  24751. }
  24752. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24754. return m_XML_TOK_INVALID
  24755. }
  24756. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  24757. goto _44
  24758. _40:
  24759. ;
  24760. _39:
  24761. ;
  24762. _38:
  24763. ;
  24764. goto _29
  24765. _41:
  24766. ;
  24767. goto gt
  24768. gt:
  24769. ;
  24770. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24771. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  24772. _42:
  24773. ;
  24774. goto sol
  24775. sol:
  24776. ;
  24777. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  24778. if !(int32(end)-int32(*(*uintptr)(unsafe.Pointer(bp))) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24779. return -int32(1)
  24780. }
  24781. if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  24782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24783. return m_XML_TOK_INVALID
  24784. }
  24785. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  24786. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  24787. _43:
  24788. ;
  24789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24790. return m_XML_TOK_INVALID
  24791. _44:
  24792. ;
  24793. goto _28
  24794. goto _29
  24795. _29:
  24796. ;
  24797. goto _30
  24798. goto _28
  24799. _28:
  24800. ;
  24801. goto _17
  24802. _16:
  24803. ;
  24804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  24805. return m_XML_TOK_INVALID
  24806. _17:
  24807. }
  24808. return -int32(1)
  24809. }
  24810. /* ptr points to character following "<" */
  24811. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  24812. var hadColon, v1, v2, v21, v22, v3 int32
  24813. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  24814. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24815. return -int32(1)
  24816. }
  24817. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24818. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24819. } else {
  24820. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24821. }
  24822. switch v1 {
  24823. case int32(_BT_NONASCII):
  24824. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24826. return m_XML_TOK_INVALID
  24827. } /* fall through */
  24828. fallthrough
  24829. case int32(_BT_NMSTRT):
  24830. fallthrough
  24831. case int32(_BT_HEX):
  24832. ptr += uintptr(2)
  24833. case int32(_BT_LEAD2):
  24834. if int32(end)-int32(ptr) < int32(2) {
  24835. return -int32(2)
  24836. }
  24837. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24839. return m_XML_TOK_INVALID
  24840. }
  24841. ptr += uintptr(2)
  24842. case int32(_BT_LEAD3):
  24843. if int32(end)-int32(ptr) < int32(3) {
  24844. return -int32(2)
  24845. }
  24846. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24848. return m_XML_TOK_INVALID
  24849. }
  24850. ptr += uintptr(3)
  24851. case int32(_BT_LEAD4):
  24852. if int32(end)-int32(ptr) < int32(4) {
  24853. return -int32(2)
  24854. }
  24855. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24856. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24857. return m_XML_TOK_INVALID
  24858. }
  24859. ptr += uintptr(4)
  24860. case int32(_BT_EXCL):
  24861. ptr += uintptr(2)
  24862. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24863. return -int32(1)
  24864. }
  24865. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24866. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24867. } else {
  24868. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24869. }
  24870. switch v2 {
  24871. case int32(_BT_MINUS):
  24872. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24873. case int32(_BT_LSQB):
  24874. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24875. }
  24876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24877. return m_XML_TOK_INVALID
  24878. case int32(_BT_QUEST):
  24879. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24880. case int32(_BT_SOL):
  24881. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  24882. default:
  24883. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24884. return m_XML_TOK_INVALID
  24885. }
  24886. hadColon = 0
  24887. /* we have a start-tag */
  24888. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  24889. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24890. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24891. } else {
  24892. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24893. }
  24894. switch v3 {
  24895. case int32(_BT_NONASCII):
  24896. goto _4
  24897. case int32(_BT_MINUS):
  24898. goto _5
  24899. case int32(_BT_NAME):
  24900. goto _6
  24901. case int32(_BT_DIGIT):
  24902. goto _7
  24903. case int32(_BT_HEX):
  24904. goto _8
  24905. case int32(_BT_NMSTRT):
  24906. goto _9
  24907. case int32(_BT_LEAD2):
  24908. goto _10
  24909. case int32(_BT_LEAD3):
  24910. goto _11
  24911. case int32(_BT_LEAD4):
  24912. goto _12
  24913. case int32(_BT_COLON):
  24914. goto _13
  24915. case int32(_BT_LF):
  24916. goto _14
  24917. case int32(_BT_CR):
  24918. goto _15
  24919. case int32(_BT_S):
  24920. goto _16
  24921. case int32(_BT_GT):
  24922. goto _17
  24923. case int32(_BT_SOL):
  24924. goto _18
  24925. default:
  24926. goto _19
  24927. }
  24928. goto _20
  24929. _4:
  24930. ;
  24931. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24932. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24933. return m_XML_TOK_INVALID
  24934. } /* fall through */
  24935. _9:
  24936. ;
  24937. _8:
  24938. ;
  24939. _7:
  24940. ;
  24941. _6:
  24942. ;
  24943. _5:
  24944. ;
  24945. ptr += uintptr(2)
  24946. goto _20
  24947. _10:
  24948. ;
  24949. if int32(end)-int32(ptr) < int32(2) {
  24950. return -int32(2)
  24951. }
  24952. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24954. return m_XML_TOK_INVALID
  24955. }
  24956. ptr += uintptr(2)
  24957. goto _20
  24958. _11:
  24959. ;
  24960. if int32(end)-int32(ptr) < int32(3) {
  24961. return -int32(2)
  24962. }
  24963. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24965. return m_XML_TOK_INVALID
  24966. }
  24967. ptr += uintptr(3)
  24968. goto _20
  24969. _12:
  24970. ;
  24971. if int32(end)-int32(ptr) < int32(4) {
  24972. return -int32(2)
  24973. }
  24974. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  24975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24976. return m_XML_TOK_INVALID
  24977. }
  24978. ptr += uintptr(4)
  24979. goto _20
  24980. _13:
  24981. ;
  24982. if hadColon != 0 {
  24983. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24984. return m_XML_TOK_INVALID
  24985. }
  24986. hadColon = int32(1)
  24987. ptr += uintptr(2)
  24988. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24989. return -int32(1)
  24990. }
  24991. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  24992. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  24993. } else {
  24994. v21 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  24995. }
  24996. switch v21 {
  24997. case int32(_BT_NONASCII):
  24998. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  24999. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25000. return m_XML_TOK_INVALID
  25001. } /* fall through */
  25002. fallthrough
  25003. case int32(_BT_NMSTRT):
  25004. fallthrough
  25005. case int32(_BT_HEX):
  25006. ptr += uintptr(2)
  25007. case int32(_BT_LEAD2):
  25008. if int32(end)-int32(ptr) < int32(2) {
  25009. return -int32(2)
  25010. }
  25011. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25012. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25013. return m_XML_TOK_INVALID
  25014. }
  25015. ptr += uintptr(2)
  25016. case int32(_BT_LEAD3):
  25017. if int32(end)-int32(ptr) < int32(3) {
  25018. return -int32(2)
  25019. }
  25020. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25021. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25022. return m_XML_TOK_INVALID
  25023. }
  25024. ptr += uintptr(3)
  25025. case int32(_BT_LEAD4):
  25026. if int32(end)-int32(ptr) < int32(4) {
  25027. return -int32(2)
  25028. }
  25029. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25030. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25031. return m_XML_TOK_INVALID
  25032. }
  25033. ptr += uintptr(4)
  25034. default:
  25035. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25036. return m_XML_TOK_INVALID
  25037. }
  25038. goto _20
  25039. _16:
  25040. ;
  25041. _15:
  25042. ;
  25043. _14:
  25044. ;
  25045. ptr += uintptr(2)
  25046. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25047. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25048. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25049. } else {
  25050. v22 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25051. }
  25052. switch v22 {
  25053. case int32(_BT_NONASCII):
  25054. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25055. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25056. return m_XML_TOK_INVALID
  25057. } /* fall through */
  25058. fallthrough
  25059. case int32(_BT_NMSTRT):
  25060. fallthrough
  25061. case int32(_BT_HEX):
  25062. ptr += uintptr(2)
  25063. case int32(_BT_LEAD2):
  25064. if int32(end)-int32(ptr) < int32(2) {
  25065. return -int32(2)
  25066. }
  25067. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25069. return m_XML_TOK_INVALID
  25070. }
  25071. ptr += uintptr(2)
  25072. case int32(_BT_LEAD3):
  25073. if int32(end)-int32(ptr) < int32(3) {
  25074. return -int32(2)
  25075. }
  25076. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25077. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25078. return m_XML_TOK_INVALID
  25079. }
  25080. ptr += uintptr(3)
  25081. case int32(_BT_LEAD4):
  25082. if int32(end)-int32(ptr) < int32(4) {
  25083. return -int32(2)
  25084. }
  25085. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25086. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25087. return m_XML_TOK_INVALID
  25088. }
  25089. ptr += uintptr(4)
  25090. case int32(_BT_GT):
  25091. goto gt
  25092. case int32(_BT_SOL):
  25093. goto sol
  25094. case int32(_BT_S):
  25095. fallthrough
  25096. case int32(_BT_CR):
  25097. fallthrough
  25098. case int32(_BT_LF):
  25099. ptr += uintptr(2)
  25100. continue
  25101. default:
  25102. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25103. return m_XML_TOK_INVALID
  25104. }
  25105. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  25106. }
  25107. return -int32(1)
  25108. _17:
  25109. ;
  25110. goto gt
  25111. gt:
  25112. ;
  25113. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25114. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  25115. _18:
  25116. ;
  25117. goto sol
  25118. sol:
  25119. ;
  25120. ptr += uintptr(2)
  25121. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25122. return -int32(1)
  25123. }
  25124. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25126. return m_XML_TOK_INVALID
  25127. }
  25128. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25129. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  25130. _19:
  25131. ;
  25132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25133. return m_XML_TOK_INVALID
  25134. _20:
  25135. }
  25136. return -int32(1)
  25137. }
  25138. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25139. var n Tsize_t
  25140. var v1, v2, v3 int32
  25141. _, _, _, _ = n, v1, v2, v3
  25142. if ptr >= end {
  25143. return -int32(4)
  25144. }
  25145. if int32(2) > int32(1) {
  25146. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  25147. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25148. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25149. if n == uint32(0) {
  25150. return -int32(1)
  25151. }
  25152. end = ptr + uintptr(n)
  25153. }
  25154. }
  25155. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25156. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25157. } else {
  25158. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25159. }
  25160. switch v1 {
  25161. case int32(_BT_LT):
  25162. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25163. case int32(_BT_AMP):
  25164. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25165. case int32(_BT_CR):
  25166. ptr += uintptr(2)
  25167. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25168. return -int32(3)
  25169. }
  25170. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25171. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25172. } else {
  25173. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25174. }
  25175. if v2 == int32(_BT_LF) {
  25176. ptr += uintptr(2)
  25177. }
  25178. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25179. return int32(m_XML_TOK_DATA_NEWLINE)
  25180. case int32(_BT_LF):
  25181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25182. return int32(m_XML_TOK_DATA_NEWLINE)
  25183. case int32(_BT_RSQB):
  25184. ptr += uintptr(2)
  25185. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25186. return -int32(5)
  25187. }
  25188. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  25189. break
  25190. }
  25191. ptr += uintptr(2)
  25192. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25193. return -int32(5)
  25194. }
  25195. if !(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  25196. ptr -= uintptr(2)
  25197. break
  25198. }
  25199. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25200. return m_XML_TOK_INVALID
  25201. case int32(_BT_LEAD2):
  25202. if int32(end)-int32(ptr) < int32(2) {
  25203. return -int32(2)
  25204. }
  25205. if 0 != 0 {
  25206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25207. return m_XML_TOK_INVALID
  25208. }
  25209. ptr += uintptr(2)
  25210. case int32(_BT_LEAD3):
  25211. if int32(end)-int32(ptr) < int32(3) {
  25212. return -int32(2)
  25213. }
  25214. if 0 != 0 {
  25215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25216. return m_XML_TOK_INVALID
  25217. }
  25218. ptr += uintptr(3)
  25219. case int32(_BT_LEAD4):
  25220. if int32(end)-int32(ptr) < int32(4) {
  25221. return -int32(2)
  25222. }
  25223. if 0 != 0 {
  25224. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25225. return m_XML_TOK_INVALID
  25226. }
  25227. ptr += uintptr(4)
  25228. case int32(_BT_NONXML):
  25229. fallthrough
  25230. case int32(_BT_MALFORM):
  25231. fallthrough
  25232. case int32(_BT_TRAIL):
  25233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25234. return m_XML_TOK_INVALID
  25235. default:
  25236. ptr += uintptr(2)
  25237. break
  25238. }
  25239. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25240. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25241. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25242. } else {
  25243. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25244. }
  25245. switch v3 {
  25246. case int32(_BT_LEAD2):
  25247. if int32(end)-int32(ptr) < int32(2) || libc.Bool(0 != 0) {
  25248. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25249. return int32(m_XML_TOK_DATA_CHARS)
  25250. }
  25251. ptr += uintptr(2)
  25252. case int32(_BT_LEAD3):
  25253. if int32(end)-int32(ptr) < int32(3) || libc.Bool(0 != 0) {
  25254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25255. return int32(m_XML_TOK_DATA_CHARS)
  25256. }
  25257. ptr += uintptr(3)
  25258. case int32(_BT_LEAD4):
  25259. if int32(end)-int32(ptr) < int32(4) || libc.Bool(0 != 0) {
  25260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25261. return int32(m_XML_TOK_DATA_CHARS)
  25262. }
  25263. ptr += uintptr(4)
  25264. case int32(_BT_RSQB):
  25265. if int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2) {
  25266. if !(int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  25267. ptr += uintptr(2)
  25268. break
  25269. }
  25270. if int32(end)-int32(ptr) >= libc.Int32FromInt32(3)*libc.Int32FromInt32(2) {
  25271. if !(int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  25272. ptr += uintptr(2)
  25273. break
  25274. }
  25275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25276. return m_XML_TOK_INVALID
  25277. }
  25278. }
  25279. /* fall through */
  25280. fallthrough
  25281. case int32(_BT_AMP):
  25282. fallthrough
  25283. case int32(_BT_LT):
  25284. fallthrough
  25285. case int32(_BT_NONXML):
  25286. fallthrough
  25287. case int32(_BT_MALFORM):
  25288. fallthrough
  25289. case int32(_BT_TRAIL):
  25290. fallthrough
  25291. case int32(_BT_CR):
  25292. fallthrough
  25293. case int32(_BT_LF):
  25294. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25295. return int32(m_XML_TOK_DATA_CHARS)
  25296. default:
  25297. ptr += uintptr(2)
  25298. break
  25299. }
  25300. }
  25301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25302. return int32(m_XML_TOK_DATA_CHARS)
  25303. }
  25304. /* ptr points to character following "%" */
  25305. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25306. var v1, v2 int32
  25307. _, _ = v1, v2
  25308. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25309. return -int32(1)
  25310. }
  25311. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25312. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25313. } else {
  25314. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25315. }
  25316. switch v1 {
  25317. case int32(_BT_NONASCII):
  25318. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25319. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25320. return m_XML_TOK_INVALID
  25321. } /* fall through */
  25322. fallthrough
  25323. case int32(_BT_NMSTRT):
  25324. fallthrough
  25325. case int32(_BT_HEX):
  25326. ptr += uintptr(2)
  25327. case int32(_BT_LEAD2):
  25328. if int32(end)-int32(ptr) < int32(2) {
  25329. return -int32(2)
  25330. }
  25331. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25332. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25333. return m_XML_TOK_INVALID
  25334. }
  25335. ptr += uintptr(2)
  25336. case int32(_BT_LEAD3):
  25337. if int32(end)-int32(ptr) < int32(3) {
  25338. return -int32(2)
  25339. }
  25340. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25341. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25342. return m_XML_TOK_INVALID
  25343. }
  25344. ptr += uintptr(3)
  25345. case int32(_BT_LEAD4):
  25346. if int32(end)-int32(ptr) < int32(4) {
  25347. return -int32(2)
  25348. }
  25349. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25350. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25351. return m_XML_TOK_INVALID
  25352. }
  25353. ptr += uintptr(4)
  25354. case int32(_BT_S):
  25355. fallthrough
  25356. case int32(_BT_LF):
  25357. fallthrough
  25358. case int32(_BT_CR):
  25359. fallthrough
  25360. case int32(_BT_PERCNT):
  25361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25362. return int32(m_XML_TOK_PERCENT)
  25363. default:
  25364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25365. return m_XML_TOK_INVALID
  25366. }
  25367. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25368. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25369. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25370. } else {
  25371. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25372. }
  25373. switch v2 {
  25374. case int32(_BT_NONASCII):
  25375. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25376. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25377. return m_XML_TOK_INVALID
  25378. } /* fall through */
  25379. fallthrough
  25380. case int32(_BT_NMSTRT):
  25381. fallthrough
  25382. case int32(_BT_HEX):
  25383. fallthrough
  25384. case int32(_BT_DIGIT):
  25385. fallthrough
  25386. case int32(_BT_NAME):
  25387. fallthrough
  25388. case int32(_BT_MINUS):
  25389. ptr += uintptr(2)
  25390. case int32(_BT_LEAD2):
  25391. if int32(end)-int32(ptr) < int32(2) {
  25392. return -int32(2)
  25393. }
  25394. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25396. return m_XML_TOK_INVALID
  25397. }
  25398. ptr += uintptr(2)
  25399. case int32(_BT_LEAD3):
  25400. if int32(end)-int32(ptr) < int32(3) {
  25401. return -int32(2)
  25402. }
  25403. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25405. return m_XML_TOK_INVALID
  25406. }
  25407. ptr += uintptr(3)
  25408. case int32(_BT_LEAD4):
  25409. if int32(end)-int32(ptr) < int32(4) {
  25410. return -int32(2)
  25411. }
  25412. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25414. return m_XML_TOK_INVALID
  25415. }
  25416. ptr += uintptr(4)
  25417. case int32(_BT_SEMI):
  25418. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25419. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  25420. default:
  25421. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25422. return m_XML_TOK_INVALID
  25423. }
  25424. }
  25425. return -int32(1)
  25426. }
  25427. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25428. var v1, v2 int32
  25429. _, _ = v1, v2
  25430. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25431. return -int32(1)
  25432. }
  25433. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25434. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25435. } else {
  25436. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25437. }
  25438. switch v1 {
  25439. case int32(_BT_NONASCII):
  25440. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25441. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25442. return m_XML_TOK_INVALID
  25443. } /* fall through */
  25444. fallthrough
  25445. case int32(_BT_NMSTRT):
  25446. fallthrough
  25447. case int32(_BT_HEX):
  25448. ptr += uintptr(2)
  25449. case int32(_BT_LEAD2):
  25450. if int32(end)-int32(ptr) < int32(2) {
  25451. return -int32(2)
  25452. }
  25453. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25455. return m_XML_TOK_INVALID
  25456. }
  25457. ptr += uintptr(2)
  25458. case int32(_BT_LEAD3):
  25459. if int32(end)-int32(ptr) < int32(3) {
  25460. return -int32(2)
  25461. }
  25462. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25463. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25464. return m_XML_TOK_INVALID
  25465. }
  25466. ptr += uintptr(3)
  25467. case int32(_BT_LEAD4):
  25468. if int32(end)-int32(ptr) < int32(4) {
  25469. return -int32(2)
  25470. }
  25471. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25472. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25473. return m_XML_TOK_INVALID
  25474. }
  25475. ptr += uintptr(4)
  25476. default:
  25477. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25478. return m_XML_TOK_INVALID
  25479. }
  25480. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25481. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25482. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25483. } else {
  25484. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25485. }
  25486. switch v2 {
  25487. case int32(_BT_NONASCII):
  25488. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25490. return m_XML_TOK_INVALID
  25491. } /* fall through */
  25492. fallthrough
  25493. case int32(_BT_NMSTRT):
  25494. fallthrough
  25495. case int32(_BT_HEX):
  25496. fallthrough
  25497. case int32(_BT_DIGIT):
  25498. fallthrough
  25499. case int32(_BT_NAME):
  25500. fallthrough
  25501. case int32(_BT_MINUS):
  25502. ptr += uintptr(2)
  25503. case int32(_BT_LEAD2):
  25504. if int32(end)-int32(ptr) < int32(2) {
  25505. return -int32(2)
  25506. }
  25507. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25508. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25509. return m_XML_TOK_INVALID
  25510. }
  25511. ptr += uintptr(2)
  25512. case int32(_BT_LEAD3):
  25513. if int32(end)-int32(ptr) < int32(3) {
  25514. return -int32(2)
  25515. }
  25516. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25517. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25518. return m_XML_TOK_INVALID
  25519. }
  25520. ptr += uintptr(3)
  25521. case int32(_BT_LEAD4):
  25522. if int32(end)-int32(ptr) < int32(4) {
  25523. return -int32(2)
  25524. }
  25525. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  25526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25527. return m_XML_TOK_INVALID
  25528. }
  25529. ptr += uintptr(4)
  25530. case int32(_BT_CR):
  25531. fallthrough
  25532. case int32(_BT_LF):
  25533. fallthrough
  25534. case int32(_BT_S):
  25535. fallthrough
  25536. case int32(_BT_RPAR):
  25537. fallthrough
  25538. case int32(_BT_GT):
  25539. fallthrough
  25540. case int32(_BT_PERCNT):
  25541. fallthrough
  25542. case int32(_BT_VERBAR):
  25543. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25544. return int32(m_XML_TOK_POUND_NAME)
  25545. default:
  25546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25547. return m_XML_TOK_INVALID
  25548. }
  25549. }
  25550. return -int32(m_XML_TOK_POUND_NAME)
  25551. }
  25552. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25553. var t, v1, v2 int32
  25554. _, _, _ = t, v1, v2
  25555. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25556. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25557. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25558. } else {
  25559. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25560. }
  25561. t = v1
  25562. switch t {
  25563. case int32(_BT_LEAD2):
  25564. if int32(end)-int32(ptr) < int32(2) {
  25565. return -int32(2)
  25566. }
  25567. if 0 != 0 {
  25568. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25569. return m_XML_TOK_INVALID
  25570. }
  25571. ptr += uintptr(2)
  25572. case int32(_BT_LEAD3):
  25573. if int32(end)-int32(ptr) < int32(3) {
  25574. return -int32(2)
  25575. }
  25576. if 0 != 0 {
  25577. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25578. return m_XML_TOK_INVALID
  25579. }
  25580. ptr += uintptr(3)
  25581. case int32(_BT_LEAD4):
  25582. if int32(end)-int32(ptr) < int32(4) {
  25583. return -int32(2)
  25584. }
  25585. if 0 != 0 {
  25586. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25587. return m_XML_TOK_INVALID
  25588. }
  25589. ptr += uintptr(4)
  25590. case int32(_BT_NONXML):
  25591. fallthrough
  25592. case int32(_BT_MALFORM):
  25593. fallthrough
  25594. case int32(_BT_TRAIL):
  25595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25596. return m_XML_TOK_INVALID
  25597. case int32(_BT_QUOT):
  25598. fallthrough
  25599. case int32(_BT_APOS):
  25600. ptr += uintptr(2)
  25601. if t != open {
  25602. break
  25603. }
  25604. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25605. return -int32(m_XML_TOK_LITERAL)
  25606. }
  25607. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25608. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25609. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25610. } else {
  25611. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25612. }
  25613. switch v2 {
  25614. case int32(_BT_S):
  25615. fallthrough
  25616. case int32(_BT_CR):
  25617. fallthrough
  25618. case int32(_BT_LF):
  25619. fallthrough
  25620. case int32(_BT_GT):
  25621. fallthrough
  25622. case int32(_BT_PERCNT):
  25623. fallthrough
  25624. case int32(_BT_LSQB):
  25625. return int32(m_XML_TOK_LITERAL)
  25626. default:
  25627. return m_XML_TOK_INVALID
  25628. }
  25629. fallthrough
  25630. default:
  25631. ptr += uintptr(2)
  25632. break
  25633. }
  25634. }
  25635. return -int32(1)
  25636. }
  25637. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25638. var n Tsize_t
  25639. var tok, v1, v29, v33, v34, v35, v36 int32
  25640. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  25641. if ptr >= end {
  25642. return -int32(4)
  25643. }
  25644. if int32(2) > int32(1) {
  25645. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  25646. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  25647. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  25648. if n == uint32(0) {
  25649. return -int32(1)
  25650. }
  25651. end = ptr + uintptr(n)
  25652. }
  25653. }
  25654. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25655. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25656. } else {
  25657. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25658. }
  25659. switch v1 {
  25660. case int32(_BT_QUOT):
  25661. goto _2
  25662. case int32(_BT_APOS):
  25663. goto _3
  25664. case int32(_BT_LT):
  25665. goto _4
  25666. case int32(_BT_CR):
  25667. goto _5
  25668. case int32(_BT_LF):
  25669. goto _6
  25670. case int32(_BT_S):
  25671. goto _7
  25672. case int32(_BT_PERCNT):
  25673. goto _8
  25674. case int32(_BT_COMMA):
  25675. goto _9
  25676. case int32(_BT_LSQB):
  25677. goto _10
  25678. case int32(_BT_RSQB):
  25679. goto _11
  25680. case int32(_BT_LPAR):
  25681. goto _12
  25682. case int32(_BT_RPAR):
  25683. goto _13
  25684. case int32(_BT_VERBAR):
  25685. goto _14
  25686. case int32(_BT_GT):
  25687. goto _15
  25688. case int32(_BT_NUM):
  25689. goto _16
  25690. case int32(_BT_LEAD2):
  25691. goto _17
  25692. case int32(_BT_LEAD3):
  25693. goto _18
  25694. case int32(_BT_LEAD4):
  25695. goto _19
  25696. case int32(_BT_HEX):
  25697. goto _20
  25698. case int32(_BT_NMSTRT):
  25699. goto _21
  25700. case int32(_BT_COLON):
  25701. goto _22
  25702. case int32(_BT_MINUS):
  25703. goto _23
  25704. case int32(_BT_NAME):
  25705. goto _24
  25706. case int32(_BT_DIGIT):
  25707. goto _25
  25708. case int32(_BT_NONASCII):
  25709. goto _26
  25710. default:
  25711. goto _27
  25712. }
  25713. goto _28
  25714. _2:
  25715. ;
  25716. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  25717. _3:
  25718. ;
  25719. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  25720. _4:
  25721. ;
  25722. ptr += uintptr(2)
  25723. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25724. return -int32(1)
  25725. }
  25726. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25727. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25728. } else {
  25729. v29 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25730. }
  25731. switch v29 {
  25732. case int32(_BT_EXCL):
  25733. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25734. case int32(_BT_QUEST):
  25735. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25736. case int32(_BT_NMSTRT):
  25737. fallthrough
  25738. case int32(_BT_HEX):
  25739. fallthrough
  25740. case int32(_BT_NONASCII):
  25741. fallthrough
  25742. case int32(_BT_LEAD2):
  25743. fallthrough
  25744. case int32(_BT_LEAD3):
  25745. fallthrough
  25746. case int32(_BT_LEAD4):
  25747. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  25748. return int32(m_XML_TOK_INSTANCE_START)
  25749. }
  25750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25751. return m_XML_TOK_INVALID
  25752. _5:
  25753. ;
  25754. if ptr+uintptr(2) == end {
  25755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  25756. /* indicate that this might be part of a CR/LF pair */
  25757. return -int32(m_XML_TOK_PROLOG_S)
  25758. }
  25759. /* fall through */
  25760. _7:
  25761. ;
  25762. _6:
  25763. ;
  25764. _32:
  25765. ;
  25766. ptr += uintptr(2)
  25767. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25768. goto _30
  25769. }
  25770. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25771. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25772. } else {
  25773. v33 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25774. }
  25775. switch v33 {
  25776. case int32(_BT_S):
  25777. fallthrough
  25778. case int32(_BT_LF):
  25779. case int32(_BT_CR):
  25780. /* don't split CR/LF pair */
  25781. if ptr+uintptr(2) != end {
  25782. break
  25783. }
  25784. /* fall through */
  25785. fallthrough
  25786. default:
  25787. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25788. return int32(m_XML_TOK_PROLOG_S)
  25789. }
  25790. goto _31
  25791. _31:
  25792. ;
  25793. goto _32
  25794. goto _30
  25795. _30:
  25796. ;
  25797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25798. return int32(m_XML_TOK_PROLOG_S)
  25799. _8:
  25800. ;
  25801. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25802. _9:
  25803. ;
  25804. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25805. return int32(m_XML_TOK_COMMA)
  25806. _10:
  25807. ;
  25808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25809. return int32(m_XML_TOK_OPEN_BRACKET)
  25810. _11:
  25811. ;
  25812. ptr += uintptr(2)
  25813. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25814. return -int32(m_XML_TOK_CLOSE_BRACKET)
  25815. }
  25816. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  25817. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  25818. return -int32(1)
  25819. }
  25820. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  25821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  25822. return int32(m_XML_TOK_COND_SECT_CLOSE)
  25823. }
  25824. }
  25825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25826. return int32(m_XML_TOK_CLOSE_BRACKET)
  25827. _12:
  25828. ;
  25829. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25830. return int32(m_XML_TOK_OPEN_PAREN)
  25831. _13:
  25832. ;
  25833. ptr += uintptr(2)
  25834. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  25835. return -int32(m_XML_TOK_CLOSE_PAREN)
  25836. }
  25837. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25838. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25839. } else {
  25840. v34 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25841. }
  25842. switch v34 {
  25843. case int32(_BT_AST):
  25844. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25845. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  25846. case int32(_BT_QUEST):
  25847. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25848. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  25849. case int32(_BT_PLUS):
  25850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25851. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  25852. case int32(_BT_CR):
  25853. fallthrough
  25854. case int32(_BT_LF):
  25855. fallthrough
  25856. case int32(_BT_S):
  25857. fallthrough
  25858. case int32(_BT_GT):
  25859. fallthrough
  25860. case int32(_BT_COMMA):
  25861. fallthrough
  25862. case int32(_BT_VERBAR):
  25863. fallthrough
  25864. case int32(_BT_RPAR):
  25865. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25866. return int32(m_XML_TOK_CLOSE_PAREN)
  25867. }
  25868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25869. return m_XML_TOK_INVALID
  25870. _14:
  25871. ;
  25872. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25873. return int32(m_XML_TOK_OR)
  25874. _15:
  25875. ;
  25876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25877. return int32(m_XML_TOK_DECL_CLOSE)
  25878. _16:
  25879. ;
  25880. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  25881. _17:
  25882. ;
  25883. if int32(end)-int32(ptr) < int32(2) {
  25884. return -int32(2)
  25885. }
  25886. if 0 != 0 {
  25887. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25888. return m_XML_TOK_INVALID
  25889. }
  25890. if 0 != 0 {
  25891. ptr += uintptr(2)
  25892. tok = int32(m_XML_TOK_NAME)
  25893. goto _28
  25894. }
  25895. if 0 != 0 {
  25896. ptr += uintptr(2)
  25897. tok = int32(m_XML_TOK_NMTOKEN)
  25898. goto _28
  25899. }
  25900. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25901. return m_XML_TOK_INVALID
  25902. _18:
  25903. ;
  25904. if int32(end)-int32(ptr) < int32(3) {
  25905. return -int32(2)
  25906. }
  25907. if 0 != 0 {
  25908. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25909. return m_XML_TOK_INVALID
  25910. }
  25911. if 0 != 0 {
  25912. ptr += uintptr(3)
  25913. tok = int32(m_XML_TOK_NAME)
  25914. goto _28
  25915. }
  25916. if 0 != 0 {
  25917. ptr += uintptr(3)
  25918. tok = int32(m_XML_TOK_NMTOKEN)
  25919. goto _28
  25920. }
  25921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25922. return m_XML_TOK_INVALID
  25923. _19:
  25924. ;
  25925. if int32(end)-int32(ptr) < int32(4) {
  25926. return -int32(2)
  25927. }
  25928. if 0 != 0 {
  25929. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25930. return m_XML_TOK_INVALID
  25931. }
  25932. if 0 != 0 {
  25933. ptr += uintptr(4)
  25934. tok = int32(m_XML_TOK_NAME)
  25935. goto _28
  25936. }
  25937. if 0 != 0 {
  25938. ptr += uintptr(4)
  25939. tok = int32(m_XML_TOK_NMTOKEN)
  25940. goto _28
  25941. }
  25942. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25943. return m_XML_TOK_INVALID
  25944. _21:
  25945. ;
  25946. _20:
  25947. ;
  25948. tok = int32(m_XML_TOK_NAME)
  25949. ptr += uintptr(2)
  25950. goto _28
  25951. _25:
  25952. ;
  25953. _24:
  25954. ;
  25955. _23:
  25956. ;
  25957. _22:
  25958. ;
  25959. tok = int32(m_XML_TOK_NMTOKEN)
  25960. ptr += uintptr(2)
  25961. goto _28
  25962. _26:
  25963. ;
  25964. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  25965. ptr += uintptr(2)
  25966. tok = int32(m_XML_TOK_NAME)
  25967. goto _28
  25968. }
  25969. if _namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&int32(0x1F))) != 0 {
  25970. ptr += uintptr(2)
  25971. tok = int32(m_XML_TOK_NMTOKEN)
  25972. goto _28
  25973. }
  25974. /* fall through */
  25975. _27:
  25976. ;
  25977. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25978. return m_XML_TOK_INVALID
  25979. _28:
  25980. ;
  25981. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  25982. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  25983. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  25984. } else {
  25985. v35 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  25986. }
  25987. switch v35 {
  25988. case int32(_BT_NONASCII):
  25989. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  25990. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  25991. return m_XML_TOK_INVALID
  25992. } /* fall through */
  25993. fallthrough
  25994. case int32(_BT_NMSTRT):
  25995. fallthrough
  25996. case int32(_BT_HEX):
  25997. fallthrough
  25998. case int32(_BT_DIGIT):
  25999. fallthrough
  26000. case int32(_BT_NAME):
  26001. fallthrough
  26002. case int32(_BT_MINUS):
  26003. ptr += uintptr(2)
  26004. case int32(_BT_LEAD2):
  26005. if int32(end)-int32(ptr) < int32(2) {
  26006. return -int32(2)
  26007. }
  26008. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26010. return m_XML_TOK_INVALID
  26011. }
  26012. ptr += uintptr(2)
  26013. case int32(_BT_LEAD3):
  26014. if int32(end)-int32(ptr) < int32(3) {
  26015. return -int32(2)
  26016. }
  26017. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26018. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26019. return m_XML_TOK_INVALID
  26020. }
  26021. ptr += uintptr(3)
  26022. case int32(_BT_LEAD4):
  26023. if int32(end)-int32(ptr) < int32(4) {
  26024. return -int32(2)
  26025. }
  26026. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26027. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26028. return m_XML_TOK_INVALID
  26029. }
  26030. ptr += uintptr(4)
  26031. case int32(_BT_GT):
  26032. fallthrough
  26033. case int32(_BT_RPAR):
  26034. fallthrough
  26035. case int32(_BT_COMMA):
  26036. fallthrough
  26037. case int32(_BT_VERBAR):
  26038. fallthrough
  26039. case int32(_BT_LSQB):
  26040. fallthrough
  26041. case int32(_BT_PERCNT):
  26042. fallthrough
  26043. case int32(_BT_S):
  26044. fallthrough
  26045. case int32(_BT_CR):
  26046. fallthrough
  26047. case int32(_BT_LF):
  26048. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26049. return tok
  26050. case int32(_BT_COLON):
  26051. ptr += uintptr(2)
  26052. switch tok {
  26053. case int32(m_XML_TOK_NAME):
  26054. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26055. return -int32(1)
  26056. }
  26057. tok = int32(m_XML_TOK_PREFIXED_NAME)
  26058. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26059. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26060. } else {
  26061. v36 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26062. }
  26063. switch v36 {
  26064. case int32(_BT_NONASCII):
  26065. if !(_namingBitmap[libc.Int32FromUint8(_namePages[libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))])<<int32(3)+libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1))))&libc.Int32FromInt32(0x1F))) != 0) {
  26066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26067. return m_XML_TOK_INVALID
  26068. } /* fall through */
  26069. fallthrough
  26070. case int32(_BT_NMSTRT):
  26071. fallthrough
  26072. case int32(_BT_HEX):
  26073. fallthrough
  26074. case int32(_BT_DIGIT):
  26075. fallthrough
  26076. case int32(_BT_NAME):
  26077. fallthrough
  26078. case int32(_BT_MINUS):
  26079. ptr += uintptr(2)
  26080. case int32(_BT_LEAD2):
  26081. if int32(end)-int32(ptr) < int32(2) {
  26082. return -int32(2)
  26083. }
  26084. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26086. return m_XML_TOK_INVALID
  26087. }
  26088. ptr += uintptr(2)
  26089. case int32(_BT_LEAD3):
  26090. if int32(end)-int32(ptr) < int32(3) {
  26091. return -int32(2)
  26092. }
  26093. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26094. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26095. return m_XML_TOK_INVALID
  26096. }
  26097. ptr += uintptr(3)
  26098. case int32(_BT_LEAD4):
  26099. if int32(end)-int32(ptr) < int32(4) {
  26100. return -int32(2)
  26101. }
  26102. if libc.Bool(0 != 0) || libc.Bool(!(libc.Int32FromInt32(0) != 0)) {
  26103. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26104. return m_XML_TOK_INVALID
  26105. }
  26106. ptr += uintptr(4)
  26107. default:
  26108. tok = int32(m_XML_TOK_NMTOKEN)
  26109. break
  26110. }
  26111. case int32(m_XML_TOK_PREFIXED_NAME):
  26112. tok = int32(m_XML_TOK_NMTOKEN)
  26113. break
  26114. }
  26115. case int32(_BT_PLUS):
  26116. if tok == int32(m_XML_TOK_NMTOKEN) {
  26117. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26118. return m_XML_TOK_INVALID
  26119. }
  26120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26121. return int32(m_XML_TOK_NAME_PLUS)
  26122. case int32(_BT_AST):
  26123. if tok == int32(m_XML_TOK_NMTOKEN) {
  26124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26125. return m_XML_TOK_INVALID
  26126. }
  26127. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26128. return int32(m_XML_TOK_NAME_ASTERISK)
  26129. case int32(_BT_QUEST):
  26130. if tok == int32(m_XML_TOK_NMTOKEN) {
  26131. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26132. return m_XML_TOK_INVALID
  26133. }
  26134. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26135. return int32(m_XML_TOK_NAME_QUESTION)
  26136. default:
  26137. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26138. return m_XML_TOK_INVALID
  26139. }
  26140. }
  26141. return -tok
  26142. }
  26143. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26144. var start uintptr
  26145. var v1, v2 int32
  26146. _, _, _ = start, v1, v2
  26147. if ptr >= end {
  26148. return -int32(4)
  26149. } else {
  26150. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26151. /* This line cannot be executed. The incoming data has already
  26152. * been tokenized once, so incomplete characters like this have
  26153. * already been eliminated from the input. Retaining the paranoia
  26154. * check is still valuable, however.
  26155. */
  26156. return -int32(1) /* LCOV_EXCL_LINE */
  26157. }
  26158. }
  26159. start = ptr
  26160. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26161. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26162. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26163. } else {
  26164. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26165. }
  26166. switch v1 {
  26167. case int32(_BT_LEAD2):
  26168. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26169. case int32(_BT_LEAD3):
  26170. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26171. case int32(_BT_LEAD4):
  26172. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26173. case int32(_BT_AMP):
  26174. if ptr == start {
  26175. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26176. }
  26177. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26178. return int32(m_XML_TOK_DATA_CHARS)
  26179. case int32(_BT_LT):
  26180. /* this is for inside entity references */
  26181. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26182. return m_XML_TOK_INVALID
  26183. case int32(_BT_LF):
  26184. if ptr == start {
  26185. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26186. return int32(m_XML_TOK_DATA_NEWLINE)
  26187. }
  26188. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26189. return int32(m_XML_TOK_DATA_CHARS)
  26190. case int32(_BT_CR):
  26191. if ptr == start {
  26192. ptr += uintptr(2)
  26193. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26194. return -int32(3)
  26195. }
  26196. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26197. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26198. } else {
  26199. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26200. }
  26201. if v2 == int32(_BT_LF) {
  26202. ptr += uintptr(2)
  26203. }
  26204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26205. return int32(m_XML_TOK_DATA_NEWLINE)
  26206. }
  26207. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26208. return int32(m_XML_TOK_DATA_CHARS)
  26209. case int32(_BT_S):
  26210. if ptr == start {
  26211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26212. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  26213. }
  26214. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26215. return int32(m_XML_TOK_DATA_CHARS)
  26216. default:
  26217. ptr += uintptr(2)
  26218. break
  26219. }
  26220. }
  26221. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26222. return int32(m_XML_TOK_DATA_CHARS)
  26223. }
  26224. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26225. var start uintptr
  26226. var tok, v1, v2, v3 int32
  26227. _, _, _, _, _ = start, tok, v1, v2, v3
  26228. if ptr >= end {
  26229. return -int32(4)
  26230. } else {
  26231. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26232. /* This line cannot be executed. The incoming data has already
  26233. * been tokenized once, so incomplete characters like this have
  26234. * already been eliminated from the input. Retaining the paranoia
  26235. * check is still valuable, however.
  26236. */
  26237. return -int32(1) /* LCOV_EXCL_LINE */
  26238. }
  26239. }
  26240. start = ptr
  26241. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26242. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26243. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26244. } else {
  26245. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26246. }
  26247. switch v1 {
  26248. case int32(_BT_LEAD2):
  26249. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26250. case int32(_BT_LEAD3):
  26251. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26252. case int32(_BT_LEAD4):
  26253. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26254. case int32(_BT_AMP):
  26255. if ptr == start {
  26256. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26257. }
  26258. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26259. return int32(m_XML_TOK_DATA_CHARS)
  26260. case int32(_BT_PERCNT):
  26261. if ptr == start {
  26262. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  26263. if tok == int32(m_XML_TOK_PERCENT) {
  26264. v2 = m_XML_TOK_INVALID
  26265. } else {
  26266. v2 = tok
  26267. }
  26268. return v2
  26269. }
  26270. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26271. return int32(m_XML_TOK_DATA_CHARS)
  26272. case int32(_BT_LF):
  26273. if ptr == start {
  26274. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  26275. return int32(m_XML_TOK_DATA_NEWLINE)
  26276. }
  26277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26278. return int32(m_XML_TOK_DATA_CHARS)
  26279. case int32(_BT_CR):
  26280. if ptr == start {
  26281. ptr += uintptr(2)
  26282. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26283. return -int32(3)
  26284. }
  26285. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26286. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26287. } else {
  26288. v3 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26289. }
  26290. if v3 == int32(_BT_LF) {
  26291. ptr += uintptr(2)
  26292. }
  26293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26294. return int32(m_XML_TOK_DATA_NEWLINE)
  26295. }
  26296. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26297. return int32(m_XML_TOK_DATA_CHARS)
  26298. default:
  26299. ptr += uintptr(2)
  26300. break
  26301. }
  26302. }
  26303. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26304. return int32(m_XML_TOK_DATA_CHARS)
  26305. }
  26306. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  26307. var level, v1 int32
  26308. var n Tsize_t
  26309. _, _, _ = level, n, v1
  26310. level = 0
  26311. if int32(2) > int32(1) {
  26312. n = libc.Uint32FromInt32(int32(end) - int32(ptr))
  26313. if n&libc.Uint32FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  26314. n &= libc.Uint32FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  26315. end = ptr + uintptr(n)
  26316. }
  26317. }
  26318. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26319. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26320. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26321. } else {
  26322. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26323. }
  26324. switch v1 {
  26325. case int32(_BT_LEAD2):
  26326. if int32(end)-int32(ptr) < int32(2) {
  26327. return -int32(2)
  26328. }
  26329. if 0 != 0 {
  26330. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26331. return m_XML_TOK_INVALID
  26332. }
  26333. ptr += uintptr(2)
  26334. case int32(_BT_LEAD3):
  26335. if int32(end)-int32(ptr) < int32(3) {
  26336. return -int32(2)
  26337. }
  26338. if 0 != 0 {
  26339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26340. return m_XML_TOK_INVALID
  26341. }
  26342. ptr += uintptr(3)
  26343. case int32(_BT_LEAD4):
  26344. if int32(end)-int32(ptr) < int32(4) {
  26345. return -int32(2)
  26346. }
  26347. if 0 != 0 {
  26348. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26349. return m_XML_TOK_INVALID
  26350. }
  26351. ptr += uintptr(4)
  26352. case int32(_BT_NONXML):
  26353. fallthrough
  26354. case int32(_BT_MALFORM):
  26355. fallthrough
  26356. case int32(_BT_TRAIL):
  26357. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26358. return m_XML_TOK_INVALID
  26359. case int32(_BT_LT):
  26360. ptr += uintptr(2)
  26361. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26362. return -int32(1)
  26363. }
  26364. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL2) {
  26365. ptr += uintptr(2)
  26366. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26367. return -int32(1)
  26368. }
  26369. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  26370. level++
  26371. ptr += uintptr(2)
  26372. }
  26373. }
  26374. case int32(_BT_RSQB):
  26375. ptr += uintptr(2)
  26376. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26377. return -int32(1)
  26378. }
  26379. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  26380. ptr += uintptr(2)
  26381. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26382. return -int32(1)
  26383. }
  26384. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  26385. ptr += uintptr(2)
  26386. if level == 0 {
  26387. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  26388. return int32(m_XML_TOK_IGNORE_SECT)
  26389. }
  26390. level--
  26391. }
  26392. }
  26393. default:
  26394. ptr += uintptr(2)
  26395. break
  26396. }
  26397. }
  26398. return -int32(1)
  26399. }
  26400. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  26401. var v2, v3, v4 int32
  26402. _, _, _ = v2, v3, v4
  26403. ptr += uintptr(2)
  26404. end -= uintptr(2)
  26405. for {
  26406. if !(int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  26407. break
  26408. }
  26409. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26410. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26411. } else {
  26412. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26413. }
  26414. switch v2 {
  26415. case int32(_BT_DIGIT):
  26416. fallthrough
  26417. case int32(_BT_HEX):
  26418. fallthrough
  26419. case int32(_BT_MINUS):
  26420. fallthrough
  26421. case int32(_BT_APOS):
  26422. fallthrough
  26423. case int32(_BT_LPAR):
  26424. fallthrough
  26425. case int32(_BT_RPAR):
  26426. fallthrough
  26427. case int32(_BT_PLUS):
  26428. fallthrough
  26429. case int32(_BT_COMMA):
  26430. fallthrough
  26431. case int32(_BT_SOL):
  26432. fallthrough
  26433. case int32(_BT_EQUALS):
  26434. fallthrough
  26435. case int32(_BT_QUEST):
  26436. fallthrough
  26437. case int32(_BT_CR):
  26438. fallthrough
  26439. case int32(_BT_LF):
  26440. fallthrough
  26441. case int32(_BT_SEMI):
  26442. fallthrough
  26443. case int32(_BT_EXCL):
  26444. fallthrough
  26445. case int32(_BT_AST):
  26446. fallthrough
  26447. case int32(_BT_PERCNT):
  26448. fallthrough
  26449. case int32(_BT_NUM):
  26450. fallthrough
  26451. case int32(_BT_COLON):
  26452. case int32(_BT_S):
  26453. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  26454. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26455. return 0
  26456. }
  26457. case int32(_BT_NAME):
  26458. fallthrough
  26459. case int32(_BT_NMSTRT):
  26460. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26461. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26462. } else {
  26463. v3 = -int32(1)
  26464. }
  26465. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  26466. break
  26467. }
  26468. /* fall through */
  26469. fallthrough
  26470. default:
  26471. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26472. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26473. } else {
  26474. v4 = -int32(1)
  26475. }
  26476. switch v4 {
  26477. case int32(0x24): /* $ */
  26478. fallthrough
  26479. case int32(0x40): /* @ */
  26480. default:
  26481. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  26482. return 0
  26483. }
  26484. break
  26485. }
  26486. goto _1
  26487. _1:
  26488. ;
  26489. ptr += uintptr(2)
  26490. }
  26491. return int32(1)
  26492. }
  26493. /* This must only be called for a well-formed start-tag or empty
  26494. element tag. Returns the number of attributes. Pointers to the
  26495. first attsMax attributes are stored in atts.
  26496. */
  26497. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  26498. var nAtts, open, state, v2, v3, v5, v7 int32
  26499. var v4, v6, v8, v9 bool
  26500. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  26501. state = 1
  26502. nAtts = 0
  26503. open = 0 /* defined when state == inValue;
  26504. initialization just to shut up compilers */
  26505. ptr += uintptr(2)
  26506. for {
  26507. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26508. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26509. } else {
  26510. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26511. }
  26512. switch v2 {
  26513. case int32(_BT_LEAD2):
  26514. if state == 0 {
  26515. if nAtts < attsMax {
  26516. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26517. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  26518. }
  26519. state = 1
  26520. }
  26521. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  26522. case int32(_BT_LEAD3):
  26523. if state == 0 {
  26524. if nAtts < attsMax {
  26525. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26526. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  26527. }
  26528. state = 1
  26529. }
  26530. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  26531. case int32(_BT_LEAD4):
  26532. if state == 0 {
  26533. if nAtts < attsMax {
  26534. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26535. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  26536. }
  26537. state = 1
  26538. }
  26539. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  26540. case int32(_BT_NONASCII):
  26541. fallthrough
  26542. case int32(_BT_NMSTRT):
  26543. fallthrough
  26544. case int32(_BT_HEX):
  26545. if state == 0 {
  26546. if nAtts < attsMax {
  26547. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fname = ptr
  26548. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = int8(1)
  26549. }
  26550. state = 1
  26551. }
  26552. case int32(_BT_QUOT):
  26553. if state != 2 {
  26554. if nAtts < attsMax {
  26555. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  26556. }
  26557. state = 2
  26558. open = int32(_BT_QUOT)
  26559. } else {
  26560. if open == int32(_BT_QUOT) {
  26561. state = 0
  26562. if nAtts < attsMax {
  26563. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  26564. }
  26565. nAtts++
  26566. }
  26567. }
  26568. case int32(_BT_APOS):
  26569. if state != 2 {
  26570. if nAtts < attsMax {
  26571. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr = ptr + uintptr(2)
  26572. }
  26573. state = 2
  26574. open = int32(_BT_APOS)
  26575. } else {
  26576. if open == int32(_BT_APOS) {
  26577. state = 0
  26578. if nAtts < attsMax {
  26579. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvalueEnd = ptr
  26580. }
  26581. nAtts++
  26582. }
  26583. }
  26584. case int32(_BT_AMP):
  26585. if nAtts < attsMax {
  26586. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  26587. }
  26588. case int32(_BT_S):
  26589. if state == 1 {
  26590. state = 0
  26591. } else {
  26592. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized != 0; v9 {
  26593. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).FvaluePtr; !v4 {
  26594. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26595. v3 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26596. } else {
  26597. v3 = -int32(1)
  26598. }
  26599. }
  26600. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  26601. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26602. v5 = int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26603. } else {
  26604. v5 = -int32(1)
  26605. }
  26606. }
  26607. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  26608. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  26609. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))))))
  26610. } else {
  26611. v7 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  26612. }
  26613. }
  26614. }
  26615. if v9 && (v8 || v7 == open) {
  26616. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  26617. }
  26618. }
  26619. case int32(_BT_CR):
  26620. fallthrough
  26621. case int32(_BT_LF):
  26622. /* This case ensures that the first attribute name is counted
  26623. Apart from that we could just change state on the quote. */
  26624. if state == 1 {
  26625. state = 0
  26626. } else {
  26627. if state == 2 && nAtts < attsMax {
  26628. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*16))).Fnormalized = 0
  26629. }
  26630. }
  26631. case int32(_BT_GT):
  26632. fallthrough
  26633. case int32(_BT_SOL):
  26634. if state != 2 {
  26635. return nAtts
  26636. }
  26637. default:
  26638. break
  26639. }
  26640. goto _1
  26641. _1:
  26642. ;
  26643. ptr += uintptr(2)
  26644. }
  26645. /* not reached */
  26646. return r
  26647. }
  26648. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26649. var c, c1, result, v2, v4 int32
  26650. _, _, _, _, _ = c, c1, result, v2, v4
  26651. result = 0
  26652. /* skip &# */
  26653. _ = enc
  26654. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  26655. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x2) {
  26656. ptr += uintptr(2)
  26657. for {
  26658. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26659. break
  26660. }
  26661. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26662. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26663. } else {
  26664. v2 = -int32(1)
  26665. }
  26666. c = v2
  26667. switch c {
  26668. case int32(m_ASCII_02):
  26669. fallthrough
  26670. case int32(m_ASCII_12):
  26671. fallthrough
  26672. case int32(m_ASCII_22):
  26673. fallthrough
  26674. case int32(m_ASCII_32):
  26675. fallthrough
  26676. case int32(m_ASCII_41):
  26677. fallthrough
  26678. case int32(m_ASCII_51):
  26679. fallthrough
  26680. case int32(m_ASCII_61):
  26681. fallthrough
  26682. case int32(m_ASCII_71):
  26683. fallthrough
  26684. case int32(m_ASCII_82):
  26685. fallthrough
  26686. case int32(m_ASCII_92):
  26687. result <<= int32(4)
  26688. result |= c - int32(m_ASCII_02)
  26689. case int32(m_ASCII_A):
  26690. fallthrough
  26691. case int32(m_ASCII_B1):
  26692. fallthrough
  26693. case int32(m_ASCII_C):
  26694. fallthrough
  26695. case int32(m_ASCII_D):
  26696. fallthrough
  26697. case int32(m_ASCII_E):
  26698. fallthrough
  26699. case int32(m_ASCII_F):
  26700. result <<= int32(4)
  26701. result += int32(10) + (c - int32(m_ASCII_A))
  26702. case int32(m_ASCII_a2):
  26703. fallthrough
  26704. case int32(m_ASCII_b1):
  26705. fallthrough
  26706. case int32(m_ASCII_c2):
  26707. fallthrough
  26708. case int32(m_ASCII_d1):
  26709. fallthrough
  26710. case int32(m_ASCII_e2):
  26711. fallthrough
  26712. case int32(m_ASCII_f1):
  26713. result <<= int32(4)
  26714. result += int32(10) + (c - int32(m_ASCII_a2))
  26715. break
  26716. }
  26717. if result >= int32(0x110000) {
  26718. return -int32(1)
  26719. }
  26720. goto _1
  26721. _1:
  26722. ;
  26723. ptr += uintptr(2)
  26724. }
  26725. } else {
  26726. for {
  26727. if !!(int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  26728. break
  26729. }
  26730. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26731. v4 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26732. } else {
  26733. v4 = -int32(1)
  26734. }
  26735. c1 = v4
  26736. result *= int32(10)
  26737. result += c1 - int32(m_ASCII_02)
  26738. if result >= int32(0x110000) {
  26739. return -int32(1)
  26740. }
  26741. goto _3
  26742. _3:
  26743. ;
  26744. ptr += uintptr(2)
  26745. }
  26746. }
  26747. return _checkCharRefNumber(tls, result)
  26748. }
  26749. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  26750. var v1, v2 int32
  26751. _, _ = v1, v2
  26752. _ = enc
  26753. switch (int32(end) - int32(ptr)) / libc.Int32FromInt32(2) {
  26754. case int32(2):
  26755. if int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t2) {
  26756. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26757. v1 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26758. } else {
  26759. v1 = -int32(1)
  26760. }
  26761. switch v1 {
  26762. case int32(m_ASCII_l2):
  26763. return int32(m_ASCII_LT1)
  26764. case int32(m_ASCII_g2):
  26765. return int32(m_ASCII_GT1)
  26766. }
  26767. }
  26768. case int32(3):
  26769. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a2) {
  26770. ptr += uintptr(2)
  26771. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m2) {
  26772. ptr += uintptr(2)
  26773. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26774. return int32(m_ASCII_AMP1)
  26775. }
  26776. }
  26777. }
  26778. case int32(4):
  26779. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26780. v2 = int32(*(*int8)(unsafe.Pointer(ptr + 1)))
  26781. } else {
  26782. v2 = -int32(1)
  26783. }
  26784. switch v2 {
  26785. case int32(m_ASCII_q1):
  26786. ptr += uintptr(2)
  26787. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  26788. ptr += uintptr(2)
  26789. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26790. ptr += uintptr(2)
  26791. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t2) {
  26792. return int32(m_ASCII_QUOT1)
  26793. }
  26794. }
  26795. }
  26796. case int32(m_ASCII_a2):
  26797. ptr += uintptr(2)
  26798. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p2) {
  26799. ptr += uintptr(2)
  26800. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o2) {
  26801. ptr += uintptr(2)
  26802. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s2) {
  26803. return int32(m_ASCII_APOS1)
  26804. }
  26805. }
  26806. }
  26807. break
  26808. }
  26809. }
  26810. return 0
  26811. }
  26812. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  26813. _ = enc
  26814. for {
  26815. if !(*(*int8)(unsafe.Pointer(ptr2)) != 0) {
  26816. break
  26817. }
  26818. if int32(end1)-int32(ptr1) < int32(2) {
  26819. /* This line cannot be executed. The incoming data has already
  26820. * been tokenized once, so incomplete characters like this have
  26821. * already been eliminated from the input. Retaining the
  26822. * paranoia check is still valuable, however.
  26823. */
  26824. return 0 /* LCOV_EXCL_LINE */
  26825. }
  26826. if !(int32(*(*int8)(unsafe.Pointer(ptr1))) == 0 && int32(*(*int8)(unsafe.Pointer(ptr1 + 1))) == int32(*(*int8)(unsafe.Pointer(ptr2)))) {
  26827. return 0
  26828. }
  26829. goto _1
  26830. _1:
  26831. ;
  26832. ptr1 += uintptr(2)
  26833. ptr2++
  26834. }
  26835. return libc.BoolInt32(ptr1 == end1)
  26836. }
  26837. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  26838. var start uintptr
  26839. var v2 int32
  26840. _, _ = start, v2
  26841. start = ptr
  26842. for {
  26843. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26844. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26845. } else {
  26846. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26847. }
  26848. switch v2 {
  26849. case int32(_BT_LEAD2):
  26850. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26851. case int32(_BT_LEAD3):
  26852. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26853. case int32(_BT_LEAD4):
  26854. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26855. case int32(_BT_NONASCII):
  26856. fallthrough
  26857. case int32(_BT_NMSTRT):
  26858. fallthrough
  26859. case int32(_BT_COLON):
  26860. fallthrough
  26861. case int32(_BT_HEX):
  26862. fallthrough
  26863. case int32(_BT_DIGIT):
  26864. fallthrough
  26865. case int32(_BT_NAME):
  26866. fallthrough
  26867. case int32(_BT_MINUS):
  26868. ptr += uintptr(2)
  26869. default:
  26870. return int32(ptr) - int32(start)
  26871. }
  26872. goto _1
  26873. _1:
  26874. }
  26875. return r
  26876. }
  26877. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  26878. var v2 int32
  26879. _ = v2
  26880. for {
  26881. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26882. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26883. } else {
  26884. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26885. }
  26886. switch v2 {
  26887. case int32(_BT_LF):
  26888. fallthrough
  26889. case int32(_BT_CR):
  26890. fallthrough
  26891. case int32(_BT_S):
  26892. ptr += uintptr(2)
  26893. default:
  26894. return ptr
  26895. }
  26896. goto _1
  26897. _1:
  26898. }
  26899. return r
  26900. }
  26901. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  26902. var v1, v2 int32
  26903. var v3 bool
  26904. _, _, _ = v1, v2, v3
  26905. for int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2) {
  26906. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26907. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26908. } else {
  26909. v1 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26910. }
  26911. switch v1 {
  26912. case int32(_BT_LEAD2):
  26913. ptr += uintptr(2) /* NOTE: The encoding has already been validated. */
  26914. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26915. case int32(_BT_LEAD3):
  26916. ptr += uintptr(3) /* NOTE: The encoding has already been validated. */
  26917. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26918. case int32(_BT_LEAD4):
  26919. ptr += uintptr(4) /* NOTE: The encoding has already been validated. */
  26920. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26921. case int32(_BT_LF):
  26922. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  26923. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26924. ptr += uintptr(2)
  26925. case int32(_BT_CR):
  26926. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  26927. ptr += uintptr(2)
  26928. if v3 = int32(end)-int32(ptr) >= libc.Int32FromInt32(1)*libc.Int32FromInt32(2); v3 {
  26929. if int32(*(*int8)(unsafe.Pointer(ptr))) == 0 {
  26930. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))))))
  26931. } else {
  26932. v2 = _unicode_byte_type(tls, *(*int8)(unsafe.Pointer(ptr)), *(*int8)(unsafe.Pointer(ptr + 1)))
  26933. }
  26934. }
  26935. if v3 && v2 == int32(_BT_LF) {
  26936. ptr += uintptr(2)
  26937. }
  26938. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint32(0)
  26939. default:
  26940. ptr += uintptr(2)
  26941. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  26942. break
  26943. }
  26944. }
  26945. }
  26946. var _big2_encoding_ns = Tnormal_encoding{
  26947. Fenc: TENCODING{
  26948. Fscanners: [4]TSCANNER{},
  26949. FliteralScanners: [2]TSCANNER{},
  26950. FminBytesPerChar: int32(2),
  26951. },
  26952. Ftype1: [256]uint8{
  26953. 9: uint8(_BT_S),
  26954. 10: uint8(_BT_LF),
  26955. 13: uint8(_BT_CR),
  26956. 32: uint8(_BT_S),
  26957. 33: uint8(_BT_EXCL),
  26958. 34: uint8(_BT_QUOT),
  26959. 35: uint8(_BT_NUM),
  26960. 36: uint8(_BT_OTHER),
  26961. 37: uint8(_BT_PERCNT),
  26962. 38: uint8(_BT_AMP),
  26963. 39: uint8(_BT_APOS),
  26964. 40: uint8(_BT_LPAR),
  26965. 41: uint8(_BT_RPAR),
  26966. 42: uint8(_BT_AST),
  26967. 43: uint8(_BT_PLUS),
  26968. 44: uint8(_BT_COMMA),
  26969. 45: uint8(_BT_MINUS),
  26970. 46: uint8(_BT_NAME),
  26971. 47: uint8(_BT_SOL),
  26972. 48: uint8(_BT_DIGIT),
  26973. 49: uint8(_BT_DIGIT),
  26974. 50: uint8(_BT_DIGIT),
  26975. 51: uint8(_BT_DIGIT),
  26976. 52: uint8(_BT_DIGIT),
  26977. 53: uint8(_BT_DIGIT),
  26978. 54: uint8(_BT_DIGIT),
  26979. 55: uint8(_BT_DIGIT),
  26980. 56: uint8(_BT_DIGIT),
  26981. 57: uint8(_BT_DIGIT),
  26982. 58: uint8(_BT_COLON),
  26983. 59: uint8(_BT_SEMI),
  26984. 60: uint8(_BT_LT),
  26985. 61: uint8(_BT_EQUALS),
  26986. 62: uint8(_BT_GT),
  26987. 63: uint8(_BT_QUEST),
  26988. 64: uint8(_BT_OTHER),
  26989. 65: uint8(_BT_HEX),
  26990. 66: uint8(_BT_HEX),
  26991. 67: uint8(_BT_HEX),
  26992. 68: uint8(_BT_HEX),
  26993. 69: uint8(_BT_HEX),
  26994. 70: uint8(_BT_HEX),
  26995. 71: uint8(_BT_NMSTRT),
  26996. 72: uint8(_BT_NMSTRT),
  26997. 73: uint8(_BT_NMSTRT),
  26998. 74: uint8(_BT_NMSTRT),
  26999. 75: uint8(_BT_NMSTRT),
  27000. 76: uint8(_BT_NMSTRT),
  27001. 77: uint8(_BT_NMSTRT),
  27002. 78: uint8(_BT_NMSTRT),
  27003. 79: uint8(_BT_NMSTRT),
  27004. 80: uint8(_BT_NMSTRT),
  27005. 81: uint8(_BT_NMSTRT),
  27006. 82: uint8(_BT_NMSTRT),
  27007. 83: uint8(_BT_NMSTRT),
  27008. 84: uint8(_BT_NMSTRT),
  27009. 85: uint8(_BT_NMSTRT),
  27010. 86: uint8(_BT_NMSTRT),
  27011. 87: uint8(_BT_NMSTRT),
  27012. 88: uint8(_BT_NMSTRT),
  27013. 89: uint8(_BT_NMSTRT),
  27014. 90: uint8(_BT_NMSTRT),
  27015. 91: uint8(_BT_LSQB),
  27016. 92: uint8(_BT_OTHER),
  27017. 93: uint8(_BT_RSQB),
  27018. 94: uint8(_BT_OTHER),
  27019. 95: uint8(_BT_NMSTRT),
  27020. 96: uint8(_BT_OTHER),
  27021. 97: uint8(_BT_HEX),
  27022. 98: uint8(_BT_HEX),
  27023. 99: uint8(_BT_HEX),
  27024. 100: uint8(_BT_HEX),
  27025. 101: uint8(_BT_HEX),
  27026. 102: uint8(_BT_HEX),
  27027. 103: uint8(_BT_NMSTRT),
  27028. 104: uint8(_BT_NMSTRT),
  27029. 105: uint8(_BT_NMSTRT),
  27030. 106: uint8(_BT_NMSTRT),
  27031. 107: uint8(_BT_NMSTRT),
  27032. 108: uint8(_BT_NMSTRT),
  27033. 109: uint8(_BT_NMSTRT),
  27034. 110: uint8(_BT_NMSTRT),
  27035. 111: uint8(_BT_NMSTRT),
  27036. 112: uint8(_BT_NMSTRT),
  27037. 113: uint8(_BT_NMSTRT),
  27038. 114: uint8(_BT_NMSTRT),
  27039. 115: uint8(_BT_NMSTRT),
  27040. 116: uint8(_BT_NMSTRT),
  27041. 117: uint8(_BT_NMSTRT),
  27042. 118: uint8(_BT_NMSTRT),
  27043. 119: uint8(_BT_NMSTRT),
  27044. 120: uint8(_BT_NMSTRT),
  27045. 121: uint8(_BT_NMSTRT),
  27046. 122: uint8(_BT_NMSTRT),
  27047. 123: uint8(_BT_OTHER),
  27048. 124: uint8(_BT_VERBAR),
  27049. 125: uint8(_BT_OTHER),
  27050. 126: uint8(_BT_OTHER),
  27051. 127: uint8(_BT_OTHER),
  27052. 128: uint8(_BT_OTHER),
  27053. 129: uint8(_BT_OTHER),
  27054. 130: uint8(_BT_OTHER),
  27055. 131: uint8(_BT_OTHER),
  27056. 132: uint8(_BT_OTHER),
  27057. 133: uint8(_BT_OTHER),
  27058. 134: uint8(_BT_OTHER),
  27059. 135: uint8(_BT_OTHER),
  27060. 136: uint8(_BT_OTHER),
  27061. 137: uint8(_BT_OTHER),
  27062. 138: uint8(_BT_OTHER),
  27063. 139: uint8(_BT_OTHER),
  27064. 140: uint8(_BT_OTHER),
  27065. 141: uint8(_BT_OTHER),
  27066. 142: uint8(_BT_OTHER),
  27067. 143: uint8(_BT_OTHER),
  27068. 144: uint8(_BT_OTHER),
  27069. 145: uint8(_BT_OTHER),
  27070. 146: uint8(_BT_OTHER),
  27071. 147: uint8(_BT_OTHER),
  27072. 148: uint8(_BT_OTHER),
  27073. 149: uint8(_BT_OTHER),
  27074. 150: uint8(_BT_OTHER),
  27075. 151: uint8(_BT_OTHER),
  27076. 152: uint8(_BT_OTHER),
  27077. 153: uint8(_BT_OTHER),
  27078. 154: uint8(_BT_OTHER),
  27079. 155: uint8(_BT_OTHER),
  27080. 156: uint8(_BT_OTHER),
  27081. 157: uint8(_BT_OTHER),
  27082. 158: uint8(_BT_OTHER),
  27083. 159: uint8(_BT_OTHER),
  27084. 160: uint8(_BT_OTHER),
  27085. 161: uint8(_BT_OTHER),
  27086. 162: uint8(_BT_OTHER),
  27087. 163: uint8(_BT_OTHER),
  27088. 164: uint8(_BT_OTHER),
  27089. 165: uint8(_BT_OTHER),
  27090. 166: uint8(_BT_OTHER),
  27091. 167: uint8(_BT_OTHER),
  27092. 168: uint8(_BT_OTHER),
  27093. 169: uint8(_BT_OTHER),
  27094. 170: uint8(_BT_NMSTRT),
  27095. 171: uint8(_BT_OTHER),
  27096. 172: uint8(_BT_OTHER),
  27097. 173: uint8(_BT_OTHER),
  27098. 174: uint8(_BT_OTHER),
  27099. 175: uint8(_BT_OTHER),
  27100. 176: uint8(_BT_OTHER),
  27101. 177: uint8(_BT_OTHER),
  27102. 178: uint8(_BT_OTHER),
  27103. 179: uint8(_BT_OTHER),
  27104. 180: uint8(_BT_OTHER),
  27105. 181: uint8(_BT_NMSTRT),
  27106. 182: uint8(_BT_OTHER),
  27107. 183: uint8(_BT_NAME),
  27108. 184: uint8(_BT_OTHER),
  27109. 185: uint8(_BT_OTHER),
  27110. 186: uint8(_BT_NMSTRT),
  27111. 187: uint8(_BT_OTHER),
  27112. 188: uint8(_BT_OTHER),
  27113. 189: uint8(_BT_OTHER),
  27114. 190: uint8(_BT_OTHER),
  27115. 191: uint8(_BT_OTHER),
  27116. 192: uint8(_BT_NMSTRT),
  27117. 193: uint8(_BT_NMSTRT),
  27118. 194: uint8(_BT_NMSTRT),
  27119. 195: uint8(_BT_NMSTRT),
  27120. 196: uint8(_BT_NMSTRT),
  27121. 197: uint8(_BT_NMSTRT),
  27122. 198: uint8(_BT_NMSTRT),
  27123. 199: uint8(_BT_NMSTRT),
  27124. 200: uint8(_BT_NMSTRT),
  27125. 201: uint8(_BT_NMSTRT),
  27126. 202: uint8(_BT_NMSTRT),
  27127. 203: uint8(_BT_NMSTRT),
  27128. 204: uint8(_BT_NMSTRT),
  27129. 205: uint8(_BT_NMSTRT),
  27130. 206: uint8(_BT_NMSTRT),
  27131. 207: uint8(_BT_NMSTRT),
  27132. 208: uint8(_BT_NMSTRT),
  27133. 209: uint8(_BT_NMSTRT),
  27134. 210: uint8(_BT_NMSTRT),
  27135. 211: uint8(_BT_NMSTRT),
  27136. 212: uint8(_BT_NMSTRT),
  27137. 213: uint8(_BT_NMSTRT),
  27138. 214: uint8(_BT_NMSTRT),
  27139. 215: uint8(_BT_OTHER),
  27140. 216: uint8(_BT_NMSTRT),
  27141. 217: uint8(_BT_NMSTRT),
  27142. 218: uint8(_BT_NMSTRT),
  27143. 219: uint8(_BT_NMSTRT),
  27144. 220: uint8(_BT_NMSTRT),
  27145. 221: uint8(_BT_NMSTRT),
  27146. 222: uint8(_BT_NMSTRT),
  27147. 223: uint8(_BT_NMSTRT),
  27148. 224: uint8(_BT_NMSTRT),
  27149. 225: uint8(_BT_NMSTRT),
  27150. 226: uint8(_BT_NMSTRT),
  27151. 227: uint8(_BT_NMSTRT),
  27152. 228: uint8(_BT_NMSTRT),
  27153. 229: uint8(_BT_NMSTRT),
  27154. 230: uint8(_BT_NMSTRT),
  27155. 231: uint8(_BT_NMSTRT),
  27156. 232: uint8(_BT_NMSTRT),
  27157. 233: uint8(_BT_NMSTRT),
  27158. 234: uint8(_BT_NMSTRT),
  27159. 235: uint8(_BT_NMSTRT),
  27160. 236: uint8(_BT_NMSTRT),
  27161. 237: uint8(_BT_NMSTRT),
  27162. 238: uint8(_BT_NMSTRT),
  27163. 239: uint8(_BT_NMSTRT),
  27164. 240: uint8(_BT_NMSTRT),
  27165. 241: uint8(_BT_NMSTRT),
  27166. 242: uint8(_BT_NMSTRT),
  27167. 243: uint8(_BT_NMSTRT),
  27168. 244: uint8(_BT_NMSTRT),
  27169. 245: uint8(_BT_NMSTRT),
  27170. 246: uint8(_BT_NMSTRT),
  27171. 247: uint8(_BT_OTHER),
  27172. 248: uint8(_BT_NMSTRT),
  27173. 249: uint8(_BT_NMSTRT),
  27174. 250: uint8(_BT_NMSTRT),
  27175. 251: uint8(_BT_NMSTRT),
  27176. 252: uint8(_BT_NMSTRT),
  27177. 253: uint8(_BT_NMSTRT),
  27178. 254: uint8(_BT_NMSTRT),
  27179. 255: uint8(_BT_NMSTRT),
  27180. },
  27181. }
  27182. func init() {
  27183. p := unsafe.Pointer(&_big2_encoding_ns)
  27184. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27185. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_big2_contentTok)
  27186. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_cdataSectionTok)
  27187. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_big2_ignoreSectionTok)
  27188. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_attributeValueTok)
  27189. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_big2_entityValueTok)
  27190. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_nameMatchesAscii)
  27191. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_big2_nameLength)
  27192. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_skipS)
  27193. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_big2_getAtts)
  27194. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_charRefNumber)
  27195. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_big2_predefinedEntityName)
  27196. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_updatePosition)
  27197. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_big2_isPublicId)
  27198. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_toUtf8)
  27199. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_big2_toUtf16)
  27200. }
  27201. var _big2_encoding = Tnormal_encoding{
  27202. Fenc: TENCODING{
  27203. Fscanners: [4]TSCANNER{},
  27204. FliteralScanners: [2]TSCANNER{},
  27205. FminBytesPerChar: int32(2),
  27206. },
  27207. Ftype1: [256]uint8{
  27208. 9: uint8(_BT_S),
  27209. 10: uint8(_BT_LF),
  27210. 13: uint8(_BT_CR),
  27211. 32: uint8(_BT_S),
  27212. 33: uint8(_BT_EXCL),
  27213. 34: uint8(_BT_QUOT),
  27214. 35: uint8(_BT_NUM),
  27215. 36: uint8(_BT_OTHER),
  27216. 37: uint8(_BT_PERCNT),
  27217. 38: uint8(_BT_AMP),
  27218. 39: uint8(_BT_APOS),
  27219. 40: uint8(_BT_LPAR),
  27220. 41: uint8(_BT_RPAR),
  27221. 42: uint8(_BT_AST),
  27222. 43: uint8(_BT_PLUS),
  27223. 44: uint8(_BT_COMMA),
  27224. 45: uint8(_BT_MINUS),
  27225. 46: uint8(_BT_NAME),
  27226. 47: uint8(_BT_SOL),
  27227. 48: uint8(_BT_DIGIT),
  27228. 49: uint8(_BT_DIGIT),
  27229. 50: uint8(_BT_DIGIT),
  27230. 51: uint8(_BT_DIGIT),
  27231. 52: uint8(_BT_DIGIT),
  27232. 53: uint8(_BT_DIGIT),
  27233. 54: uint8(_BT_DIGIT),
  27234. 55: uint8(_BT_DIGIT),
  27235. 56: uint8(_BT_DIGIT),
  27236. 57: uint8(_BT_DIGIT),
  27237. 58: uint8(_BT_NMSTRT),
  27238. 59: uint8(_BT_SEMI),
  27239. 60: uint8(_BT_LT),
  27240. 61: uint8(_BT_EQUALS),
  27241. 62: uint8(_BT_GT),
  27242. 63: uint8(_BT_QUEST),
  27243. 64: uint8(_BT_OTHER),
  27244. 65: uint8(_BT_HEX),
  27245. 66: uint8(_BT_HEX),
  27246. 67: uint8(_BT_HEX),
  27247. 68: uint8(_BT_HEX),
  27248. 69: uint8(_BT_HEX),
  27249. 70: uint8(_BT_HEX),
  27250. 71: uint8(_BT_NMSTRT),
  27251. 72: uint8(_BT_NMSTRT),
  27252. 73: uint8(_BT_NMSTRT),
  27253. 74: uint8(_BT_NMSTRT),
  27254. 75: uint8(_BT_NMSTRT),
  27255. 76: uint8(_BT_NMSTRT),
  27256. 77: uint8(_BT_NMSTRT),
  27257. 78: uint8(_BT_NMSTRT),
  27258. 79: uint8(_BT_NMSTRT),
  27259. 80: uint8(_BT_NMSTRT),
  27260. 81: uint8(_BT_NMSTRT),
  27261. 82: uint8(_BT_NMSTRT),
  27262. 83: uint8(_BT_NMSTRT),
  27263. 84: uint8(_BT_NMSTRT),
  27264. 85: uint8(_BT_NMSTRT),
  27265. 86: uint8(_BT_NMSTRT),
  27266. 87: uint8(_BT_NMSTRT),
  27267. 88: uint8(_BT_NMSTRT),
  27268. 89: uint8(_BT_NMSTRT),
  27269. 90: uint8(_BT_NMSTRT),
  27270. 91: uint8(_BT_LSQB),
  27271. 92: uint8(_BT_OTHER),
  27272. 93: uint8(_BT_RSQB),
  27273. 94: uint8(_BT_OTHER),
  27274. 95: uint8(_BT_NMSTRT),
  27275. 96: uint8(_BT_OTHER),
  27276. 97: uint8(_BT_HEX),
  27277. 98: uint8(_BT_HEX),
  27278. 99: uint8(_BT_HEX),
  27279. 100: uint8(_BT_HEX),
  27280. 101: uint8(_BT_HEX),
  27281. 102: uint8(_BT_HEX),
  27282. 103: uint8(_BT_NMSTRT),
  27283. 104: uint8(_BT_NMSTRT),
  27284. 105: uint8(_BT_NMSTRT),
  27285. 106: uint8(_BT_NMSTRT),
  27286. 107: uint8(_BT_NMSTRT),
  27287. 108: uint8(_BT_NMSTRT),
  27288. 109: uint8(_BT_NMSTRT),
  27289. 110: uint8(_BT_NMSTRT),
  27290. 111: uint8(_BT_NMSTRT),
  27291. 112: uint8(_BT_NMSTRT),
  27292. 113: uint8(_BT_NMSTRT),
  27293. 114: uint8(_BT_NMSTRT),
  27294. 115: uint8(_BT_NMSTRT),
  27295. 116: uint8(_BT_NMSTRT),
  27296. 117: uint8(_BT_NMSTRT),
  27297. 118: uint8(_BT_NMSTRT),
  27298. 119: uint8(_BT_NMSTRT),
  27299. 120: uint8(_BT_NMSTRT),
  27300. 121: uint8(_BT_NMSTRT),
  27301. 122: uint8(_BT_NMSTRT),
  27302. 123: uint8(_BT_OTHER),
  27303. 124: uint8(_BT_VERBAR),
  27304. 125: uint8(_BT_OTHER),
  27305. 126: uint8(_BT_OTHER),
  27306. 127: uint8(_BT_OTHER),
  27307. 128: uint8(_BT_OTHER),
  27308. 129: uint8(_BT_OTHER),
  27309. 130: uint8(_BT_OTHER),
  27310. 131: uint8(_BT_OTHER),
  27311. 132: uint8(_BT_OTHER),
  27312. 133: uint8(_BT_OTHER),
  27313. 134: uint8(_BT_OTHER),
  27314. 135: uint8(_BT_OTHER),
  27315. 136: uint8(_BT_OTHER),
  27316. 137: uint8(_BT_OTHER),
  27317. 138: uint8(_BT_OTHER),
  27318. 139: uint8(_BT_OTHER),
  27319. 140: uint8(_BT_OTHER),
  27320. 141: uint8(_BT_OTHER),
  27321. 142: uint8(_BT_OTHER),
  27322. 143: uint8(_BT_OTHER),
  27323. 144: uint8(_BT_OTHER),
  27324. 145: uint8(_BT_OTHER),
  27325. 146: uint8(_BT_OTHER),
  27326. 147: uint8(_BT_OTHER),
  27327. 148: uint8(_BT_OTHER),
  27328. 149: uint8(_BT_OTHER),
  27329. 150: uint8(_BT_OTHER),
  27330. 151: uint8(_BT_OTHER),
  27331. 152: uint8(_BT_OTHER),
  27332. 153: uint8(_BT_OTHER),
  27333. 154: uint8(_BT_OTHER),
  27334. 155: uint8(_BT_OTHER),
  27335. 156: uint8(_BT_OTHER),
  27336. 157: uint8(_BT_OTHER),
  27337. 158: uint8(_BT_OTHER),
  27338. 159: uint8(_BT_OTHER),
  27339. 160: uint8(_BT_OTHER),
  27340. 161: uint8(_BT_OTHER),
  27341. 162: uint8(_BT_OTHER),
  27342. 163: uint8(_BT_OTHER),
  27343. 164: uint8(_BT_OTHER),
  27344. 165: uint8(_BT_OTHER),
  27345. 166: uint8(_BT_OTHER),
  27346. 167: uint8(_BT_OTHER),
  27347. 168: uint8(_BT_OTHER),
  27348. 169: uint8(_BT_OTHER),
  27349. 170: uint8(_BT_NMSTRT),
  27350. 171: uint8(_BT_OTHER),
  27351. 172: uint8(_BT_OTHER),
  27352. 173: uint8(_BT_OTHER),
  27353. 174: uint8(_BT_OTHER),
  27354. 175: uint8(_BT_OTHER),
  27355. 176: uint8(_BT_OTHER),
  27356. 177: uint8(_BT_OTHER),
  27357. 178: uint8(_BT_OTHER),
  27358. 179: uint8(_BT_OTHER),
  27359. 180: uint8(_BT_OTHER),
  27360. 181: uint8(_BT_NMSTRT),
  27361. 182: uint8(_BT_OTHER),
  27362. 183: uint8(_BT_NAME),
  27363. 184: uint8(_BT_OTHER),
  27364. 185: uint8(_BT_OTHER),
  27365. 186: uint8(_BT_NMSTRT),
  27366. 187: uint8(_BT_OTHER),
  27367. 188: uint8(_BT_OTHER),
  27368. 189: uint8(_BT_OTHER),
  27369. 190: uint8(_BT_OTHER),
  27370. 191: uint8(_BT_OTHER),
  27371. 192: uint8(_BT_NMSTRT),
  27372. 193: uint8(_BT_NMSTRT),
  27373. 194: uint8(_BT_NMSTRT),
  27374. 195: uint8(_BT_NMSTRT),
  27375. 196: uint8(_BT_NMSTRT),
  27376. 197: uint8(_BT_NMSTRT),
  27377. 198: uint8(_BT_NMSTRT),
  27378. 199: uint8(_BT_NMSTRT),
  27379. 200: uint8(_BT_NMSTRT),
  27380. 201: uint8(_BT_NMSTRT),
  27381. 202: uint8(_BT_NMSTRT),
  27382. 203: uint8(_BT_NMSTRT),
  27383. 204: uint8(_BT_NMSTRT),
  27384. 205: uint8(_BT_NMSTRT),
  27385. 206: uint8(_BT_NMSTRT),
  27386. 207: uint8(_BT_NMSTRT),
  27387. 208: uint8(_BT_NMSTRT),
  27388. 209: uint8(_BT_NMSTRT),
  27389. 210: uint8(_BT_NMSTRT),
  27390. 211: uint8(_BT_NMSTRT),
  27391. 212: uint8(_BT_NMSTRT),
  27392. 213: uint8(_BT_NMSTRT),
  27393. 214: uint8(_BT_NMSTRT),
  27394. 215: uint8(_BT_OTHER),
  27395. 216: uint8(_BT_NMSTRT),
  27396. 217: uint8(_BT_NMSTRT),
  27397. 218: uint8(_BT_NMSTRT),
  27398. 219: uint8(_BT_NMSTRT),
  27399. 220: uint8(_BT_NMSTRT),
  27400. 221: uint8(_BT_NMSTRT),
  27401. 222: uint8(_BT_NMSTRT),
  27402. 223: uint8(_BT_NMSTRT),
  27403. 224: uint8(_BT_NMSTRT),
  27404. 225: uint8(_BT_NMSTRT),
  27405. 226: uint8(_BT_NMSTRT),
  27406. 227: uint8(_BT_NMSTRT),
  27407. 228: uint8(_BT_NMSTRT),
  27408. 229: uint8(_BT_NMSTRT),
  27409. 230: uint8(_BT_NMSTRT),
  27410. 231: uint8(_BT_NMSTRT),
  27411. 232: uint8(_BT_NMSTRT),
  27412. 233: uint8(_BT_NMSTRT),
  27413. 234: uint8(_BT_NMSTRT),
  27414. 235: uint8(_BT_NMSTRT),
  27415. 236: uint8(_BT_NMSTRT),
  27416. 237: uint8(_BT_NMSTRT),
  27417. 238: uint8(_BT_NMSTRT),
  27418. 239: uint8(_BT_NMSTRT),
  27419. 240: uint8(_BT_NMSTRT),
  27420. 241: uint8(_BT_NMSTRT),
  27421. 242: uint8(_BT_NMSTRT),
  27422. 243: uint8(_BT_NMSTRT),
  27423. 244: uint8(_BT_NMSTRT),
  27424. 245: uint8(_BT_NMSTRT),
  27425. 246: uint8(_BT_NMSTRT),
  27426. 247: uint8(_BT_OTHER),
  27427. 248: uint8(_BT_NMSTRT),
  27428. 249: uint8(_BT_NMSTRT),
  27429. 250: uint8(_BT_NMSTRT),
  27430. 251: uint8(_BT_NMSTRT),
  27431. 252: uint8(_BT_NMSTRT),
  27432. 253: uint8(_BT_NMSTRT),
  27433. 254: uint8(_BT_NMSTRT),
  27434. 255: uint8(_BT_NMSTRT),
  27435. },
  27436. }
  27437. func init() {
  27438. p := unsafe.Pointer(&_big2_encoding)
  27439. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  27440. *(*uintptr)(unsafe.Add(p, 4)) = __ccgo_fp(_big2_contentTok)
  27441. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_cdataSectionTok)
  27442. *(*uintptr)(unsafe.Add(p, 12)) = __ccgo_fp(_big2_ignoreSectionTok)
  27443. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_attributeValueTok)
  27444. *(*uintptr)(unsafe.Add(p, 20)) = __ccgo_fp(_big2_entityValueTok)
  27445. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_nameMatchesAscii)
  27446. *(*uintptr)(unsafe.Add(p, 28)) = __ccgo_fp(_big2_nameLength)
  27447. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_skipS)
  27448. *(*uintptr)(unsafe.Add(p, 36)) = __ccgo_fp(_big2_getAtts)
  27449. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_charRefNumber)
  27450. *(*uintptr)(unsafe.Add(p, 44)) = __ccgo_fp(_big2_predefinedEntityName)
  27451. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_updatePosition)
  27452. *(*uintptr)(unsafe.Add(p, 52)) = __ccgo_fp(_big2_isPublicId)
  27453. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_toUtf8)
  27454. *(*uintptr)(unsafe.Add(p, 60)) = __ccgo_fp(_big2_toUtf16)
  27455. }
  27456. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  27457. var c1, c2 int8
  27458. var v2, v3 uintptr
  27459. _, _, _, _ = c1, c2, v2, v3
  27460. for {
  27461. v2 = s1
  27462. s1++
  27463. c1 = *(*int8)(unsafe.Pointer(v2))
  27464. v3 = s2
  27465. s2++
  27466. c2 = *(*int8)(unsafe.Pointer(v3))
  27467. if int32(m_ASCII_a2) <= int32(c1) && int32(c1) <= int32(m_ASCII_z1) {
  27468. c1 = int8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27469. }
  27470. if int32(m_ASCII_a2) <= int32(c2) && int32(c2) <= int32(m_ASCII_z1) {
  27471. /* The following line will never get executed. streqci() is
  27472. * only called from two places, both of which guarantee to put
  27473. * upper-case strings into s2.
  27474. */
  27475. c2 = int8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a2)))
  27476. } /* LCOV_EXCL_LINE */
  27477. if int32(c1) != int32(c2) {
  27478. return 0
  27479. }
  27480. if !(c1 != 0) {
  27481. break
  27482. }
  27483. goto _1
  27484. _1:
  27485. }
  27486. return int32(1)
  27487. }
  27488. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  27489. _ = enc
  27490. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  27491. }
  27492. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  27493. bp := tls.Alloc(16)
  27494. defer tls.Free(16)
  27495. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27496. var _ /* buf at bp+4 */ [1]int8
  27497. var _ /* p at bp+8 */ uintptr
  27498. *(*uintptr)(unsafe.Pointer(bp + 8)) = bp + 4
  27499. (*(*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, *(*uintptr)(unsafe.Pointer(bp + 8))+uintptr(1))
  27500. if *(*uintptr)(unsafe.Pointer(bp + 8)) == bp+4 {
  27501. return -int32(1)
  27502. } else {
  27503. return int32((*(*[1]int8)(unsafe.Pointer(bp + 4)))[0])
  27504. }
  27505. return r
  27506. }
  27507. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  27508. switch c {
  27509. case int32(0x20):
  27510. fallthrough
  27511. case int32(0xD):
  27512. fallthrough
  27513. case int32(0xA):
  27514. fallthrough
  27515. case int32(0x9):
  27516. return int32(1)
  27517. }
  27518. return 0
  27519. }
  27520. // C documentation
  27521. //
  27522. // /* Return 1 if there's just optional white space or there's an S
  27523. // followed by name=val.
  27524. // */
  27525. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  27526. var c, v2 int32
  27527. var open int8
  27528. _, _, _ = c, open, v2
  27529. if ptr == end {
  27530. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27531. return int32(1)
  27532. }
  27533. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  27534. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27535. return 0
  27536. }
  27537. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  27538. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27539. }
  27540. if ptr == end {
  27541. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  27542. return int32(1)
  27543. }
  27544. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  27545. for {
  27546. c = _toAscii(tls, enc, ptr, end)
  27547. if c == -int32(1) {
  27548. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27549. return 0
  27550. }
  27551. if c == int32(m_ASCII_EQUALS2) {
  27552. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27553. break
  27554. }
  27555. if _isSpace(tls, c) != 0 {
  27556. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  27557. for {
  27558. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27559. goto _3
  27560. _3:
  27561. ;
  27562. v2 = _toAscii(tls, enc, ptr, end)
  27563. c = v2
  27564. if !(_isSpace(tls, v2) != 0) {
  27565. break
  27566. }
  27567. }
  27568. if c != int32(m_ASCII_EQUALS2) {
  27569. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27570. return 0
  27571. }
  27572. break
  27573. }
  27574. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27575. goto _1
  27576. _1:
  27577. }
  27578. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  27579. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27580. return 0
  27581. }
  27582. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27583. c = _toAscii(tls, enc, ptr, end)
  27584. for _isSpace(tls, c) != 0 {
  27585. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27586. c = _toAscii(tls, enc, ptr, end)
  27587. }
  27588. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  27589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27590. return 0
  27591. }
  27592. open = int8(c)
  27593. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27594. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  27595. for {
  27596. c = _toAscii(tls, enc, ptr, end)
  27597. if c == int32(open) {
  27598. break
  27599. }
  27600. 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) {
  27601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  27602. return 0
  27603. }
  27604. goto _4
  27605. _4:
  27606. ;
  27607. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27608. }
  27609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27610. return int32(1)
  27611. }
  27612. var _KW_version = [8]int8{
  27613. 0: int8(m_ASCII_v1),
  27614. 1: int8(m_ASCII_e2),
  27615. 2: int8(m_ASCII_r2),
  27616. 3: int8(m_ASCII_s2),
  27617. 4: int8(m_ASCII_i1),
  27618. 5: int8(m_ASCII_o2),
  27619. 6: int8(m_ASCII_n2),
  27620. }
  27621. var _KW_encoding = [9]int8{
  27622. 0: int8(m_ASCII_e2),
  27623. 1: int8(m_ASCII_n2),
  27624. 2: int8(m_ASCII_c2),
  27625. 3: int8(m_ASCII_o2),
  27626. 4: int8(m_ASCII_d1),
  27627. 5: int8(m_ASCII_i1),
  27628. 6: int8(m_ASCII_n2),
  27629. 7: int8(m_ASCII_g2),
  27630. }
  27631. var _KW_standalone = [11]int8{
  27632. 0: int8(m_ASCII_s2),
  27633. 1: int8(m_ASCII_t2),
  27634. 2: int8(m_ASCII_a2),
  27635. 3: int8(m_ASCII_n2),
  27636. 4: int8(m_ASCII_d1),
  27637. 5: int8(m_ASCII_a2),
  27638. 6: int8(m_ASCII_l2),
  27639. 7: int8(m_ASCII_o2),
  27640. 8: int8(m_ASCII_n2),
  27641. 9: int8(m_ASCII_e2),
  27642. }
  27643. var _KW_yes = [4]int8{
  27644. 0: int8(m_ASCII_y1),
  27645. 1: int8(m_ASCII_e2),
  27646. 2: int8(m_ASCII_s2),
  27647. }
  27648. var _KW_no = [3]int8{
  27649. 0: int8(m_ASCII_n2),
  27650. 1: int8(m_ASCII_o2),
  27651. }
  27652. 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) {
  27653. bp := tls.Alloc(16)
  27654. defer tls.Free(16)
  27655. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  27656. var c int32
  27657. var _ /* name at bp+8 */ uintptr
  27658. var _ /* nameEnd at bp+12 */ uintptr
  27659. var _ /* val at bp+4 */ uintptr
  27660. _ = c
  27661. *(*uintptr)(unsafe.Pointer(bp + 4)) = libc.UintptrFromInt32(0)
  27662. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  27663. *(*uintptr)(unsafe.Pointer(bp + 12)) = libc.UintptrFromInt32(0)
  27664. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27665. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27666. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8, bp+12, bp+4, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  27667. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27668. return 0
  27669. }
  27670. 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 + 12)), uintptr(unsafe.Pointer(&_KW_version))) != 0) {
  27671. if !(isGeneralTextEntity != 0) {
  27672. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27673. return 0
  27674. }
  27675. } else {
  27676. if versionPtr != 0 {
  27677. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27678. }
  27679. if versionEndPtr != 0 {
  27680. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27681. }
  27682. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8, bp+12, bp+4, bp) != 0) {
  27683. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27684. return 0
  27685. }
  27686. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  27687. if isGeneralTextEntity != 0 {
  27688. /* a TextDecl must have an EncodingDecl */
  27689. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27690. return 0
  27691. }
  27692. return int32(1)
  27693. }
  27694. }
  27695. 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 + 12)), uintptr(unsafe.Pointer(&_KW_encoding))) != 0 {
  27696. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), end)
  27697. if !(int32(m_ASCII_a2) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  27698. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27699. return 0
  27700. }
  27701. if encodingName != 0 {
  27702. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27703. }
  27704. if encoding != 0 {
  27705. *(*uintptr)(unsafe.Pointer(encoding)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{encodingFinder})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  27706. }
  27707. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8, bp+12, bp+4, bp) != 0) {
  27708. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27709. return 0
  27710. }
  27711. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  27712. return int32(1)
  27713. }
  27714. }
  27715. 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 + 12)), uintptr(unsafe.Pointer(&_KW_standalone))) != 0) || isGeneralTextEntity != 0 {
  27716. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  27717. return 0
  27718. }
  27719. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_yes))) != 0 {
  27720. if standalone != 0 {
  27721. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  27722. }
  27723. } else {
  27724. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 4)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_no))) != 0 {
  27725. if standalone != 0 {
  27726. *(*int32)(unsafe.Pointer(standalone)) = 0
  27727. }
  27728. } else {
  27729. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 4))
  27730. return 0
  27731. }
  27732. }
  27733. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  27734. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  27735. }
  27736. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  27737. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  27738. return 0
  27739. }
  27740. return int32(1)
  27741. }
  27742. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  27743. switch result >> libc.Int32FromInt32(8) {
  27744. case int32(0xD8):
  27745. fallthrough
  27746. case int32(0xD9):
  27747. fallthrough
  27748. case int32(0xDA):
  27749. fallthrough
  27750. case int32(0xDB):
  27751. fallthrough
  27752. case int32(0xDC):
  27753. fallthrough
  27754. case int32(0xDD):
  27755. fallthrough
  27756. case int32(0xDE):
  27757. fallthrough
  27758. case int32(0xDF):
  27759. return -int32(1)
  27760. case 0:
  27761. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(result)))) == int32(_BT_NONXML) {
  27762. return -int32(1)
  27763. }
  27764. case int32(0xFF):
  27765. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  27766. return -int32(1)
  27767. }
  27768. break
  27769. }
  27770. return result
  27771. }
  27772. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  27773. if c < 0 {
  27774. return 0
  27775. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  27776. if c < 128 {
  27777. *(*int8)(unsafe.Pointer(buf)) = int8(c | int32(_UTF8_cval1))
  27778. return int32(1)
  27779. }
  27780. if c < 2048 {
  27781. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  27782. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27783. return int32(2)
  27784. }
  27785. if c < 65536 {
  27786. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  27787. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27788. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27789. return int32(3)
  27790. }
  27791. if c < int32(0x110000) {
  27792. *(*int8)(unsafe.Pointer(buf)) = int8(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  27793. *(*int8)(unsafe.Pointer(buf + 1)) = int8(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27794. *(*int8)(unsafe.Pointer(buf + 2)) = int8(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27795. *(*int8)(unsafe.Pointer(buf + 3)) = int8(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  27796. return int32(4)
  27797. }
  27798. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  27799. }
  27800. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  27801. if charNum < 0 {
  27802. return 0
  27803. }
  27804. if charNum < int32(0x10000) {
  27805. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  27806. return int32(1)
  27807. }
  27808. if charNum < int32(0x110000) {
  27809. charNum -= int32(0x10000)
  27810. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  27811. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  27812. return int32(2)
  27813. }
  27814. return 0
  27815. }
  27816. type Tunknown_encoding = struct {
  27817. Fnormal Tnormal_encoding
  27818. Fconvert TCONVERTER
  27819. FuserData uintptr
  27820. Futf16 [256]uint16
  27821. Futf8 [256][4]int8
  27822. }
  27823. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  27824. return int32(1908)
  27825. }
  27826. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27827. var c int32
  27828. var uenc uintptr
  27829. _, _ = c, uenc
  27830. uenc = enc
  27831. 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)
  27832. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27833. return 0
  27834. }
  27835. 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))))
  27836. }
  27837. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27838. var c int32
  27839. var uenc uintptr
  27840. _, _ = c, uenc
  27841. uenc = enc
  27842. 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)
  27843. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  27844. return 0
  27845. }
  27846. 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))))
  27847. }
  27848. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  27849. var c int32
  27850. var uenc uintptr
  27851. _, _ = c, uenc
  27852. uenc = enc
  27853. 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)
  27854. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  27855. }
  27856. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27857. bp := tls.Alloc(16)
  27858. defer tls.Free(16)
  27859. var c, n int32
  27860. var uenc, utf8, v2 uintptr
  27861. var _ /* buf at bp+0 */ [4]int8
  27862. _, _, _, _, _ = c, n, uenc, utf8, v2
  27863. uenc = enc
  27864. for {
  27865. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  27866. return int32(_XML_CONVERT_COMPLETED)
  27867. }
  27868. utf8 = uenc + 884 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*4
  27869. v2 = utf8
  27870. utf8++
  27871. n = int32(*(*int8)(unsafe.Pointer(v2)))
  27872. if n == 0 {
  27873. 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)))
  27874. n = XXmlUtf8Encode(tls, c, bp)
  27875. if n > int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) {
  27876. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27877. }
  27878. utf8 = bp
  27879. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27880. } else {
  27881. if n > int32(toLim)-int32(*(*uintptr)(unsafe.Pointer(toP))) {
  27882. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27883. }
  27884. *(*uintptr)(unsafe.Pointer(fromP))++
  27885. }
  27886. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint32FromInt32(n))
  27887. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  27888. goto _1
  27889. _1:
  27890. }
  27891. return r
  27892. }
  27893. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  27894. var c uint16
  27895. var uenc, v1, v2 uintptr
  27896. _, _, _, _ = c, uenc, v1, v2
  27897. uenc = enc
  27898. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  27899. c = *(*uint16)(unsafe.Pointer(uenc + 372 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))*2))
  27900. if libc.Int32FromUint16(c) == 0 {
  27901. 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))))
  27902. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 72 + uintptr(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  27903. } else {
  27904. *(*uintptr)(unsafe.Pointer(fromP))++
  27905. }
  27906. v2 = toP
  27907. v1 = *(*uintptr)(unsafe.Pointer(v2))
  27908. *(*uintptr)(unsafe.Pointer(v2)) += 2
  27909. *(*uint16)(unsafe.Pointer(v1)) = c
  27910. }
  27911. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  27912. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  27913. } else {
  27914. return int32(_XML_CONVERT_COMPLETED)
  27915. }
  27916. return r
  27917. }
  27918. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  27919. var c, i, v3 int32
  27920. var e uintptr
  27921. _, _, _, _ = c, e, i, v3
  27922. e = mem
  27923. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint32(364))
  27924. i = 0
  27925. for {
  27926. if !(i < int32(128)) {
  27927. break
  27928. }
  27929. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(i)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(i)))) != int32(_BT_NONXML) && *(*int32)(unsafe.Pointer(table + uintptr(i)*4)) != i {
  27930. return uintptr(0)
  27931. }
  27932. goto _1
  27933. _1:
  27934. ;
  27935. i++
  27936. }
  27937. i = 0
  27938. for {
  27939. if !(i < int32(256)) {
  27940. break
  27941. }
  27942. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  27943. if c == -int32(1) {
  27944. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_MALFORM)
  27945. /* This shouldn't really get used. */
  27946. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = uint16(0xFFFF)
  27947. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = int8(1)
  27948. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4 + 1)) = 0
  27949. } else {
  27950. if c < 0 {
  27951. if c < -int32(4) {
  27952. return uintptr(0)
  27953. }
  27954. /* Multi-byte sequences need a converter function */
  27955. if !(convert != 0) {
  27956. return uintptr(0)
  27957. }
  27958. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  27959. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = 0
  27960. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = uint16(0)
  27961. } else {
  27962. if c < int32(0x80) {
  27963. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(c)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(c)))) != int32(_BT_NONXML) && c != i {
  27964. return uintptr(0)
  27965. }
  27966. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 72 + uintptr(c)))
  27967. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = int8(1)
  27968. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4 + 1)) = int8(c)
  27969. if c == 0 {
  27970. v3 = int32(0xFFFF)
  27971. } else {
  27972. v3 = c
  27973. }
  27974. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  27975. } else {
  27976. if _checkCharRefNumber(tls, c) < 0 {
  27977. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_NONXML)
  27978. /* This shouldn't really get used. */
  27979. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = uint16(0xFFFF)
  27980. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = int8(1)
  27981. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4 + 1)) = 0
  27982. } else {
  27983. if c > int32(0xFFFF) {
  27984. return uintptr(0)
  27985. }
  27986. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27987. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_NMSTRT)
  27988. } else {
  27989. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  27990. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_NAME)
  27991. } else {
  27992. *(*uint8)(unsafe.Pointer(e + 72 + uintptr(i))) = uint8(_BT_OTHER)
  27993. }
  27994. }
  27995. *(*int8)(unsafe.Pointer(e + 884 + uintptr(i)*4)) = int8(XXmlUtf8Encode(tls, c, e+884+uintptr(i)*4+uintptr(1)))
  27996. *(*uint16)(unsafe.Pointer(e + 372 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  27997. }
  27998. }
  27999. }
  28000. }
  28001. goto _2
  28002. _2:
  28003. ;
  28004. i++
  28005. }
  28006. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  28007. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  28008. if convert != 0 {
  28009. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  28010. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  28011. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  28012. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  28013. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  28014. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  28015. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  28016. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  28017. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  28018. }
  28019. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  28020. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  28021. return e
  28022. }
  28023. const _UNKNOWN_ENC = -1
  28024. const _ISO_8859_1_ENC = 0
  28025. const _US_ASCII_ENC = 1
  28026. const _UTF_8_ENC = 2
  28027. const _UTF_16_ENC = 3
  28028. const _UTF_16BE_ENC = 4
  28029. const _UTF_16LE_ENC = 5
  28030. const
  28031. /* must match encodingNames up to here */
  28032. _NO_ENC = 6
  28033. var _KW_ISO_8859_1 = [11]int8{
  28034. 0: int8(m_ASCII_I),
  28035. 1: int8(m_ASCII_S),
  28036. 2: int8(m_ASCII_O),
  28037. 3: int8(m_ASCII_MINUS1),
  28038. 4: int8(m_ASCII_82),
  28039. 5: int8(m_ASCII_82),
  28040. 6: int8(m_ASCII_51),
  28041. 7: int8(m_ASCII_92),
  28042. 8: int8(m_ASCII_MINUS1),
  28043. 9: int8(m_ASCII_12),
  28044. }
  28045. var _KW_US_ASCII = [9]int8{
  28046. 0: int8(m_ASCII_U1),
  28047. 1: int8(m_ASCII_S),
  28048. 2: int8(m_ASCII_MINUS1),
  28049. 3: int8(m_ASCII_A),
  28050. 4: int8(m_ASCII_S),
  28051. 5: int8(m_ASCII_C),
  28052. 6: int8(m_ASCII_I),
  28053. 7: int8(m_ASCII_I),
  28054. }
  28055. var _KW_UTF_8 = [6]int8{
  28056. 0: int8(m_ASCII_U1),
  28057. 1: int8(m_ASCII_T),
  28058. 2: int8(m_ASCII_F),
  28059. 3: int8(m_ASCII_MINUS1),
  28060. 4: int8(m_ASCII_82),
  28061. }
  28062. var _KW_UTF_16 = [7]int8{
  28063. 0: int8(m_ASCII_U1),
  28064. 1: int8(m_ASCII_T),
  28065. 2: int8(m_ASCII_F),
  28066. 3: int8(m_ASCII_MINUS1),
  28067. 4: int8(m_ASCII_12),
  28068. 5: int8(m_ASCII_61),
  28069. }
  28070. var _KW_UTF_16BE = [9]int8{
  28071. 0: int8(m_ASCII_U1),
  28072. 1: int8(m_ASCII_T),
  28073. 2: int8(m_ASCII_F),
  28074. 3: int8(m_ASCII_MINUS1),
  28075. 4: int8(m_ASCII_12),
  28076. 5: int8(m_ASCII_61),
  28077. 6: int8(m_ASCII_B1),
  28078. 7: int8(m_ASCII_E),
  28079. }
  28080. var _KW_UTF_16LE = [9]int8{
  28081. 0: int8(m_ASCII_U1),
  28082. 1: int8(m_ASCII_T),
  28083. 2: int8(m_ASCII_F),
  28084. 3: int8(m_ASCII_MINUS1),
  28085. 4: int8(m_ASCII_12),
  28086. 5: int8(m_ASCII_61),
  28087. 6: int8(m_ASCII_L),
  28088. 7: int8(m_ASCII_E),
  28089. }
  28090. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  28091. var i int32
  28092. _ = i
  28093. if name == libc.UintptrFromInt32(0) {
  28094. return int32(_NO_ENC)
  28095. }
  28096. i = 0
  28097. for {
  28098. if !(i < libc.Int32FromUint32(libc.Uint32FromInt64(24)/libc.Uint32FromInt64(4))) {
  28099. break
  28100. }
  28101. if _streqci(tls, name, _encodingNames[i]) != 0 {
  28102. return i
  28103. }
  28104. goto _1
  28105. _1:
  28106. ;
  28107. i++
  28108. }
  28109. return int32(_UNKNOWN_ENC)
  28110. }
  28111. var _encodingNames = [6]uintptr{
  28112. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  28113. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  28114. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  28115. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  28116. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  28117. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  28118. }
  28119. /* For binary compatibility, we store the index of the encoding
  28120. specified at initialization in the isUtf16 member.
  28121. */
  28122. /* This is what detects the encoding. encodingTable maps from
  28123. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  28124. the external (protocol) specified encoding; state is
  28125. XML_CONTENT_STATE if we're parsing an external text entity, and
  28126. XML_PROLOG_STATE otherwise.
  28127. */
  28128. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28129. var e int32
  28130. var encPtr uintptr
  28131. _, _ = e, encPtr
  28132. if ptr >= end {
  28133. return -int32(4)
  28134. }
  28135. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  28136. if ptr+uintptr(1) == end {
  28137. /* only a single byte available for auto-detection */
  28138. /* so we're parsing an external text entity... */
  28139. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  28140. switch int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  28141. case int32(_UTF_16_ENC):
  28142. fallthrough
  28143. case int32(_UTF_16LE_ENC):
  28144. fallthrough
  28145. case int32(_UTF_16BE_ENC):
  28146. return -int32(1)
  28147. }
  28148. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr)))) {
  28149. case int32(0xFE):
  28150. fallthrough
  28151. case int32(0xFF):
  28152. fallthrough
  28153. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  28154. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28155. break
  28156. }
  28157. /* fall through */
  28158. fallthrough
  28159. case 0x00:
  28160. fallthrough
  28161. case int32(0x3C):
  28162. return -int32(1)
  28163. }
  28164. } else {
  28165. switch libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr))))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 1)))) {
  28166. case int32(0xFEFF):
  28167. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28168. break
  28169. }
  28170. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28171. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*4))
  28172. return int32(m_XML_TOK_BOM)
  28173. /* 00 3C is handled in the default case */
  28174. fallthrough
  28175. case int32(0x3C00):
  28176. if (int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  28177. break
  28178. }
  28179. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*4))
  28180. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28181. case int32(0xFFFE):
  28182. if int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  28183. break
  28184. }
  28185. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  28186. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*4))
  28187. return int32(m_XML_TOK_BOM)
  28188. case int32(0xEFBB):
  28189. /* Maybe a UTF-8 BOM (EF BB BF) */
  28190. /* If there's an explicitly specified (external) encoding
  28191. of ISO-8859-1 or some flavour of UTF-16
  28192. and this is an external text entity,
  28193. don't look for the BOM,
  28194. because it might be a legal data.
  28195. */
  28196. if state == int32(m_XML_CONTENT_STATE) {
  28197. e = int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  28198. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  28199. break
  28200. }
  28201. }
  28202. if ptr+uintptr(2) == end {
  28203. return -int32(1)
  28204. }
  28205. if libc.Int32FromUint8(libc.Uint8FromInt8(*(*int8)(unsafe.Pointer(ptr + 2)))) == int32(0xBF) {
  28206. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  28207. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*4))
  28208. return int32(m_XML_TOK_BOM)
  28209. }
  28210. default:
  28211. if int32(*(*int8)(unsafe.Pointer(ptr))) == int32('\000') {
  28212. /* 0 isn't a legal data character. Furthermore a document
  28213. entity can only start with ASCII characters. So the only
  28214. way this can fail to be big-endian UTF-16 if it it's an
  28215. external parsed general entity that's labelled as
  28216. UTF-16LE.
  28217. */
  28218. if state == int32(m_XML_CONTENT_STATE) && int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  28219. break
  28220. }
  28221. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*4))
  28222. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28223. } else {
  28224. if int32(*(*int8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  28225. /* We could recover here in the case:
  28226. - parsing an external entity
  28227. - second byte is 0
  28228. - no externally specified encoding
  28229. - no encoding declaration
  28230. by assuming UTF-16LE. But we don't, because this would mean when
  28231. presented just with a single byte, we couldn't reliably determine
  28232. whether we needed further bytes.
  28233. */
  28234. if state == int32(m_XML_CONTENT_STATE) {
  28235. break
  28236. }
  28237. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*4))
  28238. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28239. }
  28240. }
  28241. break
  28242. }
  28243. }
  28244. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(int32((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*4))
  28245. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*4))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  28246. }
  28247. /* This file is included!
  28248. __ __ _
  28249. ___\ \/ /_ __ __ _| |_
  28250. / _ \\ /| '_ \ / _` | __|
  28251. | __// \| |_) | (_| | |_
  28252. \___/_/\_\ .__/ \__,_|\__|
  28253. |_| XML parser
  28254. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28255. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28256. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28257. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28258. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28259. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28260. Licensed under the MIT license:
  28261. Permission is hereby granted, free of charge, to any person obtaining
  28262. a copy of this software and associated documentation files (the
  28263. "Software"), to deal in the Software without restriction, including
  28264. without limitation the rights to use, copy, modify, merge, publish,
  28265. distribute, sublicense, and/or sell copies of the Software, and to permit
  28266. persons to whom the Software is furnished to do so, subject to the
  28267. following conditions:
  28268. The above copyright notice and this permission notice shall be included
  28269. in all copies or substantial portions of the Software.
  28270. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28271. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28272. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28273. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28274. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28275. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28276. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28277. */
  28278. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  28279. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  28280. }
  28281. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  28282. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  28283. }
  28284. var _encodings = [7]uintptr{
  28285. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  28286. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  28287. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28288. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  28289. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  28290. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  28291. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  28292. }
  28293. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28294. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28295. }
  28296. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28297. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28298. }
  28299. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28300. var i int32
  28301. _ = i
  28302. i = _getEncodingIndex(tls, name)
  28303. if i == int32(_UNKNOWN_ENC) {
  28304. return 0
  28305. }
  28306. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28307. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  28308. *(*TSCANNER)(unsafe.Pointer(p + 1*4)) = __ccgo_fp(_initScanContent)
  28309. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28310. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28311. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28312. return int32(1)
  28313. }
  28314. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28315. bp := tls.Alloc(144)
  28316. defer tls.Free(144)
  28317. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28318. var i int32
  28319. var _ /* buf at bp+4 */ [128]int8
  28320. var _ /* p at bp+132 */ uintptr
  28321. _ = i
  28322. *(*[128]int8)(unsafe.Pointer(bp + 4)) = [128]int8{}
  28323. *(*uintptr)(unsafe.Pointer(bp + 132)) = bp + 4
  28324. (*(*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+132, *(*uintptr)(unsafe.Pointer(bp + 132))+uintptr(m_ENCODING_MAX)-uintptr(1))
  28325. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28326. return uintptr(0)
  28327. }
  28328. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))) = 0
  28329. if _streqci(tls, bp+4, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28330. return enc
  28331. }
  28332. i = _getEncodingIndex(tls, bp+4)
  28333. if i == int32(_UNKNOWN_ENC) {
  28334. return uintptr(0)
  28335. }
  28336. return _encodings[i]
  28337. }
  28338. 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) {
  28339. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28340. }
  28341. /* This file is included!
  28342. __ __ _
  28343. ___\ \/ /_ __ __ _| |_
  28344. / _ \\ /| '_ \ / _` | __|
  28345. | __// \| |_) | (_| | |_
  28346. \___/_/\_\ .__/ \__,_|\__|
  28347. |_| XML parser
  28348. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  28349. Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
  28350. Copyright (c) 2002 Greg Stein <gstein@users.sourceforge.net>
  28351. Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
  28352. Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
  28353. Copyright (c) 2017-2021 Sebastian Pipping <sebastian@pipping.org>
  28354. Licensed under the MIT license:
  28355. Permission is hereby granted, free of charge, to any person obtaining
  28356. a copy of this software and associated documentation files (the
  28357. "Software"), to deal in the Software without restriction, including
  28358. without limitation the rights to use, copy, modify, merge, publish,
  28359. distribute, sublicense, and/or sell copies of the Software, and to permit
  28360. persons to whom the Software is furnished to do so, subject to the
  28361. following conditions:
  28362. The above copyright notice and this permission notice shall be included
  28363. in all copies or substantial portions of the Software.
  28364. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  28365. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  28366. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  28367. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  28368. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  28369. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  28370. USE OR OTHER DEALINGS IN THE SOFTWARE.
  28371. */
  28372. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28373. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  28374. }
  28375. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  28376. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  28377. }
  28378. var _encodingsNS = [7]uintptr{
  28379. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  28380. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  28381. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28382. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28383. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  28384. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  28385. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  28386. }
  28387. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28388. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  28389. }
  28390. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  28391. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  28392. }
  28393. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  28394. var i int32
  28395. _ = i
  28396. i = _getEncodingIndex(tls, name)
  28397. if i == int32(_UNKNOWN_ENC) {
  28398. return 0
  28399. }
  28400. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = int8(i)
  28401. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  28402. *(*TSCANNER)(unsafe.Pointer(p + 1*4)) = __ccgo_fp(_initScanContentNS)
  28403. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  28404. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  28405. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  28406. return int32(1)
  28407. }
  28408. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  28409. bp := tls.Alloc(144)
  28410. defer tls.Free(144)
  28411. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  28412. var i int32
  28413. var _ /* buf at bp+4 */ [128]int8
  28414. var _ /* p at bp+132 */ uintptr
  28415. _ = i
  28416. *(*[128]int8)(unsafe.Pointer(bp + 4)) = [128]int8{}
  28417. *(*uintptr)(unsafe.Pointer(bp + 132)) = bp + 4
  28418. (*(*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+132, *(*uintptr)(unsafe.Pointer(bp + 132))+uintptr(m_ENCODING_MAX)-uintptr(1))
  28419. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  28420. return uintptr(0)
  28421. }
  28422. *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 132)))) = 0
  28423. if _streqci(tls, bp+4, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  28424. return enc
  28425. }
  28426. i = _getEncodingIndex(tls, bp+4)
  28427. if i == int32(_UNKNOWN_ENC) {
  28428. return uintptr(0)
  28429. }
  28430. return _encodingsNS[i]
  28431. }
  28432. 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) {
  28433. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  28434. }
  28435. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  28436. var enc uintptr
  28437. _ = enc
  28438. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  28439. if enc != 0 {
  28440. *(*uint8)(unsafe.Pointer(enc + 72 + 58)) = uint8(_BT_COLON)
  28441. }
  28442. return enc
  28443. }
  28444. func __ccgo_fp(f interface{}) uintptr {
  28445. type iface [2]uintptr
  28446. return (*iface)(unsafe.Pointer(&f))[1]
  28447. }
  28448. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  28449. 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 (+%6d 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"